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