From 367aeb7897cf446d06d733b3f1e82da724a3db3a 2012-03-22 12:49:58 From: Jani Honkonen Date: 2012-03-22 12:49:58 Subject: [PATCH] Set the first pie slice exploded and label visible in chartthemes demo --- diff --git a/demos/chartthemes/main.cpp b/demos/chartthemes/main.cpp index 142ca26..8ad098f 100644 --- a/demos/chartthemes/main.cpp +++ b/demos/chartthemes/main.cpp @@ -47,7 +47,7 @@ public: DataList dataList; for (int j(0); j < valueCount; j++) { QPointF value(j + (qreal) rand() / (qreal) RAND_MAX, qrand() % valueMax); - QString label = QString::number(i) + ":" + QString::number(j); + QString label = "Item " + QString::number(i) + ":" + QString::number(j); dataList << Data(value, label); } m_dataTable << dataList; @@ -138,8 +138,13 @@ public: qreal pieSize = 1.0 / m_dataTable.count(); for (int i=0; iadd(data.first.y(), data.second); + foreach (Data data, m_dataTable[i]) { + QPieSlice *slice = series->add(data.first.y(), data.second); + if (data == m_dataTable[i].first()) { + slice->setLabelVisible(); + slice->setExploded(); + } + } qreal hPos = (pieSize / 2) + (i / (qreal) m_dataTable.count()); series->setPieSize(pieSize); series->setPiePosition(hPos, 0.5);