##// END OF EJS Templates
scale datetime chart in chartviewer
Michal Klocek -
r2125:b0cf5101659d
parent child
Show More
@@ -38,14 +38,16 public:
38 38 QValueAxis *valueaxis = new QValueAxis();
39 39 QDateTimeAxis *datetimeaxis = new QDateTimeAxis();
40 40 datetimeaxis->setTickCount(10);
41 datetimeaxis->setFormat("MMM yyyy");
41 datetimeaxis->setFormat("yyyy");
42 42
43 43 QString name("Series ");
44 44 int nameIndex = 0;
45 45 foreach (DataList list, table) {
46 46 QLineSeries *series = new QLineSeries(chart);
47 foreach (Data data, list)
48 series->append(data.first);
47 foreach (Data data, list){
48 QPointF point = data.first;
49 series->append(1000l*60l*60l*24l*365l*30l+point.x()*1000l*60l*60l*24l*365l,point.y());
50 }
49 51 series->setName(name + QString::number(nameIndex));
50 52 nameIndex++;
51 53 chart->addSeries(series);
@@ -23,6 +23,7
23 23 #include "chartdatetimeaxisx_p.h"
24 24 #include "chartdatetimeaxisy_p.h"
25 25 #include "domain_p.h"
26 #include <float.h>
26 27 #include <cmath>
27 28
28 29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now