@@ -1,6 +1,7 | |||
|
1 | 1 | #include "qchart.h" |
|
2 | 2 | #include "qchartseries.h" |
|
3 | 3 | #include "xylinechartitem_p.h" |
|
4 | #include "xyplotdata_p.h" | |
|
4 | 5 | #include "axis_p.h" |
|
5 | 6 | #include "xygrid_p.h" |
|
6 | 7 | #include <QDebug> |
@@ -18,19 +19,21 m_plotDataIndex(0) | |||
|
18 | 19 | // set axis |
|
19 | 20 | m_axisY->rotate(90); |
|
20 | 21 | |
|
21 | XYPlotData data; | |
|
22 | data.m_minX = 0.0; | |
|
23 | data.m_maxX = 100.0; | |
|
24 |
data |
|
|
25 |
data |
|
|
26 |
data |
|
|
27 |
data |
|
|
22 | ||
|
23 | //TODO hardcoded values , to removed soon | |
|
24 | XYPlotData* data = new XYPlotData(); | |
|
25 | data->m_minX = 0.0; | |
|
26 | data->m_maxX = 100.0; | |
|
27 | data->m_minY = 0.0; | |
|
28 | data->m_maxY = 100.0; | |
|
29 | data->m_ticksX=4; | |
|
30 | data->m_ticksY=4; | |
|
28 | 31 | |
|
29 | 32 | m_plotDataList.clear(); |
|
30 | 33 | m_plotDataList << data; |
|
31 | 34 | |
|
32 | 35 | m_grid->setZValue(10); |
|
33 | m_grid->setXYPlotData(m_plotDataList.at(0)); | |
|
36 | m_grid->setXYPlotData(*m_plotDataList.at(0)); | |
|
34 | 37 | } |
|
35 | 38 | |
|
36 | 39 | QChart::~QChart(){} |
@@ -47,9 +50,8 void QChart::addSeries(QChartSeries* series) | |||
|
47 | 50 | switch(series->type()) |
|
48 | 51 | { |
|
49 | 52 | case QChartSeries::LINE: |
|
50 | qDebug()<<"xyline added"; | |
|
51 | 53 | XYLineChartItem* item = new XYLineChartItem(reinterpret_cast<QXYChartSeries*>(series),this); |
|
52 | item->setXYPlotData(m_plotDataList.at(0)); | |
|
54 | item->setXYPlotData(*m_plotDataList.at(0)); | |
|
53 | 55 | m_items<<item; |
|
54 | 56 | break; |
|
55 | 57 | } |
@@ -2,8 +2,6 | |||
|
2 | 2 | #define CHART_H |
|
3 | 3 | |
|
4 | 4 | #include <qchartconfig.h> |
|
5 | //TODO: temporary class | |
|
6 | #include <xyplotdata_p.h> | |
|
7 | 5 | #include <QGraphicsItem> |
|
8 | 6 | |
|
9 | 7 | QCHART_BEGIN_NAMESPACE |
@@ -11,6 +9,7 QCHART_BEGIN_NAMESPACE | |||
|
11 | 9 | class Axis; |
|
12 | 10 | class XYGrid; |
|
13 | 11 | class QChartSeries; |
|
12 | class XYPlotData; | |
|
14 | 13 | |
|
15 | 14 | class QCHART_EXPORT QChart : public QGraphicsItem |
|
16 | 15 | { |
@@ -35,7 +34,7 private: | |||
|
35 | 34 | Axis* m_axisX; |
|
36 | 35 | Axis* m_axisY; |
|
37 | 36 | XYGrid* m_grid; |
|
38 | QList<XYPlotData> m_plotDataList; | |
|
37 | QList<XYPlotData*> m_plotDataList; | |
|
39 | 38 | QList<QGraphicsItem*> m_items; |
|
40 | 39 | int m_plotDataIndex; |
|
41 | 40 | int m_marginSize; |
@@ -16,6 +16,7 SOURCES += \ | |||
|
16 | 16 | |
|
17 | 17 | PRIVATE_HEADERS += \ |
|
18 | 18 | xylinechart/xylinechartitem_p.h \ |
|
19 | xylinechart/xyplotdata_p.h \# to be removed | |
|
19 | 20 | xylinechart/xygrid_p.h \ |
|
20 | 21 | axis_p.h |
|
21 | 22 | |
@@ -24,8 +25,7 PUBLIC_HEADERS += \ | |||
|
24 | 25 | qchart.h \ |
|
25 | 26 | qchartwidget.h \ |
|
26 | 27 | qchartconfig.h \ |
|
27 |
xylinechart/qxychartseries.h |
|
|
28 | xylinechart/xyplotdata_p.h # to be removed | |
|
28 | xylinechart/qxychartseries.h | |
|
29 | 29 | |
|
30 | 30 | HEADERS += $$PUBLIC_HEADERS |
|
31 | 31 | HEADERS += $$PRIVATE_HEADERS |
General Comments 0
You need to be logged in to leave comments.
Login now