@@ -42,33 +42,36 int main(int argc, char *argv[]) | |||
|
42 | 42 | |
|
43 | 43 | QLinearGradient backgroundGradient; |
|
44 | 44 | backgroundGradient.setColorAt(0.0, Qt::white); |
|
45 |
backgroundGradient.setColorAt(1.0, Q |
|
|
45 | backgroundGradient.setColorAt(1.0, Qt::white); | |
|
46 | 46 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
47 | 47 | chartView->setChartBackgroundBrush(backgroundGradient); |
|
48 | 48 | |
|
49 | 49 | QChartAxis* axisX = chartView->axisX(); |
|
50 | 50 | axisX->setLabelsAngle(45); |
|
51 |
axisX->setGridLinePen( |
|
|
51 | axisX->setGridLinePen(red); | |
|
52 | axisX->setGridLineVisible(false); | |
|
53 | axisX->setShadesVisible(true); | |
|
52 | 54 | |
|
53 | 55 | QChartAxisCategories* categoriesX = axisX->categories(); |
|
54 | 56 | categoriesX->insert(0,"low"); |
|
55 | 57 | categoriesX->insert(50,"medium"); |
|
56 | 58 | categoriesX->insert(100,"High"); |
|
57 | 59 | |
|
58 | axisX->setMin(-10); | |
|
59 | axisX->setMax(2200); | |
|
60 | // axisX->setMin(-10); | |
|
61 | // axisX->setMax(2200); | |
|
60 | 62 | |
|
61 | 63 | QChartAxis* axisY = chartView->axisY(); |
|
62 | 64 | axisY->setLabelsAngle(45); |
|
63 | 65 | axisY->setShadesBrush(Qt::yellow); |
|
66 | axisY->setGridLineVisible(false); | |
|
64 | 67 | |
|
65 | 68 | QChartAxisCategories* categoriesY = axisY->categories(); |
|
66 | 69 | categoriesY->insert(0,"low"); |
|
67 | 70 | categoriesY->insert(50,"medium"); |
|
68 | 71 | categoriesY->insert(100,"High"); |
|
69 | 72 | |
|
70 | axisY->setMin(-10); | |
|
71 | axisY->setMax(200); | |
|
73 | // axisY->setMin(-10); | |
|
74 | // axisY->setMax(200); | |
|
72 | 75 | |
|
73 | 76 | window.setCentralWidget(chartView); |
|
74 | 77 | window.resize(400, 300); |
@@ -70,6 +70,7 void QLegend::handleSeriesAdded(QSeries* series,Domain* domain) | |||
|
70 | 70 | |
|
71 | 71 | QAreaSeries* areaSeries = static_cast<QAreaSeries*>(series); |
|
72 | 72 | createMarker(areaSeries->upperSeries()); |
|
73 | if(areaSeries->lowerSeries()) | |
|
73 | 74 | createMarker(areaSeries->lowerSeries()); |
|
74 | 75 | break; |
|
75 | 76 | } |
@@ -190,8 +191,6 void QLegend::layoutChanged() | |||
|
190 | 191 | qreal x = mBoundingRect.x() + 5; |
|
191 | 192 | qreal y = mBoundingRect.y() + (mBoundingRect.height() - markerSize.height())/2; |
|
192 | 193 | foreach (LegendMarker* m, mMarkers) { |
|
193 | qDebug() << "marker x:" << x; | |
|
194 | qDebug() << "marker y:" << y; | |
|
195 | 194 | m->setBoundingRect(QRectF(x,y,markerSize.width(),markerSize.height())); |
|
196 | 195 | x += xStep; |
|
197 | 196 | } |
General Comments 0
You need to be logged in to leave comments.
Login now