From d693628c68fbcbd587c4fd9bbd12443d7e8da5d7 2012-02-06 13:26:52 From: Tero Ahola Date: 2012-02-06 13:26:52 Subject: [PATCH] tuning theme colors --- diff --git a/qmlplugin/declarativechart.h b/qmlplugin/declarativechart.h index cef5a05..f2d0b1f 100644 --- a/qmlplugin/declarativechart.h +++ b/qmlplugin/declarativechart.h @@ -22,7 +22,7 @@ public: ThemeVanilla, ThemeIcy, ThemeGrayscale, - //ThemeScientific, + ThemeScientific, ThemeUnnamed1 }; DeclarativeChart(QDeclarativeItem *parent = 0); diff --git a/src/charttheme.cpp b/src/charttheme.cpp index 1340c80..795d592 100644 --- a/src/charttheme.cpp +++ b/src/charttheme.cpp @@ -33,26 +33,32 @@ void ChartThemeData::setTheme(int theme) m_gradientEndColor = QColor(QRgb(0xffafafaf)); break; case QChart::ChartThemeIcy: - m_seriesThemes.append(SeriesTheme(QColor(0, 3, 165), 2)); - m_seriesThemes.append(SeriesTheme(QColor(49, 52, 123), 2)); - m_seriesThemes.append(SeriesTheme(QColor(71, 114, 187), 2)); - m_seriesThemes.append(SeriesTheme(QColor(48, 97, 87), 2)); - m_seriesThemes.append(SeriesTheme(QColor(19, 71, 90), 2)); - m_seriesThemes.append(SeriesTheme(QColor(110, 70, 228), 2)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFF0D2673), 2)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFF2685BF), 2)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFF3DADD9), 3)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFF62C3D9), 2)); - m_gradientStartColor = QColor(QRgb(0xffe4ffff)); - m_gradientEndColor = QColor(QRgb(0xffe4ffff)); + m_gradientStartColor = QColor(QRgb(0xffBDE3F2)); + m_gradientEndColor = QColor(QRgb(0xffafafaf)); break; case QChart::ChartThemeGrayscale: - m_seriesThemes.append(SeriesTheme(QColor(0, 0, 0), 2)); - m_seriesThemes.append(SeriesTheme(QColor(50, 50, 50), 2)); - m_seriesThemes.append(SeriesTheme(QColor(100, 100, 100), 2)); - m_seriesThemes.append(SeriesTheme(QColor(140, 140, 140), 2)); - m_seriesThemes.append(SeriesTheme(QColor(180, 180, 180), 2)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFF869299), 2)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFFA5BDCC), 2)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFFE8FFFC), 3)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFFCCC2C2), 2)); m_gradientStartColor = QColor(QRgb(0xffffffff)); m_gradientEndColor = QColor(QRgb(0xffafafaf)); break; + case QChart::ChartThemeScientific: + m_seriesThemes.append(SeriesTheme(QRgb(0xFF000000), 3)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFFFFAD00), 2)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFF596A75), 2)); + m_seriesThemes.append(SeriesTheme(QRgb(0xFF474747), 2)); + + m_gradientStartColor = QColor(QRgb(0xffafafaf)); + m_gradientEndColor = QColor(QRgb(0xffafafaf)); + break; case QChart::ChartThemeUnnamed1: m_seriesThemes.append(SeriesTheme(QColor(QRgb(0xff3fa9f5)), 2)); m_seriesThemes.append(SeriesTheme(QColor(QRgb(0xff7AC943)), 2)); diff --git a/src/qchart.h b/src/qchart.h index 5a1daee..5858d85 100644 --- a/src/qchart.h +++ b/src/qchart.h @@ -42,7 +42,7 @@ public: ChartThemeVanilla, ChartThemeIcy, ChartThemeGrayscale, - //ChartThemeScientific, + ChartThemeScientific, ChartThemeUnnamed1 }; diff --git a/test/chartwidgettest/mainwidget.cpp b/test/chartwidgettest/mainwidget.cpp index 703ebac..4ce0e03 100644 --- a/test/chartwidgettest/mainwidget.cpp +++ b/test/chartwidgettest/mainwidget.cpp @@ -124,6 +124,7 @@ void MainWidget::initThemeCombo(QGridLayout *grid) chartTheme->addItem("Vanilla"); chartTheme->addItem("Icy"); chartTheme->addItem("Grayscale"); + chartTheme->addItem("Scientific"); chartTheme->addItem("Unnamed1"); connect(chartTheme, SIGNAL(currentIndexChanged(int)), this, SLOT(changeChartTheme(int))); diff --git a/test/qmlchart/qml/qmlchart/main.qml b/test/qmlchart/qml/qmlchart/main.qml index e068b65..cc63236 100644 --- a/test/qmlchart/qml/qmlchart/main.qml +++ b/test/qmlchart/qml/qmlchart/main.qml @@ -9,52 +9,6 @@ Rectangle { anchors.centerIn: parent } -// Component.onCompleted: { -// for (var i = 0.0; i < 100.0; i += 0.1) { -// var x = i + Math.random() * 5; -// var y = Math.abs(Math.sin(3.14159 / 50 * x) * 100) + (Math.random() * 5); -// myData.append({'x':x, 'y':y}); -// } -// } - -// ChartModel { -// id: chartData -// ChartElement { -// y: 1.2 -// } -// ChartElement { -// x: 1.1 -// y: 1.2 -// } -// ChartElement { -// label: "February" -// y: 1.2 -// } -// ChartElement { -// label: "January" -// x: 0.2 -// y: 2.1 -// } -// } - -// Series { -// model: chartData -// seriesType: pie -// axis: Series.AxisSecondaryY -// } - - ListModel { - id: myData - ListElement { - nnn: 55.2 - mmm: 13.1 - } - ListElement { - nnn: 15.3 - mmm: 3.4 - } - } - Chart { anchors.fill: parent theme: Chart.ThemeIcy