diff --git a/src/charttheme.cpp b/src/charttheme.cpp index 8c091f9..892fb75 100644 --- a/src/charttheme.cpp +++ b/src/charttheme.cpp @@ -93,20 +93,30 @@ void ChartTheme::decorate(QLegend* legend) void ChartTheme::decorate(QAreaSeries* series, int index) { - QPen pen(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1.0)); - pen.setWidthF(2); - series->setPen(pen); + QPen pen; + QBrush brush; - QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); - series->setBrush(brush); + if (pen == series->pen()){ + pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1.0)); + pen.setWidthF(2); + series->setPen(pen); + } + + if (brush == series->brush()) { + QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); + series->setBrush(brush); + } } void ChartTheme::decorate(QLineSeries* series,int index) { - QPen pen(m_seriesColors.at(index%m_seriesColors.size())); - pen.setWidthF(2); - series->setPen(pen); + QPen pen; + if(pen == series->pen()){ + pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); + pen.setWidthF(2); + series->setPen(pen); + } } void ChartTheme::decorate(QBarSeries* series,int index) @@ -171,12 +181,20 @@ void ChartTheme::decorate(QPercentBarSeries* series,int index) void ChartTheme::decorate(QScatterSeries* series, int index) { - QPen pen(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1.0)); - pen.setWidthF(2); - series->setPen(pen); - QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); - series->setBrush(brush); + QPen pen; + QBrush brush; + + if (pen == series->pen()) { + pen.setColor(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1.0)); + pen.setWidthF(2); + series->setPen(pen); + } + + if (brush == series->brush()) { + QBrush brush(m_seriesColors.at(index % m_seriesColors.size())); + series->setBrush(brush); + } } void ChartTheme::decorate(QPieSeries* series, int index) @@ -193,9 +211,12 @@ void ChartTheme::decorate(QPieSeries* series, int index) void ChartTheme::decorate(QSplineSeries* series, int index) { - QPen pen(m_seriesColors.at(index%m_seriesColors.size())); - pen.setWidthF(2); - series->setPen(pen); + QPen pen; + if(pen == series->pen()){ + pen.setColor(m_seriesColors.at(index%m_seriesColors.size())); + pen.setWidthF(2); + series->setPen(pen); + } } void ChartTheme::decorate(QChartAxis* axis,bool axisX)