From abde8123ae7148faf70f4dffd5ca69879c7d0e6d 2012-03-08 13:12:02 From: Tero Ahola Date: 2012-03-08 13:12:02 Subject: [PATCH] Pie pen now uses gradient start color --- diff --git a/src/charttheme.cpp b/src/charttheme.cpp index 5a74ba6..8e6e06f 100644 --- a/src/charttheme.cpp +++ b/src/charttheme.cpp @@ -205,9 +205,10 @@ void ChartTheme::decorate(PiePresenter* item, QPieSeries* series, int count) // Get color for a slice from a gradient linearly, beginning from the start of the gradient for (int i(0); i < series->slices().count(); i++) { qreal pos = (qreal) i / (qreal) series->count(); - QColor c = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), pos); - series->slices().at(i)->setSlicePen(c); - series->slices().at(i)->setSliceBrush(c); + QColor penColor = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), 0.1); + series->slices().at(i)->setSlicePen(penColor); + QColor brushColor = colorAt(m_seriesGradients.at(count % m_seriesGradients.size()), pos); + series->slices().at(i)->setSliceBrush(brushColor); } } diff --git a/test/chartwidgettest/mainwidget.cpp b/test/chartwidgettest/mainwidget.cpp index 94bf96c..cff07cf 100644 --- a/test/chartwidgettest/mainwidget.cpp +++ b/test/chartwidgettest/mainwidget.cpp @@ -168,7 +168,7 @@ QList MainWidget::generateTestData(int columnCount, int rowCount, QStr } else if (dataCharacteristics == "Sin + random") { newColumn.append(abs(sin(3.14159265358979 / 50 * i) * 100) + (rand() % 5)); } else if (dataCharacteristics == "Random") { - newColumn.append(rand() % 5); + newColumn.append(rand() % 10 + (qreal) rand() / (qreal) RAND_MAX); } else if (dataCharacteristics == "Linear") { //newColumn.append(i * (j + 1.0)); // TODO: temporary hack to make pie work; prevent zero values: