##// END OF EJS Templates
Added ChartView.plotArea to QML API
Tero Ahola -
r1929:0db37e179fcd
parent child
Show More
@@ -138,7 +138,18 QTCOMMERCIALCHART_BEGIN_NAMESPACE
138
138
139 /*!
139 /*!
140 \qmlproperty Margins ChartView::minimumMargins
140 \qmlproperty Margins ChartView::minimumMargins
141 The minimum margins allowed between the outer bounds and the plotArea of the ChartView.
141 The minimum margins allowed between the outer bounds and the plotArea of the ChartView. Margins
142 area of ChartView is used for drawing title, axes and legend. Please note that setting the
143 properties of minimumMargins may be bigger than the defined value, depending on other ChartView
144 properties that affect it's layout. If you need to know the actual plotting area used at any
145 given time, you can check ChartView::plotArea instead.
146 */
147
148 /*!
149 \qmlproperty rect ChartView::plotArea
150 The area on the ChartView that is used for drawing series. This is the ChartView rect without the
151 margins.
152 \sa ChartView::minimumMargins
142 */
153 */
143
154
144 /*!
155 /*!
@@ -236,6 +247,7 DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
236 void DeclarativeChart::changeMinimumMargins(int top, int bottom, int left, int right)
247 void DeclarativeChart::changeMinimumMargins(int top, int bottom, int left, int right)
237 {
248 {
238 m_chart->setMinimumMargins(QMargins(left, top, right, bottom));
249 m_chart->setMinimumMargins(QMargins(left, top, right, bottom));
250 plotAreaChanged(m_chart->plotArea());
239 }
251 }
240
252
241 DeclarativeChart::~DeclarativeChart()
253 DeclarativeChart::~DeclarativeChart()
@@ -46,6 +46,7 class DeclarativeChart : public QDeclarativeItem
46 Q_PROPERTY(qreal leftMargin READ leftMargin NOTIFY leftMarginChanged)
46 Q_PROPERTY(qreal leftMargin READ leftMargin NOTIFY leftMarginChanged)
47 Q_PROPERTY(qreal rightMargin READ rightMargin NOTIFY rightMarginChanged)
47 Q_PROPERTY(qreal rightMargin READ rightMargin NOTIFY rightMarginChanged)
48 Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins REVISION 1)
48 Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins REVISION 1)
49 Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1)
49 Q_ENUMS(Animation)
50 Q_ENUMS(Animation)
50 Q_ENUMS(Theme)
51 Q_ENUMS(Theme)
51 Q_ENUMS(SeriesType)
52 Q_ENUMS(SeriesType)
@@ -115,6 +116,7 public:
115 qreal rightMargin();
116 qreal rightMargin();
116 void createDefaultAxes(QAbstractSeries* series);
117 void createDefaultAxes(QAbstractSeries* series);
117 DeclarativeMargins *minimumMargins() { return m_minMargins; }
118 DeclarativeMargins *minimumMargins() { return m_minMargins; }
119 QRectF plotArea() { return m_chart->plotArea(); }
118
120
119 public:
121 public:
120 Q_INVOKABLE QAbstractSeries *series(int index);
122 Q_INVOKABLE QAbstractSeries *series(int index);
@@ -141,6 +143,7 Q_SIGNALS:
141 void bottomMarginChanged(qreal margin);
143 void bottomMarginChanged(qreal margin);
142 void leftMarginChanged(qreal margin);
144 void leftMarginChanged(qreal margin);
143 void rightMarginChanged(qreal margin);
145 void rightMarginChanged(qreal margin);
146 void plotAreaChanged(QRectF plotArea);
144
147
145 public Q_SLOTS:
148 public Q_SLOTS:
146 // void handleMarginsChanged(QRectF newMargins);
149 // void handleMarginsChanged(QRectF newMargins);
@@ -64,10 +64,11 ChartView {
64 legend.onColorChanged: console.log("legend.onColorChanged: " + color);
64 legend.onColorChanged: console.log("legend.onColorChanged: " + color);
65 legend.onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color);
65 legend.onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color);
66 legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color);
66 legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color);
67 minimumMargins.onTopChanged: console.log("chart.minimumMargins.onTopChanged: " + top);
67 minimumMargins.onTopChanged: console.log("chart.minimumMargins.onTopChanged: " + top );
68 minimumMargins.onBottomChanged: console.log("chart.minimumMargins.onBottomChanged: " + bottom);
68 minimumMargins.onBottomChanged: console.log("chart.minimumMargins.onBottomChanged: " + bottom + " " + chartView.plotArea.height);
69 minimumMargins.onLeftChanged: console.log("chart.minimumMargins.onLeftChanged: " + left);
69 minimumMargins.onLeftChanged: console.log("chart.minimumMargins.onLeftChanged: " + left + " " + chartView.plotArea.left);
70 minimumMargins.onRightChanged: console.log("chart.minimumMargins.onRightChanged: " + right);
70 minimumMargins.onRightChanged: console.log("chart.minimumMargins.onRightChanged: " + right + " " + chartView.plotArea.right);
71 onPlotAreaChanged: console.log("chart.onPlotAreaChanged, width:" + chartView.plotArea.width + " height: " + chartView.plotArea.height + " y: " + chartView.plotArea.y + " x: " + chartView.plotArea.x);
71
72
72 ValueAxis{
73 ValueAxis{
73 onColorChanged: console.log("axisX.onColorChanged: " + color);
74 onColorChanged: console.log("axisX.onColorChanged: " + color);
General Comments 0
You need to be logged in to leave comments. Login now