NightCharts(Draw Charts)

Qt Widgets

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

2
Become a Fan
6.4

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:aintEvent(QPaintEvent e*)
{
QWidget:aintEvent(e);
QPainter painter;
QFont font;
painter.begin(this);
Nightcharts PieChart;
PieChart.setType(Nightcharts:Pie);//{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

Ratings & Comments

8 Comments

Casilio

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."?

aijagluk

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

aijagluk

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

blueliuyun

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

Nightmaster

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

HelderC

Will be great if the chart can autoresize itself. Anyway, nice work man! Congratulations!

dridk

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.

arnodupuis

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

Pling
0 Affiliates
Details
license
version 0.1a
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 1

Other Qt Widgets:

Widget Virtual Keyboard
embitel
last update date: 15 years ago

Score 5.3

Widget Marquee Label
embitel
last update date: 15 years ago

Score 6.1

Widget Color Picker
embitel
last update date: 15 years ago

Score 4.7

QtitanDataGrid advanced Grid for Qt
BigZ1
last update date: 7 years ago

Score 5.7

QtitanRibbon Microsoft RibbonUI and Office Styles for Qt
BigZ1
last update date: 7 years ago

Score 5.2

Q7TaskBar
QDevelopper
last update date: 13 years ago

Score 6.1