NightCharts(Draw Charts)
Qt Widgets
Score 61%
Description:

Introducing the class for drawing charts.
This class includes a drawing histogram, pies and pseudo 3D pies.
It has very simple API and high level usability.
Licensed under LGPL 2.1

Example :
void MainWindow::paintEvent(QPaintEvent e*)
{
QWidget::paintEvent(e);
QPainter painter;
QFont font;
painter.begin(this);
Nightcharts PieChart;
PieChart.setType(Nightcharts::DPie);//{Histogramm,Pie,DPie};
PieChart.setLegendType(Nightcharts::Round);//{Round,Vertical}
PieChart.setCords(100,100,this->width()/1.5,this->height()/1.5);
PieChart.addPiece("Item1",QColor(200,10,50),34);
PieChart.addPiece("Item2",Qt::green,27);
PieChart.addPiece("Item3",Qt::cyan,14);
PieChart.addPiece("Item4",Qt::yellow,7);
PieChart.addPiece("Item5",Qt::blue,4);
PieChart.draw(&painter);
PieChart.drawLegend(&painter);
}

Updated : remove memory leak;

Initial angle can be set. so if you change it you can achieve the effect of motion of pie on its axis.

var : palpha = ;

Updated : Now the vertical legend has its own coordinates.
Use Nightcharts::setLegendCords(double x,double y);
Also changed rendering 3d Pie by removing the black frame. His screenshot was updated.

Updated : Added new option : Nightcharts::setShadows(bool);
Also changed rendering histogram and normal pie. Screenshots was updated.

Updated(2010/09/16) : Now when you create object does not need to pass QPainter; it is transmitted only in the methods draw/drawLegend. Also removed all memory leaks.

Updated(2015/04/01) : Posted code to github and soon there will be two new types of charts
(https://github.com/Nightmeister/nightcharts)

Write about found bugs please

Casilio

2 years ago

I run example and it work fine. But if I try write something like this:
Quote:void MainWindow::on_pushButton_clicked()
{
PieChart->addPiece("dfgfg", Qt::black,10);
PieChart->draw(painter);
}
I've had message "The program has unexpectedly finished."?

Report

aijagluk

5 years ago

Function "drawLegend" must return some value.
Thanks for your job!

Report

aijagluk

5 years ago

Function "drawLegend" must return some value.
Thanks for your job!

Report

blueliuyun

6 years ago

Thank you for your code, I think this is greatly beautiful!

Report

C

Nightmaster

6 years ago

class moves into a new project. This will be a serious library for qt.
Easy to use will be saved :)

Report

HelderC

6 years ago

Will be great if the chart can autoresize itself.

Anyway, nice work man! Congratulations!

Report

dridk

6 years ago

Really cool!

I m waiting LineChart to make nice curves and more.
I suggest to get inspiration from here : http://code.google.com/intl/fr-FR/apis/chart/

I already post a message here : http://www.qtcentre.org/threads/37703-Qt-Charts-API-create-static-and-animating-charts-for-your-application?p=173322&highlight=#post173322


Maybe we can join our force.
Please upload your code on a repository like gitorious.

Report

arnodupuis

6 years ago

Agreed ! And a little doc would not hurt ;-)

Report

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
Details
version
0.1a
updated Mar 31 2015
added Sep 13 2010
downloads today
1
page views today 1