@@ -47,7 +47,7 public: | |||||
47 | DataList dataList; |
|
47 | DataList dataList; | |
48 | for (int j(0); j < valueCount; j++) { |
|
48 | for (int j(0); j < valueCount; j++) { | |
49 | QPointF value(j + (qreal) rand() / (qreal) RAND_MAX, qrand() % valueMax); |
|
49 | QPointF value(j + (qreal) rand() / (qreal) RAND_MAX, qrand() % valueMax); | |
50 | QString label = QString::number(i) + ":" + QString::number(j); |
|
50 | QString label = "Item " + QString::number(i) + ":" + QString::number(j); | |
51 | dataList << Data(value, label); |
|
51 | dataList << Data(value, label); | |
52 | } |
|
52 | } | |
53 | m_dataTable << dataList; |
|
53 | m_dataTable << dataList; | |
@@ -138,8 +138,13 public: | |||||
138 | qreal pieSize = 1.0 / m_dataTable.count(); |
|
138 | qreal pieSize = 1.0 / m_dataTable.count(); | |
139 | for (int i=0; i<m_dataTable.count(); i++) { |
|
139 | for (int i=0; i<m_dataTable.count(); i++) { | |
140 | QPieSeries *series = new QPieSeries(chart); |
|
140 | QPieSeries *series = new QPieSeries(chart); | |
141 | foreach (Data data, m_dataTable[i]) |
|
141 | foreach (Data data, m_dataTable[i]) { | |
142 | series->add(data.first.y(), data.second); |
|
142 | QPieSlice *slice = series->add(data.first.y(), data.second); | |
|
143 | if (data == m_dataTable[i].first()) { | |||
|
144 | slice->setLabelVisible(); | |||
|
145 | slice->setExploded(); | |||
|
146 | } | |||
|
147 | } | |||
143 | qreal hPos = (pieSize / 2) + (i / (qreal) m_dataTable.count()); |
|
148 | qreal hPos = (pieSize / 2) + (i / (qreal) m_dataTable.count()); | |
144 | series->setPieSize(pieSize); |
|
149 | series->setPieSize(pieSize); | |
145 | series->setPiePosition(hPos, 0.5); |
|
150 | series->setPiePosition(hPos, 0.5); |
General Comments 0
You need to be logged in to leave comments.
Login now