@@ -138,7 +138,18 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
138 | 138 | |
|
139 | 139 | /*! |
|
140 | 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 | 247 | void DeclarativeChart::changeMinimumMargins(int top, int bottom, int left, int right) |
|
237 | 248 | { |
|
238 | 249 | m_chart->setMinimumMargins(QMargins(left, top, right, bottom)); |
|
250 | plotAreaChanged(m_chart->plotArea()); | |
|
239 | 251 | } |
|
240 | 252 | |
|
241 | 253 | DeclarativeChart::~DeclarativeChart() |
@@ -46,6 +46,7 class DeclarativeChart : public QDeclarativeItem | |||
|
46 | 46 | Q_PROPERTY(qreal leftMargin READ leftMargin NOTIFY leftMarginChanged) |
|
47 | 47 | Q_PROPERTY(qreal rightMargin READ rightMargin NOTIFY rightMarginChanged) |
|
48 | 48 | Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins REVISION 1) |
|
49 | Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1) | |
|
49 | 50 | Q_ENUMS(Animation) |
|
50 | 51 | Q_ENUMS(Theme) |
|
51 | 52 | Q_ENUMS(SeriesType) |
@@ -115,6 +116,7 public: | |||
|
115 | 116 | qreal rightMargin(); |
|
116 | 117 | void createDefaultAxes(QAbstractSeries* series); |
|
117 | 118 | DeclarativeMargins *minimumMargins() { return m_minMargins; } |
|
119 | QRectF plotArea() { return m_chart->plotArea(); } | |
|
118 | 120 | |
|
119 | 121 | public: |
|
120 | 122 | Q_INVOKABLE QAbstractSeries *series(int index); |
@@ -141,6 +143,7 Q_SIGNALS: | |||
|
141 | 143 | void bottomMarginChanged(qreal margin); |
|
142 | 144 | void leftMarginChanged(qreal margin); |
|
143 | 145 | void rightMarginChanged(qreal margin); |
|
146 | void plotAreaChanged(QRectF plotArea); | |
|
144 | 147 | |
|
145 | 148 | public Q_SLOTS: |
|
146 | 149 | // void handleMarginsChanged(QRectF newMargins); |
@@ -64,10 +64,11 ChartView { | |||
|
64 | 64 | legend.onColorChanged: console.log("legend.onColorChanged: " + color); |
|
65 | 65 | legend.onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color); |
|
66 | 66 | legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color); |
|
67 | minimumMargins.onTopChanged: console.log("chart.minimumMargins.onTopChanged: " + top); | |
|
68 | minimumMargins.onBottomChanged: console.log("chart.minimumMargins.onBottomChanged: " + bottom); | |
|
69 | minimumMargins.onLeftChanged: console.log("chart.minimumMargins.onLeftChanged: " + left); | |
|
70 | minimumMargins.onRightChanged: console.log("chart.minimumMargins.onRightChanged: " + right); | |
|
67 | minimumMargins.onTopChanged: console.log("chart.minimumMargins.onTopChanged: " + top ); | |
|
68 | minimumMargins.onBottomChanged: console.log("chart.minimumMargins.onBottomChanged: " + bottom + " " + chartView.plotArea.height); | |
|
69 | minimumMargins.onLeftChanged: console.log("chart.minimumMargins.onLeftChanged: " + left + " " + chartView.plotArea.left); | |
|
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 | 73 | ValueAxis{ |
|
73 | 74 | onColorChanged: console.log("axisX.onColorChanged: " + color); |
General Comments 0
You need to be logged in to leave comments.
Login now