summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTitta Heikkala <titta.heikkala@digia.com>2014-07-01 07:10:00 +0300
committerTitta Heikkala <titta.heikkala@theqtcompany.com>2014-10-14 13:04:52 +0300
commitc544258484ff4fd5d2b88402fbaa5d154b89a3a2 (patch)
tree7659625abb566dec55d3783ed820b928542d9b2b
parent76339f714f088645e911cee65bdb66055fe029aa (diff)
Qt Charts project file structure change
Charts repository structure is changed to follow the structure of a Qt Add-On module. The task includes following changes: - All macros and definitions named 'commercial' have been renamed. - Compile errors related to QString and qSort usage have been fixed. - Old demos are moved under examples. The QML examples now support only Qt Quick 2.0, the support for Qt Quick 1 is removed. - The QML examples with multiple views are updated so that they are usable also with touch devices. - Unnecessary version checks are removed from examples. - The build stamp has been removed as it was only meant for Charts development purposes and it's no longer needed. Also development build related debug prints are removed as __DATE__ can't be used for all OS thus it doesn't make much sense. - Documentation structure has been updated based on the new module structure. The raw HTML files have been removed. Demos are combined to examples. - Unnecessary .qdocinc files are no longer needed. The content is moved to the corresponding .cpp files. - The Charts widget designer plugin is updated according to the module change. - The test cases updated according to the project structure change. Tests are added also for version 2.0. - cmake modules generation is not needed with Qt 5.4 and Qt Charts so it's disabled. - The new module name and version are updated to the plugin.qmltypes file. Task-number: QTRD-2844, QTRD-3217, QTRD-3218, QTRD-3277, QTRD-3228, QTRD-2526, QTRD-3233, QTRD-3222 Change-Id: Ib7fb26057cde710ffaf6bc780c8bf52a16f45160 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
-rw-r--r--.qmake.conf4
-rw-r--r--charts.pro91
-rw-r--r--config.pri127
-rw-r--r--demos/audio/audio.pro13
-rw-r--r--demos/audio/widget.cpp82
-rw-r--r--demos/audio/widget.h52
-rw-r--r--demos/audio/xyseriesiodevice.h47
-rw-r--r--demos/callout/callout.pro15
-rw-r--r--demos/callout/view.h59
-rw-r--r--demos/chartinteractions/chart.h53
-rw-r--r--demos/chartinteractions/chartinteractions.pro9
-rw-r--r--demos/chartinteractions/chartview.h45
-rw-r--r--demos/chartinteractions/main.cpp74
-rw-r--r--demos/chartthemes/chartthemes.pro4
-rw-r--r--demos/chartthemes/themewidget.h77
-rw-r--r--demos/demos.pri39
-rw-r--r--demos/demos.pro34
-rw-r--r--demos/dynamicspline/chart.h56
-rw-r--r--demos/dynamicspline/dynamicspline.pro4
-rw-r--r--demos/dynamicspline/main.cpp42
-rw-r--r--demos/nesteddonuts/nesteddonuts.pro8
-rw-r--r--demos/nesteddonuts/widget.cpp128
-rw-r--r--demos/nesteddonuts/widget.h47
-rw-r--r--demos/piechartcustomization/customslice.cpp48
-rw-r--r--demos/piechartcustomization/customslice.h44
-rw-r--r--demos/piechartcustomization/mainwidget.cpp360
-rw-r--r--demos/piechartcustomization/mainwidget.h93
-rw-r--r--demos/piechartcustomization/piechartcustomization.pro15
-rw-r--r--demos/qmlaxes/main.cpp42
-rw-r--r--demos/qmlaxes/qml/qmlaxes/View1.qml67
-rw-r--r--demos/qmlaxes/qml/qmlaxes/View2.qml59
-rw-r--r--demos/qmlaxes/qml/qmlaxes/View3.qml67
-rw-r--r--demos/qmlaxes/qml/qmlaxes/loader.qml37
-rw-r--r--demos/qmlaxes/qml/qmlaxes/main.qml90
-rw-r--r--demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlaxes/qmlaxes.pro9
-rw-r--r--demos/qmlaxes/resources.qrc9
-rw-r--r--demos/qmlchart/main.cpp43
-rw-r--r--demos/qmlchart/qml/qmlchart/View1.qml51
-rw-r--r--demos/qmlchart/qml/qmlchart/View10.qml41
-rw-r--r--demos/qmlchart/qml/qmlchart/View11.qml42
-rw-r--r--demos/qmlchart/qml/qmlchart/View12.qml76
-rw-r--r--demos/qmlchart/qml/qmlchart/View2.qml44
-rw-r--r--demos/qmlchart/qml/qmlchart/View3.qml44
-rw-r--r--demos/qmlchart/qml/qmlchart/View4.qml108
-rw-r--r--demos/qmlchart/qml/qmlchart/View5.qml56
-rw-r--r--demos/qmlchart/qml/qmlchart/View6.qml42
-rw-r--r--demos/qmlchart/qml/qmlchart/View7.qml42
-rw-r--r--demos/qmlchart/qml/qmlchart/View8.qml41
-rw-r--r--demos/qmlchart/qml/qmlchart/View9.qml42
-rw-r--r--demos/qmlchart/qml/qmlchart/loader.qml37
-rw-r--r--demos/qmlchart/qml/qmlchart/main.qml89
-rw-r--r--demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlchart/qmlchart.pro9
-rw-r--r--demos/qmlchart/qmlchart.svg93
-rw-r--r--demos/qmlchart/resources.qrc18
-rw-r--r--demos/qmlcustomizations/main.cpp43
-rw-r--r--demos/qmlcustomizations/qml/qmlcustomizations/loader.qml37
-rw-r--r--demos/qmlcustomizations/qml/qmlcustomizations/main.qml101
-rw-r--r--demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlcustomizations/qmlcustomizations.pro9
-rw-r--r--demos/qmlcustomizations/resources.qrc6
-rw-r--r--demos/qmlcustomlegend/main.cpp43
-rwxr-xr-xdemos/qmlcustomlegend/qml/qmlcustomlegend/AnimatedAreaSeries.qml30
-rwxr-xr-xdemos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml76
-rwxr-xr-xdemos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml100
-rwxr-xr-xdemos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml116
-rwxr-xr-xdemos/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml135
-rwxr-xr-xdemos/qmlcustomlegend/qml/qmlcustomlegend/loader.qml37
-rwxr-xr-xdemos/qmlcustomlegend/qml/qmlcustomlegend/main.qml66
-rw-r--r--demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.pri13
-rwxr-xr-xdemos/qmlcustomlegend/qmlcustomlegend.pro9
-rwxr-xr-xdemos/qmlcustomlegend/resources.qrc11
-rw-r--r--demos/qmlf1legends/main.cpp43
-rw-r--r--demos/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml96
-rw-r--r--demos/qmlf1legends/qml/qmlf1legends/main.qml93
-rw-r--r--demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlf1legends/qmlf1legends.pro9
-rw-r--r--demos/qmloscilloscope/datasource.cpp95
-rw-r--r--demos/qmloscilloscope/datasource.h50
-rw-r--r--demos/qmloscilloscope/main.cpp47
-rw-r--r--demos/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml86
-rw-r--r--demos/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml54
-rw-r--r--demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml116
-rw-r--r--demos/qmloscilloscope/qml/qmloscilloscope/main.qml62
-rw-r--r--demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmloscilloscope/qmloscilloscope.pro13
-rw-r--r--demos/qmlpolarchart/main.cpp43
-rw-r--r--demos/qmlpolarchart/qml/qmlpolarchart/View1.qml68
-rw-r--r--demos/qmlpolarchart/qml/qmlpolarchart/View2.qml89
-rw-r--r--demos/qmlpolarchart/qml/qmlpolarchart/View3.qml76
-rw-r--r--demos/qmlpolarchart/qml/qmlpolarchart/loader.qml37
-rw-r--r--demos/qmlpolarchart/qml/qmlpolarchart/main.qml90
-rw-r--r--demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlpolarchart/qmlpolarchart.pro9
-rw-r--r--demos/qmlpolarchart/resources.qrc9
-rw-r--r--demos/qmlweather/main.cpp52
-rw-r--r--demos/qmlweather/qml/qmlweather/main.qml200
-rw-r--r--demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlweather/qmlweather.pro10
-rw-r--r--demos/quick2chart/main.cpp42
-rw-r--r--demos/quick2chart/qml/quick2chart/View1.qml54
-rw-r--r--demos/quick2chart/qml/quick2chart/View10.qml42
-rw-r--r--demos/quick2chart/qml/quick2chart/View11.qml43
-rw-r--r--demos/quick2chart/qml/quick2chart/View12.qml77
-rw-r--r--demos/quick2chart/qml/quick2chart/View2.qml45
-rw-r--r--demos/quick2chart/qml/quick2chart/View3.qml45
-rw-r--r--demos/quick2chart/qml/quick2chart/View4.qml109
-rw-r--r--demos/quick2chart/qml/quick2chart/View5.qml57
-rw-r--r--demos/quick2chart/qml/quick2chart/View6.qml43
-rw-r--r--demos/quick2chart/qml/quick2chart/View7.qml43
-rw-r--r--demos/quick2chart/qml/quick2chart/View8.qml42
-rw-r--r--demos/quick2chart/qml/quick2chart/View9.qml43
-rw-r--r--demos/quick2chart/qml/quick2chart/loader.qml37
-rw-r--r--demos/quick2chart/qml/quick2chart/main.qml91
-rw-r--r--demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.cpp87
-rw-r--r--demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.h33
-rw-r--r--demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.pri6
-rw-r--r--demos/quick2chart/quick2chart.pro10
-rw-r--r--demos/quick2chart/resources.qrc18
-rw-r--r--demos/quick2oscilloscope/datasource.cpp91
-rw-r--r--demos/quick2oscilloscope/datasource.h49
-rw-r--r--demos/quick2oscilloscope/main.cpp48
-rw-r--r--demos/quick2oscilloscope/qml/quick2oscilloscope/ControlPanel.qml86
-rw-r--r--demos/quick2oscilloscope/qml/quick2oscilloscope/MultiButton.qml54
-rw-r--r--demos/quick2oscilloscope/qml/quick2oscilloscope/ScopeView.qml116
-rw-r--r--demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml64
-rw-r--r--demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.cpp87
-rw-r--r--demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.h33
-rw-r--r--demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.pri6
-rw-r--r--demos/quick2oscilloscope/quick2oscilloscope.pro13
-rw-r--r--demos/quick2oscilloscope/resources.qrc8
-rw-r--r--doc/docconf/compat.qdocconf31
-rw-r--r--doc/docconf/macros.qdocconf37
-rw-r--r--doc/docconf/qchart-html-template.qdocconf49
-rw-r--r--doc/docconf/qchart-html.qdocconf53
-rw-r--r--doc/docconf/qchart-qch.qdocconf44
-rw-r--r--doc/docconf/qcharts-qt4.qdocconf7
-rw-r--r--doc/docconf/qcharts-qt5.qdocconf15
-rw-r--r--doc/docconf/qcharts.qdocconf44
-rw-r--r--doc/src/abstractaxis.qdocinc6
-rw-r--r--doc/src/abstractbarseries.qdocinc9
-rw-r--r--doc/src/abstractseries.qdocinc2
-rw-r--r--doc/src/areaseries.qdocinc8
-rw-r--r--doc/src/barcategoryaxis.qdocinc17
-rw-r--r--doc/src/barseries.qdocinc8
-rw-r--r--doc/src/barset.qdocinc5
-rw-r--r--doc/src/categoryaxis.qdocinc12
-rw-r--r--doc/src/categoryrange.qdocinc2
-rw-r--r--doc/src/chartview.qdocinc11
-rw-r--r--doc/src/classes.qdoc102
-rw-r--r--doc/src/datetimeaxis.qdocinc6
-rw-r--r--doc/src/declarativeboxplotseries.qdocinc34
-rw-r--r--doc/src/declarativeboxset.qdocinc6
-rw-r--r--doc/src/declarativepolarchart.qdocinc20
-rw-r--r--doc/src/declarativexypoint.qdocinc3
-rw-r--r--doc/src/demos-audio.qdoc8
-rw-r--r--doc/src/demos-callout.qdoc14
-rw-r--r--doc/src/demos-chartthemes.qdoc13
-rw-r--r--doc/src/demos-dynamicspline.qdoc10
-rw-r--r--doc/src/demos-nesteddonuts.qdoc50
-rw-r--r--doc/src/demos-piechartcustomization.qdoc8
-rw-r--r--doc/src/demos-qmlaxes.qdoc32
-rw-r--r--doc/src/demos-qmlchart.qdoc118
-rw-r--r--doc/src/demos-qmlcustomizations.qdoc26
-rw-r--r--doc/src/demos-qmlcustomlegend.qdoc40
-rw-r--r--doc/src/demos-qmlf1legends.qdoc20
-rw-r--r--doc/src/demos-qmloscilloscope.qdoc37
-rw-r--r--doc/src/demos-qmlpolarchart.qdoc33
-rw-r--r--doc/src/demos-qmlweather.qdoc32
-rw-r--r--doc/src/demos-quick2chart.qdoc15
-rw-r--r--doc/src/demos-quick2oscilloscope.qdoc16
-rw-r--r--doc/src/examples-areachart.qdoc30
-rw-r--r--doc/src/examples-barchart.qdoc45
-rw-r--r--doc/src/examples-barmodelmapper.qdoc57
-rw-r--r--doc/src/examples-boxplotchart.qdoc76
-rw-r--r--doc/src/examples-customchart.qdoc26
-rw-r--r--doc/src/examples-datetimeaxis.qdoc38
-rw-r--r--doc/src/examples-donutbreakdown.qdoc45
-rw-r--r--doc/src/examples-donutchart.qdoc8
-rw-r--r--doc/src/examples-horizontalbarchart.qdoc48
-rw-r--r--doc/src/examples-horizontalpercentbarchart.qdoc54
-rw-r--r--doc/src/examples-horizontalstackedbarchart.qdoc51
-rw-r--r--doc/src/examples-legend.qdoc32
-rw-r--r--doc/src/examples-legendmarkers.qdoc41
-rw-r--r--doc/src/examples-lineandbarchart.qdoc46
-rw-r--r--doc/src/examples-linechart.qdoc30
-rw-r--r--doc/src/examples-logvalueaxis.qdoc30
-rw-r--r--doc/src/examples-modeldata.qdoc58
-rw-r--r--doc/src/examples-multiaxis.qdoc36
-rw-r--r--doc/src/examples-percentbarchart.qdoc53
-rw-r--r--doc/src/examples-piechart.qdoc8
-rw-r--r--doc/src/examples-piechartdrilldown.qdoc9
-rw-r--r--doc/src/examples-polarchart.qdoc33
-rw-r--r--doc/src/examples-scatterchart.qdoc39
-rw-r--r--doc/src/examples-scatterinteractions.qdoc9
-rw-r--r--doc/src/examples-splinechart.qdoc29
-rw-r--r--doc/src/examples-stackedbarchart.qdoc51
-rw-r--r--doc/src/examples-stackedbarchartdrilldown.qdoc45
-rw-r--r--doc/src/examples-temperaturerecords.qdoc44
-rw-r--r--doc/src/examples-zoomlinechart.qdoc31
-rw-r--r--doc/src/gettingstarted.qdoc73
-rw-r--r--doc/src/hbarmodelmapper.qdocinc17
-rw-r--r--doc/src/horizontalbarseries.qdocinc8
-rw-r--r--doc/src/horizontalpercentbarseries.qdocinc8
-rw-r--r--doc/src/horizontalstackedbarseries.qdocinc8
-rw-r--r--doc/src/hpiemodelmapper.qdocinc16
-rw-r--r--doc/src/hxymodelmapper.qdocinc3
-rw-r--r--doc/src/legend.qdocinc17
-rw-r--r--doc/src/lineseries.qdocinc8
-rw-r--r--doc/src/logvalueaxis.qdocinc7
-rw-r--r--doc/src/margins.qdocinc1
-rw-r--r--doc/src/persentbarseries.qdocinc8
-rw-r--r--doc/src/pieseries.qdocinc10
-rw-r--r--doc/src/pieslice.qdocinc12
-rw-r--r--doc/src/scatterseries.qdocinc9
-rw-r--r--doc/src/splineseries.qdocinc8
-rw-r--r--doc/src/stackedbarseries.qdocinc8
-rw-r--r--doc/src/tutorials.qdoc6
-rw-r--r--doc/src/valueaxis.qdocinc17
-rw-r--r--doc/src/vbarmodelmapper.qdocinc19
-rw-r--r--doc/src/vboxplotmodelmapper.qdocinc18
-rw-r--r--doc/src/vpiemodelmapper.qdocinc16
-rw-r--r--doc/src/vxymodelmapper.qdocinc3
-rw-r--r--doc/src/xyseries.qdocinc4
-rw-r--r--doc/src_qt4/demos.qdoc78
-rw-r--r--doc/src_qt4/examples.qdoc147
-rw-r--r--doc/src_qt4/index.qdoc43
-rw-r--r--doc/src_qt4/qml.qdoc113
-rw-r--r--doc/src_qt5/demos.qdoc78
-rw-r--r--doc/src_qt5/examples.qdoc147
-rw-r--r--doc/src_qt5/index.qdoc43
-rw-r--r--doc/src_qt5/qml.qdoc113
-rw-r--r--doc/src_qt5/qmlmodule.qdoc3
-rw-r--r--examples/areachart/main.cpp81
-rw-r--r--examples/barchart/main.cpp93
-rw-r--r--examples/barmodelmapper/tablewidget.cpp117
-rw-r--r--examples/boxplotchart/boxdatareader.h43
-rw-r--r--examples/boxplotchart/main.cpp105
-rw-r--r--examples/charts/areachart/areachart.pro (renamed from examples/areachart/areachart.pro)0
-rw-r--r--examples/charts/areachart/main.cpp81
-rw-r--r--examples/charts/audio/audio.pro15
-rw-r--r--examples/charts/audio/main.cpp (renamed from demos/audio/main.cpp)0
-rw-r--r--examples/charts/audio/widget.cpp82
-rw-r--r--examples/charts/audio/widget.h52
-rw-r--r--examples/charts/audio/xyseriesiodevice.cpp (renamed from demos/audio/xyseriesiodevice.cpp)0
-rw-r--r--examples/charts/audio/xyseriesiodevice.h47
-rw-r--r--examples/charts/barchart/barchart.pro (renamed from examples/barchart/barchart.pro)0
-rw-r--r--examples/charts/barchart/main.cpp93
-rw-r--r--examples/charts/barmodelmapper/barmodelmapper.pro (renamed from examples/barmodelmapper/barmodelmapper.pro)0
-rw-r--r--examples/charts/barmodelmapper/customtablemodel.cpp (renamed from examples/barmodelmapper/customtablemodel.cpp)0
-rw-r--r--examples/charts/barmodelmapper/customtablemodel.h (renamed from examples/barmodelmapper/customtablemodel.h)0
-rw-r--r--examples/charts/barmodelmapper/main.cpp (renamed from examples/barmodelmapper/main.cpp)0
-rw-r--r--examples/charts/barmodelmapper/tablewidget.cpp112
-rw-r--r--examples/charts/barmodelmapper/tablewidget.h (renamed from examples/barmodelmapper/tablewidget.h)0
-rw-r--r--examples/charts/boxplotchart/acme_data.txt (renamed from examples/boxplotchart/acme_data.txt)0
-rw-r--r--examples/charts/boxplotchart/boxdatareader.cpp (renamed from examples/boxplotchart/boxdatareader.cpp)0
-rw-r--r--examples/charts/boxplotchart/boxdatareader.h43
-rw-r--r--examples/charts/boxplotchart/boxplotchart.pro (renamed from examples/boxplotchart/boxplotchart.pro)0
-rw-r--r--examples/charts/boxplotchart/boxplotdata.qrc (renamed from examples/boxplotchart/boxplotdata.qrc)0
-rw-r--r--examples/charts/boxplotchart/boxwhisk_data.txt (renamed from examples/boxplotchart/boxwhisk_data.txt)0
-rw-r--r--examples/charts/boxplotchart/main.cpp105
-rw-r--r--examples/charts/callout/callout.cpp (renamed from demos/callout/callout.cpp)0
-rw-r--r--examples/charts/callout/callout.h (renamed from demos/callout/callout.h)0
-rw-r--r--examples/charts/callout/callout.pro15
-rw-r--r--examples/charts/callout/main.cpp (renamed from demos/callout/main.cpp)0
-rw-r--r--examples/charts/callout/view.cpp (renamed from demos/callout/view.cpp)0
-rw-r--r--examples/charts/callout/view.h59
-rw-r--r--examples/charts/chartinteractions/chart.cpp (renamed from demos/chartinteractions/chart.cpp)0
-rw-r--r--examples/charts/chartinteractions/chart.h53
-rw-r--r--examples/charts/chartinteractions/chartinteractions.pro11
-rw-r--r--examples/charts/chartinteractions/chartview.cpp (renamed from demos/chartinteractions/chartview.cpp)0
-rw-r--r--examples/charts/chartinteractions/chartview.h45
-rw-r--r--examples/charts/chartinteractions/main.cpp74
-rw-r--r--examples/charts/charts.pro60
-rw-r--r--examples/charts/chartthemes/chartthemes.pro7
-rw-r--r--examples/charts/chartthemes/main.cpp (renamed from demos/chartthemes/main.cpp)0
-rw-r--r--examples/charts/chartthemes/themewidget.cpp (renamed from demos/chartthemes/themewidget.cpp)0
-rw-r--r--examples/charts/chartthemes/themewidget.h77
-rw-r--r--examples/charts/customchart/customchart.pro (renamed from examples/customchart/customchart.pro)0
-rw-r--r--examples/charts/customchart/main.cpp131
-rw-r--r--examples/charts/datetimeaxis/datetimeaxis.pro (renamed from examples/datetimeaxis/datetimeaxis.pro)0
-rw-r--r--examples/charts/datetimeaxis/main.cpp100
-rw-r--r--examples/charts/datetimeaxis/sun_spots.txt (renamed from examples/datetimeaxis/sun_spots.txt)0
-rw-r--r--examples/charts/datetimeaxis/sundata.qrc (renamed from examples/datetimeaxis/sundata.qrc)0
-rw-r--r--examples/charts/donutbreakdown/donutbreakdown.pro (renamed from examples/donutbreakdown/donutbreakdown.pro)0
-rw-r--r--examples/charts/donutbreakdown/donutbreakdownchart.cpp110
-rw-r--r--examples/charts/donutbreakdown/donutbreakdownchart.h42
-rw-r--r--examples/charts/donutbreakdown/main.cpp77
-rw-r--r--examples/charts/donutbreakdown/mainslice.cpp57
-rw-r--r--examples/charts/donutbreakdown/mainslice.h48
-rw-r--r--examples/charts/donutchart/donutchart.pro (renamed from examples/donutchart/donutchart.pro)0
-rw-r--r--examples/charts/donutchart/main.cpp62
-rw-r--r--examples/charts/dynamicspline/chart.cpp (renamed from demos/dynamicspline/chart.cpp)0
-rw-r--r--examples/charts/dynamicspline/chart.h56
-rw-r--r--examples/charts/dynamicspline/dynamicspline.pro7
-rw-r--r--examples/charts/dynamicspline/main.cpp42
-rw-r--r--examples/charts/examples.pri17
-rw-r--r--examples/charts/horizontalbarchart/horizontalbarchart.pro (renamed from examples/horizontalbarchart/horizontalbarchart.pro)0
-rw-r--r--examples/charts/horizontalbarchart/main.cpp96
-rw-r--r--examples/charts/horizontalpercentbarchart/horizontalpercentbarchart.pro (renamed from examples/horizontalpercentbarchart/horizontalpercentbarchart.pro)0
-rw-r--r--examples/charts/horizontalpercentbarchart/main.cpp94
-rw-r--r--examples/charts/horizontalstackedbarchart/horizontalstackedbarchart.pro (renamed from examples/horizontalstackedbarchart/horizontalstackedbarchart.pro)0
-rw-r--r--examples/charts/horizontalstackedbarchart/main.cpp94
-rw-r--r--examples/charts/legend/legend.pro (renamed from examples/legend/legend.pro)0
-rw-r--r--examples/charts/legend/main.cpp37
-rw-r--r--examples/charts/legend/mainwidget.cpp247
-rw-r--r--examples/charts/legend/mainwidget.h78
-rw-r--r--examples/charts/legendmarkers/legendmarkers.pro (renamed from examples/legendmarkers/legendmarkers.pro)0
-rw-r--r--examples/charts/legendmarkers/main.cpp (renamed from examples/legendmarkers/main.cpp)0
-rw-r--r--examples/charts/legendmarkers/mainwidget.cpp177
-rw-r--r--examples/charts/legendmarkers/mainwidget.h62
-rw-r--r--examples/charts/lineandbar/lineandbar.pro (renamed from examples/lineandbar/lineandbar.pro)0
-rw-r--r--examples/charts/lineandbar/main.cpp111
-rw-r--r--examples/charts/linechart/linechart.pro (renamed from examples/linechart/linechart.pro)0
-rw-r--r--examples/charts/linechart/main.cpp67
-rw-r--r--examples/charts/logvalueaxis/logvalueaxis.pro (renamed from examples/logvalueaxis/logvalueaxis.pro)0
-rw-r--r--examples/charts/logvalueaxis/main.cpp75
-rw-r--r--examples/charts/modeldata/customtablemodel.cpp (renamed from examples/modeldata/customtablemodel.cpp)0
-rw-r--r--examples/charts/modeldata/customtablemodel.h (renamed from examples/modeldata/customtablemodel.h)0
-rw-r--r--examples/charts/modeldata/main.cpp (renamed from examples/modeldata/main.cpp)0
-rw-r--r--examples/charts/modeldata/modeldata.pro (renamed from examples/modeldata/modeldata.pro)0
-rw-r--r--examples/charts/modeldata/tablewidget.cpp112
-rw-r--r--examples/charts/modeldata/tablewidget.h (renamed from examples/modeldata/tablewidget.h)0
-rw-r--r--examples/charts/multiaxis/main.cpp92
-rw-r--r--examples/charts/multiaxis/multiaxis.pro (renamed from examples/multiaxis/multiaxis.pro)0
-rw-r--r--examples/charts/nesteddonuts/main.cpp (renamed from demos/nesteddonuts/main.cpp)0
-rw-r--r--examples/charts/nesteddonuts/nesteddonuts.pro8
-rw-r--r--examples/charts/nesteddonuts/widget.cpp128
-rw-r--r--examples/charts/nesteddonuts/widget.h47
-rw-r--r--examples/charts/percentbarchart/main.cpp93
-rw-r--r--examples/charts/percentbarchart/percentbarchart.pro (renamed from examples/percentbarchart/percentbarchart.pro)0
-rw-r--r--examples/charts/piechart/main.cpp70
-rw-r--r--examples/charts/piechart/piechart.pro (renamed from examples/piechart/piechart.pro)0
-rw-r--r--examples/charts/piechartcustomization/brushtool.cpp (renamed from demos/piechartcustomization/brushtool.cpp)0
-rw-r--r--examples/charts/piechartcustomization/brushtool.h (renamed from demos/piechartcustomization/brushtool.h)0
-rw-r--r--examples/charts/piechartcustomization/customslice.cpp48
-rw-r--r--examples/charts/piechartcustomization/customslice.h44
-rw-r--r--examples/charts/piechartcustomization/main.cpp (renamed from demos/piechartcustomization/main.cpp)0
-rw-r--r--examples/charts/piechartcustomization/mainwidget.cpp360
-rw-r--r--examples/charts/piechartcustomization/mainwidget.h93
-rw-r--r--examples/charts/piechartcustomization/pentool.cpp (renamed from demos/piechartcustomization/pentool.cpp)0
-rw-r--r--examples/charts/piechartcustomization/pentool.h (renamed from demos/piechartcustomization/pentool.h)0
-rw-r--r--examples/charts/piechartcustomization/piechartcustomization.pro16
-rw-r--r--examples/charts/piechartdrilldown/drilldownchart.cpp54
-rw-r--r--examples/charts/piechartdrilldown/drilldownchart.h47
-rw-r--r--examples/charts/piechartdrilldown/drilldownslice.cpp63
-rw-r--r--examples/charts/piechartdrilldown/drilldownslice.h49
-rw-r--r--examples/charts/piechartdrilldown/main.cpp77
-rw-r--r--examples/charts/piechartdrilldown/piechartdrilldown.pro (renamed from examples/piechartdrilldown/piechartdrilldown.pro)0
-rw-r--r--examples/charts/polarchart/chartview.cpp111
-rw-r--r--examples/charts/polarchart/chartview.h41
-rw-r--r--examples/charts/polarchart/main.cpp137
-rw-r--r--examples/charts/polarchart/polarchart.pro (renamed from examples/polarchart/polarchart.pro)0
-rw-r--r--examples/charts/qmlaxes/main.cpp50
-rw-r--r--examples/charts/qmlaxes/qml/qmlaxes/View1.qml68
-rw-r--r--examples/charts/qmlaxes/qml/qmlaxes/View2.qml60
-rw-r--r--examples/charts/qmlaxes/qml/qmlaxes/View3.qml68
-rw-r--r--examples/charts/qmlaxes/qml/qmlaxes/main.qml80
-rw-r--r--examples/charts/qmlaxes/qmlaxes.pro7
-rw-r--r--examples/charts/qmlaxes/resources.qrc8
-rw-r--r--examples/charts/qmlboxplot/main.cpp50
-rw-r--r--examples/charts/qmlboxplot/qml/qmlboxplot/main.qml41
-rw-r--r--examples/charts/qmlboxplot/qmlboxplot.pro9
-rw-r--r--examples/charts/qmlboxplot/resources.qrc (renamed from examples/qmlboxplot/resources.qrc)0
-rw-r--r--examples/charts/qmlchart/main.cpp50
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View1.qml54
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View10.qml42
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View11.qml43
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View12.qml77
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View2.qml45
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View3.qml45
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View4.qml108
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View5.qml56
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View6.qml43
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View7.qml43
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View8.qml42
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/View9.qml43
-rw-r--r--examples/charts/qmlchart/qml/qmlchart/main.qml91
-rw-r--r--examples/charts/qmlchart/qmlchart.pro7
-rw-r--r--examples/charts/qmlchart/resources.qrc17
-rw-r--r--examples/charts/qmlcustomizations/main.cpp49
-rw-r--r--examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml102
-rw-r--r--examples/charts/qmlcustomizations/qmlcustomizations.pro7
-rw-r--r--examples/charts/qmlcustomizations/resources.qrc5
-rw-r--r--examples/charts/qmlcustomlegend/main.cpp49
-rw-r--r--examples/charts/qmlcustomlegend/qml/qmlcustomlegend/AnimatedAreaSeries.qml30
-rw-r--r--examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml77
-rw-r--r--examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml100
-rw-r--r--examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml117
-rw-r--r--examples/charts/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml136
-rw-r--r--examples/charts/qmlcustomlegend/qml/qmlcustomlegend/main.qml66
-rw-r--r--examples/charts/qmlcustomlegend/qmlcustomlegend.pro7
-rw-r--r--examples/charts/qmlcustomlegend/resources.qrc10
-rw-r--r--examples/charts/qmlf1legends/main.cpp49
-rw-r--r--examples/charts/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml95
-rw-r--r--examples/charts/qmlf1legends/qml/qmlf1legends/main.qml95
-rw-r--r--examples/charts/qmlf1legends/qmlf1legends.pro7
-rw-r--r--examples/charts/qmlf1legends/resources.qrc (renamed from demos/qmlf1legends/resources.qrc)0
-rw-r--r--examples/charts/qmloscilloscope/datasource.cpp91
-rw-r--r--examples/charts/qmloscilloscope/datasource.h49
-rw-r--r--examples/charts/qmloscilloscope/main.cpp56
-rw-r--r--examples/charts/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml88
-rw-r--r--examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml60
-rw-r--r--examples/charts/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml115
-rw-r--r--examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml61
-rw-r--r--examples/charts/qmloscilloscope/qmloscilloscope.pro11
-rw-r--r--examples/charts/qmloscilloscope/resources.qrc (renamed from demos/qmloscilloscope/resources.qrc)0
-rw-r--r--examples/charts/qmlpiechart/main.cpp49
-rw-r--r--examples/charts/qmlpiechart/qml/qmlpiechart/main.qml54
-rw-r--r--examples/charts/qmlpiechart/qmlpiechart.pro7
-rw-r--r--examples/charts/qmlpiechart/qmlpiechart.svg (renamed from examples/qmlpiechart/qmlpiechart.svg)0
-rw-r--r--examples/charts/qmlpiechart/resources.qrc (renamed from examples/qmlpiechart/resources.qrc)0
-rw-r--r--examples/charts/qmlpolarchart/main.cpp49
-rw-r--r--examples/charts/qmlpolarchart/qml/qmlpolarchart/View1.qml69
-rw-r--r--examples/charts/qmlpolarchart/qml/qmlpolarchart/View2.qml90
-rw-r--r--examples/charts/qmlpolarchart/qml/qmlpolarchart/View3.qml77
-rw-r--r--examples/charts/qmlpolarchart/qml/qmlpolarchart/main.qml80
-rw-r--r--examples/charts/qmlpolarchart/qmlpolarchart.pro7
-rw-r--r--examples/charts/qmlpolarchart/resources.qrc8
-rw-r--r--examples/charts/qmlweather/main.cpp59
-rw-r--r--examples/charts/qmlweather/qml/qmlweather/main.qml201
-rw-r--r--examples/charts/qmlweather/qmlweather.pro7
-rw-r--r--examples/charts/qmlweather/resources.qrc (renamed from demos/qmlweather/resources.qrc)0
-rw-r--r--examples/charts/scatterchart/chartview.cpp (renamed from examples/scatterchart/chartview.cpp)0
-rw-r--r--examples/charts/scatterchart/chartview.h35
-rw-r--r--examples/charts/scatterchart/main.cpp40
-rw-r--r--examples/charts/scatterchart/scatterchart.pro (renamed from examples/scatterchart/scatterchart.pro)0
-rw-r--r--examples/charts/scatterinteractions/chartview.cpp79
-rw-r--r--examples/charts/scatterinteractions/chartview.h46
-rw-r--r--examples/charts/scatterinteractions/main.cpp (renamed from examples/scatterinteractions/main.cpp)0
-rw-r--r--examples/charts/scatterinteractions/scatterinteractions.pro (renamed from examples/scatterinteractions/scatterinteractions.pro)0
-rw-r--r--examples/charts/splinechart/main.cpp68
-rw-r--r--examples/charts/splinechart/splinechart.pro (renamed from examples/splinechart/splinechart.pro)0
-rw-r--r--examples/charts/stackedbarchart/main.cpp93
-rw-r--r--examples/charts/stackedbarchart/stackedbarchart.pro (renamed from examples/stackedbarchart/stackedbarchart.pro)0
-rw-r--r--examples/charts/stackedbarchartdrilldown/drilldownchart.cpp60
-rw-r--r--examples/charts/stackedbarchartdrilldown/drilldownchart.h46
-rw-r--r--examples/charts/stackedbarchartdrilldown/drilldownseries.cpp46
-rw-r--r--examples/charts/stackedbarchartdrilldown/drilldownseries.h48
-rw-r--r--examples/charts/stackedbarchartdrilldown/main.cpp113
-rw-r--r--examples/charts/stackedbarchartdrilldown/stackedbarchartdrilldown.pro (renamed from examples/stackedbarchartdrilldown/stackedbarchartdrilldown.pro)0
-rw-r--r--examples/charts/temperaturerecords/main.cpp88
-rw-r--r--examples/charts/temperaturerecords/temperaturerecords.pro (renamed from examples/temperaturerecords/temperaturerecords.pro)0
-rw-r--r--examples/charts/zoomlinechart/chart.cpp (renamed from examples/zoomlinechart/chart.cpp)0
-rw-r--r--examples/charts/zoomlinechart/chart.h48
-rw-r--r--examples/charts/zoomlinechart/chartview.cpp (renamed from examples/zoomlinechart/chartview.cpp)0
-rw-r--r--examples/charts/zoomlinechart/chartview.h49
-rw-r--r--examples/charts/zoomlinechart/main.cpp62
-rw-r--r--examples/charts/zoomlinechart/zoomlinechart.pro (renamed from examples/zoomlinechart/zoomlinechart.pro)0
-rw-r--r--examples/customchart/main.cpp131
-rw-r--r--examples/datetimeaxis/main.cpp100
-rw-r--r--examples/donutbreakdown/donutbreakdownchart.cpp110
-rw-r--r--examples/donutbreakdown/donutbreakdownchart.h42
-rw-r--r--examples/donutbreakdown/main.cpp77
-rw-r--r--examples/donutbreakdown/mainslice.cpp57
-rw-r--r--examples/donutbreakdown/mainslice.h48
-rw-r--r--examples/donutchart/main.cpp62
-rw-r--r--examples/examples.pri33
-rw-r--r--examples/examples.pro45
-rw-r--r--examples/horizontalbarchart/main.cpp96
-rw-r--r--examples/horizontalpercentbarchart/main.cpp94
-rw-r--r--examples/horizontalstackedbarchart/main.cpp94
-rw-r--r--examples/legend/main.cpp37
-rw-r--r--examples/legend/mainwidget.cpp247
-rw-r--r--examples/legend/mainwidget.h78
-rw-r--r--examples/legendmarkers/mainwidget.cpp177
-rw-r--r--examples/legendmarkers/mainwidget.h62
-rw-r--r--examples/lineandbar/main.cpp111
-rw-r--r--examples/linechart/main.cpp67
-rw-r--r--examples/logvalueaxis/main.cpp75
-rw-r--r--examples/modeldata/tablewidget.cpp117
-rw-r--r--examples/multiaxis/main.cpp92
-rw-r--r--examples/percentbarchart/main.cpp93
-rw-r--r--examples/piechart/main.cpp70
-rw-r--r--examples/piechartdrilldown/drilldownchart.cpp54
-rw-r--r--examples/piechartdrilldown/drilldownchart.h47
-rw-r--r--examples/piechartdrilldown/drilldownslice.cpp63
-rw-r--r--examples/piechartdrilldown/drilldownslice.h49
-rw-r--r--examples/piechartdrilldown/main.cpp77
-rw-r--r--examples/polarchart/chartview.cpp111
-rw-r--r--examples/polarchart/chartview.h41
-rw-r--r--examples/polarchart/main.cpp137
-rw-r--r--examples/qmlboxplot/main.cpp43
-rw-r--r--examples/qmlboxplot/qml/qmlboxplot/main.qml40
-rw-r--r--examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--examples/qmlboxplot/qmlboxplot.pro11
-rw-r--r--examples/qmlpiechart/main.cpp43
-rw-r--r--examples/qmlpiechart/qml/qmlpiechart/main.qml53
-rw-r--r--examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--examples/qmlpiechart/qmlpiechart.pro9
-rw-r--r--examples/scatterchart/chartview.h35
-rw-r--r--examples/scatterchart/main.cpp40
-rw-r--r--examples/scatterinteractions/chartview.cpp79
-rw-r--r--examples/scatterinteractions/chartview.h46
-rw-r--r--examples/splinechart/main.cpp68
-rw-r--r--examples/stackedbarchart/main.cpp93
-rw-r--r--examples/stackedbarchartdrilldown/drilldownchart.cpp60
-rw-r--r--examples/stackedbarchartdrilldown/drilldownchart.h46
-rw-r--r--examples/stackedbarchartdrilldown/drilldownseries.cpp46
-rw-r--r--examples/stackedbarchartdrilldown/drilldownseries.h48
-rw-r--r--examples/stackedbarchartdrilldown/main.cpp113
-rw-r--r--examples/temperaturerecords/main.cpp88
-rw-r--r--examples/zoomlinechart/chart.h48
-rw-r--r--examples/zoomlinechart/chartview.h49
-rw-r--r--examples/zoomlinechart/main.cpp62
-rw-r--r--features/qtcommercialchart.prf9
-rw-r--r--plugins/declarative/declarative.pri60
-rw-r--r--plugins/declarative/declarativeareaseries.cpp115
-rw-r--r--plugins/declarative/declarativeareaseries.h94
-rw-r--r--plugins/declarative/declarativeaxes.cpp61
-rw-r--r--plugins/declarative/declarativeaxes.h72
-rw-r--r--plugins/declarative/declarativebarseries.cpp509
-rw-r--r--plugins/declarative/declarativebarseries.h415
-rw-r--r--plugins/declarative/declarativeboxplotseries.cpp401
-rw-r--r--plugins/declarative/declarativeboxplotseries.h154
-rw-r--r--plugins/declarative/declarativecategoryaxis.cpp107
-rw-r--r--plugins/declarative/declarativecategoryaxis.h87
-rw-r--r--plugins/declarative/declarativechart.cpp1080
-rw-r--r--plugins/declarative/declarativechart.h245
-rw-r--r--plugins/declarative/declarativelineseries.cpp104
-rw-r--r--plugins/declarative/declarativelineseries.h123
-rw-r--r--plugins/declarative/declarativemargins.cpp121
-rw-r--r--plugins/declarative/declarativemargins.h54
-rw-r--r--plugins/declarative/declarativepieseries.cpp154
-rw-r--r--plugins/declarative/declarativepieseries.h96
-rw-r--r--plugins/declarative/declarativepolarchart.cpp53
-rw-r--r--plugins/declarative/declarativepolarchart.h47
-rw-r--r--plugins/declarative/declarativescatterseries.cpp114
-rw-r--r--plugins/declarative/declarativescatterseries.h130
-rw-r--r--plugins/declarative/declarativesplineseries.cpp104
-rw-r--r--plugins/declarative/declarativesplineseries.h123
-rw-r--r--plugins/declarative/declarativexypoint.cpp60
-rw-r--r--plugins/declarative/declarativexypoint.h42
-rw-r--r--plugins/declarative/declarativexyseries.cpp118
-rw-r--r--plugins/declarative/declarativexyseries.h54
-rw-r--r--plugins/declarative/plugin.cpp332
-rw-r--r--plugins/declarative/shared_defines.h42
-rw-r--r--plugins/designer/designer.pro28
-rw-r--r--plugins/designer/qchartsplugin.cpp38
-rw-r--r--plugins/designer/qchartsplugin.h4
-rw-r--r--plugins/plugins.pri14
-rw-r--r--plugins/plugins.pro15
-rw-r--r--plugins/quick1/qmldir1
-rw-r--r--plugins/quick1/quick1.pro8
-rw-r--r--plugins/quick2/plugins.qmltypes2263
-rw-r--r--plugins/quick2/qmldir3
-rw-r--r--plugins/quick2/quick2.pro11
-rw-r--r--qtcharts.pro3
-rw-r--r--src/animations/axisanimation.cpp136
-rw-r--r--src/animations/axisanimation_p.h62
-rw-r--r--src/animations/baranimation.cpp82
-rw-r--r--src/animations/baranimation_p.h59
-rw-r--r--src/animations/boxplotanimation.cpp97
-rw-r--r--src/animations/boxplotanimation_p.h64
-rw-r--r--src/animations/boxwhiskersanimation.cpp110
-rw-r--r--src/animations/boxwhiskersanimation_p.h69
-rw-r--r--src/animations/chartanimation.cpp46
-rw-r--r--src/animations/chartanimation_p.h57
-rw-r--r--src/animations/pieanimation.cpp110
-rw-r--r--src/animations/pieanimation_p.h62
-rw-r--r--src/animations/piesliceanimation.cpp128
-rw-r--r--src/animations/piesliceanimation_p.h60
-rw-r--r--src/animations/scatteranimation.cpp50
-rw-r--r--src/animations/scatteranimation_p.h50
-rw-r--r--src/animations/splineanimation.cpp210
-rw-r--r--src/animations/splineanimation_p.h62
-rw-r--r--src/animations/xyanimation.cpp155
-rw-r--r--src/animations/xyanimation_p.h67
-rw-r--r--src/areachart/areachartitem.cpp262
-rw-r--r--src/areachart/areachartitem_p.h123
-rw-r--r--src/areachart/qareaseries.cpp655
-rw-r--r--src/areachart/qareaseries.h106
-rw-r--r--src/areachart/qareaseries_p.h76
-rw-r--r--src/axis/barcategoryaxis/chartbarcategoryaxisx.cpp138
-rw-r--r--src/axis/barcategoryaxis/chartbarcategoryaxisx_p.h62
-rw-r--r--src/axis/barcategoryaxis/chartbarcategoryaxisy.cpp140
-rw-r--r--src/axis/barcategoryaxis/chartbarcategoryaxisy_p.h61
-rw-r--r--src/axis/barcategoryaxis/qbarcategoryaxis.cpp612
-rw-r--r--src/axis/barcategoryaxis/qbarcategoryaxis.h81
-rw-r--r--src/axis/barcategoryaxis/qbarcategoryaxis_p.h81
-rw-r--r--src/axis/cartesianchartaxis.cpp198
-rw-r--r--src/axis/cartesianchartaxis_p.h79
-rw-r--r--src/axis/categoryaxis/chartcategoryaxisx.cpp117
-rw-r--r--src/axis/categoryaxis/chartcategoryaxisx_p.h61
-rw-r--r--src/axis/categoryaxis/chartcategoryaxisy.cpp117
-rw-r--r--src/axis/categoryaxis/chartcategoryaxisy_p.h61
-rw-r--r--src/axis/categoryaxis/polarchartcategoryaxisangular.cpp80
-rw-r--r--src/axis/categoryaxis/polarchartcategoryaxisangular_p.h56
-rw-r--r--src/axis/categoryaxis/polarchartcategoryaxisradial.cpp79
-rw-r--r--src/axis/categoryaxis/polarchartcategoryaxisradial_p.h56
-rw-r--r--src/axis/categoryaxis/qcategoryaxis.cpp342
-rw-r--r--src/axis/categoryaxis/qcategoryaxis.h70
-rw-r--r--src/axis/categoryaxis/qcategoryaxis_p.h62
-rw-r--r--src/axis/chartaxiselement.cpp402
-rw-r--r--src/axis/chartaxiselement_p.h155
-rw-r--r--src/axis/datetimeaxis/chartdatetimeaxisx.cpp131
-rw-r--r--src/axis/datetimeaxis/chartdatetimeaxisx_p.h60
-rw-r--r--src/axis/datetimeaxis/chartdatetimeaxisy.cpp132
-rw-r--r--src/axis/datetimeaxis/chartdatetimeaxisy_p.h60
-rw-r--r--src/axis/datetimeaxis/polarchartdatetimeaxisangular.cpp80
-rw-r--r--src/axis/datetimeaxis/polarchartdatetimeaxisangular_p.h56
-rw-r--r--src/axis/datetimeaxis/polarchartdatetimeaxisradial.cpp79
-rw-r--r--src/axis/datetimeaxis/polarchartdatetimeaxisradial_p.h56
-rw-r--r--src/axis/datetimeaxis/qdatetimeaxis.cpp393
-rw-r--r--src/axis/datetimeaxis/qdatetimeaxis.h78
-rw-r--r--src/axis/datetimeaxis/qdatetimeaxis_p.h73
-rw-r--r--src/axis/horizontalaxis.cpp225
-rw-r--r--src/axis/horizontalaxis_p.h50
-rw-r--r--src/axis/linearrowitem_p.h76
-rw-r--r--src/axis/logvalueaxis/chartlogvalueaxisx.cpp137
-rw-r--r--src/axis/logvalueaxis/chartlogvalueaxisx_p.h63
-rw-r--r--src/axis/logvalueaxis/chartlogvalueaxisy.cpp137
-rw-r--r--src/axis/logvalueaxis/chartlogvalueaxisy_p.h63
-rw-r--r--src/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp90
-rw-r--r--src/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h57
-rw-r--r--src/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp95
-rw-r--r--src/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h57
-rw-r--r--src/axis/logvalueaxis/qlogvalueaxis.cpp402
-rw-r--r--src/axis/logvalueaxis/qlogvalueaxis.h77
-rw-r--r--src/axis/logvalueaxis/qlogvalueaxis_p.h69
-rw-r--r--src/axis/polarchartaxis.cpp126
-rw-r--r--src/axis/polarchartaxis_p.h70
-rw-r--r--src/axis/polarchartaxisangular.cpp432
-rw-r--r--src/axis/polarchartaxisangular_p.h63
-rw-r--r--src/axis/polarchartaxisradial.cpp297
-rw-r--r--src/axis/polarchartaxisradial_p.h60
-rw-r--r--src/axis/qabstractaxis.cpp1015
-rw-r--r--src/axis/qabstractaxis.h193
-rw-r--r--src/axis/qabstractaxis_p.h130
-rw-r--r--src/axis/valueaxis/chartvalueaxisx.cpp128
-rw-r--r--src/axis/valueaxis/chartvalueaxisx_p.h60
-rw-r--r--src/axis/valueaxis/chartvalueaxisy.cpp128
-rw-r--r--src/axis/valueaxis/chartvalueaxisy_p.h60
-rw-r--r--src/axis/valueaxis/polarchartvalueaxisangular.cpp80
-rw-r--r--src/axis/valueaxis/polarchartvalueaxisangular_p.h56
-rw-r--r--src/axis/valueaxis/polarchartvalueaxisradial.cpp79
-rw-r--r--src/axis/valueaxis/polarchartvalueaxisradial_p.h56
-rw-r--r--src/axis/valueaxis/qvalueaxis.cpp451
-rw-r--r--src/axis/valueaxis/qvalueaxis.h83
-rw-r--r--src/axis/valueaxis/qvalueaxis_p.h70
-rw-r--r--src/axis/verticalaxis.cpp229
-rw-r--r--src/axis/verticalaxis_p.h50
-rw-r--r--src/barchart/abstractbarchartitem.cpp268
-rw-r--r--src/barchart/abstractbarchartitem_p.h96
-rw-r--r--src/barchart/bar.cpp71
-rw-r--r--src/barchart/bar_p.h66
-rw-r--r--src/barchart/horizontal/bar/horizontalbarchartitem.cpp94
-rw-r--r--src/barchart/horizontal/bar/horizontalbarchartitem_p.h51
-rw-r--r--src/barchart/horizontal/bar/qhorizontalbarseries.cpp125
-rw-r--r--src/barchart/horizontal/bar/qhorizontalbarseries.h45
-rw-r--r--src/barchart/horizontal/bar/qhorizontalbarseries_p.h50
-rw-r--r--src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp140
-rw-r--r--src/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h52
-rw-r--r--src/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp124
-rw-r--r--src/barchart/horizontal/percent/qhorizontalpercentbarseries.h45
-rw-r--r--src/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h50
-rw-r--r--src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp107
-rw-r--r--src/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h51
-rw-r--r--src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp120
-rw-r--r--src/barchart/horizontal/stacked/qhorizontalstackedbarseries.h45
-rw-r--r--src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h50
-rw-r--r--src/barchart/qabstractbarseries.cpp1028
-rw-r--r--src/barchart/qabstractbarseries.h105
-rw-r--r--src/barchart/qabstractbarseries_p.h118
-rw-r--r--src/barchart/qbarmodelmapper.cpp561
-rw-r--r--src/barchart/qbarmodelmapper.h69
-rw-r--r--src/barchart/qbarmodelmapper_p.h96
-rw-r--r--src/barchart/qbarset.cpp678
-rw-r--r--src/barchart/qbarset.h120
-rw-r--r--src/barchart/qbarset_p.h82
-rw-r--r--src/barchart/qhbarmodelmapper.cpp248
-rw-r--r--src/barchart/qhbarmodelmapper.h70
-rw-r--r--src/barchart/qvbarmodelmapper.cpp246
-rw-r--r--src/barchart/qvbarmodelmapper.h70
-rw-r--r--src/barchart/vertical/bar/barchartitem.cpp125
-rw-r--r--src/barchart/vertical/bar/barchartitem_p.h57
-rw-r--r--src/barchart/vertical/bar/qbarseries.cpp124
-rw-r--r--src/barchart/vertical/bar/qbarseries.h45
-rw-r--r--src/barchart/vertical/bar/qbarseries_p.h52
-rw-r--r--src/barchart/vertical/percent/percentbarchartitem.cpp171
-rw-r--r--src/barchart/vertical/percent/percentbarchartitem_p.h59
-rw-r--r--src/barchart/vertical/percent/qpercentbarseries.cpp125
-rw-r--r--src/barchart/vertical/percent/qpercentbarseries.h46
-rw-r--r--src/barchart/vertical/percent/qpercentbarseries_p.h51
-rw-r--r--src/barchart/vertical/stacked/qstackedbarseries.cpp122
-rw-r--r--src/barchart/vertical/stacked/qstackedbarseries.h46
-rw-r--r--src/barchart/vertical/stacked/qstackedbarseries_p.h51
-rw-r--r--src/barchart/vertical/stacked/stackedbarchartitem.cpp137
-rw-r--r--src/barchart/vertical/stacked/stackedbarchartitem_p.h58
-rw-r--r--src/boxplotchart/boxplotchartitem.cpp215
-rw-r--r--src/boxplotchart/boxplotchartitem_p.h84
-rw-r--r--src/boxplotchart/boxwhiskers.cpp194
-rw-r--r--src/boxplotchart/boxwhiskers_p.h102
-rw-r--r--src/boxplotchart/boxwhiskersdata_p.h80
-rw-r--r--src/boxplotchart/qboxplotmodelmapper.cpp489
-rw-r--r--src/boxplotchart/qboxplotmodelmapper.h69
-rw-r--r--src/boxplotchart/qboxplotmodelmapper_p.h93
-rw-r--r--src/boxplotchart/qboxplotseries.cpp690
-rw-r--r--src/boxplotchart/qboxplotseries.h85
-rw-r--r--src/boxplotchart/qboxplotseries_p.h100
-rw-r--r--src/boxplotchart/qboxset.cpp336
-rw-r--r--src/boxplotchart/qboxset.h94
-rw-r--r--src/boxplotchart/qboxset_p.h84
-rw-r--r--src/boxplotchart/qvboxplotmodelmapper.cpp246
-rw-r--r--src/boxplotchart/qvboxplotmodelmapper.h70
-rw-r--r--src/chartbackground.cpp99
-rw-r--r--src/chartbackground_p.h62
-rw-r--r--src/chartconfig_p.h91
-rw-r--r--src/chartdataset.cpp639
-rw-r--r--src/chartdataset_p.h94
-rw-r--r--src/chartelement.cpp55
-rw-r--r--src/chartelement_p.h65
-rw-r--r--src/chartitem.cpp47
-rw-r--r--src/chartitem_p.h57
-rw-r--r--src/chartpresenter.cpp509
-rw-r--r--src/chartpresenter_p.h192
-rw-r--r--src/charts/animations/animations.pri (renamed from src/animations/animations.pri)0
-rw-r--r--src/charts/animations/axisanimation.cpp135
-rw-r--r--src/charts/animations/axisanimation_p.h62
-rw-r--r--src/charts/animations/baranimation.cpp82
-rw-r--r--src/charts/animations/baranimation_p.h59
-rw-r--r--src/charts/animations/boxplotanimation.cpp97
-rw-r--r--src/charts/animations/boxplotanimation_p.h64
-rw-r--r--src/charts/animations/boxwhiskersanimation.cpp110
-rw-r--r--src/charts/animations/boxwhiskersanimation_p.h69
-rw-r--r--src/charts/animations/chartanimation.cpp46
-rw-r--r--src/charts/animations/chartanimation_p.h57
-rw-r--r--src/charts/animations/pieanimation.cpp110
-rw-r--r--src/charts/animations/pieanimation_p.h62
-rw-r--r--src/charts/animations/piesliceanimation.cpp128
-rw-r--r--src/charts/animations/piesliceanimation_p.h60
-rw-r--r--src/charts/animations/scatteranimation.cpp50
-rw-r--r--src/charts/animations/scatteranimation_p.h50
-rw-r--r--src/charts/animations/splineanimation.cpp210
-rw-r--r--src/charts/animations/splineanimation_p.h62
-rw-r--r--src/charts/animations/xyanimation.cpp155
-rw-r--r--src/charts/animations/xyanimation_p.h67
-rw-r--r--src/charts/areachart/areachart.pri (renamed from src/areachart/areachart.pri)0
-rw-r--r--src/charts/areachart/areachartitem.cpp262
-rw-r--r--src/charts/areachart/areachartitem_p.h123
-rw-r--r--src/charts/areachart/qareaseries.cpp657
-rw-r--r--src/charts/areachart/qareaseries.h106
-rw-r--r--src/charts/areachart/qareaseries_p.h76
-rw-r--r--src/charts/axis/axis.pri (renamed from src/axis/axis.pri)0
-rw-r--r--src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp140
-rw-r--r--src/charts/axis/barcategoryaxis/chartbarcategoryaxisx_p.h62
-rw-r--r--src/charts/axis/barcategoryaxis/chartbarcategoryaxisy.cpp142
-rw-r--r--src/charts/axis/barcategoryaxis/chartbarcategoryaxisy_p.h61
-rw-r--r--src/charts/axis/barcategoryaxis/qbarcategoryaxis.cpp620
-rw-r--r--src/charts/axis/barcategoryaxis/qbarcategoryaxis.h81
-rw-r--r--src/charts/axis/barcategoryaxis/qbarcategoryaxis_p.h81
-rw-r--r--src/charts/axis/cartesianchartaxis.cpp198
-rw-r--r--src/charts/axis/cartesianchartaxis_p.h79
-rw-r--r--src/charts/axis/categoryaxis/chartcategoryaxisx.cpp119
-rw-r--r--src/charts/axis/categoryaxis/chartcategoryaxisx_p.h61
-rw-r--r--src/charts/axis/categoryaxis/chartcategoryaxisy.cpp119
-rw-r--r--src/charts/axis/categoryaxis/chartcategoryaxisy_p.h61
-rw-r--r--src/charts/axis/categoryaxis/polarchartcategoryaxisangular.cpp80
-rw-r--r--src/charts/axis/categoryaxis/polarchartcategoryaxisangular_p.h56
-rw-r--r--src/charts/axis/categoryaxis/polarchartcategoryaxisradial.cpp79
-rw-r--r--src/charts/axis/categoryaxis/polarchartcategoryaxisradial_p.h56
-rw-r--r--src/charts/axis/categoryaxis/qcategoryaxis.cpp345
-rw-r--r--src/charts/axis/categoryaxis/qcategoryaxis.h70
-rw-r--r--src/charts/axis/categoryaxis/qcategoryaxis_p.h62
-rw-r--r--src/charts/axis/chartaxiselement.cpp404
-rw-r--r--src/charts/axis/chartaxiselement_p.h155
-rw-r--r--src/charts/axis/datetimeaxis/chartdatetimeaxisx.cpp133
-rw-r--r--src/charts/axis/datetimeaxis/chartdatetimeaxisx_p.h60
-rw-r--r--src/charts/axis/datetimeaxis/chartdatetimeaxisy.cpp134
-rw-r--r--src/charts/axis/datetimeaxis/chartdatetimeaxisy_p.h60
-rw-r--r--src/charts/axis/datetimeaxis/polarchartdatetimeaxisangular.cpp80
-rw-r--r--src/charts/axis/datetimeaxis/polarchartdatetimeaxisangular_p.h56
-rw-r--r--src/charts/axis/datetimeaxis/polarchartdatetimeaxisradial.cpp79
-rw-r--r--src/charts/axis/datetimeaxis/polarchartdatetimeaxisradial_p.h56
-rw-r--r--src/charts/axis/datetimeaxis/qdatetimeaxis.cpp390
-rw-r--r--src/charts/axis/datetimeaxis/qdatetimeaxis.h78
-rw-r--r--src/charts/axis/datetimeaxis/qdatetimeaxis_p.h73
-rw-r--r--src/charts/axis/horizontalaxis.cpp227
-rw-r--r--src/charts/axis/horizontalaxis_p.h50
-rw-r--r--src/charts/axis/linearrowitem_p.h76
-rw-r--r--src/charts/axis/logvalueaxis/chartlogvalueaxisx.cpp139
-rw-r--r--src/charts/axis/logvalueaxis/chartlogvalueaxisx_p.h63
-rw-r--r--src/charts/axis/logvalueaxis/chartlogvalueaxisy.cpp139
-rw-r--r--src/charts/axis/logvalueaxis/chartlogvalueaxisy_p.h63
-rw-r--r--src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp90
-rw-r--r--src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h57
-rw-r--r--src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp95
-rw-r--r--src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h57
-rw-r--r--src/charts/axis/logvalueaxis/qlogvalueaxis.cpp400
-rw-r--r--src/charts/axis/logvalueaxis/qlogvalueaxis.h77
-rw-r--r--src/charts/axis/logvalueaxis/qlogvalueaxis_p.h69
-rw-r--r--src/charts/axis/polarchartaxis.cpp126
-rw-r--r--src/charts/axis/polarchartaxis_p.h70
-rw-r--r--src/charts/axis/polarchartaxisangular.cpp433
-rw-r--r--src/charts/axis/polarchartaxisangular_p.h63
-rw-r--r--src/charts/axis/polarchartaxisradial.cpp297
-rw-r--r--src/charts/axis/polarchartaxisradial_p.h60
-rw-r--r--src/charts/axis/qabstractaxis.cpp1012
-rw-r--r--src/charts/axis/qabstractaxis.h193
-rw-r--r--src/charts/axis/qabstractaxis_p.h130
-rw-r--r--src/charts/axis/valueaxis/chartvalueaxisx.cpp130
-rw-r--r--src/charts/axis/valueaxis/chartvalueaxisx_p.h60
-rw-r--r--src/charts/axis/valueaxis/chartvalueaxisy.cpp130
-rw-r--r--src/charts/axis/valueaxis/chartvalueaxisy_p.h60
-rw-r--r--src/charts/axis/valueaxis/polarchartvalueaxisangular.cpp80
-rw-r--r--src/charts/axis/valueaxis/polarchartvalueaxisangular_p.h56
-rw-r--r--src/charts/axis/valueaxis/polarchartvalueaxisradial.cpp79
-rw-r--r--src/charts/axis/valueaxis/polarchartvalueaxisradial_p.h56
-rw-r--r--src/charts/axis/valueaxis/qvalueaxis.cpp459
-rw-r--r--src/charts/axis/valueaxis/qvalueaxis.h83
-rw-r--r--src/charts/axis/valueaxis/qvalueaxis_p.h70
-rw-r--r--src/charts/axis/verticalaxis.cpp231
-rw-r--r--src/charts/axis/verticalaxis_p.h50
-rw-r--r--src/charts/barchart/abstractbarchartitem.cpp268
-rw-r--r--src/charts/barchart/abstractbarchartitem_p.h96
-rw-r--r--src/charts/barchart/bar.cpp71
-rw-r--r--src/charts/barchart/bar_p.h66
-rw-r--r--src/charts/barchart/barchart.pri (renamed from src/barchart/barchart.pri)0
-rw-r--r--src/charts/barchart/horizontal/bar/horizontalbarchartitem.cpp94
-rw-r--r--src/charts/barchart/horizontal/bar/horizontalbarchartitem_p.h51
-rw-r--r--src/charts/barchart/horizontal/bar/qhorizontalbarseries.cpp126
-rw-r--r--src/charts/barchart/horizontal/bar/qhorizontalbarseries.h45
-rw-r--r--src/charts/barchart/horizontal/bar/qhorizontalbarseries_p.h50
-rw-r--r--src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp140
-rw-r--r--src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h52
-rw-r--r--src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp125
-rw-r--r--src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries.h45
-rw-r--r--src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h50
-rw-r--r--src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp107
-rw-r--r--src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h51
-rw-r--r--src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp121
-rw-r--r--src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries.h45
-rw-r--r--src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h50
-rw-r--r--src/charts/barchart/qabstractbarseries.cpp1030
-rw-r--r--src/charts/barchart/qabstractbarseries.h105
-rw-r--r--src/charts/barchart/qabstractbarseries_p.h118
-rw-r--r--src/charts/barchart/qbarmodelmapper.cpp561
-rw-r--r--src/charts/barchart/qbarmodelmapper.h69
-rw-r--r--src/charts/barchart/qbarmodelmapper_p.h96
-rw-r--r--src/charts/barchart/qbarset.cpp676
-rw-r--r--src/charts/barchart/qbarset.h120
-rw-r--r--src/charts/barchart/qbarset_p.h82
-rw-r--r--src/charts/barchart/qhbarmodelmapper.cpp258
-rw-r--r--src/charts/barchart/qhbarmodelmapper.h70
-rw-r--r--src/charts/barchart/qvbarmodelmapper.cpp258
-rw-r--r--src/charts/barchart/qvbarmodelmapper.h70
-rw-r--r--src/charts/barchart/vertical/bar/barchartitem.cpp125
-rw-r--r--src/charts/barchart/vertical/bar/barchartitem_p.h57
-rw-r--r--src/charts/barchart/vertical/bar/qbarseries.cpp125
-rw-r--r--src/charts/barchart/vertical/bar/qbarseries.h45
-rw-r--r--src/charts/barchart/vertical/bar/qbarseries_p.h52
-rw-r--r--src/charts/barchart/vertical/percent/percentbarchartitem.cpp171
-rw-r--r--src/charts/barchart/vertical/percent/percentbarchartitem_p.h59
-rw-r--r--src/charts/barchart/vertical/percent/qpercentbarseries.cpp126
-rw-r--r--src/charts/barchart/vertical/percent/qpercentbarseries.h46
-rw-r--r--src/charts/barchart/vertical/percent/qpercentbarseries_p.h51
-rw-r--r--src/charts/barchart/vertical/stacked/qstackedbarseries.cpp123
-rw-r--r--src/charts/barchart/vertical/stacked/qstackedbarseries.h46
-rw-r--r--src/charts/barchart/vertical/stacked/qstackedbarseries_p.h51
-rw-r--r--src/charts/barchart/vertical/stacked/stackedbarchartitem.cpp137
-rw-r--r--src/charts/barchart/vertical/stacked/stackedbarchartitem_p.h58
-rw-r--r--src/charts/boxplotchart/boxplotchart.pri (renamed from src/boxplotchart/boxplotchart.pri)0
-rw-r--r--src/charts/boxplotchart/boxplotchartitem.cpp215
-rw-r--r--src/charts/boxplotchart/boxplotchartitem_p.h84
-rw-r--r--src/charts/boxplotchart/boxwhiskers.cpp194
-rw-r--r--src/charts/boxplotchart/boxwhiskers_p.h102
-rw-r--r--src/charts/boxplotchart/boxwhiskersdata_p.h80
-rw-r--r--src/charts/boxplotchart/qboxplotmodelmapper.cpp489
-rw-r--r--src/charts/boxplotchart/qboxplotmodelmapper.h69
-rw-r--r--src/charts/boxplotchart/qboxplotmodelmapper_p.h93
-rw-r--r--src/charts/boxplotchart/qboxplotseries.cpp690
-rw-r--r--src/charts/boxplotchart/qboxplotseries.h85
-rw-r--r--src/charts/boxplotchart/qboxplotseries_p.h100
-rw-r--r--src/charts/boxplotchart/qboxset.cpp336
-rw-r--r--src/charts/boxplotchart/qboxset.h94
-rw-r--r--src/charts/boxplotchart/qboxset_p.h84
-rw-r--r--src/charts/boxplotchart/qvboxplotmodelmapper.cpp257
-rw-r--r--src/charts/boxplotchart/qvboxplotmodelmapper.h70
-rw-r--r--src/charts/chartbackground.cpp91
-rw-r--r--src/charts/chartbackground_p.h62
-rw-r--r--src/charts/chartconfig_p.h60
-rw-r--r--src/charts/chartdataset.cpp639
-rw-r--r--src/charts/chartdataset_p.h94
-rw-r--r--src/charts/chartelement.cpp55
-rw-r--r--src/charts/chartelement_p.h65
-rw-r--r--src/charts/charthelpers_p.h (renamed from src/charthelpers_p.h)0
-rw-r--r--src/charts/chartitem.cpp47
-rw-r--r--src/charts/chartitem_p.h57
-rw-r--r--src/charts/chartpresenter.cpp508
-rw-r--r--src/charts/chartpresenter_p.h192
-rw-r--r--src/charts/charts.pro82
-rw-r--r--src/charts/chartsnamespace.h28
-rw-r--r--src/charts/chartthememanager.cpp249
-rw-r--r--src/charts/chartthememanager_p.h84
-rw-r--r--src/charts/charttitle.cpp91
-rw-r--r--src/charts/charttitle_p.h53
-rw-r--r--src/charts/common.pri15
-rw-r--r--src/charts/doc/images/api_category_axis.png (renamed from doc/images/api_category_axis.png)bin6793 -> 6793 bytes
-rw-r--r--src/charts/doc/images/api_datatime_axis.png (renamed from doc/images/api_datatime_axis.png)bin78372 -> 78372 bytes
-rw-r--r--src/charts/doc/images/arrow_down.png (renamed from doc/images/arrow_down.png)bin177 -> 177 bytes
-rw-r--r--src/charts/doc/images/bg.png (renamed from doc/images/bg.png)bin372 -> 372 bytes
-rw-r--r--src/charts/doc/images/breadcrumb.png (renamed from doc/images/breadcrumb.png)bin134 -> 134 bytes
-rw-r--r--src/charts/doc/images/bullet_dn.png (renamed from doc/images/bullet_dn.png)bin230 -> 230 bytes
-rw-r--r--src/charts/doc/images/bullet_gt.png (renamed from doc/images/bullet_gt.png)bin124 -> 124 bytes
-rw-r--r--src/charts/doc/images/bullet_sq.png (renamed from doc/images/bullet_sq.png)bin74 -> 74 bytes
-rw-r--r--src/charts/doc/images/bullet_up.png (renamed from doc/images/bullet_up.png)bin210 -> 210 bytes
-rw-r--r--src/charts/doc/images/digia_logo.png (renamed from doc/images/digia_logo.png)bin690 -> 690 bytes
-rw-r--r--src/charts/doc/images/examples_areachart.png (renamed from doc/images/examples_areachart.png)bin41332 -> 41332 bytes
-rw-r--r--src/charts/doc/images/examples_audio.png (renamed from doc/images/demos_audio.png)bin49452 -> 49452 bytes
-rw-r--r--src/charts/doc/images/examples_barchart.png (renamed from doc/images/examples_barchart.png)bin31448 -> 31448 bytes
-rw-r--r--src/charts/doc/images/examples_barmodelmapper.png (renamed from doc/images/examples_barmodelmapper.png)bin91629 -> 91629 bytes
-rw-r--r--src/charts/doc/images/examples_boxplotchart.png (renamed from doc/images/examples_boxplotchart.png)bin69135 -> 69135 bytes
-rw-r--r--src/charts/doc/images/examples_callout.png (renamed from doc/images/demos_callout.png)bin79984 -> 79984 bytes
-rw-r--r--src/charts/doc/images/examples_chartthemes_blue_cerulean.png (renamed from doc/images/demo_chartthemes_blue_cerulean.png)bin129218 -> 129218 bytes
-rw-r--r--src/charts/doc/images/examples_chartthemes_brown_sand.png (renamed from doc/images/demo_chartthemes_brown_sand.png)bin112797 -> 112797 bytes
-rw-r--r--src/charts/doc/images/examples_chartthemes_light.png (renamed from doc/images/demo_chartthemes_light.png)bin108482 -> 108482 bytes
-rw-r--r--src/charts/doc/images/examples_customchart.png (renamed from doc/images/examples_customchart.png)bin30554 -> 30554 bytes
-rw-r--r--src/charts/doc/images/examples_datetimeaxis.png (renamed from doc/images/examples_datetimeaxis.png)bin75267 -> 75267 bytes
-rw-r--r--src/charts/doc/images/examples_donutbreakdown.png (renamed from doc/images/examples_donutbreakdown.png)bin92062 -> 92062 bytes
-rw-r--r--src/charts/doc/images/examples_donutchart.png (renamed from doc/images/examples_donutchart.png)bin47040 -> 47040 bytes
-rw-r--r--src/charts/doc/images/examples_dynamicspline1.png (renamed from doc/images/demos_dynamicspline1.png)bin34292 -> 34292 bytes
-rw-r--r--src/charts/doc/images/examples_dynamicspline2.png (renamed from doc/images/demos_dynamicspline2.png)bin40347 -> 40347 bytes
-rw-r--r--src/charts/doc/images/examples_horizontalbarchart.png (renamed from doc/images/examples_horizontalbarchart.png)bin42261 -> 42261 bytes
-rw-r--r--src/charts/doc/images/examples_horizontalpercentbarchart.png (renamed from doc/images/examples_horizontalpercentbarchart.png)bin39993 -> 39993 bytes
-rw-r--r--src/charts/doc/images/examples_horizontalstackedbarchart.png (renamed from doc/images/examples_horizontalstackedbarchart.png)bin40940 -> 40940 bytes
-rw-r--r--src/charts/doc/images/examples_legend_detach.png (renamed from doc/images/examples_legend_detach.png)bin61273 -> 61273 bytes
-rw-r--r--src/charts/doc/images/examples_legend_detach2.png (renamed from doc/images/examples_legend_detach2.png)bin75296 -> 75296 bytes
-rw-r--r--src/charts/doc/images/examples_legendmarkers.png (renamed from doc/images/examples_legendmarkers.png)bin65162 -> 65162 bytes
-rw-r--r--src/charts/doc/images/examples_lineandbar.png (renamed from doc/images/examples_lineandbar.png)bin48731 -> 48731 bytes
-rw-r--r--src/charts/doc/images/examples_linechart.png (renamed from doc/images/examples_linechart.png)bin41188 -> 41188 bytes
-rw-r--r--src/charts/doc/images/examples_logvalueaxis.png (renamed from doc/images/examples_logvalueaxis.png)bin43823 -> 43823 bytes
-rw-r--r--src/charts/doc/images/examples_modeldata.png (renamed from doc/images/examples_modeldata.png)bin122670 -> 122670 bytes
-rw-r--r--src/charts/doc/images/examples_multiaxis.png (renamed from doc/images/examples_multiaxis.png)bin91649 -> 91649 bytes
-rw-r--r--src/charts/doc/images/examples_nesteddonuts.png (renamed from doc/images/demos_nesteddonuts.png)bin99909 -> 99909 bytes
-rw-r--r--src/charts/doc/images/examples_percentbarchart.png (renamed from doc/images/examples_percentbarchart.png)bin41041 -> 41041 bytes
-rw-r--r--src/charts/doc/images/examples_percentbarchart_legend.png (renamed from doc/images/examples_percentbarchart_legend.png)bin66859 -> 66859 bytes
-rw-r--r--src/charts/doc/images/examples_piechart.png (renamed from doc/images/examples_piechart.png)bin37613 -> 37613 bytes
-rw-r--r--src/charts/doc/images/examples_piechartdrill1.png (renamed from doc/images/examples_piechartdrill1.png)bin48580 -> 48580 bytes
-rw-r--r--src/charts/doc/images/examples_piechartdrill2.png (renamed from doc/images/examples_piechartdrill2.png)bin59468 -> 59468 bytes
-rw-r--r--src/charts/doc/images/examples_polarchart.png (renamed from doc/images/examples_polarchart.png)bin144425 -> 144425 bytes
-rw-r--r--src/charts/doc/images/examples_qmlaxes1.png (renamed from doc/images/demos_qmlaxes1.png)bin43753 -> 43753 bytes
-rw-r--r--src/charts/doc/images/examples_qmlaxes2.png (renamed from doc/images/demos_qmlaxes2.png)bin40033 -> 40033 bytes
-rw-r--r--src/charts/doc/images/examples_qmlaxes3.png (renamed from doc/images/demos_qmlaxes3.png)bin35051 -> 35051 bytes
-rw-r--r--src/charts/doc/images/examples_qmlboxplot.png (renamed from doc/images/examples_qmlboxplot.png)bin38202 -> 38202 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart1.png (renamed from doc/images/demos_qmlchart1.png)bin41391 -> 41391 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart10.png (renamed from doc/images/demos_qmlchart10.png)bin38626 -> 38626 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart11.png (renamed from doc/images/demos_qmlchart11.png)bin37772 -> 37772 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart12.png (renamed from doc/images/demos_qmlchart12.png)bin74409 -> 74409 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart2.png (renamed from doc/images/demos_qmlchart2.png)bin37390 -> 37390 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart3.png (renamed from doc/images/demos_qmlchart3.png)bin39135 -> 39135 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart4.png (renamed from doc/images/demos_qmlchart4.png)bin51563 -> 51563 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart5.png (renamed from doc/images/demos_qmlchart5.png)bin37997 -> 37997 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart6.png (renamed from doc/images/demos_qmlchart6.png)bin20283 -> 20283 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart7.png (renamed from doc/images/demos_qmlchart7.png)bin37926 -> 37926 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart8.png (renamed from doc/images/demos_qmlchart8.png)bin37293 -> 37293 bytes
-rw-r--r--src/charts/doc/images/examples_qmlchart9.png (renamed from doc/images/demos_qmlchart9.png)bin37972 -> 37972 bytes
-rw-r--r--src/charts/doc/images/examples_qmlcustomizations.png (renamed from doc/images/demos_qmlcustomizations.png)bin38735 -> 38735 bytes
-rw-r--r--src/charts/doc/images/examples_qmlcustomlegend1.png (renamed from doc/images/demos-qmlcustomlegend1.png)bin53458 -> 53458 bytes
-rw-r--r--src/charts/doc/images/examples_qmlcustomlegend2.png (renamed from doc/images/demos-qmlcustomlegend2.png)bin55307 -> 55307 bytes
-rw-r--r--src/charts/doc/images/examples_qmlcustomlegend3.png (renamed from doc/images/demos-qmlcustomlegend3.png)bin43897 -> 43897 bytes
-rw-r--r--src/charts/doc/images/examples_qmlcustommodel.png (renamed from doc/images/demos_qmlcustommodel.png)bin49142 -> 49142 bytes
-rw-r--r--src/charts/doc/images/examples_qmlf1legends.png (renamed from doc/images/demos_qmlf1legends.png)bin48312 -> 48312 bytes
-rw-r--r--src/charts/doc/images/examples_qmloscilloscope.png (renamed from doc/images/demos_qmloscilloscope.png)bin56377 -> 56377 bytes
-rw-r--r--src/charts/doc/images/examples_qmlpiechart.png (renamed from doc/images/examples_qmlpiechart.png)bin32704 -> 32704 bytes
-rw-r--r--src/charts/doc/images/examples_qmlpolarchart1.png (renamed from doc/images/demos_qmlpolarchart1.png)bin95929 -> 95929 bytes
-rw-r--r--src/charts/doc/images/examples_qmlpolarchart2.png (renamed from doc/images/demos_qmlpolarchart2.png)bin108429 -> 108429 bytes
-rw-r--r--src/charts/doc/images/examples_qmlpolarchart3.png (renamed from doc/images/demos_qmlpolarchart3.png)bin90823 -> 90823 bytes
-rw-r--r--src/charts/doc/images/examples_qmlweather.png (renamed from doc/images/demos_qmlweather.png)bin64793 -> 64793 bytes
-rw-r--r--src/charts/doc/images/examples_scatterchart.png (renamed from doc/images/examples_scatterchart.png)bin30702 -> 30702 bytes
-rw-r--r--src/charts/doc/images/examples_scatterinteractions.png (renamed from doc/images/examples_scatterinteractions.png)bin41609 -> 41609 bytes
-rw-r--r--src/charts/doc/images/examples_splinechart.png (renamed from doc/images/examples_splinechart.png)bin41052 -> 41052 bytes
-rw-r--r--src/charts/doc/images/examples_stackedbarchart.png (renamed from doc/images/examples_stackedbarchart.png)bin40699 -> 40699 bytes
-rw-r--r--src/charts/doc/images/examples_stackedbarchartdrilldown1.png (renamed from doc/images/examples_stackedbarchartdrilldown1.png)bin39237 -> 39237 bytes
-rw-r--r--src/charts/doc/images/examples_stackedbarchartdrilldown2.png (renamed from doc/images/examples_stackedbarchartdrilldown2.png)bin37845 -> 37845 bytes
-rw-r--r--src/charts/doc/images/examples_temperaturerecords.png (renamed from doc/images/examples_temperaturerecords.png)bin38760 -> 38760 bytes
-rw-r--r--src/charts/doc/images/examples_zoomlinechart1.png (renamed from doc/images/examples_zoomlinechart1.png)bin50892 -> 50892 bytes
-rw-r--r--src/charts/doc/images/examples_zoomlinechart2.png (renamed from doc/images/examples_zoomlinechart2.png)bin40448 -> 40448 bytes
-rw-r--r--src/charts/doc/images/horBar.png (renamed from doc/images/horBar.png)bin2807 -> 2807 bytes
-rw-r--r--src/charts/doc/images/piechart_customization.png (renamed from doc/images/piechart_customization.png)bin132696 -> 132696 bytes
-rw-r--r--src/charts/doc/images/qcharts.png (renamed from doc/images/qcharts.png)bin5582 -> 5582 bytes
-rw-r--r--src/charts/doc/images/qt-logo.png (renamed from doc/images/qt-logo.png)bin5149 -> 5149 bytes
-rw-r--r--src/charts/doc/qtcharts.qdocconf66
-rw-r--r--src/charts/doc/snippets/doc_src_qmlcharts.cpp21
-rw-r--r--src/charts/doc/snippets/doc_src_qtcharts.cpp35
-rw-r--r--src/charts/doc/snippets/doc_src_qtcharts.pro21
-rw-r--r--src/charts/doc/src/examples-areachart.qdoc30
-rw-r--r--src/charts/doc/src/examples-audio.qdoc8
-rw-r--r--src/charts/doc/src/examples-barchart.qdoc47
-rw-r--r--src/charts/doc/src/examples-barmodelmapper.qdoc58
-rw-r--r--src/charts/doc/src/examples-boxplotchart.qdoc78
-rw-r--r--src/charts/doc/src/examples-callout.qdoc15
-rw-r--r--src/charts/doc/src/examples-chartthemes.qdoc15
-rw-r--r--src/charts/doc/src/examples-customchart.qdoc26
-rw-r--r--src/charts/doc/src/examples-datetimeaxis.qdoc38
-rw-r--r--src/charts/doc/src/examples-donutbreakdown.qdoc45
-rw-r--r--src/charts/doc/src/examples-donutchart.qdoc9
-rw-r--r--src/charts/doc/src/examples-dynamicspline.qdoc10
-rw-r--r--src/charts/doc/src/examples-horizontalbarchart.qdoc50
-rw-r--r--src/charts/doc/src/examples-horizontalpercentbarchart.qdoc56
-rw-r--r--src/charts/doc/src/examples-horizontalstackedbarchart.qdoc53
-rw-r--r--src/charts/doc/src/examples-legend.qdoc40
-rw-r--r--src/charts/doc/src/examples-legendmarkers.qdoc43
-rw-r--r--src/charts/doc/src/examples-lineandbarchart.qdoc48
-rw-r--r--src/charts/doc/src/examples-linechart.qdoc30
-rw-r--r--src/charts/doc/src/examples-logvalueaxis.qdoc30
-rw-r--r--src/charts/doc/src/examples-modeldata.qdoc59
-rw-r--r--src/charts/doc/src/examples-multiaxis.qdoc37
-rw-r--r--src/charts/doc/src/examples-nesteddonuts.qdoc50
-rw-r--r--src/charts/doc/src/examples-percentbarchart.qdoc55
-rw-r--r--src/charts/doc/src/examples-piechart.qdoc9
-rw-r--r--src/charts/doc/src/examples-piechartcustomization.qdoc8
-rw-r--r--src/charts/doc/src/examples-piechartdrilldown.qdoc9
-rw-r--r--src/charts/doc/src/examples-polarchart.qdoc34
-rw-r--r--src/charts/doc/src/examples-qmlaxes.qdoc32
-rw-r--r--src/charts/doc/src/examples-qmlchart.qdoc125
-rw-r--r--src/charts/doc/src/examples-qmlcustomizations.qdoc28
-rw-r--r--src/charts/doc/src/examples-qmlcustomlegend.qdoc43
-rw-r--r--src/charts/doc/src/examples-qmlf1legends.qdoc23
-rw-r--r--src/charts/doc/src/examples-qmloscilloscope.qdoc47
-rw-r--r--src/charts/doc/src/examples-qmlpolarchart.qdoc35
-rw-r--r--src/charts/doc/src/examples-qmlweather.qdoc34
-rw-r--r--src/charts/doc/src/examples-scatterchart.qdoc39
-rw-r--r--src/charts/doc/src/examples-scatterinteractions.qdoc10
-rw-r--r--src/charts/doc/src/examples-splinechart.qdoc34
-rw-r--r--src/charts/doc/src/examples-stackedbarchart.qdoc53
-rw-r--r--src/charts/doc/src/examples-stackedbarchartdrilldown.qdoc50
-rw-r--r--src/charts/doc/src/examples-temperaturerecords.qdoc46
-rw-r--r--src/charts/doc/src/examples-zoomlinechart.qdoc33
-rw-r--r--src/charts/doc/src/index.qdoc61
-rw-r--r--src/charts/doc/src/qtcharts.qdoc200
-rw-r--r--src/charts/doc/style/offline.css (renamed from doc/style/offline.css)0
-rw-r--r--src/charts/domain/abstractdomain.cpp265
-rw-r--r--src/charts/domain/abstractdomain_p.h132
-rw-r--r--src/charts/domain/domain.pri (renamed from src/domain/domain.pri)0
-rw-r--r--src/charts/domain/logxlogydomain.cpp278
-rw-r--r--src/charts/domain/logxlogydomain_p.h79
-rw-r--r--src/charts/domain/logxlogypolardomain.cpp273
-rw-r--r--src/charts/domain/logxlogypolardomain_p.h81
-rw-r--r--src/charts/domain/logxydomain.cpp245
-rw-r--r--src/charts/domain/logxydomain_p.h75
-rw-r--r--src/charts/domain/logxypolardomain.cpp242
-rw-r--r--src/charts/domain/logxypolardomain_p.h77
-rw-r--r--src/charts/domain/polardomain.cpp91
-rw-r--r--src/charts/domain/polardomain_p.h62
-rw-r--r--src/charts/domain/xlogydomain.cpp241
-rw-r--r--src/charts/domain/xlogydomain_p.h75
-rw-r--r--src/charts/domain/xlogypolardomain.cpp237
-rw-r--r--src/charts/domain/xlogypolardomain_p.h77
-rw-r--r--src/charts/domain/xydomain.cpp186
-rw-r--r--src/charts/domain/xydomain_p.h64
-rw-r--r--src/charts/domain/xypolardomain.cpp184
-rw-r--r--src/charts/domain/xypolardomain_p.h65
-rw-r--r--src/charts/layout/abstractchartlayout.cpp203
-rw-r--r--src/charts/layout/abstractchartlayout_p.h82
-rw-r--r--src/charts/layout/cartesianchartlayout.cpp246
-rw-r--r--src/charts/layout/cartesianchartlayout_p.h50
-rw-r--r--src/charts/layout/layout.pri (renamed from src/layout/layout.pri)0
-rw-r--r--src/charts/layout/polarchartlayout.cpp82
-rw-r--r--src/charts/layout/polarchartlayout_p.h50
-rw-r--r--src/charts/legend/legend.pri (renamed from src/legend/legend.pri)0
-rw-r--r--src/charts/legend/legendlayout.cpp506
-rw-r--r--src/charts/legend/legendlayout_p.h84
-rw-r--r--src/charts/legend/legendmarkeritem.cpp192
-rw-r--r--src/charts/legend/legendmarkeritem_p.h101
-rw-r--r--src/charts/legend/legendscroller.cpp74
-rw-r--r--src/charts/legend/legendscroller_p.h57
-rw-r--r--src/charts/legend/qarealegendmarker.cpp126
-rw-r--r--src/charts/legend/qarealegendmarker.h56
-rw-r--r--src/charts/legend/qarealegendmarker_p.h64
-rw-r--r--src/charts/legend/qbarlegendmarker.cpp146
-rw-r--r--src/charts/legend/qbarlegendmarker.h57
-rw-r--r--src/charts/legend/qbarlegendmarker_p.h66
-rw-r--r--src/charts/legend/qboxplotlegendmarker.cpp127
-rw-r--r--src/charts/legend/qboxplotlegendmarker.h55
-rw-r--r--src/charts/legend/qboxplotlegendmarker_p.h64
-rw-r--r--src/charts/legend/qlegend.cpp632
-rw-r--r--src/charts/legend/qlegend.h112
-rw-r--r--src/charts/legend/qlegend_p.h101
-rw-r--r--src/charts/legend/qlegendmarker.cpp294
-rw-r--r--src/charts/legend/qlegendmarker.h105
-rw-r--r--src/charts/legend/qlegendmarker_p.h82
-rw-r--r--src/charts/legend/qpielegendmarker.cpp144
-rw-r--r--src/charts/legend/qpielegendmarker.h57
-rw-r--r--src/charts/legend/qpielegendmarker_p.h68
-rw-r--r--src/charts/legend/qxylegendmarker.cpp138
-rw-r--r--src/charts/legend/qxylegendmarker.h55
-rw-r--r--src/charts/legend/qxylegendmarker_p.h64
-rw-r--r--src/charts/linechart/linechart.pri (renamed from src/linechart/linechart.pri)0
-rw-r--r--src/charts/linechart/linechartitem.cpp405
-rw-r--r--src/charts/linechart/linechartitem_p.h91
-rw-r--r--src/charts/linechart/qlineseries.cpp173
-rw-r--r--src/charts/linechart/qlineseries.h52
-rw-r--r--src/charts/linechart/qlineseries_p.h51
-rw-r--r--src/charts/piechart/piechart.pri (renamed from src/piechart/piechart.pri)0
-rw-r--r--src/charts/piechart/piechartitem.cpp228
-rw-r--r--src/charts/piechart/piechartitem_p.h86
-rw-r--r--src/charts/piechart/pieslicedata_p.h141
-rw-r--r--src/charts/piechart/piesliceitem.cpp319
-rw-r--r--src/charts/piechart/piesliceitem_p.h91
-rw-r--r--src/charts/piechart/qhpiemodelmapper.cpp267
-rw-r--r--src/charts/piechart/qhpiemodelmapper.h70
-rw-r--r--src/charts/piechart/qpiemodelmapper.cpp568
-rw-r--r--src/charts/piechart/qpiemodelmapper.h69
-rw-r--r--src/charts/piechart/qpiemodelmapper_p.h99
-rw-r--r--src/charts/piechart/qpieseries.cpp947
-rw-r--r--src/charts/piechart/qpieseries.h103
-rw-r--r--src/charts/piechart/qpieseries_p.h93
-rw-r--r--src/charts/piechart/qpieslice.cpp794
-rw-r--r--src/charts/piechart/qpieslice.h147
-rw-r--r--src/charts/piechart/qpieslice_p.h80
-rw-r--r--src/charts/piechart/qvpiemodelmapper.cpp270
-rw-r--r--src/charts/piechart/qvpiemodelmapper.h70
-rw-r--r--src/charts/qabstractseries.cpp328
-rw-r--r--src/charts/qabstractseries.h98
-rw-r--r--src/charts/qabstractseries_p.h105
-rw-r--r--src/charts/qchart.cpp872
-rw-r--r--src/charts/qchart.h183
-rw-r--r--src/charts/qchart_p.h70
-rw-r--r--src/charts/qchartglobal.h78
-rw-r--r--src/charts/qchartview.cpp317
-rw-r--r--src/charts/qchartview.h74
-rw-r--r--src/charts/qchartview_p.h65
-rw-r--r--src/charts/qpolarchart.cpp133
-rw-r--r--src/charts/qpolarchart.h60
-rw-r--r--src/charts/scatterchart/qscatterseries.cpp336
-rw-r--r--src/charts/scatterchart/qscatterseries.h75
-rw-r--r--src/charts/scatterchart/qscatterseries_p.h53
-rw-r--r--src/charts/scatterchart/scatter.pri (renamed from src/scatterchart/scatter.pri)0
-rw-r--r--src/charts/scatterchart/scatterchartitem.cpp237
-rw-r--r--src/charts/scatterchart/scatterchartitem_p.h151
-rw-r--r--src/charts/scroller.cpp216
-rw-r--r--src/charts/scroller_p.h109
-rw-r--r--src/charts/splinechart/qsplineseries.cpp165
-rw-r--r--src/charts/splinechart/qsplineseries.h51
-rw-r--r--src/charts/splinechart/qsplineseries_p.h54
-rw-r--r--src/charts/splinechart/splinechart.pri (renamed from src/splinechart/splinechart.pri)0
-rw-r--r--src/charts/splinechart/splinechartitem.cpp485
-rw-r--r--src/charts/splinechart/splinechartitem_p.h94
-rw-r--r--src/charts/themes/charttheme_p.h93
-rw-r--r--src/charts/themes/chartthemebluecerulean_p.h70
-rw-r--r--src/charts/themes/chartthemeblueicy_p.h72
-rw-r--r--src/charts/themes/chartthemebluencs_p.h71
-rw-r--r--src/charts/themes/chartthemebrownsand_p.h71
-rw-r--r--src/charts/themes/chartthemedark_p.h71
-rw-r--r--src/charts/themes/chartthemehighcontrast_p.h73
-rw-r--r--src/charts/themes/chartthemelight_p.h73
-rw-r--r--src/charts/themes/chartthemeqt_p.h74
-rw-r--r--src/charts/themes/chartthemesystem_p.h177
-rw-r--r--src/charts/themes/themes.pri (renamed from src/themes/themes.pri)0
-rw-r--r--src/charts/xychart/qhxymodelmapper.cpp243
-rw-r--r--src/charts/xychart/qhxymodelmapper.h70
-rw-r--r--src/charts/xychart/qvxymodelmapper.cpp243
-rw-r--r--src/charts/xychart/qvxymodelmapper.h70
-rw-r--r--src/charts/xychart/qxymodelmapper.cpp533
-rw-r--r--src/charts/xychart/qxymodelmapper.h69
-rw-r--r--src/charts/xychart/qxymodelmapper_p.h97
-rw-r--r--src/charts/xychart/qxyseries.cpp801
-rw-r--r--src/charts/xychart/qxyseries.h120
-rw-r--r--src/charts/xychart/qxyseries_p.h79
-rw-r--r--src/charts/xychart/xychart.cpp189
-rw-r--r--src/charts/xychart/xychart.pri20
-rw-r--r--src/charts/xychart/xychart_p.h92
-rw-r--r--src/chartsnamespace.h28
-rw-r--r--src/chartsqml2/chartsqml2.pro69
-rw-r--r--src/chartsqml2/chartsqml2_plugin.cpp312
-rw-r--r--src/chartsqml2/declarativeareaseries.cpp115
-rw-r--r--src/chartsqml2/declarativeareaseries.h94
-rw-r--r--src/chartsqml2/declarativeaxes.cpp61
-rw-r--r--src/chartsqml2/declarativeaxes.h72
-rw-r--r--src/chartsqml2/declarativebarseries.cpp509
-rw-r--r--src/chartsqml2/declarativebarseries.h361
-rw-r--r--src/chartsqml2/declarativeboxplotseries.cpp423
-rw-r--r--src/chartsqml2/declarativeboxplotseries.h142
-rw-r--r--src/chartsqml2/declarativecategoryaxis.cpp100
-rw-r--r--src/chartsqml2/declarativecategoryaxis.h76
-rw-r--r--src/chartsqml2/declarativechart.cpp1063
-rw-r--r--src/chartsqml2/declarativechart.h231
-rw-r--r--src/chartsqml2/declarativelineseries.cpp104
-rw-r--r--src/chartsqml2/declarativelineseries.h109
-rw-r--r--src/chartsqml2/declarativemargins.cpp113
-rw-r--r--src/chartsqml2/declarativemargins.h54
-rw-r--r--src/chartsqml2/declarativepieseries.cpp154
-rw-r--r--src/chartsqml2/declarativepieseries.h85
-rw-r--r--src/chartsqml2/declarativepolarchart.cpp64
-rw-r--r--src/chartsqml2/declarativepolarchart.h41
-rw-r--r--src/chartsqml2/declarativescatterseries.cpp114
-rw-r--r--src/chartsqml2/declarativescatterseries.h116
-rw-r--r--src/chartsqml2/declarativesplineseries.cpp104
-rw-r--r--src/chartsqml2/declarativesplineseries.h109
-rw-r--r--src/chartsqml2/declarativexypoint.cpp54
-rw-r--r--src/chartsqml2/declarativexypoint.h42
-rw-r--r--src/chartsqml2/declarativexyseries.cpp118
-rw-r--r--src/chartsqml2/declarativexyseries.h54
-rw-r--r--src/chartsqml2/plugins.qmltypes2305
-rw-r--r--src/chartsqml2/qmldir4
-rw-r--r--src/chartthememanager.cpp249
-rw-r--r--src/chartthememanager_p.h84
-rw-r--r--src/charttitle.cpp91
-rw-r--r--src/charttitle_p.h53
-rw-r--r--src/domain/abstractdomain.cpp266
-rw-r--r--src/domain/abstractdomain_p.h132
-rw-r--r--src/domain/logxlogydomain.cpp278
-rw-r--r--src/domain/logxlogydomain_p.h79
-rw-r--r--src/domain/logxlogypolardomain.cpp273
-rw-r--r--src/domain/logxlogypolardomain_p.h81
-rw-r--r--src/domain/logxydomain.cpp245
-rw-r--r--src/domain/logxydomain_p.h75
-rw-r--r--src/domain/logxypolardomain.cpp242
-rw-r--r--src/domain/logxypolardomain_p.h77
-rw-r--r--src/domain/polardomain.cpp91
-rw-r--r--src/domain/polardomain_p.h62
-rw-r--r--src/domain/xlogydomain.cpp241
-rw-r--r--src/domain/xlogydomain_p.h75
-rw-r--r--src/domain/xlogypolardomain.cpp237
-rw-r--r--src/domain/xlogypolardomain_p.h77
-rw-r--r--src/domain/xydomain.cpp186
-rw-r--r--src/domain/xydomain_p.h64
-rw-r--r--src/domain/xypolardomain.cpp184
-rw-r--r--src/domain/xypolardomain_p.h65
-rw-r--r--src/layout/abstractchartlayout.cpp203
-rw-r--r--src/layout/abstractchartlayout_p.h82
-rw-r--r--src/layout/cartesianchartlayout.cpp246
-rw-r--r--src/layout/cartesianchartlayout_p.h50
-rw-r--r--src/layout/polarchartlayout.cpp82
-rw-r--r--src/layout/polarchartlayout_p.h50
-rw-r--r--src/legend/legendlayout.cpp506
-rw-r--r--src/legend/legendlayout_p.h84
-rw-r--r--src/legend/legendmarkeritem.cpp191
-rw-r--r--src/legend/legendmarkeritem_p.h101
-rw-r--r--src/legend/legendscroller.cpp74
-rw-r--r--src/legend/legendscroller_p.h57
-rw-r--r--src/legend/qarealegendmarker.cpp126
-rw-r--r--src/legend/qarealegendmarker.h56
-rw-r--r--src/legend/qarealegendmarker_p.h64
-rw-r--r--src/legend/qbarlegendmarker.cpp146
-rw-r--r--src/legend/qbarlegendmarker.h57
-rw-r--r--src/legend/qbarlegendmarker_p.h66
-rw-r--r--src/legend/qboxplotlegendmarker.cpp127
-rw-r--r--src/legend/qboxplotlegendmarker.h55
-rw-r--r--src/legend/qboxplotlegendmarker_p.h64
-rw-r--r--src/legend/qlegend.cpp623
-rw-r--r--src/legend/qlegend.h112
-rw-r--r--src/legend/qlegend_p.h101
-rw-r--r--src/legend/qlegendmarker.cpp294
-rw-r--r--src/legend/qlegendmarker.h105
-rw-r--r--src/legend/qlegendmarker_p.h82
-rw-r--r--src/legend/qpielegendmarker.cpp144
-rw-r--r--src/legend/qpielegendmarker.h57
-rw-r--r--src/legend/qpielegendmarker_p.h68
-rw-r--r--src/legend/qxylegendmarker.cpp138
-rw-r--r--src/legend/qxylegendmarker.h55
-rw-r--r--src/legend/qxylegendmarker_p.h64
-rw-r--r--src/linechart/linechartitem.cpp405
-rw-r--r--src/linechart/linechartitem_p.h91
-rw-r--r--src/linechart/qlineseries.cpp172
-rw-r--r--src/linechart/qlineseries.h52
-rw-r--r--src/linechart/qlineseries_p.h51
-rw-r--r--src/piechart/piechartitem.cpp228
-rw-r--r--src/piechart/piechartitem_p.h86
-rw-r--r--src/piechart/pieslicedata_p.h141
-rw-r--r--src/piechart/piesliceitem.cpp319
-rw-r--r--src/piechart/piesliceitem_p.h91
-rw-r--r--src/piechart/qhpiemodelmapper.cpp257
-rw-r--r--src/piechart/qhpiemodelmapper.h70
-rw-r--r--src/piechart/qpiemodelmapper.cpp568
-rw-r--r--src/piechart/qpiemodelmapper.h69
-rw-r--r--src/piechart/qpiemodelmapper_p.h99
-rw-r--r--src/piechart/qpieseries.cpp944
-rw-r--r--src/piechart/qpieseries.h103
-rw-r--r--src/piechart/qpieseries_p.h93
-rw-r--r--src/piechart/qpieslice.cpp789
-rw-r--r--src/piechart/qpieslice.h147
-rw-r--r--src/piechart/qpieslice_p.h80
-rw-r--r--src/piechart/qvpiemodelmapper.cpp260
-rw-r--r--src/piechart/qvpiemodelmapper.h70
-rw-r--r--src/qabstractseries.cpp333
-rw-r--r--src/qabstractseries.h98
-rw-r--r--src/qabstractseries_p.h105
-rw-r--r--src/qchart.cpp872
-rw-r--r--src/qchart.h183
-rw-r--r--src/qchart_p.h70
-rw-r--r--src/qchartglobal.h97
-rw-r--r--src/qchartview.cpp317
-rw-r--r--src/qchartview.h74
-rw-r--r--src/qchartview_p.h65
-rw-r--r--src/qpolarchart.cpp133
-rw-r--r--src/qpolarchart.h60
-rw-r--r--src/scatterchart/qscatterseries.cpp334
-rw-r--r--src/scatterchart/qscatterseries.h75
-rw-r--r--src/scatterchart/qscatterseries_p.h53
-rw-r--r--src/scatterchart/scatterchartitem.cpp237
-rw-r--r--src/scatterchart/scatterchartitem_p.h151
-rw-r--r--src/scroller.cpp216
-rw-r--r--src/scroller_p.h109
-rw-r--r--src/splinechart/qsplineseries.cpp164
-rw-r--r--src/splinechart/qsplineseries.h51
-rw-r--r--src/splinechart/qsplineseries_p.h54
-rw-r--r--src/splinechart/splinechartitem.cpp485
-rw-r--r--src/splinechart/splinechartitem_p.h94
-rw-r--r--src/src.pro270
-rw-r--r--src/themes/charttheme_p.h93
-rw-r--r--src/themes/chartthemebluecerulean_p.h70
-rw-r--r--src/themes/chartthemeblueicy_p.h72
-rw-r--r--src/themes/chartthemebluencs_p.h71
-rw-r--r--src/themes/chartthemebrownsand_p.h71
-rw-r--r--src/themes/chartthemedark_p.h71
-rw-r--r--src/themes/chartthemehighcontrast_p.h73
-rw-r--r--src/themes/chartthemelight_p.h73
-rw-r--r--src/themes/chartthemeqt_p.h74
-rw-r--r--src/themes/chartthemesystem_p.h177
-rw-r--r--src/xychart/qhxymodelmapper.cpp246
-rw-r--r--src/xychart/qhxymodelmapper.h70
-rw-r--r--src/xychart/qvxymodelmapper.cpp246
-rw-r--r--src/xychart/qvxymodelmapper.h70
-rw-r--r--src/xychart/qxymodelmapper.cpp533
-rw-r--r--src/xychart/qxymodelmapper.h69
-rw-r--r--src/xychart/qxymodelmapper_p.h97
-rw-r--r--src/xychart/qxyseries.cpp804
-rw-r--r--src/xychart/qxyseries.h120
-rw-r--r--src/xychart/qxyseries_p.h79
-rw-r--r--src/xychart/xychart.cpp189
-rw-r--r--src/xychart/xychart.pri21
-rw-r--r--src/xychart/xychart_p.h92
-rw-r--r--sync.profile19
-rw-r--r--tests/auto/auto.pri22
-rw-r--r--tests/auto/auto.pro25
-rw-r--r--tests/auto/chartdataset/chartdataset.pro2
-rw-r--r--tests/auto/chartdataset/tst_chartdataset.cpp6
-rw-r--r--tests/auto/domain/domain.pro2
-rw-r--r--tests/auto/domain/tst_domain.cpp6
-rw-r--r--tests/auto/inc/tst_definitions.h35
-rw-r--r--tests/auto/qabstractaxis/tst_qabstractaxis.cpp16
-rw-r--r--tests/auto/qabstractaxis/tst_qabstractaxis.h2
-rw-r--r--tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp2
-rw-r--r--tests/auto/qbarseries/tst_qbarseries.cpp2
-rw-r--r--tests/auto/qbarset/tst_qbarset.cpp2
-rw-r--r--tests/auto/qchart/tst_qchart.cpp2
-rw-r--r--tests/auto/qchartview/tst_qchartview.cpp8
-rw-r--r--tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp2
-rw-r--r--tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp2
-rw-r--r--tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp2
-rw-r--r--tests/auto/qlegend/tst_qlegend.cpp2
-rw-r--r--tests/auto/qml-qtquicktest/qml-qtquicktest.pro14
-rw-r--r--tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml4
-rw-r--r--tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_4.qml118
-rw-r--r--tests/auto/qml-qtquicktest/tst_barseries.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_barseries_1_1.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_barseries_1_2.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_barseries_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_barseries_1_4.qml163
-rw-r--r--tests/auto/qml-qtquicktest/tst_boxplotseries.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_boxplotseries_1_4.qml100
-rw-r--r--tests/auto/qml-qtquicktest/tst_categoryaxis.qml4
-rw-r--r--tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_categoryaxis_1_4.qml84
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartview.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartview_1_1.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartview_1_2.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartview_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartview_1_4.qml80
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_4.qml160
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewsignals.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_chartviewsignals_1_4.qml73
-rw-r--r--tests/auto/qml-qtquicktest/tst_pieseries.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_pieseries_1_4.qml135
-rw-r--r--tests/auto/qml-qtquicktest/tst_valueaxis.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_valueaxis_1_4.qml116
-rw-r--r--tests/auto/qml-qtquicktest/tst_xyseries.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml2
-rw-r--r--tests/auto/qml-qtquicktest/tst_xyseries_1_4.qml262
-rw-r--r--tests/auto/qml/qml.pro2
-rw-r--r--tests/auto/qml/tst_qml.cpp107
-rw-r--r--tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp2
-rw-r--r--tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp2
-rw-r--r--tests/auto/qpieseries/tst_qpieseries.cpp2
-rw-r--r--tests/auto/qpieslice/tst_qpieslice.cpp2
-rw-r--r--tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp2
-rw-r--r--tests/auto/quick2/quick2.pro5
-rw-r--r--tests/auto/quick2/tst_quick2.cpp142
-rw-r--r--tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp2
-rw-r--r--tests/auto/qxyseries/tst_qxyseries.h2
-rw-r--r--tests/boxplottester/main.cpp4
-rw-r--r--tests/boxplottester/mainwidget.cpp7
-rw-r--r--tests/boxplottester/mainwidget.h2
-rw-r--r--tests/chartdesigner/engine.cpp2
-rw-r--r--tests/chartdesigner/engine.h6
-rw-r--r--tests/chartdesigner/mainwindow.cpp2
-rw-r--r--tests/chartdesigner/mainwindow.h6
-rw-r--r--tests/chartviewer/charts.h6
-rw-r--r--tests/chartviewer/chartviewer.pro2
-rw-r--r--tests/chartviewer/grid.h6
-rw-r--r--tests/chartviewer/window.h6
-rw-r--r--tests/chartwidgettest/main.cpp4
-rw-r--r--tests/chartwidgettest/mainwidget.cpp3
-rw-r--r--tests/chartwidgettest/mainwidget.h2
-rw-r--r--tests/polarcharttest/chartview.cpp2
-rw-r--r--tests/polarcharttest/chartview.h2
-rw-r--r--tests/polarcharttest/mainwindow.cpp2
-rw-r--r--tests/polarcharttest/mainwindow.h2
-rw-r--r--tests/presenterchart/chartview.h2
-rw-r--r--tests/qmlchartaxis/main.cpp34
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/Button.qml2
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/ChartAxes.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/ChartAxesRevert.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/ConfiguringDynamically.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/CreatingDynamically.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/DefaultAndUserDefined.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxes.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxesRevert.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/Legacy.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/SeriesSpecificDynamic.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/SwitchingDynamically.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/UserDefined.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/UserDefinedRevert.qml4
-rw-r--r--tests/qmlchartaxis/qml/qmlchartaxis/main.qml6
-rw-r--r--tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--tests/qmlchartaxis/qmlchartaxis.pro1
-rw-r--r--tests/qmlchartproperties/main.cpp36
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/Button.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml6
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml6
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorSeries.qml4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml5
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml5
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml6
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml2
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml6
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml4
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/loader.qml37
-rw-r--r--tests/qmlchartproperties/qml/qmlchartproperties/main.qml6
-rw-r--r--tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--tests/qmlchartproperties/qmlchartproperties.pro1
-rw-r--r--tests/qmlchartproperties/resources.qrc1
-rw-r--r--tests/quick2chartproperties/main.cpp42
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml111
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml111
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml76
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml199
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/Button.qml70
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml110
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditor.qml119
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorAxis.qml131
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorLegend.qml80
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml124
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorSeries.qml64
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorTitle.qml35
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/FontEditor.qml92
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml77
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml79
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml79
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml78
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml123
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml78
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml67
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/PieEditor.qml228
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml75
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml118
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml77
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml77
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/loader.qml37
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/main.qml179
-rw-r--r--tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.cpp87
-rw-r--r--tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.h33
-rw-r--r--tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.pri6
-rw-r--r--tests/quick2chartproperties/quick2chartproperties.pro9
-rw-r--r--tests/quick2chartproperties/resources.qrc31
-rw-r--r--tests/tests.pri39
-rw-r--r--tests/tests.pro14
-rw-r--r--tests/wavechart/wavechart.cpp2
-rw-r--r--tests/wavechart/wavechart.h2
-rw-r--r--tools/demoLauncher/demoLauncher.pro2
-rw-r--r--tools/demoLauncher/widget.cpp6
1533 files changed, 65384 insertions, 73669 deletions
diff --git a/.qmake.conf b/.qmake.conf
new file mode 100644
index 00000000..30dcb90f
--- /dev/null
+++ b/.qmake.conf
@@ -0,0 +1,4 @@
+load(qt_build_config)
+CONFIG += qt_example_installs
+
+MODULE_VERSION=2.0.0
diff --git a/charts.pro b/charts.pro
deleted file mode 100644
index b16930b8..00000000
--- a/charts.pro
+++ /dev/null
@@ -1,91 +0,0 @@
-!include(config.pri) {
- error('Missing config.pri')
-}
-
-TEMPLATE = subdirs
-SUBDIRS = src plugins
-!nomake_demos_examples: SUBDIRS += demos examples
-exists(tests): SUBDIRS += tests
-
-development_build: message('Development build')
-
-CONFIG += ordered
-QMAKE_CXXFLAGS += -g -Wall
-unix:QMAKE_DISTCLEAN += -r build bin include lib doc/html
-win32:QMAKE_DISTCLEAN += /Q /s build bin include lib doc\\html
-
-# install feature file
-feature.path = $$[QT_INSTALL_DATA]/mkspecs/features
-feature.files = $$PWD/features/qtcommercialchart.prf
-INSTALLS += feature
-
-# docs
-CHARTS_VERSION = 1.4.0
-CHARTS_VERSION_TAG = 140
-
-contains(QT_MAJOR_VERSION, 5) {
- QDOC_CONFFILE = qcharts-qt5.qdocconf
- DEFINES += QDOC_QT5
-} else {
- QDOC_CONFFILE = qcharts-qt4.qdocconf
-}
-
-contains(QMAKE_HOST.os, Windows) {
- QDOC_CONF = $$CHART_BUILD_DOC_DIR\\docconf\\$$QDOC_CONFFILE
- win32-g++|qnx {
- VERSION_SETTINGS = \
- set QT_CHARTS_VERSION=$$CHARTS_VERSION&& set QT_CHARTS_VERSION_TAG=$$CHARTS_VERSION_TAG&&
- } else {
- VERSION_SETTINGS = \
- set QT_CHARTS_VERSION=$$CHARTS_VERSION $$escape_expand(\\n\\t) \
- set QT_CHARTS_VERSION_TAG=$$CHARTS_VERSION_TAG $$escape_expand(\\n\\t)
- }
-} else {
- QDOC_CONF = $$CHART_BUILD_DOC_DIR/docconf/$$QDOC_CONFFILE
- VERSION_SETTINGS = \
- QT_CHARTS_VERSION=$$CHARTS_VERSION QT_CHARTS_VERSION_TAG=$$CHARTS_VERSION_TAG
-}
-
-contains(QT_MAJOR_VERSION, 5) {
- QDOC_CMD = qdoc
- HELPGENERATOR_CMD = qhelpgenerator -platform minimal
-} else {
- QDOC_CMD = qdoc3
- HELPGENERATOR_CMD = qhelpgenerator
-}
-
-QHP_FILE = doc/html/qtcharts.qhp
-QCH_FILE = doc/qch/qtcharts.qch
-
-docs.target = docs
-docs.depends = qch_docs FORCE
-qch_docs.target = qch_docs
-qch_docs.commands = $$HELPGENERATOR_CMD $$QHP_FILE -o $$QCH_FILE
-qch_docs.depends = html_docs FORCE
-html_docs.target = html_docs
-html_docs.commands = $$VERSION_SETTINGS $$QDOC_CMD $$QDOC_CONF
-html_docs.depends = FORCE
-
-QMAKE_EXTRA_TARGETS += docs qch_docs html_docs
-
-# coverage
-unix:coverage:{
- QMAKE_DISTCLEAN += -r ./coverage
- QMAKE_CLEAN += build/*.gcda build/*.gcno
- QMAKE_EXTRA_TARGETS += buildcoverage runcoverage gencoverage
-
- buildcoverage.target = build_coverage
- buildcoverage.depends = all
- buildcoverage.commands = mkdir -p ./coverage; \
- make -C src prepare_coverage;
-
- runcoverage.target = run_coverage
- runcoverage.depends = buildcoverage
- runcoverage.commands = for f in `ls ./bin/tst_*` ; do echo "processing \$\$f test..."; \$\$f >> unit.log; done ; exit 0;
-
- gencoverage.target = gen_coverage
- gencoverage.depends = runcoverage
- gencoverage.commands = make -C src gen_coverage; \
- genhtml -o ./coverage ./coverage/coverage.info --prefix $$PWD
-}
-
diff --git a/config.pri b/config.pri
deleted file mode 100644
index de6ec0fb..00000000
--- a/config.pri
+++ /dev/null
@@ -1,127 +0,0 @@
-##################### LIB #################################################
-
-LIBRARY_NAME = QtCommercialChart
-ios:CONFIG(iphonesimulator, iphonesimulator|iphoneos):LIBRARY_NAME = $$join(LIBRARY_NAME,,,_iphonesimulator)
-CONFIG(debug, debug|release) {
- mac: LIBRARY_NAME = $$join(LIBRARY_NAME,,,_debug)
- win32: LIBRARY_NAME = $$join(LIBRARY_NAME,,,d)
-}
-
-LIBS += -l$$LIBRARY_NAME
-
-# This will undefine Q_DECL_EXPORT/Q_DECL_IMPORT at qchartglobal.h
-# They should not be used for staticlib builds.
-static|staticlib:DEFINES+=QTCOMMERCIALCHART_STATICLIB
-
-#################### COVERAGE #################################################################
-coverage: CONFIG += debug
-
-##################### SHADOW CONFIG #################################################
-
-!contains($${PWD}, $${OUT_PWD}){
- search = "$$PWD:::"
- temp = $$split(search,"/")
- temp = $$last(temp)
- path = $$replace(search,$$temp,'')
- temp = $$split(OUT_PWD,$$path)
- temp = $$split(temp,'/')
- temp = $$first(temp)
- path = "$${path}$${temp}"
- SHADOW=$$path
-}else{
- SHADOW=$$PWD
- CONFIG-=development_build
-}
-
-##################### BUILD PATHS ##################################################
-
-CHART_BUILD_PUBLIC_HEADER_DIR = $$SHADOW/include
-CHART_BUILD_PRIVATE_HEADER_DIR = $$CHART_BUILD_PUBLIC_HEADER_DIR/private
-CHART_BUILD_LIB_DIR = $$SHADOW/lib
-CHART_BUILD_DIR = $$SHADOW/build
-CHART_BUILD_BIN_DIR = $$SHADOW/bin
-CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_BIN_DIR
-CHART_BUILD_QML2_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR
-CHART_BUILD_DESIGNER_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR
-CHART_BUILD_DOC_DIR = $$SHADOW/doc
-
-CONFIG(release,debug|release){
- CHART_BUILD_LIB_DIR = $$CHART_BUILD_LIB_DIR/release
- CHART_BUILD_BIN_DIR = $$CHART_BUILD_BIN_DIR/release
- CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR/release/imports/QtCommercial/Chart
- CHART_BUILD_QML2_PLUGIN_DIR = $$CHART_BUILD_QML2_PLUGIN_DIR/release/qml/QtCommercial/Chart
- CHART_BUILD_DESIGNER_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR
-}
-
-
-CONFIG(debug,debug|release){
- CHART_BUILD_LIB_DIR = $$CHART_BUILD_LIB_DIR/debug
- CHART_BUILD_BIN_DIR = $$CHART_BUILD_BIN_DIR/debug
- CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR/debug/imports/QtCommercial/Chart
- CHART_BUILD_QML2_PLUGIN_DIR = $$CHART_BUILD_QML2_PLUGIN_DIR/debug/qml/QtCommercial/Chart
- CHART_BUILD_DESIGNER_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR
-}
-# Use own folders for debug and release builds
-
-CONFIG(debug, debug|release):CHART_BUILD_DIR = $$join(CHART_BUILD_DIR,,,/debug)
-CONFIG(release, debug|release): CHART_BUILD_DIR = $$join(CHART_BUILD_DIR,,,/release)
-
-
-contains(QMAKE_HOST.os, Windows) {
- CHART_BUILD_PUBLIC_HEADER_DIR = $$replace(CHART_BUILD_PUBLIC_HEADER_DIR, "/","\\")
- CHART_BUILD_PRIVATE_HEADER_DIR = $$replace(CHART_BUILD_PRIVATE_HEADER_DIR, "/","\\")
- CHART_BUILD_BUILD_DIR = $$replace(CHART_BUILD_BUILD_DIR, "/","\\")
- CHART_BUILD_BIN_DIR = $$replace(CHART_BUILD_BIN_DIR, "/","\\")
- CHART_BUILD_QML_PLUGIN_DIR = $$replace(CHART_BUILD_QML_PLUGIN_DIR, "/","\\")
- CHART_BUILD_QML2_PLUGIN_DIR = $$replace(CHART_BUILD_QML2_PLUGIN_DIR, "/","\\")
- CHART_BUILD_DESIGNER_PLUGIN_DIR = $$replace(CHART_BUILD_DESIGNER_PLUGIN_DIR, "/","\\")
- CHART_BUILD_DOC_DIR = $$replace(CHART_BUILD_DOC_DIR, "/","\\")
- CHART_BUILD_LIB_DIR = $$replace(CHART_BUILD_LIB_DIR, "/","\\")
-}
-
-macx:!ios {
- # Some Qt versions use an incompatible configuration on OSX which makes the build fail.
- # As a work-around, set the minimum OSX version to 10.5.
- QMAKE_CXXFLAGS *= -mmacosx-version-min=10.5
- QMAKE_LFLAGS *= -mmacosx-version-min=10.5
-}
-
-linux-arm*: {
- DEFINES+=QT_ON_ARM
-}
-
-##################### INCLUDES ############################################################
-
-
-INCLUDEPATH += $$CHART_BUILD_PUBLIC_HEADER_DIR $$[QT_INSTALL_HEADERS]/QtCommercialChart
-
-!exists($$CHART_BUILD_LIB_DIR) {
- system($$QMAKE_MKDIR $$CHART_BUILD_LIB_DIR)
-}
-!win32: {
- LIBS += -L$$CHART_BUILD_LIB_DIR -Wl,-rpath,$$CHART_BUILD_LIB_DIR
-} else {
- win32-msvc*: {
- # hack fix for error:
- # "LINK : fatal error LNK1146: no argument specified with option '/LIBPATH:'"
- QMAKE_LIBDIR += $$CHART_BUILD_LIB_DIR
- } else {
- LIBS += -L$$CHART_BUILD_LIB_DIR
- }
-}
-LIBS += -L$$[QT_INSTALL_LIBS]
-
-##################### DEVELOPMENT BUILD ###################################################
-
-development_build: {
- DEFINES+=DEVELOPMENT_BUILD
- CONFIG+=debug_and_release
- CONFIG+=build_all
-}
-
-##################### UNIT TESTS ##############################################################
-
-CONFIG(debug, debug|release) {
- DEFINES+=BUILD_PRIVATE_UNIT_TESTS
-}
-
diff --git a/demos/audio/audio.pro b/demos/audio/audio.pro
deleted file mode 100644
index 0bd25015..00000000
--- a/demos/audio/audio.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-!include( ../demos.pri ):error( "Couldn't find the demos.pri file!" )
-
-QT += multimedia
-
-TARGET = audio
-TEMPLATE = app
-
-SOURCES += main.cpp\
- widget.cpp \
- xyseriesiodevice.cpp
-
-HEADERS += widget.h \
- xyseriesiodevice.h
diff --git a/demos/audio/widget.cpp b/demos/audio/widget.cpp
deleted file mode 100644
index f31de40b..00000000
--- a/demos/audio/widget.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "widget.h"
-#include <QAudioDeviceInfo>
-#include <QAudioInput>
-#include <QChartView>
-#include <QLineSeries>
-#include <QChart>
-#include <QVBoxLayout>
-#include <QValueAxis>
-#include "xyseriesiodevice.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-Widget::Widget(QWidget *parent)
- : QWidget(parent),
- m_device(0),
- m_chart(0),
- m_series(0),
- m_audioInput(0)
-{
- m_chart = new QChart;
- QChartView *chartView = new QChartView(m_chart);
- chartView->setMinimumSize(800, 600);
- m_series = new QLineSeries;
- m_chart->addSeries(m_series);
- QValueAxis *axisX = new QValueAxis;
- axisX->setRange(0, 2000);
- axisX->setLabelFormat("%g");
- axisX->setTitleText("Samples");
- QValueAxis *axisY = new QValueAxis;
- axisY->setRange(-1, 1);
- axisY->setTitleText("Audio level");
- m_chart->setAxisX(axisX, m_series);
- m_chart->setAxisY(axisY, m_series);
- m_chart->legend()->hide();
- m_chart->setTitle("Data from the microphone");
-
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addWidget(chartView);
- setLayout(mainLayout);
-
- QAudioFormat formatAudio;
- formatAudio.setSampleRate(8000);
- formatAudio.setChannelCount(1);
- formatAudio.setSampleSize(8);
- formatAudio.setCodec("audio/pcm");
- formatAudio.setByteOrder(QAudioFormat::LittleEndian);
- formatAudio.setSampleType(QAudioFormat::UnSignedInt);
-
- QAudioDeviceInfo inputDevices = QAudioDeviceInfo::defaultInputDevice();
- m_audioInput = new QAudioInput(inputDevices,formatAudio, this);
-
- m_device = new XYSeriesIODevice(m_series, this);
- m_device->open(QIODevice::WriteOnly);
-
- m_audioInput->start(m_device);
-}
-
-Widget::~Widget()
-{
- m_audioInput->stop();
- m_device->close();
-}
diff --git a/demos/audio/widget.h b/demos/audio/widget.h
deleted file mode 100644
index fa6a2804..00000000
--- a/demos/audio/widget.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WIDGET_H
-#define WIDGET_H
-
-#include <QWidget>
-#include <QChartGlobal>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QLineSeries;
-class QChart;
-QTCOMMERCIALCHART_END_NAMESPACE
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class XYSeriesIODevice;
-class QAudioInput;
-
-class Widget : public QWidget
-{
- Q_OBJECT
-
-public:
- Widget(QWidget *parent = 0);
- ~Widget();
-
-private:
- XYSeriesIODevice *m_device;
- QChart *m_chart;
- QLineSeries *m_series;
- QAudioInput *m_audioInput;
-};
-
-#endif // WIDGET_H
diff --git a/demos/audio/xyseriesiodevice.h b/demos/audio/xyseriesiodevice.h
deleted file mode 100644
index f7f9fbdd..00000000
--- a/demos/audio/xyseriesiodevice.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef XYSERIESIODEVICE_H
-#define XYSERIESIODEVICE_H
-
-#include <QIODevice>
-#include <QChartGlobal>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QXYSeries;
-QTCOMMERCIALCHART_END_NAMESPACE
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class XYSeriesIODevice : public QIODevice
-{
- Q_OBJECT
-public:
- explicit XYSeriesIODevice(QXYSeries * series, QObject *parent = 0);
-
-protected:
- qint64 readData(char * data, qint64 maxSize);
- qint64 writeData(const char * data, qint64 maxSize);
-
-private:
- QXYSeries *m_series;
-};
-
-#endif // XYSERIESIODEVICE_H
diff --git a/demos/callout/callout.pro b/demos/callout/callout.pro
deleted file mode 100644
index ebe7b466..00000000
--- a/demos/callout/callout.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-TARGET = callout
-TEMPLATE = app
-
-SOURCES += \
- main.cpp\
- callout.cpp \
- view.cpp
-
-HEADERS += \
- callout.h \
- view.h
diff --git a/demos/callout/view.h b/demos/callout/view.h
deleted file mode 100644
index 384e8a89..00000000
--- a/demos/callout/view.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIEW_H
-#define VIEW_H
-#include <QGraphicsView>
-#include <QChartGlobal>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QChart;
-QTCOMMERCIALCHART_END_NAMESPACE
-
-class QGraphicsScene;
-class QResizeEvent;
-class Callout;
-class QMouseEvent;
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class View: public QGraphicsView
-{
- Q_OBJECT
-
-public:
- View(QWidget *parent = 0);
-
-protected:
- void resizeEvent(QResizeEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
-
-public slots:
- void keepCallout();
- void tooltip(QPointF point, bool state);
-
-private:
- QGraphicsSimpleTextItem *m_coordX;
- QGraphicsSimpleTextItem *m_coordY;
- QChart *m_chart;
- Callout *m_tooltip;
-};
-
-#endif
diff --git a/demos/chartinteractions/chart.h b/demos/chartinteractions/chart.h
deleted file mode 100644
index 9d94f449..00000000
--- a/demos/chartinteractions/chart.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHART_H
-#define CHART_H
-
-#include <QChart>
-#include <QLineSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class Chart : public QChart
-{
- Q_OBJECT
-public:
- explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0, QLineSeries *series = 0);
- ~Chart();
-
-public slots:
- void clickPoint(const QPointF &point);
-
-public:
- void handlePointMove(const QPoint &point);
- void setPointClicked(bool clicked);
-
-private:
- qreal distance(const QPointF &p1, const QPointF &p2);
- QLineSeries *m_series;
- QPointF m_movingPoint;
-
- //Boolean value to determine if an actual point in the
- //series is clicked.
- bool m_clicked;
-};
-
-#endif // CHART_H
diff --git a/demos/chartinteractions/chartinteractions.pro b/demos/chartinteractions/chartinteractions.pro
deleted file mode 100644
index b00f2f43..00000000
--- a/demos/chartinteractions/chartinteractions.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../demos.pri ):error( "Couldn't find the demos.pri file!" )
-
-QT += core gui
-
-TARGET = chartinteractions
-TEMPLATE = app
-
-HEADERS += chart.h chartview.h
-SOURCES += main.cpp chart.cpp chartview.cpp
diff --git a/demos/chartinteractions/chartview.h b/demos/chartinteractions/chartview.h
deleted file mode 100644
index 5623430d..00000000
--- a/demos/chartinteractions/chartview.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHARTVIEW_H
-#define CHARTVIEW_H
-
-#include <QChartView>
-
-class Chart;
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class ChartView : public QChartView
-{
-public:
- ChartView(Chart *chart, QWidget *parent = 0);
-
-protected:
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
-
-private:
- Chart *m_chart;
- QPoint m_mousePos;
-};
-
-#endif
diff --git a/demos/chartinteractions/main.cpp b/demos/chartinteractions/main.cpp
deleted file mode 100644
index 9e11d847..00000000
--- a/demos/chartinteractions/main.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QLineSeries>
-
-#include <QValueAxis>
-
-#include "chart.h"
-#include "chartview.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- QLineSeries *series = new QLineSeries();
-
- series->append(0, 6);
- series->append(1, 3);
- series->append(2, 4);
- series->append(3, 8);
- series->append(7, 13);
- series->append(10, 5);
- *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
-
- Chart *chart = new Chart(0, 0, series);
- chart->legend()->hide();
- chart->addSeries(series);
- QPen p = series->pen();
- p.setWidth(5);
- series->setPen(p);
- chart->createDefaultAxes();
- chart->setTitle("Drag'n drop to move data points");
-
- QValueAxis *axisX = new QValueAxis();
- chart->setAxisX(axisX, series);
- axisX->setRange(0, 20);
-
- QValueAxis *axisY = new QValueAxis();
- chart->setAxisY(axisY, series);
- axisY->setRange(0, 13);
-
- QObject::connect(series, SIGNAL(clicked(QPointF)), chart, SLOT(clickPoint(QPointF)));
-
- ChartView *chartView = new ChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
-
- return a.exec();
-}
diff --git a/demos/chartthemes/chartthemes.pro b/demos/chartthemes/chartthemes.pro
deleted file mode 100644
index d9a61a74..00000000
--- a/demos/chartthemes/chartthemes.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-!include( ../demos.pri ):error( "Couldn't find the demos.pri file!" )
-TARGET = chartthemes
-SOURCES = main.cpp themewidget.cpp
-HEADERS = themewidget.h
diff --git a/demos/chartthemes/themewidget.h b/demos/chartthemes/themewidget.h
deleted file mode 100644
index 4b1b677c..00000000
--- a/demos/chartthemes/themewidget.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef THEMEWIDGET_H
-#define THEMEWIDGET_H
-
-#include <QWidget>
-#include <QChartGlobal>
-
-class QComboBox;
-class QCheckBox;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QChartView;
-class QChart;
-QTCOMMERCIALCHART_END_NAMESPACE
-
-typedef QPair<QPointF, QString> Data;
-typedef QList<Data> DataList;
-typedef QList<DataList> DataTable;
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class ThemeWidget: public QWidget
-{
- Q_OBJECT
-public:
- explicit ThemeWidget(QWidget *parent = 0);
- ~ThemeWidget();
-
-private Q_SLOTS:
- void updateUI();
-
-private:
- DataTable generateRandomData(int listCount, int valueMax, int valueCount) const;
- QComboBox *createThemeBox() const;
- QComboBox *createAnimationBox() const;
- QComboBox *createLegendBox() const;
- void connectSignals();
- QChart *createAreaChart() const;
- QChart *createBarChart(int valueCount) const;
- QChart *createPieChart() const;
- QChart *createLineChart() const;
- QChart *createSplineChart() const;
- QChart *createScatterChart() const;
-
-private:
- int m_listCount;
- int m_valueMax;
- int m_valueCount;
- QList<QChartView *> m_charts;
- DataTable m_dataTable;
-
- QComboBox *m_themeComboBox;
- QCheckBox *m_antialiasCheckBox;
- QComboBox *m_animatedComboBox;
- QComboBox *m_legendComboBox;
-};
-
-#endif /* THEMEWIDGET_H */
diff --git a/demos/demos.pri b/demos/demos.pri
deleted file mode 100644
index e96d687c..00000000
--- a/demos/demos.pri
+++ /dev/null
@@ -1,39 +0,0 @@
-!include( ../config.pri ) {
- error( "Couldn't find the config.pri file!" )
-}
-
-DESTDIR = $$CHART_BUILD_BIN_DIR
-!ios {
-OBJECTS_DIR = $$CHART_BUILD_DIR/demos/$$TARGET
-MOC_DIR = $$CHART_BUILD_DIR/demos/$$TARGET
-UI_DIR = $$CHART_BUILD_DIR/demos/$$TARGET
-RCC_DIR = $$CHART_BUILD_DIR/demos/$$TARGET
-}
-TEMPLATE = app
-QT += core gui
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-
-# staticlib config causes problems when building executables
-staticlib: CONFIG-=staticlib
-
-android {
- # Workaround to fix android deployment, which seems to always look for target in
- # OUT_PWD instead of DESTDIR.
- COPY_PARAMETERS = "$$CHART_BUILD_BIN_DIR/lib$${TARGET}.so $$OUT_PWD/lib$${TARGET}.so"
- contains(QMAKE_HOST.os, Windows): COPY_PARAMETERS = $$replace(COPY_PARAMETERS, "/","\\")
- QMAKE_POST_LINK += $$QMAKE_COPY $$COPY_PARAMETERS
-
- contains(TARGET, qml.*) {
- charts_qmldir.files = $$CHART_BUILD_QML_PLUGIN_DIR/qmldir
- charts_qmldir.path = /assets/imports/QtCommercial/Chart
- charts_qmlplugin.files = $$CHART_BUILD_QML_PLUGIN_DIR/libqtcommercialchartqml.so
- charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
- INSTALLS += charts_qmldir charts_qmlplugin
- } else:contains(TARGET, quick2.*) {
- charts_qmldir.files = $$CHART_BUILD_QML2_PLUGIN_DIR/qmldir
- charts_qmldir.path = /assets/qml/QtCommercial/Chart
- charts_qmlplugin.files = $$CHART_BUILD_QML2_PLUGIN_DIR/libqtcommercialchartqml2.so
- charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
- INSTALLS += charts_qmldir charts_qmlplugin
- }
-}
diff --git a/demos/demos.pro b/demos/demos.pro
deleted file mode 100644
index 98937905..00000000
--- a/demos/demos.pro
+++ /dev/null
@@ -1,34 +0,0 @@
-CURRENTLY_BUILDING_COMPONENTS = "demos"
-!include( ../config.pri ) {
- error( "Couldn't find the config.pri file!" )
-}
-
-TEMPLATE = subdirs
-SUBDIRS += piechartcustomization \
- dynamicspline \
- nesteddonuts \
- chartinteractions \
- callout \
- chartthemes
-
-!contains(QT_VERSION, ^5\\..*\\..*$)|qtHaveModule(declarative) {
- SUBDIRS += qmlchart \
- qmlweather \
- qmlf1legends \
- qmlcustomizations \
- qmlaxes \
- qmlcustomlegend \
- qmlpolarchart \
- qmloscilloscope
-}
-
-contains(QT_CONFIG, multimedia) {
- SUBDIRS += audio
-} else {
- message("QtMultimedia library not available. Some demos are disabled")
-}
-
-contains(QT_VERSION, ^5\\..*\\..*$):qtHaveModule(quick) {
- SUBDIRS += quick2chart \
- quick2oscilloscope
-}
diff --git a/demos/dynamicspline/chart.h b/demos/dynamicspline/chart.h
deleted file mode 100644
index 2908310f..00000000
--- a/demos/dynamicspline/chart.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHART_H
-#define CHART_H
-
-#include <QChart>
-#include <QTimer>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QSplineSeries;
-class QValueAxis;
-QTCOMMERCIALCHART_END_NAMESPACE
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-//![1]
-class Chart: public QChart
-{
- Q_OBJECT
-public:
- Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
- virtual ~Chart();
-
-public slots:
- void handleTimeout();
-
-private:
- QTimer m_timer;
- QSplineSeries *m_series;
- QStringList m_titles;
- QValueAxis *m_axis;
- qreal m_step;
- qreal m_x;
- qreal m_y;
-};
-//![1]
-
-#endif /* CHART_H */
diff --git a/demos/dynamicspline/dynamicspline.pro b/demos/dynamicspline/dynamicspline.pro
deleted file mode 100644
index 697a864e..00000000
--- a/demos/dynamicspline/dynamicspline.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-!include( ../demos.pri ):error( "Couldn't find the demos.pri file!" )
-TARGET = dynamicspline
-HEADERS += chart.h
-SOURCES += main.cpp chart.cpp
diff --git a/demos/dynamicspline/main.cpp b/demos/dynamicspline/main.cpp
deleted file mode 100644
index 326e635d..00000000
--- a/demos/dynamicspline/main.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chart.h"
-#include <QChartView>
-#include <QApplication>
-#include <QMainWindow>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
- QMainWindow window;
- Chart *chart = new Chart;
- chart->setTitle("Dynamic spline chart");
- chart->legend()->hide();
- chart->setAnimationOptions(QChart::AllAnimations);
- QChartView chartView(chart);
- chartView.setRenderHint(QPainter::Antialiasing);
- window.setCentralWidget(&chartView);
- window.resize(400, 300);
- window.show();
- return a.exec();
-}
diff --git a/demos/nesteddonuts/nesteddonuts.pro b/demos/nesteddonuts/nesteddonuts.pro
deleted file mode 100644
index 2da71e11..00000000
--- a/demos/nesteddonuts/nesteddonuts.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-TARGET = nesteddonuts
-SOURCES += main.cpp\
- widget.cpp
-HEADERS += widget.h
diff --git a/demos/nesteddonuts/widget.cpp b/demos/nesteddonuts/widget.cpp
deleted file mode 100644
index fdde6a64..00000000
--- a/demos/nesteddonuts/widget.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "widget.h"
-#include <QChartView>
-#include <QChart>
-#include <QLegend>
-#include <QPieSeries>
-#include <QPieSlice>
-#include <QTime>
-#include <QGridLayout>
-#include <QTimer>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-Widget::Widget(QWidget *parent)
- : QWidget(parent)
-{
- setMinimumSize(800, 600);
- qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
-
- //! [1]
- QChartView *chartView = new QChartView;
- chartView->setRenderHint(QPainter::Antialiasing);
- QChart *chart = chartView->chart();
- chart->legend()->setVisible(false);
- chart->setTitle("Nested donuts demo");
- chart->setAnimationOptions(QChart::AllAnimations);
- //! [1]
-
- //! [2]
- qreal minSize = 0.1;
- qreal maxSize = 0.9;
- int donutCount = 5;
- //! [2]
-
- //! [3]
- for (int i = 0; i < donutCount; i++) {
- QPieSeries *donut = new QPieSeries;
- int sliceCount = 3 + qrand() % 3;
- for (int j = 0; j < sliceCount; j++) {
- qreal value = 100 + qrand() % 100;
- QPieSlice *slice = new QPieSlice(QString("%1").arg(value), value);
- slice->setLabelVisible(true);
- slice->setLabelColor(Qt::white);
- slice->setLabelPosition(QPieSlice::LabelInsideTangential);
- connect(slice, SIGNAL(hovered(bool)), this, SLOT(explodeSlice(bool)));
- donut->append(slice);
- donut->setHoleSize(minSize + i * (maxSize - minSize) / donutCount);
- donut->setPieSize(minSize + (i + 1) * (maxSize - minSize) / donutCount);
- }
- m_donuts.append(donut);
- chartView->chart()->addSeries(donut);
- }
- //! [3]
-
- // create main layout
- //! [4]
- QGridLayout *mainLayout = new QGridLayout;
- mainLayout->addWidget(chartView, 1, 1);
- setLayout(mainLayout);
- //! [4]
-
- //! [5]
- updateTimer = new QTimer(this);
- connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateRotation()));
- updateTimer->start(1250);
- //! [5]
-}
-
-Widget::~Widget()
-{
-
-}
-
-//! [6]
-void Widget::updateRotation()
-{
- for (int i = 0; i < m_donuts.count(); i++) {
- QPieSeries *donut = m_donuts.at(i);
- qreal phaseShift = -50 + qrand() % 100;
- donut->setPieStartAngle(donut->pieStartAngle() + phaseShift);
- donut->setPieEndAngle(donut->pieEndAngle() + phaseShift);
- }
-}
-//! [6]
-
-//! [7]
-void Widget::explodeSlice(bool exploded)
-{
- QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
- if (exploded) {
- updateTimer->stop();
- qreal sliceStartAngle = slice->startAngle();
- qreal sliceEndAngle = slice->startAngle() + slice->angleSpan();
-
- QPieSeries *donut = slice->series();
- qreal seriesIndex = m_donuts.indexOf(donut);
- for (int i = seriesIndex + 1; i < m_donuts.count(); i++) {
- m_donuts.at(i)->setPieStartAngle(sliceEndAngle);
- m_donuts.at(i)->setPieEndAngle(360 + sliceStartAngle);
- }
- } else {
- for (int i = 0; i < m_donuts.count(); i++) {
- m_donuts.at(i)->setPieStartAngle(0);
- m_donuts.at(i)->setPieEndAngle(360);
- }
- updateTimer->start();
- }
- slice->setExploded(exploded);
-}
-//! [7]
diff --git a/demos/nesteddonuts/widget.h b/demos/nesteddonuts/widget.h
deleted file mode 100644
index d9ba46ab..00000000
--- a/demos/nesteddonuts/widget.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef WIDGET_H
-#define WIDGET_H
-
-#include <QWidget>
-#include <QPieSeries>
-
-class QTimer;
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class Widget : public QWidget
-{
- Q_OBJECT
-
-public:
- Widget(QWidget *parent = 0);
- ~Widget();
-
-public slots:
- void updateRotation();
- void explodeSlice(bool exploded);
-
-private:
- QList<QPieSeries *> m_donuts;
- QTimer *updateTimer;
-};
-
-#endif // WIDGET_H
diff --git a/demos/piechartcustomization/customslice.cpp b/demos/piechartcustomization/customslice.cpp
deleted file mode 100644
index 5ccfe53c..00000000
--- a/demos/piechartcustomization/customslice.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "customslice.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-CustomSlice::CustomSlice(QString label, qreal value)
- : QPieSlice(label, value)
-{
- connect(this, SIGNAL(hovered(bool)), this, SLOT(showHighlight(bool)));
-}
-
-QBrush CustomSlice::originalBrush()
-{
- return m_originalBrush;
-}
-
-void CustomSlice::showHighlight(bool show)
-{
- if (show) {
- QBrush brush = this->brush();
- m_originalBrush = brush;
- brush.setColor(brush.color().lighter());
- setBrush(brush);
- } else {
- setBrush(m_originalBrush);
- }
-}
-
-#include "moc_customslice.cpp"
diff --git a/demos/piechartcustomization/customslice.h b/demos/piechartcustomization/customslice.h
deleted file mode 100644
index 61ae8630..00000000
--- a/demos/piechartcustomization/customslice.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef CUSTOMSLICE_H
-#define CUSTOMSLICE_H
-
-#include <QPieSlice>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class CustomSlice : public QPieSlice
-{
- Q_OBJECT
-
-public:
- CustomSlice(QString label, qreal value);
-
-public:
- QBrush originalBrush();
-
-public Q_SLOTS:
- void showHighlight(bool show);
-
-private:
- QBrush m_originalBrush;
-};
-
-#endif // CUSTOMSLICE_H
diff --git a/demos/piechartcustomization/mainwidget.cpp b/demos/piechartcustomization/mainwidget.cpp
deleted file mode 100644
index b984ba55..00000000
--- a/demos/piechartcustomization/mainwidget.cpp
+++ /dev/null
@@ -1,360 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "mainwidget.h"
-#include "customslice.h"
-#include "pentool.h"
-#include "brushtool.h"
-#include <QPushButton>
-#include <QComboBox>
-#include <QCheckBox>
-#include <QLineEdit>
-#include <QGroupBox>
-#include <QDoubleSpinBox>
-#include <QFormLayout>
-#include <QFontDialog>
-#include <QChartView>
-#include <QPieSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-MainWidget::MainWidget(QWidget *parent)
- : QWidget(parent),
- m_slice(0)
-{
- // create chart
- QChart *chart = new QChart;
- chart->setTitle("Piechart customization");
- chart->setAnimationOptions(QChart::AllAnimations);
-
- // create series
- m_series = new QPieSeries();
- *m_series << new CustomSlice("Slice 1", 10.0);
- *m_series << new CustomSlice("Slice 2", 20.0);
- *m_series << new CustomSlice("Slice 3", 30.0);
- *m_series << new CustomSlice("Slice 4", 40.0);
- *m_series << new CustomSlice("Slice 5", 50.0);
- m_series->setLabelsVisible();
- chart->addSeries(m_series);
-
- connect(m_series, SIGNAL(clicked(QPieSlice*)), this, SLOT(handleSliceClicked(QPieSlice*)));
-
- // chart settings
- m_themeComboBox = new QComboBox();
- m_themeComboBox->addItem("Light", QChart::ChartThemeLight);
- m_themeComboBox->addItem("BlueCerulean", QChart::ChartThemeBlueCerulean);
- m_themeComboBox->addItem("Dark", QChart::ChartThemeDark);
- m_themeComboBox->addItem("BrownSand", QChart::ChartThemeBrownSand);
- m_themeComboBox->addItem("BlueNcs", QChart::ChartThemeBlueNcs);
- m_themeComboBox->addItem("High Contrast", QChart::ChartThemeHighContrast);
- m_themeComboBox->addItem("Blue Icy", QChart::ChartThemeBlueIcy);
- m_themeComboBox->addItem("Qt", QChart::ChartThemeQt);
-
- m_aaCheckBox = new QCheckBox();
- m_animationsCheckBox = new QCheckBox();
- m_animationsCheckBox->setCheckState(Qt::Checked);
-
- m_legendCheckBox = new QCheckBox();
-
- QFormLayout *chartSettingsLayout = new QFormLayout();
- chartSettingsLayout->addRow("Theme", m_themeComboBox);
- chartSettingsLayout->addRow("Antialiasing", m_aaCheckBox);
- chartSettingsLayout->addRow("Animations", m_animationsCheckBox);
- chartSettingsLayout->addRow("Legend", m_legendCheckBox);
- QGroupBox *chartSettings = new QGroupBox("Chart");
- chartSettings->setLayout(chartSettingsLayout);
-
- connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateChartSettings()));
- connect(m_aaCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateChartSettings()));
- connect(m_animationsCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateChartSettings()));
- connect(m_legendCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateChartSettings()));
-
- // series settings
- m_hPosition = new QDoubleSpinBox();
- m_hPosition->setMinimum(0.0);
- m_hPosition->setMaximum(1.0);
- m_hPosition->setSingleStep(0.1);
- m_hPosition->setValue(m_series->horizontalPosition());
-
- m_vPosition = new QDoubleSpinBox();
- m_vPosition->setMinimum(0.0);
- m_vPosition->setMaximum(1.0);
- m_vPosition->setSingleStep(0.1);
- m_vPosition->setValue(m_series->verticalPosition());
-
- m_sizeFactor = new QDoubleSpinBox();
- m_sizeFactor->setMinimum(0.0);
- m_sizeFactor->setMaximum(1.0);
- m_sizeFactor->setSingleStep(0.1);
- m_sizeFactor->setValue(m_series->pieSize());
-
- m_startAngle = new QDoubleSpinBox();
- m_startAngle->setMinimum(-720);
- m_startAngle->setMaximum(720);
- m_startAngle->setValue(m_series->pieStartAngle());
- m_startAngle->setSingleStep(1);
-
- m_endAngle = new QDoubleSpinBox();
- m_endAngle->setMinimum(-720);
- m_endAngle->setMaximum(720);
- m_endAngle->setValue(m_series->pieEndAngle());
- m_endAngle->setSingleStep(1);
-
- m_holeSize = new QDoubleSpinBox();
- m_holeSize->setMinimum(0.0);
- m_holeSize->setMaximum(1.0);
- m_holeSize->setSingleStep(0.1);
- m_holeSize->setValue(m_series->holeSize());
-
- QPushButton *appendSlice = new QPushButton("Append slice");
- QPushButton *insertSlice = new QPushButton("Insert slice");
- QPushButton *removeSlice = new QPushButton("Remove selected slice");
-
- QFormLayout *seriesSettingsLayout = new QFormLayout();
- seriesSettingsLayout->addRow("Horizontal position", m_hPosition);
- seriesSettingsLayout->addRow("Vertical position", m_vPosition);
- seriesSettingsLayout->addRow("Size factor", m_sizeFactor);
- seriesSettingsLayout->addRow("Start angle", m_startAngle);
- seriesSettingsLayout->addRow("End angle", m_endAngle);
- seriesSettingsLayout->addRow("Hole size", m_holeSize);
- seriesSettingsLayout->addRow(appendSlice);
- seriesSettingsLayout->addRow(insertSlice);
- seriesSettingsLayout->addRow(removeSlice);
- QGroupBox *seriesSettings = new QGroupBox("Series");
- seriesSettings->setLayout(seriesSettingsLayout);
-
- connect(m_vPosition, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
- connect(m_hPosition, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
- connect(m_sizeFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
- connect(m_startAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
- connect(m_endAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
- connect(m_holeSize, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
- connect(appendSlice, SIGNAL(clicked()), this, SLOT(appendSlice()));
- connect(insertSlice, SIGNAL(clicked()), this, SLOT(insertSlice()));
- connect(removeSlice, SIGNAL(clicked()), this, SLOT(removeSlice()));
-
- // slice settings
- m_sliceName = new QLineEdit("<click a slice>");
- m_sliceName->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
- m_sliceValue = new QDoubleSpinBox();
- m_sliceValue->setMaximum(1000);
- m_sliceLabelVisible = new QCheckBox();
- m_sliceLabelArmFactor = new QDoubleSpinBox();
- m_sliceLabelArmFactor->setSingleStep(0.01);
- m_sliceExploded = new QCheckBox();
- m_sliceExplodedFactor = new QDoubleSpinBox();
- m_sliceExplodedFactor->setSingleStep(0.01);
- m_pen = new QPushButton();
- m_penTool = new PenTool("Slice pen", this);
- m_brush = new QPushButton();
- m_brushTool = new BrushTool("Slice brush", this);
- m_font = new QPushButton();
- m_labelBrush = new QPushButton();
- m_labelBrushTool = new BrushTool("Label brush", this);
- m_labelPosition = new QComboBox(this);
- m_labelPosition->addItem("Outside", QPieSlice::LabelOutside);
- m_labelPosition->addItem("Inside horizontal", QPieSlice::LabelInsideHorizontal);
- m_labelPosition->addItem("Inside tangential", QPieSlice::LabelInsideTangential);
- m_labelPosition->addItem("Inside normal", QPieSlice::LabelInsideNormal);
-
- QFormLayout *sliceSettingsLayout = new QFormLayout();
- sliceSettingsLayout->addRow("Label", m_sliceName);
- sliceSettingsLayout->addRow("Value", m_sliceValue);
- sliceSettingsLayout->addRow("Pen", m_pen);
- sliceSettingsLayout->addRow("Brush", m_brush);
- sliceSettingsLayout->addRow("Label visible", m_sliceLabelVisible);
- sliceSettingsLayout->addRow("Label font", m_font);
- sliceSettingsLayout->addRow("Label brush", m_labelBrush);
- sliceSettingsLayout->addRow("Label position", m_labelPosition);
- sliceSettingsLayout->addRow("Label arm length", m_sliceLabelArmFactor);
- sliceSettingsLayout->addRow("Exploded", m_sliceExploded);
- sliceSettingsLayout->addRow("Explode distance", m_sliceExplodedFactor);
- QGroupBox *sliceSettings = new QGroupBox("Selected slice");
- sliceSettings->setLayout(sliceSettingsLayout);
-
- connect(m_sliceName, SIGNAL(textChanged(QString)), this, SLOT(updateSliceSettings()));
- connect(m_sliceValue, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings()));
- connect(m_pen, SIGNAL(clicked()), m_penTool, SLOT(show()));
- connect(m_penTool, SIGNAL(changed()), this, SLOT(updateSliceSettings()));
- connect(m_brush, SIGNAL(clicked()), m_brushTool, SLOT(show()));
- connect(m_brushTool, SIGNAL(changed()), this, SLOT(updateSliceSettings()));
- connect(m_font, SIGNAL(clicked()), this, SLOT(showFontDialog()));
- connect(m_labelBrush, SIGNAL(clicked()), m_labelBrushTool, SLOT(show()));
- connect(m_labelBrushTool, SIGNAL(changed()), this, SLOT(updateSliceSettings()));
- connect(m_sliceLabelVisible, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings()));
- connect(m_sliceLabelVisible, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings()));
- connect(m_sliceLabelArmFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings()));
- connect(m_sliceExploded, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings()));
- connect(m_sliceExplodedFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings()));
- connect(m_labelPosition, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSliceSettings()));
-
- // create chart view
- m_chartView = new QChartView(chart);
-
- // create main layout
- QVBoxLayout *settingsLayout = new QVBoxLayout();
- settingsLayout->addWidget(chartSettings);
- settingsLayout->addWidget(seriesSettings);
- settingsLayout->addWidget(sliceSettings);
- settingsLayout->addStretch();
-
- QGridLayout *baseLayout = new QGridLayout();
- baseLayout->addLayout(settingsLayout, 0, 0);
- baseLayout->addWidget(m_chartView, 0, 1);
- setLayout(baseLayout);
-
- updateSerieSettings();
- updateChartSettings();
-}
-
-
-void MainWidget::updateChartSettings()
-{
- QChart::ChartTheme theme = (QChart::ChartTheme) m_themeComboBox->itemData(m_themeComboBox->currentIndex()).toInt();
- m_chartView->chart()->setTheme(theme);
- m_chartView->setRenderHint(QPainter::Antialiasing, m_aaCheckBox->isChecked());
-
- if (m_animationsCheckBox->checkState() == Qt::Checked)
- m_chartView->chart()->setAnimationOptions(QChart::AllAnimations);
- else
- m_chartView->chart()->setAnimationOptions(QChart::NoAnimation);
-
- if (m_legendCheckBox->checkState() == Qt::Checked)
- m_chartView->chart()->legend()->show();
- else
- m_chartView->chart()->legend()->hide();
-}
-
-void MainWidget::updateSerieSettings()
-{
- m_series->setHorizontalPosition(m_hPosition->value());
- m_series->setVerticalPosition(m_vPosition->value());
- m_series->setPieSize(m_sizeFactor->value());
- m_holeSize->setMaximum(m_sizeFactor->value());
- m_series->setPieStartAngle(m_startAngle->value());
- m_series->setPieEndAngle(m_endAngle->value());
- m_series->setHoleSize(m_holeSize->value());
-}
-
-void MainWidget::updateSliceSettings()
-{
- if (!m_slice)
- return;
-
- m_slice->setLabel(m_sliceName->text());
-
- m_slice->setValue(m_sliceValue->value());
-
- m_slice->setPen(m_penTool->pen());
- m_slice->setBrush(m_brushTool->brush());
-
- m_slice->setLabelBrush(m_labelBrushTool->brush());
- m_slice->setLabelVisible(m_sliceLabelVisible->isChecked());
- m_slice->setLabelArmLengthFactor(m_sliceLabelArmFactor->value());
- m_slice->setLabelPosition((QPieSlice::LabelPosition)m_labelPosition->currentIndex()); // assumes that index is in sync with the enum
-
- m_slice->setExploded(m_sliceExploded->isChecked());
- m_slice->setExplodeDistanceFactor(m_sliceExplodedFactor->value());
-}
-
-void MainWidget::handleSliceClicked(QPieSlice *slice)
-{
- m_slice = static_cast<CustomSlice *>(slice);
-
- // name
- m_sliceName->blockSignals(true);
- m_sliceName->setText(slice->label());
- m_sliceName->blockSignals(false);
-
- // value
- m_sliceValue->blockSignals(true);
- m_sliceValue->setValue(slice->value());
- m_sliceValue->blockSignals(false);
-
- // pen
- m_pen->setText(PenTool::name(m_slice->pen()));
- m_penTool->setPen(m_slice->pen());
-
- // brush
- m_brush->setText(m_slice->originalBrush().color().name());
- m_brushTool->setBrush(m_slice->originalBrush());
-
- // label
- m_labelBrush->setText(BrushTool::name(m_slice->labelBrush()));
- m_labelBrushTool->setBrush(m_slice->labelBrush());
- m_font->setText(slice->labelFont().toString());
- m_sliceLabelVisible->blockSignals(true);
- m_sliceLabelVisible->setChecked(slice->isLabelVisible());
- m_sliceLabelVisible->blockSignals(false);
- m_sliceLabelArmFactor->blockSignals(true);
- m_sliceLabelArmFactor->setValue(slice->labelArmLengthFactor());
- m_sliceLabelArmFactor->blockSignals(false);
- m_labelPosition->blockSignals(true);
- m_labelPosition->setCurrentIndex(slice->labelPosition()); // assumes that index is in sync with the enum
- m_labelPosition->blockSignals(false);
-
- // exploded
- m_sliceExploded->blockSignals(true);
- m_sliceExploded->setChecked(slice->isExploded());
- m_sliceExploded->blockSignals(false);
- m_sliceExplodedFactor->blockSignals(true);
- m_sliceExplodedFactor->setValue(slice->explodeDistanceFactor());
- m_sliceExplodedFactor->blockSignals(false);
-}
-
-void MainWidget::showFontDialog()
-{
- if (!m_slice)
- return;
-
- QFontDialog dialog(m_slice->labelFont());
- dialog.show();
- dialog.exec();
-
- m_slice->setLabelFont(dialog.currentFont());
- m_font->setText(dialog.currentFont().toString());
-}
-
-void MainWidget::appendSlice()
-{
- *m_series << new CustomSlice("Slice " + QString::number(m_series->count() + 1), 10.0);
-}
-
-void MainWidget::insertSlice()
-{
- if (!m_slice)
- return;
-
- int i = m_series->slices().indexOf(m_slice);
-
- m_series->insert(i, new CustomSlice("Slice " + QString::number(m_series->count() + 1), 10.0));
-}
-
-void MainWidget::removeSlice()
-{
- if (!m_slice)
- return;
-
- m_sliceName->setText("<click a slice>");
-
- m_series->remove(m_slice);
- m_slice = 0;
-}
-
-#include "moc_mainwidget.cpp"
diff --git a/demos/piechartcustomization/mainwidget.h b/demos/piechartcustomization/mainwidget.h
deleted file mode 100644
index 07fcd034..00000000
--- a/demos/piechartcustomization/mainwidget.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef MAINWIDGET_H
-#define MAINWIDGET_H
-
-#include <QWidget>
-#include <QChartGlobal>
-
-class QLineEdit;
-class QPushButton;
-class QCheckBox;
-class QComboBox;
-class QDoubleSpinBox;
-class PenTool;
-class BrushTool;
-class CustomSlice;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QChartView;
-class QPieSeries;
-class QPieSlice;
-QTCOMMERCIALCHART_END_NAMESPACE
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class MainWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit MainWidget(QWidget *parent = 0);
-
-public Q_SLOTS:
- void updateChartSettings();
- void updateSerieSettings();
- void updateSliceSettings();
- void handleSliceClicked(QPieSlice *slice);
- void showFontDialog();
- void appendSlice();
- void insertSlice();
- void removeSlice();
-
-private:
- QComboBox *m_themeComboBox;
- QCheckBox *m_aaCheckBox;
- QCheckBox *m_animationsCheckBox;
- QCheckBox *m_legendCheckBox;
-
- QChartView *m_chartView;
- QPieSeries *m_series;
- CustomSlice *m_slice;
-
- QDoubleSpinBox *m_hPosition;
- QDoubleSpinBox *m_vPosition;
- QDoubleSpinBox *m_sizeFactor;
- QDoubleSpinBox *m_startAngle;
- QDoubleSpinBox *m_endAngle;
- QDoubleSpinBox *m_holeSize;
-
- QLineEdit *m_sliceName;
- QDoubleSpinBox *m_sliceValue;
- QCheckBox *m_sliceLabelVisible;
- QDoubleSpinBox *m_sliceLabelArmFactor;
- QCheckBox *m_sliceExploded;
- QDoubleSpinBox *m_sliceExplodedFactor;
- QPushButton *m_brush;
- BrushTool *m_brushTool;
- QPushButton *m_pen;
- PenTool *m_penTool;
- QPushButton *m_font;
- QPushButton *m_labelBrush;
- QComboBox *m_labelPosition;
- BrushTool *m_labelBrushTool;
-};
-
-#endif // MAINWIDGET_H
diff --git a/demos/piechartcustomization/piechartcustomization.pro b/demos/piechartcustomization/piechartcustomization.pro
deleted file mode 100644
index 9698b487..00000000
--- a/demos/piechartcustomization/piechartcustomization.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-TARGET = piechartcustomization
-SOURCES += main.cpp \
- pentool.cpp \
- brushtool.cpp \
- customslice.cpp \
- mainwidget.cpp
-
-HEADERS += \
- pentool.h \
- brushtool.h \
- customslice.h \
- mainwidget.h
diff --git a/demos/qmlaxes/main.cpp b/demos/qmlaxes/main.cpp
deleted file mode 100644
index 9ce94bcc..00000000
--- a/demos/qmlaxes/main.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
- // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmlaxes/loader.qml"));
- viewer->setRenderHint(QPainter::Antialiasing, true);
- viewer->showExpanded();
-
- return app->exec();
-}
diff --git a/demos/qmlaxes/qml/qmlaxes/View1.qml b/demos/qmlaxes/qml/qmlaxes/View1.qml
deleted file mode 100644
index 7ee15f61..00000000
--- a/demos/qmlaxes/qml/qmlaxes/View1.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Two Series, Common Axes"
- anchors.fill: parent
- legend.visible: false
-
- ValueAxis {
- id: axisX
- min: 0
- max: 10
- tickCount: 5
- }
-
- ValueAxis {
- id: axisY
- min: -0.5
- max: 1.5
- }
-
- LineSeries {
- id: series1
- axisX: axisX
- axisY: axisY
- }
-
- ScatterSeries {
- id: series2
- axisX: axisX
- axisY: axisY
- }
- }
-
- // Add data dynamically to the series
- Component.onCompleted: {
- for (var i = 0; i <= 10; i++) {
- series1.append(i, Math.random());
- series2.append(i, Math.random());
- }
- }
- //![1]
-}
diff --git a/demos/qmlaxes/qml/qmlaxes/View2.qml b/demos/qmlaxes/qml/qmlaxes/View2.qml
deleted file mode 100644
index bba5aaa6..00000000
--- a/demos/qmlaxes/qml/qmlaxes/View2.qml
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Accurate Historical Data"
- anchors.fill: parent
- legend.visible: false
-
- LineSeries {
- axisX: DateTimeAxis {
- format: "yyyy MMM"
- tickCount: 5
- }
- axisY: ValueAxis {
- min: 0
- max: 150
- }
-
- // Please note that month in JavaScript months are zero based, so 2 means March
- XYPoint { x: toMsecsSinceEpoch(new Date(1950, 2, 15)); y: 5 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 50 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1987, 12, 31)); y: 102 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 100 }
- XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 2)); y: 110 }
- }
- }
-
- // DateTimeAxis is based on QDateTimes so we must convert our JavaScript dates to
- // milliseconds since epoch to make them match the DateTimeAxis values
- function toMsecsSinceEpoch(date) {
- var msecs = date.getTime();
- return msecs;
- }
- //![1]
-}
diff --git a/demos/qmlaxes/qml/qmlaxes/View3.qml b/demos/qmlaxes/qml/qmlaxes/View3.qml
deleted file mode 100644
index 2985fef7..00000000
--- a/demos/qmlaxes/qml/qmlaxes/View3.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Numerical Data for Dummies"
- anchors.fill: parent
- legend.visible: false
-
- LineSeries {
- axisY: CategoryAxis {
- min: 0
- max: 30
- CategoryRange {
- label: "critical"
- endValue: 2
- }
- CategoryRange {
- label: "low"
- endValue: 4
- }
- CategoryRange {
- label: "normal"
- endValue: 7
- }
- CategoryRange {
- label: "high"
- endValue: 15
- }
- CategoryRange {
- label: "extremely high"
- endValue: 30
- }
- }
-
- XYPoint { x: 0; y: 4.3 }
- XYPoint { x: 1; y: 4.1 }
- XYPoint { x: 2; y: 4.7 }
- XYPoint { x: 3; y: 3.9 }
- XYPoint { x: 4; y: 5.2 }
- }
- }
- //![1]
-}
diff --git a/demos/qmlaxes/qml/qmlaxes/loader.qml b/demos/qmlaxes/qml/qmlaxes/loader.qml
deleted file mode 100644
index be6d47b3..00000000
--- a/demos/qmlaxes/qml/qmlaxes/loader.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Item {
- id: container
- width: 440
- height: 340
- Component.onCompleted: {
- var co = Qt.createComponent("main.qml")
- if (co.status == Component.Ready) {
- var o = co.createObject(container)
- } else {
- console.log(co.errorString())
- console.log("QtCommercial.Chart 1.1 not available")
- console.log("Please use correct QML_IMPORT_PATH export")
- }
- }
-}
diff --git a/demos/qmlaxes/qml/qmlaxes/main.qml b/demos/qmlaxes/qml/qmlaxes/main.qml
deleted file mode 100644
index 56f5e288..00000000
--- a/demos/qmlaxes/qml/qmlaxes/main.qml
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- width: parent.width
- height: parent.height
- property int viewNumber: 1
- property int viewCount: 3
-
- Loader {
- id: loader
- anchors.fill: parent
- source: "View" + viewNumber + ".qml";
- }
-
- Rectangle {
- id: infoText
- anchors.centerIn: parent
- width: parent.width
- height: 40
- color: "black"
- Text {
- color: "white"
- anchors.centerIn: parent
- text: "Use left and right arrow keys to navigate"
- }
-
- Behavior on opacity {
- NumberAnimation { duration: 400 }
- }
- }
-
- MouseArea {
- focus: true
- anchors.fill: parent
- onClicked: {
- if (infoText.opacity > 0) {
- infoText.opacity = 0.0;
- } else {
- nextView();
- }
- }
- Keys.onPressed: {
- if (infoText.opacity > 0) {
- infoText.opacity = 0.0;
- } else {
- if (event.key == Qt.Key_Left) {
- previousView();
- } else {
- nextView();
- }
- }
- }
- }
-
- function nextView() {
- var i = viewNumber + 1;
- if (i > viewCount)
- viewNumber = 1;
- else
- viewNumber = i;
- }
-
- function previousView() {
- var i = viewNumber - 1;
- if (i <= 0)
- viewNumber = viewCount;
- else
- viewNumber = i;
- }
-}
diff --git a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/demos/qmlaxes/qmlaxes.pro b/demos/qmlaxes/qmlaxes.pro
deleted file mode 100644
index 3e1a0954..00000000
--- a/demos/qmlaxes/qmlaxes.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/qmlaxes/*
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlaxes/resources.qrc b/demos/qmlaxes/resources.qrc
deleted file mode 100644
index 29e173d4..00000000
--- a/demos/qmlaxes/resources.qrc
+++ /dev/null
@@ -1,9 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/qmlaxes/loader.qml</file>
- <file>qml/qmlaxes/main.qml</file>
- <file>qml/qmlaxes/View1.qml</file>
- <file>qml/qmlaxes/View2.qml</file>
- <file>qml/qmlaxes/View3.qml</file>
- </qresource>
-</RCC>
diff --git a/demos/qmlchart/main.cpp b/demos/qmlchart/main.cpp
deleted file mode 100644
index dbf65620..00000000
--- a/demos/qmlchart/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
-
- // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmlchart/loader.qml"));
- viewer->setRenderHint(QPainter::Antialiasing, true);
- viewer->showExpanded();
-
- return app->exec();
-}
diff --git a/demos/qmlchart/qml/qmlchart/View1.qml b/demos/qmlchart/qml/qmlchart/View1.qml
deleted file mode 100644
index c2409ec9..00000000
--- a/demos/qmlchart/qml/qmlchart/View1.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
- property variant othersSlice: 0
-
- //![1]
- ChartView {
- id: chart
- title: "Top-5 car brand shares in Finland"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
-
- PieSeries {
- id: pieSeries
- PieSlice { label: "Volkswagen"; value: 13.5 }
- PieSlice { label: "Toyota"; value: 10.9 }
- PieSlice { label: "Ford"; value: 8.6 }
- PieSlice { label: "Skoda"; value: 8.2 }
- PieSlice { label: "Volvo"; value: 6.8 }
- }
- }
-
- Component.onCompleted: {
- // You can also manipulate slices dynamically
- othersSlice = pieSeries.append("Others", 52.0);
- pieSeries.find("Volkswagen").exploded = true;
- }
- //![1]
-}
diff --git a/demos/qmlchart/qml/qmlchart/View10.qml b/demos/qmlchart/qml/qmlchart/View10.qml
deleted file mode 100644
index 4fef2052..00000000
--- a/demos/qmlchart/qml/qmlchart/View10.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Horizontal Stacked Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
-
- HorizontalStackedBarSeries {
- axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
diff --git a/demos/qmlchart/qml/qmlchart/View11.qml b/demos/qmlchart/qml/qmlchart/View11.qml
deleted file mode 100644
index 2799d3ea..00000000
--- a/demos/qmlchart/qml/qmlchart/View11.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Horizontal Percent Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
-
- HorizontalPercentBarSeries {
- axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
-
diff --git a/demos/qmlchart/qml/qmlchart/View12.qml b/demos/qmlchart/qml/qmlchart/View12.qml
deleted file mode 100644
index ce2d7373..00000000
--- a/demos/qmlchart/qml/qmlchart/View12.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- id: chart
- title: "Production costs"
- anchors.fill: parent
- legend.visible: false
-
- PieSeries {
- id: pieOuter
- size: 0.96
- holeSize: 0.7
- PieSlice { id: slice; label: "Alpha"; value: 19511; color: "#8AB846"; borderColor: "#163430" }
- PieSlice { label: "Epsilon"; value: 11105; color: "#C0EEFF"; borderColor: "#3B391C" }
- PieSlice { label: "Psi"; value: 9352; color: "#DF8939"; borderColor: "#13060C" }
- }
-
- PieSeries {
- size: 0.7
- id: pieInner
- holeSize: 0.25
-
- PieSlice { label: "Materials"; value: 10334; color: "#8AB846"; borderColor: "#163430" }
- PieSlice { label: "Employee"; value: 3066; color: "#AAE356"; borderColor: "#163430" }
- PieSlice { label: "Logistics"; value: 6111; color: "#99CC4E"; borderColor: "#163430" }
-
- PieSlice { label: "Materials"; value: 7371; color: "#C0EEFF"; borderColor: "#3B391C" }
- PieSlice { label: "Employee"; value: 2443; color: "#C9FAFF"; borderColor: "#3B391C" }
- PieSlice { label: "Logistics"; value: 1291; color: "#B0FAFF"; borderColor: "#3B391C" }
-
- PieSlice { label: "Materials"; value: 4022; color: "#DF8939"; borderColor: "#13060C" }
- PieSlice { label: "Employee"; value: 3998; color: "#FC9D42"; borderColor: "#13060C" }
- PieSlice { label: "Logistics"; value: 1332; color: "#F2963F"; borderColor: "#13060C" }
- }
- }
-
- Component.onCompleted: {
- // Set the common slice properties dynamically for convenience
- for (var i = 0; i < pieOuter.count; i++) {
- pieOuter.at(i).labelPosition = PieSlice.LabelOutside;
- pieOuter.at(i).labelVisible = true;
- pieOuter.at(i).borderWidth = 3;
- }
- for (var i = 0; i < pieInner.count; i++) {
- pieInner.at(i).labelPosition = PieSlice.LabelInsideNormal;
- pieInner.at(i).labelVisible = true;
- pieInner.at(i).borderWidth = 2;
- }
- }
- //![1]
-}
diff --git a/demos/qmlchart/qml/qmlchart/View2.qml b/demos/qmlchart/qml/qmlchart/View2.qml
deleted file mode 100644
index bc96abc7..00000000
--- a/demos/qmlchart/qml/qmlchart/View2.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Line"
- anchors.fill: parent
-
- LineSeries {
- name: "LineSeries"
- XYPoint { x: 0; y: 0 }
- XYPoint { x: 1.1; y: 2.1 }
- XYPoint { x: 1.9; y: 3.3 }
- XYPoint { x: 2.1; y: 2.1 }
- XYPoint { x: 2.9; y: 4.9 }
- XYPoint { x: 3.4; y: 3.0 }
- XYPoint { x: 4.1; y: 3.3 }
- }
- }
- //![1]
-}
diff --git a/demos/qmlchart/qml/qmlchart/View3.qml b/demos/qmlchart/qml/qmlchart/View3.qml
deleted file mode 100644
index 26ac57ce..00000000
--- a/demos/qmlchart/qml/qmlchart/View3.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Spline"
- anchors.fill: parent
-
- SplineSeries {
- name: "SplineSeries"
- XYPoint { x: 0; y: 0.0 }
- XYPoint { x: 1.1; y: 3.2 }
- XYPoint { x: 1.9; y: 2.4 }
- XYPoint { x: 2.1; y: 2.1 }
- XYPoint { x: 2.9; y: 2.6 }
- XYPoint { x: 3.4; y: 2.3 }
- XYPoint { x: 4.1; y: 3.1 }
- }
- }
- //![1]
-}
diff --git a/demos/qmlchart/qml/qmlchart/View4.qml b/demos/qmlchart/qml/qmlchart/View4.qml
deleted file mode 100644
index 32ccb19d..00000000
--- a/demos/qmlchart/qml/qmlchart/View4.qml
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "NHL All-Star Team Players"
- anchors.fill: parent
-
- ValueAxis {
- id: valueAxis
- min: 2000
- max: 2011
- tickCount: 12
- labelFormat: "%.0f"
- }
-
- AreaSeries {
- name: "Russian"
- color: "#FFD52B1E"
- borderColor: "#FF0039A5"
- borderWidth: 3
- axisX: valueAxis
- upperSeries: LineSeries {
- XYPoint { x: 2000; y: 1 }
- XYPoint { x: 2001; y: 1 }
- XYPoint { x: 2002; y: 1 }
- XYPoint { x: 2003; y: 1 }
- XYPoint { x: 2004; y: 1 }
- XYPoint { x: 2005; y: 0 }
- XYPoint { x: 2006; y: 1 }
- XYPoint { x: 2007; y: 1 }
- XYPoint { x: 2008; y: 4 }
- XYPoint { x: 2009; y: 3 }
- XYPoint { x: 2010; y: 2 }
- XYPoint { x: 2011; y: 1 }
- }
- }
- // ...
- //![1]
-
- AreaSeries {
- name: "Swedish"
- color: "#AF005292"
- borderColor: "#AFFDCA00"
- borderWidth: 3
- axisX: valueAxis
- upperSeries: LineSeries {
- XYPoint { x: 2000; y: 1 }
- XYPoint { x: 2001; y: 1 }
- XYPoint { x: 2002; y: 3 }
- XYPoint { x: 2003; y: 3 }
- XYPoint { x: 2004; y: 2 }
- XYPoint { x: 2005; y: 0 }
- XYPoint { x: 2006; y: 2 }
- XYPoint { x: 2007; y: 1 }
- XYPoint { x: 2008; y: 2 }
- XYPoint { x: 2009; y: 1 }
- XYPoint { x: 2010; y: 3 }
- XYPoint { x: 2011; y: 3 }
- }
- }
-
- AreaSeries {
- name: "Finnish"
- color: "#00357F"
- borderColor: "#FEFEFE"
- borderWidth: 3
- axisX: valueAxis
- upperSeries: LineSeries {
- XYPoint { x: 2000; y: 0 }
- XYPoint { x: 2001; y: 0 }
- XYPoint { x: 2002; y: 0 }
- XYPoint { x: 2003; y: 0 }
- XYPoint { x: 2004; y: 0 }
- XYPoint { x: 2005; y: 0 }
- XYPoint { x: 2006; y: 1 }
- XYPoint { x: 2007; y: 0 }
- XYPoint { x: 2008; y: 0 }
- XYPoint { x: 2009; y: 0 }
- XYPoint { x: 2010; y: 0 }
- XYPoint { x: 2011; y: 1 }
- }
- }
- }
-}
diff --git a/demos/qmlchart/qml/qmlchart/View5.qml b/demos/qmlchart/qml/qmlchart/View5.qml
deleted file mode 100644
index 5632b6c4..00000000
--- a/demos/qmlchart/qml/qmlchart/View5.qml
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Scatters"
- anchors.fill: parent
-
- ScatterSeries {
- id: scatter1
- name: "Scatter1"
- XYPoint { x: 1.5; y: 1.5 }
- XYPoint { x: 1.5; y: 1.6 }
- XYPoint { x: 1.57; y: 1.55 }
- XYPoint { x: 1.8; y: 1.8 }
- XYPoint { x: 1.9; y: 1.6 }
- XYPoint { x: 2.1; y: 1.3 }
- XYPoint { x: 2.5; y: 2.1 }
- }
-
- ScatterSeries {
- name: "Scatter2"
- // ...
- //![1]
- XYPoint { x: 2.0; y: 2.0 }
- XYPoint { x: 2.0; y: 2.1 }
- XYPoint { x: 2.07; y: 2.05 }
- XYPoint { x: 2.2; y: 2.9 }
- XYPoint { x: 2.4; y: 2.7 }
- XYPoint { x: 2.67; y: 2.65 }
- }
- }
-}
diff --git a/demos/qmlchart/qml/qmlchart/View6.qml b/demos/qmlchart/qml/qmlchart/View6.qml
deleted file mode 100644
index ff5b3e8b..00000000
--- a/demos/qmlchart/qml/qmlchart/View6.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
-
- BarSeries {
- id: mySeries
- axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
diff --git a/demos/qmlchart/qml/qmlchart/View7.qml b/demos/qmlchart/qml/qmlchart/View7.qml
deleted file mode 100644
index 6b86b2c6..00000000
--- a/demos/qmlchart/qml/qmlchart/View7.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Stacked Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
-
- StackedBarSeries {
- id: mySeries
- axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
diff --git a/demos/qmlchart/qml/qmlchart/View8.qml b/demos/qmlchart/qml/qmlchart/View8.qml
deleted file mode 100644
index eeb0147a..00000000
--- a/demos/qmlchart/qml/qmlchart/View8.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Percent Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
-
- PercentBarSeries {
- axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
diff --git a/demos/qmlchart/qml/qmlchart/View9.qml b/demos/qmlchart/qml/qmlchart/View9.qml
deleted file mode 100644
index 5df8d52f..00000000
--- a/demos/qmlchart/qml/qmlchart/View9.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Horizontal Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
-
- HorizontalBarSeries {
- axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
-
diff --git a/demos/qmlchart/qml/qmlchart/loader.qml b/demos/qmlchart/qml/qmlchart/loader.qml
deleted file mode 100644
index 271f1f76..00000000
--- a/demos/qmlchart/qml/qmlchart/loader.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Item {
- id: container
- width: 600
- height: 400
- Component.onCompleted: {
- var co = Qt.createComponent("main.qml")
- if (co.status == Component.Ready) {
- var o = co.createObject(container)
- } else {
- console.log(co.errorString())
- console.log("QtCommercial.Chart 1.1 not available")
- console.log("Please use correct QML_IMPORT_PATH export")
- }
- }
-}
diff --git a/demos/qmlchart/qml/qmlchart/main.qml b/demos/qmlchart/qml/qmlchart/main.qml
deleted file mode 100644
index d4ca8f82..00000000
--- a/demos/qmlchart/qml/qmlchart/main.qml
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- width: parent.width
- height: parent.height
- property int viewNumber: 1
-
- Loader {
- id: loader
- anchors.fill: parent
- source: "View" + viewNumber + ".qml";
- }
-
- Rectangle {
- id: infoText
- anchors.centerIn: parent
- width: parent.width
- height: 40
- color: "black"
- Text {
- color: "white"
- anchors.centerIn: parent
- text: "Use left and right arrow keys to navigate between chart types"
- }
-
- Behavior on opacity {
- NumberAnimation { duration: 400 }
- }
- }
-
- MouseArea {
- focus: true
- anchors.fill: parent
- onClicked: {
- if (infoText.opacity > 0) {
- infoText.opacity = 0.0;
- } else {
- nextView();
- }
- }
- Keys.onPressed: {
- if (infoText.opacity > 0) {
- infoText.opacity = 0.0;
- } else {
- if (event.key == Qt.Key_Left) {
- previousView();
- } else {
- nextView();
- }
- }
- }
- }
-
- function nextView() {
- var i = viewNumber + 1;
- if (i > 12)
- viewNumber = 1;
- else
- viewNumber = i;
- }
-
- function previousView() {
- var i = viewNumber - 1;
- if (i <= 0)
- viewNumber = 12;
- else
- viewNumber = i;
- }
-}
diff --git a/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/demos/qmlchart/qmlchart.pro b/demos/qmlchart/qmlchart.pro
deleted file mode 100644
index f9996cb5..00000000
--- a/demos/qmlchart/qmlchart.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/qmlchart/*
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlchart/qmlchart.svg b/demos/qmlchart/qmlchart.svg
deleted file mode 100644
index 566acfad..00000000
--- a/demos/qmlchart/qmlchart.svg
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- height="44px"
- version="1.1"
- viewBox="0 0 44 44"
- width="44px"
- x="0px"
- y="0px"
- id="svg2"
- inkscape:version="0.47 r22583"
- sodipodi:docname="qt.svg">
- <metadata
- id="metadata18">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs16">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 22 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="44 : 22 : 1"
- inkscape:persp3d-origin="22 : 14.666667 : 1"
- id="perspective2836" />
- </defs>
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="1920"
- inkscape:window-height="1020"
- id="namedview14"
- showgrid="false"
- inkscape:zoom="21.454545"
- inkscape:cx="49.412871"
- inkscape:cy="21.894358"
- inkscape:window-x="-4"
- inkscape:window-y="-4"
- inkscape:window-maximized="1"
- inkscape:current-layer="g3" />
- <g
- transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)"
- id="g3">
- <path
- d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z"
- style="fill:#006225"
- id="path5"
- sodipodi:nodetypes="cccccccc" />
- <path
- d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z"
- style="fill:#80c342"
- id="path7" />
- <path
- d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z"
- style="fill:#006225"
- id="path11" />
- <path
- d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z"
- style="fill:#006225"
- id="path13" />
- <path
- id="path17"
- style="fill:#ffffff"
- d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" />
- <path
- d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z"
- style="fill:#006225"
- id="path19" />
- <path
- id="path21"
- style="fill:#006225"
- d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" />
- </g>
-</svg>
diff --git a/demos/qmlchart/resources.qrc b/demos/qmlchart/resources.qrc
deleted file mode 100644
index 43b6f8a8..00000000
--- a/demos/qmlchart/resources.qrc
+++ /dev/null
@@ -1,18 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/qmlchart/loader.qml</file>
- <file>qml/qmlchart/main.qml</file>
- <file>qml/qmlchart/View1.qml</file>
- <file>qml/qmlchart/View2.qml</file>
- <file>qml/qmlchart/View3.qml</file>
- <file>qml/qmlchart/View4.qml</file>
- <file>qml/qmlchart/View5.qml</file>
- <file>qml/qmlchart/View6.qml</file>
- <file>qml/qmlchart/View7.qml</file>
- <file>qml/qmlchart/View8.qml</file>
- <file>qml/qmlchart/View9.qml</file>
- <file>qml/qmlchart/View10.qml</file>
- <file>qml/qmlchart/View11.qml</file>
- <file>qml/qmlchart/View12.qml</file>
- </qresource>
-</RCC>
diff --git a/demos/qmlcustomizations/main.cpp b/demos/qmlcustomizations/main.cpp
deleted file mode 100644
index 79424b95..00000000
--- a/demos/qmlcustomizations/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
-
- // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmlcustomizations/loader.qml"));
- viewer->setRenderHint(QPainter::Antialiasing, true);
- viewer->showExpanded();
-
- return app->exec();
-}
diff --git a/demos/qmlcustomizations/qml/qmlcustomizations/loader.qml b/demos/qmlcustomizations/qml/qmlcustomizations/loader.qml
deleted file mode 100644
index c3eea330..00000000
--- a/demos/qmlcustomizations/qml/qmlcustomizations/loader.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Item {
- id: container
- width: 400
- height: 300
- Component.onCompleted: {
- var co = Qt.createComponent("main.qml")
- if (co.status == Component.Ready) {
- var o = co.createObject(container)
- } else {
- console.log(co.errorString())
- console.log("QtCommercial.Chart 1.1 not available")
- console.log("Please use correct QML_IMPORT_PATH export")
- }
- }
-}
diff --git a/demos/qmlcustomizations/qml/qmlcustomizations/main.qml b/demos/qmlcustomizations/qml/qmlcustomizations/main.qml
deleted file mode 100644
index f338d692..00000000
--- a/demos/qmlcustomizations/qml/qmlcustomizations/main.qml
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- width: parent.width
- height: parent.height
- property int __activeIndex: 1
- property real __intervalCoefficient: 0
-
- //![1]
- ChartView {
- id: chartView
- anchors.fill: parent
- title: "Wheel of fortune"
- legend.visible: false
-
- PieSeries {
- id: wheelOfFortune
- horizontalPosition: 0.3
- }
-
- SplineSeries {
- id: splineSeries
- }
-
- ScatterSeries {
- id: scatterSeries
- }
- }
- //![1]
-
- //![2]
- Component.onCompleted: {
- __intervalCoefficient = Math.random() + 0.1;
-
- for (var i = 0; i < 20; i++)
- wheelOfFortune.append("", 1);
-
- var interval = 1;
- for (var j = 0; interval < 800; j++) {
- interval = __intervalCoefficient * j * j;
- splineSeries.append(j, interval);
- }
- chartView.axisX(scatterSeries).max = j;
- chartView.axisY(scatterSeries).max = 1000;
- }
- //![2]
-
- Timer {
- triggeredOnStart: true
- running: true
- repeat: true
- interval: 100
- onTriggered: {
- var index = __activeIndex % wheelOfFortune.count;
- if (interval < 700) {
- //![3]
- wheelOfFortune.at(index).exploded = false;
- __activeIndex++;
- index = __activeIndex % wheelOfFortune.count;
- wheelOfFortune.at(index).exploded = true;
- //![3]
- interval = splineSeries.at(__activeIndex).y;
- //![4]
- scatterSeries.clear();
- scatterSeries.append(__activeIndex, interval);
- scatterSeries.color = Qt.tint(scatterSeries.color, "#05FF0000");
- scatterSeries.markerSize += 0.5;
- //![4]
- } else {
- //![5]
- // Switch the colors of the slice and the border
- wheelOfFortune.at(index).borderWidth = 2;
- var borderColor = wheelOfFortune.at(index).borderColor;
- wheelOfFortune.at(index).borderColor = wheelOfFortune.at(index).color;
- wheelOfFortune.at(index).color = borderColor;
- //![5]
- }
- }
- }
-}
diff --git a/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/demos/qmlcustomizations/qmlcustomizations.pro b/demos/qmlcustomizations/qmlcustomizations.pro
deleted file mode 100644
index f4da8598..00000000
--- a/demos/qmlcustomizations/qmlcustomizations.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/qmlcustomizations/*
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlcustomizations/resources.qrc b/demos/qmlcustomizations/resources.qrc
deleted file mode 100644
index d7966f36..00000000
--- a/demos/qmlcustomizations/resources.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/qmlcustomizations/loader.qml</file>
- <file>qml/qmlcustomizations/main.qml</file>
- </qresource>
-</RCC>
diff --git a/demos/qmlcustomlegend/main.cpp b/demos/qmlcustomlegend/main.cpp
deleted file mode 100644
index 774b3ffc..00000000
--- a/demos/qmlcustomlegend/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
-
- //viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmlcustomlegend/loader.qml"));
- viewer->setRenderHint(QPainter::Antialiasing, true);
- viewer->showExpanded();
-
- return app->exec();
-}
diff --git a/demos/qmlcustomlegend/qml/qmlcustomlegend/AnimatedAreaSeries.qml b/demos/qmlcustomlegend/qml/qmlcustomlegend/AnimatedAreaSeries.qml
deleted file mode 100755
index 8173b5d6..00000000
--- a/demos/qmlcustomlegend/qml/qmlcustomlegend/AnimatedAreaSeries.qml
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-AreaSeries {
- id: series
-
- Behavior on opacity {
- NumberAnimation { duration: 250 }
- }
-}
diff --git a/demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml b/demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml
deleted file mode 100755
index c0b66672..00000000
--- a/demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.2
-
-//![1]
-ChartView {
- id: chartViewHighlighted
- title: ""
- property variant selectedSeries
- signal clicked
- legend.visible: false
- margins.top: 10
- margins.bottom: 0
-
- LineSeries {
- id: lineSeries
-
- axisX: ValueAxis {
- min: 2006
- max: 2012
- labelFormat: "%.0f"
- tickCount: 7
- }
- axisY: ValueAxis {
- id: axisY
- titleText: "EUR"
- min: 0
- max: 40000
- niceNumbersEnabled: true
- labelFormat: "%.0f"
- tickCount: 5
- }
- }
-//![1]
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- chartViewHighlighted.clicked();
- }
- }
-
- onSelectedSeriesChanged: {
- lineSeries.clear();
- lineSeries.color = selectedSeries.color;
- var maxVal = 0.0;
- for (var i = 0; i < selectedSeries.upperSeries.count; i++ ) {
- var y = selectedSeries.upperSeries.at(i).y - selectedSeries.lowerSeries.at(i).y;
- lineSeries.append(selectedSeries.upperSeries.at(i).x, y);
- if (maxVal < y)
- maxVal = y;
- }
- chartViewHighlighted.title = selectedSeries.name;
- axisY.max = maxVal;
- }
-}
-
diff --git a/demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml b/demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml
deleted file mode 100755
index 60680934..00000000
--- a/demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- id: chartViewSelector
- width: parent.width
- height: parent.height
- signal seriesAdded(string seriesName, color seriesColor)
-
- function highlightSeries(seriesName) {
- if (seriesName == "") {
- if (state != "")
- state = "";
-
- for (var i = 0; i < chartViewStacked.count; i++)
- chartViewStacked.series(i).opacity = 1.0;
- } else {
- var targetOpacity = 0.1;
- for (var j = 0; j < chartViewStacked.count; j++) {
- if (chartViewStacked.series(j).name != seriesName)
- chartViewStacked.series(j).opacity = 0.25;
- else if (state == "highlight")
- chartViewSelected.selectedSeries = chartViewStacked.series(j);
- }
- }
- }
-
- function selectSeries(seriesName) {
- for (var i = 0; i < chartViewStacked.count; i++) {
- if (chartViewStacked.series(i).name == seriesName) {
- chartViewSelected.selectedSeries = chartViewStacked.series(i);
- if (chartViewSelector.state == "")
- chartViewSelector.state = "highlighted";
- else
- chartViewSelector.state = "";
- }
- }
- }
-
- ChartViewStacked {
- id: chartViewStacked
- anchors.left: parent.left
- anchors.leftMargin: 0
- width: parent.width
- height: parent.height
- onSeriesAdded: chartViewSelector.seriesAdded(series.name, series.color);
- }
-
- ChartViewHighlighted {
- id: chartViewSelected
- anchors.left: chartViewStacked.right
- width: parent.width
- height: parent.height
-
- opacity: 0.0
- onClicked: {
- chartViewSelector.state = "";
- }
- }
-
- states: State {
- name: "highlighted"
- PropertyChanges {
- target: chartViewSelected
- opacity: 1.0
- }
- PropertyChanges {
- target: chartViewStacked
- anchors.leftMargin: -chartViewStacked.width
- opacity: 0.0
- }
- }
-
- transitions: Transition {
- PropertyAnimation {
- properties: "width, height, opacity, anchors.leftMargin"
- duration: 400
- }
- }
-}
diff --git a/demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml b/demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml
deleted file mode 100755
index 365da46a..00000000
--- a/demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.2
-
-ChartView {
- id: chartView
- title: "Government Taxes"
- legend.visible: false
- signal entered(string seriesName)
- signal exited(string seriesName)
- margins.top: 10
- margins.bottom: 0
-
- ValueAxis {
- id: axisX
- min: 2006
- max: 2012
- tickCount: 7
- labelFormat: "%.0f"
- }
-
- ValueAxis {
- id: axisY
- titleText: "EUR"
- min: 0
- max: 90000
- tickCount: 10
- labelFormat: "%.0f"
- }
-
- AnimatedAreaSeries {
- id: stateSeries
- name: "state"
- axisX: axisX
- axisY: axisY
- borderWidth: 0
- upperSeries: LineSeries {
- id: stateUpper
- XYPoint { x: 2006; y: 33119 }
- XYPoint { x: 2007; y: 37941 }
- XYPoint { x: 2008; y: 40122 }
- XYPoint { x: 2009; y: 38991 }
- XYPoint { x: 2010; y: 34055 }
- XYPoint { x: 2011; y: 34555 }
- XYPoint { x: 2012; y: 38991 }
- }
- lowerSeries: LineSeries {
- XYPoint { x: 2006; y: 0 }
- XYPoint { x: 2007; y: 0 }
- XYPoint { x: 2008; y: 0 }
- XYPoint { x: 2009; y: 0 }
- XYPoint { x: 2010; y: 0 }
- XYPoint { x: 2011; y: 0 }
- XYPoint { x: 2012; y: 0 }
- }
- }
-
- //![1]
- AnimatedAreaSeries {
- id: municipalSeries
- name: "municipal"
- axisX: axisX
- axisY: axisY
- borderWidth: 0
- upperSeries: LineSeries {
- id: municipalUpper
- XYPoint { x: 2006; y: 33119 + 13443 }
- XYPoint { x: 2007; y: 37941 + 15311 }
- XYPoint { x: 2008; y: 40122 + 16552 }
- XYPoint { x: 2009; y: 38991 + 17904 }
- XYPoint { x: 2010; y: 34055 + 17599 }
- XYPoint { x: 2011; y: 34555 + 19002 }
- XYPoint { x: 2012; y: 38991 + 19177 }
- }
- lowerSeries: stateUpper
- }
- //![1]
-
- AnimatedAreaSeries {
- id: socialSeries
- name: "social sec."
- axisX: axisX
- axisY: axisY
- borderWidth: 0
- upperSeries: LineSeries {
- id: socialUpper
- XYPoint { x: 2006; y: 33119 + 13443 + 18855 }
- XYPoint { x: 2007; y: 37941 + 15311 + 20238 }
- XYPoint { x: 2008; y: 40122 + 16552 + 21347 }
- XYPoint { x: 2009; y: 38991 + 17904 + 22376 }
- XYPoint { x: 2010; y: 34055 + 17599 + 22076 }
- XYPoint { x: 2011; y: 34555 + 19002 + 22631 }
- XYPoint { x: 2012; y: 38991 + 19177 + 23686 }
- }
- lowerSeries: municipalUpper
- }
-}
diff --git a/demos/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml b/demos/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml
deleted file mode 100755
index 578eed26..00000000
--- a/demos/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- id: legend
- color: "lightgray"
- property int seriesCount: 0
- property variant seriesNames: []
- property variant seriesColors: []
- signal entered(string seriesName)
- signal exited(string seriesName)
- signal selected(string seriesName)
-
- function addSeries(seriesName, color) {
- var names = seriesNames;
- names[seriesCount] = seriesName;
- seriesNames = names;
-
- var colors = seriesColors;
- colors[seriesCount] = color;
- seriesColors = colors;
-
- seriesCount++;
- }
-
- Gradient {
- id: buttonGradient
- GradientStop { position: 0.0; color: "#F0F0F0" }
- GradientStop { position: 1.0; color: "#A0A0A0" }
- }
-
- Gradient {
- id: buttonGradientHovered
- GradientStop { position: 0.0; color: "#FFFFFF" }
- GradientStop { position: 1.0; color: "#B0B0B0" }
- }
-
- //![2]
- Component {
- id: legendDelegate
- Rectangle {
- id: rect
- // ...
- //![2]
- property string name: seriesNames[index]
- property color markerColor: seriesColors[index]
- gradient: buttonGradient
- border.color: "#A0A0A0"
- border.width: 1
- radius: 4
- height: 20
- width: 100
-
- Row {
- id: row
- spacing: 5
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 5
- Rectangle {
- id: marker
- anchors.verticalCenter: parent.verticalCenter
- color: markerColor
- opacity: 0.3
- radius: 4
- width: 12
- height: 10
- }
- Text {
- id: label
- anchors.verticalCenter: parent.verticalCenter
- anchors.verticalCenterOffset: -1
- text: name
- }
- }
-
- //![3]
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- hoverEnabled: true
- onEntered: {
- rect.gradient = buttonGradientHovered;
- legend.entered(label.text);
- }
- onExited: {
- rect.gradient = buttonGradient;
- legend.exited(label.text);
- marker.opacity = 0.3;
- marker.height = 10;
- }
- onClicked: {
- legend.selected(label.text);
- marker.opacity = 1.0;
- marker.height = 12;
- }
- }
- //![3]
- }
- }
-
- //![1]
- Row {
- id: legendRow
- anchors.centerIn: parent
- spacing: 6
-
- Repeater {
- id: legendRepeater
- model: seriesCount
- delegate: legendDelegate
- }
- }
- //![1]
-}
diff --git a/demos/qmlcustomlegend/qml/qmlcustomlegend/loader.qml b/demos/qmlcustomlegend/qml/qmlcustomlegend/loader.qml
deleted file mode 100755
index 1b09580d..00000000
--- a/demos/qmlcustomlegend/qml/qmlcustomlegend/loader.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Item {
- id: container
- width: 400
- height: 320
- Component.onCompleted: {
- var co = Qt.createComponent("main.qml")
- if (co.status == Component.Ready) {
- var o = co.createObject(container)
- } else {
- console.log(co.errorString())
- console.log("QtCommercial.Chart 1.1 not available")
- console.log("Please use correct QML_IMPORT_PATH export")
- }
- }
-}
diff --git a/demos/qmlcustomlegend/qml/qmlcustomlegend/main.qml b/demos/qmlcustomlegend/qml/qmlcustomlegend/main.qml
deleted file mode 100755
index 1e91b10b..00000000
--- a/demos/qmlcustomlegend/qml/qmlcustomlegend/main.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- id: main
- width: parent.width
- height: parent.height
-
- Column {
- id: column
- anchors.fill: parent
- anchors.bottomMargin: 10
- spacing: 0
-
- ChartViewSelector {
- id: chartViewSelector
- width: parent.width
- height: parent.height - customLegend.height - anchors.bottomMargin
- onSeriesAdded: customLegend.addSeries(seriesName, seriesColor);
- }
-
- CustomLegend {
- id: customLegend
- width: parent.width
- height: 35
- anchors.horizontalCenter: parent.horizontalCenter
- onEntered: chartViewSelector.highlightSeries(seriesName);
- onExited: chartViewSelector.highlightSeries("");
- onSelected: chartViewSelector.selectSeries(seriesName);
- }
- }
-
- states: State {
- name: "highlighted"
- PropertyChanges {
- target: chartViewHighlighted
- width: column.width
- height: (column.height - column.anchors.margins * 2 - customLegend.height)
- }
- PropertyChanges {
- target: chartViewStacked
- width: 1
- height: 1
- }
- }
-}
diff --git a/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/demos/qmlcustomlegend/qmlcustomlegend.pro b/demos/qmlcustomlegend/qmlcustomlegend.pro
deleted file mode 100755
index fc376490..00000000
--- a/demos/qmlcustomlegend/qmlcustomlegend.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/qmlcustomlegend/*
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlcustomlegend/resources.qrc b/demos/qmlcustomlegend/resources.qrc
deleted file mode 100755
index 5c3ad444..00000000
--- a/demos/qmlcustomlegend/resources.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/qmlcustomlegend/loader.qml</file>
- <file>qml/qmlcustomlegend/main.qml</file>
- <file>qml/qmlcustomlegend/CustomLegend.qml</file>
- <file>qml/qmlcustomlegend/ChartViewStacked.qml</file>
- <file>qml/qmlcustomlegend/ChartViewHighlighted.qml</file>
- <file>qml/qmlcustomlegend/ChartViewSelector.qml</file>
- <file>qml/qmlcustomlegend/AnimatedAreaSeries.qml</file>
- </qresource>
-</RCC>
diff --git a/demos/qmlf1legends/main.cpp b/demos/qmlf1legends/main.cpp
deleted file mode 100644
index 7138ce8e..00000000
--- a/demos/qmlf1legends/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDebug>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
-
- QmlApplicationViewer viewer;
-#ifdef Q_OS_ANDROID
- viewer.addImportPath(QString::fromLatin1("assets:/imports"));
- viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
-// viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer.setSource(QUrl("qrc:/qml/qmlf1legends/main.qml"));
- viewer.setRenderHint(QPainter::Antialiasing, true);
- viewer.showExpanded();
- return app->exec();
-}
diff --git a/demos/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml b/demos/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml
deleted file mode 100644
index 6fb05dad..00000000
--- a/demos/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.1
-
-//![1]
-XmlListModel {
- // Hard-coded test data
- xml: "<results><row><speedTrap>0</speedTrap><driver>Fittipaldi</driver><speed>104.12</speed></row>"
- +"<row><speedTrap>0</speedTrap><driver>Stewart</driver><speed>106.12</speed></row>"
- +"<row><speedTrap>0</speedTrap><driver>Hunt</driver><speed>106.12</speed></row>"
- // ...
-//![1]
- +"<row><speedTrap>1</speedTrap><driver>Fittipaldi</driver><speed>115.12</speed></row>"
- +"<row><speedTrap>1</speedTrap><driver>Stewart</driver><speed>114.12</speed></row>"
- +"<row><speedTrap>1</speedTrap><driver>Hunt</driver><speed>115.12</speed></row>"
- +"<row><speedTrap>2</speedTrap><driver>Hunt</driver><speed>165.23</speed></row>"
- +"<row><speedTrap>2</speedTrap><driver>Fittipaldi</driver><speed>175.23</speed></row>"
- +"<row><speedTrap>2</speedTrap><driver>Stewart</driver><speed>168.23</speed></row>"
- +"<row><speedTrap>3</speedTrap><driver>Hunt</driver><speed>104.87</speed></row>"
- +"<row><speedTrap>3</speedTrap><driver>Fittipaldi</driver><speed>104.43</speed></row>"
- +"<row><speedTrap>3</speedTrap><driver>Stewart</driver><speed>94.83</speed></row>"
- +"<row><speedTrap>4</speedTrap><driver>Hunt</driver><speed>107.87</speed></row>"
- +"<row><speedTrap>4</speedTrap><driver>Fittipaldi</driver><speed>111.84</speed></row>"
- +"<row><speedTrap>4</speedTrap><driver>Stewart</driver><speed>106.84</speed></row>"
- +"<row><speedTrap>5</speedTrap><driver>Hunt</driver><speed>94.87</speed></row>"
- +"<row><speedTrap>5</speedTrap><driver>Stewart</driver><speed>92.37</speed></row>"
- +"<row><speedTrap>5</speedTrap><driver>Fittipaldi</driver><speed>99.37</speed></row>"
- +"<row><speedTrap>6</speedTrap><driver>Hunt</driver><speed>52.87</speed></row>"
- +"<row><speedTrap>6</speedTrap><driver>Fittipaldi</driver><speed>42.87</speed></row>"
- +"<row><speedTrap>6</speedTrap><driver>Stewart</driver><speed>55.87</speed></row>"
- +"<row><speedTrap>7</speedTrap><driver>Hunt</driver><speed>77.87</speed></row>"
- +"<row><speedTrap>7</speedTrap><driver>Fittipaldi</driver><speed>72.87</speed></row>"
- +"<row><speedTrap>7</speedTrap><driver>Stewart</driver><speed>87.87</speed></row>"
- +"<row><speedTrap>8</speedTrap><driver>Hunt</driver><speed>94.17</speed></row>"
- +"<row><speedTrap>8</speedTrap><driver>Fittipaldi</driver><speed>98.17</speed></row>"
- +"<row><speedTrap>8</speedTrap><driver>Stewart</driver><speed>84.17</speed></row>"
- +"<row><speedTrap>9</speedTrap><driver>Hunt</driver><speed>91.87</speed></row>"
- +"<row><speedTrap>9</speedTrap><driver>Fittipaldi</driver><speed>71.87</speed></row>"
- +"<row><speedTrap>9</speedTrap><driver>Stewart</driver><speed>81.87</speed></row>"
- +"<row><speedTrap>10</speedTrap><driver>Hunt</driver><speed>104.87</speed></row>"
- +"<row><speedTrap>10</speedTrap><driver>Fittipaldi</driver><speed>115.87</speed></row>"
- +"<row><speedTrap>10</speedTrap><driver>Stewart</driver><speed>119.87</speed></row>"
- +"<row><speedTrap>11</speedTrap><driver>Hunt</driver><speed>162.87</speed></row>"
- +"<row><speedTrap>11</speedTrap><driver>Fittipaldi</driver><speed>155.84</speed></row>"
- +"<row><speedTrap>11</speedTrap><driver>Stewart</driver><speed>152.84</speed></row>"
- +"<row><speedTrap>12</speedTrap><driver>Hunt</driver><speed>181.87</speed></row>"
- +"<row><speedTrap>12</speedTrap><driver>Fittipaldi</driver><speed>161.85</speed></row>"
- +"<row><speedTrap>12</speedTrap><driver>Stewart</driver><speed>167.85</speed></row>"
- +"<row><speedTrap>13</speedTrap><driver>Hunt</driver><speed>155.87</speed></row>"
- +"<row><speedTrap>13</speedTrap><driver>Fittipaldi</driver><speed>154.87</speed></row>"
- +"<row><speedTrap>13</speedTrap><driver>Stewart</driver><speed>164.87</speed></row>"
- +"<row><speedTrap>14</speedTrap><driver>Hunt</driver><speed>197.57</speed></row>"
- +"<row><speedTrap>14</speedTrap><driver>Fittipaldi</driver><speed>187.54</speed></row>"
- +"<row><speedTrap>14</speedTrap><driver>Stewart</driver><speed>180.54</speed></row>"
- +"<row><speedTrap>15</speedTrap><driver>Fittipaldi</driver><speed>216.87</speed></row>"
- +"<row><speedTrap>15</speedTrap><driver>Hunt</driver><speed>207.87</speed></row>"
- +"<row><speedTrap>15</speedTrap><driver>Stewart</driver><speed>197.87</speed></row>"
- +"<row><speedTrap>16</speedTrap><driver>Hunt</driver><speed>82.87</speed></row>"
- +"<row><speedTrap>16</speedTrap><driver>Fittipaldi</driver><speed>79.37</speed></row>"
- +"<row><speedTrap>16</speedTrap><driver>Stewart</driver><speed>85.37</speed></row>"
- +"<row><speedTrap>17</speedTrap><driver>Hunt</driver><speed>153.87</speed></row>"
- +"<row><speedTrap>17</speedTrap><driver>Fittipaldi</driver><speed>143.87</speed></row>"
- +"<row><speedTrap>17</speedTrap><driver>Stewart</driver><speed>133.87</speed></row>"
- +"<row><speedTrap>18</speedTrap><driver>Hunt</driver><speed>89.87</speed></row>"
- +"<row><speedTrap>18</speedTrap><driver>Fittipaldi</driver><speed>95.85</speed></row>"
- +"<row><speedTrap>18</speedTrap><driver>Stewart</driver><speed>98.85</speed></row>"
- +"<row><speedTrap>19</speedTrap><driver>Hunt</driver><speed>169.87</speed></row>"
- +"<row><speedTrap>19</speedTrap><driver>Stewart</driver><speed>167.87</speed></row>"
- +"<row><speedTrap>19</speedTrap><driver>Fittipaldi</driver><speed>154.87</speed></row>"
- +"</results>"
-//![2]
- query: "/results/row"
-
- XmlRole { name: "speedTrap"; query: "speedTrap/string()" }
- XmlRole { name: "driver"; query: "driver/string()" }
- XmlRole { name: "speed"; query: "speed/string()" }
-}
-//![2]
diff --git a/demos/qmlf1legends/qml/qmlf1legends/main.qml b/demos/qmlf1legends/qml/qmlf1legends/main.qml
deleted file mode 100644
index 0f6ac73c..00000000
--- a/demos/qmlf1legends/qml/qmlf1legends/main.qml
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.1
-import QtCommercial.Chart 1.1
-
-Rectangle {
- width: 400
- height: 300
- property int currentIndex: -1
-
- //![1]
- ChartView {
- id: chartView
- title: "Driver Speeds, lap 1"
- anchors.fill: parent
- legend.alignment: Qt.AlignTop
- animationOptions: ChartView.SeriesAnimations
- }
- //![1]
-
- //![2]
- // An example XmlListModel containing F1 legend drivers' speeds at speed traps
- SpeedsXml {
- id: speedsXml
- onStatusChanged: {
- if (status == XmlListModel.Ready) {
- timer.start();
- }
- }
- }
- //![2]
-
- //![3]
- // A timer to mimic refreshing the data dynamically
- Timer {
- id: timer
- interval: 700
- repeat: true
- triggeredOnStart: true
- running: false
- onTriggered: {
- currentIndex++;
- if (currentIndex < speedsXml.count) {
- // Check if there is a series for the data already (we are using driver name to identify series)
- var lineSeries = chartView.series(speedsXml.get(currentIndex).driver);
- if (!lineSeries) {
- lineSeries = chartView.createSeries(ChartView.SeriesTypeLine, speedsXml.get(currentIndex).driver);
- chartView.axisY().min = 0;
- chartView.axisY().max = 250;
- chartView.axisY().tickCount = 6;
- chartView.axisY().titleText = "speed (kph)";
- chartView.axisX().titleText = "speed trap";
- chartView.axisX().labelFormat = "%.0f";
- }
- lineSeries.append(speedsXml.get(currentIndex).speedTrap, speedsXml.get(currentIndex).speed);
-
- if (speedsXml.get(currentIndex).speedTrap > 3) {
- chartView.axisX().max = Number(speedsXml.get(currentIndex).speedTrap) + 1;
- chartView.axisX().min = chartView.axisX().max - 5;
- } else {
- chartView.axisX().max = 5;
- chartView.axisX().min = 0;
- }
- chartView.axisX().tickCount = chartView.axisX().max - chartView.axisX().min + 1;
- } else {
- // No more data, change x-axis range to show all the data
- timer.stop();
- chartView.animationOptions = ChartView.AllAnimations;
- chartView.axisX().min = 0;
- chartView.axisX().max = speedsXml.get(currentIndex - 1).speedTrap;
- }
- }
- }
- //![3]
-}
diff --git a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/demos/qmlf1legends/qmlf1legends.pro b/demos/qmlf1legends/qmlf1legends.pro
deleted file mode 100644
index 6e18e3e4..00000000
--- a/demos/qmlf1legends/qmlf1legends.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/qmlf1legends/*
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmloscilloscope/datasource.cpp b/demos/qmloscilloscope/datasource.cpp
deleted file mode 100644
index 35285778..00000000
--- a/demos/qmloscilloscope/datasource.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "datasource.h"
-#include <QXYSeries>
-#include <QAreaSeries>
-#include <QDeclarativeView>
-#include <QDebug>
-#include <qmath.h>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-Q_DECLARE_METATYPE(QAbstractSeries *)
-Q_DECLARE_METATYPE(QAbstractAxis *)
-
-DataSource::DataSource(QDeclarativeView *appViewer, QObject *parent) :
- QObject(parent),
- m_appViewer(appViewer),
- m_index(-1)
-{
- qRegisterMetaType<QAbstractSeries*>();
- qRegisterMetaType<QAbstractAxis*>();
-
- generateData(0, 5, 1024);
-}
-
-void DataSource::update(QAbstractSeries *series)
-{
- if (series) {
- QXYSeries *xySeries = static_cast<QXYSeries *>(series);
- m_index++;
- if (m_index > m_data.count() - 1)
- m_index = 0;
-
- QList<QPointF> points = m_data.at(m_index);
- // Use replace instead of clear + append, it's optimized for performance
- xySeries->replace(points);
- }
-}
-
-void DataSource::generateData(int type, int rowCount, int colCount)
-{
- // Remove previous data
- foreach (QList<QPointF> row, m_data)
- row.clear();
- m_data.clear();
-
- // Append the new data depending on the type
- for (int i(0); i < rowCount; i++) {
- QList<QPointF> points;
- for (int j(0); j < colCount; j++) {
- qreal x(0);
- qreal y(0);
- switch (type) {
- case 0:
- // data with sin + random component
- y = qSin(3.14159265358979 / 50 * j) + 0.5 + (qreal) rand() / (qreal) RAND_MAX;
- x = j;
- break;
- case 1:
- // linear data
- x = j;
- y = (qreal) i / 10;
- break;
- default:
- // unknown, do nothing
- break;
- }
- points.append(QPointF(x, y));
- }
- m_data.append(points);
- }
-}
-
-void DataSource::setAntialiasing(bool enabled)
-{
- m_appViewer->setRenderHint(QPainter::Antialiasing, enabled);
-}
diff --git a/demos/qmloscilloscope/datasource.h b/demos/qmloscilloscope/datasource.h
deleted file mode 100644
index 7e9f476e..00000000
--- a/demos/qmloscilloscope/datasource.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DATASOURCE_H
-#define DATASOURCE_H
-
-#include <QObject>
-#include <QAbstractSeries>
-
-class QDeclarativeView;
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class DataSource : public QObject
-{
- Q_OBJECT
-public:
- explicit DataSource(QDeclarativeView *appViewer, QObject *parent = 0);
-
-signals:
-
-public slots:
- void generateData(int type, int rowCount, int colCount);
- void update(QAbstractSeries *series);
- void setAntialiasing(bool enabled);
-
-private:
- QDeclarativeView *m_appViewer;
- QList<QList<QPointF> > m_data;
- int m_index;
-};
-
-#endif // DATASOURCE_H
diff --git a/demos/qmloscilloscope/main.cpp b/demos/qmloscilloscope/main.cpp
deleted file mode 100644
index c00f4599..00000000
--- a/demos/qmloscilloscope/main.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeContext>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-#include "datasource.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
-
- DataSource dataSource(viewer.data());
- viewer->rootContext()->setContextProperty("dataSource", &dataSource);
-
- // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmloscilloscope/main.qml"));
- viewer->showExpanded();
-
- return app->exec();
-}
diff --git a/demos/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml b/demos/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml
deleted file mode 100644
index 8c590de6..00000000
--- a/demos/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Column {
- spacing: 8
- signal animationsEnabled(bool enabled)
- signal seriesTypeChanged(string type)
- signal refreshRateChanged(variant rate);
- signal signalSourceChanged(string source, int signalCount, int sampleCount);
- signal antialiasingEnabled(bool enabled)
-
- Text {
- text: "Scope"
- font.pointSize: 18
- color: "white"
- }
-
- MultiButton {
- text: "Graph: "
- items: ["line", "spline", "scatter"]
- currentSelection: 0
- onSelectionChanged: seriesTypeChanged(items[currentSelection]);
- }
-
- MultiButton {
- id: signalSourceButton
- text: "Source: "
- items: ["sin", "linear"]
- currentSelection: 0
- onSelectionChanged: signalSourceChanged(
- selection,
- 5,
- sampleCountButton.items[sampleCountButton.currentSelection]);
- }
-
- MultiButton {
- id: sampleCountButton
- text: "Samples: "
- items: [6, 128, 1024, 10000]
- currentSelection: 2
- onSelectionChanged: signalSourceChanged(
- signalSourceButton.items[signalSourceButton.currentSelection],
- 5,
- selection);
- }
-
- MultiButton {
- text: "Refresh rate: "
- items: [1, 24, 60, 100]
- currentSelection: 2
- onSelectionChanged: refreshRateChanged(items[currentSelection]);
- }
-
- MultiButton {
- text: "Animations: "
- items: ["OFF", "ON"]
- currentSelection: 0
- onSelectionChanged: animationsEnabled(currentSelection == 1);
- }
-
- MultiButton {
- text: "Antialias: "
- items: ["OFF", "ON"]
- currentSelection: 0
- onSelectionChanged: antialiasingEnabled(currentSelection == 1);
- }
-}
diff --git a/demos/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml b/demos/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml
deleted file mode 100644
index 74f8577f..00000000
--- a/demos/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- id: button
- width: 115
- height: 31
- gradient: Gradient {
- GradientStop { position: mouseArea.pressed ? 1.0 : 0.0; color: "#A09090" }
- GradientStop { position: mouseArea.pressed ? 0.0 : 1.0; color: "#505050" }
- }
- smooth: true
-
- radius: 7
- property string text: "Option: "
- property variant items: ["first"]
- property int currentSelection: 0
- signal selectionChanged(variant selection)
-
- Text {
- id: buttonText
- anchors.centerIn: parent
- color: "#FFFFFF"
- text: button.text + button.items[currentSelection]
- }
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: {
- currentSelection = (currentSelection + 1) % items.length;
- selectionChanged(button.items[currentSelection]);
- }
- }
-}
diff --git a/demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml b/demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml
deleted file mode 100644
index f6b249bb..00000000
--- a/demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.2
-
-//![1]
-ChartView {
- id: chartView
- animationOptions: ChartView.NoAnimation
- theme: ChartView.ChartThemeDark
-
- ValueAxis {
- id: axisY1
- min: -1
- max: 4
- }
-
- ValueAxis {
- id: axisY2
- min: -10
- max: 5
- }
-
- ValueAxis {
- id: axisX
- min: 0
- max: 1000
- }
-
- LineSeries {
- id: lineSeries1
- name: "signal 1"
- axisX: axisX
- axisY: axisY1
- }
- LineSeries {
- id: lineSeries2
- name: "signal 2"
- axisX: axisX
- axisYRight: axisY2
- }
-// ...
-//![1]
-
- //![2]
- Timer {
- id: refreshTimer
- interval: 1 / 60 * 1000 // 60 Hz
- running: true
- repeat: true
- onTriggered: {
- dataSource.update(chartView.series(0));
- dataSource.update(chartView.series(1));
- }
- }
- //![2]
-
- //![3]
- function changeSeriesType(type) {
- chartView.removeAllSeries();
-
- // Create two new series of the correct type. Axis x is the same for both of the series,
- // but the series have their own y-axes to make it possible to control the y-offset
- // of the "signal sources".
- if (type == "line") {
- chartView.createSeries(ChartView.SeriesTypeLine, "signal 1", axisX, axisY1);
- chartView.createSeries(ChartView.SeriesTypeLine, "signal 2", axisX, axisY2);
- } else if (type == "spline") {
- chartView.createSeries(ChartView.SeriesTypeSpline, "signal 1", axisX, axisY1);
- chartView.createSeries(ChartView.SeriesTypeSpline, "signal 2", axisX, axisY2);
- } else {
- var series1 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 1", axisX, axisY1);
- series1.markerSize = 3;
- series1.borderColor = "transparent";
- var series2 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 2", axisX, axisY2);
- series2.markerSize = 3;
- series2.borderColor = "transparent";
- }
- }
-
- function createAxis(min, max) {
- // The following creates a ValueAxis object that can be then set as a x or y axis for a series
- return Qt.createQmlObject("import QtQuick 1.1; import QtCommercial.Chart 1.1; ValueAxis { min: "
- + min + "; max: " + max + " }", chartView);
- }
- //![3]
-
- function setAnimations(enabled) {
- if (enabled)
- chartView.animationOptions = ChartView.SeriesAnimations;
- else
- chartView.animationOptions = ChartView.NoAnimation;
- }
-
- function changeRefreshRate(rate) {
- refreshTimer.interval = 1 / Number(rate) * 1000;
- }
-}
diff --git a/demos/qmloscilloscope/qml/qmloscilloscope/main.qml b/demos/qmloscilloscope/qml/qmloscilloscope/main.qml
deleted file mode 100644
index 2574e3bb..00000000
--- a/demos/qmloscilloscope/qml/qmloscilloscope/main.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-//![1]
-Rectangle {
- id: main
- width: 460
- height: 350
- color: "#404040"
-
- ControlPanel {
- id: controlPanel
- anchors.top: parent.top
- anchors.topMargin: 10
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.leftMargin: 10
-// ...
-//![1]
-
- onSignalSourceChanged: {
- if (source == "sin")
- dataSource.generateData(0, signalCount, sampleCount);
- else
- dataSource.generateData(1, signalCount, sampleCount);
- }
- onAnimationsEnabled: scopeView.setAnimations(enabled);
- onSeriesTypeChanged: scopeView.changeSeriesType(type);
- onRefreshRateChanged: scopeView.changeRefreshRate(rate);
- onAntialiasingEnabled: dataSource.setAntialiasing(enabled);
- }
-
-//![2]
- ScopeView {
- id: scopeView
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.right: parent.right
- anchors.left: controlPanel.right
- height: main.height
- }
-//![2]
-}
diff --git a/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/demos/qmloscilloscope/qmloscilloscope.pro b/demos/qmloscilloscope/qmloscilloscope.pro
deleted file mode 100644
index 5bf080e8..00000000
--- a/demos/qmloscilloscope/qmloscilloscope.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp \
- datasource.cpp
-OTHER_FILES += qml/qmloscilloscope/*
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
-
-HEADERS += \
- datasource.h
diff --git a/demos/qmlpolarchart/main.cpp b/demos/qmlpolarchart/main.cpp
deleted file mode 100644
index 27e6a540..00000000
--- a/demos/qmlpolarchart/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
-
- // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmlpolarchart/loader.qml"));
- viewer->setRenderHint(QPainter::Antialiasing, true);
- viewer->showExpanded();
-
- return app->exec();
-}
diff --git a/demos/qmlpolarchart/qml/qmlpolarchart/View1.qml b/demos/qmlpolarchart/qml/qmlpolarchart/View1.qml
deleted file mode 100644
index 4d9ef097..00000000
--- a/demos/qmlpolarchart/qml/qmlpolarchart/View1.qml
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.3
-
-Rectangle {
- anchors.fill: parent
- //![1]
- PolarChartView {
- title: "Two Series, Common Axes"
- anchors.fill: parent
- legend.visible: false
-
- ValueAxis {
- id: axisAngular
- min: 0
- max: 20
- tickCount: 9
- }
-
- ValueAxis {
- id: axisRadial
- min: -0.5
- max: 1.5
- }
-
- SplineSeries {
- id: series1
- axisAngular: axisAngular
- axisRadial: axisRadial
- pointsVisible: true
- }
-
- ScatterSeries {
- id: series2
- axisAngular: axisAngular
- axisRadial: axisRadial
- markerSize: 10
- }
- }
-
- // Add data dynamically to the series
- Component.onCompleted: {
- for (var i = 0; i <= 20; i++) {
- series1.append(i, Math.random());
- series2.append(i, Math.random());
- }
- }
- //![1]
-}
diff --git a/demos/qmlpolarchart/qml/qmlpolarchart/View2.qml b/demos/qmlpolarchart/qml/qmlpolarchart/View2.qml
deleted file mode 100644
index b062c0c3..00000000
--- a/demos/qmlpolarchart/qml/qmlpolarchart/View2.qml
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.3
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- PolarChartView {
- title: "Historical Area Series"
- anchors.fill: parent
- legend.visible: false
-
- DateTimeAxis {
- id: axis1
- format: "yyyy MMM"
- tickCount: 13
- }
- ValueAxis {
- id: axis2
- }
- LineSeries {
- id: lowerLine
- axisAngular: axis1
- axisRadial: axis2
-
- // Please note that month in JavaScript months are zero based, so 2 means March
- XYPoint { x: toMsecsSinceEpoch(new Date(1950, 0, 1)); y: 15 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1962, 4, 1)); y: 35 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 50 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1978, 2, 1)); y: 75 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1987, 11, 1)); y: 102 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1992, 1, 1)); y: 132 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 100 }
- XYPoint { x: toMsecsSinceEpoch(new Date(2002, 4, 1)); y: 120 }
- XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 1)); y: 140 }
- XYPoint { x: toMsecsSinceEpoch(new Date(2013, 5, 1)); y: 150 }
- }
- LineSeries {
- id: upperLine
- axisAngular: axis1
- axisRadial: axis2
-
- // Please note that month in JavaScript months are zero based, so 2 means March
- XYPoint { x: toMsecsSinceEpoch(new Date(1950, 0, 1)); y: 30 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1962, 4, 1)); y: 55 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 80 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1978, 2, 1)); y: 105 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1987, 11, 1)); y: 125 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1992, 1, 1)); y: 160 }
- XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 140 }
- XYPoint { x: toMsecsSinceEpoch(new Date(2002, 4, 1)); y: 140 }
- XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 1)); y: 170 }
- XYPoint { x: toMsecsSinceEpoch(new Date(2013, 5, 1)); y: 200 }
- }
- AreaSeries {
- axisAngular: axis1
- axisRadial: axis2
- lowerSeries: lowerLine
- upperSeries: upperLine
- }
- }
- // DateTimeAxis is based on QDateTimes so we must convert our JavaScript dates to
- // milliseconds since epoch to make them match the DateTimeAxis values
- function toMsecsSinceEpoch(date) {
- var msecs = date.getTime();
- return msecs;
- }
- //![1]
-}
diff --git a/demos/qmlpolarchart/qml/qmlpolarchart/View3.qml b/demos/qmlpolarchart/qml/qmlpolarchart/View3.qml
deleted file mode 100644
index c671448f..00000000
--- a/demos/qmlpolarchart/qml/qmlpolarchart/View3.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.3
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- PolarChartView {
- title: "Numerical Data for Dummies"
- anchors.fill: parent
- legend.visible: false
-
- LineSeries {
- axisRadial: CategoryAxis {
- min: 0
- max: 30
- CategoryRange {
- label: "critical"
- endValue: 2
- }
- CategoryRange {
- label: "low"
- endValue: 7
- }
- CategoryRange {
- label: "normal"
- endValue: 12
- }
- CategoryRange {
- label: "high"
- endValue: 18
- }
- CategoryRange {
- label: "extremely high"
- endValue: 30
- }
- }
-
- axisAngular: ValueAxis {
- tickCount: 13
- }
-
- XYPoint { x: 0; y: 4.3 }
- XYPoint { x: 1; y: 4.1 }
- XYPoint { x: 2; y: 4.7 }
- XYPoint { x: 3; y: 3.9 }
- XYPoint { x: 4; y: 5.2 }
- XYPoint { x: 5; y: 5.3 }
- XYPoint { x: 6; y: 6.1 }
- XYPoint { x: 7; y: 7.7 }
- XYPoint { x: 8; y: 12.9 }
- XYPoint { x: 9; y: 19.2 }
- }
- }
- //![1]
-}
diff --git a/demos/qmlpolarchart/qml/qmlpolarchart/loader.qml b/demos/qmlpolarchart/qml/qmlpolarchart/loader.qml
deleted file mode 100644
index 06054d01..00000000
--- a/demos/qmlpolarchart/qml/qmlpolarchart/loader.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Item {
- id: container
- width: 800
- height: 600
- Component.onCompleted: {
- var co = Qt.createComponent("main.qml")
- if (co.status == Component.Ready) {
- var o = co.createObject(container)
- } else {
- console.log(co.errorString())
- console.log("QtCommercial.Chart 1.3 not available")
- console.log("Please use correct QML_IMPORT_PATH export")
- }
- }
-}
diff --git a/demos/qmlpolarchart/qml/qmlpolarchart/main.qml b/demos/qmlpolarchart/qml/qmlpolarchart/main.qml
deleted file mode 100644
index 56f5e288..00000000
--- a/demos/qmlpolarchart/qml/qmlpolarchart/main.qml
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Rectangle {
- width: parent.width
- height: parent.height
- property int viewNumber: 1
- property int viewCount: 3
-
- Loader {
- id: loader
- anchors.fill: parent
- source: "View" + viewNumber + ".qml";
- }
-
- Rectangle {
- id: infoText
- anchors.centerIn: parent
- width: parent.width
- height: 40
- color: "black"
- Text {
- color: "white"
- anchors.centerIn: parent
- text: "Use left and right arrow keys to navigate"
- }
-
- Behavior on opacity {
- NumberAnimation { duration: 400 }
- }
- }
-
- MouseArea {
- focus: true
- anchors.fill: parent
- onClicked: {
- if (infoText.opacity > 0) {
- infoText.opacity = 0.0;
- } else {
- nextView();
- }
- }
- Keys.onPressed: {
- if (infoText.opacity > 0) {
- infoText.opacity = 0.0;
- } else {
- if (event.key == Qt.Key_Left) {
- previousView();
- } else {
- nextView();
- }
- }
- }
- }
-
- function nextView() {
- var i = viewNumber + 1;
- if (i > viewCount)
- viewNumber = 1;
- else
- viewNumber = i;
- }
-
- function previousView() {
- var i = viewNumber - 1;
- if (i <= 0)
- viewNumber = viewCount;
- else
- viewNumber = i;
- }
-}
diff --git a/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/demos/qmlpolarchart/qmlpolarchart.pro b/demos/qmlpolarchart/qmlpolarchart.pro
deleted file mode 100644
index f661312b..00000000
--- a/demos/qmlpolarchart/qmlpolarchart.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/qmlpolarchart/*
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlpolarchart/resources.qrc b/demos/qmlpolarchart/resources.qrc
deleted file mode 100644
index 854acbef..00000000
--- a/demos/qmlpolarchart/resources.qrc
+++ /dev/null
@@ -1,9 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/qmlpolarchart/loader.qml</file>
- <file>qml/qmlpolarchart/main.qml</file>
- <file>qml/qmlpolarchart/View1.qml</file>
- <file>qml/qmlpolarchart/View2.qml</file>
- <file>qml/qmlpolarchart/View3.qml</file>
- </qresource>
-</RCC>
diff --git a/demos/qmlweather/main.cpp b/demos/qmlweather/main.cpp
deleted file mode 100644
index fee07449..00000000
--- a/demos/qmlweather/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeContext>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDebug>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
-
- QmlApplicationViewer viewer;
-#ifdef Q_OS_ANDROID
- viewer.addImportPath(QString::fromLatin1("assets:/imports"));
- viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
-// viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- QString appKey;
- if (argc > 1) {
- appKey = argv[1];
- qDebug() << "App key for worldweatheronline.com:" << appKey;
- } else {
- qWarning() << "No app key for worldweatheronline.com given. Using static test data instead of live data.";
- }
- viewer.rootContext()->setContextProperty("weatherAppKey", appKey);
- viewer.setSource(QUrl("qrc:/qml/qmlweather/main.qml"));
- viewer.setRenderHint(QPainter::Antialiasing, true);
- viewer.showExpanded();
- return app->exec();
-}
diff --git a/demos/qmlweather/qml/qmlweather/main.qml b/demos/qmlweather/qml/qmlweather/main.qml
deleted file mode 100644
index 16e48a38..00000000
--- a/demos/qmlweather/qml/qmlweather/main.qml
+++ /dev/null
@@ -1,200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.1
-import QtCommercial.Chart 1.2
-
-Rectangle {
- width: 500
- height: 400
- gradient: Gradient {
- GradientStop { position: 0.0; color: "lightblue" }
- GradientStop { position: 1.0; color: "white" }
- }
-
- //![1]
- ChartView {
- id: chartView
- title: "Weather forecast"
- //![1]
- anchors.top: parent.top
- anchors.bottom: weatherImageRow.top
- anchors.left: parent.left
- anchors.right: parent.right
- legend.alignment: Qt.AlignTop
-
- //![2]
- BarCategoriesAxis {
- id: barCategoriesAxis
- titleText: "Date"
- }
-
- ValueAxis{
- id: valueAxisY2
- min: 0
- max: 10
- titleText: "Rainfall [mm]"
- }
-
- ValueAxis {
- id: valueAxisX
- // Hide the value axis; it is only used to map the line series to bar categories axis
- visible: false
- min: 0
- max: 5
- }
-
- ValueAxis{
- id: valueAxisY
- min: 0
- max: 15
- titleText: "Temperature [&deg;C]"
- }
-
- LineSeries {
- id: maxTempSeries
- axisX: valueAxisX
- axisY: valueAxisY
- name: "Max. temperature"
- }
-
- LineSeries {
- id: minTempSeries
- axisX: valueAxisX
- axisY: valueAxisY
- name: "Min. temperature"
- }
-
- BarSeries {
- id: myBarSeries
- axisX: barCategoriesAxis
- axisYRight: valueAxisY2
- BarSet {
- id: rainfallSet
- label: "Rainfall"
- }
- }
- //![2]
- }
-
- // A timer to refresh the forecast every 5 minutes
- Timer {
- interval: 300000
- repeat: true
- triggeredOnStart: true
- running: true
- onTriggered: {
- if (weatherAppKey != "") {
- //![3]
- // Make HTTP GET request and parse the result
- var xhr = new XMLHttpRequest;
- xhr.open("GET",
- "http://free.worldweatheronline.com/feed/weather.ashx?q=Jyv%c3%a4skyl%c3%a4,Finland&format=json&num_of_days=5&key="
- + weatherAppKey);
- xhr.onreadystatechange = function() {
- if (xhr.readyState == XMLHttpRequest.DONE) {
- var a = JSON.parse(xhr.responseText);
- parseWeatherData(a);
- }
- }
- xhr.send();
- //![3]
- } else {
- // No app key for worldweatheronline.com given by the user -> use dummy static data
- var responseText = "{ \"data\": { \"current_condition\": [ {\"cloudcover\": \"10\", \"humidity\": \"61\", \"observation_time\": \"06:26 AM\", \"precipMM\": \"0.0\", \"pressure\": \"1022\", \"temp_C\": \"6\", \"temp_F\": \"43\", \"visibility\": \"10\", \"weatherCode\": \"113\", \"weatherDesc\": [ {\"value\": \"Sunny\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0001_sunny.png\" } ], \"winddir16Point\": \"SE\", \"winddirDegree\": \"140\", \"windspeedKmph\": \"7\", \"windspeedMiles\": \"4\" } ], \"request\": [ {\"query\": \"Jyvaskyla, Finland\", \"type\": \"City\" } ], \"weather\": [ {\"date\": \"2012-05-09\", \"precipMM\": \"0.4\", \"tempMaxC\": \"14\", \"tempMaxF\": \"57\", \"tempMinC\": \"7\", \"tempMinF\": \"45\", \"weatherCode\": \"116\", \"weatherDesc\": [ {\"value\": \"Partly Cloudy\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png\" } ], \"winddir16Point\": \"S\", \"winddirDegree\": \"179\", \"winddirection\": \"S\", \"windspeedKmph\": \"20\", \"windspeedMiles\": \"12\" }, {\"date\": \"2012-05-10\", \"precipMM\": \"2.4\", \"tempMaxC\": \"13\", \"tempMaxF\": \"55\", \"tempMinC\": \"8\", \"tempMinF\": \"46\", \"weatherCode\": \"266\", \"weatherDesc\": [ {\"value\": \"Light drizzle\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0017_cloudy_with_light_rain.png\" } ], \"winddir16Point\": \"SW\", \"winddirDegree\": \"219\", \"winddirection\": \"SW\", \"windspeedKmph\": \"21\", \"windspeedMiles\": \"13\" }, {\"date\": \"2012-05-11\", \"precipMM\": \"11.1\", \"tempMaxC\": \"15\", \"tempMaxF\": \"59\", \"tempMinC\": \"7\", \"tempMinF\": \"44\", \"weatherCode\": \"266\", \"weatherDesc\": [ {\"value\": \"Light drizzle\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0017_cloudy_with_light_rain.png\" } ], \"winddir16Point\": \"SSW\", \"winddirDegree\": \"200\", \"winddirection\": \"SSW\", \"windspeedKmph\": \"20\", \"windspeedMiles\": \"12\" }, {\"date\": \"2012-05-12\", \"precipMM\": \"2.8\", \"tempMaxC\": \"7\", \"tempMaxF\": \"44\", \"tempMinC\": \"2\", \"tempMinF\": \"35\", \"weatherCode\": \"317\", \"weatherDesc\": [ {\"value\": \"Light sleet\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0021_cloudy_with_sleet.png\" } ], \"winddir16Point\": \"NW\", \"winddirDegree\": \"311\", \"winddirection\": \"NW\", \"windspeedKmph\": \"24\", \"windspeedMiles\": \"15\" }, {\"date\": \"2012-05-13\", \"precipMM\": \"0.4\", \"tempMaxC\": \"6\", \"tempMaxF\": \"42\", \"tempMinC\": \"2\", \"tempMinF\": \"35\", \"weatherCode\": \"116\", \"weatherDesc\": [ {\"value\": \"Partly Cloudy\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png\" } ], \"winddir16Point\": \"WNW\", \"winddirDegree\": \"281\", \"winddirection\": \"WNW\", \"windspeedKmph\": \"21\", \"windspeedMiles\": \"13\" } ] }}";
- var a = JSON.parse(responseText);
- parseWeatherData(a);
- }
- }
- }
-
- Row {
- id: weatherImageRow
- anchors.bottom: poweredByText.top
- anchors.bottomMargin: 10
- anchors.left: parent.left
- anchors.leftMargin: 25
- anchors.right: parent.right
- anchors.rightMargin: 25
-
- ListModel {
- id: weatherImageModel
- }
-
- Repeater {
- id: repeater
- model: weatherImageModel
- delegate: Image {
- source: imageSource
- width: weatherImageRow.width / weatherImageModel.count
- height: width
- fillMode: Image.PreserveAspectCrop
- }
- }
- }
-
- Text {
- id: poweredByText
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 10
- anchors.left: parent.left
- anchors.leftMargin: 25
- text: "Powered by World Weather Online"
- }
-
- function parseWeatherData(weatherData) {
- // Clear previous values
- maxTempSeries.clear();
- minTempSeries.clear();
- weatherImageModel.clear();
-
- //![4]
- // Loop through the parsed JSON
- for (var i in weatherData.data.weather) {
- var weatherObj = weatherData.data.weather[i];
- //![4]
-
- //![5]
- // Store temperature values, rainfall and weather icon.
- // The temperature values begin from 0.5 instead of 0.0 to make the start from the
- // middle of the rainfall bars. This makes the temperature lines visually better
- // synchronized with the rainfall bars.
- maxTempSeries.append(Number(i) + 0.5, weatherObj.tempMaxC);
- minTempSeries.append(Number(i) + 0.5, weatherObj.tempMinC);
- rainfallSet.append(i, weatherObj.precipMM);
- weatherImageModel.append({"imageSource":weatherObj.weatherIconUrl[0].value});
- //![5]
-
- // Update scale of the chart
- valueAxisY.max = Math.max(chartView.axisY().max,weatherObj.tempMaxC);
- valueAxisX.min = 0;
- valueAxisX.max = Number(i) + 1;
-
- // Set the x-axis labels to the dates of the forecast
- var xLabels = barCategoriesAxis.categories;
- xLabels[Number(i)] = weatherObj.date.substring(5, 10);
- barCategoriesAxis.categories = xLabels;
- barCategoriesAxis.visible = true;
- barCategoriesAxis.min = 0;
- barCategoriesAxis.max = xLabels.length - 1;
- }
- }
-
-}
diff --git a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/demos/qmlweather/qmlweather.pro b/demos/qmlweather/qmlweather.pro
deleted file mode 100644
index 52fa5716..00000000
--- a/demos/qmlweather/qmlweather.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/qmlweather/*
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
-
diff --git a/demos/quick2chart/main.cpp b/demos/quick2chart/main.cpp
deleted file mode 100644
index 04913d00..00000000
--- a/demos/quick2chart/main.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets/QApplication>
-#include <QtQuick/QQuickItem>
-#include <QDir>
-#include <QtQml/QQmlEngine>
-#include "qtquick2applicationviewer.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QtQuick2ApplicationViewer viewer;
-#ifdef Q_OS_ANDROID
- viewer.addImportPath(QString::fromLatin1("assets:/qml"));
- viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
-#endif
- viewer.setSource(QUrl("qrc:/qml/quick2chart/main.qml"));
- viewer.showExpanded();
-
- return app.exec();
-}
diff --git a/demos/quick2chart/qml/quick2chart/View1.qml b/demos/quick2chart/qml/quick2chart/View1.qml
deleted file mode 100644
index e3850ae1..00000000
--- a/demos/quick2chart/qml/quick2chart/View1.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![2]
-import QtQuick 2.0
-//![2]
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
- property variant othersSlice: 0
-
- //![1]
- ChartView {
- id: chart
- title: "Top-5 car brand shares in Finland"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
- antialiasing: true
-
- PieSeries {
- id: pieSeries
- PieSlice { label: "Volkswagen"; value: 13.5 }
- PieSlice { label: "Toyota"; value: 10.9 }
- PieSlice { label: "Ford"; value: 8.6 }
- PieSlice { label: "Skoda"; value: 8.2 }
- PieSlice { label: "Volvo"; value: 6.8 }
- }
- }
-
- Component.onCompleted: {
- // You can also manipulate slices dynamically
- othersSlice = pieSeries.append("Others", 52.0);
- pieSeries.find("Volkswagen").exploded = true;
- }
- //![1]
-}
diff --git a/demos/quick2chart/qml/quick2chart/View10.qml b/demos/quick2chart/qml/quick2chart/View10.qml
deleted file mode 100644
index 2a5a2973..00000000
--- a/demos/quick2chart/qml/quick2chart/View10.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Horizontal Stacked Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
- antialiasing: true
-
- HorizontalStackedBarSeries {
- axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
diff --git a/demos/quick2chart/qml/quick2chart/View11.qml b/demos/quick2chart/qml/quick2chart/View11.qml
deleted file mode 100644
index 2b2d444a..00000000
--- a/demos/quick2chart/qml/quick2chart/View11.qml
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Horizontal Percent Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
- antialiasing: true
-
- HorizontalPercentBarSeries {
- axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
-
diff --git a/demos/quick2chart/qml/quick2chart/View12.qml b/demos/quick2chart/qml/quick2chart/View12.qml
deleted file mode 100644
index 74d97896..00000000
--- a/demos/quick2chart/qml/quick2chart/View12.qml
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- id: chart
- title: "Production costs"
- anchors.fill: parent
- legend.visible: false
- antialiasing: true
-
- PieSeries {
- id: pieOuter
- size: 0.96
- holeSize: 0.7
- PieSlice { id: slice; label: "Alpha"; value: 19511; color: "#8AB846"; borderColor: "#163430" }
- PieSlice { label: "Epsilon"; value: 11105; color: "#C0EEFF"; borderColor: "#3B391C" }
- PieSlice { label: "Psi"; value: 9352; color: "#DF8939"; borderColor: "#13060C" }
- }
-
- PieSeries {
- size: 0.7
- id: pieInner
- holeSize: 0.25
-
- PieSlice { label: "Materials"; value: 10334; color: "#8AB846"; borderColor: "#163430" }
- PieSlice { label: "Employee"; value: 3066; color: "#AAE356"; borderColor: "#163430" }
- PieSlice { label: "Logistics"; value: 6111; color: "#99CC4E"; borderColor: "#163430" }
-
- PieSlice { label: "Materials"; value: 7371; color: "#C0EEFF"; borderColor: "#3B391C" }
- PieSlice { label: "Employee"; value: 2443; color: "#C9FAFF"; borderColor: "#3B391C" }
- PieSlice { label: "Logistics"; value: 1291; color: "#B0FAFF"; borderColor: "#3B391C" }
-
- PieSlice { label: "Materials"; value: 4022; color: "#DF8939"; borderColor: "#13060C" }
- PieSlice { label: "Employee"; value: 3998; color: "#FC9D42"; borderColor: "#13060C" }
- PieSlice { label: "Logistics"; value: 1332; color: "#F2963F"; borderColor: "#13060C" }
- }
- }
-
- Component.onCompleted: {
- // Set the common slice properties dynamically for convenience
- for (var i = 0; i < pieOuter.count; i++) {
- pieOuter.at(i).labelPosition = PieSlice.LabelOutside;
- pieOuter.at(i).labelVisible = true;
- pieOuter.at(i).borderWidth = 3;
- }
- for (var i = 0; i < pieInner.count; i++) {
- pieInner.at(i).labelPosition = PieSlice.LabelInsideNormal;
- pieInner.at(i).labelVisible = true;
- pieInner.at(i).borderWidth = 2;
- }
- }
- //![1]
-}
diff --git a/demos/quick2chart/qml/quick2chart/View2.qml b/demos/quick2chart/qml/quick2chart/View2.qml
deleted file mode 100644
index a7e0ace4..00000000
--- a/demos/quick2chart/qml/quick2chart/View2.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Line"
- anchors.fill: parent
- antialiasing: true
-
- LineSeries {
- name: "LineSeries"
- XYPoint { x: 0; y: 0 }
- XYPoint { x: 1.1; y: 2.1 }
- XYPoint { x: 1.9; y: 3.3 }
- XYPoint { x: 2.1; y: 2.1 }
- XYPoint { x: 2.9; y: 4.9 }
- XYPoint { x: 3.4; y: 3.0 }
- XYPoint { x: 4.1; y: 3.3 }
- }
- }
- //![1]
-}
diff --git a/demos/quick2chart/qml/quick2chart/View3.qml b/demos/quick2chart/qml/quick2chart/View3.qml
deleted file mode 100644
index d56ceeb2..00000000
--- a/demos/quick2chart/qml/quick2chart/View3.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Spline"
- anchors.fill: parent
- antialiasing: true
-
- SplineSeries {
- name: "SplineSeries"
- XYPoint { x: 0; y: 0.0 }
- XYPoint { x: 1.1; y: 3.2 }
- XYPoint { x: 1.9; y: 2.4 }
- XYPoint { x: 2.1; y: 2.1 }
- XYPoint { x: 2.9; y: 2.6 }
- XYPoint { x: 3.4; y: 2.3 }
- XYPoint { x: 4.1; y: 3.1 }
- }
- }
- //![1]
-}
diff --git a/demos/quick2chart/qml/quick2chart/View4.qml b/demos/quick2chart/qml/quick2chart/View4.qml
deleted file mode 100644
index 5ca59061..00000000
--- a/demos/quick2chart/qml/quick2chart/View4.qml
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "NHL All-Star Team Players"
- anchors.fill: parent
- antialiasing: true
-
- ValueAxis {
- id: valueAxis
- min: 2000
- max: 2011
- tickCount: 12
- labelFormat: "%.0f"
- }
-
- AreaSeries {
- name: "Russian"
- color: "#FFD52B1E"
- borderColor: "#FF0039A5"
- borderWidth: 3
- axisX: valueAxis
- upperSeries: LineSeries {
- XYPoint { x: 2000; y: 1 }
- XYPoint { x: 2001; y: 1 }
- XYPoint { x: 2002; y: 1 }
- XYPoint { x: 2003; y: 1 }
- XYPoint { x: 2004; y: 1 }
- XYPoint { x: 2005; y: 0 }
- XYPoint { x: 2006; y: 1 }
- XYPoint { x: 2007; y: 1 }
- XYPoint { x: 2008; y: 4 }
- XYPoint { x: 2009; y: 3 }
- XYPoint { x: 2010; y: 2 }
- XYPoint { x: 2011; y: 1 }
- }
- }
- // ...
- //![1]
-
- AreaSeries {
- name: "Swedish"
- color: "#AF005292"
- borderColor: "#AFFDCA00"
- borderWidth: 3
- axisX: valueAxis
- upperSeries: LineSeries {
- XYPoint { x: 2000; y: 1 }
- XYPoint { x: 2001; y: 1 }
- XYPoint { x: 2002; y: 3 }
- XYPoint { x: 2003; y: 3 }
- XYPoint { x: 2004; y: 2 }
- XYPoint { x: 2005; y: 0 }
- XYPoint { x: 2006; y: 2 }
- XYPoint { x: 2007; y: 1 }
- XYPoint { x: 2008; y: 2 }
- XYPoint { x: 2009; y: 1 }
- XYPoint { x: 2010; y: 3 }
- XYPoint { x: 2011; y: 3 }
- }
- }
-
- AreaSeries {
- name: "Finnish"
- color: "#00357F"
- borderColor: "#FEFEFE"
- borderWidth: 3
- axisX: valueAxis
- upperSeries: LineSeries {
- XYPoint { x: 2000; y: 0 }
- XYPoint { x: 2001; y: 0 }
- XYPoint { x: 2002; y: 0 }
- XYPoint { x: 2003; y: 0 }
- XYPoint { x: 2004; y: 0 }
- XYPoint { x: 2005; y: 0 }
- XYPoint { x: 2006; y: 1 }
- XYPoint { x: 2007; y: 0 }
- XYPoint { x: 2008; y: 0 }
- XYPoint { x: 2009; y: 0 }
- XYPoint { x: 2010; y: 0 }
- XYPoint { x: 2011; y: 1 }
- }
- }
- }
-}
diff --git a/demos/quick2chart/qml/quick2chart/View5.qml b/demos/quick2chart/qml/quick2chart/View5.qml
deleted file mode 100644
index 4b0882cb..00000000
--- a/demos/quick2chart/qml/quick2chart/View5.qml
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Scatters"
- anchors.fill: parent
- antialiasing: true
-
- ScatterSeries {
- id: scatter1
- name: "Scatter1"
- XYPoint { x: 1.5; y: 1.5 }
- XYPoint { x: 1.5; y: 1.6 }
- XYPoint { x: 1.57; y: 1.55 }
- XYPoint { x: 1.8; y: 1.8 }
- XYPoint { x: 1.9; y: 1.6 }
- XYPoint { x: 2.1; y: 1.3 }
- XYPoint { x: 2.5; y: 2.1 }
- }
-
- ScatterSeries {
- name: "Scatter2"
- // ...
- //![1]
- XYPoint { x: 2.0; y: 2.0 }
- XYPoint { x: 2.0; y: 2.1 }
- XYPoint { x: 2.07; y: 2.05 }
- XYPoint { x: 2.2; y: 2.9 }
- XYPoint { x: 2.4; y: 2.7 }
- XYPoint { x: 2.67; y: 2.65 }
- }
- }
-}
diff --git a/demos/quick2chart/qml/quick2chart/View6.qml b/demos/quick2chart/qml/quick2chart/View6.qml
deleted file mode 100644
index b9db3aca..00000000
--- a/demos/quick2chart/qml/quick2chart/View6.qml
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
- antialiasing: true
-
- BarSeries {
- id: mySeries
- axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
diff --git a/demos/quick2chart/qml/quick2chart/View7.qml b/demos/quick2chart/qml/quick2chart/View7.qml
deleted file mode 100644
index 998097a7..00000000
--- a/demos/quick2chart/qml/quick2chart/View7.qml
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Stacked Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
- antialiasing: true
-
- StackedBarSeries {
- id: mySeries
- axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
diff --git a/demos/quick2chart/qml/quick2chart/View8.qml b/demos/quick2chart/qml/quick2chart/View8.qml
deleted file mode 100644
index fcb8a729..00000000
--- a/demos/quick2chart/qml/quick2chart/View8.qml
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Percent Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
- antialiasing: true
-
- PercentBarSeries {
- axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
diff --git a/demos/quick2chart/qml/quick2chart/View9.qml b/demos/quick2chart/qml/quick2chart/View9.qml
deleted file mode 100644
index 5ba3d365..00000000
--- a/demos/quick2chart/qml/quick2chart/View9.qml
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Rectangle {
- anchors.fill: parent
-
- //![1]
- ChartView {
- title: "Horizontal Bar series"
- anchors.fill: parent
- legend.alignment: Qt.AlignBottom
- antialiasing: true
-
- HorizontalBarSeries {
- axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
- }
- }
- //![1]
-}
-
diff --git a/demos/quick2chart/qml/quick2chart/loader.qml b/demos/quick2chart/qml/quick2chart/loader.qml
deleted file mode 100644
index f9b7569a..00000000
--- a/demos/quick2chart/qml/quick2chart/loader.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Item {
- id: container
- width: 600
- height: 400
- Component.onCompleted: {
- var co = Qt.createComponent("main.qml")
- if (co.status == Component.Ready) {
- var o = co.createObject(container)
- } else {
- console.log(co.errorString())
- console.log("QtCommercial.Chart 1.1 not available")
- console.log("Please use correct QML_IMPORT_PATH export")
- }
- }
-}
diff --git a/demos/quick2chart/qml/quick2chart/main.qml b/demos/quick2chart/qml/quick2chart/main.qml
deleted file mode 100644
index 2f52d578..00000000
--- a/demos/quick2chart/qml/quick2chart/main.qml
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![1]
-import QtQuick 2.0
-//![1]
-
-Rectangle {
- width: 600
- height: 400
- property int viewNumber: 1
-
- Loader {
- id: loader
- anchors.fill: parent
- source: "View" + viewNumber + ".qml";
- }
-
- Rectangle {
- id: infoText
- anchors.centerIn: parent
- width: parent.width
- height: 40
- color: "black"
- Text {
- color: "white"
- anchors.centerIn: parent
- text: "Use left and right arrow keys to navigate between chart types"
- }
-
- Behavior on opacity {
- NumberAnimation { duration: 400 }
- }
- }
-
- MouseArea {
- focus: true
- anchors.fill: parent
- onClicked: {
- if (infoText.opacity > 0) {
- infoText.opacity = 0.0;
- } else {
- nextView();
- }
- }
- Keys.onPressed: {
- if (infoText.opacity > 0) {
- infoText.opacity = 0.0;
- } else {
- if (event.key == Qt.Key_Left) {
- previousView();
- } else {
- nextView();
- }
- }
- }
- }
-
- function nextView() {
- var i = viewNumber + 1;
- if (i > 12)
- viewNumber = 1;
- else
- viewNumber = i;
- }
-
- function previousView() {
- var i = viewNumber - 1;
- if (i <= 0)
- viewNumber = 12;
- else
- viewNumber = i;
- }
-}
diff --git a/demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.cpp
deleted file mode 100644
index b58190f6..00000000
--- a/demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// checksum 0xc01f version 0x90005
-/*
- This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
- QtQuick2ApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qtquick2applicationviewer.h"
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QDir>
-#include <QtQml/QQmlEngine>
-
-class QtQuick2ApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QtQuick2ApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#if defined(Q_OS_IOS)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_MAC)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#elif defined(Q_OS_ANDROID_NO_SDK)
- return QLatin1String("/data/user/qt/") + path;
-#endif
- return path;
-}
-
-QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
- : QQuickView(parent)
- , d(new QtQuick2ApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QQuickView::SizeRootObjectToView);
-}
-
-QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
-{
- delete d;
-}
-
-void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QtQuick2ApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
-}
-
-void QtQuick2ApplicationViewer::showExpanded()
-{
-#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
- showFullScreen();
-#else
- show();
-#endif
-}
diff --git a/demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.h b/demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.h
deleted file mode 100644
index cf66f140..00000000
--- a/demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// checksum 0xfde6 version 0x90005
-/*
- This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
- QtQuick2ApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QTQUICK2APPLICATIONVIEWER_H
-#define QTQUICK2APPLICATIONVIEWER_H
-
-#include <QtQuick/QQuickView>
-
-class QtQuick2ApplicationViewer : public QQuickView
-{
- Q_OBJECT
-
-public:
- explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
- virtual ~QtQuick2ApplicationViewer();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- void showExpanded();
-
-private:
- class QtQuick2ApplicationViewerPrivate *d;
-};
-
-#endif // QTQUICK2APPLICATIONVIEWER_H
diff --git a/demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.pri b/demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.pri
deleted file mode 100644
index b2d0f51d..00000000
--- a/demos/quick2chart/qtquick2applicationviewer/qtquick2applicationviewer.pri
+++ /dev/null
@@ -1,6 +0,0 @@
-QT += qml quick widgets
-
-SOURCES += $$PWD/qtquick2applicationviewer.cpp
-HEADERS += $$PWD/qtquick2applicationviewer.h
-INCLUDEPATH += $$PWD
-
diff --git a/demos/quick2chart/quick2chart.pro b/demos/quick2chart/quick2chart.pro
deleted file mode 100644
index 006d47f9..00000000
--- a/demos/quick2chart/quick2chart.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/quick2chart/*
-
-include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
-
diff --git a/demos/quick2chart/resources.qrc b/demos/quick2chart/resources.qrc
deleted file mode 100644
index 853f4423..00000000
--- a/demos/quick2chart/resources.qrc
+++ /dev/null
@@ -1,18 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/quick2chart/loader.qml</file>
- <file>qml/quick2chart/main.qml</file>
- <file>qml/quick2chart/View1.qml</file>
- <file>qml/quick2chart/View2.qml</file>
- <file>qml/quick2chart/View3.qml</file>
- <file>qml/quick2chart/View4.qml</file>
- <file>qml/quick2chart/View5.qml</file>
- <file>qml/quick2chart/View6.qml</file>
- <file>qml/quick2chart/View7.qml</file>
- <file>qml/quick2chart/View8.qml</file>
- <file>qml/quick2chart/View9.qml</file>
- <file>qml/quick2chart/View10.qml</file>
- <file>qml/quick2chart/View11.qml</file>
- <file>qml/quick2chart/View12.qml</file>
- </qresource>
-</RCC>
diff --git a/demos/quick2oscilloscope/datasource.cpp b/demos/quick2oscilloscope/datasource.cpp
deleted file mode 100644
index 48b2ecfb..00000000
--- a/demos/quick2oscilloscope/datasource.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "datasource.h"
-#include <QXYSeries>
-#include <QAreaSeries>
-#include <QtQuick/QQuickView>
-#include <QtQuick/QQuickItem>
-#include <QDebug>
-#include <qmath.h>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-Q_DECLARE_METATYPE(QAbstractSeries *)
-Q_DECLARE_METATYPE(QAbstractAxis *)
-
-DataSource::DataSource(QQuickView *appViewer, QObject *parent) :
- QObject(parent),
- m_appViewer(appViewer),
- m_index(-1)
-{
- qRegisterMetaType<QAbstractSeries*>();
- qRegisterMetaType<QAbstractAxis*>();
-
- generateData(0, 5, 1024);
-}
-
-void DataSource::update(QAbstractSeries *series)
-{
- if (series) {
- QXYSeries *xySeries = static_cast<QXYSeries *>(series);
- m_index++;
- if (m_index > m_data.count() - 1)
- m_index = 0;
-
- QList<QPointF> points = m_data.at(m_index);
- // Use replace instead of clear + append, it's optimized for performance
- xySeries->replace(points);
- }
-}
-
-void DataSource::generateData(int type, int rowCount, int colCount)
-{
- // Remove previous data
- foreach (QList<QPointF> row, m_data)
- row.clear();
- m_data.clear();
-
- // Append the new data depending on the type
- for (int i(0); i < rowCount; i++) {
- QList<QPointF> points;
- for (int j(0); j < colCount; j++) {
- qreal x(0);
- qreal y(0);
- switch (type) {
- case 0:
- // data with sin + random component
- y = qSin(3.14159265358979 / 50 * j) + 0.5 + (qreal) rand() / (qreal) RAND_MAX;
- x = j;
- break;
- case 1:
- // linear data
- x = j;
- y = (qreal) i / 10;
- break;
- default:
- // unknown, do nothing
- break;
- }
- points.append(QPointF(x, y));
- }
- m_data.append(points);
- }
-}
diff --git a/demos/quick2oscilloscope/datasource.h b/demos/quick2oscilloscope/datasource.h
deleted file mode 100644
index 3670a7d5..00000000
--- a/demos/quick2oscilloscope/datasource.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DATASOURCE_H
-#define DATASOURCE_H
-
-#include <QObject>
-#include <QAbstractSeries>
-
-class QQuickView;
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class DataSource : public QObject
-{
- Q_OBJECT
-public:
- explicit DataSource(QQuickView *appViewer, QObject *parent = 0);
-
-signals:
-
-public slots:
- void generateData(int type, int rowCount, int colCount);
- void update(QAbstractSeries *series);
-
-private:
- QQuickView *m_appViewer;
- QList<QList<QPointF> > m_data;
- int m_index;
-};
-
-#endif // DATASOURCE_H
diff --git a/demos/quick2oscilloscope/main.cpp b/demos/quick2oscilloscope/main.cpp
deleted file mode 100644
index 1d733c9b..00000000
--- a/demos/quick2oscilloscope/main.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets/QApplication>
-#include <QtQuick/QQuickItem>
-#include <QtQml/QQmlContext>
-#include <QtQml/QQmlEngine>
-#include <QDir>
-#include "qtquick2applicationviewer.h"
-#include "datasource.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QtQuick2ApplicationViewer viewer;
-#ifdef Q_OS_ANDROID
- viewer.addImportPath(QString::fromLatin1("assets:/qml"));
- viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
-#endif
-
- DataSource dataSource(&viewer);
- viewer.rootContext()->setContextProperty("dataSource", &dataSource);
-
- viewer.setSource(QUrl("qrc:/qml/quick2oscilloscope/main.qml"));
- viewer.showExpanded();
-
- return app.exec();
-}
diff --git a/demos/quick2oscilloscope/qml/quick2oscilloscope/ControlPanel.qml b/demos/quick2oscilloscope/qml/quick2oscilloscope/ControlPanel.qml
deleted file mode 100644
index 74041410..00000000
--- a/demos/quick2oscilloscope/qml/quick2oscilloscope/ControlPanel.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Column {
- spacing: 8
- signal animationsEnabled(bool enabled)
- signal seriesTypeChanged(string type)
- signal refreshRateChanged(variant rate);
- signal signalSourceChanged(string source, int signalCount, int sampleCount);
- signal antialiasingEnabled(bool enabled)
-
- Text {
- text: "Scope"
- font.pointSize: 18
- color: "white"
- }
-
- MultiButton {
- text: "Graph: "
- items: ["line", "spline", "scatter"]
- currentSelection: 0
- onSelectionChanged: seriesTypeChanged(items[currentSelection]);
- }
-
- MultiButton {
- id: signalSourceButton
- text: "Source: "
- items: ["sin", "linear"]
- currentSelection: 0
- onSelectionChanged: signalSourceChanged(
- selection,
- 5,
- sampleCountButton.items[sampleCountButton.currentSelection]);
- }
-
- MultiButton {
- id: sampleCountButton
- text: "Samples: "
- items: [6, 128, 1024, 10000]
- currentSelection: 2
- onSelectionChanged: signalSourceChanged(
- signalSourceButton.items[signalSourceButton.currentSelection],
- 5,
- selection);
- }
-
- MultiButton {
- text: "Refresh rate: "
- items: [1, 24, 60, 100]
- currentSelection: 2
- onSelectionChanged: refreshRateChanged(items[currentSelection]);
- }
-
- MultiButton {
- text: "Animations: "
- items: ["OFF", "ON"]
- currentSelection: 0
- onSelectionChanged: animationsEnabled(currentSelection == 1);
- }
-
- MultiButton {
- text: "Antialias: "
- items: ["OFF", "ON"]
- currentSelection: 0
- onSelectionChanged: antialiasingEnabled(currentSelection == 1);
- }
-}
diff --git a/demos/quick2oscilloscope/qml/quick2oscilloscope/MultiButton.qml b/demos/quick2oscilloscope/qml/quick2oscilloscope/MultiButton.qml
deleted file mode 100644
index 072e8019..00000000
--- a/demos/quick2oscilloscope/qml/quick2oscilloscope/MultiButton.qml
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Rectangle {
- id: button
- width: 115
- height: 31
- gradient: Gradient {
- GradientStop { position: mouseArea.pressed ? 1.0 : 0.0; color: "#A09090" }
- GradientStop { position: mouseArea.pressed ? 0.0 : 1.0; color: "#505050" }
- }
- smooth: true
-
- radius: 7
- property string text: "Option: "
- property variant items: ["first"]
- property int currentSelection: 0
- signal selectionChanged(variant selection)
-
- Text {
- id: buttonText
- anchors.centerIn: parent
- color: "#FFFFFF"
- text: button.text + button.items[currentSelection]
- }
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: {
- currentSelection = (currentSelection + 1) % items.length;
- selectionChanged(button.items[currentSelection]);
- }
- }
-}
diff --git a/demos/quick2oscilloscope/qml/quick2oscilloscope/ScopeView.qml b/demos/quick2oscilloscope/qml/quick2oscilloscope/ScopeView.qml
deleted file mode 100644
index bdab2604..00000000
--- a/demos/quick2oscilloscope/qml/quick2oscilloscope/ScopeView.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.2
-
-//![1]
-ChartView {
- id: chartView
- animationOptions: ChartView.NoAnimation
- theme: ChartView.ChartThemeDark
-
- ValueAxis {
- id: axisY1
- min: -1
- max: 4
- }
-
- ValueAxis {
- id: axisY2
- min: -10
- max: 5
- }
-
- ValueAxis {
- id: axisX
- min: 0
- max: 1000
- }
-
- LineSeries {
- id: lineSeries1
- name: "signal 1"
- axisX: axisX
- axisY: axisY1
- }
- LineSeries {
- id: lineSeries2
- name: "signal 2"
- axisX: axisX
- axisYRight: axisY2
- }
-// ...
-//![1]
-
- //![2]
- Timer {
- id: refreshTimer
- interval: 1 / 60 * 1000 // 60 Hz
- running: true
- repeat: true
- onTriggered: {
- dataSource.update(chartView.series(0));
- dataSource.update(chartView.series(1));
- }
- }
- //![2]
-
- //![3]
- function changeSeriesType(type) {
- chartView.removeAllSeries();
-
- // Create two new series of the correct type. Axis x is the same for both of the series,
- // but the series have their own y-axes to make it possible to control the y-offset
- // of the "signal sources".
- if (type == "line") {
- chartView.createSeries(ChartView.SeriesTypeLine, "signal 1", axisX, axisY1);
- chartView.createSeries(ChartView.SeriesTypeLine, "signal 2", axisX, axisY2);
- } else if (type == "spline") {
- chartView.createSeries(ChartView.SeriesTypeSpline, "signal 1", axisX, axisY1);
- chartView.createSeries(ChartView.SeriesTypeSpline, "signal 2", axisX, axisY2);
- } else {
- var series1 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 1", axisX, axisY1);
- series1.markerSize = 3;
- series1.borderColor = "transparent";
- var series2 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 2", axisX, axisY2);
- series2.markerSize = 3;
- series2.borderColor = "transparent";
- }
- }
-
- function createAxis(min, max) {
- // The following creates a ValueAxis object that can be then set as a x or y axis for a series
- return Qt.createQmlObject("import QtQuick 1.1; import QtCommercial.Chart 1.1; ValueAxis { min: "
- + min + "; max: " + max + " }", chartView);
- }
- //![3]
-
- function setAnimations(enabled) {
- if (enabled)
- chartView.animationOptions = ChartView.SeriesAnimations;
- else
- chartView.animationOptions = ChartView.NoAnimation;
- }
-
- function changeRefreshRate(rate) {
- refreshTimer.interval = 1 / Number(rate) * 1000;
- }
-}
diff --git a/demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml b/demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml
deleted file mode 100644
index 8b00f355..00000000
--- a/demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![3]
-import QtQuick 2.0
-//![3]
-
-//![1]
-Rectangle {
- id: main
- width: 400
- height: 300
- color: "#404040"
-
- ControlPanel {
- id: controlPanel
- anchors.top: parent.top
- anchors.topMargin: 10
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.leftMargin: 10
-// ...
-//![1]
-
- onSignalSourceChanged: {
- if (source == "sin")
- dataSource.generateData(0, signalCount, sampleCount);
- else
- dataSource.generateData(1, signalCount, sampleCount);
- }
- onAnimationsEnabled: scopeView.setAnimations(enabled);
- onSeriesTypeChanged: scopeView.changeSeriesType(type);
- onRefreshRateChanged: scopeView.changeRefreshRate(rate);
- onAntialiasingEnabled: scopeView.antialiasing = enabled;
- }
-
-//![2]
- ScopeView {
- id: scopeView
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.right: parent.right
- anchors.left: controlPanel.right
- height: main.height
- }
-//![2]
-}
diff --git a/demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.cpp
deleted file mode 100644
index b58190f6..00000000
--- a/demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// checksum 0xc01f version 0x90005
-/*
- This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
- QtQuick2ApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qtquick2applicationviewer.h"
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QDir>
-#include <QtQml/QQmlEngine>
-
-class QtQuick2ApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QtQuick2ApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#if defined(Q_OS_IOS)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_MAC)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#elif defined(Q_OS_ANDROID_NO_SDK)
- return QLatin1String("/data/user/qt/") + path;
-#endif
- return path;
-}
-
-QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
- : QQuickView(parent)
- , d(new QtQuick2ApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QQuickView::SizeRootObjectToView);
-}
-
-QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
-{
- delete d;
-}
-
-void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QtQuick2ApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
-}
-
-void QtQuick2ApplicationViewer::showExpanded()
-{
-#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
- showFullScreen();
-#else
- show();
-#endif
-}
diff --git a/demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.h b/demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.h
deleted file mode 100644
index cf66f140..00000000
--- a/demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// checksum 0xfde6 version 0x90005
-/*
- This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
- QtQuick2ApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QTQUICK2APPLICATIONVIEWER_H
-#define QTQUICK2APPLICATIONVIEWER_H
-
-#include <QtQuick/QQuickView>
-
-class QtQuick2ApplicationViewer : public QQuickView
-{
- Q_OBJECT
-
-public:
- explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
- virtual ~QtQuick2ApplicationViewer();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- void showExpanded();
-
-private:
- class QtQuick2ApplicationViewerPrivate *d;
-};
-
-#endif // QTQUICK2APPLICATIONVIEWER_H
diff --git a/demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.pri b/demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.pri
deleted file mode 100644
index b2d0f51d..00000000
--- a/demos/quick2oscilloscope/qtquick2applicationviewer/qtquick2applicationviewer.pri
+++ /dev/null
@@ -1,6 +0,0 @@
-QT += qml quick widgets
-
-SOURCES += $$PWD/qtquick2applicationviewer.cpp
-HEADERS += $$PWD/qtquick2applicationviewer.h
-INCLUDEPATH += $$PWD
-
diff --git a/demos/quick2oscilloscope/quick2oscilloscope.pro b/demos/quick2oscilloscope/quick2oscilloscope.pro
deleted file mode 100644
index 3f5575a6..00000000
--- a/demos/quick2oscilloscope/quick2oscilloscope.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-!include( ../demos.pri ) {
- error( "Couldn't find the demos.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp \
- datasource.cpp
-OTHER_FILES += qml/quick2oscilloscope/*
-
-include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
-
-HEADERS += \
- datasource.h
diff --git a/demos/quick2oscilloscope/resources.qrc b/demos/quick2oscilloscope/resources.qrc
deleted file mode 100644
index 87208ca4..00000000
--- a/demos/quick2oscilloscope/resources.qrc
+++ /dev/null
@@ -1,8 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/quick2oscilloscope/main.qml</file>
- <file>qml/quick2oscilloscope/ControlPanel.qml</file>
- <file>qml/quick2oscilloscope/ScopeView.qml</file>
- <file>qml/quick2oscilloscope/MultiButton.qml</file>
- </qresource>
-</RCC>
diff --git a/doc/docconf/compat.qdocconf b/doc/docconf/compat.qdocconf
deleted file mode 100644
index d14b78e3..00000000
--- a/doc/docconf/compat.qdocconf
+++ /dev/null
@@ -1,31 +0,0 @@
-macro.0 = "\\\\0"
-macro.b = "\\bold"
-macro.n = "\\\\n"
-macro.r = "\\\\r"
-macro.i = "\\o"
-macro.i11 = "\\o{1,1}"
-macro.i12 = "\\o{1,2}"
-macro.i13 = "\\o{1,3}"
-macro.i14 = "\\o{1,4}"
-macro.i15 = "\\o{1,5}"
-macro.i16 = "\\o{1,6}"
-macro.i17 = "\\o{1,7}"
-macro.i18 = "\\o{1,8}"
-macro.i19 = "\\o{1,9}"
-macro.i21 = "\\o{2,1}"
-macro.i31 = "\\o{3,1}"
-macro.i41 = "\\o{4,1}"
-macro.i51 = "\\o{5,1}"
-macro.i61 = "\\o{6,1}"
-macro.i71 = "\\o{7,1}"
-macro.i81 = "\\o{8,1}"
-macro.i91 = "\\o{9,1}"
-macro.img = "\\image"
-macro.endquote = "\\endquotation"
-macro.relatesto = "\\relates"
-
-spurious = "Missing comma in .*" \
- "Missing pattern .*"
-
-macro.li = "\\o"
-macro.e = "\\i" \ No newline at end of file
diff --git a/doc/docconf/macros.qdocconf b/doc/docconf/macros.qdocconf
deleted file mode 100644
index 2262daa9..00000000
--- a/doc/docconf/macros.qdocconf
+++ /dev/null
@@ -1,37 +0,0 @@
-macro.aacute.HTML = "&aacute;"
-macro.Aring.HTML = "&Aring;"
-macro.aring.HTML = "&aring;"
-macro.Auml.HTML = "&Auml;"
-macro.author = "\\bold{Author:}"
-macro.br.HTML = "<br />"
-macro.BR.HTML = "<br />"
-macro.copyright.HTML = "&copy;"
-macro.eacute.HTML = "&eacute;"
-macro.gui = "\\bold"
-macro.hr.HTML = "<hr />"
-macro.iacute.HTML = "&iacute;"
-macro.key = "\\bold"
-macro.menu = "\\bold"
-macro.note = "\\bold{Note:}"
-macro.oslash.HTML = "&oslash;"
-macro.ouml.HTML = "&ouml;"
-macro.QA = "\\e{Qt Assistant}"
-macro.QD = "\\e{Qt Designer}"
-macro.QL = "\\e{Qt Linguist}"
-macro.QQV = "\\e{Qt QML Viewer}"
-macro.param = "\\e"
-macro.raisedaster.HTML = "<sup>*</sup>"
-macro.rarrow.HTML = "&rarr;"
-macro.reg.HTML = "<sup>&reg;</sup>"
-macro.return = "Returns"
-macro.starslash = "\\c{*/}"
-macro.begincomment = "\\c{/*}"
-macro.endcomment = "\\c{*/}"
-macro.uuml.HTML = "&uuml;"
-macro.mdash.HTML = "&mdash;"
-
-macro.beginfloatleft.HTML = "<div style=\"float: left; margin-right: 2em\">"
-macro.beginfloatright.HTML = "<div style=\"float: right; margin-left: 2em\">"
-macro.endfloat.HTML = "</div>"
-macro.clearfloat.HTML = "<br style=\"clear: both\" />"
-macro.emptyspan.HTML = "<span></span>"
diff --git a/doc/docconf/qchart-html-template.qdocconf b/doc/docconf/qchart-html-template.qdocconf
deleted file mode 100644
index b399afbc..00000000
--- a/doc/docconf/qchart-html-template.qdocconf
+++ /dev/null
@@ -1,49 +0,0 @@
-include(qchart-html.qdocconf)
-
-HTML.postheader = \
- "<div class=\"header\" id=\"qtdocheader\">\n" \
- " <div class=\"content\"> \n" \
- " <img src=\"images/qcharts.png\" alt=\"qcharts\"/>\n" \
- " <p class=\"qtcharts\"> \n" \
- " <span>Qt Charts</span>\n" \
- " </p>\n" \
- " <p class=\"qtref\"> \n" \
- " <span>Reference Documentation</span>\n" \
- " </p>\n" \
- " </div>\n" \
- " <div class=\"breadcrumb toolblock\">\n" \
- " <ul>\n" \
- " <li class=\"first\"><a href=\"index.html\">About</a></li>\n" \
- " <li><a href=\"gettingstarted.html\">Getting started</a></li>\n" \
- " <li><a href=\"classes.html\">API Classes</a></li>\n" \
- " <li><a href=\"qml.html\">QML API</a></li>\n" \
- " <li><a href=\"examples.html\">Examples</a></li>\n" \
- " <li><a href=\"demos.html\">Demos</a></li>\n" \
- " <!-- Breadcrumbs go here -->\n"
-
-HTML.postpostheader = \
- " </ul>\n" \
- " </div>\n" \
- "</div>\n" \
- "<div class=\"content mainContent\">\n"
-
-HTML.footer = \
- " <div class=\"ft\">\n" \
- " <span></span>\n" \
- " </div>\n" \
- "</div> \n" \
- "<div class=\"footer\">\n" \
- " <p>\n" \
- " <acronym title=\"Copyright\">&copy;</acronym> 2014 Digia." \
- " Qt and Qt logos are trademarks of of Digia Corporation \n" \
- " in Finland and/or other countries worldwide.</p>\n" \
- " <p>\n" \
- " All other trademarks are property of their respective owners.</p>\n" \
- " <br />\n" \
- " <p>\n" \
- " Licensees holding valid Qt Enterprise licenses may use this document in accordance with the" \
- " Qt Enterprise License Agreement provided with the Software or, alternatively, in accordance" \
- " with the terms contained in a written agreement between you and Digia.</p>\n" \
- " <p>\n" \
- " <img src=\"images/digia_logo.png\" alt=\"digia\" /></p>\n" \
- "</div>\n" \
diff --git a/doc/docconf/qchart-html.qdocconf b/doc/docconf/qchart-html.qdocconf
deleted file mode 100644
index f7cf8ad2..00000000
--- a/doc/docconf/qchart-html.qdocconf
+++ /dev/null
@@ -1,53 +0,0 @@
-# Define the location of the templates to use. Style sheets and scripts are
-# specified relative to the template directory and will be copied into
-# subdirectories of the output directory.
-
-HTML.templatedir = .
-
-HTML.stylesheets = ../style/offline.css
-
-HTML.scripts =
-
-# Files not referenced in any qdoc file, many needed by style sheets.
-# These also need to be listed in qhp.Qt.extraFiles with the correct
-# directory prefixes.
-
-#extraimages definition for Qt4
-extraimages.HTML = qt-logo.png \
- digia_logo.png \
- qcharts.png \
- arrow_down.png \
- breadcrumb.png \
- bullet_gt.png \
- bullet_dn.png \
- bullet_sq.png \
- bullet_up.png \
- horBar.png \
- presenterchart_example.png \
- bg.png
-
-# extraimages definition for Qt5
-HTML.extraimages = ../images/qt-logo.png \
- ../images/digia_logo.png \
- ../images/qcharts.png \
- ../images/arrow_down.png \
- ../images/breadcrumb.png \
- ../images/bullet_gt.png \
- ../images/bullet_dn.png \
- ../images/bullet_sq.png \
- ../images/bullet_up.png \
- ../images/horBar.png \
- ../images/bg.png
-
-# Include the style sheets and scripts used.
-
-HTML.headerstyles = \
- " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
-
-HTML.headerscripts =
-
-HTML.endheader = \
- "</head>\n" \
- "<body>\n"
-
-HTML.nobreadcrumbs = true \ No newline at end of file
diff --git a/doc/docconf/qchart-qch.qdocconf b/doc/docconf/qchart-qch.qdocconf
deleted file mode 100644
index 8c3d9d65..00000000
--- a/doc/docconf/qchart-qch.qdocconf
+++ /dev/null
@@ -1,44 +0,0 @@
-qhp.projects = QtCharts
-qhp.QtCharts.file = qtcharts.qhp
-qhp.QtCharts.namespace = com.digia.qtcharts.$QT_CHARTS_VERSION_TAG
-qhp.QtCharts.virtualFolder = doc
-qhp.QtCharts.indexTitle = Qt Charts Reference $QT_CHARTS_VERSION
-qhp.QtCharts.filterAttributes = qtcharts $QT_CHARTS_VERSION
-qhp.QtCharts.customFilters.QtCharts.name = Qt Charts $QT_CHARTS_VERSION
-qhp.QtCharts.customFilters.QtCharts.filterAttributes = qtcharts $QT_CHARTS_VERSION
-qhp.QtCharts.indexRoot =
-
-qhp.QtCharts.subprojects = gettingstarted classes qmlclasses examples demos
-
-qhp.QtCharts.subprojects.gettingstarted.title = Getting Started
-qhp.QtCharts.subprojects.gettingstarted.indexTitle = Qt Charts getting started
-
-qhp.QtCharts.subprojects.classes.title = API Classes
-qhp.QtCharts.subprojects.classes.indexTitle = Qt Charts API
-
-qhp.QtCharts.subprojects.qmlclasses.title = QML API
-qhp.QtCharts.subprojects.qmlclasses.indexTitle = Qt Charts QML API
-
-qhp.QtCharts.subprojects.examples.title = Examples
-qhp.QtCharts.subprojects.examples.indexTitle = Qt Charts Examples
-
-qhp.QtCharts.subprojects.demos.title = Demos
-qhp.QtCharts.subprojects.demos.indexTitle = Qt Charts Demos
-
-# Files not referenced in any qdoc file.
-# See also extraimages.HTML
-qhp.QtCharts.extraFiles = index.html \
- examples.html \
- demos.html \
- images/arrow_down.png \
- images/bg.png \
- images/breadcrumb.png \
- images/bullet_gt.png \
- images/bullet_dn.png \
- images/bullet_sq.png \
- images/bullet_up.png \
- images/digia_logo.png \
- images/horBar.png \
- images/qcharts.png \
- images/qt-logo.png \
- style/offline.css
diff --git a/doc/docconf/qcharts-qt4.qdocconf b/doc/docconf/qcharts-qt4.qdocconf
deleted file mode 100644
index a819a0c4..00000000
--- a/doc/docconf/qcharts-qt4.qdocconf
+++ /dev/null
@@ -1,7 +0,0 @@
-include(compat.qdocconf)
-include(macros.qdocconf)
-include(qchart-html-template.qdocconf)
-include(qchart-qch.qdocconf)
-include(qcharts.qdocconf)
-
-sourcedirs += ../src_qt4
diff --git a/doc/docconf/qcharts-qt5.qdocconf b/doc/docconf/qcharts-qt5.qdocconf
deleted file mode 100644
index 33c6836f..00000000
--- a/doc/docconf/qcharts-qt5.qdocconf
+++ /dev/null
@@ -1,15 +0,0 @@
-include(macros.qdocconf)
-include(qchart-html-template.qdocconf)
-include(qchart-qch.qdocconf)
-include(qcharts.qdocconf)
-
-defines = QDOC_QT5
-sourcedirs += ../../
-
-#excludedirs for Windows and Linux
-excludedirs += ../src_qt4
-#excludefiles for Mac
-excludefiles += ../src_qt4/demos.qdoc \
- ../src_qt4/examples.qdoc \
- ../src_qt4/index.qdoc \
- ../src_qt4/qml.qdoc
diff --git a/doc/docconf/qcharts.qdocconf b/doc/docconf/qcharts.qdocconf
deleted file mode 100644
index 9d2bd7a1..00000000
--- a/doc/docconf/qcharts.qdocconf
+++ /dev/null
@@ -1,44 +0,0 @@
-project = Qt Charts
-description = Library for creating charts
-version = 1.4.0
-
-sourcedirs = ../../src \
- ../../examples \
- ../src \
- ../qch \
- ../../plugins/declarative
-headerdirs = ../../src \
- ../../examples \
- ../../plugins/declarative
-exampledirs = ../../ \
- ../../src \
- ../../examples
-
-outputdir = ../html
-imagedirs = ../images
-
-sources.fileextensions = *.cpp *.qdoc *.mm *.qml *.qdocinc
-headers.fileextensions = *.h *.ch *.h++ *.hh *.hpp *.hxx
-examples.fileextensions = *.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml
-examples.imageextensions = *.png *.jpeg *.jpg *.gif *.mng
-
-Cpp.ignoretokens = Q_INVOKABLE \
- QTCOMMERCIALCHART_EXPORT \
- QTCOMMERCIALCHART_END_NAMESPACE \
- QTCOMMERCIALCHART_BEGIN_NAMESPACE
-Cpp.ignoredirectives = Q_DECLARE_HANDLE \
- Q_DECLARE_INTERFACE \
- Q_DECLARE_METATYPE \
- Q_DECLARE_OPERATORS_FOR_FLAGS \
- Q_DECLARE_PRIVATE \
- Q_DECLARE_PUBLIC \
- Q_DECLARE_SHARED \
- Q_DECLARE_TR_FUNCTIONS \
- Q_DECLARE_TYPEINFO \
- Q_DISABLE_COPY \
- QT_FORWARD_DECLARE_CLASS \
- Q_DUMMY_COMPARISON_OPERATOR \
- Q_ENUMS \
- Q_FLAGS \
- Q_INTERFACES \
- __attribute__
diff --git a/doc/src/abstractaxis.qdocinc b/doc/src/abstractaxis.qdocinc
deleted file mode 100644
index 79cce2e2..00000000
--- a/doc/src/abstractaxis.qdocinc
+++ /dev/null
@@ -1,6 +0,0 @@
-\brief The AbstractAxis is a base element used for specialized axis elements.
-
-Each series can be bound to only one horizontal and vertical axis.
-
-Properties and visibility of various axis elements such as axis line, title, labels, grid lines,
-and shades can be individually controlled.
diff --git a/doc/src/abstractbarseries.qdocinc b/doc/src/abstractbarseries.qdocinc
deleted file mode 100644
index 5dc86988..00000000
--- a/doc/src/abstractbarseries.qdocinc
+++ /dev/null
@@ -1,9 +0,0 @@
-\inherits AbstractSeries
-
-The following QML shows how to create a simple bar chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1
-
-\beginfloatleft
-\image demos_qmlchart6.png
-\endfloat
-\clearfloat
diff --git a/doc/src/abstractseries.qdocinc b/doc/src/abstractseries.qdocinc
deleted file mode 100644
index 40286e6c..00000000
--- a/doc/src/abstractseries.qdocinc
+++ /dev/null
@@ -1,2 +0,0 @@
-AbstractSeries is the base class for all series.
-The class cannot be instantiated by the user.
diff --git a/doc/src/areaseries.qdocinc b/doc/src/areaseries.qdocinc
deleted file mode 100644
index 1fd21227..00000000
--- a/doc/src/areaseries.qdocinc
+++ /dev/null
@@ -1,8 +0,0 @@
-\inherits AbstractSeries
-
-The following QML shows how to create a simple area chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View4.qml 1
-\beginfloatleft
-\image demos_qmlchart4.png
-\endfloat
-\clearfloat
diff --git a/doc/src/barcategoryaxis.qdocinc b/doc/src/barcategoryaxis.qdocinc
deleted file mode 100644
index 858e7042..00000000
--- a/doc/src/barcategoryaxis.qdocinc
+++ /dev/null
@@ -1,17 +0,0 @@
-\inherits AbstractAxis
-
-\brief The Axis element is used for manipulating chart's axes.
-
-Axis can be setup to show axis line with tick marks, grid lines and shades.
-Categories are drawn between ticks. Note that you can use this also with lineseries too.
-
-To access BarCategoryAxis you can use ChartView API. For example:
-\code
- ChartView {
- BarCategoryAxis {
- id: categoryAxis
- categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ]
- }
- // Add a few series...
- }
-\endcode
diff --git a/doc/src/barseries.qdocinc b/doc/src/barseries.qdocinc
deleted file mode 100644
index 4deb9fef..00000000
--- a/doc/src/barseries.qdocinc
+++ /dev/null
@@ -1,8 +0,0 @@
-\inherits AbstractBarSeries
-
-The following QML shows how to create a simple grouped bar chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1
-\beginfloatleft
-\image demos_qmlchart6.png
-\endfloat
-\clearfloat
diff --git a/doc/src/barset.qdocinc b/doc/src/barset.qdocinc
deleted file mode 100644
index d9098ae6..00000000
--- a/doc/src/barset.qdocinc
+++ /dev/null
@@ -1,5 +0,0 @@
-BarSet represents one set of bars. Set of bars contains one data value for each category.
-First value of set is assumed to belong to first category, second to second category and so on.
-If set has fewer values than there are categories, then the missing values are assumed to be
-at the end of set. For missing values in middle of a set, numerical value of zero is used.
-\sa AbstractBarSeries, BarSeries, StackedBarSeries, PercentBarSeries
diff --git a/doc/src/categoryaxis.qdocinc b/doc/src/categoryaxis.qdocinc
deleted file mode 100644
index a0c313ec..00000000
--- a/doc/src/categoryaxis.qdocinc
+++ /dev/null
@@ -1,12 +0,0 @@
-\inherits AbstractAxis
-\brief CategoryAxis allows putting a named ranges on the axis.
-
-For example:
-\table
- \row
- \li \br
- \br
- \br
- \snippet ../demos/qmlaxes/qml/qmlaxes/View3.qml 1
- \li \inlineimage demos_qmlaxes3.png
-\endtable
diff --git a/doc/src/categoryrange.qdocinc b/doc/src/categoryrange.qdocinc
deleted file mode 100644
index 59a1d851..00000000
--- a/doc/src/categoryrange.qdocinc
+++ /dev/null
@@ -1,2 +0,0 @@
-\brief With CategoryRange you can define a range used by a CategoryAxis.
-\sa CategoryAxis
diff --git a/doc/src/chartview.qdocinc b/doc/src/chartview.qdocinc
deleted file mode 100644
index 10a2460a..00000000
--- a/doc/src/chartview.qdocinc
+++ /dev/null
@@ -1,11 +0,0 @@
-ChartView element is the parent that is responsible for showing different chart series types.
-
-The following QML shows how to create a simple chart with one pie series:
-\snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1
-\snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2
-\snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 3
-
-\beginfloatleft
-\image examples_qmlpiechart.png
-\endfloat
-\clearfloat
diff --git a/doc/src/classes.qdoc b/doc/src/classes.qdoc
deleted file mode 100644
index 290e4bd8..00000000
--- a/doc/src/classes.qdoc
+++ /dev/null
@@ -1,102 +0,0 @@
-/*!
- \page classes.html
- \title Qt Charts API
- \keyword All Classes
-
- Charts API is built on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using the QChart class. However
- there is also the convenience class QChartView, which is QWidget based. These enable us to quickly use Qt Charts as a normal Qt widget.
-
- Each chart type is represented by the QAbstractSeries derived class. To create charts, the users have to use an instance of the related
- series class and add it to a QChart instance.
- \code
- QLineSeries* series = new QLineSeries();
- series->add(0, 6);
- series->add(2, 4);
- ...
- chartView->chart()->addSeries(series);
- chartView->chart()->createDefaultAxes();
- \endcode
-
- \raw HTML
- <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
- <tr>
- <th class="titleheader" width="25%">
- Common and global
- </th>
- <th class="titleheader" width="25%">
- XY chart
- </th>
- </tr>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qchart.html">QChart</a></li>
- <li><a href="qpolarchart.html">QPolarChart</a></li>
- <li><a href="qchartview.html">QChartView</a></li>
- <li><a href="qabstractaxis.html">QAbstractAxis</a></li>
- <li><a href="qvalueaxis.html">QValueAxis</a></li>
- <li><a href="qlogvalueaxis.html">QLogValueAxis</a></li>
- <li><a href="qbarcategoryaxis.html">QBarCategoryAxis</a></li>
- <li><a href="qcategoryaxis.html">QCategoryAxis</a></li>
- <li><a href="qdatetimeaxis.html">QDateTimeAxis</a></li>
- <li><a href="qlegend.html">QLegend</a></li>
- <li><a href="qlegendmarker.html">QLegendMarker</a></li>
- <li><a href="qpielegendmarker.html">QPieLegendMarker</a></li>
- <li><a href="qxylegendmarker.html">QXYLegendMarker</a></li>
- <li><a href="qbarlegendmarker.html">QBarLegendMarker</a></li>
- <li><a href="qarealegendmarker.html">QAreaLegendMarker</a></li>
- <li><a href="qboxplotlegendmarker.html">QBoxPlotLegendMarker</a></li>
- <li><a href="qabstractseries.html">QAbstractSeries</a></li>
- </ul>
- </td>
- <td valign="top">
- <ul>
- <li><a href="qxyseries.html">QXYSeries</a></li>
- <li><a href="qlineseries.html">QLineSeries</a></li>
- <li><a href="qareaseries.html">QAreaSeries</a></li>
- <li><a href="qscatterseries.html">QScatterSeries</a></li>
- <li><a href="qsplineseries.html">QSplineSeries</a></li>
- <li><a href="qhxymodelmapper.html">QHXYModelMapper</a></li>
- <li><a href="qvxymodelmapper.html">QVXYModelMapper</a></li>
- </ul>
- </td>
- </tr>
- </table>
- <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
- <tr>
- <th class="titleheader" width="25%">
- Pie chart
- </th>
- <th class="titleheader" width="25%">
- Bar chart
- </th>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qpieseries.html">QPieSeries</a></li>
- <li><a href="qpieslice.html">QPieSlice</a></li>
- <li><a href="qhpiemodelmapper.html">QHPieModelMapper</a></li>
- <li><a href="qvpiemodelmapper.html">QVPieModelMapper</a></li>
- </ul>
- </td>
- <td valign="top">
- <ul>
- <li><a href="qbarseries.html">QBarSeries</a></li>
- <li><a href="qbarset.html">QBarSet</a></li>
- <li><a href="qpercentbarseries.html">QPercentBarSeries</a></li>
- <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li>
- <li><a href="qboxplotseries.html">QBoxPlotSeries</a></li>
- <li><a href="qboxset.html">QBoxSet</a></li>
- <li><a href="qhbarmodelmapper.html">QHBarModelMapper</a></li>
- <li><a href="qvbarmodelmapper.html">QVBarModelMapper</a></li>
- <li><a href="qvboxplotmodelmapper.html">QVBoxPlotModelMapper</a></li>
- <li><a href="qhorizontalbarseries.html">QHorizontalBarSeries</a></li>
- <li><a href="qhorizontalstackedbarseries.html">QHorizontalStackedBarSeries</a></li>
- <li><a href="qhorizontalpercentbarseries.html">QHorizontalPercentBarSeries</a></li>
- </ul>
- </td>
- </tr>
- </table>
- \endraw
-
-*/
diff --git a/doc/src/datetimeaxis.qdocinc b/doc/src/datetimeaxis.qdocinc
deleted file mode 100644
index 1f1be20e..00000000
--- a/doc/src/datetimeaxis.qdocinc
+++ /dev/null
@@ -1,6 +0,0 @@
-\brief The DateTimeAxis element is used for manipulating chart's axes.
-\inherits AbstractAxis
-
-The labels can be configured by setting an appropriate DateTime format.
-Note that any date before 4714 BCE or after about 1.4 million CE may not be accurately stored.
-DateTimeAxis can be setup to show axis line with tick marks, grid lines and shades.
diff --git a/doc/src/declarativeboxplotseries.qdocinc b/doc/src/declarativeboxplotseries.qdocinc
deleted file mode 100644
index 8b08cd68..00000000
--- a/doc/src/declarativeboxplotseries.qdocinc
+++ /dev/null
@@ -1,34 +0,0 @@
-\inherits AbstractSeries
-
-BoxPlotSeries represents a series of data shown as box-and-whiskers bars. The purpose of this class is to act as
-a container for single box-and-whiskers items. Each item is drawn to own slot. If chart includes multiple instances of
-BoxPlotSeries then box-and-whiskers items with the same index are drawn to same slot.
-
-The following QML shows how to create a simple box-and-whiskers chart:
-\code
-import QtQuick 1.0
-import QtCommercial.Chart 1.3
-
-ChartView {
- title: "Box Plot series"
- width: 400
- height: 300
- theme: ChartView.ChartThemeBrownSand
- legend.alignment: Qt.AlignBottom
-
- BoxPlotSeries {
- id: plotSeries
- name: "Income"
- BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] }
- BoxSet { label: "Feb"; values: [5, 6, 7.5, 8.6, 11.8] }
- BoxSet { label: "Mar"; values: [3.2, 5, 5.7, 8, 9.2] }
- BoxSet { label: "Apr"; values: [3.8, 5, 6.4, 7, 8] }
- BoxSet { label: "May"; values: [4, 5, 5.2, 6, 7] }
- }
-}
-\endcode
-
-\beginfloatleft
-\image examples_qmlboxplot.png
-\endfloat
-\clearfloat
diff --git a/doc/src/declarativeboxset.qdocinc b/doc/src/declarativeboxset.qdocinc
deleted file mode 100644
index 8dd9c999..00000000
--- a/doc/src/declarativeboxset.qdocinc
+++ /dev/null
@@ -1,6 +0,0 @@
-BoxSet represents one box-and-whiskers item. It takes five values to create a graphical representation
-of range and three medians. There are two ways to give the values. The first one is with constructor
-or with append method. In these the values have to be given in the following order: lower extreme, lower quartile, median,
-upper quartile and upper extreme. The second method is to create an empty QBoxSet instance and give the values using
-value specific methods.
-\sa BoxPlotSeries
diff --git a/doc/src/declarativepolarchart.qdocinc b/doc/src/declarativepolarchart.qdocinc
deleted file mode 100644
index 778b0897..00000000
--- a/doc/src/declarativepolarchart.qdocinc
+++ /dev/null
@@ -1,20 +0,0 @@
-PolarChartView element is the parent that is responsible for showing different chart series types
-in a polar chart.
-
-Polar charts support line, spline, area, and scatter series, and all axis types
-supported by those series.
-
-\note When setting ticks to an angular ValueAxis, keep in mind that the first and last tick
-are co-located at 0/360 degree angle.
-
-\note If the angular distance between two consecutive points in a series is more than 180 degrees,
-any line connecting the two points becomes meaningless, so choose the axis ranges accordingly
-when displaying line, spline, or area series.
-
-The following QML shows how to create a polar chart with two series:
-\snippet ../demos/qmlpolarchart/qml/qmlpolarchart/View1.qml 1
-
-\beginfloatleft
-\image demos_qmlpolarchart1.png
-\endfloat
-\clearfloat
diff --git a/doc/src/declarativexypoint.qdocinc b/doc/src/declarativexypoint.qdocinc
deleted file mode 100644
index 7df317ab..00000000
--- a/doc/src/declarativexypoint.qdocinc
+++ /dev/null
@@ -1,3 +0,0 @@
-XYPoint is a convenience element for initializing XY-series with static coordinate data. To
-manipulate an XY-series dynamically, use it's data manipulation functions instead.
-\sa LineSeries, AreaSeries, ScatterSeries, SplineSeries
diff --git a/doc/src/demos-audio.qdoc b/doc/src/demos-audio.qdoc
deleted file mode 100644
index f5d5428e..00000000
--- a/doc/src/demos-audio.qdoc
+++ /dev/null
@@ -1,8 +0,0 @@
-/*!
- \example demos/audio
- \title Audio demo
- \subtitle
-
- This demo shows the drawing of dynamic data (microphone input).
- \image demos_audio.png
-*/
diff --git a/doc/src/demos-callout.qdoc b/doc/src/demos-callout.qdoc
deleted file mode 100644
index 46b72639..00000000
--- a/doc/src/demos-callout.qdoc
+++ /dev/null
@@ -1,14 +0,0 @@
-/*!
- \example demos/callout
- \title Callout demo
- \subtitle
-
- This demo shows how to draw an additional element (a callout) on top of the chart.
- \image demos_callout.png
-
- QChart class provides two methods that map between the scene coordinates and the series domain (defined by the axes ranges).
-
- QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series)
-
- QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series)
-*/
diff --git a/doc/src/demos-chartthemes.qdoc b/doc/src/demos-chartthemes.qdoc
deleted file mode 100644
index a35b3d54..00000000
--- a/doc/src/demos-chartthemes.qdoc
+++ /dev/null
@@ -1,13 +0,0 @@
-/*!
- \example demos/chartthemes
- \title Chart themes demo
- \subtitle
-
- This demo shows the look and feel of the different built-in themes for all supported chart types.
- In order to give the result a more harmonious look, the background palette of the application is
- customized to the theme selected.
-
- \image demo_chartthemes_light.png
- \image demo_chartthemes_brown_sand.png
- \image demo_chartthemes_blue_cerulean.png
-*/
diff --git a/doc/src/demos-dynamicspline.qdoc b/doc/src/demos-dynamicspline.qdoc
deleted file mode 100644
index fd90493f..00000000
--- a/doc/src/demos-dynamicspline.qdoc
+++ /dev/null
@@ -1,10 +0,0 @@
-/*!
- \example demos/dynamicspline
- \title Dynamic spline demo
- \subtitle
-
- This example shows how to draw dynamic data.
-
- \image demos_dynamicspline1.png
- \image demos_dynamicspline2.png
-*/
diff --git a/doc/src/demos-nesteddonuts.qdoc b/doc/src/demos-nesteddonuts.qdoc
deleted file mode 100644
index 2ca50cc5..00000000
--- a/doc/src/demos-nesteddonuts.qdoc
+++ /dev/null
@@ -1,50 +0,0 @@
-/*!
- \example demos/nesteddonuts
- \title Nested donuts demo
- \subtitle
-
- This example shows how to create a nested donuts chart using the QPieSeries API.
- \image demos_nesteddonuts.png
-
- Let's start by creating a QChartView instance and enabling the Antialiasing on it. A QChart object is then obtained from the QChartView instance.
- The legend is disabled and the title of the chart is set. Last line enables the animations of the chart.
-
- \snippet ../demos/nesteddonuts/widget.cpp 1
-
- Three variables are defined that will be used to define the donut chart. Min and max size define the relative size of the whole donut.
- minSize is the relative inner size of the smallest donut. maxSize is the relative outer size of the biggest donut.
-
- \snippet ../demos/nesteddonuts/widget.cpp 2
-
- The following block of code defines the individual donuts and their slices. First a new QPieSeries object is created.
- The number of slices in each donut is randomized.
- The internal for loop creates the slices with a random value and label same as the value.
- Next the label of the slice is set to be visible and its color is set to white.
- To make the example more interesting the hovered signal of the slice is connected to widget's slot, of which the inner workings are explained later.
- Finally the slice is added to the donut. The donut's size is adjusted to achieve the nesting of the donuts.
- Then the donut is added to the widget's list of donuts and to the chart.
-
- \snippet ../demos/nesteddonuts/widget.cpp 3
-
- Finally the widget is placed in a layout used by the application.
-
- \snippet ../demos/nesteddonuts/widget.cpp 4
-
- To make the example more interesting the donuts are rotated randomly every 1.25 sec.
-
- \snippet ../demos/nesteddonuts/widget.cpp 5
-
- The widget's updatedRotation slot is defined below.
- It goes through all of the donuts and modifies their current rotation by a random value.
-
- \snippet ../demos/nesteddonuts/widget.cpp 6
-
- The earlier mentioned explodeSlice slot code is provided below.
- If the slice is set to exploded, then stop the timer that controls the donuts rotation.
- Then the slice's start and end angles are obtained from the slice.
- To highlight the selected slice all the other donuts that lie outward from the one that contains the selected slice
- have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice.
- If the slice is no longer selected return to the original state.
-
- \snippet ../demos/nesteddonuts/widget.cpp 7
-*/
diff --git a/doc/src/demos-piechartcustomization.qdoc b/doc/src/demos-piechartcustomization.qdoc
deleted file mode 100644
index d6844060..00000000
--- a/doc/src/demos-piechartcustomization.qdoc
+++ /dev/null
@@ -1,8 +0,0 @@
-/*!
- \example demos/piechartcustomization
- \title Pie chart customization demo
- \subtitle
-
- This demo shows how the look and feel of a pie chart can be customized.
- \image piechart_customization.png
-*/
diff --git a/doc/src/demos-qmlaxes.qdoc b/doc/src/demos-qmlaxes.qdoc
deleted file mode 100644
index 155dd748..00000000
--- a/doc/src/demos-qmlaxes.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/*!
- \example demos/qmlaxes
- \title Qml Axes
- \subtitle
-
- This is a demonstration of how to use axes in your QML application.
-
- \table
- \row
- \li \br
- We begin with a chart that has a line series and a scatter series with random
- data. Both series use the same axes.
- \br
- \br
- \snippet ../demos/qmlaxes/qml/qmlaxes/View1.qml 1
- \li \inlineimage demos_qmlaxes1.png
- \row
- \li \br
- The next example shows a chart with some accurate historical data that makes us to use a DateTimeAxis.
- \br
- \br
- \snippet ../demos/qmlaxes/qml/qmlaxes/View2.qml 1
- \li \inlineimage demos_qmlaxes2.png
- \row
- \li \br
- And the final example with a chart that uses a CategoryAxis to make the data easier to understand.
- \br
- \br
- \snippet ../demos/qmlaxes/qml/qmlaxes/View3.qml 1
- \li \inlineimage demos_qmlaxes3.png
- \endtable
-*/
diff --git a/doc/src/demos-qmlchart.qdoc b/doc/src/demos-qmlchart.qdoc
deleted file mode 100644
index 77c6635e..00000000
--- a/doc/src/demos-qmlchart.qdoc
+++ /dev/null
@@ -1,118 +0,0 @@
-/*!
- \example demos/qmlchart
- \title Qml charts demo
- \subtitle
-
- This basic demonstration shows how to use the different chart types by using qml. Creating each chart type begins
- with the creation of a ChartView.
-
- \table
- \row
- \li \br
- To create a pie, we use the PieSeries API together with a few PieSlices:
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View1.qml 1
- \li \inlineimage demos_qmlchart1.png
- \endtable
-
- \table
- \row
- \li \br
- To create a chart with a line series:
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View2.qml 1
- \li \inlineimage demos_qmlchart2.png
- \endtable
-
- \table
- \row
- \li \br
- And spline series:
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View3.qml 1
- \li \inlineimage demos_qmlchart3.png
- \endtable
-
- \table
- \row
- \li \br
- Then we create a chart that illustrates the NHL All-Star player selections by using three area series:
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View4.qml 1
- \li \inlineimage demos_qmlchart4.png
- \endtable
-
- \table
- \row
- \li \br
- Then a couple of scatter series:
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View5.qml 1
- \li \inlineimage demos_qmlchart5.png
- \endtable
-
- And a few different bar series:
- \table
- \row
- \li \br
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1
- \li \inlineimage demos_qmlchart6.png
- \endtable
- \table
- \row
- \li \br
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View7.qml 1
- \li \inlineimage demos_qmlchart7.png
- \endtable
- \table
- \row
- \li \br
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1
- \li \inlineimage demos_qmlchart8.png
- \endtable
- \table
- \row
- \li \br
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View9.qml 1
- \li \inlineimage demos_qmlchart9.png
- \endtable
- \table
- \row
- \li \br
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View10.qml 1
- \li \inlineimage demos_qmlchart10.png
- \endtable
- \table
- \row
- \li \br
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View11.qml 1
- \li \inlineimage demos_qmlchart11.png
- \endtable
-
- \table
- \row
- \li \br
- And finally an example demonstrating how to create a donut chart with two pie series:
- \br
- \br
- \snippet ../demos/qmlchart/qml/qmlchart/View12.qml 1
- \li \inlineimage demos_qmlchart12.png
- \endtable
-*/
diff --git a/doc/src/demos-qmlcustomizations.qdoc b/doc/src/demos-qmlcustomizations.qdoc
deleted file mode 100644
index 3efb2fbd..00000000
--- a/doc/src/demos-qmlcustomizations.qdoc
+++ /dev/null
@@ -1,26 +0,0 @@
-/*!
- \example demos/qmlcustomizations
- \title Qml Customizations
- \subtitle
-
- \image demos_qmlcustomizations.png
-
- This application shows you how to customize different visual properties of a ChartView and series. It shows
- a wheel of fortune by customizing a pie series.
-
- First we create the ChartView and a couple of series.
- \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 1
-
- The application data is generated in Component.onCompleted of the main rectangle:
- \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 2
-
- The following customizations are done repeatedly with a timer. To highlight one of the pie slices at time
- we modify its exploded property:
- \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 3
-
- Then an animation using a scatter series with one data point:
- \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 4
-
- When the wheel of fortune has stopped, we make the active slice blink by modifying its colors.
- \snippet ../demos/qmlcustomizations/qml/qmlcustomizations/main.qml 5
-*/
diff --git a/doc/src/demos-qmlcustomlegend.qdoc b/doc/src/demos-qmlcustomlegend.qdoc
deleted file mode 100644
index fe79e371..00000000
--- a/doc/src/demos-qmlcustomlegend.qdoc
+++ /dev/null
@@ -1,40 +0,0 @@
-/*!
- \example demos/qmlcustomlegend
- \title Qml Custom Legend
- \subtitle
-
- This demo application shows you how to create your own custom legend instead of using the
- built-in legend of ChartView API.
-
- \table
- \row
- \li \br
- The main view of the application shows a stacked area chart. This is how one of
- \br
- the stacked areas is created. See ChartViewStacked.qml and AnimatedAreaSeries.qml.
- \br
- \br
- \snippet ../demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml 1
- \li \inlineimage demos-qmlcustomlegend1.png
- \row
- \li \br
- Hovering with mouse on top of the legend will highlight the hovered series.
- \br
- (see CustomLegend.qml).
- \br
- \br
- \snippet ../demos/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml 1
- \snippet ../demos/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml 2
- \snippet ../demos/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml 3
- \li \inlineimage demos-qmlcustomlegend2.png
- \row
- \li \br
- You can also select one of the stacked areas for a closer look as a line series by
- \br
- a mouse click (see ChartViewHighlighted.qml).
- \br
- \br
- \snippet ../demos/qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml 1
- \li \inlineimage demos-qmlcustomlegend3.png
- \endtable
-*/
diff --git a/doc/src/demos-qmlf1legends.qdoc b/doc/src/demos-qmlf1legends.qdoc
deleted file mode 100644
index a0b7f786..00000000
--- a/doc/src/demos-qmlf1legends.qdoc
+++ /dev/null
@@ -1,20 +0,0 @@
-/*!
- \example demos/qmlf1legends
- \title Qml F1 Legends
- \subtitle
-
- \image demos_qmlf1legends.png
-
- This application demonstrates how to use XmlListModel as a datasource for a Chart.
-
- Let's define an empty ChartView first:
- \snippet ../demos/qmlf1legends/qml/qmlf1legends/main.qml 1
-
- Our XmlListModel uses hard-coded test data. In a real application the data source would be a timing system.
- \snippet ../demos/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml 1
- \snippet ../demos/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml 2
- \snippet ../demos/qmlf1legends/qml/qmlf1legends/main.qml 2
-
- The data is parsed with a timer. The line series representing each driver are created on the fly.
- \snippet ../demos/qmlf1legends/qml/qmlf1legends/main.qml 3
-*/
diff --git a/doc/src/demos-qmloscilloscope.qdoc b/doc/src/demos-qmloscilloscope.qdoc
deleted file mode 100644
index be5b2954..00000000
--- a/doc/src/demos-qmloscilloscope.qdoc
+++ /dev/null
@@ -1,37 +0,0 @@
-/*!
- \example demos/qmloscilloscope
- \title Oscilloscope
-
- \image demos_qmloscilloscope.png
-
- The oscilloscope application demonstrates how to use the Qt Charts QML API to implement an
- application with strict performance requirements. The application uses generated data with
- configurable characteristics to mimic a simple oscilloscope user interface. To find out the
- actual screen refresh performance of the application, you can set QML_SHOW_FRAMERATE = 1 to
- your run environment settings to get the framerate shown in the application output console.
- To do so go to Projects - Run - Run environment in Qt Creator and select Add. Then you can
- experiment with the different configurable options of the demo application to find the
- configuration that gives you the best performance in your environment.
-
- Note: You can try if enabling OpenGL improves the performance with the following startup
- parameter:
- \code
- -graphicssystem opengl
- \endcode
-
- The application window is shared by control and scope views:
- \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/main.qml 1
- \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/main.qml 2
-
- ControlView implements the buttons used for configuring. ScopeView uses a ChartView to show
- a chart with two line series:
- \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 1
-
- The data of the line series is updated with a QML timer. In a real life application the
- updating could be triggered with a signal from Qt C++ code.
- \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 2
-
- The oscilloscope also allows you to switch the type of the series used for visualizing the
- signal sources. This is implemented by dynamically destroying and creating series:
- \snippet ../demos/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 3
-*/
diff --git a/doc/src/demos-qmlpolarchart.qdoc b/doc/src/demos-qmlpolarchart.qdoc
deleted file mode 100644
index ffe2105e..00000000
--- a/doc/src/demos-qmlpolarchart.qdoc
+++ /dev/null
@@ -1,33 +0,0 @@
-/*!
- \example demos/qmlpolarchart
- \title Qml Polar Chart
- \subtitle
-
- This is a demonstration on how to use a polar chart in your QML application.
-
- \table
- \row
- \li \br
- We begin with a chart that has a spline series and a scatter series with random
- data. Both series use the same axes.
- \br
- \br
- \snippet ../demos/qmlpolarchart/qml/qmlpolarchart/View1.qml 1
- \li \inlineimage demos_qmlpolarchart1.png
- \row
- \li \br
- The next example shows a chart with some accurate historical data for which we need to use a DateTimeAxis
- and a AreaSeries.
- \br
- \br
- \snippet ../demos/qmlpolarchart/qml/qmlpolarchart/View2.qml 1
- \li \inlineimage demos_qmlpolarchart2.png
- \row
- \li \br
- And the final example with a chart that uses a CategoryAxis to make the data easier to understand.
- \br
- \br
- \snippet ../demos/qmlpolarchart/qml/qmlpolarchart/View3.qml 1
- \li \inlineimage demos_qmlpolarchart3.png
- \endtable
-*/
diff --git a/doc/src/demos-qmlweather.qdoc b/doc/src/demos-qmlweather.qdoc
deleted file mode 100644
index 1f190d0b..00000000
--- a/doc/src/demos-qmlweather.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/*!
- \example demos/qmlweather
- \title Qml Weather
- \subtitle
-
- \image demos_qmlweather.png
-
- This is a basic demonstration showing how to use the different chart types by using qml. By default the
- application uses static test data to mimic a weather forecast. You can also obtain an application
- id from http://www.worldweatheronline.com/ to get access to their weather API. You can then give
- your application id as a parameter to the Qml Weather executable to make it use live data.
-
- For example:
- \code
- bin\qmlweather.exe 1234567890abcdef123456
- \endcode
-
- The demo application uses a ChartView and a some series to visualize weather data:
- \snippet ../demos/qmlweather/qml/qmlweather/main.qml 1
- \snippet ../demos/qmlweather/qml/qmlweather/main.qml 2
-
- To get data with weather forecast data, we make an HTTP GET request to World Weather Online. We
- request the response in JSON data format.
- \snippet ../demos/qmlweather/qml/qmlweather/main.qml 3
-
- The JSON response contains an array of forecast data:
- \snippet ../demos/qmlweather/qml/qmlweather/main.qml 4
-
- That is then used as input data for our series and a ListModel we use as a container for weather
- icon URLs:
- \snippet ../demos/qmlweather/qml/qmlweather/main.qml 5
-*/
diff --git a/doc/src/demos-quick2chart.qdoc b/doc/src/demos-quick2chart.qdoc
deleted file mode 100644
index f441bade..00000000
--- a/doc/src/demos-quick2chart.qdoc
+++ /dev/null
@@ -1,15 +0,0 @@
-/*!
- \example demos/quick2chart
- \title Qt Quick 2 charts demo
- \subtitle
-
- \image demos_qmlchart1.png
-
- This is a reimplementation of \l{Qml charts demo} in Qt Quick 2.
-
- The main difference in qml files is importing the correct version of Qt Quick:
-
- \snippet ../demos/quick2chart/qml/quick2chart/View1.qml 2
-
- Additionally, antialiasing is set with the qml property in Qt Quick 2.
-*/
diff --git a/doc/src/demos-quick2oscilloscope.qdoc b/doc/src/demos-quick2oscilloscope.qdoc
deleted file mode 100644
index 28152589..00000000
--- a/doc/src/demos-quick2oscilloscope.qdoc
+++ /dev/null
@@ -1,16 +0,0 @@
-/*!
- \example demos/quick2oscilloscope
- \title Qt Quick 2 Oscilloscope
-
- \image demos_qmloscilloscope.png
-
- This is a reimplementation of the \l{Oscilloscope} demo in Qt Quick 2.
-
- The main difference in qml files is importing the correct version of Qt Quick:
-
- \snippet ../demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml 3
-
- \note QML_SHOW_FRAMERATE environment variable doesn't work with Qt Quick 2.
- From Qt 5.1.0 on, the QSG_RENDER_TIMING environment variable can be used
- similarly to display rendering time.
-*/
diff --git a/doc/src/examples-areachart.qdoc b/doc/src/examples-areachart.qdoc
deleted file mode 100644
index 02c90853..00000000
--- a/doc/src/examples-areachart.qdoc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*!
- \example examples/areachart
- \title AreaChart Example
- \subtitle
-
- The example shows how to create a simple area chart.
-
- \image examples_areachart.png
-
- To create area charts, we need two QLineSeries instances. They are going to define the upper and lower boundary of the area.
-
- \snippet ../examples/areachart/main.cpp 1
-
- We add data to both series and use the stream operator.
-
- \snippet ../examples/areachart/main.cpp 2
-
- Now we create a QAreaSeries instance using two line series objects. We set the custom gradient fill and width of the outline.
-
- \snippet ../examples/areachart/main.cpp 3
-
- Last we create the QChartView instance, set the title, set anti-aliasing, and add the area series. We also create the default axes and specify the ranges on them.
-
- \snippet ../examples/areachart/main.cpp 4
-
- The chart is ready to be shown.
-
- \snippet ../examples/areachart/main.cpp 5
-
-*/
diff --git a/doc/src/examples-barchart.qdoc b/doc/src/examples-barchart.qdoc
deleted file mode 100644
index 3b020daa..00000000
--- a/doc/src/examples-barchart.qdoc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*!
- \example examples/barchart
- \title BarChart Example
- \subtitle
-
- The example shows how to create a bar chart. BarChart shows the data in sets as separate bars, which are in categories.
-
- \image examples_barchart.png
-
- The barsets are used in the same way in all barcharts.
- To illustrate the difference between various barcharts, we use the same data in the examples.
- Data that the barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data
- to them. The data is appended here with the << operator. Alternatively, the append method could be used.
-
- \snippet ../examples/barchart/main.cpp 1
-
- We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
- First values of each set are grouped together at first category second value to second category and so on.
-
- \snippet ../examples/barchart/main.cpp 2
-
- Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
- setAnimationOptions(QChart::SeriesAnimations)
-
- \snippet ../examples/barchart/main.cpp 3
-
- To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with a list of categories and
- set it to be the x-axis of the chart. The chart takes ownership of axis. For y-axis we use default axis, which is created and scaled to series data
- by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
- override the category axis.
-
- \snippet ../examples/barchart/main.cpp 4
-
- We also want to show the legend. To do that, we get the legend pointer from the chart and set it to visible. We also place the legend to the bottom of the chart by setting its alignment to Qt::AlignBottom.
-
- \snippet ../examples/barchart/main.cpp 5
-
- Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
-
- \snippet ../examples/barchart/main.cpp 6
-
- The chart is ready to be shown. We set the chart to be central widget of the window. We also set the size for the chart window and show it.
-
- \snippet ../examples/barchart/main.cpp 7
-*/
diff --git a/doc/src/examples-barmodelmapper.qdoc b/doc/src/examples-barmodelmapper.qdoc
deleted file mode 100644
index 81c109df..00000000
--- a/doc/src/examples-barmodelmapper.qdoc
+++ /dev/null
@@ -1,57 +0,0 @@
-/*!
- \example examples/barmodelmapper
- \title BarModelMapper example
- \subtitle
-
- This example shows how to use QAbstractItemModel derived model as the data for the bar series.
-
- \image examples_barmodelmapper.png
-
- Let's start by creating an instance of CustomTableModel class.
- The CustomTableModel class is derived from QAbstractTableModel, and it was created for the purpose of this example.
- The constructor of this class populates the model's internal data store with the data required for our chart example.
-
- \snippet ../examples/barmodelmapper/tablewidget.cpp 1
-
- We now have a model with data that we would like to display both on the chart and in a QTableView.
- First, we create QTableView and tell it to use the model as a data source. To have the data presented nicely, the minimum width of the table view is set and its headers resize mode changed to stretch.
-
- \snippet ../examples/barmodelmapper/tablewidget.cpp 2
-
- Now we need a QChart instance to display the same data on the chart.
- We also enable animations. It makes it easier to see how a modification to the model's data affects the chart.
-
- \snippet ../examples/barmodelmapper/tablewidget.cpp 3
-
- The first line of the code below creates new bar series. Variables firstRow and rowCount are used to define a custom model mapping.
- Custom mapping allows to take only part of the data from the model. In this case data from 5 rows starting with the row with the index 3.
- The following three lines create an instance of the QVBarModelMapper class and specify that the data for the bar sets should be taken from the model's columns with indexes from 1 to 4 (inclusive).
- To create a connection between the series and the model we set both of those objects to QVBarModelMapper.
-
- Finally the series is added to the chart.
-
- \snippet ../examples/barmodelmapper/tablewidget.cpp 4
-
- To show in QTableView which data corresponds with which bar set, this example uses table coloring.
- When series is added to the chart, it is assigned a color based on the currently selected theme.
- Code below extracts that color from the series and uses it to create colored QTableView.
- Coloring of the view is not a part of the QChart functionality.
-
- \snippet ../examples/barmodelmapper/tablewidget.cpp 5
-
- We would like to have categories placed on the chart's axis that describe what the data means.
- Next snippet shows how to do that.
-
- \snippet ../examples/barmodelmapper/tablewidget.cpp 6
-
- To avoid setting up the QGraphicsScene we use the QChartView class that does it for us. The QChart object pointer is used as a parameter of the QChartView constructor.
- To make the render look nicer Antialiasing is turned on and the minimum size of the chartView widget is set.
-
- \snippet ../examples/barmodelmapper/tablewidget.cpp 7
-
- Finally, we place both widgets in a layout and use the layout as the application layout.
-
- \snippet ../examples/barmodelmapper/tablewidget.cpp 8
-
- The application is ready. Try modifying the data in the table view and see how it affects the chart.
-*/
diff --git a/doc/src/examples-boxplotchart.qdoc b/doc/src/examples-boxplotchart.qdoc
deleted file mode 100644
index 7bcc362a..00000000
--- a/doc/src/examples-boxplotchart.qdoc
+++ /dev/null
@@ -1,76 +0,0 @@
-/*!
- \example examples/boxplotchart
- \title Box and Whiskers Example
- \subtitle
-
- The example shows how to create a box-and-whiskers chart. It also shows how to read the non-continuous data from a file,
- arrange it and find medians needed for box-and-whiskers plotting.
-
- \image examples_boxplotchart.png
-
- To show the share deviation of two companies we start by creating two QBoxPlotSeries to handle monthly data.
-
- \snippet ../examples/boxplotchart/main.cpp 1
-
- QFile class is used to open a text file where the non-continuous data is kept. The BoxDataReader is an auxiliary class for
- reading the text file and finding the extreme and median values from the data. The BoxDataReader is explained in more detail later.
- The method readBox reads the values and sets them to the QBoxSet item which the method returns for the caller. The returned QBoxSet
- item is added to the series.
-
- \snippet ../examples/boxplotchart/main.cpp 2
-
- In this section a second file is opened for reading the data for the second company.
-
- \snippet ../examples/boxplotchart/main.cpp 3
-
- In this code snippet a new QChart instance is created and previously created series are added to it. The title is also defined and
- animation is set to be SeriesAnimation.
-
- \snippet ../examples/boxplotchart/main.cpp 4
-
- Here we ask the chart to create default axes for our presentation. We also set the range for the vertical axis by querying the pointer
- for the axis from the chart, and then setting the min and max for that axis.
-
- \snippet ../examples/boxplotchart/main.cpp 5
-
- In this section we set the legends to be visible and place them at the bottom of the chart.
-
- \snippet ../examples/boxplotchart/main.cpp 6
-
- Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
-
- \snippet ../examples/boxplotchart/main.cpp 7
-
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
-
- \snippet ../examples/boxplotchart/main.cpp 8
-
- Here the method readBox is explained in detail. Firstly, a line is read from the file and lines starting with # are rejected
- since they are considered as comment lines.
-
- \snippet ../examples/boxplotchart/boxdatareader.cpp 1
-
- In this file the data is arranged as number, space, number, or space. On this snippet the line is split into single number strings which
- are stored on QStringList.
-
- \snippet ../examples/boxplotchart/boxdatareader.cpp 2
-
- The sortedList will hold the numbers in continuous order and in this code segment we show how to do it. First the sortedList is cleared and numbers
- are read from the strList and stored into sortedList in double format. The qSort method arranges the sortedList into continuous order
- starting from the smallest.
-
- \snippet ../examples/boxplotchart/boxdatareader.cpp 3
-
- Below you will find a code sample showing how to select extremes and medians from the continuous data. Firstly a new QBoxSet is created.
- Lower and upper extremes are simple to select; they are just first and last items on the sortedList. For medians we use a helper
- method findMedian which is explained later. For the median from the upper half we need to adjust the begin number if the
- amount of the numbers is even or uneven. The end number for lower half comes naturally from int rounding.
-
- \snippet ../examples/boxplotchart/boxdatareader.cpp 4
-
- Below you will find the code sample for the method findMedian. If the amount of numbers is uneven we select the number from
- the middle. For even amount numbers we take two numbers from the middle and calculate the mean value.
-
- \snippet ../examples/boxplotchart/boxdatareader.cpp 5
-*/
diff --git a/doc/src/examples-customchart.qdoc b/doc/src/examples-customchart.qdoc
deleted file mode 100644
index 47005d79..00000000
--- a/doc/src/examples-customchart.qdoc
+++ /dev/null
@@ -1,26 +0,0 @@
-/*!
- \example examples/customchart
- \title Custom Chart Example
- \subtitle
-
- This example shows how to customize the appearance of the different elements on a chart.
- \image examples_customchart.png
-
- We begin by creating a simple line series and a chart object.
- \snippet ../examples/customchart/main.cpp 1
-
- First we customize the series and the chart's title and background.
- \snippet ../examples/customchart/main.cpp 2
-
- Then we customize the axes.
- \snippet ../examples/customchart/main.cpp 3
-
- Then the axis label values and ranges. Once the axes are ready, we set them to be used by the chart.
- \snippet ../examples/customchart/main.cpp 4
-
- Finally, we create a view containing the chart.
- \snippet ../examples/customchart/main.cpp 5
-
- Now we are ready to show the chart on a main window.
- \snippet ../examples/customchart/main.cpp 6
-*/
diff --git a/doc/src/examples-datetimeaxis.qdoc b/doc/src/examples-datetimeaxis.qdoc
deleted file mode 100644
index 183a2161..00000000
--- a/doc/src/examples-datetimeaxis.qdoc
+++ /dev/null
@@ -1,38 +0,0 @@
-/*!
- \example examples/datetimeaxis
- \title DateTimeAxis Example
- \subtitle
-
- The example shows how to use QLineChart with QDateTimeAxis.
-
- \image examples_datetimeaxis.png
-
- To create line chart, QLineSeries instance is needed. Let's create one.
-
- \snippet ../examples/datetimeaxis/main.cpp 1
-
- On the charts we will present how the number of sun spots changes in time. The data (from the Space Weather Prediction Center) is read from a text file.
- In the snippet below, notice how the QDateTime::toMSecsSinceEpoch method is used to convert the QDateTime object into a number that can be passed to the QLineSeries append method.
-
- \snippet ../examples/datetimeaxis/main.cpp 2
-
- To present the data on the chart we need the QChart instance. We add the series to it, hide the legend, create the default axes and set the title of the chart.
-
- \snippet ../examples/datetimeaxis/main.cpp 3
-
- Since we use QLineSeries, calling createDefaultAxes will create QValueAxis both as X- and Y-axis. To use QDateTimeAxis we need to set it manually to the chart.
- First, the instance of QDateTimeAxis is created, then the number of ticks to be shown is set. The number of sun spots is provided as an average for the month.
- Therefore we don't need the axis labels to contain the information about the time and the day. This is achieved by setting a custom label format.
- Please refer to the QDateTime::toString() method documentation to learn about the available format options.
-
- \snippet ../examples/datetimeaxis/main.cpp 4
-
- Then we create a QChartView object with QChart as a parameter. This way we don't need to create the QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer.
-
- \snippet ../examples/datetimeaxis/main.cpp 5
-
- The chart is ready to be shown.
-
- \snippet ../examples/datetimeaxis/main.cpp 6
-
-*/
diff --git a/doc/src/examples-donutbreakdown.qdoc b/doc/src/examples-donutbreakdown.qdoc
deleted file mode 100644
index a8a35d11..00000000
--- a/doc/src/examples-donutbreakdown.qdoc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*!
- \example examples/donutbreakdown
- \title Donut chart breakdown example
- \subtitle
-
- This example shows how to use create a donut breakdown chart using QPieSeries API.
- \image examples_donutbreakdown.png
-
- Let's start by defining some data for the chart.
-
- \snippet ../examples/donutbreakdown/main.cpp 1
-
- Then we create a chart where we add the data. Note that this is our own chart derived from QChart.
-
- \snippet ../examples/donutbreakdown/main.cpp 2
-
- Our own chart works in such a way that we create a main series in the constructor we create a main series,
- which aggregates the data provided by the breakdown series. This is the piechart in the center.
-
- \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 1
-
- When a breakdown series is added the data is used to create a slice in the main series and the
- breakdown series itself is used to create a segment of a donut positioned so that it is aligned
- with the corresponding slice in the main series.
-
- \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 2
-
- Here's how the start and end angles for the donut segments are calculated.
-
- \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 3
-
- The legend markers are customized to show the breakdown percentage. The markers for the main level slices are hidden.
-
- \snippet ../examples/donutbreakdown/donutbreakdownchart.cpp 4
-
- Instead the main level slices show the percentage on the label.
-
- \snippet ../examples/donutbreakdown/mainslice.cpp 1
- \snippet ../examples/donutbreakdown/mainslice.cpp 2
-
- Now that we have our chart defined, we can finally create a QChartView and show the chart.
-
- \snippet ../examples/donutbreakdown/main.cpp 3
-
-*/
diff --git a/doc/src/examples-donutchart.qdoc b/doc/src/examples-donutchart.qdoc
deleted file mode 100644
index e49103f3..00000000
--- a/doc/src/examples-donutchart.qdoc
+++ /dev/null
@@ -1,8 +0,0 @@
-/*!
- \example examples/donutchart
- \title Donutchart Example
- \subtitle
-
- This example shows how to create a simple donut chart, and do some customizations to a slice.
- \image examples_donutchart.png
-*/
diff --git a/doc/src/examples-horizontalbarchart.qdoc b/doc/src/examples-horizontalbarchart.qdoc
deleted file mode 100644
index ed705c06..00000000
--- a/doc/src/examples-horizontalbarchart.qdoc
+++ /dev/null
@@ -1,48 +0,0 @@
-/*!
- \example examples/horizontalbarchart
- \title HorizontalBarChart Example
- \subtitle
-
- The example shows how to create a horizontal bar chart. QHorizontalBarChart shows the data in sets as separate bars, which are grouped in categories. QHorizontalBarChart works just like
- QBarChart, except that the bars are drawn horizontally on the chart.
-
- \image examples_horizontalbarchart.png
-
- The bar sets are used in the same way in all bar charts.
- To illustrate the difference between various bar charts, we use the same data in all examples.
- Data that bar chart visualizes, is defined by QBarSet instances. Here we create the sets and append data
- to them. The data is appended here with << operator. Alternatively, the append method could also be used.
-
- \snippet ../examples/horizontalbarchart/main.cpp 1
-
- We create the series and append the bar sets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
- The first values of each set are grouped together in the first category; the second values in the second category, and so on.
-
- \snippet ../examples/horizontalbarchart/main.cpp 2
-
- Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
- setAnimationOptions(QChart::SeriesAnimations).
-
- \snippet ../examples/horizontalbarchart/main.cpp 3
-
- To have the categories displayed on axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and
- set it to be the y-axis of the chart. The chart takes ownership of axis. For the x-axis we use the default axis, which is created and scaled to series data
- by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be done before we set the category axis. Otherwise the default axis will
- override the category axis.
-
- \snippet ../examples/horizontalbarchart/main.cpp 4
-
- We also want to show the legend. To do so, we get the legend pointer from chart and set it to visible. We also place the legend to the bottom of the chart by setting its alignment
- to Qt::AlignBottom.
-
- \snippet ../examples/horizontalbarchart/main.cpp 5
-
- Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
-
- \snippet ../examples/horizontalbarchart/main.cpp 6
-
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
-
- \snippet ../examples/horizontalbarchart/main.cpp 7
-*/
diff --git a/doc/src/examples-horizontalpercentbarchart.qdoc b/doc/src/examples-horizontalpercentbarchart.qdoc
deleted file mode 100644
index 73cd6546..00000000
--- a/doc/src/examples-horizontalpercentbarchart.qdoc
+++ /dev/null
@@ -1,54 +0,0 @@
-/*!
- \example examples/horizontalpercentbarchart
- \title HorizontalPercentBarChart Example
- \subtitle
-
- The example shows how to create a simple horizontal percent bar chart. The horizontal percent bar chart shows the data in a set as a percentage of
- all sets per category.
-
- Creating a horizontal percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
- horizontal percent bar chart, we use the QHorizontalPercentBarSeries api instead of QBarSeries. Also, in the
- \l {BarChart Example} {bar chart}, we used a nice numbers algorithm to make the y-axis numbering look better. With
- the percent bar chart there is no need for that, because the maximum y-axis value is always 100.
-
- \image examples_horizontalpercentbarchart.png
-
- The barsets are used in same way in all barcharts.
- To illustrate the difference between various barcharts, we use same data in examples.
- The data which the bar chart visualizes is defined by QBarSet instances. Here we create the sets and append data
- to them. The data is appended here with << operator. Alternatively the append method could be used.
-
- \snippet ../examples/horizontalpercentbarchart/main.cpp 1
-
- We create the series and append the bar sets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
- The first values of each set are grouped together in the first category, the second value in the second category etc.
-
- \snippet ../examples/horizontalpercentbarchart/main.cpp 2
-
- Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
- setAnimationOptions(QChart::SeriesAnimations)
-
- \snippet ../examples/horizontalpercentbarchart/main.cpp 3
-
- To have the categories displayed on an axis, we need to create a QBarCategoryAxis first. Here we create a category axis with a list of categories and
- set it to be the y-axis of the chart. The chart takes ownership of the axis. For the x-axis we use the default axis, which is created and scaled to series data
- by calling createDefaultAxes of the chart. Note that createDefaultAxes must be called before we set the category axis. Otherwise the default axis will
- override the category axis.
-
- \snippet ../examples/horizontalpercentbarchart/main.cpp 4
-
- We also want to show the legend. To do that, we get the legend pointer from the chart
- and set it to visible. We also place the legend to bottom of the chart by setting its
- alignment to Qt::AlignBottom.
-
- \snippet ../examples/horizontalpercentbarchart/main.cpp 5
-
- Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
-
- \snippet ../examples/horizontalpercentbarchart/main.cpp 6
-
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
-
- \snippet ../examples/horizontalpercentbarchart/main.cpp 7
-*/
diff --git a/doc/src/examples-horizontalstackedbarchart.qdoc b/doc/src/examples-horizontalstackedbarchart.qdoc
deleted file mode 100644
index a63c9fa4..00000000
--- a/doc/src/examples-horizontalstackedbarchart.qdoc
+++ /dev/null
@@ -1,51 +0,0 @@
-/*!
- \example examples/horizontalstackedbarchart
- \title HorizontalStackedBarChart Example
- \subtitle
-
- The example shows how to create a simple stacked horizontal bar chart. The stacked bar chart shows the data in sets as bars that are
- stacked on top of each other. The stacking is done per category.
- Creating a stacked horizontal bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
- stacked horizontal bar chart, we use the QHorizontalStackedBarSeries api instead of QBarSeries.
-
- \image examples_horizontalstackedbarchart.png
-
- The bar sets are used in same way in all bar charts.
- To illustrate the difference between various barcharts, we use the same data in all examples.
- The data that barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data
- to them. The data is appended here with the << operator. Alternatively, the append method could also be used.
-
- \snippet ../examples/horizontalstackedbarchart/main.cpp 1
-
- We create the series and append the bar sets to it. The series takes ownership of the bar sets. The series groups the data from sets to categories.
- The first values of each set are grouped together in the first category, the second values in the second category and so on.
-
- \snippet ../examples/horizontalstackedbarchart/main.cpp 2
-
- Here we create the chart object and add the series to it. We set the title for the chart with setTitle, and then turn on the animations of the series by calling
- setAnimationOptions(QChart::SeriesAnimations).
-
- \snippet ../examples/horizontalstackedbarchart/main.cpp 3
-
- To have categories displayed on an axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and
- set it to be the y-axis of the chart. The chart takes ownership of the axis. For the x-axis we use the default axis, which is created and scaled to series data
- by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
- override the category axis.
-
- \snippet ../examples/horizontalstackedbarchart/main.cpp 4
-
- We also want to show the legend. To do that, we get the legend pointer from the chart and
- set it to visible. We also place the legend to the bottom of the chart by setting its alignment
- to Qt::AlignBottom.
-
- \snippet ../examples/horizontalstackedbarchart/main.cpp 5
-
- Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
-
- \snippet ../examples/horizontalstackedbarchart/main.cpp 6
-
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
-
- \snippet ../examples/horizontalstackedbarchart/main.cpp 7
-*/
diff --git a/doc/src/examples-legend.qdoc b/doc/src/examples-legend.qdoc
deleted file mode 100644
index cbefa1f3..00000000
--- a/doc/src/examples-legend.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/*!
- \example examples/legend
- \title Legend Example
- \subtitle
-
- This example shows how to detach the legend from the chart and how to attach it back. By default the chart
- draws the legend inside the same view with the chart. In some cases the user may want to draw the legend to somewhere else. To make this possible the legend can be detached from the chart. Detaching means that the chart doesn't draw the legend or try to change its layout. Detached legend can then be drawn wherever the user wishes, for example, in a different graphics scene. The behavior of the legend can be inspected by running the legend example.
- In the example we use the bar series where we add or remove the bar sets. The legend reflects the changes in series. The legend can be detached or attached back to the chart and its alignment can be modified.
- When the legend is detached, it can be resized and positioned freely.
-
- \table
- \row
- \li \inlineimage examples_legend_detach.png
- \li \inlineimage examples_legend_detach2.png
- \endtable
-
- Here we turn the legend visible and set its alignment to the bottom of the chart.
-
- \snippet ../examples/legend/mainwidget.cpp 1
-
- This snippet shows how to detach the legend from the chart. After detaching, we turn its background to visible and set a different color to it. This makes it easier to see how the items inside the legend are arranged in detached mode.
-
- \snippet ../examples/legend/mainwidget.cpp 2
-
- Here we attach the legend back to the chart. The background is turned invisible.
-
- \snippet ../examples/legend/mainwidget.cpp 3
-
- This shows how we set the detached legend dimensions. After setting the new values, we call update to show changes on screen.
-
- \snippet ../examples/legend/mainwidget.cpp 4
-*/
diff --git a/doc/src/examples-legendmarkers.qdoc b/doc/src/examples-legendmarkers.qdoc
deleted file mode 100644
index 7dc85f11..00000000
--- a/doc/src/examples-legendmarkers.qdoc
+++ /dev/null
@@ -1,41 +0,0 @@
-/*!
- \example examples/legendmarkers
- \title LegendMarkers Example
- \subtitle
-
- The example shows how to make use of legend markers. In this example we create an application which uses the QLegendMarker clicked signal to show/hide the corresponding series
- in a chart. The connect marker button connects a clicked signal from all markers in a legend to the handleMarkerClicked slot.
-
- \image examples_legendmarkers.png
-
- Our application has buttons for adding or removing a series in a chart and a button to connect or disconnect the legend markers clicked signal to our handler.
- In the image above we have connected the markers and clicked on one of them.
-
- \snippet ../examples/legendmarkers/mainwidget.cpp 1
-
- Here we connect the markers in the legend to our handler. To avoid connecting the same marker more than once, we first disconnect it.
-
- \snippet ../examples/legendmarkers/mainwidget.cpp 2
-
- Here we disconnect all markers from our handler.
-
- \snippet ../examples/legendmarkers/mainwidget.cpp 3
-
- In our handler we first cast the sender of the event to the QLegendMarker.
-
- \snippet ../examples/legendmarkers/mainwidget.cpp 4
-
- Then we check the type of the marker. This is required if we want to access the detailed methods of the marker and cast it to the correct type.
- If all we need is the pointer to QAbstractSeries, the casting isn't necessary. In case of a pie or bar series, we may need the pointer to a related QPieSlice or QBarSet.
-
- \snippet ../examples/legendmarkers/mainwidget.cpp 5
-
- We want to toggle the visibility of the series, when the marker is clicked. To do so, we get the pointer to a related series from the marker and toggle its visibility.
- Since the legend marker follows the visibility of the series by default, we also set the marked back to visible. If we don't do so, the marker will be
- invisible in the legend and we can't click on it anymore.
-
- \snippet ../examples/legendmarkers/mainwidget.cpp 6
-
- Instead of making the marker invisible when the series is hidden, we dim the color of the marker. Here we do it by modifying the color of the laberBrush.
-
-*/
diff --git a/doc/src/examples-lineandbarchart.qdoc b/doc/src/examples-lineandbarchart.qdoc
deleted file mode 100644
index 3ef6615f..00000000
--- a/doc/src/examples-lineandbarchart.qdoc
+++ /dev/null
@@ -1,46 +0,0 @@
-/*!
- \example examples/lineandbar
- \title Line and BarChart Example
- \subtitle
-
- The example shows how to combine different charts and set the axes. In the example we combine a linechart with
- a barchart and use the category axis as a common axis for both.
-
- \image examples_lineandbar.png
-
- Here we create data for our bar series.
-
- \snippet ../examples/lineandbar/main.cpp 1
-
- We create a bar series and append sets to it.
- The first values of each set are grouped together in the first category, the second values in the second category and so on.
-
- \snippet ../examples/lineandbar/main.cpp 2
-
- Then we create a line series and add data to it. To make the data match with the barchart, we use the index as an x-value for our line series, so that
- first point is at (0,value) second at (1,value) and so on.
-
- \snippet ../examples/lineandbar/main.cpp 8
-
- Here we create the chart and add both series to it.
-
- \snippet ../examples/lineandbar/main.cpp 3
-
- To make the chart show the series properly, we have to create custom axes for the series. If we don't create custom axes, then each series will get scaled to
- use the maximum area of the chart (like in single series case) and the result will be incorrect. With custom axes we set the range of both series to follow the
- same axis. For the x-axis we use the QBarCategoryAxis and for the y-axis we use QValuesAxis.
-
- \snippet ../examples/lineandbar/main.cpp 4
-
- And we also want to show the legend.
-
- \snippet ../examples/lineandbar/main.cpp 5
-
- Finally we add the chart onto a view.
-
- \snippet ../examples/lineandbar/main.cpp 6
-
- Now it is ready to be shown in a window.
-
- \snippet ../examples/lineandbar/main.cpp 7
-*/
diff --git a/doc/src/examples-linechart.qdoc b/doc/src/examples-linechart.qdoc
deleted file mode 100644
index a1262953..00000000
--- a/doc/src/examples-linechart.qdoc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*!
- \example examples/linechart
- \title LineChart Example
- \subtitle
-
- The example shows how to create a simple line chart.
-
- \image examples_linechart.png
-
- To create a line chart, a QLineSeries instance is needed. Let's create one.
-
- \snippet ../examples/linechart/main.cpp 1
-
- Then we add data to the series. We can use the append() member function or use the stream operator.
-
- \snippet ../examples/linechart/main.cpp 2
-
- To present the data on the chart we need a QChart instance. We add the series to it, create the default axes, and set the title of the chart.
-
- \snippet ../examples/linechart/main.cpp 3
-
- Then we create a QChartView object with QChart as a parameter. This way we don't need to create a QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer.
-
- \snippet ../examples/linechart/main.cpp 4
-
- The chart is ready to be shown.
-
- \snippet ../examples/linechart/main.cpp 5
-
-*/
diff --git a/doc/src/examples-logvalueaxis.qdoc b/doc/src/examples-logvalueaxis.qdoc
deleted file mode 100644
index 82e6a037..00000000
--- a/doc/src/examples-logvalueaxis.qdoc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*!
- \example examples/logvalueaxis
- \title Logarithmic Axis Example
- \subtitle
-
- The example shows how to use QLogValueAxis.
-
- \image examples_logvalueaxis.png
-
- Create a QLineSeries instance and add some data to it.
-
- \snippet ../examples/logvalueaxis/main.cpp 1
-
- To present the data on the chart we need a QChart instance. Add the series to it, hide the legend and set the title of the chart.
-
- \snippet ../examples/logvalueaxis/main.cpp 2
-
- Create the axes. Add them to the chart and attach to the series.
-
- \snippet ../examples/logvalueaxis/main.cpp 3
-
- Then create a QChartView object with QChart as a parameter. Enable antialiasing to have the rendered line look nicer.
-
- \snippet ../examples/logvalueaxis/main.cpp 4
-
- The chart is ready to be shown.
-
- \snippet ../examples/logvalueaxis/main.cpp 5
-
-*/
diff --git a/doc/src/examples-modeldata.qdoc b/doc/src/examples-modeldata.qdoc
deleted file mode 100644
index e8f66558..00000000
--- a/doc/src/examples-modeldata.qdoc
+++ /dev/null
@@ -1,58 +0,0 @@
-/*!
- \example examples/modeldata
- \title Model Data Example
- \subtitle
-
- This example shows how to use the QAbstractItemModel derived model as the data for the series.
-
- \image examples_modeldata.png
-
- Let's start by creating an instance of the CustomTableModel class.
- The CustomTableModel class is derived from QAbstractTableModel and it was created for the purpose of this example.
- The constructor of this class populates the internal data store of the model with the data that is suitable for our chart example.
-
- \snippet ../examples/modeldata/tablewidget.cpp 1
-
- We now have a model with data that we would like to display both on the chart and in a QTableView.
- First, we create QTableView and tell it to use the model as a data source. To make the data cells fill the table view we also change headers resize mode.
-
- \snippet ../examples/modeldata/tablewidget.cpp 2
-
- Now we need the QChart instance to display the same data on the chart.
- We also enable animations. It makes it easier to see how modifying the model's data affect the chart.
-
- \snippet ../examples/modeldata/tablewidget.cpp 3
-
- The code below creates new line series and gives it a name. The following line creates an instance of QVXYModelMapper class.
- The next two lines specify that X-coordinates are taken from the model's column(Qt::Vertical) with index 0. The Y-coordinates are taken from the model's column with index 1.
- To create a connection between the series and the model we set both of those objects to QVXYModelMapper.
-
- Finally, the series is added to the chart.
-
- \snippet ../examples/modeldata/tablewidget.cpp 4
-
- To show in QTableView which data corresponds with which series this example uses table coloring.
- When a series is added to the chart it is assigned a color based on the currently selected theme.
- The code below extracts that color from the series and uses it to create a colored QTableView.
- The coloring of the view is not a part of the QChart functionality.
-
- \snippet ../examples/modeldata/tablewidget.cpp 5
-
- The same operations are done with a second series. Notice that for this series different columns of the same model are mapped.
-
- \snippet ../examples/modeldata/tablewidget.cpp 6
-
- \snippet ../examples/modeldata/tablewidget.cpp 7
-
- To avoid setting up the QGraphicsScene we use the QChartView class that does it for us.
- QChart object pointer is used as a parameter of the QChartView constructor.
- To make the chart look nicer, Antialiasing is turned on and the minimum size of the chartView widget is set.
-
- \snippet ../examples/modeldata/tablewidget.cpp 8
-
- Finally we place both widgets in a layout and use the layout as the application layout.
-
- \snippet ../examples/modeldata/tablewidget.cpp 9
-
- The application is ready. Try modifying the data in the table view and see how it affects the chart.
-*/
diff --git a/doc/src/examples-multiaxis.qdoc b/doc/src/examples-multiaxis.qdoc
deleted file mode 100644
index 4407c90c..00000000
--- a/doc/src/examples-multiaxis.qdoc
+++ /dev/null
@@ -1,36 +0,0 @@
-/*!
- \example examples/multiaxis
- \title Multiple Axes Example
- \subtitle
-
- The example shows how to create a simple chart with two vertical axes. One for each series.
-
- \image examples_multiaxis.png
-
- Create the QChart instance, hide the legend of the chart, and set its title.
-
- \snippet ../examples/multiaxis/main.cpp 1
-
- Create a QValueAxis instance that will be used as a horizontal axis by both series and add it the bottom of the chart.
- The axis can be shared between many series, but each series can have only one vertical and horizontal axis.
-
- \snippet ../examples/multiaxis/main.cpp 2
-
- Create the first series, and add the data to it. Finally, add the series to the chart. Instantiate its own Y-axis, add it to the chart. Then attach both the common X-axis and the series specific Y-axis.
- In this example the color of the axis line is set to be the same as the color of the series to make it possible to distinguish which axis is attached to which series.
-
- \snippet ../examples/multiaxis/main.cpp 3
-
- Similarly prepare another series. This time a different axis type is used. Additionally grid lines color is also set to be the same as the color of the series.
-
- \snippet ../examples/multiaxis/main.cpp 4
-
- Create a QChartView object with QChart as a parameter. Enable Antialiasing to have the rendered splines look nicer.
-
- \snippet ../examples/multiaxis/main.cpp 5
-
- The chart is ready to be shown.
-
- \snippet ../examples/multiaxis/main.cpp 6
-
-*/
diff --git a/doc/src/examples-percentbarchart.qdoc b/doc/src/examples-percentbarchart.qdoc
deleted file mode 100644
index 2b64f820..00000000
--- a/doc/src/examples-percentbarchart.qdoc
+++ /dev/null
@@ -1,53 +0,0 @@
-/*!
- \example examples/percentbarchart
- \title PercentBarChart Example
- \subtitle
-
- The example shows how to create a simple percent bar chart. A percent bar chart shows the data in sets as a percentage of
- all sets per category.
-
- Creating percent bar charts is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
- percent bar charts, we use the QPercentBarSeries api instead of QBarSeries. Also, in the
- \l {BarChart Example} {bar chart} we used the nice numbers algorithm to make the y-axis numbering look better. With
- the percent bar chart there is no need for that, because the maximum y-axis value is always 100.
-
- \image examples_percentbarchart.png
-
- The barsets are used in same way in all barcharts.
- To illustrate the difference between various barcharts, we use the same data in all examples.
- The data visualized by the bar chart is defined by QBarSet instances. Here we create the sets and append data
- to them. The data is appended here with the << operator. Alternatively the append method could be used.
-
- \snippet ../examples/percentbarchart/main.cpp 1
-
- We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
- The first values of each set are grouped together in the first category, the second values in the second category etc.
-
- \snippet ../examples/percentbarchart/main.cpp 2
-
- Here we create the chart object and add the series to it. We set the title of the chart with setTitle, and then turn on animations of the series by calling
- setAnimationOptions(QChart::SeriesAnimations)
-
- \snippet ../examples/percentbarchart/main.cpp 3
-
- To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with a list of categories and
- set it to be the x-axis of the chart. The chart takes ownership of the axis. For the y-axis we use the default axis, which is created and scaled
- to series data by calling createDefaultAxes of the chart. Note that createDefaultAxes must be called before we set the category axis.
- Otherwise the default axis will override the category axis.
-
- \snippet ../examples/percentbarchart/main.cpp 4
-
- We also want to show the legend. To do so, we get the legend pointer from the chart and set it to visible. We also place the legend to bottom of
- the chart by setting its alignment to Qt::AlignBottom.
-
- \snippet ../examples/percentbarchart/main.cpp 5
-
- Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
-
- \snippet ../examples/percentbarchart/main.cpp 6
-
- The chart is ready to be shown. We set the chart to be central widget of the window.
- We also set the size for the chart window and show it.
-
- \snippet ../examples/percentbarchart/main.cpp 7
-*/
diff --git a/doc/src/examples-piechart.qdoc b/doc/src/examples-piechart.qdoc
deleted file mode 100644
index c0b1ee61..00000000
--- a/doc/src/examples-piechart.qdoc
+++ /dev/null
@@ -1,8 +0,0 @@
-/*!
- \example examples/piechart
- \title Piechart Example
- \subtitle
-
- The example shows how to create a simple pie chart and do some customizations to a pie slice.
- \image examples_piechart.png
-*/
diff --git a/doc/src/examples-piechartdrilldown.qdoc b/doc/src/examples-piechartdrilldown.qdoc
deleted file mode 100644
index 33391879..00000000
--- a/doc/src/examples-piechartdrilldown.qdoc
+++ /dev/null
@@ -1,9 +0,0 @@
-/*!
- \example examples/piechartdrilldown
- \title Piechart Drilldown Example
- \subtitle
-
- The example shows how to implement a piechart with drilldown effect.
- \image examples_piechartdrill1.png
- \image examples_piechartdrill2.png
-*/
diff --git a/doc/src/examples-polarchart.qdoc b/doc/src/examples-polarchart.qdoc
deleted file mode 100644
index ddda8e7b..00000000
--- a/doc/src/examples-polarchart.qdoc
+++ /dev/null
@@ -1,33 +0,0 @@
-/*!
- \example examples/polarchart
- \title Polar Chart Example
- \subtitle
-
- The example shows how to create a simple polar chart with multiple different series.
- It also shows how to implement scrolling and zooming of the polar chart as well as
- visually demonstrate how polar charts and cartesian charts relate to each other.
-
- \image examples_polarchart.png
-
- Creating a polar chart is done with a QPolarChart instance instead of a QChart instance.
-
- \snippet ../examples/polarchart/main.cpp 1
-
- Axes are created similarly to cartesian charts, but when axes are added to the chart,
- you can use polar orientations instead of alignments.
-
- \snippet ../examples/polarchart/main.cpp 2
-
- Zooming and scrolling of a polar chart is logically nearly identical to zooming and scrolling of a cartesian chart.
- The main difference is that when scrolling along the X-axis (angular axis), the angle is used instead of the number of pixels.
- Another difference is that zooming to a rectangle cannot be done.
-
- \snippet ../examples/polarchart/chartview.cpp 1
-
- The same axes and series can be used in both cartesian and polar charts, though not simultaneously.
- To switch between chart types, you first need to remove the series and axes from the old chart, and then add
- them to the new chart. If you want to preserve the axis ranges, those need to be copied, too.
-
- \snippet ../examples/polarchart/chartview.cpp 2
-
-*/
diff --git a/doc/src/examples-scatterchart.qdoc b/doc/src/examples-scatterchart.qdoc
deleted file mode 100644
index 2199d5a3..00000000
--- a/doc/src/examples-scatterchart.qdoc
+++ /dev/null
@@ -1,39 +0,0 @@
-/*!
- \example examples/scatterchart
- \title ScatterChart Example
- \subtitle
-
- The example shows how to create a simple scatter chart.
-
- \image examples_scatterchart.png
-
- To create scatter charts, a QScatterSeries instance is needed. Here we create a scatter series
- instance, and set the type and width of outline for the scatter points.
-
- \snippet ../examples/scatterchart/chartview.cpp 1
-
- We add the data to be shown. We can use the append() member function or use the stream operator.
-
- \snippet ../examples/scatterchart/chartview.cpp 2
-
- We can define the brush of the scatter series to be an image. Here the image is a star created
- using QPainterPath.
-
- \snippet ../examples/scatterchart/chartview.cpp 3
-
- In the end we enable anti-aliasing, set the chart title, and add the scatter series onto the
- chart. We also disable drop shadow, because it would not look good on an application with only
- chart view shown.
-
- \snippet ../examples/scatterchart/chartview.cpp 4
-
- The image used as a brush for the scatter series may contain several colors. Therefore we need
- to set the desired color explicitly by setting the brush for the legend marker items.
-
- \snippet ../examples/scatterchart/chartview.cpp 5
-
- The chart is ready to be shown.
-
- \snippet ../examples/scatterchart/main.cpp 4
-
-*/
diff --git a/doc/src/examples-scatterinteractions.qdoc b/doc/src/examples-scatterinteractions.qdoc
deleted file mode 100644
index 12625e34..00000000
--- a/doc/src/examples-scatterinteractions.qdoc
+++ /dev/null
@@ -1,9 +0,0 @@
-/*!
- \example examples/scatterinteractions
- \title ScatterInteractions Example
- \subtitle
-
- This example shows how to create a simple scatter chart and how to interact with the chart.
-
- \image examples_scatterinteractions.png
-*/
diff --git a/doc/src/examples-splinechart.qdoc b/doc/src/examples-splinechart.qdoc
deleted file mode 100644
index c5308b91..00000000
--- a/doc/src/examples-splinechart.qdoc
+++ /dev/null
@@ -1,29 +0,0 @@
-/*!
- \example examples/splinechart
- \title SplineChart Example
- \subtitle
-
- The example shows how to create a simple spline chart.
-
- \image examples_splinechart.png
-
- To create spline charts we need to put our data into QSplineSeries. QSplineSeries automatically calculates spline segment control points that are needed to properly draw the spline.
-
- \snippet ../examples/splinechart/main.cpp 1
-
-Now let's add some data points to the series.
-
- \snippet ../examples/splinechart/main.cpp 2
-
-The data series has been populated. To display it on a chart we create a QChart object and add the data series to it. We also set the title and the values range on the y-axis, so that our chart's visibility is better.
-
- \snippet ../examples/splinechart/main.cpp 3
-
-Then we create a QChartView object with QChart as a parameter. This way we don't need to create a QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer.
-
- \snippet ../examples/splinechart/main.cpp 4
-
- Finally, we set the QChartView as the windows's central widget.
-
- \snippet ../examples/splinechart/main.cpp 5
-*/
diff --git a/doc/src/examples-stackedbarchart.qdoc b/doc/src/examples-stackedbarchart.qdoc
deleted file mode 100644
index 7375b43a..00000000
--- a/doc/src/examples-stackedbarchart.qdoc
+++ /dev/null
@@ -1,51 +0,0 @@
-/*!
- \example examples/stackedbarchart
- \title StackedBarChart Example
- \subtitle
-
- The example shows how to create a simple stacked bar chart. The stacked bar chart shows the data in sets as bars
- stacked on top of each other. The stacking is done per category.
- The example shows how to create a simple stacked bar chart. Stacked bar chart shows the data in sets as bars that are
- stacked on top of each other. The stacking is done per category.
- Creating a stacked bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
- stacked bar chart, we use the QStackedBarSeries api instead of QBarSeries.
-
- \image examples_stackedbarchart.png
-
- The barsets are used in same way in all barcharts.
- To illustrate the difference between various barcharts, we use same data in all examples.
- Data, which the barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data
- to them. The data is appended here with << operator. Alternatively the append method could be used.
-
- \snippet ../examples/stackedbarchart/main.cpp 1
-
- We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
- The first values of each set are grouped together in the first category, the second values in the second category etc.
-
- \snippet ../examples/stackedbarchart/main.cpp 2
-
- Here we create the chart object and add the series to it. We set the title for the chart with setTitle, and then turn on animations of the series by calling
- setAnimationOptions(QChart::SeriesAnimations).
-
- \snippet ../examples/stackedbarchart/main.cpp 3
-
- To have categories displayed on the axis, we need to create a QBarCategoryAxis. Here we create a category axis with list of categories and
- set it to be the x-axis of the chart. The chart takes ownership of the axis. For the y-axis we use default axis, which is created and scaled to series data
- by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
- override the category axis.
-
- \snippet ../examples/stackedbarchart/main.cpp 4
-
- We also want to show the legend. To do so, we get the legend pointer from the chart and set it to visible. We also place the legend to the bottom of the chart by setting its alignment to Qt::AlignBottom.
-
- \snippet ../examples/stackedbarchart/main.cpp 5
-
- Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
-
- \snippet ../examples/stackedbarchart/main.cpp 6
-
- The chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
-
- \snippet ../examples/stackedbarchart/main.cpp 7
-*/
diff --git a/doc/src/examples-stackedbarchartdrilldown.qdoc b/doc/src/examples-stackedbarchartdrilldown.qdoc
deleted file mode 100644
index f9a5dea9..00000000
--- a/doc/src/examples-stackedbarchartdrilldown.qdoc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*!
- \example examples/stackedbarchartdrilldown
- \title StackedBarChart Drilldown Example
- \subtitle
-
- The example shows how to implement drilldown using a stacked barchart. In thedrilldown example we create a stacked bar chart, which shows the harvest of various chili peppers during season. In season view the harvest is grouped by month. To drill down to weekly view, right-click the selected month. On weekly view, the harvest of the month clicked is shown by week.
-
- The season view looks like this:
- \image examples_stackedbarchartdrilldown1.png
-
- Clicking on a month shows that month's harvest:
- \image examples_stackedbarchartdrilldown2.png
-
- First we define a drilldown series class, which adds categories to the stacked bar series and mapping for categories to other drilldown series.
- The purpose of the drilldown series is to contain knowledge of the drilldown structure. The mapDrilldownSeries function maps the category to a given series. We can request the mapping for a category with the drilldownSeries(int category) function.
-
- \snippet ../examples/stackedbarchartdrilldown/drilldownseries.h 1
-
- Next we define our own drilldown chart, which implements the handler for the mouse click. All QBarSeries derived classes send out the clicked(QBarSet*, int) signal when a series is clicked with the mouse. The parameter QBarSet contains the pointer to the clicked bar set and parameter int contains the index of the clicked category.
-
- \snippet ../examples/stackedbarchartdrilldown/drilldownchart.h 1
-
- Now we have our drilldown classes and we can start using them.
- First create the chart.
-
- \snippet ../examples/stackedbarchartdrilldown/main.cpp 1
-
- We define the categories from which the drilldown series will be constructed.
-
- \snippet ../examples/stackedbarchartdrilldown/main.cpp 2
-
- To create the drilldown structure, we first create our top level series, which we call seasonSeries. For each month in seasonSeries we create a drilldown series called weeklySeries which contains more detailed data for that month.
- In weeklySeries, we use the drilldown handler to bring us back to seasonSeries. To do so we add mapping to the series. The seasonSeries is mapped to weeklySeries for each month. Every weeklySeries is mapped back to the seasonSeries.
- To make mapping work, we connect the clicked signals from our series to the drilldownChart.
-
- \snippet ../examples/stackedbarchartdrilldown/main.cpp 3
-
- When we have our drilldown structure ready, we can add the data to it. Here we generate a random crop for each plant in each week. The monthly crop is calculated from weekly crops and is set as value to the monthly series.
-
- \snippet ../examples/stackedbarchartdrilldown/main.cpp 4
-
- Here we set the chart to show the top level series initially.
-
- \snippet ../examples/stackedbarchartdrilldown/main.cpp 5
-*/
diff --git a/doc/src/examples-temperaturerecords.qdoc b/doc/src/examples-temperaturerecords.qdoc
deleted file mode 100644
index 50422d56..00000000
--- a/doc/src/examples-temperaturerecords.qdoc
+++ /dev/null
@@ -1,44 +0,0 @@
-/*!
- \example examples/temperaturerecords
- \title Temperature records example
- \subtitle
-
- The example shows how to create a bar chart with negative bars. For our example we use temperature data.
-
- \image examples_temperaturerecords.png
-
- First we create two barsets and append the data to them. One set represents the minimum temperatures and another the maximum temperatures.
-
- \snippet ../examples/temperaturerecords/main.cpp 1
-
- We create the series and append the barsets to it. The series takes ownership of the barsets.
-
- \snippet ../examples/temperaturerecords/main.cpp 2
-
- Here we create the chart object and add the series to it. We set the title for the chart with setTitle, and then turn on animations of the series by calling
- setAnimationOptions(QChart::SeriesAnimations)
-
- \snippet ../examples/temperaturerecords/main.cpp 3
-
- To have categories displayed on an axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and
- set it to be the x-axis of the chart. The chart takes ownership of the axis. For y-axis we use the default axis, which is created and scaled to the series data
- by calling createDefaultAxes of the chart. We change the range for the y-axis, since this gives nicer result than with autoscaling.
-
- Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will override the category axis.
-
- \snippet ../examples/temperaturerecords/main.cpp 4
-
- We also want to show the legend. To do so, we get the legend pointer from the chart and set it to visible. We also place the legend to the bottom
- of the chart by setting its alignment to Qt::AlignBottom.
-
- \snippet ../examples/temperaturerecords/main.cpp 5
-
- Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
-
- \snippet ../examples/temperaturerecords/main.cpp 6
-
- Chart is ready to be shown. We set the chart to be the central widget of the window.
- We also set the size for the chart window and show it.
-
- \snippet ../examples/temperaturerecords/main.cpp 7
-*/
diff --git a/doc/src/examples-zoomlinechart.qdoc b/doc/src/examples-zoomlinechart.qdoc
deleted file mode 100644
index 1bdf2f73..00000000
--- a/doc/src/examples-zoomlinechart.qdoc
+++ /dev/null
@@ -1,31 +0,0 @@
-/*!
- \example examples/zoomlinechart
- \title Zoom Line Example
- \subtitle
-
- The example shows how to create your own custom zooming effect with QRubberBand by using a mouse
- and how to use touch gestures for paning and zooming.
- \image examples_zoomlinechart1.png
- \image examples_zoomlinechart2.png
-
- Let's first create a line series with some example data.
- \snippet ../examples/zoomlinechart/main.cpp 1
-
- Then we create a custom chart view by deriving from QChartView:
- \snippet ../examples/zoomlinechart/chartview.h 1
-
- We override mouse and key event handling
- \snippet ../examples/zoomlinechart/chartview.h 2
-
- Then we implement a custom logic for mouse and key events. For example pressing the '+' key will zoom in and pressing
- the '-' key will zoom out.
- \snippet ../examples/zoomlinechart/chartview.cpp 1
-
- We also create our own QChart:
- \snippet ../examples/zoomlinechart/chart.h 1
-
- Where we can handle the gestures:
- \snippet ../examples/zoomlinechart/chart.cpp 1
-
- Note that you will need to call grabGesture() to both QMainWindow and QChart.
-*/
diff --git a/doc/src/gettingstarted.qdoc b/doc/src/gettingstarted.qdoc
deleted file mode 100644
index 7de708d7..00000000
--- a/doc/src/gettingstarted.qdoc
+++ /dev/null
@@ -1,73 +0,0 @@
-/*!
- \page gettingstarted.html
- \title Qt Charts Getting Started
- \keyword Introduction
-
- Compiling:
- \code
- qmake CONFIG+=release
- make
- make install
- \endcode
-
- Depending on the OS and the compiler you are using, "make" might need to be replaced with another command like: nmake, mingw32-make, etc.
-
- To uninstall the Qt Charts run:
- \code
- make uninstall
- \endcode
-
- Compiling as a static library (lib only):
- \code
- qmake CONFIG+=staticlib
- make
- make install
- \endcode
-
- Building both debug and release at the same time:
- \code
- qmake CONFIG+="debug_and_release build_all"
- make
- make install
- \endcode
-
- Please note that the \e build_all option is necessary for the install to work correctly. Otherwise it will not install both versions.
-
- Building without demos and examples:
- \code
- qmake CONFIG+=nomake_demos_examples
- make
- make install
- \endcode
-
- \b {New project}
-
- Create a new project in a usual way and then add to your project's *.pro file following line:
-
- \code
- CONFIG += qtcommercialchart
- \endcode
-
- \b {Widget project}
-
- To use the Qt Charts classes add Qt Charts namespace macro in your header file.
- \code
- #include<QWidget>
- #include<QChartView>
-
- QTCOMMERCIALCHART_USE_NAMESPACE
-
- class ExampleWidget : public QWidget
- \endcode
-
- \b {QML project}
-
- Add an import line to your *.qml file:
- \code
- import QtCommercial.Chart 1.4
- \endcode
-
- \raw HTML
- \endraw
-
-*/
diff --git a/doc/src/hbarmodelmapper.qdocinc b/doc/src/hbarmodelmapper.qdocinc
deleted file mode 100644
index f4e7dcb6..00000000
--- a/doc/src/hbarmodelmapper.qdocinc
+++ /dev/null
@@ -1,17 +0,0 @@
-HBarModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as a data source
-for any bar series. It is possible to use both QAbstractItemModel and bar series data API to manipulate data.
-HBarModelMapper keeps the series and the model in sync.
-
-The following QML example would create a bar series with three bar sets (assuming the model has
-at least four rows). Each bar set would contain data starting from column 1. The name of a set would be defined by
-the vertical header (of the row).
-\code
- BarSeries {
- HBarModelMapper {
- model: myCustomModel // QAbstractItemModel derived implementation
- firstBarSetRow: 1
- lastBarSetRow: 3
- firstColumn: 1
- }
- }
-\endcode
diff --git a/doc/src/horizontalbarseries.qdocinc b/doc/src/horizontalbarseries.qdocinc
deleted file mode 100644
index 6c04915f..00000000
--- a/doc/src/horizontalbarseries.qdocinc
+++ /dev/null
@@ -1,8 +0,0 @@
-\inherits AbstractBarSeries
-
-The following QML shows how to create a simple horizontal bar chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View9.qml 1
-\beginfloatleft
-\image demos_qmlchart9.png
-\endfloat
-\clearfloat
diff --git a/doc/src/horizontalpercentbarseries.qdocinc b/doc/src/horizontalpercentbarseries.qdocinc
deleted file mode 100644
index 922b0bda..00000000
--- a/doc/src/horizontalpercentbarseries.qdocinc
+++ /dev/null
@@ -1,8 +0,0 @@
-\inherits AbstractBarSeries
-
-The following QML shows how to create a simple horizontal percent bar chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View11.qml 1
-\beginfloatleft
-\image demos_qmlchart11.png
-\endfloat
-\clearfloat
diff --git a/doc/src/horizontalstackedbarseries.qdocinc b/doc/src/horizontalstackedbarseries.qdocinc
deleted file mode 100644
index d7665e20..00000000
--- a/doc/src/horizontalstackedbarseries.qdocinc
+++ /dev/null
@@ -1,8 +0,0 @@
-\inherits AbstractBarSeries
-
-The following QML shows how to create a simple horizontal stacked bar chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View10.qml 1
-\beginfloatleft
-\image demos_qmlchart10.png
-\endfloat
-\clearfloat
diff --git a/doc/src/hpiemodelmapper.qdocinc b/doc/src/hpiemodelmapper.qdocinc
deleted file mode 100644
index 3320bb99..00000000
--- a/doc/src/hpiemodelmapper.qdocinc
+++ /dev/null
@@ -1,16 +0,0 @@
-HPieModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as a data source
-for a pie series. It is possible to use both QAbstractItemModel and PieSeries data API to manipulate data.
-HPieModelMapper keeps the Pie and the model in sync.
-
-The following QML example would create a pie series with four slices (assuming the model has
-at least five columns). Each slice would contain a label from row 1 and a value from row 2.
-\code
- HPieModelMapper {
- series: pieSeries
- model: customModel
- labelsRow: 1
- valuesRow: 2
- firstColumn: 1
- columnCount: 4
- }
-\endcode
diff --git a/doc/src/hxymodelmapper.qdocinc b/doc/src/hxymodelmapper.qdocinc
deleted file mode 100644
index 612959e8..00000000
--- a/doc/src/hxymodelmapper.qdocinc
+++ /dev/null
@@ -1,3 +0,0 @@
-HXYModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as a data source
-for XYSeries based series. It is possible to use both QAbstractItemModel and XYSeries data API to manipulate data.
-HXYModelMapper keeps the series and the model in sync.
diff --git a/doc/src/legend.qdocinc b/doc/src/legend.qdocinc
deleted file mode 100644
index d2c6ef66..00000000
--- a/doc/src/legend.qdocinc
+++ /dev/null
@@ -1,17 +0,0 @@
-\brief Legend is part of Qt Chart QML API.
-
-Legend is a graphical object, whics displays legend of the chart. Legend state is updated by ChartView, when
-series have been changed. Legend is used via ChartView class. For example:
-\code
- ChartView {
- legend.visible: true
- legend.alignment: Qt.AlignBottom
- // Add a few series...
- }
-\endcode
-
-\image examples_percentbarchart_legend.png
-
-Please note that there is no QML API available for modifying legend markers, unlike in the Qt API of Charts.
-The use case of modifying markers can be implemented for example by creating your own custom legend. For an example
-on how to do this, see \l {demos/qmlcustomlegend}{Qml Custom Demo} application.
diff --git a/doc/src/lineseries.qdocinc b/doc/src/lineseries.qdocinc
deleted file mode 100644
index 4e1ba988..00000000
--- a/doc/src/lineseries.qdocinc
+++ /dev/null
@@ -1,8 +0,0 @@
-\inherits XYSeries
-
-The following QML shows how to create a simple line chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View2.qml 1
-\beginfloatleft
-\image demos_qmlchart2.png
-\endfloat
-\clearfloat
diff --git a/doc/src/logvalueaxis.qdocinc b/doc/src/logvalueaxis.qdocinc
deleted file mode 100644
index d027e783..00000000
--- a/doc/src/logvalueaxis.qdocinc
+++ /dev/null
@@ -1,7 +0,0 @@
-\brief The LogValueAxis element is used for manipulating chart's axes.
-\inherits AbstractAxis
-
-\note If a LogValueAxis is attached to a series with one or more points with
-negative or zero values on the associated dimension, the series will not be
-plotted at all. This is particularly relevant when XYModelMappers are used,
-since empty cells in models typically contain zero values.
diff --git a/doc/src/margins.qdocinc b/doc/src/margins.qdocinc
deleted file mode 100644
index 941b00d0..00000000
--- a/doc/src/margins.qdocinc
+++ /dev/null
@@ -1 +0,0 @@
-Uncreatable type that is used to define top, bottom, left and right margins.
diff --git a/doc/src/persentbarseries.qdocinc b/doc/src/persentbarseries.qdocinc
deleted file mode 100644
index ebb65aa2..00000000
--- a/doc/src/persentbarseries.qdocinc
+++ /dev/null
@@ -1,8 +0,0 @@
-\inherits AbstractBarSeries
-
-The following QML shows how to create a simple percent bar chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1
-\beginfloatleft
-\image demos_qmlchart8.png
-\endfloat
-\clearfloat
diff --git a/doc/src/pieseries.qdocinc b/doc/src/pieseries.qdocinc
deleted file mode 100644
index 256109eb..00000000
--- a/doc/src/pieseries.qdocinc
+++ /dev/null
@@ -1,10 +0,0 @@
-\inherits AbstractSeries
-
-The following QML shows how to create a simple pie chart.
-
-\snippet ../demos/qmlchart/qml/qmlchart/View1.qml 1
-
-\beginfloatleft
-\image demos_qmlchart1.png
-\endfloat
-\clearfloat
diff --git a/doc/src/pieslice.qdocinc b/doc/src/pieslice.qdocinc
deleted file mode 100644
index 556bb388..00000000
--- a/doc/src/pieslice.qdocinc
+++ /dev/null
@@ -1,12 +0,0 @@
-PieSlice defines the properties of a single slice in a PieSeries. The element should be used
-as a child for a PieSeries. For example:
-\snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2
-
-An alternative (dynamic) method for adding slices to a PieSeries is using PieSeries.append
-method.
-\snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 4
-
-In that case you may want to use PieSeries.at or PieSeries.find to access the properties of
-an individual PieSlice instance.
-\snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 5
-\sa PieSeries
diff --git a/doc/src/scatterseries.qdocinc b/doc/src/scatterseries.qdocinc
deleted file mode 100644
index 3b12d67c..00000000
--- a/doc/src/scatterseries.qdocinc
+++ /dev/null
@@ -1,9 +0,0 @@
-\inherits XYSeries
-
-The following QML shows how to create a chart with two simple scatter series:
-\snippet ../demos/qmlchart/qml/qmlchart/View5.qml 1
-
-\beginfloatleft
-\image demos_qmlchart5.png
-\endfloat
-\clearfloat
diff --git a/doc/src/splineseries.qdocinc b/doc/src/splineseries.qdocinc
deleted file mode 100644
index 38ab4386..00000000
--- a/doc/src/splineseries.qdocinc
+++ /dev/null
@@ -1,8 +0,0 @@
-\inherits XYSeries
-
-The following QML shows how to create a simple spline chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View3.qml 1
-\beginfloatleft
-\image demos_qmlchart3.png
-\endfloat
-\clearfloat
diff --git a/doc/src/stackedbarseries.qdocinc b/doc/src/stackedbarseries.qdocinc
deleted file mode 100644
index 8d94d3d6..00000000
--- a/doc/src/stackedbarseries.qdocinc
+++ /dev/null
@@ -1,8 +0,0 @@
-\inherits AbstractBarSeries
-
-The following QML shows how to create a simple stacked bar chart:
-\snippet ../demos/qmlchart/qml/qmlchart/View7.qml 1
-\beginfloatleft
-\image demos_qmlchart7.png
-\endfloat
-\clearfloat
diff --git a/doc/src/tutorials.qdoc b/doc/src/tutorials.qdoc
deleted file mode 100644
index 945d7acb..00000000
--- a/doc/src/tutorials.qdoc
+++ /dev/null
@@ -1,6 +0,0 @@
-/*!
- \page tutorials.html
- \title Tutorials
- \keyword Tutorials
-
-*/
diff --git a/doc/src/valueaxis.qdocinc b/doc/src/valueaxis.qdocinc
deleted file mode 100644
index 8b21e7a3..00000000
--- a/doc/src/valueaxis.qdocinc
+++ /dev/null
@@ -1,17 +0,0 @@
-\inherits AbstractAxis
-\brief The ValueAxis element is used for manipulating chart's axes
-
-ValueAxis can be setup to show axis line with tick marks, grid lines and shades.
-Values of axis are drawn to position of ticks
-
-Example about using ValueAxis:
-\code
- ChartView {
- ValueAxis {
- id: xAxis
- min: 0
- max: 10
- }
- // Add a few series...
- }
-\endcode
diff --git a/doc/src/vbarmodelmapper.qdocinc b/doc/src/vbarmodelmapper.qdocinc
deleted file mode 100644
index b6c4b6df..00000000
--- a/doc/src/vbarmodelmapper.qdocinc
+++ /dev/null
@@ -1,19 +0,0 @@
-\inherits BarModelMapper
-
-VBarModelMapper allows you to use your own QAbstractItemModel derived model with data in columns as a data source
-for any bar series. It is possible to use both QAbstractItemModel and bar series data API to manipulate data.
-VBarModelMapper keeps the series and the model in sync.
-
-The following QML example would create a bar series with three bar sets (assuming the
-model has at least four columns). Each bar set would contain data starting from row 1. The name of a set would be
-defined by the horizontal header (of the column).
-\code
- BarSeries {
- VBarModelMapper {
- model: myCustomModel // QAbstractItemModel derived implementation
- firstBarSetColumn: 1
- lastBarSetColumn: 3
- firstRow: 1
- }
- }
-\endcode
diff --git a/doc/src/vboxplotmodelmapper.qdocinc b/doc/src/vboxplotmodelmapper.qdocinc
deleted file mode 100644
index 1f611170..00000000
--- a/doc/src/vboxplotmodelmapper.qdocinc
+++ /dev/null
@@ -1,18 +0,0 @@
-VBoxPlotModelMapper allows you to use your own QAbstractItemModel derived model with data in columns as a data source
-for any box-and-whiskers series. It is possible to use both QAbstractItemModel and box-and-whiskers series data API to
-manipulate data.
-VBoxPlotModelMapper keeps the series and the model in sync.
-
-The following QML example would create a box-and-whiskers series with three box sets (assuming the
-model has at least four columns). Each box set would contain data starting from row 1. The name of a set would be
-defined by the horizontal header (of the column).
-\code
- BoxPlotSeries {
- VBoxPlotModelMapper {
- model: myCustomModel // QAbstractItemModel derived implementation
- firstBoxSetColumn: 1
- lastBoxSetColumn: 3
- firstRow: 1
- }
- }
-\endcode
diff --git a/doc/src/vpiemodelmapper.qdocinc b/doc/src/vpiemodelmapper.qdocinc
deleted file mode 100644
index b669a1c6..00000000
--- a/doc/src/vpiemodelmapper.qdocinc
+++ /dev/null
@@ -1,16 +0,0 @@
-VPieModelMapper allows you to use your own QAbstractItemModel derived model with data in columns as a data source
-for a pie series. It is possible to use both QAbstractItemModel and PieSeries data API to manipulate data.
-VPieModelMapper keeps the Pie and the model in sync.
-
-The following QML example would create a pie series with four slices (assuming the model has at least five rows).
-Each slice would contain a label from column 1 and a value from column 2.
-\code
- VPieModelMapper {
- series: pieSeries
- model: customModel
- labelsColumn: 1
- valuesColumn: 2
- firstRow: 1
- rowCount: 4
- }
-\endcode
diff --git a/doc/src/vxymodelmapper.qdocinc b/doc/src/vxymodelmapper.qdocinc
deleted file mode 100644
index 403f8d5e..00000000
--- a/doc/src/vxymodelmapper.qdocinc
+++ /dev/null
@@ -1,3 +0,0 @@
-VXYModelMapper allows you to use your own QAbstractItemModel derived model with data in columns as a data source
-for XYSeries based series. It is possible to use both QAbstractItemModel and XYSeries data API to manipulate data.
-VXYModelMapper keeps the series and the model in sync.
diff --git a/doc/src/xyseries.qdocinc b/doc/src/xyseries.qdocinc
deleted file mode 100644
index 64f4baa7..00000000
--- a/doc/src/xyseries.qdocinc
+++ /dev/null
@@ -1,4 +0,0 @@
-\inherits AbstractSeries
-
-The XYSeries class is a base class for line, spline and scatter series.
-The class cannot be instantiated directly.
diff --git a/doc/src_qt4/demos.qdoc b/doc/src_qt4/demos.qdoc
deleted file mode 100644
index 38c310f4..00000000
--- a/doc/src_qt4/demos.qdoc
+++ /dev/null
@@ -1,78 +0,0 @@
-/*!
- \page demos.html
- \title Qt Charts Demos
- \keyword Demos
-
- \raw HTML
- <div class="qchart">
-
- <table>
- <tr>
- <td><a href="demos-audio.html">Audio</a></td>
- <td><a href="demos-callout.html">Callout</a></td>
- </tr>
- <tr>
- <td><a href="demos-audio.html"><img src="images/demos_audio.png" width="300" alt="Audio" /></a></td>
- <td><a href="demos-callout.html"><img src="images/demos_callout.png" width="300" alt="Callout" /></a></td>
- </tr>
- <tr>
- <td><a href="demos-chartthemes.html">Chart Themes</a></td>
- <td><a href="demos-dynamicspline.html">Dynamic Spline Chart</a></td>
- </tr>
- <tr>
- <td><a href="demos-chartthemes.html"><img src="images/demo_chartthemes_blue_cerulean.png" width="300" alt="Chart Themes" /></a></td>
- <td><a href="demos-dynamicspline.html"><img src="images/demos_dynamicspline2.png" width="300" alt="Dynamic Spline" /></a></td>
- </tr>
- <tr>
- <td><a href="demos-nesteddonuts.html">Nested Donuts Chart</a></td>
- <td><a href="demos-piechartcustomization.html">Pie Chart Customization</a></td>
- </tr>
- <tr>
- <td><a href="demos-nesteddonuts.html"><img src="images/demos_nesteddonuts.png" width="300" alt="Nested Donuts Chart" /></a></td>
- <td><a href="demos-piechartcustomization.html"><img src="images/piechart_customization.png" width="300" alt="Pie Chart Customization" /></a></td>
- </tr>
- <tr>
- <td><a href="demos-qmlchart.html">Qml Basic Charts</a></td>
- <td><a href="demos-qmlaxes.html">Qml Axes</a></td>
- </tr>
- <tr>
- <td><a href="demos-qmlchart.html"><img src="images/demos_qmlchart1.png" width="300" alt="Qml Basic Charts" /></a></td>
- <td><a href="demos-qmlaxes.html"><img src="images/demos_qmlaxes1.png" width="300" alt="Qml Axes" /></a></td>
- </tr>
- <tr>
- <td><a href="demos-qmlcustomizations.html">Qml Customizations</a></td>
- <td><a href="demos-qmlcustomlegend.html">Qml Custom Legend</a></td>
- </tr>
- <tr>
- <td><a href="demos-qmlcustomizations.html"><img src="images/demos_qmlcustomizations.png" width="300" alt="Qml Customizations" /></a></td>
- <td><a href="demos-qmlcustomlegend.html"><img src="images/demos-qmlcustomlegend1.png" width="300" alt="Qml Custom Legend" /></a></td>
- </tr>
- <tr>
- <td><a href="demos-qmlf1legends.html">Qml F1 Legends</a></td>
- <td><a href="demos-qmloscilloscope.html">Qml Oscilloscope</a></td>
- </tr>
- <tr>
- <td><a href="demos-qmlf1legends.html"><img src="images/demos_qmlf1legends.png" width="300" alt="Qml F1 Legends" /></a></td>
- <td><a href="demos-qmloscilloscope.html"><img src="images/demos_qmloscilloscope.png" width="300" alt="Qml Oscilloscope" /></a></td>
- </tr>
- <tr>
- <td><a href="demos-qmlweather.html">Qml Weather</a></td>
- <td><a href="demos-qmlpolarchart.html">Qml Polar Chart</a></td>
- </tr>
- <tr>
- <td><a href="demos-qmlweather.html"><img src="images/demos_qmlweather.png" width="300" alt="Qml Weather" /></a></td>
- <td><a href="demos-qmlpolarchart.html"><img src="images/demos_qmlpolarchart1.png" width="300" alt="Qml Polar Chart" /></a></td>
- </tr>
- <tr>
- <td><a href="demos-quick2chart.html">Qt Quick 2 Basic Charts</a></td>
- <td><a href="demos-quick2oscilloscope.html">Qt Quick 2 Oscilloscope</a></td>
- </tr>
- <tr>
- <td><a href="demos-quick2chart.html"><img src="images/demos_qmlchart1.png" width="300" alt="Qt Quick 2 Basic Charts" /></a></td>
- <td><a href="demos-quick2oscilloscope.html"><img src="images/demos_qmloscilloscope.png" width="300" alt="Qt Quick 2 Oscilloscope" /></a></td>
- </tr>
- </table>
- </div>
- \endraw
-
-*/
diff --git a/doc/src_qt4/examples.qdoc b/doc/src_qt4/examples.qdoc
deleted file mode 100644
index c814f8ce..00000000
--- a/doc/src_qt4/examples.qdoc
+++ /dev/null
@@ -1,147 +0,0 @@
-/*!
- \page examples.html
- \title Qt Charts Examples
- \keyword Examples
-
- \raw HTML
- <div class="qchart">
-
- <table>
- <tr>
- <td><a href="examples-areachart.html">Area Chart</a></td>
- <td><a href="examples-barchart.html">Bar Chart</a></td>
- </tr>
- <tr>
- <td><a href="examples-areachart.html"><img src="images/examples_areachart.png" width="300" alt="Area Chart" /></a></td>
- <td><a href="examples-barchart.html"><img src="images/examples_barchart.png" width="300" alt="Bar Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-barmodelmapper.html">Bar Chart from Model</a></td>
- <td><a href="examples-boxplotchart.html">Box-and-whiskers Chart</a></td>
- </tr>
- <tr>
- <td><a href="examples-barmodelmapper.html"><img src="images/examples_barmodelmapper.png" width="300" alt="Bar Chart from Model" /></a></td>
- <td><a href="examples-boxplotchart.html"><img src="images/examples_boxplotchart.png" width="300" alt="Bar Chart from Model" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-customchart.html">Custom Chart</a></td>
- <td><a href="examples-datetimeaxis.html">DateTimeAxis Example</a></td>
- </tr>
- <tr>
- <td><a href="examples-customchart.html"><img src="images/examples_customchart.png" width="300" alt="Custom Chart" /></a></td>
- <td><a href="examples-datetimeaxis.html"><img src="images/examples_datetimeaxis.png" width="300" alt="DateTimeAxis Example" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-donutbreakdown.html">Donut Breakdown Chart</a></td>
- <td><a href="examples-donutchart.html">Donut Chart</a></td>
- </tr>
- <tr>
- <td><a href="examples-donutbreakdown.html"><img src="images/examples_donutbreakdown.png" width="300" alt="Donut Breakdown Chart" /></a></td>
- <td><a href="examples-donutchart.html"><img src="images/examples_donutchart.png" width="300" alt="Donut Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-horizontalbarchart.html">Horizontal Bar Chart</a></td>
- <td><a href="examples-horizontalpercentbarchart.html">Horizontal Percent Bar Chart</a></td>
- </tr>
- <tr>
- <td><a href="examples-horizontalbarchart.html"><img src="images/examples_horizontalbarchart.png" width="300" alt="Horizontal Bar Chart" /></a></td>
- <td><a href="examples-horizontalpercentbarchart.html"><img src="images/examples_horizontalpercentbarchart.png" width="300" alt="Horizontal Percent Bar Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-horizontalstackedbarchart.html">Horizontal Stacked Bar Chart</a></td>
- <td><a href="examples-legend.html">Legend</a></td>
- </tr>
- <tr>
- <td><a href="examples-horizontalstackedbarchart.html"><img src="images/examples_horizontalstackedbarchart.png" width="300" alt="Horizontal Stacked Bar Chart" /></a></td>
- <td><a href="examples-legend.html"><img src="images/examples_legend_detach.png" width="300" alt="Legend" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-legendmarkers.html">Legend Markers</a></td>
- <td><a href="examples-lineandbar.html">Line and Barchart</a></td>
- </tr>
- <tr>
- <td><a href="examples-legendmarkers.html"><img src="images/examples_legendmarkers.png" width="300" alt="Legend Markers" /></a></td>
- <td><a href="examples-lineandbar.html"><img src="images/examples_lineandbar.png" width="300" alt="Line and Barchart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-linechart.html">Line Chart</a></td>
- <td><a href="examples-logvalueaxis.html">Logarithmic axis</a></td>
- </tr>
- <tr>
- <td><a href="examples-linechart.html"><img src="images/examples_linechart.png" width="300" alt="Line Chart" /></a></td>
- <td><a href="examples-logvalueaxis.html"><img src="images/examples_logvalueaxis.png" width="300" alt="Logarythmix axis" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-modeldata.html">Model Data</a></td>
- <td><a href="examples-multiaxis.html">Multiple axes</a></td>
- </tr>
- <tr>
- <td><a href="examples-modeldata.html"><img src="images/examples_modeldata.png" width="300" alt="Model Data" /></a></td>
- <td><a href="examples-multiaxis.html"><img src="images/examples_multiaxis.png" width="300" alt="Multiple axes" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-percentbarchart.html">Percent Bar Chart</a></td>
- <td><a href="examples-piechart.html">Pie Chart</a></td>
- </tr>
- <tr>
- <td><a href="examples-percentbarchart.html"><img src="images/examples_percentbarchart.png" width="300" alt="Percent Bar Chart" /></a></td>
- <td><a href="examples-piechart.html"><img src="images/examples_piechart.png" width="300" alt="Pie Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-piechartdrilldown.html">Pie Chart Drilldown</a></td>
- <td><a href="examples-polarchart.html">Polar chart</a></td>
- </tr>
- <tr>
- <td><a href="examples-piechartdrilldown.html"><img src="images/examples_piechartdrill2.png" width="300" alt="Pie Chart Drilldown" /></a></td>
- <td><a href="examples-polarchart.html"><img src="images/examples_polarchart.png" width="300" alt="Polar chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-scatterchart.html">Scatter chart</a></td>
- <td><a href="examples-scatterinteractions.html">Scatter Interactions</a></td>
- </tr>
- <tr>
- <td><a href="examples-scatterchart.html"><img src="images/examples_scatterchart.png" width="300" alt="Scatter chart" /></a></td>
- <td><a href="examples-scatterinteractions.html"><img src="images/examples_scatterinteractions.png" width="300" alt="Scatter Interactions" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-splinechart.html">Spline Chart</a></td>
- <td><a href="examples-stackedbarchart.html">Stacked Bar Chart</a></td>
- </tr>
- <tr>
- <td><a href="examples-splinechart.html"><img src="images/examples_splinechart.png" width="300" alt="Spline Chart" /></a></td>
- <td><a href="examples-stackedbarchart.html"><img src="images/examples_stackedbarchart.png" width="300" alt="Stacked Bar Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-stackedbarchartdrilldown.html">Stacked Bar Chart Drilldown</a></td>
- <td><a href="examples-temperaturerecords.html">Temperature Records</a></td>
- </tr>
- <tr>
- <td><a href="examples-stackedbarchartdrilldown.html"><img src="images/examples_stackedbarchartdrilldown1.png" width="300" alt="Stacked Bar Chart Drilldown" /></a></td>
- <td><a href="examples-temperaturerecords.html"><img src="images/examples_temperaturerecords.png" width="300" alt="Temperature Records" /></a></td>
- </tr>
-
- <tr>
- <td><a href="examples-zoomlinechart.html">Zoom Line</a></td>
- </tr>
- <tr>
- <td><a href="examples-zoomlinechart.html"><img src="images/examples_zoomlinechart1.png" width="300" alt="Zoom Line" /></a></td>
- </tr>
-
- </table>
- </div>
- \endraw
-
-*/
diff --git a/doc/src_qt4/index.qdoc b/doc/src_qt4/index.qdoc
deleted file mode 100644
index 1a3a9ae4..00000000
--- a/doc/src_qt4/index.qdoc
+++ /dev/null
@@ -1,43 +0,0 @@
-/*!
- \page index.html
- \keyword About
-
- \raw HTML
- <div class="qchart">
- <img src="images/qt-logo.png" alt="qt-logo" style="margin:0px 8px"/>
-
- <p>
- Qt Charts is a part of the Qt Enterprise addons package. It provides a set of easy to use chart
- components which are available for Qt customers. It uses the Qt Graphics View
- Framework, therefore charts can be easily integrated to modern user interfaces. Qt Charts can
- be used as QWidgets, QGraphicsWidget, or QML elements. Users can easily create impressive
- graphs by selecting one of the charts themes.
- </p>
- <p>
- Below are a few basic examples of the different chart types. You can find more applications
- from the Examples and Demo sections of the documentation.
- </p>
-
- <table>
- <tr>
- <td><a href="examples-linechart.html"><img src="images/examples_linechart.png" width="440" alt="linechart" /></a></td>
- <td><a href="examples-areachart.html"><img src="images/examples_areachart.png" width="440" alt="areachart" /></a></td>
- </tr>
- <tr>
- <td><a href="examples-scatterchart.html"><img src="images/examples_scatterchart.png" width="440" alt="scatterchart" /></a></td>
- <td><a href="examples-barchart.html"><img src="images/examples_barchart.png" width="440" alt="barchart" /></a></td>
- </tr>
- <tr>
- <td><a href="examples-horizontalbarchart.html"><img src="images/examples_horizontalbarchart.png" width="440" alt="horizontalbarchart" /></a></td>
- <td><a href="examples-piechart.html"><img src="images/examples_piechart.png" width="440" alt="piechart" /></a></td>
- </tr>
- <tr>
- <td><a href="examples-splinechart.html"><img src="images/examples_splinechart.png" width="440" alt="linechart" /></a></td>
- <td><a href="examples-customchart.html"><img src="images/examples_customchart.png" width="440" alt="customerchart" /></a></td>
- </tr>
- <tr>
- </tr>
- </table>
- </div>
- \endraw
-*/
diff --git a/doc/src_qt4/qml.qdoc b/doc/src_qt4/qml.qdoc
deleted file mode 100644
index 5199e3ee..00000000
--- a/doc/src_qt4/qml.qdoc
+++ /dev/null
@@ -1,113 +0,0 @@
-/*!
- \page qml.html
- \title Qt Charts QML API
- \keyword Charts QML API
-
- The Qt Charts QML API is an intuitive and simple way to show charts in your QML
- applications.
-
- \table
- \row
- \li \br
- Use the following QML to create a simple pie chart:
- \br
- \br
- \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1
- \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2
- \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 3
- \li \inlineimage examples_qmlpiechart.png
- \endtable
-
- \note Since Qt Charts utilizes Qt Graphics View Framework for drawing, it works best
- with Qt Quick 1, which is based on the same framework.
- As of release 1.3.0, Qt Charts is also usable with Qt Quick 2, though the performance
- is slightly worse than with Qt Quick 1 due to the additional rendering step that is required.
-
- \note Since Qt Creator 3.0 the project created with Qt Quick Application wizard based on
- Qt Quick 2 template uses QGuiApplication by default. As Qt Charts utilizes Qt Graphics View
- Framework for drawing, QApplication must be used. The project created with the wizard is
- usable with Qt Charts after the QGuiApplication is replaced with QApplication.
-
- \note Qt Quick 1 is supported from Qt 4.7.4 onwards because of the missing
- Q_REVISION macro in the earlier Qt releases. Qt Quick 2 is supported with only Qt 5.
-
- \raw HTML
- <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
- <tr>
- <th class="titleheader" width="25%"> ChartView and it's properties </th>
- </tr>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qml-chartview.html">ChartView</a></li>
- <li><a href="qml-polarchartview.html">PolarChartView</a></li>
- <li><a href="qml-abstractaxis.html">AbstractAxis</a></li>
- <li><a href="qml-valueaxis.html">ValueAxis</a></li>
- <li><a href="qml-logvalueaxis.html">LogValueAxis</a></li>
- <li><a href="qml-categoryaxis.html">CategoryAxis</a></li>
- <li><a href="qml-categoryrange.html">CategoryRange</a></li>
- <li><a href="qml-barcategoryaxis.html">BarCategoryAxis</a></li>
- <li><a href="qml-datetimeaxis.html">DateTimeAxis</a></li>
- <li><a href="qml-legend.html">Legend</a></li>
- <li><a href="qml-abstractseries.html">AbstractSeries</a></li>
- </ul>
- </td>
- </tr>
- </table>
- <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
- <tr>
- <th class="titleheader" width="25%"> XY chart </th>
- </tr>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qml-xyseries.html">XYSeries</a></li>
- <li><a href="qml-lineseries.html">LineSeries</a></li>
- <li><a href="qml-areaseries.html">AreaSeries</a></li>
- <li><a href="qml-scatterseries.html">ScatterSeries</a></li>
- <li><a href="qml-splineseries.html">SplineSeries</a></li>
- <li><a href="qml-xypoint.html">XYPoint</a></li>
- <li><a href="qml-hxymodelmapper.html">HXYModelMapper</a></li>
- <li><a href="qml-vxymodelmapper.html">VXYModelMapper</a></li>
- </ul>
- </td>
- </tr>
- </table>
- <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
- <tr>
- <th class="titleheader" width="25%"> Pie chart </th>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qml-pieseries.html">PieSeries</a></li>
- <li><a href="qml-pieslice.html">PieSlice</a></li>
- <li><a href="qml-hpiemodelmapper.html">HPieModelMapper</a></li>
- <li><a href="qml-vpiemodelmapper.html">VPieModelMapper</a></li>
- </ul>
- </td>
- </tr>
- </table>
- <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
- <tr>
- <th class="titleheader" width="25%"> Bar chart </th>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qml-barseries.html">BarSeries</a></li>
- <li><a href="qml-stackedbarseries.html">StackedBarSeries</a></li>
- <li><a href="qml-percentbarseries.html">PercentBarSeries</a></li>
- <li><a href="qml-horizontalbarseries.html">HorizontalBarSeries</a></li>
- <li><a href="qml-horizontalstackedbarseries.html">HorizontalStackedBarSeries</a></li>
- <li><a href="qml-horizontalpercentbarseries.html">HorizontalPercentBarSeries</a></li>
- <li><a href="qml-barset.html">BarSet</a></li>
- <li><a href="qml-boxplotseries.html">BoxPlotSeries</a></li>
- <li><a href="qml-boxset.html">BoxSet</a></li>
- <li><a href="qml-hbarmodelmapper.html">HBarModelMapper</a></li>
- <li><a href="qml-vbarmodelmapper.html">VBarModelMapper</a></li>
- <li><a href="qml-vboxplotmodelmapper.html">VBoxPlotModelMapper</a></li>
- </ul>
- </td>
- </tr>
- </table>
- \endraw
-*/
diff --git a/doc/src_qt5/demos.qdoc b/doc/src_qt5/demos.qdoc
deleted file mode 100644
index 021b8c09..00000000
--- a/doc/src_qt5/demos.qdoc
+++ /dev/null
@@ -1,78 +0,0 @@
-/*!
- \page demos.html
- \title Qt Charts Demos
- \keyword Demos
-
- \raw HTML
- <div class="qchart">
-
- <table>
- <tr>
- <td><a href="qt-charts-demos-audio-example.html">Audio</a></td>
- <td><a href="qt-charts-demos-callout-example.html">Callout</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-audio-example.html"><img src="images/demos_audio.png" width="300" alt="Audio" /></a></td>
- <td><a href="qt-charts-demos-callout-example.html"><img src="images/demos_callout.png" width="300" alt="Callout" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-chartthemes-example.html">Chart Themes</a></td>
- <td><a href="qt-charts-demos-dynamicspline-example.html">Dynamic Spline Chart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-chartthemes-example.html"><img src="images/demo_chartthemes_blue_cerulean.png" width="300" alt="Chart Themes" /></a></td>
- <td><a href="qt-charts-demos-dynamicspline-example.html"><img src="images/demos_dynamicspline2.png" width="300" alt="Dynamic Spline" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-nesteddonuts-example.html">Nested Donuts Chart</a></td>
- <td><a href="qt-charts-demos-piechartcustomization-example.html">Pie Chart Customization</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-nesteddonuts-example.html"><img src="images/demos_nesteddonuts.png" width="300" alt="Nested Donuts Chart" /></a></td>
- <td><a href="qt-charts-demos-piechartcustomization-example.html"><img src="images/piechart_customization.png" width="300" alt="Pie Chart Customization" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-qmlchart-example.html">Qml Basic Charts</a></td>
- <td><a href="qt-charts-demos-qmlaxes-example.html">Qml Axes</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-qmlchart-example.html"><img src="images/demos_qmlchart1.png" width="300" alt="Qml Basic Charts" /></a></td>
- <td><a href="qt-charts-demos-qmlaxes-example.html"><img src="images/demos_qmlaxes1.png" width="300" alt="Qml Axes" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-qmlcustomizations-example.html">Qml Customizations</a></td>
- <td><a href="qt-charts-demos-qmlcustomlegend-example.html">Qml Custom Legend</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-qmlcustomizations-example.html"><img src="images/demos_qmlcustomizations.png" width="300" alt="Qml Customizations" /></a></td>
- <td><a href="qt-charts-demos-qmlcustomlegend-example.html"><img src="images/demos-qmlcustomlegend1.png" width="300" alt="Qml Custom Legend" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-qmlf1legends-example.html">Qml F1 Legends</a></td>
- <td><a href="qt-charts-demos-qmloscilloscope-example.html">Qml Oscilloscope</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-qmlf1legends-example.html"><img src="images/demos_qmlf1legends.png" width="300" alt="Qml F1 Legends" /></a></td>
- <td><a href="qt-charts-demos-qmloscilloscope-example.html"><img src="images/demos_qmloscilloscope.png" width="300" alt="Qml Oscilloscope" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-qmlweather-example.html">Qml Weather</a></td>
- <td><a href="qt-charts-demos-qmlpolarchart-example.html">Qml Polar Chart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-qmlweather-example.html"><img src="images/demos_qmlweather.png" width="300" alt="Qml Weather" /></a></td>
- <td><a href="qt-charts-demos-qmlpolarchart-example.html"><img src="images/demos_qmlpolarchart1.png" width="300" alt="Qml Polar Chart" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-quick2chart-example.html">Qt Quick 2 Basic Charts</a></td>
- <td><a href="qt-charts-demos-quick2oscilloscope-example.html">Qt Quick 2 Oscilloscope</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-demos-quick2chart-example.html"><img src="images/demos_qmlchart1.png" width="300" alt="Qt Quick 2 Basic Charts" /></a></td>
- <td><a href="qt-charts-demos-quick2oscilloscope-example.html"><img src="images/demos_qmloscilloscope.png" width="300" alt="Qt Quick 2 Oscilloscope" /></a></td>
- </tr>
- </table>
- </div>
- \endraw
-
-*/
diff --git a/doc/src_qt5/examples.qdoc b/doc/src_qt5/examples.qdoc
deleted file mode 100644
index f7358185..00000000
--- a/doc/src_qt5/examples.qdoc
+++ /dev/null
@@ -1,147 +0,0 @@
-/*!
- \page examples.html
- \title Qt Charts Examples
- \keyword Examples
-
- \raw HTML
- <div class="qchart">
-
- <table>
- <tr>
- <td><a href="qt-charts-examples-areachart-example.html">Area Chart</a></td>
- <td><a href="qt-charts-examples-barchart-example.html">Bar Chart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-areachart-example.html"><img src="images/examples_areachart.png" width="300" alt="Area Chart" /></a></td>
- <td><a href="qt-charts-examples-barchart-example.html"><img src="images/examples_barchart.png" width="300" alt="Bar Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-barmodelmapper-example.html">Bar Chart from Model</a></td>
- <td><a href="qt-charts-examples-boxplotchart-example.html">Box-and-whiskers Chart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-barmodelmapper-example.html"><img src="images/examples_barmodelmapper.png" width="300" alt="Bar Chart from Model" /></a></td>
- <td><a href="qt-charts-examples-boxplotchart-example.html"><img src="images/examples_boxplotchart.png" width="300" alt="Bar Chart from Model" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-customchart-example.html">Custom Chart</a></td>
- <td><a href="qt-charts-examples-datetimeaxis-example.html">DateTimeAxis Example</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-customchart-example.html"><img src="images/examples_customchart.png" width="300" alt="Custom Chart" /></a></td>
- <td><a href="qt-charts-examples-datetimeaxis-example.html"><img src="images/examples_datetimeaxis.png" width="300" alt="DateTimeAxis Example" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-donutbreakdown-example.html">Donut Breakdown Chart</a></td>
- <td><a href="qt-charts-examples-donutchart-example.html">Donut Chart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-donutbreakdown-example.html"><img src="images/examples_donutbreakdown.png" width="300" alt="Donut Breakdown Chart" /></a></td>
- <td><a href="qt-charts-examples-donutchart-example.html"><img src="images/examples_donutchart.png" width="300" alt="Donut Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-horizontalbarchart-example.html">Horizontal Bar Chart</a></td>
- <td><a href="qt-charts-examples-horizontalpercentbarchart-example.html">Horizontal Percent Bar Chart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-horizontalbarchart-example.html"><img src="images/examples_horizontalbarchart.png" width="300" alt="Horizontal Bar Chart" /></a></td>
- <td><a href="qt-charts-examples-horizontalpercentbarchart-example.html"><img src="images/examples_horizontalpercentbarchart.png" width="300" alt="Horizontal Percent Bar Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-horizontalstackedbarchart-example.html">Horizontal Stacked Bar Chart</a></td>
- <td><a href="qt-charts-examples-legend-example.html">Legend</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-horizontalstackedbarchart-example.html"><img src="images/examples_horizontalstackedbarchart.png" width="300" alt="Horizontal Stacked Bar Chart" /></a></td>
- <td><a href="qt-charts-examples-legend-example.html"><img src="images/examples_legend_detach.png" width="300" alt="Legend" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-legendmarkers-example.html">Legend Markers</a></td>
- <td><a href="qt-charts-examples-lineandbar-example.html">Line and Barchart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-legendmarkers-example.html"><img src="images/examples_legendmarkers.png" width="300" alt="Legend Markers" /></a></td>
- <td><a href="qt-charts-examples-lineandbar-example.html"><img src="images/examples_lineandbar.png" width="300" alt="Line and Barchart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-linechart-example.html">Line Chart</a></td>
- <td><a href="qt-charts-examples-logvalueaxis-example.html">Logarithmic axis</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-linechart-example.html"><img src="images/examples_linechart.png" width="300" alt="Line Chart" /></a></td>
- <td><a href="qt-charts-examples-logvalueaxis-example.html"><img src="images/examples_logvalueaxis.png" width="300" alt="Logarythmix axis" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-modeldata-example.html">Model Data</a></td>
- <td><a href="qt-charts-examples-multiaxis-example.html">Multiple axes</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-modeldata-example.html"><img src="images/examples_modeldata.png" width="300" alt="Model Data" /></a></td>
- <td><a href="qt-charts-examples-multiaxis-example.html"><img src="images/examples_multiaxis.png" width="300" alt="Multiple axes" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-percentbarchart-example.html">Percent Bar Chart</a></td>
- <td><a href="qt-charts-examples-piechart-example.html">Pie Chart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-percentbarchart-example.html"><img src="images/examples_percentbarchart.png" width="300" alt="Percent Bar Chart" /></a></td>
- <td><a href="qt-charts-examples-piechart-example.html"><img src="images/examples_piechart.png" width="300" alt="Pie Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-piechartdrilldown-example.html">Pie Chart Drilldown</a></td>
- <td><a href="qt-charts-examples-polarchart-example.html">Polar chart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-piechartdrilldown-example.html"><img src="images/examples_piechartdrill2.png" width="300" alt="Pie Chart Drilldown" /></a></td>
- <td><a href="qt-charts-examples-polarchart-example.html"><img src="images/examples_polarchart.png" width="300" alt="Polar chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-scatterchart-example.html">Scatter chart</a></td>
- <td><a href="qt-charts-examples-scatterinteractions-example.html">Scatter Interactions</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-scatterchart-example.html"><img src="images/examples_scatterchart.png" width="300" alt="Scatter chart" /></a></td>
- <td><a href="qt-charts-examples-scatterinteractions-example.html"><img src="images/examples_scatterinteractions.png" width="300" alt="Scatter Interactions" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-splinechart-example.html">Spline Chart</a></td>
- <td><a href="qt-charts-examples-stackedbarchart-example.html">Stacked Bar Chart</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-splinechart-example.html"><img src="images/examples_splinechart.png" width="300" alt="Spline Chart" /></a></td>
- <td><a href="qt-charts-examples-stackedbarchart-example.html"><img src="images/examples_stackedbarchart.png" width="300" alt="Stacked Bar Chart" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-stackedbarchartdrilldown-example.html">Stacked Bar Chart Drilldown</a></td>
- <td><a href="qt-charts-examples-temperaturerecords-example.html">Temperature Records</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-stackedbarchartdrilldown-example.html"><img src="images/examples_stackedbarchartdrilldown1.png" width="300" alt="Stacked Bar Chart Drilldown" /></a></td>
- <td><a href="qt-charts-examples-temperaturerecords-example.html"><img src="images/examples_temperaturerecords.png" width="300" alt="Temperature Records" /></a></td>
- </tr>
-
- <tr>
- <td><a href="qt-charts-examples-zoomlinechart-example.html">Zoom Line</a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-zoomlinechart-example.html"><img src="images/examples_zoomlinechart1.png" width="300" alt="Zoom Line" /></a></td>
- </tr>
-
- </table>
- </div>
- \endraw
-
-*/
diff --git a/doc/src_qt5/index.qdoc b/doc/src_qt5/index.qdoc
deleted file mode 100644
index a34e577d..00000000
--- a/doc/src_qt5/index.qdoc
+++ /dev/null
@@ -1,43 +0,0 @@
-/*!
- \page index.html
- \keyword About
-
- \raw HTML
- <div class="qchart">
- <img src="images/qt-logo.png" alt="qt-logo" style="margin:0px 8px"/>
-
- <p>
- Qt Charts is a part of the Qt Enterprise addons package. It provides a set of easy to use chart
- components which are available for Qt customers. It uses the Qt Graphics View
- Framework, therefore charts can be easily integrated to modern user interfaces. Qt Charts can
- be used as QWidgets, QGraphicsWidget, or QML types. Users can easily create impressive
- graphs by selecting one of the charts themes.
- </p>
- <p>
- Below are a few basic examples of the different chart types. You can find more applications
- from the Examples and Demo sections of the documentation.
- </p>
-
- <table>
- <tr>
- <td><a href="qt-charts-examples-linechart-example.html"><img src="images/examples_linechart.png" width="440" alt="linechart" /></a></td>
- <td><a href="qt-charts-examples-areachart-example.html"><img src="images/examples_areachart.png" width="440" alt="areachart" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-scatterchart-example.html"><img src="images/examples_scatterchart.png" width="440" alt="scatterchart" /></a></td>
- <td><a href="qt-charts-examples-barchart-example.html"><img src="images/examples_barchart.png" width="440" alt="barchart" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-horizontalbarchart-example.html"><img src="images/examples_horizontalbarchart.png" width="440" alt="horizontalbarchart" /></a></td>
- <td><a href="qt-charts-examples-piechart-example.html"><img src="images/examples_piechart.png" width="440" alt="piechart" /></a></td>
- </tr>
- <tr>
- <td><a href="qt-charts-examples-splinechart-example.html"><img src="images/examples_splinechart.png" width="440" alt="linechart" /></a></td>
- <td><a href="qt-charts-examples-customchart-example.html"><img src="images/examples_customchart.png" width="440" alt="customerchart" /></a></td>
- </tr>
- <tr>
- </tr>
- </table>
- </div>
- \endraw
-*/
diff --git a/doc/src_qt5/qml.qdoc b/doc/src_qt5/qml.qdoc
deleted file mode 100644
index 056e7328..00000000
--- a/doc/src_qt5/qml.qdoc
+++ /dev/null
@@ -1,113 +0,0 @@
-/*!
- \page qml.html
- \title Qt Charts QML API
- \keyword Charts QML API
-
- The Qt Charts QML API is an intuitive and simple way to show charts in your QML
- applications.
-
- \table
- \row
- \li \br
- Use the following QML to create a simple pie chart:
- \br
- \br
- \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 1
- \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 2
- \snippet ../examples/qmlpiechart/qml/qmlpiechart/main.qml 3
- \li \inlineimage examples_qmlpiechart.png
- \endtable
-
- \note Since Qt Charts utilizes Qt Graphics View Framework for drawing, it works best
- with Qt Quick 1, which is based on the same framework.
- As of release 1.3.0, Qt Charts is also usable with Qt Quick 2, though the performance
- is slightly worse than with Qt Quick 1 due to the additional rendering step that is required.
-
- \note Since Qt Creator 3.0 the project created with Qt Quick Application wizard based on
- Qt Quick 2 template uses QGuiApplication by default. As Qt Charts utilizes Qt Graphics View
- Framework for drawing, QApplication must be used. The project created with the wizard is
- usable with Qt Charts after the QGuiApplication is replaced with QApplication.
-
- \note Qt Quick 1 is supported from Qt 4.7.4 onwards because of the missing
- Q_REVISION macro in the earlier Qt releases. Qt Quick 2 is supported with only Qt 5.
-
- \raw HTML
- <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
- <tr>
- <th class="titleheader" width="25%"> ChartView and it's properties </th>
- </tr>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qml-qtcommercial-chart-chartview.html">ChartView</a></li>
- <li><a href="qml-qtcommercial-chart-polarchartview.html">PolarChartView</a></li>
- <li><a href="qml-qtcommercial-chart-abstractaxis.html">AbstractAxis</a></li>
- <li><a href="qml-qtcommercial-chart-valueaxis.html">ValueAxis</a></li>
- <li><a href="qml-qtcommercial-chart-logvalueaxis.html">LogValueAxis</a></li>
- <li><a href="qml-qtcommercial-chart-categoryaxis.html">CategoryAxis</a></li>
- <li><a href="qml-qtcommercial-chart-categoryrange.html">CategoryRange</a></li>
- <li><a href="qml-qtcommercial-chart-barcategoryaxis.html">BarCategoryAxis</a></li>
- <li><a href="qml-qtcommercial-chart-datetimeaxis.html">DateTimeAxis</a></li>
- <li><a href="qml-qtcommercial-chart-legend.html">Legend</a></li>
- <li><a href="qml-qtcommercial-chart-abstractseries.html">AbstractSeries</a></li>
- </ul>
- </td>
- </tr>
- </table>
- <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
- <tr>
- <th class="titleheader" width="25%"> XY chart </th>
- </tr>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qml-qtcommercial-chart-xyseries.html">XYSeries</a></li>
- <li><a href="qml-qtcommercial-chart-lineseries.html">LineSeries</a></li>
- <li><a href="qml-qtcommercial-chart-areaseries.html">AreaSeries</a></li>
- <li><a href="qml-qtcommercial-chart-scatterseries.html">ScatterSeries</a></li>
- <li><a href="qml-qtcommercial-chart-splineseries.html">SplineSeries</a></li>
- <li><a href="qml-qtcommercial-chart-xypoint.html">XYPoint</a></li>
- <li><a href="qml-qtcommercial-chart-hxymodelmapper.html">HXYModelMapper</a></li>
- <li><a href="qml-qtcommercial-chart-vxymodelmapper.html">VXYModelMapper</a></li>
- </ul>
- </td>
- </tr>
- </table>
- <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
- <tr>
- <th class="titleheader" width="25%"> Pie chart </th>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qml-qtcommercial-chart-pieseries.html">PieSeries</a></li>
- <li><a href="qml-qtcommercial-chart-pieslice.html">PieSlice</a></li>
- <li><a href="qml-qtcommercial-chart-hpiemodelmapper.html">HPieModelMapper</a></li>
- <li><a href="qml-qtcommercial-chart-vpiemodelmapper.html">VPieModelMapper</a></li>
- </ul>
- </td>
- </tr>
- </table>
- <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
- <tr>
- <th class="titleheader" width="25%"> Bar chart </th>
- <tr>
- <td valign="top">
- <ul>
- <li><a href="qml-qtcommercial-chart-barseries.html">BarSeries</a></li>
- <li><a href="qml-qtcommercial-chart-stackedbarseries.html">StackedBarSeries</a></li>
- <li><a href="qml-qtcommercial-chart-percentbarseries.html">PercentBarSeries</a></li>
- <li><a href="qml-qtcommercial-chart-horizontalbarseries.html">HorizontalBarSeries</a></li>
- <li><a href="qml-qtcommercial-chart-horizontalstackedbarseries.html">HorizontalStackedBarSeries</a></li>
- <li><a href="qml-qtcommercial-chart-horizontalpercentbarseries.html">HorizontalPercentBarSeries</a></li>
- <li><a href="qml-qtcommercial-chart-barset.html">BarSet</a></li>
- <li><a href="qml-qtcommercial-chart-boxplotseries.html">BoxPlotSeries</a></li>
- <li><a href="qml-qtcommercial-chart-boxset.html">BoxSet</a></li>
- <li><a href="qml-qtcommercial-chart-hbarmodelmapper.html">HBarModelMapper</a></li>
- <li><a href="qml-qtcommercial-chart-vbarmodelmapper.html">VBarModelMapper</a></li>
- <li><a href="qml-qtcommercial-chart-vboxplotmodelmapper.html">VBoxPlotModelMapper</a></li>
- </ul>
- </td>
- </tr>
- </table>
- \endraw
-*/
diff --git a/doc/src_qt5/qmlmodule.qdoc b/doc/src_qt5/qmlmodule.qdoc
deleted file mode 100644
index b909cb58..00000000
--- a/doc/src_qt5/qmlmodule.qdoc
+++ /dev/null
@@ -1,3 +0,0 @@
-/*!
- \qmlmodule QtCommercial.Chart 1.4
-*/
diff --git a/examples/areachart/main.cpp b/examples/areachart/main.cpp
deleted file mode 100644
index e860ea18..00000000
--- a/examples/areachart/main.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QLineSeries>
-#include <QAreaSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QLineSeries *series0 = new QLineSeries();
- QLineSeries *series1 = new QLineSeries();
-//![1]
-
-//![2]
- *series0 << QPointF(1, 5) << QPointF(3, 7) << QPointF(7, 6) << QPointF(9, 7) << QPointF(12, 6)
- << QPointF(16, 7) << QPointF(18, 5);
- *series1 << QPointF(1, 3) << QPointF(3, 4) << QPointF(7, 3) << QPointF(8, 2) << QPointF(12, 3)
- << QPointF(16, 4) << QPointF(18, 3);
-//![2]
-
-//![3]
- QAreaSeries *series = new QAreaSeries(series0, series1);
- series->setName("Batman");
- QPen pen(0x059605);
- pen.setWidth(3);
- series->setPen(pen);
-
- QLinearGradient gradient(QPointF(0, 0), QPointF(0, 1));
- gradient.setColorAt(0.0, 0x3cc63c);
- gradient.setColorAt(1.0, 0x26f626);
- gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- series->setBrush(gradient);
-//![3]
-
-//![4]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Simple areachart example");
- chart->createDefaultAxes();
- chart->axisX()->setRange(0, 20);
- chart->axisY()->setRange(0, 10);
-//![4]
-
-//![5]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![5]
-
-//![6]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
-//![6]
-
- return a.exec();
-}
diff --git a/examples/barchart/main.cpp b/examples/barchart/main.cpp
deleted file mode 100644
index 001ae2b3..00000000
--- a/examples/barchart/main.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QBarSeries>
-#include <QBarSet>
-#include <QLegend>
-#include <QBarCategoryAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QBarSet *set0 = new QBarSet("Jane");
- QBarSet *set1 = new QBarSet("John");
- QBarSet *set2 = new QBarSet("Axel");
- QBarSet *set3 = new QBarSet("Mary");
- QBarSet *set4 = new QBarSet("Samantha");
-
- *set0 << 1 << 2 << 3 << 4 << 5 << 6;
- *set1 << 5 << 0 << 0 << 4 << 0 << 7;
- *set2 << 3 << 5 << 8 << 13 << 8 << 5;
- *set3 << 5 << 6 << 7 << 3 << 4 << 5;
- *set4 << 9 << 7 << 5 << 3 << 1 << 2;
-//![1]
-
-//![2]
- QBarSeries *series = new QBarSeries();
- series->append(set0);
- series->append(set1);
- series->append(set2);
- series->append(set3);
- series->append(set4);
-
-//![2]
-
-//![3]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Simple barchart example");
- chart->setAnimationOptions(QChart::SeriesAnimations);
-//![3]
-
-//![4]
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- QBarCategoryAxis *axis = new QBarCategoryAxis();
- axis->append(categories);
- chart->createDefaultAxes();
- chart->setAxisX(axis, series);
-//![4]
-
-//![5]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
-//![5]
-
-//![6]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![6]
-
-//![7]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(420, 300);
- window.show();
-//![7]
-
- return a.exec();
-}
diff --git a/examples/barmodelmapper/tablewidget.cpp b/examples/barmodelmapper/tablewidget.cpp
deleted file mode 100644
index f31bfff9..00000000
--- a/examples/barmodelmapper/tablewidget.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tablewidget.h"
-#include "customtablemodel.h"
-#include <QGridLayout>
-#include <QTableView>
-#include <QChart>
-#include <QChartView>
-#include <QLineSeries>
-#include <QVXYModelMapper>
-#include <QBarSeries>
-#include <QBarSet>
-#include <QVBarModelMapper>
-#include <QHeaderView>
-#include <QBarCategoryAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-TableWidget::TableWidget(QWidget *parent)
- : QWidget(parent)
-{
- // create simple model for storing data
- // user's table data model
- //! [1]
- CustomTableModel *model = new CustomTableModel;
- //! [1]
-
- //! [2]
- // create table view and add model to it
- QTableView *tableView = new QTableView;
- tableView->setModel(model);
- tableView->setMinimumWidth(300);
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
- tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
- tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
-#else
- tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
- tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
-#endif
- //! [2]
-
- //! [3]
- QChart *chart = new QChart;
- chart->setAnimationOptions(QChart::AllAnimations);
- //! [3]
-
- // series 1
- //! [4]
- QBarSeries *series = new QBarSeries;
-
- int first = 3;
- int count = 5;
- QVBarModelMapper *mapper = new QVBarModelMapper(this);
- mapper->setFirstBarSetColumn(1);
- mapper->setLastBarSetColumn(4);
- mapper->setFirstRow(first);
- mapper->setRowCount(count);
- mapper->setSeries(series);
- mapper->setModel(model);
- chart->addSeries(series);
- //! [4]
-
- //! [5]
- // for storing color hex from the series
- QString seriesColorHex = "#000000";
-
- // get the color of the series and use it for showing the mapped area
- QList<QBarSet *> barsets = series->barSets();
- for (int i = 0; i < barsets.count(); i++) {
- seriesColorHex = "#" + QString::number(barsets.at(i)->brush().color().rgb(), 16).right(6).toUpper();
- model->addMapping(seriesColorHex, QRect(1 + i, first, 1, barsets.at(i)->count()));
- }
- //! [5]
-
- //! [6]
- QStringList categories;
- categories << "April" << "May" << "June" << "July" << "August";
- QBarCategoryAxis *axis = new QBarCategoryAxis();
- axis->append(categories);
- chart->createDefaultAxes();
- chart->setAxisX(axis, series);
- //! [6]
-
- //! [7]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
- chartView->setMinimumSize(640, 480);
- //! [7]
-
- //! [8]
- // create main layout
- QGridLayout *mainLayout = new QGridLayout;
- mainLayout->addWidget(tableView, 1, 0);
- mainLayout->addWidget(chartView, 1, 1);
- mainLayout->setColumnStretch(1, 1);
- mainLayout->setColumnStretch(0, 0);
- setLayout(mainLayout);
- //! [8]
-}
diff --git a/examples/boxplotchart/boxdatareader.h b/examples/boxplotchart/boxdatareader.h
deleted file mode 100644
index 8f1e9c51..00000000
--- a/examples/boxplotchart/boxdatareader.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BOXDATAREADER_H
-#define BOXDATAREADER_H
-
-#include <QTextStream>
-#include <QBoxSet>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class BoxDataReader : public QTextStream
-{
-public:
- explicit BoxDataReader(QIODevice *device);
- QBoxSet *readBox();
- void readFile(QIODevice *device);
-
-protected:
- qreal findMedian(int begin, int end);
-
-private:
- QList<qreal> sortedList;
-};
-
-#endif // BOXDATAREADER_H
diff --git a/examples/boxplotchart/main.cpp b/examples/boxplotchart/main.cpp
deleted file mode 100644
index 78ce7a54..00000000
--- a/examples/boxplotchart/main.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QBoxPlotSeries>
-#include <QBoxSet>
-#include <QLegend>
-#include <QBarCategoryAxis>
-#include <QFile>
-
-#include "boxdatareader.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- //! [1]
- QBoxPlotSeries *acmeSeries = new QBoxPlotSeries();
- acmeSeries->setName("Acme Ltd");
-
- QBoxPlotSeries *boxWhiskSeries = new QBoxPlotSeries();
- boxWhiskSeries->setName("BoxWhisk Inc");
- //! [1]
-
- //! [2]
- QFile acmeData(":acme");
- if (!acmeData.open(QIODevice::ReadOnly | QIODevice::Text))
- return 1;
-
- BoxDataReader dataReader(&acmeData);
- while (!dataReader.atEnd()) {
- QBoxSet *set = dataReader.readBox();
- if (set)
- acmeSeries->append(set);
- }
- //! [2]
-
- //! [3]
- QFile boxwhiskData(":boxwhisk");
- if (!boxwhiskData.open(QIODevice::ReadOnly | QIODevice::Text))
- return 1;
-
- dataReader.readFile(&boxwhiskData);
- while (!dataReader.atEnd()) {
- QBoxSet *set = dataReader.readBox();
- if (set)
- boxWhiskSeries->append(set);
- }
- //! [3]
-
- //! [4]
- QChart *chart = new QChart();
- chart->addSeries(acmeSeries);
- chart->addSeries(boxWhiskSeries);
- chart->setTitle("Acme Ltd and BoxWhisk Inc share deviation in 2012");
- chart->setAnimationOptions(QChart::SeriesAnimations);
- //! [4]
-
- //! [5]
- chart->createDefaultAxes();
- chart->axisY()->setMin(15.0);
- chart->axisY()->setMax(34.0);
- //! [5]
-
- //! [6]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
- //! [6]
-
- //! [7]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
- //! [7]
-
- //! [8]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(800, 600);
- window.show();
- //! [8]
-
- return a.exec();
-}
-
diff --git a/examples/areachart/areachart.pro b/examples/charts/areachart/areachart.pro
index e8e1a074..e8e1a074 100644
--- a/examples/areachart/areachart.pro
+++ b/examples/charts/areachart/areachart.pro
diff --git a/examples/charts/areachart/main.cpp b/examples/charts/areachart/main.cpp
new file mode 100644
index 00000000..6f2a1cac
--- /dev/null
+++ b/examples/charts/areachart/main.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QtCharts/QChartView>
+#include <QtCharts/QLineSeries>
+#include <QtCharts/QAreaSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QLineSeries *series0 = new QLineSeries();
+ QLineSeries *series1 = new QLineSeries();
+//![1]
+
+//![2]
+ *series0 << QPointF(1, 5) << QPointF(3, 7) << QPointF(7, 6) << QPointF(9, 7) << QPointF(12, 6)
+ << QPointF(16, 7) << QPointF(18, 5);
+ *series1 << QPointF(1, 3) << QPointF(3, 4) << QPointF(7, 3) << QPointF(8, 2) << QPointF(12, 3)
+ << QPointF(16, 4) << QPointF(18, 3);
+//![2]
+
+//![3]
+ QAreaSeries *series = new QAreaSeries(series0, series1);
+ series->setName("Batman");
+ QPen pen(0x059605);
+ pen.setWidth(3);
+ series->setPen(pen);
+
+ QLinearGradient gradient(QPointF(0, 0), QPointF(0, 1));
+ gradient.setColorAt(0.0, 0x3cc63c);
+ gradient.setColorAt(1.0, 0x26f626);
+ gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ series->setBrush(gradient);
+//![3]
+
+//![4]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->setTitle("Simple areachart example");
+ chart->createDefaultAxes();
+ chart->axisX()->setRange(0, 20);
+ chart->axisY()->setRange(0, 10);
+//![4]
+
+//![5]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![5]
+
+//![6]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.show();
+//![6]
+
+ return a.exec();
+}
diff --git a/examples/charts/audio/audio.pro b/examples/charts/audio/audio.pro
new file mode 100644
index 00000000..6a3b6917
--- /dev/null
+++ b/examples/charts/audio/audio.pro
@@ -0,0 +1,15 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+QT += multimedia
+
+TARGET = audio
+TEMPLATE = app
+
+SOURCES += main.cpp\
+ widget.cpp \
+ xyseriesiodevice.cpp
+
+HEADERS += widget.h \
+ xyseriesiodevice.h
diff --git a/demos/audio/main.cpp b/examples/charts/audio/main.cpp
index dd9069df..dd9069df 100644
--- a/demos/audio/main.cpp
+++ b/examples/charts/audio/main.cpp
diff --git a/examples/charts/audio/widget.cpp b/examples/charts/audio/widget.cpp
new file mode 100644
index 00000000..6cd5d442
--- /dev/null
+++ b/examples/charts/audio/widget.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "widget.h"
+#include <QAudioDeviceInfo>
+#include <QAudioInput>
+#include <QChartView>
+#include <QLineSeries>
+#include <QChart>
+#include <QVBoxLayout>
+#include <QValueAxis>
+#include "xyseriesiodevice.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+Widget::Widget(QWidget *parent)
+ : QWidget(parent),
+ m_device(0),
+ m_chart(0),
+ m_series(0),
+ m_audioInput(0)
+{
+ m_chart = new QChart;
+ QChartView *chartView = new QChartView(m_chart);
+ chartView->setMinimumSize(800, 600);
+ m_series = new QLineSeries;
+ m_chart->addSeries(m_series);
+ QValueAxis *axisX = new QValueAxis;
+ axisX->setRange(0, 2000);
+ axisX->setLabelFormat("%g");
+ axisX->setTitleText("Samples");
+ QValueAxis *axisY = new QValueAxis;
+ axisY->setRange(-1, 1);
+ axisY->setTitleText("Audio level");
+ m_chart->setAxisX(axisX, m_series);
+ m_chart->setAxisY(axisY, m_series);
+ m_chart->legend()->hide();
+ m_chart->setTitle("Data from the microphone");
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(chartView);
+ setLayout(mainLayout);
+
+ QAudioFormat formatAudio;
+ formatAudio.setSampleRate(8000);
+ formatAudio.setChannelCount(1);
+ formatAudio.setSampleSize(8);
+ formatAudio.setCodec("audio/pcm");
+ formatAudio.setByteOrder(QAudioFormat::LittleEndian);
+ formatAudio.setSampleType(QAudioFormat::UnSignedInt);
+
+ QAudioDeviceInfo inputDevices = QAudioDeviceInfo::defaultInputDevice();
+ m_audioInput = new QAudioInput(inputDevices,formatAudio, this);
+
+ m_device = new XYSeriesIODevice(m_series, this);
+ m_device->open(QIODevice::WriteOnly);
+
+ m_audioInput->start(m_device);
+}
+
+Widget::~Widget()
+{
+ m_audioInput->stop();
+ m_device->close();
+}
diff --git a/examples/charts/audio/widget.h b/examples/charts/audio/widget.h
new file mode 100644
index 00000000..6f745069
--- /dev/null
+++ b/examples/charts/audio/widget.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include <QWidget>
+#include <QChartGlobal>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QLineSeries;
+class QChart;
+QT_CHARTS_END_NAMESPACE
+
+QT_CHARTS_USE_NAMESPACE
+
+class XYSeriesIODevice;
+class QAudioInput;
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Widget(QWidget *parent = 0);
+ ~Widget();
+
+private:
+ XYSeriesIODevice *m_device;
+ QChart *m_chart;
+ QLineSeries *m_series;
+ QAudioInput *m_audioInput;
+};
+
+#endif // WIDGET_H
diff --git a/demos/audio/xyseriesiodevice.cpp b/examples/charts/audio/xyseriesiodevice.cpp
index 5440771f..5440771f 100644
--- a/demos/audio/xyseriesiodevice.cpp
+++ b/examples/charts/audio/xyseriesiodevice.cpp
diff --git a/examples/charts/audio/xyseriesiodevice.h b/examples/charts/audio/xyseriesiodevice.h
new file mode 100644
index 00000000..6e504b08
--- /dev/null
+++ b/examples/charts/audio/xyseriesiodevice.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef XYSERIESIODEVICE_H
+#define XYSERIESIODEVICE_H
+
+#include <QIODevice>
+#include <QChartGlobal>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QXYSeries;
+QT_CHARTS_END_NAMESPACE
+
+QT_CHARTS_USE_NAMESPACE
+
+class XYSeriesIODevice : public QIODevice
+{
+ Q_OBJECT
+public:
+ explicit XYSeriesIODevice(QXYSeries * series, QObject *parent = 0);
+
+protected:
+ qint64 readData(char * data, qint64 maxSize);
+ qint64 writeData(const char * data, qint64 maxSize);
+
+private:
+ QXYSeries *m_series;
+};
+
+#endif // XYSERIESIODEVICE_H
diff --git a/examples/barchart/barchart.pro b/examples/charts/barchart/barchart.pro
index 14db3c88..14db3c88 100644
--- a/examples/barchart/barchart.pro
+++ b/examples/charts/barchart/barchart.pro
diff --git a/examples/charts/barchart/main.cpp b/examples/charts/barchart/main.cpp
new file mode 100644
index 00000000..a0e3cd89
--- /dev/null
+++ b/examples/charts/barchart/main.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QBarSeries>
+#include <QBarSet>
+#include <QLegend>
+#include <QBarCategoryAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QBarSet *set0 = new QBarSet("Jane");
+ QBarSet *set1 = new QBarSet("John");
+ QBarSet *set2 = new QBarSet("Axel");
+ QBarSet *set3 = new QBarSet("Mary");
+ QBarSet *set4 = new QBarSet("Samantha");
+
+ *set0 << 1 << 2 << 3 << 4 << 5 << 6;
+ *set1 << 5 << 0 << 0 << 4 << 0 << 7;
+ *set2 << 3 << 5 << 8 << 13 << 8 << 5;
+ *set3 << 5 << 6 << 7 << 3 << 4 << 5;
+ *set4 << 9 << 7 << 5 << 3 << 1 << 2;
+//![1]
+
+//![2]
+ QBarSeries *series = new QBarSeries();
+ series->append(set0);
+ series->append(set1);
+ series->append(set2);
+ series->append(set3);
+ series->append(set4);
+
+//![2]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->setTitle("Simple barchart example");
+ chart->setAnimationOptions(QChart::SeriesAnimations);
+//![3]
+
+//![4]
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
+ QBarCategoryAxis *axis = new QBarCategoryAxis();
+ axis->append(categories);
+ chart->createDefaultAxes();
+ chart->setAxisX(axis, series);
+//![4]
+
+//![5]
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
+//![5]
+
+//![6]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![6]
+
+//![7]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(420, 300);
+ window.show();
+//![7]
+
+ return a.exec();
+}
diff --git a/examples/barmodelmapper/barmodelmapper.pro b/examples/charts/barmodelmapper/barmodelmapper.pro
index 91b8f367..91b8f367 100644
--- a/examples/barmodelmapper/barmodelmapper.pro
+++ b/examples/charts/barmodelmapper/barmodelmapper.pro
diff --git a/examples/barmodelmapper/customtablemodel.cpp b/examples/charts/barmodelmapper/customtablemodel.cpp
index 3ec58384..3ec58384 100644
--- a/examples/barmodelmapper/customtablemodel.cpp
+++ b/examples/charts/barmodelmapper/customtablemodel.cpp
diff --git a/examples/barmodelmapper/customtablemodel.h b/examples/charts/barmodelmapper/customtablemodel.h
index 755f4c7d..755f4c7d 100644
--- a/examples/barmodelmapper/customtablemodel.h
+++ b/examples/charts/barmodelmapper/customtablemodel.h
diff --git a/examples/barmodelmapper/main.cpp b/examples/charts/barmodelmapper/main.cpp
index bf0b384b..bf0b384b 100644
--- a/examples/barmodelmapper/main.cpp
+++ b/examples/charts/barmodelmapper/main.cpp
diff --git a/examples/charts/barmodelmapper/tablewidget.cpp b/examples/charts/barmodelmapper/tablewidget.cpp
new file mode 100644
index 00000000..81e881e9
--- /dev/null
+++ b/examples/charts/barmodelmapper/tablewidget.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tablewidget.h"
+#include "customtablemodel.h"
+#include <QGridLayout>
+#include <QTableView>
+#include <QChart>
+#include <QChartView>
+#include <QLineSeries>
+#include <QVXYModelMapper>
+#include <QBarSeries>
+#include <QBarSet>
+#include <QVBarModelMapper>
+#include <QHeaderView>
+#include <QBarCategoryAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+TableWidget::TableWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ // create simple model for storing data
+ // user's table data model
+ //! [1]
+ CustomTableModel *model = new CustomTableModel;
+ //! [1]
+
+ //! [2]
+ // create table view and add model to it
+ QTableView *tableView = new QTableView;
+ tableView->setModel(model);
+ tableView->setMinimumWidth(300);
+ tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
+ tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
+ //! [2]
+
+ //! [3]
+ QChart *chart = new QChart;
+ chart->setAnimationOptions(QChart::AllAnimations);
+ //! [3]
+
+ // series 1
+ //! [4]
+ QBarSeries *series = new QBarSeries;
+
+ int first = 3;
+ int count = 5;
+ QVBarModelMapper *mapper = new QVBarModelMapper(this);
+ mapper->setFirstBarSetColumn(1);
+ mapper->setLastBarSetColumn(4);
+ mapper->setFirstRow(first);
+ mapper->setRowCount(count);
+ mapper->setSeries(series);
+ mapper->setModel(model);
+ chart->addSeries(series);
+ //! [4]
+
+ //! [5]
+ // for storing color hex from the series
+ QString seriesColorHex = "#000000";
+
+ // get the color of the series and use it for showing the mapped area
+ QList<QBarSet *> barsets = series->barSets();
+ for (int i = 0; i < barsets.count(); i++) {
+ seriesColorHex = "#" + QString::number(barsets.at(i)->brush().color().rgb(), 16).right(6).toUpper();
+ model->addMapping(seriesColorHex, QRect(1 + i, first, 1, barsets.at(i)->count()));
+ }
+ //! [5]
+
+ //! [6]
+ QStringList categories;
+ categories << "April" << "May" << "June" << "July" << "August";
+ QBarCategoryAxis *axis = new QBarCategoryAxis();
+ axis->append(categories);
+ chart->createDefaultAxes();
+ chart->setAxisX(axis, series);
+ //! [6]
+
+ //! [7]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+ chartView->setMinimumSize(640, 480);
+ //! [7]
+
+ //! [8]
+ // create main layout
+ QGridLayout *mainLayout = new QGridLayout;
+ mainLayout->addWidget(tableView, 1, 0);
+ mainLayout->addWidget(chartView, 1, 1);
+ mainLayout->setColumnStretch(1, 1);
+ mainLayout->setColumnStretch(0, 0);
+ setLayout(mainLayout);
+ //! [8]
+}
diff --git a/examples/barmodelmapper/tablewidget.h b/examples/charts/barmodelmapper/tablewidget.h
index 3846cc11..3846cc11 100644
--- a/examples/barmodelmapper/tablewidget.h
+++ b/examples/charts/barmodelmapper/tablewidget.h
diff --git a/examples/boxplotchart/acme_data.txt b/examples/charts/boxplotchart/acme_data.txt
index 9511418d..9511418d 100644
--- a/examples/boxplotchart/acme_data.txt
+++ b/examples/charts/boxplotchart/acme_data.txt
diff --git a/examples/boxplotchart/boxdatareader.cpp b/examples/charts/boxplotchart/boxdatareader.cpp
index ba2d8b3a..ba2d8b3a 100644
--- a/examples/boxplotchart/boxdatareader.cpp
+++ b/examples/charts/boxplotchart/boxdatareader.cpp
diff --git a/examples/charts/boxplotchart/boxdatareader.h b/examples/charts/boxplotchart/boxdatareader.h
new file mode 100644
index 00000000..5dbddc14
--- /dev/null
+++ b/examples/charts/boxplotchart/boxdatareader.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BOXDATAREADER_H
+#define BOXDATAREADER_H
+
+#include <QTextStream>
+#include <QBoxSet>
+
+QT_CHARTS_USE_NAMESPACE
+
+class BoxDataReader : public QTextStream
+{
+public:
+ explicit BoxDataReader(QIODevice *device);
+ QBoxSet *readBox();
+ void readFile(QIODevice *device);
+
+protected:
+ qreal findMedian(int begin, int end);
+
+private:
+ QList<qreal> sortedList;
+};
+
+#endif // BOXDATAREADER_H
diff --git a/examples/boxplotchart/boxplotchart.pro b/examples/charts/boxplotchart/boxplotchart.pro
index c2483511..c2483511 100644
--- a/examples/boxplotchart/boxplotchart.pro
+++ b/examples/charts/boxplotchart/boxplotchart.pro
diff --git a/examples/boxplotchart/boxplotdata.qrc b/examples/charts/boxplotchart/boxplotdata.qrc
index fe6d52b5..fe6d52b5 100644
--- a/examples/boxplotchart/boxplotdata.qrc
+++ b/examples/charts/boxplotchart/boxplotdata.qrc
diff --git a/examples/boxplotchart/boxwhisk_data.txt b/examples/charts/boxplotchart/boxwhisk_data.txt
index f1d49cf0..f1d49cf0 100644
--- a/examples/boxplotchart/boxwhisk_data.txt
+++ b/examples/charts/boxplotchart/boxwhisk_data.txt
diff --git a/examples/charts/boxplotchart/main.cpp b/examples/charts/boxplotchart/main.cpp
new file mode 100644
index 00000000..802217e1
--- /dev/null
+++ b/examples/charts/boxplotchart/main.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QBoxPlotSeries>
+#include <QBoxSet>
+#include <QLegend>
+#include <QBarCategoryAxis>
+#include <QFile>
+
+#include "boxdatareader.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ //! [1]
+ QBoxPlotSeries *acmeSeries = new QBoxPlotSeries();
+ acmeSeries->setName("Acme Ltd");
+
+ QBoxPlotSeries *boxWhiskSeries = new QBoxPlotSeries();
+ boxWhiskSeries->setName("BoxWhisk Inc");
+ //! [1]
+
+ //! [2]
+ QFile acmeData(":acme");
+ if (!acmeData.open(QIODevice::ReadOnly | QIODevice::Text))
+ return 1;
+
+ BoxDataReader dataReader(&acmeData);
+ while (!dataReader.atEnd()) {
+ QBoxSet *set = dataReader.readBox();
+ if (set)
+ acmeSeries->append(set);
+ }
+ //! [2]
+
+ //! [3]
+ QFile boxwhiskData(":boxwhisk");
+ if (!boxwhiskData.open(QIODevice::ReadOnly | QIODevice::Text))
+ return 1;
+
+ dataReader.readFile(&boxwhiskData);
+ while (!dataReader.atEnd()) {
+ QBoxSet *set = dataReader.readBox();
+ if (set)
+ boxWhiskSeries->append(set);
+ }
+ //! [3]
+
+ //! [4]
+ QChart *chart = new QChart();
+ chart->addSeries(acmeSeries);
+ chart->addSeries(boxWhiskSeries);
+ chart->setTitle("Acme Ltd and BoxWhisk Inc share deviation in 2012");
+ chart->setAnimationOptions(QChart::SeriesAnimations);
+ //! [4]
+
+ //! [5]
+ chart->createDefaultAxes();
+ chart->axisY()->setMin(15.0);
+ chart->axisY()->setMax(34.0);
+ //! [5]
+
+ //! [6]
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
+ //! [6]
+
+ //! [7]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+ //! [7]
+
+ //! [8]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(800, 600);
+ window.show();
+ //! [8]
+
+ return a.exec();
+}
+
diff --git a/demos/callout/callout.cpp b/examples/charts/callout/callout.cpp
index 2491368f..2491368f 100644
--- a/demos/callout/callout.cpp
+++ b/examples/charts/callout/callout.cpp
diff --git a/demos/callout/callout.h b/examples/charts/callout/callout.h
index 23fc8484..23fc8484 100644
--- a/demos/callout/callout.h
+++ b/examples/charts/callout/callout.h
diff --git a/examples/charts/callout/callout.pro b/examples/charts/callout/callout.pro
new file mode 100644
index 00000000..b0da66d6
--- /dev/null
+++ b/examples/charts/callout/callout.pro
@@ -0,0 +1,15 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+TARGET = callout
+TEMPLATE = app
+
+SOURCES += \
+ main.cpp\
+ callout.cpp \
+ view.cpp
+
+HEADERS += \
+ callout.h \
+ view.h
diff --git a/demos/callout/main.cpp b/examples/charts/callout/main.cpp
index a6dfc2e9..a6dfc2e9 100644
--- a/demos/callout/main.cpp
+++ b/examples/charts/callout/main.cpp
diff --git a/demos/callout/view.cpp b/examples/charts/callout/view.cpp
index a7c43863..a7c43863 100644
--- a/demos/callout/view.cpp
+++ b/examples/charts/callout/view.cpp
diff --git a/examples/charts/callout/view.h b/examples/charts/callout/view.h
new file mode 100644
index 00000000..3a322382
--- /dev/null
+++ b/examples/charts/callout/view.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef VIEW_H
+#define VIEW_H
+#include <QGraphicsView>
+#include <QChartGlobal>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QChart;
+QT_CHARTS_END_NAMESPACE
+
+class QGraphicsScene;
+class QResizeEvent;
+class Callout;
+class QMouseEvent;
+
+QT_CHARTS_USE_NAMESPACE
+
+class View: public QGraphicsView
+{
+ Q_OBJECT
+
+public:
+ View(QWidget *parent = 0);
+
+protected:
+ void resizeEvent(QResizeEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+
+public slots:
+ void keepCallout();
+ void tooltip(QPointF point, bool state);
+
+private:
+ QGraphicsSimpleTextItem *m_coordX;
+ QGraphicsSimpleTextItem *m_coordY;
+ QChart *m_chart;
+ Callout *m_tooltip;
+};
+
+#endif
diff --git a/demos/chartinteractions/chart.cpp b/examples/charts/chartinteractions/chart.cpp
index 8aa2a443..8aa2a443 100644
--- a/demos/chartinteractions/chart.cpp
+++ b/examples/charts/chartinteractions/chart.cpp
diff --git a/examples/charts/chartinteractions/chart.h b/examples/charts/chartinteractions/chart.h
new file mode 100644
index 00000000..9a10387b
--- /dev/null
+++ b/examples/charts/chartinteractions/chart.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHART_H
+#define CHART_H
+
+#include <QChart>
+#include <QLineSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+class Chart : public QChart
+{
+ Q_OBJECT
+public:
+ explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0, QLineSeries *series = 0);
+ ~Chart();
+
+public slots:
+ void clickPoint(const QPointF &point);
+
+public:
+ void handlePointMove(const QPoint &point);
+ void setPointClicked(bool clicked);
+
+private:
+ qreal distance(const QPointF &p1, const QPointF &p2);
+ QLineSeries *m_series;
+ QPointF m_movingPoint;
+
+ //Boolean value to determine if an actual point in the
+ //series is clicked.
+ bool m_clicked;
+};
+
+#endif // CHART_H
diff --git a/examples/charts/chartinteractions/chartinteractions.pro b/examples/charts/chartinteractions/chartinteractions.pro
new file mode 100644
index 00000000..8cf4c36c
--- /dev/null
+++ b/examples/charts/chartinteractions/chartinteractions.pro
@@ -0,0 +1,11 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+QT += core gui
+
+TARGET = chartinteractions
+TEMPLATE = app
+
+HEADERS += chart.h chartview.h
+SOURCES += main.cpp chart.cpp chartview.cpp
diff --git a/demos/chartinteractions/chartview.cpp b/examples/charts/chartinteractions/chartview.cpp
index 95fae6cd..95fae6cd 100644
--- a/demos/chartinteractions/chartview.cpp
+++ b/examples/charts/chartinteractions/chartview.cpp
diff --git a/examples/charts/chartinteractions/chartview.h b/examples/charts/chartinteractions/chartview.h
new file mode 100644
index 00000000..931feee0
--- /dev/null
+++ b/examples/charts/chartinteractions/chartview.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHARTVIEW_H
+#define CHARTVIEW_H
+
+#include <QChartView>
+
+class Chart;
+
+QT_CHARTS_USE_NAMESPACE
+
+class ChartView : public QChartView
+{
+public:
+ ChartView(Chart *chart, QWidget *parent = 0);
+
+protected:
+ void mousePressEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+
+private:
+ Chart *m_chart;
+ QPoint m_mousePos;
+};
+
+#endif
diff --git a/examples/charts/chartinteractions/main.cpp b/examples/charts/chartinteractions/main.cpp
new file mode 100644
index 00000000..67cfb800
--- /dev/null
+++ b/examples/charts/chartinteractions/main.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QLineSeries>
+
+#include <QValueAxis>
+
+#include "chart.h"
+#include "chartview.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ QLineSeries *series = new QLineSeries();
+
+ series->append(0, 6);
+ series->append(1, 3);
+ series->append(2, 4);
+ series->append(3, 8);
+ series->append(7, 13);
+ series->append(10, 5);
+ *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
+
+ Chart *chart = new Chart(0, 0, series);
+ chart->legend()->hide();
+ chart->addSeries(series);
+ QPen p = series->pen();
+ p.setWidth(5);
+ series->setPen(p);
+ chart->createDefaultAxes();
+ chart->setTitle("Drag'n drop to move data points");
+
+ QValueAxis *axisX = new QValueAxis();
+ chart->setAxisX(axisX, series);
+ axisX->setRange(0, 20);
+
+ QValueAxis *axisY = new QValueAxis();
+ chart->setAxisY(axisY, series);
+ axisY->setRange(0, 13);
+
+ QObject::connect(series, SIGNAL(clicked(QPointF)), chart, SLOT(clickPoint(QPointF)));
+
+ ChartView *chartView = new ChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.show();
+
+ return a.exec();
+}
diff --git a/examples/charts/charts.pro b/examples/charts/charts.pro
new file mode 100644
index 00000000..e9d3e0e8
--- /dev/null
+++ b/examples/charts/charts.pro
@@ -0,0 +1,60 @@
+TEMPLATE = subdirs
+SUBDIRS += areachart \
+ customchart \
+ linechart \
+ percentbarchart \
+ piechart \
+ piechartdrilldown \
+ scatterchart \
+ scatterinteractions \
+ splinechart \
+ stackedbarchart \
+ stackedbarchartdrilldown \
+ zoomlinechart \
+ modeldata \
+ barchart \
+ boxplotchart \
+ legend \
+ barmodelmapper \
+ lineandbar \
+ horizontalbarchart \
+ horizontalstackedbarchart \
+ horizontalpercentbarchart \
+ donutbreakdown \
+ temperaturerecords \
+ donutchart \
+ multiaxis \
+ legendmarkers \
+ logvalueaxis \
+ polarchart \
+ piechartcustomization \
+ dynamicspline \
+ nesteddonuts \
+ chartinteractions \
+ callout \
+ chartthemes
+
+qtHaveModule(quick) {
+ SUBDIRS += qmlboxplot \
+ qmlpiechart \
+ qmlweather \
+ qmlf1legends \
+ qmlcustomizations \
+ qmlaxes \
+ qmlcustomlegend \
+ qmlpolarchart \
+ qmlchart \
+ qmloscilloscope
+}
+
+contains(QT_CONFIG, multimedia) {
+ SUBDIRS += audio
+} else {
+ message("QtMultimedia library not available. Some examples are disabled")
+}
+
+!linux-arm*: {
+SUBDIRS += \
+ datetimeaxis
+}
+
diff --git a/examples/charts/chartthemes/chartthemes.pro b/examples/charts/chartthemes/chartthemes.pro
new file mode 100644
index 00000000..2a414557
--- /dev/null
+++ b/examples/charts/chartthemes/chartthemes.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+TARGET = chartthemes
+SOURCES = main.cpp themewidget.cpp
+HEADERS = themewidget.h
diff --git a/demos/chartthemes/main.cpp b/examples/charts/chartthemes/main.cpp
index 5bc1af84..5bc1af84 100644
--- a/demos/chartthemes/main.cpp
+++ b/examples/charts/chartthemes/main.cpp
diff --git a/demos/chartthemes/themewidget.cpp b/examples/charts/chartthemes/themewidget.cpp
index d1b0051b..d1b0051b 100644
--- a/demos/chartthemes/themewidget.cpp
+++ b/examples/charts/chartthemes/themewidget.cpp
diff --git a/examples/charts/chartthemes/themewidget.h b/examples/charts/chartthemes/themewidget.h
new file mode 100644
index 00000000..d1a4d997
--- /dev/null
+++ b/examples/charts/chartthemes/themewidget.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef THEMEWIDGET_H
+#define THEMEWIDGET_H
+
+#include <QWidget>
+#include <QChartGlobal>
+
+class QComboBox;
+class QCheckBox;
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QChartView;
+class QChart;
+QT_CHARTS_END_NAMESPACE
+
+typedef QPair<QPointF, QString> Data;
+typedef QList<Data> DataList;
+typedef QList<DataList> DataTable;
+
+QT_CHARTS_USE_NAMESPACE
+
+class ThemeWidget: public QWidget
+{
+ Q_OBJECT
+public:
+ explicit ThemeWidget(QWidget *parent = 0);
+ ~ThemeWidget();
+
+private Q_SLOTS:
+ void updateUI();
+
+private:
+ DataTable generateRandomData(int listCount, int valueMax, int valueCount) const;
+ QComboBox *createThemeBox() const;
+ QComboBox *createAnimationBox() const;
+ QComboBox *createLegendBox() const;
+ void connectSignals();
+ QChart *createAreaChart() const;
+ QChart *createBarChart(int valueCount) const;
+ QChart *createPieChart() const;
+ QChart *createLineChart() const;
+ QChart *createSplineChart() const;
+ QChart *createScatterChart() const;
+
+private:
+ int m_listCount;
+ int m_valueMax;
+ int m_valueCount;
+ QList<QChartView *> m_charts;
+ DataTable m_dataTable;
+
+ QComboBox *m_themeComboBox;
+ QCheckBox *m_antialiasCheckBox;
+ QComboBox *m_animatedComboBox;
+ QComboBox *m_legendComboBox;
+};
+
+#endif /* THEMEWIDGET_H */
diff --git a/examples/customchart/customchart.pro b/examples/charts/customchart/customchart.pro
index 5f3f7382..5f3f7382 100644
--- a/examples/customchart/customchart.pro
+++ b/examples/charts/customchart/customchart.pro
diff --git a/examples/charts/customchart/main.cpp b/examples/charts/customchart/main.cpp
new file mode 100644
index 00000000..8a35dfb1
--- /dev/null
+++ b/examples/charts/customchart/main.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QLineSeries>
+#include <QCategoryAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QLineSeries *series = new QLineSeries();
+ *series << QPointF(0, 6) << QPointF(9, 4) << QPointF(15, 20) << QPointF(25, 12) << QPointF(29, 26);
+ QChart *chart = new QChart();
+ chart->legend()->hide();
+ chart->addSeries(series);
+//![1]
+
+//![2]
+ // Customize series
+ QPen pen(QRgb(0xfdb157));
+ pen.setWidth(5);
+ series->setPen(pen);
+
+ // Customize chart title
+ QFont font;
+ font.setPixelSize(18);
+ chart->setTitleFont(font);
+ chart->setTitleBrush(QBrush(Qt::white));
+ chart->setTitle("Customchart example");
+
+ // Customize chart background
+ QLinearGradient backgroundGradient;
+ backgroundGradient.setStart(QPointF(0, 0));
+ backgroundGradient.setFinalStop(QPointF(0, 1));
+ backgroundGradient.setColorAt(0.0, QRgb(0xd2d0d1));
+ backgroundGradient.setColorAt(1.0, QRgb(0x4c4547));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ chart->setBackgroundBrush(backgroundGradient);
+
+ // Customize plot area background
+ QLinearGradient plotAreaGradient;
+ plotAreaGradient.setStart(QPointF(0, 1));
+ plotAreaGradient.setFinalStop(QPointF(1, 0));
+ plotAreaGradient.setColorAt(0.0, QRgb(0x555555));
+ plotAreaGradient.setColorAt(1.0, QRgb(0x55aa55));
+ plotAreaGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ chart->setPlotAreaBackgroundBrush(plotAreaGradient);
+ chart->setPlotAreaBackgroundVisible(true);
+//![2]
+
+//![3]
+ QCategoryAxis *axisX = new QCategoryAxis();
+ QCategoryAxis *axisY = new QCategoryAxis();
+
+ // Customize axis label font
+ QFont labelsFont;
+ labelsFont.setPixelSize(12);
+ axisX->setLabelsFont(labelsFont);
+ axisY->setLabelsFont(labelsFont);
+
+ // Customize axis colors
+ QPen axisPen(QRgb(0xd18952));
+ axisPen.setWidth(2);
+ axisX->setLinePen(axisPen);
+ axisY->setLinePen(axisPen);
+
+ // Customize axis label colors
+ QBrush axisBrush(Qt::white);
+ axisX->setLabelsBrush(axisBrush);
+ axisY->setLabelsBrush(axisBrush);
+
+ // Customize grid lines and shades
+ axisX->setGridLineVisible(false);
+ axisY->setGridLineVisible(false);
+ axisY->setShadesPen(Qt::NoPen);
+ axisY->setShadesBrush(QBrush(QColor(0x99, 0xcc, 0xcc, 0x55)));
+ axisY->setShadesVisible(true);
+//![3]
+
+//![4]
+ axisX->append("low", 10);
+ axisX->append("optimal", 20);
+ axisX->append("high", 30);
+ axisX->setRange(0, 30);
+
+ axisY->append("slow", 10);
+ axisY->append("med", 20);
+ axisY->append("fast", 30);
+ axisY->setRange(0, 30);
+
+ chart->setAxisX(axisX, series);
+ chart->setAxisY(axisY, series);
+//![4]
+
+//![5]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![5]
+
+//![6]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.show();
+//![6]
+
+ return a.exec();
+}
diff --git a/examples/datetimeaxis/datetimeaxis.pro b/examples/charts/datetimeaxis/datetimeaxis.pro
index 0ec9d715..0ec9d715 100644
--- a/examples/datetimeaxis/datetimeaxis.pro
+++ b/examples/charts/datetimeaxis/datetimeaxis.pro
diff --git a/examples/charts/datetimeaxis/main.cpp b/examples/charts/datetimeaxis/main.cpp
new file mode 100644
index 00000000..988b74f2
--- /dev/null
+++ b/examples/charts/datetimeaxis/main.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QLineSeries>
+#include <QDateTime>
+#include <QDateTimeAxis>
+#include <QFile>
+#include <QTextStream>
+#include <QDebug>
+#include <QValueAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
+
+ //![1]
+ QLineSeries *series = new QLineSeries();
+ //![1]
+
+ //![2]
+ // data from http://www.swpc.noaa.gov/ftpdir/weekly/RecentIndices.txt
+ // http://www.swpc.noaa.gov/ftpdir/weekly/README
+ // http://www.weather.gov/disclaimer
+ QFile sunSpots(":sun");
+ if (!sunSpots.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ return 1;
+ }
+
+ QTextStream stream(&sunSpots);
+ while (!stream.atEnd()) {
+ QString line = stream.readLine();
+ if (line.startsWith("#") || line.startsWith(":"))
+ continue;
+ QStringList values = line.split(" ", QString::SkipEmptyParts);
+ QDateTime momentInTime;
+ momentInTime.setDate(QDate(values[0].toInt(), values[1].toInt() , 15));
+ series->append(momentInTime.toMSecsSinceEpoch(), values[2].toDouble());
+ }
+ sunSpots.close();
+ //![2]
+
+ //![3]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->legend()->hide();
+ chart->setTitle("Sunspots count (by Space Weather Prediction Center)");
+ //![3]
+
+ //![4]
+ QDateTimeAxis *axisX = new QDateTimeAxis;
+ axisX->setTickCount(10);
+ axisX->setFormat("MMM yyyy");
+ axisX->setTitleText("Date");
+ chart->addAxis(axisX, Qt::AlignBottom);
+ series->attachAxis(axisX);
+
+ QValueAxis *axisY = new QValueAxis;
+ axisY->setLabelFormat("%i");
+ axisY->setTitleText("Sunspots count");
+ chart->addAxis(axisY, Qt::AlignLeft);
+ series->attachAxis(axisY);
+ //![4]
+
+ //![5]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+ //![5]
+
+ //![6]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(820, 600);
+ window.show();
+ //![6]
+
+ return a.exec();
+}
diff --git a/examples/datetimeaxis/sun_spots.txt b/examples/charts/datetimeaxis/sun_spots.txt
index 91ef5982..91ef5982 100644
--- a/examples/datetimeaxis/sun_spots.txt
+++ b/examples/charts/datetimeaxis/sun_spots.txt
diff --git a/examples/datetimeaxis/sundata.qrc b/examples/charts/datetimeaxis/sundata.qrc
index 318be590..318be590 100644
--- a/examples/datetimeaxis/sundata.qrc
+++ b/examples/charts/datetimeaxis/sundata.qrc
diff --git a/examples/donutbreakdown/donutbreakdown.pro b/examples/charts/donutbreakdown/donutbreakdown.pro
index fecef7b8..fecef7b8 100644
--- a/examples/donutbreakdown/donutbreakdown.pro
+++ b/examples/charts/donutbreakdown/donutbreakdown.pro
diff --git a/examples/charts/donutbreakdown/donutbreakdownchart.cpp b/examples/charts/donutbreakdown/donutbreakdownchart.cpp
new file mode 100644
index 00000000..5272f105
--- /dev/null
+++ b/examples/charts/donutbreakdown/donutbreakdownchart.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "donutbreakdownchart.h"
+#include "mainslice.h"
+#include <QPieSlice>
+#include <QPieLegendMarker>
+
+QT_CHARTS_USE_NAMESPACE
+
+//![1]
+DonutBreakdownChart::DonutBreakdownChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
+ : QChart(QChart::ChartTypeCartesian, parent, wFlags)
+{
+ // create the series for main center pie
+ m_mainSeries = new QPieSeries();
+ m_mainSeries->setPieSize(0.7);
+ QChart::addSeries(m_mainSeries);
+}
+//![1]
+
+//![2]
+void DonutBreakdownChart::addBreakdownSeries(QPieSeries *breakdownSeries, QColor color)
+{
+ QFont font("Arial", 8);
+
+ // add breakdown series as a slice to center pie
+ MainSlice *mainSlice = new MainSlice(breakdownSeries);
+ mainSlice->setName(breakdownSeries->name());
+ mainSlice->setValue(breakdownSeries->sum());
+ m_mainSeries->append(mainSlice);
+
+ // customize the slice
+ mainSlice->setBrush(color);
+ mainSlice->setLabelVisible();
+ mainSlice->setLabelColor(Qt::white);
+ mainSlice->setLabelPosition(QPieSlice::LabelInsideHorizontal);
+ mainSlice->setLabelFont(font);
+
+ // position and customize the breakdown series
+ breakdownSeries->setPieSize(0.8);
+ breakdownSeries->setHoleSize(0.7);
+ breakdownSeries->setLabelsVisible();
+ foreach (QPieSlice *slice, breakdownSeries->slices()) {
+ color = color.lighter(115);
+ slice->setBrush(color);
+ slice->setLabelFont(font);
+ }
+
+ // add the series to the chart
+ QChart::addSeries(breakdownSeries);
+
+ // recalculate breakdown donut segments
+ recalculateAngles();
+
+ // update customize legend markers
+ updateLegendMarkers();
+}
+//![2]
+
+//![3]
+void DonutBreakdownChart::recalculateAngles()
+{
+ qreal angle = 0;
+ foreach (QPieSlice *slice, m_mainSeries->slices()) {
+ QPieSeries *breakdownSeries = qobject_cast<MainSlice *>(slice)->breakdownSeries();
+ breakdownSeries->setPieStartAngle(angle);
+ angle += slice->percentage() * 360.0; // full pie is 360.0
+ breakdownSeries->setPieEndAngle(angle);
+ }
+}
+//![3]
+
+//![4]
+void DonutBreakdownChart::updateLegendMarkers()
+{
+ // go through all markers
+ foreach (QAbstractSeries *series, QChart::series()) {
+ foreach (QLegendMarker *marker, legend()->markers(series)) {
+ QPieLegendMarker *pieMarker = qobject_cast<QPieLegendMarker *>(marker);
+ if (series == m_mainSeries) {
+ // hide markers from main series
+ pieMarker->setVisible(false);
+ } else {
+ // modify markers from breakdown series
+ pieMarker->setLabel(QString("%1 %2%")
+ .arg(pieMarker->slice()->label())
+ .arg(pieMarker->slice()->percentage() * 100, 0, 'f', 2));
+ pieMarker->setFont(QFont("Arial", 8));
+ }
+ }
+ }
+}
+//![4]
diff --git a/examples/charts/donutbreakdown/donutbreakdownchart.h b/examples/charts/donutbreakdown/donutbreakdownchart.h
new file mode 100644
index 00000000..71b3ecf4
--- /dev/null
+++ b/examples/charts/donutbreakdown/donutbreakdownchart.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef DONUTBREAKDOWNCHART_H
+#define DONUTBREAKDOWNCHART_H
+
+#include <QChart>
+#include <QPieSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+class DonutBreakdownChart : public QChart
+{
+public:
+ DonutBreakdownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
+ void addBreakdownSeries(QPieSeries *series, QColor color);
+
+private:
+ void recalculateAngles();
+ void updateLegendMarkers();
+
+private:
+ QPieSeries *m_mainSeries;
+};
+
+#endif // DONUTBREAKDOWNCHART_H
diff --git a/examples/charts/donutbreakdown/main.cpp b/examples/charts/donutbreakdown/main.cpp
new file mode 100644
index 00000000..fb3925b6
--- /dev/null
+++ b/examples/charts/donutbreakdown/main.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QApplication>
+#include <QMainWindow>
+#include <QStatusBar>
+#include <QChartView>
+#include "donutbreakdownchart.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ //![1]
+ // Graph is based on data of 'Total consumption of energy increased by 10 per cent in 2010'
+ // Statistics Finland, 13 December 2011
+ // http://www.stat.fi/til/ekul/2010/ekul_2010_2011-12-13_tie_001_en.html
+
+ QPieSeries *series1 = new QPieSeries();
+ series1->setName("Fossil fuels");
+ series1->append("Oil", 353295);
+ series1->append("Coal", 188500);
+ series1->append("Natural gas", 148680);
+ series1->append("Peat", 94545);
+
+ QPieSeries *series2 = new QPieSeries();
+ series2->setName("Renewables");
+ series2->append("Wood fuels", 319663);
+ series2->append("Hydro power", 45875);
+ series2->append("Wind power", 1060);
+
+ QPieSeries *series3 = new QPieSeries();
+ series3->setName("Others");
+ series3->append("Nuclear energy", 238789);
+ series3->append("Import energy", 37802);
+ series3->append("Other", 32441);
+ //![1]
+
+ //![2]
+ DonutBreakdownChart *donutBreakdown = new DonutBreakdownChart();
+ donutBreakdown->setAnimationOptions(QChart::AllAnimations);
+ donutBreakdown->setTitle("Total consumption of energy in Finland 2010");
+ donutBreakdown->legend()->setAlignment(Qt::AlignRight);
+ donutBreakdown->addBreakdownSeries(series1, Qt::red);
+ donutBreakdown->addBreakdownSeries(series2, Qt::darkGreen);
+ donutBreakdown->addBreakdownSeries(series3, Qt::darkBlue);
+ //![2]
+
+ //![3]
+ QMainWindow window;
+ QChartView *chartView = new QChartView(donutBreakdown);
+ chartView->setRenderHint(QPainter::Antialiasing);
+ window.setCentralWidget(chartView);
+ window.resize(800, 500);
+ window.show();
+ //![3]
+
+ return a.exec();
+}
diff --git a/examples/charts/donutbreakdown/mainslice.cpp b/examples/charts/donutbreakdown/mainslice.cpp
new file mode 100644
index 00000000..0ac83b3c
--- /dev/null
+++ b/examples/charts/donutbreakdown/mainslice.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainslice.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+//![1]
+MainSlice::MainSlice(QPieSeries *breakdownSeries, QObject *parent)
+ : QPieSlice(parent),
+ m_breakdownSeries(breakdownSeries)
+{
+ connect(this, SIGNAL(percentageChanged()), this, SLOT(updateLabel()));
+}
+//![1]
+
+QPieSeries *MainSlice::breakdownSeries() const
+{
+ return m_breakdownSeries;
+}
+
+void MainSlice::setName(QString name)
+{
+ m_name = name;
+}
+
+QString MainSlice::name() const
+{
+ return m_name;
+}
+
+//![2]
+void MainSlice::updateLabel()
+{
+ this->setLabel(QString("%1 %2%").arg(m_name).arg(percentage() * 100, 0, 'f', 2));
+}
+//![2]
+
+#include "moc_mainslice.cpp"
+
diff --git a/examples/charts/donutbreakdown/mainslice.h b/examples/charts/donutbreakdown/mainslice.h
new file mode 100644
index 00000000..6c6d63c2
--- /dev/null
+++ b/examples/charts/donutbreakdown/mainslice.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINSLICE_H
+#define MAINSLICE_H
+
+#include <QPieSlice>
+#include <QPieSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+class MainSlice : public QPieSlice
+{
+ Q_OBJECT
+public:
+ MainSlice(QPieSeries *breakdownSeries, QObject *parent = 0);
+
+ QPieSeries *breakdownSeries() const;
+
+ void setName(QString name);
+ QString name() const;
+
+public Q_SLOTS:
+ void updateLabel();
+
+private:
+ QPieSeries *m_breakdownSeries;
+ QString m_name;
+};
+
+#endif // MAINSLICE_H
diff --git a/examples/donutchart/donutchart.pro b/examples/charts/donutchart/donutchart.pro
index 72d4ea4d..72d4ea4d 100644
--- a/examples/donutchart/donutchart.pro
+++ b/examples/charts/donutchart/donutchart.pro
diff --git a/examples/charts/donutchart/main.cpp b/examples/charts/donutchart/main.cpp
new file mode 100644
index 00000000..78b2a7c3
--- /dev/null
+++ b/examples/charts/donutchart/main.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QPieSeries>
+#include <QPieSlice>
+#include <QDebug>
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QPieSeries *series = new QPieSeries();
+ series->setHoleSize(0.35);
+ series->append("Protein 4.2%", 4.2);
+ QPieSlice *slice = series->append("Fat 15.6%", 15.6);
+ slice->setExploded();
+ slice->setLabelVisible();
+ series->append("Other 23.8%", 23.8);
+ series->append("Carbs 56.4%", 56.4);
+//![1]
+
+//![2]
+ QChartView *chartView = new QChartView();
+ chartView->setRenderHint(QPainter::Antialiasing);
+ chartView->chart()->setTitle("Donut with a lemon glaze (100g)");
+ chartView->chart()->addSeries(series);
+ chartView->chart()->legend()->setAlignment(Qt::AlignBottom);
+ chartView->chart()->setTheme(QChart::ChartThemeBlueCerulean);
+ chartView->chart()->legend()->setFont(QFont("Arial", 7));
+//![2]
+
+//![3]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.show();
+//![3]
+
+ return a.exec();
+}
diff --git a/demos/dynamicspline/chart.cpp b/examples/charts/dynamicspline/chart.cpp
index 4c7bc355..4c7bc355 100644
--- a/demos/dynamicspline/chart.cpp
+++ b/examples/charts/dynamicspline/chart.cpp
diff --git a/examples/charts/dynamicspline/chart.h b/examples/charts/dynamicspline/chart.h
new file mode 100644
index 00000000..b6d5eb1c
--- /dev/null
+++ b/examples/charts/dynamicspline/chart.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHART_H
+#define CHART_H
+
+#include <QChart>
+#include <QTimer>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QSplineSeries;
+class QValueAxis;
+QT_CHARTS_END_NAMESPACE
+
+QT_CHARTS_USE_NAMESPACE
+
+//![1]
+class Chart: public QChart
+{
+ Q_OBJECT
+public:
+ Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
+ virtual ~Chart();
+
+public slots:
+ void handleTimeout();
+
+private:
+ QTimer m_timer;
+ QSplineSeries *m_series;
+ QStringList m_titles;
+ QValueAxis *m_axis;
+ qreal m_step;
+ qreal m_x;
+ qreal m_y;
+};
+//![1]
+
+#endif /* CHART_H */
diff --git a/examples/charts/dynamicspline/dynamicspline.pro b/examples/charts/dynamicspline/dynamicspline.pro
new file mode 100644
index 00000000..feb26895
--- /dev/null
+++ b/examples/charts/dynamicspline/dynamicspline.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+TARGET = dynamicspline
+HEADERS += chart.h
+SOURCES += main.cpp chart.cpp
diff --git a/examples/charts/dynamicspline/main.cpp b/examples/charts/dynamicspline/main.cpp
new file mode 100644
index 00000000..00f18c2f
--- /dev/null
+++ b/examples/charts/dynamicspline/main.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chart.h"
+#include <QChartView>
+#include <QApplication>
+#include <QMainWindow>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ QMainWindow window;
+ Chart *chart = new Chart;
+ chart->setTitle("Dynamic spline chart");
+ chart->legend()->hide();
+ chart->setAnimationOptions(QChart::AllAnimations);
+ QChartView chartView(chart);
+ chartView.setRenderHint(QPainter::Antialiasing);
+ window.setCentralWidget(&chartView);
+ window.resize(400, 300);
+ window.show();
+ return a.exec();
+}
diff --git a/examples/charts/examples.pri b/examples/charts/examples.pri
new file mode 100644
index 00000000..7b2eaaa7
--- /dev/null
+++ b/examples/charts/examples.pri
@@ -0,0 +1,17 @@
+
+INCLUDEPATH += ../../../include
+
+LIBS += -L$$OUT_PWD/../../../lib
+
+TEMPLATE = app
+
+QT += charts
+QT += core gui widgets
+
+contains(TARGET, qml.*) {
+ QT += qml quick
+}
+
+target.path = $$[QT_INSTALL_EXAMPLES]/charts/$$TARGET
+INSTALLS += target
+
diff --git a/examples/horizontalbarchart/horizontalbarchart.pro b/examples/charts/horizontalbarchart/horizontalbarchart.pro
index 61ec088e..61ec088e 100644
--- a/examples/horizontalbarchart/horizontalbarchart.pro
+++ b/examples/charts/horizontalbarchart/horizontalbarchart.pro
diff --git a/examples/charts/horizontalbarchart/main.cpp b/examples/charts/horizontalbarchart/main.cpp
new file mode 100644
index 00000000..725aa127
--- /dev/null
+++ b/examples/charts/horizontalbarchart/main.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QBarSeries>
+#include <QBarSet>
+#include <QLegend>
+#include <QBarCategoryAxis>
+#include <QValueAxis>
+#include <QHorizontalBarSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QBarSet *set0 = new QBarSet("Jane");
+ QBarSet *set1 = new QBarSet("John");
+ QBarSet *set2 = new QBarSet("Axel");
+ QBarSet *set3 = new QBarSet("Mary");
+ QBarSet *set4 = new QBarSet("Samantha");
+
+ *set0 << 1 << 2 << 3 << 4 << 5 << 6;
+ *set1 << 5 << 0 << 0 << 4 << 0 << 7;
+ *set2 << 3 << 5 << 8 << 13 << 8 << 5;
+ *set3 << 5 << 6 << 7 << 3 << 4 << 5;
+ *set4 << 9 << 7 << 5 << 3 << 1 << 2;
+//![1]
+
+//![2]
+ QHorizontalBarSeries *series = new QHorizontalBarSeries();
+ series->append(set0);
+ series->append(set1);
+ series->append(set2);
+ series->append(set3);
+ series->append(set4);
+//![2]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->setTitle("Simple horizontal barchart example");
+ chart->setAnimationOptions(QChart::SeriesAnimations);
+//![3]
+
+//![4]
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
+ QBarCategoryAxis *axisY = new QBarCategoryAxis();
+ axisY->append(categories);
+ chart->setAxisY(axisY, series);
+ QValueAxis *axisX = new QValueAxis();
+ chart->setAxisX(axisX, series);
+ axisX->applyNiceNumbers();
+//![4]
+
+//![5]
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
+//![5]
+
+//![6]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![6]
+
+//![7]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(420, 300);
+ window.show();
+//![7]
+
+ return a.exec();
+}
diff --git a/examples/horizontalpercentbarchart/horizontalpercentbarchart.pro b/examples/charts/horizontalpercentbarchart/horizontalpercentbarchart.pro
index d6168695..d6168695 100644
--- a/examples/horizontalpercentbarchart/horizontalpercentbarchart.pro
+++ b/examples/charts/horizontalpercentbarchart/horizontalpercentbarchart.pro
diff --git a/examples/charts/horizontalpercentbarchart/main.cpp b/examples/charts/horizontalpercentbarchart/main.cpp
new file mode 100644
index 00000000..d8adab49
--- /dev/null
+++ b/examples/charts/horizontalpercentbarchart/main.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QBarSeries>
+#include <QBarSet>
+#include <QLegend>
+#include <QBarCategoryAxis>
+#include <QHorizontalPercentBarSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QBarSet *set0 = new QBarSet("Jane");
+ QBarSet *set1 = new QBarSet("John");
+ QBarSet *set2 = new QBarSet("Axel");
+ QBarSet *set3 = new QBarSet("Mary");
+ QBarSet *set4 = new QBarSet("Samantha");
+
+ *set0 << 1 << 2 << 3 << 4 << 5 << 6;
+ *set1 << 5 << 0 << 0 << 4 << 0 << 7;
+ *set2 << 3 << 5 << 8 << 13 << 8 << 5;
+ *set3 << 5 << 6 << 7 << 3 << 4 << 5;
+ *set4 << 9 << 7 << 5 << 3 << 1 << 2;
+//![1]
+
+//![2]
+ QHorizontalPercentBarSeries *series = new QHorizontalPercentBarSeries();
+ series->append(set0);
+ series->append(set1);
+ series->append(set2);
+ series->append(set3);
+ series->append(set4);
+
+//![2]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->setTitle("Simple horizontal percent barchart example");
+ chart->setAnimationOptions(QChart::SeriesAnimations);
+//![3]
+
+//![4]
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
+ QBarCategoryAxis *axis = new QBarCategoryAxis();
+ axis->append(categories);
+ chart->createDefaultAxes();
+ chart->setAxisY(axis, series);
+//![4]
+
+//![5]
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
+//![5]
+
+//![6]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![6]
+
+//![7]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(420, 300);
+ window.show();
+//![7]
+
+ return a.exec();
+}
diff --git a/examples/horizontalstackedbarchart/horizontalstackedbarchart.pro b/examples/charts/horizontalstackedbarchart/horizontalstackedbarchart.pro
index 5c08d212..5c08d212 100644
--- a/examples/horizontalstackedbarchart/horizontalstackedbarchart.pro
+++ b/examples/charts/horizontalstackedbarchart/horizontalstackedbarchart.pro
diff --git a/examples/charts/horizontalstackedbarchart/main.cpp b/examples/charts/horizontalstackedbarchart/main.cpp
new file mode 100644
index 00000000..13df0cdf
--- /dev/null
+++ b/examples/charts/horizontalstackedbarchart/main.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QBarSeries>
+#include <QBarSet>
+#include <QLegend>
+#include <QBarCategoryAxis>
+#include <QHorizontalStackedBarSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QBarSet *set0 = new QBarSet("Jane");
+ QBarSet *set1 = new QBarSet("John");
+ QBarSet *set2 = new QBarSet("Axel");
+ QBarSet *set3 = new QBarSet("Mary");
+ QBarSet *set4 = new QBarSet("Samantha");
+
+ *set0 << 1 << 2 << 3 << 4 << 5 << 6;
+ *set1 << 5 << 0 << 0 << 4 << 0 << 7;
+ *set2 << 3 << 5 << 8 << 13 << 8 << 5;
+ *set3 << 5 << 6 << 7 << 3 << 4 << 5;
+ *set4 << 9 << 7 << 5 << 3 << 1 << 2;
+//![1]
+
+//![2]
+ QHorizontalStackedBarSeries *series = new QHorizontalStackedBarSeries();
+ series->append(set0);
+ series->append(set1);
+ series->append(set2);
+ series->append(set3);
+ series->append(set4);
+
+//![2]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->setTitle("Simple horizontal stacked barchart example");
+ chart->setAnimationOptions(QChart::SeriesAnimations);
+//![3]
+
+//![4]
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
+ QBarCategoryAxis *axis = new QBarCategoryAxis();
+ axis->append(categories);
+ chart->createDefaultAxes();
+ chart->setAxisY(axis, series);
+//![4]
+
+//![5]
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
+//![5]
+
+//![6]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![6]
+
+//![7]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(420, 300);
+ window.show();
+//![7]
+
+ return a.exec();
+}
diff --git a/examples/legend/legend.pro b/examples/charts/legend/legend.pro
index 5e22fb2a..5e22fb2a 100644
--- a/examples/legend/legend.pro
+++ b/examples/charts/legend/legend.pro
diff --git a/examples/charts/legend/main.cpp b/examples/charts/legend/main.cpp
new file mode 100644
index 00000000..64d3903b
--- /dev/null
+++ b/examples/charts/legend/main.cpp
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwidget.h"
+
+#include <QApplication>
+#include <QMainWindow>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ MainWidget w;
+ w.resize(720, 480);
+ w.show();
+
+ return a.exec();
+}
diff --git a/examples/charts/legend/mainwidget.cpp b/examples/charts/legend/mainwidget.cpp
new file mode 100644
index 00000000..32bc2ae9
--- /dev/null
+++ b/examples/charts/legend/mainwidget.cpp
@@ -0,0 +1,247 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwidget.h"
+#include <QChart>
+#include <QChartView>
+#include <QPushButton>
+#include <QLabel>
+#include <QDebug>
+#include <QBarSet>
+#include <QBarSeries>
+#include <QLegend>
+#include <QFormLayout>
+
+QT_CHARTS_USE_NAMESPACE
+
+MainWidget::MainWidget(QWidget *parent) :
+ QWidget(parent)
+{
+ // Create buttons for ui
+ m_buttonLayout = new QGridLayout();
+ QPushButton *detachLegendButton = new QPushButton("Toggle attached");
+ connect(detachLegendButton, SIGNAL(clicked()), this, SLOT(toggleAttached()));
+ m_buttonLayout->addWidget(detachLegendButton, 0, 0);
+
+ QPushButton *addSetButton = new QPushButton("add barset");
+ connect(addSetButton, SIGNAL(clicked()), this, SLOT(addBarset()));
+ m_buttonLayout->addWidget(addSetButton, 2, 0);
+ QPushButton *removeBarsetButton = new QPushButton("remove barset");
+ connect(removeBarsetButton, SIGNAL(clicked()), this, SLOT(removeBarset()));
+ m_buttonLayout->addWidget(removeBarsetButton, 3, 0);
+
+ QPushButton *alignButton = new QPushButton("Align (Bottom)");
+ connect(alignButton, SIGNAL(clicked()), this, SLOT(setLegendAlignment()));
+ m_buttonLayout->addWidget(alignButton, 4, 0);
+
+ QPushButton *boldButton = new QPushButton("Toggle bold");
+ connect(boldButton, SIGNAL(clicked()), this, SLOT(toggleBold()));
+ m_buttonLayout->addWidget(boldButton, 8, 0);
+
+ QPushButton *italicButton = new QPushButton("Toggle italic");
+ connect(italicButton, SIGNAL(clicked()), this, SLOT(toggleItalic()));
+ m_buttonLayout->addWidget(italicButton, 9, 0);
+
+ m_legendPosX = new QDoubleSpinBox();
+ m_legendPosY = new QDoubleSpinBox();
+ m_legendWidth = new QDoubleSpinBox();
+ m_legendHeight = new QDoubleSpinBox();
+
+ connect(m_legendPosX, SIGNAL(valueChanged(double)), this, SLOT(updateLegendLayout()));
+ connect(m_legendPosY, SIGNAL(valueChanged(double)), this, SLOT(updateLegendLayout()));
+ connect(m_legendWidth, SIGNAL(valueChanged(double)), this, SLOT(updateLegendLayout()));
+ connect(m_legendHeight, SIGNAL(valueChanged(double)), this, SLOT(updateLegendLayout()));
+
+ QFormLayout *legendLayout = new QFormLayout();
+ legendLayout->addRow("HPos", m_legendPosX);
+ legendLayout->addRow("VPos", m_legendPosY);
+ legendLayout->addRow("Width", m_legendWidth);
+ legendLayout->addRow("Height", m_legendHeight);
+ m_legendSettings = new QGroupBox("Detached legend");
+ m_legendSettings->setLayout(legendLayout);
+ m_buttonLayout->addWidget(m_legendSettings);
+ m_legendSettings->setVisible(false);
+
+ // Create chart view with the chart
+ m_chart = new QChart();
+ m_chartView = new QChartView(m_chart, this);
+
+ // Create spinbox to modify font size
+ m_fontSize = new QDoubleSpinBox();
+ m_fontSize->setValue(m_chart->legend()->font().pointSizeF());
+ connect(m_fontSize, SIGNAL(valueChanged(double)), this, SLOT(fontSizeChanged()));
+
+ QFormLayout *fontLayout = new QFormLayout();
+ fontLayout->addRow("Legend font size", m_fontSize);
+
+ // Create layout for grid and detached legend
+ m_mainLayout = new QGridLayout();
+ m_mainLayout->addLayout(m_buttonLayout, 0, 0);
+ m_mainLayout->addLayout(fontLayout, 1, 0);
+ m_mainLayout->addWidget(m_chartView, 0, 1, 3, 1);
+ setLayout(m_mainLayout);
+
+ createSeries();
+}
+
+void MainWidget::createSeries()
+{
+ m_series = new QBarSeries();
+ addBarset();
+ addBarset();
+ addBarset();
+ addBarset();
+
+ m_chart->addSeries(m_series);
+ m_chart->setTitle("Legend detach example");
+ m_chart->createDefaultAxes();
+//![1]
+ m_chart->legend()->setVisible(true);
+ m_chart->legend()->setAlignment(Qt::AlignBottom);
+//![1]
+
+ m_chartView->setRenderHint(QPainter::Antialiasing);
+}
+
+void MainWidget::showLegendSpinbox()
+{
+ m_legendSettings->setVisible(true);
+ QRectF chartViewRect = m_chartView->rect();
+
+ m_legendPosX->setMinimum(0);
+ m_legendPosX->setMaximum(chartViewRect.width());
+ m_legendPosX->setValue(150);
+
+ m_legendPosY->setMinimum(0);
+ m_legendPosY->setMaximum(chartViewRect.height());
+ m_legendPosY->setValue(150);
+
+ m_legendWidth->setMinimum(0);
+ m_legendWidth->setMaximum(chartViewRect.width());
+ m_legendWidth->setValue(150);
+
+ m_legendHeight->setMinimum(0);
+ m_legendHeight->setMaximum(chartViewRect.height());
+ m_legendHeight->setValue(75);
+}
+
+void MainWidget::hideLegendSpinbox()
+{
+ m_legendSettings->setVisible(false);
+}
+
+
+void MainWidget::toggleAttached()
+{
+ QLegend *legend = m_chart->legend();
+ if (legend->isAttachedToChart()) {
+ //![2]
+ legend->detachFromChart();
+ m_chart->legend()->setBackgroundVisible(true);
+ m_chart->legend()->setBrush(QBrush(QColor(128, 128, 128, 128)));
+ m_chart->legend()->setPen(QPen(QColor(192, 192, 192, 192)));
+ //![2]
+ showLegendSpinbox();
+ updateLegendLayout();
+ } else {
+ //![3]
+ legend->attachToChart();
+ legend->setBackgroundVisible(false);
+ //![3]
+ hideLegendSpinbox();
+ }
+ update();
+}
+
+void MainWidget::addBarset()
+{
+ QBarSet *barSet = new QBarSet(QString("set ") + QString::number(m_series->count()));
+ qreal delta = m_series->count() * 0.1;
+ *barSet << 1 + delta << 2 + delta << 3 + delta << 4 + delta;
+ m_series->append(barSet);
+}
+
+void MainWidget::removeBarset()
+{
+ QList<QBarSet *> sets = m_series->barSets();
+ if (sets.count() > 0) {
+ m_series->remove(sets.at(sets.count() - 1));
+ }
+}
+
+void MainWidget::setLegendAlignment()
+{
+ QPushButton *button = qobject_cast<QPushButton *>(sender());
+
+ switch (m_chart->legend()->alignment()) {
+ case Qt::AlignTop:
+ m_chart->legend()->setAlignment(Qt::AlignLeft);
+ if (button)
+ button->setText("Align (Left)");
+ break;
+ case Qt::AlignLeft:
+ m_chart->legend()->setAlignment(Qt::AlignBottom);
+ if (button)
+ button->setText("Align (Bottom)");
+ break;
+ case Qt::AlignBottom:
+ m_chart->legend()->setAlignment(Qt::AlignRight);
+ if (button)
+ button->setText("Align (Right)");
+ break;
+ default:
+ if (button)
+ button->setText("Align (Top)");
+ m_chart->legend()->setAlignment(Qt::AlignTop);
+ break;
+ }
+}
+
+void MainWidget::toggleBold()
+{
+ QFont font = m_chart->legend()->font();
+ font.setBold(!font.bold());
+ m_chart->legend()->setFont(font);
+}
+
+void MainWidget::toggleItalic()
+{
+ QFont font = m_chart->legend()->font();
+ font.setItalic(!font.italic());
+ m_chart->legend()->setFont(font);
+}
+
+void MainWidget::fontSizeChanged()
+{
+ QFont font = m_chart->legend()->font();
+ font.setPointSizeF(m_fontSize->value());
+ m_chart->legend()->setFont(font);
+}
+
+void MainWidget::updateLegendLayout()
+{
+//![4]
+ m_chart->legend()->setGeometry(QRectF(m_legendPosX->value(),
+ m_legendPosY->value(),
+ m_legendWidth->value(),
+ m_legendHeight->value()));
+ m_chart->legend()->update();
+//![4]
+}
diff --git a/examples/charts/legend/mainwidget.h b/examples/charts/legend/mainwidget.h
new file mode 100644
index 00000000..3a24d674
--- /dev/null
+++ b/examples/charts/legend/mainwidget.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWIDGET_H
+#define MAINWIDGET_H
+
+#include "qchartglobal.h"
+#include "qchart.h"
+#include "qchartview.h"
+#include <QWidget>
+#include <QGraphicsWidget>
+#include <QGridLayout>
+#include <QGraphicsGridLayout>
+#include <QDoubleSpinBox>
+#include <QGroupBox>
+#include <QBarSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+class MainWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit MainWidget(QWidget *parent = 0);
+ void createSeries();
+ void showLegendSpinbox();
+ void hideLegendSpinbox();
+
+public Q_SLOTS:
+ void toggleAttached();
+ void addBarset();
+ void removeBarset();
+
+ void setLegendAlignment();
+
+ void toggleBold();
+ void toggleItalic();
+ void fontSizeChanged();
+
+ void updateLegendLayout();
+
+private:
+ QChart *m_chart;
+ QBarSeries *m_series;
+
+ QChartView *m_chartView;
+ QGridLayout *m_mainLayout;
+ QGridLayout *m_buttonLayout;
+ QGridLayout *m_fontLayout;
+
+ QDoubleSpinBox *m_fontSize;
+
+ // For detached layout
+ QGroupBox *m_legendSettings;
+ QDoubleSpinBox *m_legendPosX;
+ QDoubleSpinBox *m_legendPosY;
+ QDoubleSpinBox *m_legendWidth;
+ QDoubleSpinBox *m_legendHeight;
+};
+
+#endif // MAINWIDGET_H
diff --git a/examples/legendmarkers/legendmarkers.pro b/examples/charts/legendmarkers/legendmarkers.pro
index f79bdba4..f79bdba4 100644
--- a/examples/legendmarkers/legendmarkers.pro
+++ b/examples/charts/legendmarkers/legendmarkers.pro
diff --git a/examples/legendmarkers/main.cpp b/examples/charts/legendmarkers/main.cpp
index f627e496..f627e496 100644
--- a/examples/legendmarkers/main.cpp
+++ b/examples/charts/legendmarkers/main.cpp
diff --git a/examples/charts/legendmarkers/mainwidget.cpp b/examples/charts/legendmarkers/mainwidget.cpp
new file mode 100644
index 00000000..f71e7a61
--- /dev/null
+++ b/examples/charts/legendmarkers/mainwidget.cpp
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwidget.h"
+#include <QChart>
+#include <QChartView>
+#include <QPushButton>
+#include <QLabel>
+#include <QDebug>
+#include <QLegend>
+#include <QFormLayout>
+#include <QLegendMarker>
+#include <QLineSeries>
+#include <QXYLegendMarker>
+#include <qmath.h>
+
+QT_CHARTS_USE_NAMESPACE
+
+MainWidget::MainWidget(QWidget *parent) :
+ QWidget(parent)
+{
+ // Create chart view with the chart
+ m_chart = new QChart();
+ m_chartView = new QChartView(m_chart, this);
+
+ // Create layout for grid and detached legend
+ m_mainLayout = new QGridLayout();
+ m_mainLayout->addWidget(m_chartView, 0, 1, 3, 1);
+ setLayout(m_mainLayout);
+
+ // Add few series
+ addSeries();
+ addSeries();
+ addSeries();
+ addSeries();
+
+ connectMarkers();
+
+ // Set the title and show legend
+ m_chart->setTitle("Legendmarker example (click on legend)");
+ m_chart->legend()->setVisible(true);
+ m_chart->legend()->setAlignment(Qt::AlignBottom);
+
+ m_chartView->setRenderHint(QPainter::Antialiasing);
+}
+
+void MainWidget::addSeries()
+{
+ QLineSeries *series = new QLineSeries();
+ m_series.append(series);
+
+ series->setName(QString("line " + QString::number(m_series.count())));
+
+ // Make some sine wave for data
+ QList<QPointF> data;
+ int offset = m_chart->series().count();
+ for (int i = 0; i < 360; i++) {
+ qreal x = offset * 20 + i;
+ data.append(QPointF(i, qSin(2.0 * 3.141592 * x / 360.0)));
+ }
+
+ series->append(data);
+ m_chart->addSeries(series);
+
+ if (m_series.count() == 1) {
+ m_chart->createDefaultAxes();
+ }
+}
+
+void MainWidget::removeSeries()
+{
+ // Remove last series from chart
+ if (m_series.count() > 0) {
+ QLineSeries *series = m_series.last();
+ m_chart->removeSeries(series);
+ m_series.removeLast();
+ delete series;
+ }
+}
+
+void MainWidget::connectMarkers()
+{
+//![1]
+ // Connect all markers to handler
+ foreach (QLegendMarker* marker, m_chart->legend()->markers()) {
+ // Disconnect possible existing connection to avoid multiple connections
+ QObject::disconnect(marker, SIGNAL(clicked()), this, SLOT(handleMarkerClicked()));
+ QObject::connect(marker, SIGNAL(clicked()), this, SLOT(handleMarkerClicked()));
+ }
+//![1]
+}
+
+void MainWidget::disconnectMarkers()
+{
+//![2]
+ foreach (QLegendMarker* marker, m_chart->legend()->markers()) {
+ QObject::disconnect(marker, SIGNAL(clicked()), this, SLOT(handleMarkerClicked()));
+ }
+//![2]
+}
+
+void MainWidget::handleMarkerClicked()
+{
+//![3]
+ QLegendMarker* marker = qobject_cast<QLegendMarker*> (sender());
+ Q_ASSERT(marker);
+//![3]
+
+//![4]
+ switch (marker->type())
+//![4]
+ {
+ case QLegendMarker::LegendMarkerTypeXY:
+ {
+//![5]
+ // Toggle visibility of series
+ marker->series()->setVisible(!marker->series()->isVisible());
+
+ // Turn legend marker back to visible, since hiding series also hides the marker
+ // and we don't want it to happen now.
+ marker->setVisible(true);
+//![5]
+
+//![6]
+ // Dim the marker, if series is not visible
+ qreal alpha = 1.0;
+
+ if (!marker->series()->isVisible()) {
+ alpha = 0.5;
+ }
+
+ QColor color;
+ QBrush brush = marker->labelBrush();
+ color = brush.color();
+ color.setAlphaF(alpha);
+ brush.setColor(color);
+ marker->setLabelBrush(brush);
+
+ brush = marker->brush();
+ color = brush.color();
+ color.setAlphaF(alpha);
+ brush.setColor(color);
+ marker->setBrush(brush);
+
+ QPen pen = marker->pen();
+ color = pen.color();
+ color.setAlphaF(alpha);
+ pen.setColor(color);
+ marker->setPen(pen);
+
+//![6]
+ break;
+ }
+ default:
+ {
+ qDebug() << "Unknown marker type";
+ break;
+ }
+ }
+}
diff --git a/examples/charts/legendmarkers/mainwidget.h b/examples/charts/legendmarkers/mainwidget.h
new file mode 100644
index 00000000..350808a2
--- /dev/null
+++ b/examples/charts/legendmarkers/mainwidget.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWIDGET_H
+#define MAINWIDGET_H
+
+#include "qchartglobal.h"
+#include "qchart.h"
+#include "qchartview.h"
+#include <QWidget>
+#include <QGraphicsWidget>
+#include <QGridLayout>
+#include <QGraphicsGridLayout>
+#include <QDoubleSpinBox>
+#include <QGroupBox>
+#include <QLineSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+class MainWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit MainWidget(QWidget *parent = 0);
+
+public slots:
+ void addSeries();
+ void removeSeries();
+ void connectMarkers();
+ void disconnectMarkers();
+
+ void handleMarkerClicked();
+
+private:
+
+ QChart *m_chart;
+ QList<QLineSeries *> m_series;
+
+ QChartView *m_chartView;
+ QGridLayout *m_mainLayout;
+ QGridLayout *m_fontLayout;
+
+};
+
+#endif // MAINWIDGET_H
diff --git a/examples/lineandbar/lineandbar.pro b/examples/charts/lineandbar/lineandbar.pro
index dd94abd5..dd94abd5 100644
--- a/examples/lineandbar/lineandbar.pro
+++ b/examples/charts/lineandbar/lineandbar.pro
diff --git a/examples/charts/lineandbar/main.cpp b/examples/charts/lineandbar/main.cpp
new file mode 100644
index 00000000..264d5829
--- /dev/null
+++ b/examples/charts/lineandbar/main.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QBarSeries>
+#include <QBarSet>
+#include <QLineSeries>
+#include <QLegend>
+#include <QBarCategoryAxis>
+#include <QValueAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QBarSet *set0 = new QBarSet("Jane");
+ QBarSet *set1 = new QBarSet("John");
+ QBarSet *set2 = new QBarSet("Axel");
+ QBarSet *set3 = new QBarSet("Mary");
+ QBarSet *set4 = new QBarSet("Sam");
+
+ *set0 << 1 << 2 << 3 << 4 << 5 << 6;
+ *set1 << 5 << 0 << 0 << 4 << 0 << 7;
+ *set2 << 3 << 5 << 8 << 13 << 8 << 5;
+ *set3 << 5 << 6 << 7 << 3 << 4 << 5;
+ *set4 << 9 << 7 << 5 << 3 << 1 << 2;
+//![1]
+
+//![2]
+ QBarSeries *barseries = new QBarSeries();
+ barseries->append(set0);
+ barseries->append(set1);
+ barseries->append(set2);
+ barseries->append(set3);
+ barseries->append(set4);
+//![2]
+
+//![8]
+ QLineSeries *lineseries = new QLineSeries();
+ lineseries->setName("trend");
+ lineseries->append(QPoint(0, 4));
+ lineseries->append(QPoint(1, 15));
+ lineseries->append(QPoint(2, 20));
+ lineseries->append(QPoint(3, 4));
+ lineseries->append(QPoint(4, 12));
+ lineseries->append(QPoint(5, 17));
+//![8]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->addSeries(barseries);
+ chart->addSeries(lineseries);
+ chart->setTitle("Line and barchart example");
+//![3]
+
+//![4]
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
+ QBarCategoryAxis *axisX = new QBarCategoryAxis();
+ axisX->append(categories);
+ chart->setAxisX(axisX, lineseries);
+ chart->setAxisX(axisX, barseries);
+ axisX->setRange(QString("Jan"), QString("Jun"));
+
+ QValueAxis *axisY = new QValueAxis();
+ chart->setAxisY(axisY, lineseries);
+ chart->setAxisY(axisY, barseries);
+ axisY->setRange(0, 20);
+//![4]
+
+//![5]
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
+//![5]
+
+//![6]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![6]
+
+//![7]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(440, 300);
+ window.show();
+//![7]
+
+ return a.exec();
+}
diff --git a/examples/linechart/linechart.pro b/examples/charts/linechart/linechart.pro
index d3eb640a..d3eb640a 100644
--- a/examples/linechart/linechart.pro
+++ b/examples/charts/linechart/linechart.pro
diff --git a/examples/charts/linechart/main.cpp b/examples/charts/linechart/main.cpp
new file mode 100644
index 00000000..c0040e51
--- /dev/null
+++ b/examples/charts/linechart/main.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QLineSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QLineSeries *series = new QLineSeries();
+//![1]
+
+//![2]
+ series->append(0, 6);
+ series->append(2, 4);
+ series->append(3, 8);
+ series->append(7, 4);
+ series->append(10, 5);
+ *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
+//![2]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->legend()->hide();
+ chart->addSeries(series);
+ chart->createDefaultAxes();
+ chart->setTitle("Simple line chart example");
+//![3]
+
+//![4]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![4]
+
+
+//![5]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.show();
+//![5]
+
+ return a.exec();
+}
diff --git a/examples/logvalueaxis/logvalueaxis.pro b/examples/charts/logvalueaxis/logvalueaxis.pro
index ede43079..ede43079 100644
--- a/examples/logvalueaxis/logvalueaxis.pro
+++ b/examples/charts/logvalueaxis/logvalueaxis.pro
diff --git a/examples/charts/logvalueaxis/main.cpp b/examples/charts/logvalueaxis/main.cpp
new file mode 100644
index 00000000..73591ae3
--- /dev/null
+++ b/examples/charts/logvalueaxis/main.cpp
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QLineSeries>
+#include <QValueAxis>
+#include <QLogValueAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ //![1]
+ QLineSeries *series = new QLineSeries();
+ *series << QPointF(1, 1) << QPointF(2, 73) << QPointF(3, 268) << QPointF(4, 17) << QPointF(5, 4325) << QPointF(6, 723);
+ //![1]
+
+ //![2]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->legend()->hide();
+ chart->setTitle("Logarithmic axis example");
+ //![2]
+
+ //![3]
+ QValueAxis *axisX = new QValueAxis;
+ axisX->setTitleText("Data point");
+ axisX->setTickCount(6);
+ axisX->setLabelFormat("%i");
+ chart->addAxis(axisX, Qt::AlignBottom);
+ series->attachAxis(axisX);
+
+ QLogValueAxis *axisY = new QLogValueAxis;
+ axisY->setLabelFormat("%g");
+ axisY->setTitleText("Values");
+ axisY->setBase(8);
+ chart->addAxis(axisY, Qt::AlignLeft);
+ series->attachAxis(axisY);
+ //![3]
+
+ //![4]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+ //![4]
+
+ //![5]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.show();
+ //![5]
+
+ return a.exec();
+}
diff --git a/examples/modeldata/customtablemodel.cpp b/examples/charts/modeldata/customtablemodel.cpp
index 2bec3c98..2bec3c98 100644
--- a/examples/modeldata/customtablemodel.cpp
+++ b/examples/charts/modeldata/customtablemodel.cpp
diff --git a/examples/modeldata/customtablemodel.h b/examples/charts/modeldata/customtablemodel.h
index 755f4c7d..755f4c7d 100644
--- a/examples/modeldata/customtablemodel.h
+++ b/examples/charts/modeldata/customtablemodel.h
diff --git a/examples/modeldata/main.cpp b/examples/charts/modeldata/main.cpp
index bf0b384b..bf0b384b 100644
--- a/examples/modeldata/main.cpp
+++ b/examples/charts/modeldata/main.cpp
diff --git a/examples/modeldata/modeldata.pro b/examples/charts/modeldata/modeldata.pro
index 7c302bd9..7c302bd9 100644
--- a/examples/modeldata/modeldata.pro
+++ b/examples/charts/modeldata/modeldata.pro
diff --git a/examples/charts/modeldata/tablewidget.cpp b/examples/charts/modeldata/tablewidget.cpp
new file mode 100644
index 00000000..5d50dd70
--- /dev/null
+++ b/examples/charts/modeldata/tablewidget.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tablewidget.h"
+#include "customtablemodel.h"
+#include <QGridLayout>
+#include <QTableView>
+#include <QChart>
+#include <QChartView>
+#include <QLineSeries>
+#include <QVXYModelMapper>
+#include <QHeaderView>
+
+QT_CHARTS_USE_NAMESPACE
+
+TableWidget::TableWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ // create simple model for storing data
+ // user's table data model
+ //! [1]
+ CustomTableModel *model = new CustomTableModel;
+ //! [1]
+
+ //! [2]
+ // create table view and add model to it
+ QTableView *tableView = new QTableView;
+ tableView->setModel(model);
+ tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
+ tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
+ //! [2]
+
+ //! [3]
+ QChart *chart = new QChart;
+ chart->setAnimationOptions(QChart::AllAnimations);
+ //! [3]
+
+ // series 1
+ //! [4]
+ QLineSeries *series = new QLineSeries;
+ series->setName("Line 1");
+ QVXYModelMapper *mapper = new QVXYModelMapper(this);
+ mapper->setXColumn(0);
+ mapper->setYColumn(1);
+ mapper->setSeries(series);
+ mapper->setModel(model);
+ chart->addSeries(series);
+ //! [4]
+
+ //! [5]
+ // for storing color hex from the series
+ QString seriesColorHex = "#000000";
+
+ // get the color of the series and use it for showing the mapped area
+ seriesColorHex = "#" + QString::number(series->pen().color().rgb(), 16).right(6).toUpper();
+ model->addMapping(seriesColorHex, QRect(0, 0, 2, model->rowCount()));
+ //! [5]
+
+
+ // series 2
+ //! [6]
+ series = new QLineSeries;
+ series->setName("Line 2");
+
+ mapper = new QVXYModelMapper(this);
+ mapper->setXColumn(2);
+ mapper->setYColumn(3);
+ mapper->setSeries(series);
+ mapper->setModel(model);
+ chart->addSeries(series);
+ //! [6]
+
+ //! [7]
+ // get the color of the series and use it for showing the mapped area
+ seriesColorHex = "#" + QString::number(series->pen().color().rgb(), 16).right(6).toUpper();
+ model->addMapping(seriesColorHex, QRect(2, 0, 2, model->rowCount()));
+ //! [7]
+
+ //! [8]
+ chart->createDefaultAxes();
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+ chartView->setMinimumSize(640, 480);
+ //! [8]
+
+ //! [9]
+ // create main layout
+ QGridLayout *mainLayout = new QGridLayout;
+ mainLayout->addWidget(tableView, 1, 0);
+ mainLayout->addWidget(chartView, 1, 1);
+ mainLayout->setColumnStretch(1, 1);
+ mainLayout->setColumnStretch(0, 0);
+ setLayout(mainLayout);
+ //! [9]
+}
diff --git a/examples/modeldata/tablewidget.h b/examples/charts/modeldata/tablewidget.h
index 3846cc11..3846cc11 100644
--- a/examples/modeldata/tablewidget.h
+++ b/examples/charts/modeldata/tablewidget.h
diff --git a/examples/charts/multiaxis/main.cpp b/examples/charts/multiaxis/main.cpp
new file mode 100644
index 00000000..b6b53e88
--- /dev/null
+++ b/examples/charts/multiaxis/main.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QLineSeries>
+#include <QSplineSeries>
+#include <QValueAxis>
+#include <QCategoryAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ //![1]
+ QChart *chart = new QChart();
+ chart->legend()->hide();
+ chart->setTitle("Multiaxis chart example");
+ //![1]
+
+ //![2]
+ QValueAxis *axisX = new QValueAxis;
+ axisX->setTickCount(10);
+ chart->addAxis(axisX, Qt::AlignBottom);
+ //![2]
+
+ //![3]
+ QSplineSeries *series = new QSplineSeries;
+ *series << QPointF(1, 5) << QPointF(3.5, 18) << QPointF(4.8, 7.5) << QPointF(10, 2.5);
+ chart->addSeries(series);
+
+ QValueAxis *axisY = new QValueAxis;
+ axisY->setLinePenColor(series->pen().color());
+
+ chart->addAxis(axisY, Qt::AlignLeft);
+ series->attachAxis(axisX);
+ series->attachAxis(axisY);
+ //![3]
+
+ //![4]
+ series = new QSplineSeries;
+ *series << QPointF(1, 0.5) << QPointF(1.5, 4.5) << QPointF(2.4, 2.5) << QPointF(4.3, 12.5)
+ << QPointF(5.2, 3.5) << QPointF(7.4, 16.5) << QPointF(8.3, 7.5) << QPointF(10, 17);
+ chart->addSeries(series);
+
+ QCategoryAxis *axisY3 = new QCategoryAxis;
+ axisY3->append("Low", 5);
+ axisY3->append("Medium", 12);
+ axisY3->append("High", 17);
+ axisY3->setLinePenColor(series->pen().color());
+ axisY3->setGridLinePen((series->pen()));
+
+ chart->addAxis(axisY3, Qt::AlignRight);
+ series->attachAxis(axisX);
+ series->attachAxis(axisY3);
+ //![4]
+
+ //![5]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+ //![5]
+
+ //![6]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(800, 600);
+ window.show();
+ //![6]
+
+ return a.exec();
+}
+
diff --git a/examples/multiaxis/multiaxis.pro b/examples/charts/multiaxis/multiaxis.pro
index 33de57cb..33de57cb 100644
--- a/examples/multiaxis/multiaxis.pro
+++ b/examples/charts/multiaxis/multiaxis.pro
diff --git a/demos/nesteddonuts/main.cpp b/examples/charts/nesteddonuts/main.cpp
index 0b833a83..0b833a83 100644
--- a/demos/nesteddonuts/main.cpp
+++ b/examples/charts/nesteddonuts/main.cpp
diff --git a/examples/charts/nesteddonuts/nesteddonuts.pro b/examples/charts/nesteddonuts/nesteddonuts.pro
new file mode 100644
index 00000000..fadab0cd
--- /dev/null
+++ b/examples/charts/nesteddonuts/nesteddonuts.pro
@@ -0,0 +1,8 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+TARGET = nesteddonuts
+SOURCES += main.cpp\
+ widget.cpp
+HEADERS += widget.h
diff --git a/examples/charts/nesteddonuts/widget.cpp b/examples/charts/nesteddonuts/widget.cpp
new file mode 100644
index 00000000..e11c4c7c
--- /dev/null
+++ b/examples/charts/nesteddonuts/widget.cpp
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "widget.h"
+#include <QChartView>
+#include <QChart>
+#include <QLegend>
+#include <QPieSeries>
+#include <QPieSlice>
+#include <QTime>
+#include <QGridLayout>
+#include <QTimer>
+
+QT_CHARTS_USE_NAMESPACE
+
+Widget::Widget(QWidget *parent)
+ : QWidget(parent)
+{
+ setMinimumSize(800, 600);
+ qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
+
+ //! [1]
+ QChartView *chartView = new QChartView;
+ chartView->setRenderHint(QPainter::Antialiasing);
+ QChart *chart = chartView->chart();
+ chart->legend()->setVisible(false);
+ chart->setTitle("Nested donuts demo");
+ chart->setAnimationOptions(QChart::AllAnimations);
+ //! [1]
+
+ //! [2]
+ qreal minSize = 0.1;
+ qreal maxSize = 0.9;
+ int donutCount = 5;
+ //! [2]
+
+ //! [3]
+ for (int i = 0; i < donutCount; i++) {
+ QPieSeries *donut = new QPieSeries;
+ int sliceCount = 3 + qrand() % 3;
+ for (int j = 0; j < sliceCount; j++) {
+ qreal value = 100 + qrand() % 100;
+ QPieSlice *slice = new QPieSlice(QString("%1").arg(value), value);
+ slice->setLabelVisible(true);
+ slice->setLabelColor(Qt::white);
+ slice->setLabelPosition(QPieSlice::LabelInsideTangential);
+ connect(slice, SIGNAL(hovered(bool)), this, SLOT(explodeSlice(bool)));
+ donut->append(slice);
+ donut->setHoleSize(minSize + i * (maxSize - minSize) / donutCount);
+ donut->setPieSize(minSize + (i + 1) * (maxSize - minSize) / donutCount);
+ }
+ m_donuts.append(donut);
+ chartView->chart()->addSeries(donut);
+ }
+ //! [3]
+
+ // create main layout
+ //! [4]
+ QGridLayout *mainLayout = new QGridLayout;
+ mainLayout->addWidget(chartView, 1, 1);
+ setLayout(mainLayout);
+ //! [4]
+
+ //! [5]
+ updateTimer = new QTimer(this);
+ connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateRotation()));
+ updateTimer->start(1250);
+ //! [5]
+}
+
+Widget::~Widget()
+{
+
+}
+
+//! [6]
+void Widget::updateRotation()
+{
+ for (int i = 0; i < m_donuts.count(); i++) {
+ QPieSeries *donut = m_donuts.at(i);
+ qreal phaseShift = -50 + qrand() % 100;
+ donut->setPieStartAngle(donut->pieStartAngle() + phaseShift);
+ donut->setPieEndAngle(donut->pieEndAngle() + phaseShift);
+ }
+}
+//! [6]
+
+//! [7]
+void Widget::explodeSlice(bool exploded)
+{
+ QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
+ if (exploded) {
+ updateTimer->stop();
+ qreal sliceStartAngle = slice->startAngle();
+ qreal sliceEndAngle = slice->startAngle() + slice->angleSpan();
+
+ QPieSeries *donut = slice->series();
+ qreal seriesIndex = m_donuts.indexOf(donut);
+ for (int i = seriesIndex + 1; i < m_donuts.count(); i++) {
+ m_donuts.at(i)->setPieStartAngle(sliceEndAngle);
+ m_donuts.at(i)->setPieEndAngle(360 + sliceStartAngle);
+ }
+ } else {
+ for (int i = 0; i < m_donuts.count(); i++) {
+ m_donuts.at(i)->setPieStartAngle(0);
+ m_donuts.at(i)->setPieEndAngle(360);
+ }
+ updateTimer->start();
+ }
+ slice->setExploded(exploded);
+}
+//! [7]
diff --git a/examples/charts/nesteddonuts/widget.h b/examples/charts/nesteddonuts/widget.h
new file mode 100644
index 00000000..6d2b749c
--- /dev/null
+++ b/examples/charts/nesteddonuts/widget.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef WIDGET_H
+#define WIDGET_H
+
+#include <QWidget>
+#include <QPieSeries>
+
+class QTimer;
+
+QT_CHARTS_USE_NAMESPACE
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Widget(QWidget *parent = 0);
+ ~Widget();
+
+public slots:
+ void updateRotation();
+ void explodeSlice(bool exploded);
+
+private:
+ QList<QPieSeries *> m_donuts;
+ QTimer *updateTimer;
+};
+
+#endif // WIDGET_H
diff --git a/examples/charts/percentbarchart/main.cpp b/examples/charts/percentbarchart/main.cpp
new file mode 100644
index 00000000..15a68206
--- /dev/null
+++ b/examples/charts/percentbarchart/main.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QPercentBarSeries>
+#include <QBarSet>
+#include <QLegend>
+#include <QBarCategoryAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QBarSet *set0 = new QBarSet("Jane");
+ QBarSet *set1 = new QBarSet("John");
+ QBarSet *set2 = new QBarSet("Axel");
+ QBarSet *set3 = new QBarSet("Mary");
+ QBarSet *set4 = new QBarSet("Samantha");
+
+ *set0 << 1 << 2 << 3 << 4 << 5 << 6;
+ *set1 << 5 << 0 << 0 << 4 << 0 << 7;
+ *set2 << 3 << 5 << 8 << 13 << 8 << 5;
+ *set3 << 5 << 6 << 7 << 3 << 4 << 5;
+ *set4 << 9 << 7 << 5 << 3 << 1 << 2;
+//![1]
+
+//![2]
+ QPercentBarSeries *series = new QPercentBarSeries();
+ series->append(set0);
+ series->append(set1);
+ series->append(set2);
+ series->append(set3);
+ series->append(set4);
+//![2]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->setTitle("Simple percentbarchart example");
+ chart->setAnimationOptions(QChart::SeriesAnimations);
+//![3]
+
+//![4]
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
+ QBarCategoryAxis *axis = new QBarCategoryAxis();
+ axis->append(categories);
+ chart->createDefaultAxes();
+ chart->setAxisX(axis, series);
+//![4]
+
+//![5]
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
+//![5]
+
+//![6]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![6]
+
+//![7]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(420, 300);
+ window.show();
+//![7]
+
+ return a.exec();
+}
+
diff --git a/examples/percentbarchart/percentbarchart.pro b/examples/charts/percentbarchart/percentbarchart.pro
index 983159d1..983159d1 100644
--- a/examples/percentbarchart/percentbarchart.pro
+++ b/examples/charts/percentbarchart/percentbarchart.pro
diff --git a/examples/charts/piechart/main.cpp b/examples/charts/piechart/main.cpp
new file mode 100644
index 00000000..5e7b4ef1
--- /dev/null
+++ b/examples/charts/piechart/main.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QPieSeries>
+#include <QPieSlice>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QPieSeries *series = new QPieSeries();
+ series->append("Jane", 1);
+ series->append("Joe", 2);
+ series->append("Andy", 3);
+ series->append("Barbara", 4);
+ series->append("Axel", 5);
+//![1]
+
+//![2]
+ QPieSlice *slice = series->slices().at(1);
+ slice->setExploded();
+ slice->setLabelVisible();
+ slice->setPen(QPen(Qt::darkGreen, 2));
+ slice->setBrush(Qt::green);
+//![2]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->setTitle("Simple piechart example");
+ chart->legend()->hide();
+//![3]
+
+//![4]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![4]
+
+//![5]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.show();
+//![5]
+
+ return a.exec();
+}
diff --git a/examples/piechart/piechart.pro b/examples/charts/piechart/piechart.pro
index 7bd48514..7bd48514 100644
--- a/examples/piechart/piechart.pro
+++ b/examples/charts/piechart/piechart.pro
diff --git a/demos/piechartcustomization/brushtool.cpp b/examples/charts/piechartcustomization/brushtool.cpp
index 08dff95a..08dff95a 100644
--- a/demos/piechartcustomization/brushtool.cpp
+++ b/examples/charts/piechartcustomization/brushtool.cpp
diff --git a/demos/piechartcustomization/brushtool.h b/examples/charts/piechartcustomization/brushtool.h
index f6e31b72..f6e31b72 100644
--- a/demos/piechartcustomization/brushtool.h
+++ b/examples/charts/piechartcustomization/brushtool.h
diff --git a/examples/charts/piechartcustomization/customslice.cpp b/examples/charts/piechartcustomization/customslice.cpp
new file mode 100644
index 00000000..bbcd1492
--- /dev/null
+++ b/examples/charts/piechartcustomization/customslice.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "customslice.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+CustomSlice::CustomSlice(QString label, qreal value)
+ : QPieSlice(label, value)
+{
+ connect(this, SIGNAL(hovered(bool)), this, SLOT(showHighlight(bool)));
+}
+
+QBrush CustomSlice::originalBrush()
+{
+ return m_originalBrush;
+}
+
+void CustomSlice::showHighlight(bool show)
+{
+ if (show) {
+ QBrush brush = this->brush();
+ m_originalBrush = brush;
+ brush.setColor(brush.color().lighter());
+ setBrush(brush);
+ } else {
+ setBrush(m_originalBrush);
+ }
+}
+
+#include "moc_customslice.cpp"
diff --git a/examples/charts/piechartcustomization/customslice.h b/examples/charts/piechartcustomization/customslice.h
new file mode 100644
index 00000000..4c8e81fa
--- /dev/null
+++ b/examples/charts/piechartcustomization/customslice.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef CUSTOMSLICE_H
+#define CUSTOMSLICE_H
+
+#include <QPieSlice>
+
+QT_CHARTS_USE_NAMESPACE
+
+class CustomSlice : public QPieSlice
+{
+ Q_OBJECT
+
+public:
+ CustomSlice(QString label, qreal value);
+
+public:
+ QBrush originalBrush();
+
+public Q_SLOTS:
+ void showHighlight(bool show);
+
+private:
+ QBrush m_originalBrush;
+};
+
+#endif // CUSTOMSLICE_H
diff --git a/demos/piechartcustomization/main.cpp b/examples/charts/piechartcustomization/main.cpp
index f35fd0fc..f35fd0fc 100644
--- a/demos/piechartcustomization/main.cpp
+++ b/examples/charts/piechartcustomization/main.cpp
diff --git a/examples/charts/piechartcustomization/mainwidget.cpp b/examples/charts/piechartcustomization/mainwidget.cpp
new file mode 100644
index 00000000..fb0ed05d
--- /dev/null
+++ b/examples/charts/piechartcustomization/mainwidget.cpp
@@ -0,0 +1,360 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "mainwidget.h"
+#include "customslice.h"
+#include "pentool.h"
+#include "brushtool.h"
+#include <QPushButton>
+#include <QComboBox>
+#include <QCheckBox>
+#include <QLineEdit>
+#include <QGroupBox>
+#include <QDoubleSpinBox>
+#include <QFormLayout>
+#include <QFontDialog>
+#include <QChartView>
+#include <QPieSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+MainWidget::MainWidget(QWidget *parent)
+ : QWidget(parent),
+ m_slice(0)
+{
+ // create chart
+ QChart *chart = new QChart;
+ chart->setTitle("Piechart customization");
+ chart->setAnimationOptions(QChart::AllAnimations);
+
+ // create series
+ m_series = new QPieSeries();
+ *m_series << new CustomSlice("Slice 1", 10.0);
+ *m_series << new CustomSlice("Slice 2", 20.0);
+ *m_series << new CustomSlice("Slice 3", 30.0);
+ *m_series << new CustomSlice("Slice 4", 40.0);
+ *m_series << new CustomSlice("Slice 5", 50.0);
+ m_series->setLabelsVisible();
+ chart->addSeries(m_series);
+
+ connect(m_series, SIGNAL(clicked(QPieSlice*)), this, SLOT(handleSliceClicked(QPieSlice*)));
+
+ // chart settings
+ m_themeComboBox = new QComboBox();
+ m_themeComboBox->addItem("Light", QChart::ChartThemeLight);
+ m_themeComboBox->addItem("BlueCerulean", QChart::ChartThemeBlueCerulean);
+ m_themeComboBox->addItem("Dark", QChart::ChartThemeDark);
+ m_themeComboBox->addItem("BrownSand", QChart::ChartThemeBrownSand);
+ m_themeComboBox->addItem("BlueNcs", QChart::ChartThemeBlueNcs);
+ m_themeComboBox->addItem("High Contrast", QChart::ChartThemeHighContrast);
+ m_themeComboBox->addItem("Blue Icy", QChart::ChartThemeBlueIcy);
+ m_themeComboBox->addItem("Qt", QChart::ChartThemeQt);
+
+ m_aaCheckBox = new QCheckBox();
+ m_animationsCheckBox = new QCheckBox();
+ m_animationsCheckBox->setCheckState(Qt::Checked);
+
+ m_legendCheckBox = new QCheckBox();
+
+ QFormLayout *chartSettingsLayout = new QFormLayout();
+ chartSettingsLayout->addRow("Theme", m_themeComboBox);
+ chartSettingsLayout->addRow("Antialiasing", m_aaCheckBox);
+ chartSettingsLayout->addRow("Animations", m_animationsCheckBox);
+ chartSettingsLayout->addRow("Legend", m_legendCheckBox);
+ QGroupBox *chartSettings = new QGroupBox("Chart");
+ chartSettings->setLayout(chartSettingsLayout);
+
+ connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateChartSettings()));
+ connect(m_aaCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateChartSettings()));
+ connect(m_animationsCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateChartSettings()));
+ connect(m_legendCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateChartSettings()));
+
+ // series settings
+ m_hPosition = new QDoubleSpinBox();
+ m_hPosition->setMinimum(0.0);
+ m_hPosition->setMaximum(1.0);
+ m_hPosition->setSingleStep(0.1);
+ m_hPosition->setValue(m_series->horizontalPosition());
+
+ m_vPosition = new QDoubleSpinBox();
+ m_vPosition->setMinimum(0.0);
+ m_vPosition->setMaximum(1.0);
+ m_vPosition->setSingleStep(0.1);
+ m_vPosition->setValue(m_series->verticalPosition());
+
+ m_sizeFactor = new QDoubleSpinBox();
+ m_sizeFactor->setMinimum(0.0);
+ m_sizeFactor->setMaximum(1.0);
+ m_sizeFactor->setSingleStep(0.1);
+ m_sizeFactor->setValue(m_series->pieSize());
+
+ m_startAngle = new QDoubleSpinBox();
+ m_startAngle->setMinimum(-720);
+ m_startAngle->setMaximum(720);
+ m_startAngle->setValue(m_series->pieStartAngle());
+ m_startAngle->setSingleStep(1);
+
+ m_endAngle = new QDoubleSpinBox();
+ m_endAngle->setMinimum(-720);
+ m_endAngle->setMaximum(720);
+ m_endAngle->setValue(m_series->pieEndAngle());
+ m_endAngle->setSingleStep(1);
+
+ m_holeSize = new QDoubleSpinBox();
+ m_holeSize->setMinimum(0.0);
+ m_holeSize->setMaximum(1.0);
+ m_holeSize->setSingleStep(0.1);
+ m_holeSize->setValue(m_series->holeSize());
+
+ QPushButton *appendSlice = new QPushButton("Append slice");
+ QPushButton *insertSlice = new QPushButton("Insert slice");
+ QPushButton *removeSlice = new QPushButton("Remove selected slice");
+
+ QFormLayout *seriesSettingsLayout = new QFormLayout();
+ seriesSettingsLayout->addRow("Horizontal position", m_hPosition);
+ seriesSettingsLayout->addRow("Vertical position", m_vPosition);
+ seriesSettingsLayout->addRow("Size factor", m_sizeFactor);
+ seriesSettingsLayout->addRow("Start angle", m_startAngle);
+ seriesSettingsLayout->addRow("End angle", m_endAngle);
+ seriesSettingsLayout->addRow("Hole size", m_holeSize);
+ seriesSettingsLayout->addRow(appendSlice);
+ seriesSettingsLayout->addRow(insertSlice);
+ seriesSettingsLayout->addRow(removeSlice);
+ QGroupBox *seriesSettings = new QGroupBox("Series");
+ seriesSettings->setLayout(seriesSettingsLayout);
+
+ connect(m_vPosition, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
+ connect(m_hPosition, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
+ connect(m_sizeFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
+ connect(m_startAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
+ connect(m_endAngle, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
+ connect(m_holeSize, SIGNAL(valueChanged(double)), this, SLOT(updateSerieSettings()));
+ connect(appendSlice, SIGNAL(clicked()), this, SLOT(appendSlice()));
+ connect(insertSlice, SIGNAL(clicked()), this, SLOT(insertSlice()));
+ connect(removeSlice, SIGNAL(clicked()), this, SLOT(removeSlice()));
+
+ // slice settings
+ m_sliceName = new QLineEdit("<click a slice>");
+ m_sliceName->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
+ m_sliceValue = new QDoubleSpinBox();
+ m_sliceValue->setMaximum(1000);
+ m_sliceLabelVisible = new QCheckBox();
+ m_sliceLabelArmFactor = new QDoubleSpinBox();
+ m_sliceLabelArmFactor->setSingleStep(0.01);
+ m_sliceExploded = new QCheckBox();
+ m_sliceExplodedFactor = new QDoubleSpinBox();
+ m_sliceExplodedFactor->setSingleStep(0.01);
+ m_pen = new QPushButton();
+ m_penTool = new PenTool("Slice pen", this);
+ m_brush = new QPushButton();
+ m_brushTool = new BrushTool("Slice brush", this);
+ m_font = new QPushButton();
+ m_labelBrush = new QPushButton();
+ m_labelBrushTool = new BrushTool("Label brush", this);
+ m_labelPosition = new QComboBox(this);
+ m_labelPosition->addItem("Outside", QPieSlice::LabelOutside);
+ m_labelPosition->addItem("Inside horizontal", QPieSlice::LabelInsideHorizontal);
+ m_labelPosition->addItem("Inside tangential", QPieSlice::LabelInsideTangential);
+ m_labelPosition->addItem("Inside normal", QPieSlice::LabelInsideNormal);
+
+ QFormLayout *sliceSettingsLayout = new QFormLayout();
+ sliceSettingsLayout->addRow("Label", m_sliceName);
+ sliceSettingsLayout->addRow("Value", m_sliceValue);
+ sliceSettingsLayout->addRow("Pen", m_pen);
+ sliceSettingsLayout->addRow("Brush", m_brush);
+ sliceSettingsLayout->addRow("Label visible", m_sliceLabelVisible);
+ sliceSettingsLayout->addRow("Label font", m_font);
+ sliceSettingsLayout->addRow("Label brush", m_labelBrush);
+ sliceSettingsLayout->addRow("Label position", m_labelPosition);
+ sliceSettingsLayout->addRow("Label arm length", m_sliceLabelArmFactor);
+ sliceSettingsLayout->addRow("Exploded", m_sliceExploded);
+ sliceSettingsLayout->addRow("Explode distance", m_sliceExplodedFactor);
+ QGroupBox *sliceSettings = new QGroupBox("Selected slice");
+ sliceSettings->setLayout(sliceSettingsLayout);
+
+ connect(m_sliceName, SIGNAL(textChanged(QString)), this, SLOT(updateSliceSettings()));
+ connect(m_sliceValue, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings()));
+ connect(m_pen, SIGNAL(clicked()), m_penTool, SLOT(show()));
+ connect(m_penTool, SIGNAL(changed()), this, SLOT(updateSliceSettings()));
+ connect(m_brush, SIGNAL(clicked()), m_brushTool, SLOT(show()));
+ connect(m_brushTool, SIGNAL(changed()), this, SLOT(updateSliceSettings()));
+ connect(m_font, SIGNAL(clicked()), this, SLOT(showFontDialog()));
+ connect(m_labelBrush, SIGNAL(clicked()), m_labelBrushTool, SLOT(show()));
+ connect(m_labelBrushTool, SIGNAL(changed()), this, SLOT(updateSliceSettings()));
+ connect(m_sliceLabelVisible, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings()));
+ connect(m_sliceLabelVisible, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings()));
+ connect(m_sliceLabelArmFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings()));
+ connect(m_sliceExploded, SIGNAL(toggled(bool)), this, SLOT(updateSliceSettings()));
+ connect(m_sliceExplodedFactor, SIGNAL(valueChanged(double)), this, SLOT(updateSliceSettings()));
+ connect(m_labelPosition, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSliceSettings()));
+
+ // create chart view
+ m_chartView = new QChartView(chart);
+
+ // create main layout
+ QVBoxLayout *settingsLayout = new QVBoxLayout();
+ settingsLayout->addWidget(chartSettings);
+ settingsLayout->addWidget(seriesSettings);
+ settingsLayout->addWidget(sliceSettings);
+ settingsLayout->addStretch();
+
+ QGridLayout *baseLayout = new QGridLayout();
+ baseLayout->addLayout(settingsLayout, 0, 0);
+ baseLayout->addWidget(m_chartView, 0, 1);
+ setLayout(baseLayout);
+
+ updateSerieSettings();
+ updateChartSettings();
+}
+
+
+void MainWidget::updateChartSettings()
+{
+ QChart::ChartTheme theme = (QChart::ChartTheme) m_themeComboBox->itemData(m_themeComboBox->currentIndex()).toInt();
+ m_chartView->chart()->setTheme(theme);
+ m_chartView->setRenderHint(QPainter::Antialiasing, m_aaCheckBox->isChecked());
+
+ if (m_animationsCheckBox->checkState() == Qt::Checked)
+ m_chartView->chart()->setAnimationOptions(QChart::AllAnimations);
+ else
+ m_chartView->chart()->setAnimationOptions(QChart::NoAnimation);
+
+ if (m_legendCheckBox->checkState() == Qt::Checked)
+ m_chartView->chart()->legend()->show();
+ else
+ m_chartView->chart()->legend()->hide();
+}
+
+void MainWidget::updateSerieSettings()
+{
+ m_series->setHorizontalPosition(m_hPosition->value());
+ m_series->setVerticalPosition(m_vPosition->value());
+ m_series->setPieSize(m_sizeFactor->value());
+ m_holeSize->setMaximum(m_sizeFactor->value());
+ m_series->setPieStartAngle(m_startAngle->value());
+ m_series->setPieEndAngle(m_endAngle->value());
+ m_series->setHoleSize(m_holeSize->value());
+}
+
+void MainWidget::updateSliceSettings()
+{
+ if (!m_slice)
+ return;
+
+ m_slice->setLabel(m_sliceName->text());
+
+ m_slice->setValue(m_sliceValue->value());
+
+ m_slice->setPen(m_penTool->pen());
+ m_slice->setBrush(m_brushTool->brush());
+
+ m_slice->setLabelBrush(m_labelBrushTool->brush());
+ m_slice->setLabelVisible(m_sliceLabelVisible->isChecked());
+ m_slice->setLabelArmLengthFactor(m_sliceLabelArmFactor->value());
+ m_slice->setLabelPosition((QPieSlice::LabelPosition)m_labelPosition->currentIndex()); // assumes that index is in sync with the enum
+
+ m_slice->setExploded(m_sliceExploded->isChecked());
+ m_slice->setExplodeDistanceFactor(m_sliceExplodedFactor->value());
+}
+
+void MainWidget::handleSliceClicked(QPieSlice *slice)
+{
+ m_slice = static_cast<CustomSlice *>(slice);
+
+ // name
+ m_sliceName->blockSignals(true);
+ m_sliceName->setText(slice->label());
+ m_sliceName->blockSignals(false);
+
+ // value
+ m_sliceValue->blockSignals(true);
+ m_sliceValue->setValue(slice->value());
+ m_sliceValue->blockSignals(false);
+
+ // pen
+ m_pen->setText(PenTool::name(m_slice->pen()));
+ m_penTool->setPen(m_slice->pen());
+
+ // brush
+ m_brush->setText(m_slice->originalBrush().color().name());
+ m_brushTool->setBrush(m_slice->originalBrush());
+
+ // label
+ m_labelBrush->setText(BrushTool::name(m_slice->labelBrush()));
+ m_labelBrushTool->setBrush(m_slice->labelBrush());
+ m_font->setText(slice->labelFont().toString());
+ m_sliceLabelVisible->blockSignals(true);
+ m_sliceLabelVisible->setChecked(slice->isLabelVisible());
+ m_sliceLabelVisible->blockSignals(false);
+ m_sliceLabelArmFactor->blockSignals(true);
+ m_sliceLabelArmFactor->setValue(slice->labelArmLengthFactor());
+ m_sliceLabelArmFactor->blockSignals(false);
+ m_labelPosition->blockSignals(true);
+ m_labelPosition->setCurrentIndex(slice->labelPosition()); // assumes that index is in sync with the enum
+ m_labelPosition->blockSignals(false);
+
+ // exploded
+ m_sliceExploded->blockSignals(true);
+ m_sliceExploded->setChecked(slice->isExploded());
+ m_sliceExploded->blockSignals(false);
+ m_sliceExplodedFactor->blockSignals(true);
+ m_sliceExplodedFactor->setValue(slice->explodeDistanceFactor());
+ m_sliceExplodedFactor->blockSignals(false);
+}
+
+void MainWidget::showFontDialog()
+{
+ if (!m_slice)
+ return;
+
+ QFontDialog dialog(m_slice->labelFont());
+ dialog.show();
+ dialog.exec();
+
+ m_slice->setLabelFont(dialog.currentFont());
+ m_font->setText(dialog.currentFont().toString());
+}
+
+void MainWidget::appendSlice()
+{
+ *m_series << new CustomSlice("Slice " + QString::number(m_series->count() + 1), 10.0);
+}
+
+void MainWidget::insertSlice()
+{
+ if (!m_slice)
+ return;
+
+ int i = m_series->slices().indexOf(m_slice);
+
+ m_series->insert(i, new CustomSlice("Slice " + QString::number(m_series->count() + 1), 10.0));
+}
+
+void MainWidget::removeSlice()
+{
+ if (!m_slice)
+ return;
+
+ m_sliceName->setText("<click a slice>");
+
+ m_series->remove(m_slice);
+ m_slice = 0;
+}
+
+#include "moc_mainwidget.cpp"
diff --git a/examples/charts/piechartcustomization/mainwidget.h b/examples/charts/piechartcustomization/mainwidget.h
new file mode 100644
index 00000000..e9d3ada1
--- /dev/null
+++ b/examples/charts/piechartcustomization/mainwidget.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef MAINWIDGET_H
+#define MAINWIDGET_H
+
+#include <QWidget>
+#include <QChartGlobal>
+
+class QLineEdit;
+class QPushButton;
+class QCheckBox;
+class QComboBox;
+class QDoubleSpinBox;
+class PenTool;
+class BrushTool;
+class CustomSlice;
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QChartView;
+class QPieSeries;
+class QPieSlice;
+QT_CHARTS_END_NAMESPACE
+
+QT_CHARTS_USE_NAMESPACE
+
+class MainWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MainWidget(QWidget *parent = 0);
+
+public Q_SLOTS:
+ void updateChartSettings();
+ void updateSerieSettings();
+ void updateSliceSettings();
+ void handleSliceClicked(QPieSlice *slice);
+ void showFontDialog();
+ void appendSlice();
+ void insertSlice();
+ void removeSlice();
+
+private:
+ QComboBox *m_themeComboBox;
+ QCheckBox *m_aaCheckBox;
+ QCheckBox *m_animationsCheckBox;
+ QCheckBox *m_legendCheckBox;
+
+ QChartView *m_chartView;
+ QPieSeries *m_series;
+ CustomSlice *m_slice;
+
+ QDoubleSpinBox *m_hPosition;
+ QDoubleSpinBox *m_vPosition;
+ QDoubleSpinBox *m_sizeFactor;
+ QDoubleSpinBox *m_startAngle;
+ QDoubleSpinBox *m_endAngle;
+ QDoubleSpinBox *m_holeSize;
+
+ QLineEdit *m_sliceName;
+ QDoubleSpinBox *m_sliceValue;
+ QCheckBox *m_sliceLabelVisible;
+ QDoubleSpinBox *m_sliceLabelArmFactor;
+ QCheckBox *m_sliceExploded;
+ QDoubleSpinBox *m_sliceExplodedFactor;
+ QPushButton *m_brush;
+ BrushTool *m_brushTool;
+ QPushButton *m_pen;
+ PenTool *m_penTool;
+ QPushButton *m_font;
+ QPushButton *m_labelBrush;
+ QComboBox *m_labelPosition;
+ BrushTool *m_labelBrushTool;
+};
+
+#endif // MAINWIDGET_H
diff --git a/demos/piechartcustomization/pentool.cpp b/examples/charts/piechartcustomization/pentool.cpp
index 104231ee..104231ee 100644
--- a/demos/piechartcustomization/pentool.cpp
+++ b/examples/charts/piechartcustomization/pentool.cpp
diff --git a/demos/piechartcustomization/pentool.h b/examples/charts/piechartcustomization/pentool.h
index 66e7ab10..66e7ab10 100644
--- a/demos/piechartcustomization/pentool.h
+++ b/examples/charts/piechartcustomization/pentool.h
diff --git a/examples/charts/piechartcustomization/piechartcustomization.pro b/examples/charts/piechartcustomization/piechartcustomization.pro
new file mode 100644
index 00000000..722744de
--- /dev/null
+++ b/examples/charts/piechartcustomization/piechartcustomization.pro
@@ -0,0 +1,16 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+TARGET = piechartcustomization
+SOURCES += main.cpp \
+ pentool.cpp \
+ brushtool.cpp \
+ customslice.cpp \
+ mainwidget.cpp
+
+HEADERS += \
+ pentool.h \
+ brushtool.h \
+ customslice.h \
+ mainwidget.h
diff --git a/examples/charts/piechartdrilldown/drilldownchart.cpp b/examples/charts/piechartdrilldown/drilldownchart.cpp
new file mode 100644
index 00000000..b326472c
--- /dev/null
+++ b/examples/charts/piechartdrilldown/drilldownchart.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "drilldownchart.h"
+#include "drilldownslice.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+DrilldownChart::DrilldownChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
+ : QChart(QChart::ChartTypeCartesian, parent, wFlags),
+ m_currentSeries(0)
+{
+
+}
+
+DrilldownChart::~DrilldownChart()
+{
+
+}
+
+void DrilldownChart::changeSeries(QAbstractSeries *series)
+{
+ // NOTE: if the series is owned by the chart it will be deleted
+ // here the "window" owns the series...
+ if (m_currentSeries)
+ removeSeries(m_currentSeries);
+ m_currentSeries = series;
+ addSeries(series);
+ setTitle(series->name());
+}
+
+void DrilldownChart::handleSliceClicked(QPieSlice *slice)
+{
+ DrilldownSlice *drilldownSlice = static_cast<DrilldownSlice *>(slice);
+ changeSeries(drilldownSlice->drilldownSeries());
+}
+
+#include "moc_drilldownchart.cpp"
diff --git a/examples/charts/piechartdrilldown/drilldownchart.h b/examples/charts/piechartdrilldown/drilldownchart.h
new file mode 100644
index 00000000..554b6651
--- /dev/null
+++ b/examples/charts/piechartdrilldown/drilldownchart.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef DRILLDOWNCHART_H
+#define DRILLDOWNCHART_H
+
+#include <QChart>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QAbstractSeries;
+class QPieSlice;
+QT_CHARTS_END_NAMESPACE
+
+QT_CHARTS_USE_NAMESPACE
+
+class DrilldownChart : public QChart
+{
+ Q_OBJECT
+public:
+ explicit DrilldownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
+ ~DrilldownChart();
+ void changeSeries(QAbstractSeries *series);
+
+public Q_SLOTS:
+ void handleSliceClicked(QPieSlice *slice);
+
+private:
+ QAbstractSeries *m_currentSeries;
+};
+
+#endif // DRILLDOWNCHART_H
diff --git a/examples/charts/piechartdrilldown/drilldownslice.cpp b/examples/charts/piechartdrilldown/drilldownslice.cpp
new file mode 100644
index 00000000..c04d7fe7
--- /dev/null
+++ b/examples/charts/piechartdrilldown/drilldownslice.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "drilldownslice.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+DrilldownSlice::DrilldownSlice(qreal value, QString prefix, QAbstractSeries *drilldownSeries)
+ : m_drilldownSeries(drilldownSeries),
+ m_prefix(prefix)
+{
+ setValue(value);
+ updateLabel();
+ setLabelFont(QFont("Arial", 8));
+ connect(this, SIGNAL(percentageChanged()), this, SLOT(updateLabel()));
+ connect(this, SIGNAL(hovered(bool)), this, SLOT(showHighlight(bool)));
+}
+
+DrilldownSlice::~DrilldownSlice()
+{
+
+}
+
+QAbstractSeries *DrilldownSlice::drilldownSeries() const
+{
+ return m_drilldownSeries;
+}
+
+void DrilldownSlice::updateLabel()
+{
+ QString label = m_prefix;
+ label += " $";
+ label += QString::number(this->value());
+ label += ", ";
+ label += QString::number(this->percentage() * 100, 'f', 1);
+ label += "%";
+ setLabel(label);
+}
+
+void DrilldownSlice::showHighlight(bool show)
+{
+ setLabelVisible(show);
+ setExploded(show);
+}
+
+#include "moc_drilldownslice.cpp"
diff --git a/examples/charts/piechartdrilldown/drilldownslice.h b/examples/charts/piechartdrilldown/drilldownslice.h
new file mode 100644
index 00000000..9743e852
--- /dev/null
+++ b/examples/charts/piechartdrilldown/drilldownslice.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef DRILLDOWNSLICE_H
+#define DRILLDOWNSLICE_H
+
+#include <QPieSlice>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QAbstractSeries;
+QT_CHARTS_END_NAMESPACE
+
+QT_CHARTS_USE_NAMESPACE
+
+class DrilldownSlice : public QPieSlice
+{
+ Q_OBJECT
+
+public:
+ DrilldownSlice(qreal value, QString prefix, QAbstractSeries *drilldownSeries);
+ virtual ~DrilldownSlice();
+ QAbstractSeries *drilldownSeries() const;
+
+public Q_SLOTS:
+ void updateLabel();
+ void showHighlight(bool show);
+
+private:
+ QAbstractSeries *m_drilldownSeries;
+ QString m_prefix;
+};
+
+#endif // DRILLDOWNSLICE_H
diff --git a/examples/charts/piechartdrilldown/main.cpp b/examples/charts/piechartdrilldown/main.cpp
new file mode 100644
index 00000000..a32587ff
--- /dev/null
+++ b/examples/charts/piechartdrilldown/main.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "drilldownchart.h"
+#include "drilldownslice.h"
+#include <QApplication>
+#include <QMainWindow>
+#include <QTime>
+#include <QChartView>
+#include <QLegend>
+#include <QPieSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
+
+ QMainWindow window;
+
+ DrilldownChart *chart = new DrilldownChart();
+ chart->setTheme(QChart::ChartThemeLight);
+ chart->setAnimationOptions(QChart::AllAnimations);
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignRight);
+
+ QPieSeries *yearSeries = new QPieSeries(&window);
+ yearSeries->setName("Sales by year - All");
+
+ QList<QString> months;
+ months << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
+ QList<QString> names;
+ names << "Jane" << "John" << "Axel" << "Mary" << "Susan" << "Bob";
+
+ foreach (QString name, names) {
+ QPieSeries *series = new QPieSeries(&window);
+ series->setName("Sales by month - " + name);
+
+ foreach (QString month, months)
+ *series << new DrilldownSlice(qrand() % 1000, month, yearSeries);
+
+ QObject::connect(series, SIGNAL(clicked(QPieSlice*)), chart, SLOT(handleSliceClicked(QPieSlice*)));
+
+ *yearSeries << new DrilldownSlice(series->sum(), name, series);
+ }
+
+ QObject::connect(yearSeries, SIGNAL(clicked(QPieSlice*)), chart, SLOT(handleSliceClicked(QPieSlice*)));
+
+ chart->changeSeries(yearSeries);
+
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+ window.setCentralWidget(chartView);
+ window.resize(800, 500);
+ window.show();
+
+ return a.exec();
+}
diff --git a/examples/piechartdrilldown/piechartdrilldown.pro b/examples/charts/piechartdrilldown/piechartdrilldown.pro
index 0f9626c9..0f9626c9 100644
--- a/examples/piechartdrilldown/piechartdrilldown.pro
+++ b/examples/charts/piechartdrilldown/piechartdrilldown.pro
diff --git a/examples/charts/polarchart/chartview.cpp b/examples/charts/polarchart/chartview.cpp
new file mode 100644
index 00000000..038ce709
--- /dev/null
+++ b/examples/charts/polarchart/chartview.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartview.h"
+#include <QMouseEvent>
+#include <QDebug>
+#include <QAbstractAxis>
+#include <QValueAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+ChartView::ChartView(QWidget *parent)
+ : QChartView(parent)
+{
+}
+
+//![1]
+void ChartView::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Plus:
+ chart()->zoomIn();
+ break;
+ case Qt::Key_Minus:
+ chart()->zoomOut();
+ break;
+ case Qt::Key_Left:
+ chart()->scroll(-1.0, 0);
+ break;
+ case Qt::Key_Right:
+ chart()->scroll(1.0, 0);
+ break;
+ case Qt::Key_Up:
+ chart()->scroll(0, 1.0);
+ break;
+ case Qt::Key_Down:
+ chart()->scroll(0, -1.0);
+ break;
+ case Qt::Key_Space:
+ switchChartType();
+ break;
+ default:
+ QGraphicsView::keyPressEvent(event);
+ break;
+ }
+}
+//![1]
+
+//![2]
+void ChartView::switchChartType()
+{
+ QChart *newChart;
+ QChart *oldChart = chart();
+
+ if (oldChart->chartType() == QChart::ChartTypeCartesian)
+ newChart = new QPolarChart();
+ else
+ newChart = new QChart();
+
+ // Move series and axes from old chart to new one
+ QList<QAbstractSeries *> seriesList = oldChart->series();
+ QList<QAbstractAxis *> axisList = oldChart->axes();
+ QList<QPair<qreal, qreal> > axisRanges;
+
+ foreach (QAbstractAxis *axis, axisList) {
+ QValueAxis *valueAxis = static_cast<QValueAxis *>(axis);
+ axisRanges.append(QPair<qreal, qreal>(valueAxis->min(), valueAxis->max()));
+ }
+
+ foreach (QAbstractSeries *series, seriesList)
+ oldChart->removeSeries(series);
+
+ foreach (QAbstractAxis *axis, axisList) {
+ oldChart->removeAxis(axis);
+ newChart->addAxis(axis, axis->alignment());
+ }
+
+ foreach (QAbstractSeries *series, seriesList) {
+ newChart->addSeries(series);
+ foreach (QAbstractAxis *axis, axisList)
+ series->attachAxis(axis);
+ }
+
+ int count = 0;
+ foreach (QAbstractAxis *axis, axisList) {
+ axis->setRange(axisRanges[count].first, axisRanges[count].second);
+ count++;
+ }
+
+ newChart->setTitle(oldChart->title());
+ setChart(newChart);
+ delete oldChart;
+}
+//![2]
diff --git a/examples/charts/polarchart/chartview.h b/examples/charts/polarchart/chartview.h
new file mode 100644
index 00000000..9f59b469
--- /dev/null
+++ b/examples/charts/polarchart/chartview.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHARTVIEW_H
+#define CHARTVIEW_H
+
+#include <QChartView>
+#include <QPolarChart>
+
+QT_CHARTS_USE_NAMESPACE
+
+class ChartView : public QChartView
+{
+public:
+ ChartView(QWidget *parent = 0);
+
+protected:
+ void keyPressEvent(QKeyEvent *event);
+
+private:
+ void switchChartType();
+};
+
+#endif
diff --git a/examples/charts/polarchart/main.cpp b/examples/charts/polarchart/main.cpp
new file mode 100644
index 00000000..cc959519
--- /dev/null
+++ b/examples/charts/polarchart/main.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartview.h"
+#include <QApplication>
+#include <QMainWindow>
+#include <QScatterSeries>
+#include <QLineSeries>
+#include <QSplineSeries>
+#include <QAreaSeries>
+#include <QValueAxis>
+#include <QPolarChart>
+#include <QDebug>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ const qreal angularMin = -100;
+ const qreal angularMax = 100;
+
+ const qreal radialMin = -100;
+ const qreal radialMax = 100;
+
+ QScatterSeries *series1 = new QScatterSeries();
+ series1->setName("scatter");
+ for (int i = angularMin; i <= angularMax; i += 10)
+ series1->append(i, (i / radialMax) * radialMax + 8.0);
+
+ QSplineSeries *series2 = new QSplineSeries();
+ series2->setName("spline");
+ for (int i = angularMin; i <= angularMax; i += 10)
+ series2->append(i, (i / radialMax) * radialMax);
+
+ QLineSeries *series3 = new QLineSeries();
+ series3->setName("star outer");
+ qreal ad = (angularMax - angularMin) / 8;
+ qreal rd = (radialMax - radialMin) / 3 * 1.3;
+ series3->append(angularMin, radialMax);
+ series3->append(angularMin + ad*1, radialMin + rd);
+ series3->append(angularMin + ad*2, radialMax);
+ series3->append(angularMin + ad*3, radialMin + rd);
+ series3->append(angularMin + ad*4, radialMax);
+ series3->append(angularMin + ad*5, radialMin + rd);
+ series3->append(angularMin + ad*6, radialMax);
+ series3->append(angularMin + ad*7, radialMin + rd);
+ series3->append(angularMin + ad*8, radialMax);
+
+ QLineSeries *series4 = new QLineSeries();
+ series4->setName("star inner");
+ ad = (angularMax - angularMin) / 8;
+ rd = (radialMax - radialMin) / 3;
+ series4->append(angularMin, radialMax);
+ series4->append(angularMin + ad*1, radialMin + rd);
+ series4->append(angularMin + ad*2, radialMax);
+ series4->append(angularMin + ad*3, radialMin + rd);
+ series4->append(angularMin + ad*4, radialMax);
+ series4->append(angularMin + ad*5, radialMin + rd);
+ series4->append(angularMin + ad*6, radialMax);
+ series4->append(angularMin + ad*7, radialMin + rd);
+ series4->append(angularMin + ad*8, radialMax);
+
+ QAreaSeries *series5 = new QAreaSeries();
+ series5->setName("star area");
+ series5->setUpperSeries(series3);
+ series5->setLowerSeries(series4);
+ series5->setOpacity(0.5);
+
+ //![1]
+ QPolarChart *chart = new QPolarChart();
+ //![1]
+ chart->addSeries(series1);
+ chart->addSeries(series2);
+ chart->addSeries(series3);
+ chart->addSeries(series4);
+ chart->addSeries(series5);
+
+ chart->setTitle("Use arrow keys to scroll, +/- to zoom, and space to switch chart type.");
+
+ //![2]
+ QValueAxis *angularAxis = new QValueAxis();
+ angularAxis->setTickCount(9); // First and last ticks are co-located on 0/360 angle.
+ angularAxis->setLabelFormat("%.1f");
+ angularAxis->setShadesVisible(true);
+ angularAxis->setShadesBrush(QBrush(QColor(249, 249, 255)));
+ chart->addAxis(angularAxis, QPolarChart::PolarOrientationAngular);
+
+ QValueAxis *radialAxis = new QValueAxis();
+ radialAxis->setTickCount(9);
+ radialAxis->setLabelFormat("%d");
+ chart->addAxis(radialAxis, QPolarChart::PolarOrientationRadial);
+ //![2]
+
+ series1->attachAxis(radialAxis);
+ series1->attachAxis(angularAxis);
+ series2->attachAxis(radialAxis);
+ series2->attachAxis(angularAxis);
+ series3->attachAxis(radialAxis);
+ series3->attachAxis(angularAxis);
+ series4->attachAxis(radialAxis);
+ series4->attachAxis(angularAxis);
+ series5->attachAxis(radialAxis);
+ series5->attachAxis(angularAxis);
+
+ radialAxis->setRange(radialMin, radialMax);
+ angularAxis->setRange(angularMin, angularMax);
+
+ ChartView *chartView = new ChartView();
+ chartView->setChart(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(800, 600);
+ window.show();
+
+ return a.exec();
+}
diff --git a/examples/polarchart/polarchart.pro b/examples/charts/polarchart/polarchart.pro
index 8759c1ce..8759c1ce 100644
--- a/examples/polarchart/polarchart.pro
+++ b/examples/charts/polarchart/polarchart.pro
diff --git a/examples/charts/qmlaxes/main.cpp b/examples/charts/qmlaxes/main.cpp
new file mode 100644
index 00000000..bb0957e8
--- /dev/null
+++ b/examples/charts/qmlaxes/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QtCore/QDir>
+#include <QtQuick/QQuickView>
+#include <QtQml/QQmlEngine>
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ viewer.setTitle(QStringLiteral("QML Axes"));
+ viewer.setSource(QUrl("qrc:/qml/qmlaxes/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmlaxes/qml/qmlaxes/View1.qml b/examples/charts/qmlaxes/qml/qmlaxes/View1.qml
new file mode 100644
index 00000000..4c09e269
--- /dev/null
+++ b/examples/charts/qmlaxes/qml/qmlaxes/View1.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Two Series, Common Axes"
+ anchors.fill: parent
+ legend.visible: false
+ antialiasing: true
+
+ ValueAxis {
+ id: axisX
+ min: 0
+ max: 10
+ tickCount: 5
+ }
+
+ ValueAxis {
+ id: axisY
+ min: -0.5
+ max: 1.5
+ }
+
+ LineSeries {
+ id: series1
+ axisX: axisX
+ axisY: axisY
+ }
+
+ ScatterSeries {
+ id: series2
+ axisX: axisX
+ axisY: axisY
+ }
+ }
+
+ // Add data dynamically to the series
+ Component.onCompleted: {
+ for (var i = 0; i <= 10; i++) {
+ series1.append(i, Math.random());
+ series2.append(i, Math.random());
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlaxes/qml/qmlaxes/View2.qml b/examples/charts/qmlaxes/qml/qmlaxes/View2.qml
new file mode 100644
index 00000000..4672c19f
--- /dev/null
+++ b/examples/charts/qmlaxes/qml/qmlaxes/View2.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Accurate Historical Data"
+ anchors.fill: parent
+ legend.visible: false
+ antialiasing: true
+
+ LineSeries {
+ axisX: DateTimeAxis {
+ format: "yyyy MMM"
+ tickCount: 5
+ }
+ axisY: ValueAxis {
+ min: 0
+ max: 150
+ }
+
+ // Please note that month in JavaScript months are zero based, so 2 means March
+ XYPoint { x: toMsecsSinceEpoch(new Date(1950, 2, 15)); y: 5 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 50 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1987, 12, 31)); y: 102 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 100 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 2)); y: 110 }
+ }
+ }
+
+ // DateTimeAxis is based on QDateTimes so we must convert our JavaScript dates to
+ // milliseconds since epoch to make them match the DateTimeAxis values
+ function toMsecsSinceEpoch(date) {
+ var msecs = date.getTime();
+ return msecs;
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlaxes/qml/qmlaxes/View3.qml b/examples/charts/qmlaxes/qml/qmlaxes/View3.qml
new file mode 100644
index 00000000..711833c6
--- /dev/null
+++ b/examples/charts/qmlaxes/qml/qmlaxes/View3.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Numerical Data for Dummies"
+ anchors.fill: parent
+ legend.visible: false
+ antialiasing: true
+
+ LineSeries {
+ axisY: CategoryAxis {
+ min: 0
+ max: 30
+ CategoryRange {
+ label: "critical"
+ endValue: 2
+ }
+ CategoryRange {
+ label: "low"
+ endValue: 4
+ }
+ CategoryRange {
+ label: "normal"
+ endValue: 7
+ }
+ CategoryRange {
+ label: "high"
+ endValue: 15
+ }
+ CategoryRange {
+ label: "extremely high"
+ endValue: 30
+ }
+ }
+
+ XYPoint { x: 0; y: 4.3 }
+ XYPoint { x: 1; y: 4.1 }
+ XYPoint { x: 2; y: 4.7 }
+ XYPoint { x: 3; y: 3.9 }
+ XYPoint { x: 4; y: 5.2 }
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlaxes/qml/qmlaxes/main.qml b/examples/charts/qmlaxes/qml/qmlaxes/main.qml
new file mode 100644
index 00000000..cc75dca3
--- /dev/null
+++ b/examples/charts/qmlaxes/qml/qmlaxes/main.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 440
+ height: 330
+ property bool sourceLoaded: false
+
+ ListView {
+ id: root
+ focus: true
+ anchors.fill: parent
+ snapMode: ListView.SnapOneItem
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlightMoveDuration: 250
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+
+ onCurrentIndexChanged: {
+ if (infoText.opacity > 0.0) {
+ if (sourceLoaded)
+ infoText.opacity = 0.0;
+ else if (currentIndex != 0)
+ currentIndex = 0;
+ }
+ }
+
+ model: ListModel {
+ ListElement {component: "View1.qml"}
+ ListElement {component: "View2.qml"}
+ ListElement {component: "View3.qml"}
+ }
+
+ delegate: Loader {
+ width: root.width
+ height: root.height
+
+ source: component
+ asynchronous: true
+
+ onLoaded: sourceLoaded = true
+ }
+ }
+
+ Rectangle {
+ id: infoText
+ anchors.centerIn: parent
+ width: parent.width
+ height: 40
+ color: "black"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: "You can navigate between views using swipe or arrow keys"
+ }
+
+ Behavior on opacity {
+ NumberAnimation { duration: 400 }
+ }
+ }
+}
diff --git a/examples/charts/qmlaxes/qmlaxes.pro b/examples/charts/qmlaxes/qmlaxes.pro
new file mode 100644
index 00000000..50b4c012
--- /dev/null
+++ b/examples/charts/qmlaxes/qmlaxes.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/qmlaxes/*
diff --git a/examples/charts/qmlaxes/resources.qrc b/examples/charts/qmlaxes/resources.qrc
new file mode 100644
index 00000000..c30b2f2c
--- /dev/null
+++ b/examples/charts/qmlaxes/resources.qrc
@@ -0,0 +1,8 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/qmlaxes/main.qml</file>
+ <file>qml/qmlaxes/View1.qml</file>
+ <file>qml/qmlaxes/View2.qml</file>
+ <file>qml/qmlaxes/View3.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/charts/qmlboxplot/main.cpp b/examples/charts/qmlboxplot/main.cpp
new file mode 100644
index 00000000..709bd5d2
--- /dev/null
+++ b/examples/charts/qmlboxplot/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QDir>
+#include <QtQuick/QQuickView>
+#include <QtQml/QQmlEngine>
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ viewer.setTitle(QStringLiteral("QML Box Plot"));
+ viewer.setSource(QUrl("qrc:/qml/qmlboxplot/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmlboxplot/qml/qmlboxplot/main.qml b/examples/charts/qmlboxplot/qml/qmlboxplot/main.qml
new file mode 100644
index 00000000..bb71b5df
--- /dev/null
+++ b/examples/charts/qmlboxplot/qml/qmlboxplot/main.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+ChartView {
+ title: "Box Plot series"
+ width: 400
+ height: 300
+ theme: ChartView.ChartThemeBrownSand
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ BoxPlotSeries {
+ id: plotSeries
+ name: "Income"
+ BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] }
+ BoxSet { label: "Feb"; values: [5, 6, 7.5, 8.6, 11.8] }
+ BoxSet { label: "Mar"; values: [3.2, 5, 5.7, 8, 9.2] }
+ BoxSet { label: "Apr"; values: [3.8, 5, 6.4, 7, 8] }
+ BoxSet { label: "May"; values: [4, 5, 5.2, 6, 7] }
+ }
+}
diff --git a/examples/charts/qmlboxplot/qmlboxplot.pro b/examples/charts/qmlboxplot/qmlboxplot.pro
new file mode 100644
index 00000000..237f05f1
--- /dev/null
+++ b/examples/charts/qmlboxplot/qmlboxplot.pro
@@ -0,0 +1,9 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+
+OTHER_FILES += \
+ qml/qmlboxplot/main.qml
diff --git a/examples/qmlboxplot/resources.qrc b/examples/charts/qmlboxplot/resources.qrc
index 49a98f16..49a98f16 100644
--- a/examples/qmlboxplot/resources.qrc
+++ b/examples/charts/qmlboxplot/resources.qrc
diff --git a/examples/charts/qmlchart/main.cpp b/examples/charts/qmlchart/main.cpp
new file mode 100644
index 00000000..16327b97
--- /dev/null
+++ b/examples/charts/qmlchart/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickView>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ viewer.setTitle(QStringLiteral("QML Chart"));
+
+ viewer.setSource(QUrl("qrc:/qml/qmlchart/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View1.qml b/examples/charts/qmlchart/qml/qmlchart/View1.qml
new file mode 100644
index 00000000..20590780
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View1.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![2]
+import QtQuick 2.0
+//![2]
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+ property variant othersSlice: 0
+
+ //![1]
+ ChartView {
+ id: chart
+ title: "Top-5 car brand shares in Finland"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ PieSeries {
+ id: pieSeries
+ PieSlice { label: "Volkswagen"; value: 13.5 }
+ PieSlice { label: "Toyota"; value: 10.9 }
+ PieSlice { label: "Ford"; value: 8.6 }
+ PieSlice { label: "Skoda"; value: 8.2 }
+ PieSlice { label: "Volvo"; value: 6.8 }
+ }
+ }
+
+ Component.onCompleted: {
+ // You can also manipulate slices dynamically
+ othersSlice = pieSeries.append("Others", 52.0);
+ pieSeries.find("Volkswagen").exploded = true;
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View10.qml b/examples/charts/qmlchart/qml/qmlchart/View10.qml
new file mode 100644
index 00000000..a3e3442b
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View10.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Horizontal Stacked Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ HorizontalStackedBarSeries {
+ axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View11.qml b/examples/charts/qmlchart/qml/qmlchart/View11.qml
new file mode 100644
index 00000000..68aaf907
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View11.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Horizontal Percent Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ HorizontalPercentBarSeries {
+ axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
+
diff --git a/examples/charts/qmlchart/qml/qmlchart/View12.qml b/examples/charts/qmlchart/qml/qmlchart/View12.qml
new file mode 100644
index 00000000..04be8f00
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View12.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ id: chart
+ title: "Production costs"
+ anchors.fill: parent
+ legend.visible: false
+ antialiasing: true
+
+ PieSeries {
+ id: pieOuter
+ size: 0.96
+ holeSize: 0.7
+ PieSlice { id: slice; label: "Alpha"; value: 19511; color: "#8AB846"; borderColor: "#163430" }
+ PieSlice { label: "Epsilon"; value: 11105; color: "#C0EEFF"; borderColor: "#3B391C" }
+ PieSlice { label: "Psi"; value: 9352; color: "#DF8939"; borderColor: "#13060C" }
+ }
+
+ PieSeries {
+ size: 0.7
+ id: pieInner
+ holeSize: 0.25
+
+ PieSlice { label: "Materials"; value: 10334; color: "#8AB846"; borderColor: "#163430" }
+ PieSlice { label: "Employee"; value: 3066; color: "#AAE356"; borderColor: "#163430" }
+ PieSlice { label: "Logistics"; value: 6111; color: "#99CC4E"; borderColor: "#163430" }
+
+ PieSlice { label: "Materials"; value: 7371; color: "#C0EEFF"; borderColor: "#3B391C" }
+ PieSlice { label: "Employee"; value: 2443; color: "#C9FAFF"; borderColor: "#3B391C" }
+ PieSlice { label: "Logistics"; value: 1291; color: "#B0FAFF"; borderColor: "#3B391C" }
+
+ PieSlice { label: "Materials"; value: 4022; color: "#DF8939"; borderColor: "#13060C" }
+ PieSlice { label: "Employee"; value: 3998; color: "#FC9D42"; borderColor: "#13060C" }
+ PieSlice { label: "Logistics"; value: 1332; color: "#F2963F"; borderColor: "#13060C" }
+ }
+ }
+
+ Component.onCompleted: {
+ // Set the common slice properties dynamically for convenience
+ for (var i = 0; i < pieOuter.count; i++) {
+ pieOuter.at(i).labelPosition = PieSlice.LabelOutside;
+ pieOuter.at(i).labelVisible = true;
+ pieOuter.at(i).borderWidth = 3;
+ }
+ for (var i = 0; i < pieInner.count; i++) {
+ pieInner.at(i).labelPosition = PieSlice.LabelInsideNormal;
+ pieInner.at(i).labelVisible = true;
+ pieInner.at(i).borderWidth = 2;
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View2.qml b/examples/charts/qmlchart/qml/qmlchart/View2.qml
new file mode 100644
index 00000000..be0ae18d
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View2.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Line"
+ anchors.fill: parent
+ antialiasing: true
+
+ LineSeries {
+ name: "LineSeries"
+ XYPoint { x: 0; y: 0 }
+ XYPoint { x: 1.1; y: 2.1 }
+ XYPoint { x: 1.9; y: 3.3 }
+ XYPoint { x: 2.1; y: 2.1 }
+ XYPoint { x: 2.9; y: 4.9 }
+ XYPoint { x: 3.4; y: 3.0 }
+ XYPoint { x: 4.1; y: 3.3 }
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View3.qml b/examples/charts/qmlchart/qml/qmlchart/View3.qml
new file mode 100644
index 00000000..e7680bea
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View3.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Spline"
+ anchors.fill: parent
+ antialiasing: true
+
+ SplineSeries {
+ name: "SplineSeries"
+ XYPoint { x: 0; y: 0.0 }
+ XYPoint { x: 1.1; y: 3.2 }
+ XYPoint { x: 1.9; y: 2.4 }
+ XYPoint { x: 2.1; y: 2.1 }
+ XYPoint { x: 2.9; y: 2.6 }
+ XYPoint { x: 3.4; y: 2.3 }
+ XYPoint { x: 4.1; y: 3.1 }
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View4.qml b/examples/charts/qmlchart/qml/qmlchart/View4.qml
new file mode 100644
index 00000000..5ba5dc15
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View4.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "NHL All-Star Team Players"
+ anchors.fill: parent
+ antialiasing: true
+
+ ValueAxis {
+ id: valueAxis
+ min: 2000
+ max: 2011
+ tickCount: 12
+ labelFormat: "%.0f"
+ }
+
+ AreaSeries {
+ name: "Russian"
+ color: "#FFD52B1E"
+ borderColor: "#FF0039A5"
+ borderWidth: 3
+ axisX: valueAxis
+ upperSeries: LineSeries {
+ XYPoint { x: 2000; y: 1 }
+ XYPoint { x: 2001; y: 1 }
+ XYPoint { x: 2002; y: 1 }
+ XYPoint { x: 2003; y: 1 }
+ XYPoint { x: 2004; y: 1 }
+ XYPoint { x: 2005; y: 0 }
+ XYPoint { x: 2006; y: 1 }
+ XYPoint { x: 2007; y: 1 }
+ XYPoint { x: 2008; y: 4 }
+ XYPoint { x: 2009; y: 3 }
+ XYPoint { x: 2010; y: 2 }
+ XYPoint { x: 2011; y: 1 }
+ }
+ }
+ //![1]
+
+ AreaSeries {
+ name: "Swedish"
+ color: "#AF005292"
+ borderColor: "#AFFDCA00"
+ borderWidth: 3
+ axisX: valueAxis
+ upperSeries: LineSeries {
+ XYPoint { x: 2000; y: 1 }
+ XYPoint { x: 2001; y: 1 }
+ XYPoint { x: 2002; y: 3 }
+ XYPoint { x: 2003; y: 3 }
+ XYPoint { x: 2004; y: 2 }
+ XYPoint { x: 2005; y: 0 }
+ XYPoint { x: 2006; y: 2 }
+ XYPoint { x: 2007; y: 1 }
+ XYPoint { x: 2008; y: 2 }
+ XYPoint { x: 2009; y: 1 }
+ XYPoint { x: 2010; y: 3 }
+ XYPoint { x: 2011; y: 3 }
+ }
+ }
+
+ AreaSeries {
+ name: "Finnish"
+ color: "#00357F"
+ borderColor: "#FEFEFE"
+ borderWidth: 3
+ axisX: valueAxis
+ upperSeries: LineSeries {
+ XYPoint { x: 2000; y: 0 }
+ XYPoint { x: 2001; y: 0 }
+ XYPoint { x: 2002; y: 0 }
+ XYPoint { x: 2003; y: 0 }
+ XYPoint { x: 2004; y: 0 }
+ XYPoint { x: 2005; y: 0 }
+ XYPoint { x: 2006; y: 1 }
+ XYPoint { x: 2007; y: 0 }
+ XYPoint { x: 2008; y: 0 }
+ XYPoint { x: 2009; y: 0 }
+ XYPoint { x: 2010; y: 0 }
+ XYPoint { x: 2011; y: 1 }
+ }
+ }
+ }
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View5.qml b/examples/charts/qmlchart/qml/qmlchart/View5.qml
new file mode 100644
index 00000000..7cce1d77
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View5.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Scatters"
+ anchors.fill: parent
+ antialiasing: true
+
+ ScatterSeries {
+ id: scatter1
+ name: "Scatter1"
+ XYPoint { x: 1.5; y: 1.5 }
+ XYPoint { x: 1.5; y: 1.6 }
+ XYPoint { x: 1.57; y: 1.55 }
+ XYPoint { x: 1.8; y: 1.8 }
+ XYPoint { x: 1.9; y: 1.6 }
+ XYPoint { x: 2.1; y: 1.3 }
+ XYPoint { x: 2.5; y: 2.1 }
+ }
+
+ ScatterSeries {
+ name: "Scatter2"
+ //![1]
+ XYPoint { x: 2.0; y: 2.0 }
+ XYPoint { x: 2.0; y: 2.1 }
+ XYPoint { x: 2.07; y: 2.05 }
+ XYPoint { x: 2.2; y: 2.9 }
+ XYPoint { x: 2.4; y: 2.7 }
+ XYPoint { x: 2.67; y: 2.65 }
+ }
+ }
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View6.qml b/examples/charts/qmlchart/qml/qmlchart/View6.qml
new file mode 100644
index 00000000..78d3a834
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View6.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ BarSeries {
+ id: mySeries
+ axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View7.qml b/examples/charts/qmlchart/qml/qmlchart/View7.qml
new file mode 100644
index 00000000..4980e70b
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View7.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Stacked Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ StackedBarSeries {
+ id: mySeries
+ axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View8.qml b/examples/charts/qmlchart/qml/qmlchart/View8.qml
new file mode 100644
index 00000000..bba51cc9
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View8.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Percent Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ PercentBarSeries {
+ axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlchart/qml/qmlchart/View9.qml b/examples/charts/qmlchart/qml/qmlchart/View9.qml
new file mode 100644
index 00000000..fe0f0a55
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/View9.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Horizontal Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ HorizontalBarSeries {
+ axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
+
diff --git a/examples/charts/qmlchart/qml/qmlchart/main.qml b/examples/charts/qmlchart/qml/qmlchart/main.qml
new file mode 100644
index 00000000..0a384636
--- /dev/null
+++ b/examples/charts/qmlchart/qml/qmlchart/main.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![1]
+import QtQuick 2.0
+//![1]
+
+Rectangle {
+ width: 600
+ height: 400
+ property bool sourceLoaded: false
+
+ ListView {
+ id: root
+ focus: true
+ anchors.fill: parent
+ snapMode: ListView.SnapOneItem
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlightMoveDuration: 250
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+
+ onCurrentIndexChanged: {
+ if (infoText.opacity > 0.0) {
+ if (sourceLoaded)
+ infoText.opacity = 0.0;
+ else if (currentIndex != 0)
+ currentIndex = 0;
+ }
+ }
+
+ model: ListModel {
+ ListElement {component: "View1.qml"}
+ ListElement {component: "View2.qml"}
+ ListElement {component: "View3.qml"}
+ ListElement {component: "View4.qml"}
+ ListElement {component: "View5.qml"}
+ ListElement {component: "View6.qml"}
+ ListElement {component: "View7.qml"}
+ ListElement {component: "View8.qml"}
+ ListElement {component: "View9.qml"}
+ ListElement {component: "View10.qml"}
+ ListElement {component: "View11.qml"}
+ ListElement {component: "View12.qml"}
+ }
+
+ delegate: Loader {
+ width: root.width
+ height: root.height
+
+ source: component
+ asynchronous: true
+
+ onLoaded: sourceLoaded = true
+ }
+ }
+
+ Rectangle {
+ id: infoText
+ anchors.centerIn: parent
+ width: parent.width
+ height: 40
+ color: "black"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: "You can navigate between views using swipe or arrow keys"
+ }
+
+ Behavior on opacity {
+ NumberAnimation { duration: 400 }
+ }
+ }
+}
diff --git a/examples/charts/qmlchart/qmlchart.pro b/examples/charts/qmlchart/qmlchart.pro
new file mode 100644
index 00000000..82426424
--- /dev/null
+++ b/examples/charts/qmlchart/qmlchart.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/qmlchart/*
diff --git a/examples/charts/qmlchart/resources.qrc b/examples/charts/qmlchart/resources.qrc
new file mode 100644
index 00000000..7b14dace
--- /dev/null
+++ b/examples/charts/qmlchart/resources.qrc
@@ -0,0 +1,17 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/qmlchart/main.qml</file>
+ <file>qml/qmlchart/View1.qml</file>
+ <file>qml/qmlchart/View2.qml</file>
+ <file>qml/qmlchart/View3.qml</file>
+ <file>qml/qmlchart/View4.qml</file>
+ <file>qml/qmlchart/View5.qml</file>
+ <file>qml/qmlchart/View6.qml</file>
+ <file>qml/qmlchart/View7.qml</file>
+ <file>qml/qmlchart/View8.qml</file>
+ <file>qml/qmlchart/View9.qml</file>
+ <file>qml/qmlchart/View10.qml</file>
+ <file>qml/qmlchart/View11.qml</file>
+ <file>qml/qmlchart/View12.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/charts/qmlcustomizations/main.cpp b/examples/charts/qmlcustomizations/main.cpp
new file mode 100644
index 00000000..e36fd058
--- /dev/null
+++ b/examples/charts/qmlcustomizations/main.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickView>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ viewer.setTitle(QStringLiteral("QML Customizations"));
+ viewer.setSource(QUrl("qrc:/qml/qmlcustomizations/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml b/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml
new file mode 100644
index 00000000..8000caf7
--- /dev/null
+++ b/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ width: 400
+ height: 300
+ property int __activeIndex: 1
+ property real __intervalCoefficient: 0
+
+ //![1]
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+ title: "Wheel of fortune"
+ legend.visible: false
+ antialiasing: true
+
+ PieSeries {
+ id: wheelOfFortune
+ horizontalPosition: 0.3
+ }
+
+ SplineSeries {
+ id: splineSeries
+ }
+
+ ScatterSeries {
+ id: scatterSeries
+ }
+ }
+ //![1]
+
+ //![2]
+ Component.onCompleted: {
+ __intervalCoefficient = Math.random() + 0.1;
+
+ for (var i = 0; i < 20; i++)
+ wheelOfFortune.append("", 1);
+
+ var interval = 1;
+ for (var j = 0; interval < 800; j++) {
+ interval = __intervalCoefficient * j * j;
+ splineSeries.append(j, interval);
+ }
+ chartView.axisX(scatterSeries).max = j;
+ chartView.axisY(scatterSeries).max = 1000;
+ }
+ //![2]
+
+ Timer {
+ triggeredOnStart: true
+ running: true
+ repeat: true
+ interval: 100
+ onTriggered: {
+ var index = __activeIndex % wheelOfFortune.count;
+ if (interval < 700) {
+ //![3]
+ wheelOfFortune.at(index).exploded = false;
+ __activeIndex++;
+ index = __activeIndex % wheelOfFortune.count;
+ wheelOfFortune.at(index).exploded = true;
+ //![3]
+ interval = splineSeries.at(__activeIndex).y;
+ //![4]
+ scatterSeries.clear();
+ scatterSeries.append(__activeIndex, interval);
+ scatterSeries.color = Qt.tint(scatterSeries.color, "#05FF0000");
+ scatterSeries.markerSize += 0.5;
+ //![4]
+ } else {
+ //![5]
+ // Switch the colors of the slice and the border
+ wheelOfFortune.at(index).borderWidth = 2;
+ var borderColor = wheelOfFortune.at(index).borderColor;
+ wheelOfFortune.at(index).borderColor = wheelOfFortune.at(index).color;
+ wheelOfFortune.at(index).color = borderColor;
+ //![5]
+ }
+ }
+ }
+}
diff --git a/examples/charts/qmlcustomizations/qmlcustomizations.pro b/examples/charts/qmlcustomizations/qmlcustomizations.pro
new file mode 100644
index 00000000..ae2d4e5b
--- /dev/null
+++ b/examples/charts/qmlcustomizations/qmlcustomizations.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/qmlcustomizations/*
diff --git a/examples/charts/qmlcustomizations/resources.qrc b/examples/charts/qmlcustomizations/resources.qrc
new file mode 100644
index 00000000..35dd1b54
--- /dev/null
+++ b/examples/charts/qmlcustomizations/resources.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/qmlcustomizations/main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/charts/qmlcustomlegend/main.cpp b/examples/charts/qmlcustomlegend/main.cpp
new file mode 100644
index 00000000..82cda036
--- /dev/null
+++ b/examples/charts/qmlcustomlegend/main.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickView>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ viewer.setTitle(QStringLiteral("QML Custom Legend"));
+ viewer.setSource(QUrl("qrc:/qml/qmlcustomlegend/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/AnimatedAreaSeries.qml b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/AnimatedAreaSeries.qml
new file mode 100644
index 00000000..0af6b5c3
--- /dev/null
+++ b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/AnimatedAreaSeries.qml
@@ -0,0 +1,30 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+AreaSeries {
+ id: series
+
+ Behavior on opacity {
+ NumberAnimation { duration: 250 }
+ }
+}
diff --git a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml
new file mode 100644
index 00000000..7ca033b2
--- /dev/null
+++ b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+//![1]
+ChartView {
+ id: chartViewHighlighted
+ title: ""
+ property variant selectedSeries
+ signal clicked
+ legend.visible: false
+ margins.top: 10
+ margins.bottom: 0
+ antialiasing: true
+
+ LineSeries {
+ id: lineSeries
+
+ axisX: ValueAxis {
+ min: 2006
+ max: 2012
+ labelFormat: "%.0f"
+ tickCount: 7
+ }
+ axisY: ValueAxis {
+ id: axisY
+ titleText: "EUR"
+ min: 0
+ max: 40000
+ niceNumbersEnabled: true
+ labelFormat: "%.0f"
+ tickCount: 5
+ }
+ }
+//![1]
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ chartViewHighlighted.clicked();
+ }
+ }
+
+ onSelectedSeriesChanged: {
+ lineSeries.clear();
+ lineSeries.color = selectedSeries.color;
+ var maxVal = 0.0;
+ for (var i = 0; i < selectedSeries.upperSeries.count; i++ ) {
+ var y = selectedSeries.upperSeries.at(i).y - selectedSeries.lowerSeries.at(i).y;
+ lineSeries.append(selectedSeries.upperSeries.at(i).x, y);
+ if (maxVal < y)
+ maxVal = y;
+ }
+ chartViewHighlighted.title = selectedSeries.name;
+ axisY.max = maxVal;
+ }
+}
+
diff --git a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml
new file mode 100644
index 00000000..86714a01
--- /dev/null
+++ b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ id: chartViewSelector
+ width: parent.width
+ height: parent.height
+ signal seriesAdded(string seriesName, color seriesColor)
+
+ function highlightSeries(seriesName) {
+ if (seriesName == "") {
+ if (state != "")
+ state = "";
+
+ for (var i = 0; i < chartViewStacked.count; i++)
+ chartViewStacked.series(i).opacity = 1.0;
+ } else {
+ var targetOpacity = 0.1;
+ for (var j = 0; j < chartViewStacked.count; j++) {
+ if (chartViewStacked.series(j).name != seriesName)
+ chartViewStacked.series(j).opacity = 0.25;
+ else if (state == "highlight")
+ chartViewSelected.selectedSeries = chartViewStacked.series(j);
+ }
+ }
+ }
+
+ function selectSeries(seriesName) {
+ for (var i = 0; i < chartViewStacked.count; i++) {
+ if (chartViewStacked.series(i).name == seriesName) {
+ chartViewSelected.selectedSeries = chartViewStacked.series(i);
+ if (chartViewSelector.state == "")
+ chartViewSelector.state = "highlighted";
+ else
+ chartViewSelector.state = "";
+ }
+ }
+ }
+
+ ChartViewStacked {
+ id: chartViewStacked
+ anchors.left: parent.left
+ anchors.leftMargin: 0
+ width: parent.width
+ height: parent.height
+ onSeriesAdded: chartViewSelector.seriesAdded(series.name, series.color);
+ }
+
+ ChartViewHighlighted {
+ id: chartViewSelected
+ anchors.left: chartViewStacked.right
+ width: parent.width
+ height: parent.height
+
+ opacity: 0.0
+ onClicked: {
+ chartViewSelector.state = "";
+ }
+ }
+
+ states: State {
+ name: "highlighted"
+ PropertyChanges {
+ target: chartViewSelected
+ opacity: 1.0
+ }
+ PropertyChanges {
+ target: chartViewStacked
+ anchors.leftMargin: -chartViewStacked.width
+ opacity: 0.0
+ }
+ }
+
+ transitions: Transition {
+ PropertyAnimation {
+ properties: "width, height, opacity, anchors.leftMargin"
+ duration: 400
+ }
+ }
+}
diff --git a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml
new file mode 100644
index 00000000..ade88c04
--- /dev/null
+++ b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+ChartView {
+ id: chartView
+ title: "Government Taxes"
+ legend.visible: false
+ signal entered(string seriesName)
+ signal exited(string seriesName)
+ margins.top: 10
+ margins.bottom: 0
+ antialiasing: true
+
+ ValueAxis {
+ id: axisX
+ min: 2006
+ max: 2012
+ tickCount: 7
+ labelFormat: "%.0f"
+ }
+
+ ValueAxis {
+ id: axisY
+ titleText: "EUR"
+ min: 0
+ max: 90000
+ tickCount: 10
+ labelFormat: "%.0f"
+ }
+
+ AnimatedAreaSeries {
+ id: stateSeries
+ name: "state"
+ axisX: axisX
+ axisY: axisY
+ borderWidth: 0
+ upperSeries: LineSeries {
+ id: stateUpper
+ XYPoint { x: 2006; y: 33119 }
+ XYPoint { x: 2007; y: 37941 }
+ XYPoint { x: 2008; y: 40122 }
+ XYPoint { x: 2009; y: 38991 }
+ XYPoint { x: 2010; y: 34055 }
+ XYPoint { x: 2011; y: 34555 }
+ XYPoint { x: 2012; y: 38991 }
+ }
+ lowerSeries: LineSeries {
+ XYPoint { x: 2006; y: 0 }
+ XYPoint { x: 2007; y: 0 }
+ XYPoint { x: 2008; y: 0 }
+ XYPoint { x: 2009; y: 0 }
+ XYPoint { x: 2010; y: 0 }
+ XYPoint { x: 2011; y: 0 }
+ XYPoint { x: 2012; y: 0 }
+ }
+ }
+
+ //![1]
+ AnimatedAreaSeries {
+ id: municipalSeries
+ name: "municipal"
+ axisX: axisX
+ axisY: axisY
+ borderWidth: 0
+ upperSeries: LineSeries {
+ id: municipalUpper
+ XYPoint { x: 2006; y: 33119 + 13443 }
+ XYPoint { x: 2007; y: 37941 + 15311 }
+ XYPoint { x: 2008; y: 40122 + 16552 }
+ XYPoint { x: 2009; y: 38991 + 17904 }
+ XYPoint { x: 2010; y: 34055 + 17599 }
+ XYPoint { x: 2011; y: 34555 + 19002 }
+ XYPoint { x: 2012; y: 38991 + 19177 }
+ }
+ lowerSeries: stateUpper
+ }
+ //![1]
+
+ AnimatedAreaSeries {
+ id: socialSeries
+ name: "social sec."
+ axisX: axisX
+ axisY: axisY
+ borderWidth: 0
+ upperSeries: LineSeries {
+ id: socialUpper
+ XYPoint { x: 2006; y: 33119 + 13443 + 18855 }
+ XYPoint { x: 2007; y: 37941 + 15311 + 20238 }
+ XYPoint { x: 2008; y: 40122 + 16552 + 21347 }
+ XYPoint { x: 2009; y: 38991 + 17904 + 22376 }
+ XYPoint { x: 2010; y: 34055 + 17599 + 22076 }
+ XYPoint { x: 2011; y: 34555 + 19002 + 22631 }
+ XYPoint { x: 2012; y: 38991 + 19177 + 23686 }
+ }
+ lowerSeries: municipalUpper
+ }
+}
diff --git a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml
new file mode 100644
index 00000000..d146f83c
--- /dev/null
+++ b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ id: legend
+ color: "lightgray"
+
+ property int seriesCount: 0
+ property variant seriesNames: []
+ property variant seriesColors: []
+ signal entered(string seriesName)
+ signal exited(string seriesName)
+ signal selected(string seriesName)
+
+ function addSeries(seriesName, color) {
+ var names = seriesNames;
+ names[seriesCount] = seriesName;
+ seriesNames = names;
+
+ var colors = seriesColors;
+ colors[seriesCount] = color;
+ seriesColors = colors;
+
+ seriesCount++;
+ }
+
+ Gradient {
+ id: buttonGradient
+ GradientStop { position: 0.0; color: "#F0F0F0" }
+ GradientStop { position: 1.0; color: "#A0A0A0" }
+ }
+
+ Gradient {
+ id: buttonGradientHovered
+ GradientStop { position: 0.0; color: "#FFFFFF" }
+ GradientStop { position: 1.0; color: "#B0B0B0" }
+ }
+
+ //![2]
+ Component {
+ id: legendDelegate
+ Rectangle {
+ id: rect
+ //![2]
+ property string name: seriesNames[index]
+ property color markerColor: seriesColors[index]
+ gradient: buttonGradient
+ border.color: "#A0A0A0"
+ border.width: 1
+ radius: 4
+
+ implicitWidth: label.implicitWidth + marker.implicitWidth + 30
+ implicitHeight: label.implicitHeight + marker.implicitHeight + 10
+
+ Row {
+ id: row
+ spacing: 5
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 5
+ Rectangle {
+ id: marker
+ anchors.verticalCenter: parent.verticalCenter
+ color: markerColor
+ opacity: 0.3
+ radius: 4
+ width: 12
+ height: 10
+ }
+ Text {
+ id: label
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: -1
+ text: name
+ }
+ }
+
+ //![3]
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+ onEntered: {
+ rect.gradient = buttonGradientHovered;
+ legend.entered(label.text);
+ }
+ onExited: {
+ rect.gradient = buttonGradient;
+ legend.exited(label.text);
+ marker.opacity = 0.3;
+ marker.height = 10;
+ }
+ onClicked: {
+ legend.selected(label.text);
+ marker.opacity = 1.0;
+ marker.height = 12;
+ }
+ }
+ //![3]
+ }
+ }
+
+ //![1]
+ Row {
+ id: legendRow
+ anchors.centerIn: parent
+ spacing: 10
+
+ Repeater {
+ id: legendRepeater
+ model: seriesCount
+ delegate: legendDelegate
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/main.qml b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/main.qml
new file mode 100644
index 00000000..815d5331
--- /dev/null
+++ b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/main.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ id: main
+ width: 400
+ height: 320
+
+ Column {
+ id: column
+ anchors.fill: parent
+ anchors.bottomMargin: 10
+ spacing: 0
+
+ ChartViewSelector {
+ id: chartViewSelector
+ width: parent.width
+ height: parent.height - customLegend.height - anchors.bottomMargin
+ onSeriesAdded: customLegend.addSeries(seriesName, seriesColor);
+ }
+
+ CustomLegend {
+ id: customLegend
+ width: parent.width
+ height: 50
+ anchors.horizontalCenter: parent.horizontalCenter
+ onEntered: chartViewSelector.highlightSeries(seriesName);
+ onExited: chartViewSelector.highlightSeries("");
+ onSelected: chartViewSelector.selectSeries(seriesName);
+ }
+ }
+
+ states: State {
+ name: "highlighted"
+ PropertyChanges {
+ target: chartViewHighlighted
+ width: column.width
+ height: (column.height - column.anchors.margins * 2 - customLegend.height)
+ }
+ PropertyChanges {
+ target: chartViewStacked
+ width: 1
+ height: 1
+ }
+ }
+}
diff --git a/examples/charts/qmlcustomlegend/qmlcustomlegend.pro b/examples/charts/qmlcustomlegend/qmlcustomlegend.pro
new file mode 100644
index 00000000..d42afded
--- /dev/null
+++ b/examples/charts/qmlcustomlegend/qmlcustomlegend.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/qmlcustomlegend/*
diff --git a/examples/charts/qmlcustomlegend/resources.qrc b/examples/charts/qmlcustomlegend/resources.qrc
new file mode 100644
index 00000000..bd49690b
--- /dev/null
+++ b/examples/charts/qmlcustomlegend/resources.qrc
@@ -0,0 +1,10 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/qmlcustomlegend/main.qml</file>
+ <file>qml/qmlcustomlegend/CustomLegend.qml</file>
+ <file>qml/qmlcustomlegend/ChartViewStacked.qml</file>
+ <file>qml/qmlcustomlegend/ChartViewHighlighted.qml</file>
+ <file>qml/qmlcustomlegend/ChartViewSelector.qml</file>
+ <file>qml/qmlcustomlegend/AnimatedAreaSeries.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/charts/qmlf1legends/main.cpp b/examples/charts/qmlf1legends/main.cpp
new file mode 100644
index 00000000..df79b769
--- /dev/null
+++ b/examples/charts/qmlf1legends/main.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickView>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ viewer.setTitle(QStringLiteral("QML F1 Legends"));
+ viewer.setSource(QUrl("qrc:/qml/qmlf1legends/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml b/examples/charts/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml
new file mode 100644
index 00000000..00d45a17
--- /dev/null
+++ b/examples/charts/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick.XmlListModel 2.0
+
+//![1]
+XmlListModel {
+ // Hard-coded test data
+ xml: "<results><row><speedTrap>0</speedTrap><driver>Fittipaldi</driver><speed>104.12</speed></row>"
+ +"<row><speedTrap>0</speedTrap><driver>Stewart</driver><speed>106.12</speed></row>"
+ +"<row><speedTrap>0</speedTrap><driver>Hunt</driver><speed>106.12</speed></row>"
+//![1]
+ +"<row><speedTrap>1</speedTrap><driver>Fittipaldi</driver><speed>115.12</speed></row>"
+ +"<row><speedTrap>1</speedTrap><driver>Stewart</driver><speed>114.12</speed></row>"
+ +"<row><speedTrap>1</speedTrap><driver>Hunt</driver><speed>115.12</speed></row>"
+ +"<row><speedTrap>2</speedTrap><driver>Hunt</driver><speed>165.23</speed></row>"
+ +"<row><speedTrap>2</speedTrap><driver>Fittipaldi</driver><speed>175.23</speed></row>"
+ +"<row><speedTrap>2</speedTrap><driver>Stewart</driver><speed>168.23</speed></row>"
+ +"<row><speedTrap>3</speedTrap><driver>Hunt</driver><speed>104.87</speed></row>"
+ +"<row><speedTrap>3</speedTrap><driver>Fittipaldi</driver><speed>104.43</speed></row>"
+ +"<row><speedTrap>3</speedTrap><driver>Stewart</driver><speed>94.83</speed></row>"
+ +"<row><speedTrap>4</speedTrap><driver>Hunt</driver><speed>107.87</speed></row>"
+ +"<row><speedTrap>4</speedTrap><driver>Fittipaldi</driver><speed>111.84</speed></row>"
+ +"<row><speedTrap>4</speedTrap><driver>Stewart</driver><speed>106.84</speed></row>"
+ +"<row><speedTrap>5</speedTrap><driver>Hunt</driver><speed>94.87</speed></row>"
+ +"<row><speedTrap>5</speedTrap><driver>Stewart</driver><speed>92.37</speed></row>"
+ +"<row><speedTrap>5</speedTrap><driver>Fittipaldi</driver><speed>99.37</speed></row>"
+ +"<row><speedTrap>6</speedTrap><driver>Hunt</driver><speed>52.87</speed></row>"
+ +"<row><speedTrap>6</speedTrap><driver>Fittipaldi</driver><speed>42.87</speed></row>"
+ +"<row><speedTrap>6</speedTrap><driver>Stewart</driver><speed>55.87</speed></row>"
+ +"<row><speedTrap>7</speedTrap><driver>Hunt</driver><speed>77.87</speed></row>"
+ +"<row><speedTrap>7</speedTrap><driver>Fittipaldi</driver><speed>72.87</speed></row>"
+ +"<row><speedTrap>7</speedTrap><driver>Stewart</driver><speed>87.87</speed></row>"
+ +"<row><speedTrap>8</speedTrap><driver>Hunt</driver><speed>94.17</speed></row>"
+ +"<row><speedTrap>8</speedTrap><driver>Fittipaldi</driver><speed>98.17</speed></row>"
+ +"<row><speedTrap>8</speedTrap><driver>Stewart</driver><speed>84.17</speed></row>"
+ +"<row><speedTrap>9</speedTrap><driver>Hunt</driver><speed>91.87</speed></row>"
+ +"<row><speedTrap>9</speedTrap><driver>Fittipaldi</driver><speed>71.87</speed></row>"
+ +"<row><speedTrap>9</speedTrap><driver>Stewart</driver><speed>81.87</speed></row>"
+ +"<row><speedTrap>10</speedTrap><driver>Hunt</driver><speed>104.87</speed></row>"
+ +"<row><speedTrap>10</speedTrap><driver>Fittipaldi</driver><speed>115.87</speed></row>"
+ +"<row><speedTrap>10</speedTrap><driver>Stewart</driver><speed>119.87</speed></row>"
+ +"<row><speedTrap>11</speedTrap><driver>Hunt</driver><speed>162.87</speed></row>"
+ +"<row><speedTrap>11</speedTrap><driver>Fittipaldi</driver><speed>155.84</speed></row>"
+ +"<row><speedTrap>11</speedTrap><driver>Stewart</driver><speed>152.84</speed></row>"
+ +"<row><speedTrap>12</speedTrap><driver>Hunt</driver><speed>181.87</speed></row>"
+ +"<row><speedTrap>12</speedTrap><driver>Fittipaldi</driver><speed>161.85</speed></row>"
+ +"<row><speedTrap>12</speedTrap><driver>Stewart</driver><speed>167.85</speed></row>"
+ +"<row><speedTrap>13</speedTrap><driver>Hunt</driver><speed>155.87</speed></row>"
+ +"<row><speedTrap>13</speedTrap><driver>Fittipaldi</driver><speed>154.87</speed></row>"
+ +"<row><speedTrap>13</speedTrap><driver>Stewart</driver><speed>164.87</speed></row>"
+ +"<row><speedTrap>14</speedTrap><driver>Hunt</driver><speed>197.57</speed></row>"
+ +"<row><speedTrap>14</speedTrap><driver>Fittipaldi</driver><speed>187.54</speed></row>"
+ +"<row><speedTrap>14</speedTrap><driver>Stewart</driver><speed>180.54</speed></row>"
+ +"<row><speedTrap>15</speedTrap><driver>Fittipaldi</driver><speed>216.87</speed></row>"
+ +"<row><speedTrap>15</speedTrap><driver>Hunt</driver><speed>207.87</speed></row>"
+ +"<row><speedTrap>15</speedTrap><driver>Stewart</driver><speed>197.87</speed></row>"
+ +"<row><speedTrap>16</speedTrap><driver>Hunt</driver><speed>82.87</speed></row>"
+ +"<row><speedTrap>16</speedTrap><driver>Fittipaldi</driver><speed>79.37</speed></row>"
+ +"<row><speedTrap>16</speedTrap><driver>Stewart</driver><speed>85.37</speed></row>"
+ +"<row><speedTrap>17</speedTrap><driver>Hunt</driver><speed>153.87</speed></row>"
+ +"<row><speedTrap>17</speedTrap><driver>Fittipaldi</driver><speed>143.87</speed></row>"
+ +"<row><speedTrap>17</speedTrap><driver>Stewart</driver><speed>133.87</speed></row>"
+ +"<row><speedTrap>18</speedTrap><driver>Hunt</driver><speed>89.87</speed></row>"
+ +"<row><speedTrap>18</speedTrap><driver>Fittipaldi</driver><speed>95.85</speed></row>"
+ +"<row><speedTrap>18</speedTrap><driver>Stewart</driver><speed>98.85</speed></row>"
+ +"<row><speedTrap>19</speedTrap><driver>Hunt</driver><speed>169.87</speed></row>"
+ +"<row><speedTrap>19</speedTrap><driver>Stewart</driver><speed>167.87</speed></row>"
+ +"<row><speedTrap>19</speedTrap><driver>Fittipaldi</driver><speed>154.87</speed></row>"
+ +"</results>"
+//![2]
+ query: "/results/row"
+
+ XmlRole { name: "speedTrap"; query: "speedTrap/string()" }
+ XmlRole { name: "driver"; query: "driver/string()" }
+ XmlRole { name: "speed"; query: "speed/string()" }
+}
+//![2]
diff --git a/examples/charts/qmlf1legends/qml/qmlf1legends/main.qml b/examples/charts/qmlf1legends/qml/qmlf1legends/main.qml
new file mode 100644
index 00000000..9aaec276
--- /dev/null
+++ b/examples/charts/qmlf1legends/qml/qmlf1legends/main.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+import QtQuick.XmlListModel 2.0
+
+Rectangle {
+ width: 400
+ height: 300
+ property int currentIndex: -1
+
+ //![1]
+ ChartView {
+ id: chartView
+ title: "Driver Speeds, lap 1"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignTop
+ animationOptions: ChartView.SeriesAnimations
+ antialiasing: true
+ }
+ //![1]
+
+ //![2]
+ // An example XmlListModel containing F1 legend drivers' speeds at speed traps
+ SpeedsXml {
+ id: speedsXml
+ onStatusChanged: {
+ if (status == XmlListModel.Ready) {
+ timer.start();
+ }
+ }
+ }
+ //![2]
+
+ //![3]
+ // A timer to mimic refreshing the data dynamically
+ Timer {
+ id: timer
+ interval: 700
+ repeat: true
+ triggeredOnStart: true
+ running: false
+ onTriggered: {
+ currentIndex++;
+ if (currentIndex < speedsXml.count) {
+ // Check if there is a series for the data already (we are using driver name to identify series)
+ var lineSeries = chartView.series(speedsXml.get(currentIndex).driver);
+ if (!lineSeries) {
+ lineSeries = chartView.createSeries(ChartView.SeriesTypeLine, speedsXml.get(currentIndex).driver);
+ chartView.axisY().min = 0;
+ chartView.axisY().max = 250;
+ chartView.axisY().tickCount = 6;
+ chartView.axisY().titleText = "speed (kph)";
+ chartView.axisX().titleText = "speed trap";
+ chartView.axisX().labelFormat = "%.0f";
+ }
+ lineSeries.append(speedsXml.get(currentIndex).speedTrap, speedsXml.get(currentIndex).speed);
+
+ if (speedsXml.get(currentIndex).speedTrap > 3) {
+ chartView.axisX().max = Number(speedsXml.get(currentIndex).speedTrap) + 1;
+ chartView.axisX().min = chartView.axisX().max - 5;
+ } else {
+ chartView.axisX().max = 5;
+ chartView.axisX().min = 0;
+ }
+ chartView.axisX().tickCount = chartView.axisX().max - chartView.axisX().min + 1;
+ } else {
+ // No more data, change x-axis range to show all the data
+ timer.stop();
+ chartView.animationOptions = ChartView.AllAnimations;
+ chartView.axisX().min = 0;
+ chartView.axisX().max = speedsXml.get(currentIndex - 1).speedTrap;
+ }
+ }
+ }
+ //![3]
+}
diff --git a/examples/charts/qmlf1legends/qmlf1legends.pro b/examples/charts/qmlf1legends/qmlf1legends.pro
new file mode 100644
index 00000000..fc8c04f4
--- /dev/null
+++ b/examples/charts/qmlf1legends/qmlf1legends.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/qmlf1legends/*
diff --git a/demos/qmlf1legends/resources.qrc b/examples/charts/qmlf1legends/resources.qrc
index 2a89c915..2a89c915 100644
--- a/demos/qmlf1legends/resources.qrc
+++ b/examples/charts/qmlf1legends/resources.qrc
diff --git a/examples/charts/qmloscilloscope/datasource.cpp b/examples/charts/qmloscilloscope/datasource.cpp
new file mode 100644
index 00000000..ff651110
--- /dev/null
+++ b/examples/charts/qmloscilloscope/datasource.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "datasource.h"
+#include <QXYSeries>
+#include <QAreaSeries>
+#include <QtQuick/QQuickView>
+#include <QtQuick/QQuickItem>
+#include <QDebug>
+#include <qmath.h>
+
+QT_CHARTS_USE_NAMESPACE
+
+Q_DECLARE_METATYPE(QAbstractSeries *)
+Q_DECLARE_METATYPE(QAbstractAxis *)
+
+DataSource::DataSource(QQuickView *appViewer, QObject *parent) :
+ QObject(parent),
+ m_appViewer(appViewer),
+ m_index(-1)
+{
+ qRegisterMetaType<QAbstractSeries*>();
+ qRegisterMetaType<QAbstractAxis*>();
+
+ generateData(0, 5, 1024);
+}
+
+void DataSource::update(QAbstractSeries *series)
+{
+ if (series) {
+ QXYSeries *xySeries = static_cast<QXYSeries *>(series);
+ m_index++;
+ if (m_index > m_data.count() - 1)
+ m_index = 0;
+
+ QList<QPointF> points = m_data.at(m_index);
+ // Use replace instead of clear + append, it's optimized for performance
+ xySeries->replace(points);
+ }
+}
+
+void DataSource::generateData(int type, int rowCount, int colCount)
+{
+ // Remove previous data
+ foreach (QList<QPointF> row, m_data)
+ row.clear();
+ m_data.clear();
+
+ // Append the new data depending on the type
+ for (int i(0); i < rowCount; i++) {
+ QList<QPointF> points;
+ for (int j(0); j < colCount; j++) {
+ qreal x(0);
+ qreal y(0);
+ switch (type) {
+ case 0:
+ // data with sin + random component
+ y = qSin(3.14159265358979 / 50 * j) + 0.5 + (qreal) rand() / (qreal) RAND_MAX;
+ x = j;
+ break;
+ case 1:
+ // linear data
+ x = j;
+ y = (qreal) i / 10;
+ break;
+ default:
+ // unknown, do nothing
+ break;
+ }
+ points.append(QPointF(x, y));
+ }
+ m_data.append(points);
+ }
+}
diff --git a/examples/charts/qmloscilloscope/datasource.h b/examples/charts/qmloscilloscope/datasource.h
new file mode 100644
index 00000000..8cb8daa7
--- /dev/null
+++ b/examples/charts/qmloscilloscope/datasource.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DATASOURCE_H
+#define DATASOURCE_H
+
+#include <QObject>
+#include <QAbstractSeries>
+
+class QQuickView;
+
+QT_CHARTS_USE_NAMESPACE
+
+class DataSource : public QObject
+{
+ Q_OBJECT
+public:
+ explicit DataSource(QQuickView *appViewer, QObject *parent = 0);
+
+signals:
+
+public slots:
+ void generateData(int type, int rowCount, int colCount);
+ void update(QAbstractSeries *series);
+
+private:
+ QQuickView *m_appViewer;
+ QList<QList<QPointF> > m_data;
+ int m_index;
+};
+
+#endif // DATASOURCE_H
diff --git a/examples/charts/qmloscilloscope/main.cpp b/examples/charts/qmloscilloscope/main.cpp
new file mode 100644
index 00000000..cb68260f
--- /dev/null
+++ b/examples/charts/qmloscilloscope/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQml/QQmlContext>
+#include <QtQuick/QQuickView>
+#include <QtQml/QQmlEngine>
+#include <QtCore/QDir>
+#include "datasource.h"
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ viewer.setTitle(QStringLiteral("QML Oscilloscope"));
+
+ DataSource dataSource(&viewer);
+ viewer.rootContext()->setContextProperty("dataSource", &dataSource);
+
+ viewer.setSource(QUrl("qrc:/qml/qmloscilloscope/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml b/examples/charts/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml
new file mode 100644
index 00000000..72b9b5df
--- /dev/null
+++ b/examples/charts/qmloscilloscope/qml/qmloscilloscope/ControlPanel.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Layouts 1.0
+
+ColumnLayout {
+ spacing: 8
+ Layout.fillHeight: true
+ signal animationsEnabled(bool enabled)
+ signal seriesTypeChanged(string type)
+ signal refreshRateChanged(variant rate);
+ signal signalSourceChanged(string source, int signalCount, int sampleCount);
+ signal antialiasingEnabled(bool enabled)
+
+ Text {
+ text: "Scope"
+ font.pointSize: 18
+ color: "white"
+ }
+
+ MultiButton {
+ text: "Graph: "
+ items: ["line", "spline", "scatter"]
+ currentSelection: 0
+ onSelectionChanged: seriesTypeChanged(items[currentSelection]);
+ }
+
+ MultiButton {
+ id: signalSourceButton
+ text: "Source: "
+ items: ["sin", "linear"]
+ currentSelection: 0
+ onSelectionChanged: signalSourceChanged(
+ selection,
+ 5,
+ sampleCountButton.items[sampleCountButton.currentSelection]);
+ }
+
+ MultiButton {
+ id: sampleCountButton
+ text: "Samples: "
+ items: [6, 128, 1024, 10000]
+ currentSelection: 2
+ onSelectionChanged: signalSourceChanged(
+ signalSourceButton.items[signalSourceButton.currentSelection],
+ 5,
+ selection);
+ }
+
+ MultiButton {
+ text: "Refresh rate: "
+ items: [1, 24, 60, 100]
+ currentSelection: 2
+ onSelectionChanged: refreshRateChanged(items[currentSelection]);
+ }
+
+ MultiButton {
+ text: "Animations: "
+ items: ["OFF", "ON"]
+ currentSelection: 0
+ onSelectionChanged: animationsEnabled(currentSelection == 1);
+ }
+
+ MultiButton {
+ text: "Antialias: "
+ items: ["OFF", "ON"]
+ currentSelection: 0
+ onSelectionChanged: antialiasingEnabled(currentSelection == 1);
+ }
+}
diff --git a/examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml b/examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml
new file mode 100644
index 00000000..8f6e1e1e
--- /dev/null
+++ b/examples/charts/qmloscilloscope/qml/qmloscilloscope/MultiButton.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Styles 1.0
+
+Item {
+ id: button
+
+ property string text: "Option: "
+ property variant items: ["first"]
+ property int currentSelection: 0
+ signal selectionChanged(variant selection)
+
+ signal clicked
+
+ implicitWidth: buttonText.implicitWidth + 5
+ implicitHeight: buttonText.implicitHeight + 10
+
+ Button {
+ id: buttonText
+ width: parent.width
+ height: parent.height
+
+ style: ButtonStyle {
+ label: Component {
+ Text {
+ text: button.text + button.items[currentSelection]
+ clip: true
+ wrapMode: Text.WordWrap
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ anchors.fill: parent
+ }
+ }
+ }
+ onClicked: {
+ currentSelection = (currentSelection + 1) % items.length;
+ selectionChanged(button.items[currentSelection]);
+ }
+ }
+}
diff --git a/examples/charts/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml b/examples/charts/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml
new file mode 100644
index 00000000..d27bf0aa
--- /dev/null
+++ b/examples/charts/qmloscilloscope/qml/qmloscilloscope/ScopeView.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+//![1]
+ChartView {
+ id: chartView
+ animationOptions: ChartView.NoAnimation
+ theme: ChartView.ChartThemeDark
+
+ ValueAxis {
+ id: axisY1
+ min: -1
+ max: 4
+ }
+
+ ValueAxis {
+ id: axisY2
+ min: -10
+ max: 5
+ }
+
+ ValueAxis {
+ id: axisX
+ min: 0
+ max: 1000
+ }
+
+ LineSeries {
+ id: lineSeries1
+ name: "signal 1"
+ axisX: axisX
+ axisY: axisY1
+ }
+ LineSeries {
+ id: lineSeries2
+ name: "signal 2"
+ axisX: axisX
+ axisYRight: axisY2
+ }
+//![1]
+
+ //![2]
+ Timer {
+ id: refreshTimer
+ interval: 1 / 60 * 1000 // 60 Hz
+ running: true
+ repeat: true
+ onTriggered: {
+ dataSource.update(chartView.series(0));
+ dataSource.update(chartView.series(1));
+ }
+ }
+ //![2]
+
+ //![3]
+ function changeSeriesType(type) {
+ chartView.removeAllSeries();
+
+ // Create two new series of the correct type. Axis x is the same for both of the series,
+ // but the series have their own y-axes to make it possible to control the y-offset
+ // of the "signal sources".
+ if (type == "line") {
+ chartView.createSeries(ChartView.SeriesTypeLine, "signal 1", axisX, axisY1);
+ chartView.createSeries(ChartView.SeriesTypeLine, "signal 2", axisX, axisY2);
+ } else if (type == "spline") {
+ chartView.createSeries(ChartView.SeriesTypeSpline, "signal 1", axisX, axisY1);
+ chartView.createSeries(ChartView.SeriesTypeSpline, "signal 2", axisX, axisY2);
+ } else {
+ var series1 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 1", axisX, axisY1);
+ series1.markerSize = 3;
+ series1.borderColor = "transparent";
+ var series2 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 2", axisX, axisY2);
+ series2.markerSize = 3;
+ series2.borderColor = "transparent";
+ }
+ }
+
+ function createAxis(min, max) {
+ // The following creates a ValueAxis object that can be then set as a x or y axis for a series
+ return Qt.createQmlObject("import QtQuick 2.0; import QtCharts 2.0; ValueAxis { min: "
+ + min + "; max: " + max + " }", chartView);
+ }
+ //![3]
+
+ function setAnimations(enabled) {
+ if (enabled)
+ chartView.animationOptions = ChartView.SeriesAnimations;
+ else
+ chartView.animationOptions = ChartView.NoAnimation;
+ }
+
+ function changeRefreshRate(rate) {
+ refreshTimer.interval = 1 / Number(rate) * 1000;
+ }
+}
diff --git a/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml b/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml
new file mode 100644
index 00000000..c88dfab3
--- /dev/null
+++ b/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![1]
+Rectangle {
+ id: main
+ width: 400
+ height: 300
+ color: "#404040"
+
+ ControlPanel {
+ id: controlPanel
+ anchors.top: parent.top
+ anchors.topMargin: 10
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+//![1]
+
+ onSignalSourceChanged: {
+ if (source == "sin")
+ dataSource.generateData(0, signalCount, sampleCount);
+ else
+ dataSource.generateData(1, signalCount, sampleCount);
+ }
+ onAnimationsEnabled: scopeView.setAnimations(enabled);
+ onSeriesTypeChanged: scopeView.changeSeriesType(type);
+ onRefreshRateChanged: scopeView.changeRefreshRate(rate);
+ onAntialiasingEnabled: scopeView.antialiasing = enabled;
+ }
+
+//![2]
+ ScopeView {
+ id: scopeView
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.left: controlPanel.right
+ height: main.height
+ }
+//![2]
+}
diff --git a/examples/charts/qmloscilloscope/qmloscilloscope.pro b/examples/charts/qmloscilloscope/qmloscilloscope.pro
new file mode 100644
index 00000000..a66fabcd
--- /dev/null
+++ b/examples/charts/qmloscilloscope/qmloscilloscope.pro
@@ -0,0 +1,11 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp \
+ datasource.cpp
+OTHER_FILES += qml/qmloscilloscope/*
+
+HEADERS += \
+ datasource.h
diff --git a/demos/qmloscilloscope/resources.qrc b/examples/charts/qmloscilloscope/resources.qrc
index e2aadae8..e2aadae8 100644
--- a/demos/qmloscilloscope/resources.qrc
+++ b/examples/charts/qmloscilloscope/resources.qrc
diff --git a/examples/charts/qmlpiechart/main.cpp b/examples/charts/qmlpiechart/main.cpp
new file mode 100644
index 00000000..5162b540
--- /dev/null
+++ b/examples/charts/qmlpiechart/main.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickView>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ viewer.setTitle(QStringLiteral("QML Pie Chart"));
+ viewer.setSource(QUrl("qrc:/qml/qmlpiechart/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmlpiechart/qml/qmlpiechart/main.qml b/examples/charts/qmlpiechart/qml/qmlpiechart/main.qml
new file mode 100644
index 00000000..b836539b
--- /dev/null
+++ b/examples/charts/qmlpiechart/qml/qmlpiechart/main.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![1]
+import QtQuick 2.0
+import QtCharts 2.0
+
+ChartView {
+ width: 400
+ height: 300
+ theme: ChartView.ChartThemeBrownSand
+ antialiasing: true
+
+//![1]
+//![2]
+ PieSeries {
+ id: pieSeries
+ PieSlice { label: "eaten"; value: 94.9 }
+ PieSlice { label: "not yet eaten"; value: 5.1 }
+ }
+//![2]
+
+ Component.onCompleted: {
+ if (false) {
+ //![4]
+ pieSeries.append("don't care", 1.1);
+ //![4]
+
+ //![5]
+ pieSeries.at(0).exploded = true;
+ //![5]
+ }
+ }
+
+//![3]
+}
+//![3]
diff --git a/examples/charts/qmlpiechart/qmlpiechart.pro b/examples/charts/qmlpiechart/qmlpiechart.pro
new file mode 100644
index 00000000..926f9c2d
--- /dev/null
+++ b/examples/charts/qmlpiechart/qmlpiechart.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/qmlpiechart/*
diff --git a/examples/qmlpiechart/qmlpiechart.svg b/examples/charts/qmlpiechart/qmlpiechart.svg
index 566acfad..566acfad 100644
--- a/examples/qmlpiechart/qmlpiechart.svg
+++ b/examples/charts/qmlpiechart/qmlpiechart.svg
diff --git a/examples/qmlpiechart/resources.qrc b/examples/charts/qmlpiechart/resources.qrc
index 2501bcc8..2501bcc8 100644
--- a/examples/qmlpiechart/resources.qrc
+++ b/examples/charts/qmlpiechart/resources.qrc
diff --git a/examples/charts/qmlpolarchart/main.cpp b/examples/charts/qmlpolarchart/main.cpp
new file mode 100644
index 00000000..a850da1f
--- /dev/null
+++ b/examples/charts/qmlpolarchart/main.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickView>
+#include <QtCore/QDir>
+#include <QtQml/QQmlEngine>
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ viewer.setTitle(QStringLiteral("QML Polar Chart"));
+ viewer.setSource(QUrl("qrc:/qml/qmlpolarchart/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmlpolarchart/qml/qmlpolarchart/View1.qml b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View1.qml
new file mode 100644
index 00000000..b6c921fa
--- /dev/null
+++ b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View1.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+ //![1]
+ PolarChartView {
+ title: "Two Series, Common Axes"
+ anchors.fill: parent
+ legend.visible: false
+ antialiasing: true
+
+ ValueAxis {
+ id: axisAngular
+ min: 0
+ max: 20
+ tickCount: 9
+ }
+
+ ValueAxis {
+ id: axisRadial
+ min: -0.5
+ max: 1.5
+ }
+
+ SplineSeries {
+ id: series1
+ axisAngular: axisAngular
+ axisRadial: axisRadial
+ pointsVisible: true
+ }
+
+ ScatterSeries {
+ id: series2
+ axisAngular: axisAngular
+ axisRadial: axisRadial
+ markerSize: 10
+ }
+ }
+
+ // Add data dynamically to the series
+ Component.onCompleted: {
+ for (var i = 0; i <= 20; i++) {
+ series1.append(i, Math.random());
+ series2.append(i, Math.random());
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlpolarchart/qml/qmlpolarchart/View2.qml b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View2.qml
new file mode 100644
index 00000000..9df1f66b
--- /dev/null
+++ b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View2.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ PolarChartView {
+ title: "Historical Area Series"
+ anchors.fill: parent
+ legend.visible: false
+ antialiasing: true
+
+ DateTimeAxis {
+ id: axis1
+ format: "yyyy MMM"
+ tickCount: 13
+ }
+ ValueAxis {
+ id: axis2
+ }
+ LineSeries {
+ id: lowerLine
+ axisAngular: axis1
+ axisRadial: axis2
+
+ // Please note that month in JavaScript months are zero based, so 2 means March
+ XYPoint { x: toMsecsSinceEpoch(new Date(1950, 0, 1)); y: 15 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1962, 4, 1)); y: 35 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 50 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1978, 2, 1)); y: 75 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1987, 11, 1)); y: 102 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1992, 1, 1)); y: 132 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 100 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(2002, 4, 1)); y: 120 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 1)); y: 140 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(2013, 5, 1)); y: 150 }
+ }
+ LineSeries {
+ id: upperLine
+ axisAngular: axis1
+ axisRadial: axis2
+
+ // Please note that month in JavaScript months are zero based, so 2 means March
+ XYPoint { x: toMsecsSinceEpoch(new Date(1950, 0, 1)); y: 30 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1962, 4, 1)); y: 55 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 80 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1978, 2, 1)); y: 105 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1987, 11, 1)); y: 125 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1992, 1, 1)); y: 160 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 140 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(2002, 4, 1)); y: 140 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 1)); y: 170 }
+ XYPoint { x: toMsecsSinceEpoch(new Date(2013, 5, 1)); y: 200 }
+ }
+ AreaSeries {
+ axisAngular: axis1
+ axisRadial: axis2
+ lowerSeries: lowerLine
+ upperSeries: upperLine
+ }
+ }
+ // DateTimeAxis is based on QDateTimes so we must convert our JavaScript dates to
+ // milliseconds since epoch to make them match the DateTimeAxis values
+ function toMsecsSinceEpoch(date) {
+ var msecs = date.getTime();
+ return msecs;
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlpolarchart/qml/qmlpolarchart/View3.qml b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View3.qml
new file mode 100644
index 00000000..0a5304b4
--- /dev/null
+++ b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View3.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ PolarChartView {
+ title: "Numerical Data for Dummies"
+ anchors.fill: parent
+ legend.visible: false
+ antialiasing: true
+
+ LineSeries {
+ axisRadial: CategoryAxis {
+ min: 0
+ max: 30
+ CategoryRange {
+ label: "critical"
+ endValue: 2
+ }
+ CategoryRange {
+ label: "low"
+ endValue: 7
+ }
+ CategoryRange {
+ label: "normal"
+ endValue: 12
+ }
+ CategoryRange {
+ label: "high"
+ endValue: 18
+ }
+ CategoryRange {
+ label: "extremely high"
+ endValue: 30
+ }
+ }
+
+ axisAngular: ValueAxis {
+ tickCount: 13
+ }
+
+ XYPoint { x: 0; y: 4.3 }
+ XYPoint { x: 1; y: 4.1 }
+ XYPoint { x: 2; y: 4.7 }
+ XYPoint { x: 3; y: 3.9 }
+ XYPoint { x: 4; y: 5.2 }
+ XYPoint { x: 5; y: 5.3 }
+ XYPoint { x: 6; y: 6.1 }
+ XYPoint { x: 7; y: 7.7 }
+ XYPoint { x: 8; y: 12.9 }
+ XYPoint { x: 9; y: 19.2 }
+ }
+ }
+ //![1]
+}
diff --git a/examples/charts/qmlpolarchart/qml/qmlpolarchart/main.qml b/examples/charts/qmlpolarchart/qml/qmlpolarchart/main.qml
new file mode 100644
index 00000000..ce5a4ed4
--- /dev/null
+++ b/examples/charts/qmlpolarchart/qml/qmlpolarchart/main.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 800
+ height: 600
+ property bool sourceLoaded: false
+
+ ListView {
+ id: root
+ focus: true
+ anchors.fill: parent
+ snapMode: ListView.SnapOneItem
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlightMoveDuration: 250
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+
+ onCurrentIndexChanged: {
+ if (infoText.opacity > 0.0) {
+ if (sourceLoaded)
+ infoText.opacity = 0.0;
+ else if (currentIndex != 0)
+ currentIndex = 0;
+ }
+ }
+
+ model: ListModel {
+ ListElement {component: "View1.qml"}
+ ListElement {component: "View2.qml"}
+ ListElement {component: "View3.qml"}
+ }
+
+ delegate: Loader {
+ width: root.width
+ height: root.height
+
+ source: component
+ asynchronous: true
+
+ onLoaded: sourceLoaded = true
+ }
+ }
+
+ Rectangle {
+ id: infoText
+ anchors.centerIn: parent
+ width: parent.width
+ height: 40
+ color: "black"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: "You can navigate between views using swipe or arrow keys"
+ }
+
+ Behavior on opacity {
+ NumberAnimation { duration: 400 }
+ }
+ }
+}
diff --git a/examples/charts/qmlpolarchart/qmlpolarchart.pro b/examples/charts/qmlpolarchart/qmlpolarchart.pro
new file mode 100644
index 00000000..aa3341a5
--- /dev/null
+++ b/examples/charts/qmlpolarchart/qmlpolarchart.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/qmlpolarchart/*
diff --git a/examples/charts/qmlpolarchart/resources.qrc b/examples/charts/qmlpolarchart/resources.qrc
new file mode 100644
index 00000000..a4a975ed
--- /dev/null
+++ b/examples/charts/qmlpolarchart/resources.qrc
@@ -0,0 +1,8 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/qmlpolarchart/main.qml</file>
+ <file>qml/qmlpolarchart/View1.qml</file>
+ <file>qml/qmlpolarchart/View2.qml</file>
+ <file>qml/qmlpolarchart/View3.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/charts/qmlweather/main.cpp b/examples/charts/qmlweather/main.cpp
new file mode 100644
index 00000000..9bdd28d1
--- /dev/null
+++ b/examples/charts/qmlweather/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickView>
+#include <QDebug>
+#include <QtCore/QDir>
+#include <QtQml/QQmlContext>
+#include <QtQml/QQmlEngine>
+
+int main(int argc, char *argv[])
+{
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
+#else
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
+#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
+
+ QString appKey;
+ if (argc > 1) {
+ appKey = argv[1];
+ qDebug() << "App key for worldweatheronline.com:" << appKey;
+ } else {
+ qWarning() << "No app key for worldweatheronline.com given. Using static test data instead of live data.";
+ }
+ viewer.setTitle(QStringLiteral("QML Weather"));
+ viewer.rootContext()->setContextProperty("weatherAppKey", appKey);
+ viewer.setSource(QUrl("qrc:/qml/qmlweather/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
+
+ return app.exec();
+}
diff --git a/examples/charts/qmlweather/qml/qmlweather/main.qml b/examples/charts/qmlweather/qml/qmlweather/main.qml
new file mode 100644
index 00000000..23d3ee23
--- /dev/null
+++ b/examples/charts/qmlweather/qml/qmlweather/main.qml
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCharts 2.0
+
+Rectangle {
+ width: 500
+ height: 400
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightblue" }
+ GradientStop { position: 1.0; color: "white" }
+ }
+
+ //![1]
+ ChartView {
+ id: chartView
+ title: "Weather forecast"
+ //![1]
+ anchors.top: parent.top
+ anchors.bottom: weatherImageRow.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ legend.alignment: Qt.AlignTop
+ antialiasing: true
+
+ //![2]
+ BarCategoryAxis {
+ id: barCategoriesAxis
+ titleText: "Date"
+ }
+
+ ValueAxis{
+ id: valueAxisY2
+ min: 0
+ max: 10
+ titleText: "Rainfall [mm]"
+ }
+
+ ValueAxis {
+ id: valueAxisX
+ // Hide the value axis; it is only used to map the line series to bar categories axis
+ visible: false
+ min: 0
+ max: 5
+ }
+
+ ValueAxis{
+ id: valueAxisY
+ min: 0
+ max: 15
+ titleText: "Temperature [&deg;C]"
+ }
+
+ LineSeries {
+ id: maxTempSeries
+ axisX: valueAxisX
+ axisY: valueAxisY
+ name: "Max. temperature"
+ }
+
+ LineSeries {
+ id: minTempSeries
+ axisX: valueAxisX
+ axisY: valueAxisY
+ name: "Min. temperature"
+ }
+
+ BarSeries {
+ id: myBarSeries
+ axisX: barCategoriesAxis
+ axisYRight: valueAxisY2
+ BarSet {
+ id: rainfallSet
+ label: "Rainfall"
+ }
+ }
+ //![2]
+ }
+
+ // A timer to refresh the forecast every 5 minutes
+ Timer {
+ interval: 300000
+ repeat: true
+ triggeredOnStart: true
+ running: true
+ onTriggered: {
+ if (weatherAppKey != "") {
+ //![3]
+ // Make HTTP GET request and parse the result
+ var xhr = new XMLHttpRequest;
+ xhr.open("GET",
+ "http://free.worldweatheronline.com/feed/weather.ashx?q=Jyv%c3%a4skyl%c3%a4,Finland&format=json&num_of_days=5&key="
+ + weatherAppKey);
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == XMLHttpRequest.DONE) {
+ var a = JSON.parse(xhr.responseText);
+ parseWeatherData(a);
+ }
+ }
+ xhr.send();
+ //![3]
+ } else {
+ // No app key for worldweatheronline.com given by the user -> use dummy static data
+ var responseText = "{ \"data\": { \"current_condition\": [ {\"cloudcover\": \"10\", \"humidity\": \"61\", \"observation_time\": \"06:26 AM\", \"precipMM\": \"0.0\", \"pressure\": \"1022\", \"temp_C\": \"6\", \"temp_F\": \"43\", \"visibility\": \"10\", \"weatherCode\": \"113\", \"weatherDesc\": [ {\"value\": \"Sunny\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0001_sunny.png\" } ], \"winddir16Point\": \"SE\", \"winddirDegree\": \"140\", \"windspeedKmph\": \"7\", \"windspeedMiles\": \"4\" } ], \"request\": [ {\"query\": \"Jyvaskyla, Finland\", \"type\": \"City\" } ], \"weather\": [ {\"date\": \"2012-05-09\", \"precipMM\": \"0.4\", \"tempMaxC\": \"14\", \"tempMaxF\": \"57\", \"tempMinC\": \"7\", \"tempMinF\": \"45\", \"weatherCode\": \"116\", \"weatherDesc\": [ {\"value\": \"Partly Cloudy\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png\" } ], \"winddir16Point\": \"S\", \"winddirDegree\": \"179\", \"winddirection\": \"S\", \"windspeedKmph\": \"20\", \"windspeedMiles\": \"12\" }, {\"date\": \"2012-05-10\", \"precipMM\": \"2.4\", \"tempMaxC\": \"13\", \"tempMaxF\": \"55\", \"tempMinC\": \"8\", \"tempMinF\": \"46\", \"weatherCode\": \"266\", \"weatherDesc\": [ {\"value\": \"Light drizzle\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0017_cloudy_with_light_rain.png\" } ], \"winddir16Point\": \"SW\", \"winddirDegree\": \"219\", \"winddirection\": \"SW\", \"windspeedKmph\": \"21\", \"windspeedMiles\": \"13\" }, {\"date\": \"2012-05-11\", \"precipMM\": \"11.1\", \"tempMaxC\": \"15\", \"tempMaxF\": \"59\", \"tempMinC\": \"7\", \"tempMinF\": \"44\", \"weatherCode\": \"266\", \"weatherDesc\": [ {\"value\": \"Light drizzle\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0017_cloudy_with_light_rain.png\" } ], \"winddir16Point\": \"SSW\", \"winddirDegree\": \"200\", \"winddirection\": \"SSW\", \"windspeedKmph\": \"20\", \"windspeedMiles\": \"12\" }, {\"date\": \"2012-05-12\", \"precipMM\": \"2.8\", \"tempMaxC\": \"7\", \"tempMaxF\": \"44\", \"tempMinC\": \"2\", \"tempMinF\": \"35\", \"weatherCode\": \"317\", \"weatherDesc\": [ {\"value\": \"Light sleet\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0021_cloudy_with_sleet.png\" } ], \"winddir16Point\": \"NW\", \"winddirDegree\": \"311\", \"winddirection\": \"NW\", \"windspeedKmph\": \"24\", \"windspeedMiles\": \"15\" }, {\"date\": \"2012-05-13\", \"precipMM\": \"0.4\", \"tempMaxC\": \"6\", \"tempMaxF\": \"42\", \"tempMinC\": \"2\", \"tempMinF\": \"35\", \"weatherCode\": \"116\", \"weatherDesc\": [ {\"value\": \"Partly Cloudy\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png\" } ], \"winddir16Point\": \"WNW\", \"winddirDegree\": \"281\", \"winddirection\": \"WNW\", \"windspeedKmph\": \"21\", \"windspeedMiles\": \"13\" } ] }}";
+ var a = JSON.parse(responseText);
+ parseWeatherData(a);
+ }
+ }
+ }
+
+ Row {
+ id: weatherImageRow
+ anchors.bottom: poweredByText.top
+ anchors.bottomMargin: 10
+ anchors.left: parent.left
+ anchors.leftMargin: 25
+ anchors.right: parent.right
+ anchors.rightMargin: 25
+
+ ListModel {
+ id: weatherImageModel
+ }
+
+ Repeater {
+ id: repeater
+ model: weatherImageModel
+ delegate: Image {
+ source: imageSource
+ width: weatherImageRow.width / weatherImageModel.count
+ height: width
+ fillMode: Image.PreserveAspectCrop
+ }
+ }
+ }
+
+ Text {
+ id: poweredByText
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 10
+ anchors.left: parent.left
+ anchors.leftMargin: 25
+ text: "Powered by World Weather Online"
+ }
+
+ function parseWeatherData(weatherData) {
+ // Clear previous values
+ maxTempSeries.clear();
+ minTempSeries.clear();
+ weatherImageModel.clear();
+
+ //![4]
+ // Loop through the parsed JSON
+ for (var i in weatherData.data.weather) {
+ var weatherObj = weatherData.data.weather[i];
+ //![4]
+
+ //![5]
+ // Store temperature values, rainfall and weather icon.
+ // The temperature values begin from 0.5 instead of 0.0 to make the start from the
+ // middle of the rainfall bars. This makes the temperature lines visually better
+ // synchronized with the rainfall bars.
+ maxTempSeries.append(Number(i) + 0.5, weatherObj.tempMaxC);
+ minTempSeries.append(Number(i) + 0.5, weatherObj.tempMinC);
+ rainfallSet.append(i, weatherObj.precipMM);
+ weatherImageModel.append({"imageSource":weatherObj.weatherIconUrl[0].value});
+ //![5]
+
+ // Update scale of the chart
+ valueAxisY.max = Math.max(chartView.axisY().max,weatherObj.tempMaxC);
+ valueAxisX.min = 0;
+ valueAxisX.max = Number(i) + 1;
+
+ // Set the x-axis labels to the dates of the forecast
+ var xLabels = barCategoriesAxis.categories;
+ xLabels[Number(i)] = weatherObj.date.substring(5, 10);
+ barCategoriesAxis.categories = xLabels;
+ barCategoriesAxis.visible = true;
+ barCategoriesAxis.min = 0;
+ barCategoriesAxis.max = xLabels.length - 1;
+ }
+ }
+
+}
diff --git a/examples/charts/qmlweather/qmlweather.pro b/examples/charts/qmlweather/qmlweather.pro
new file mode 100644
index 00000000..5e0d8df4
--- /dev/null
+++ b/examples/charts/qmlweather/qmlweather.pro
@@ -0,0 +1,7 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/qmlweather/*
diff --git a/demos/qmlweather/resources.qrc b/examples/charts/qmlweather/resources.qrc
index 7205906f..7205906f 100644
--- a/demos/qmlweather/resources.qrc
+++ b/examples/charts/qmlweather/resources.qrc
diff --git a/examples/scatterchart/chartview.cpp b/examples/charts/scatterchart/chartview.cpp
index 345be195..345be195 100644
--- a/examples/scatterchart/chartview.cpp
+++ b/examples/charts/scatterchart/chartview.cpp
diff --git a/examples/charts/scatterchart/chartview.h b/examples/charts/scatterchart/chartview.h
new file mode 100644
index 00000000..c2c03038
--- /dev/null
+++ b/examples/charts/scatterchart/chartview.h
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHARTVIEW_H
+#define CHARTVIEW_H
+
+#include <QChartView>
+
+QT_CHARTS_USE_NAMESPACE
+
+class ChartView : public QChartView
+{
+ Q_OBJECT
+public:
+ explicit ChartView(QWidget *parent = 0);
+};
+
+#endif // CHARTVIEW_H
diff --git a/examples/charts/scatterchart/main.cpp b/examples/charts/scatterchart/main.cpp
new file mode 100644
index 00000000..e1a76ed2
--- /dev/null
+++ b/examples/charts/scatterchart/main.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include "chartview.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![4]
+ ChartView *chartView = new ChartView();
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.show();
+//![4]
+
+ return a.exec();
+}
diff --git a/examples/scatterchart/scatterchart.pro b/examples/charts/scatterchart/scatterchart.pro
index 8170d6f4..8170d6f4 100644
--- a/examples/scatterchart/scatterchart.pro
+++ b/examples/charts/scatterchart/scatterchart.pro
diff --git a/examples/charts/scatterinteractions/chartview.cpp b/examples/charts/scatterinteractions/chartview.cpp
new file mode 100644
index 00000000..7e55c4e0
--- /dev/null
+++ b/examples/charts/scatterinteractions/chartview.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartview.h"
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_USE_NAMESPACE
+
+ChartView::ChartView(QWidget *parent)
+ : QChartView(new QChart(), parent),
+ m_scatter(0),
+ m_scatter2(0)
+{
+ setRenderHint(QPainter::Antialiasing);
+
+ chart()->setTitle("Click to interact with scatter points");
+
+ m_scatter = new QScatterSeries();
+ m_scatter->setName("scatter1");
+ for (qreal x(0.5); x <= 4.0; x += 0.5) {
+ for (qreal y(0.5); y <= 4.0; y += 0.5) {
+ *m_scatter << QPointF(x, y);
+ }
+ }
+ m_scatter2 = new QScatterSeries();
+ m_scatter2->setName("scatter2");
+
+ chart()->addSeries(m_scatter2);
+ chart()->addSeries(m_scatter);
+ chart()->createDefaultAxes();
+ chart()->axisX()->setRange(0, 4.5);
+ chart()->axisY()->setRange(0, 4.5);
+
+ connect(m_scatter, SIGNAL(clicked(QPointF)), this, SLOT(handleClickedPoint(QPointF)));
+}
+
+ChartView::~ChartView()
+{
+}
+
+void ChartView::handleClickedPoint(const QPointF &point)
+{
+ QPointF clickedPoint = point;
+ // Find the closest point from series 1
+ QPointF closest(INT_MAX, INT_MAX);
+ qreal distance(INT_MAX);
+ foreach (QPointF currentPoint, m_scatter->points()) {
+ qreal currentDistance = qSqrt((currentPoint.x() - clickedPoint.x())
+ * (currentPoint.x() - clickedPoint.x())
+ + (currentPoint.y() - clickedPoint.y())
+ * (currentPoint.y() - clickedPoint.y()));
+ if (currentDistance < distance) {
+ distance = currentDistance;
+ closest = currentPoint;
+ }
+ }
+
+ // Remove the closes point from series 1 and append it to series 2
+ m_scatter->remove(closest);
+ m_scatter2->append(closest);
+}
diff --git a/examples/charts/scatterinteractions/chartview.h b/examples/charts/scatterinteractions/chartview.h
new file mode 100644
index 00000000..da280051
--- /dev/null
+++ b/examples/charts/scatterinteractions/chartview.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHARTVIEW_H
+#define CHARTVIEW_H
+
+#include <QChartGlobal>
+#include <QChartView>
+#include <QScatterSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+class ChartView : public QChartView
+{
+ Q_OBJECT
+
+public:
+ ChartView(QWidget *parent = 0);
+ ~ChartView();
+
+private Q_SLOTS:
+ void handleClickedPoint(const QPointF &point);
+
+private:
+ QScatterSeries *m_scatter;
+ QScatterSeries *m_scatter2;
+};
+
+#endif // CHARTVIEW_H
diff --git a/examples/scatterinteractions/main.cpp b/examples/charts/scatterinteractions/main.cpp
index fb5dd8fc..fb5dd8fc 100644
--- a/examples/scatterinteractions/main.cpp
+++ b/examples/charts/scatterinteractions/main.cpp
diff --git a/examples/scatterinteractions/scatterinteractions.pro b/examples/charts/scatterinteractions/scatterinteractions.pro
index 596fe020..596fe020 100644
--- a/examples/scatterinteractions/scatterinteractions.pro
+++ b/examples/charts/scatterinteractions/scatterinteractions.pro
diff --git a/examples/charts/splinechart/main.cpp b/examples/charts/splinechart/main.cpp
new file mode 100644
index 00000000..e6a40dd0
--- /dev/null
+++ b/examples/charts/splinechart/main.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QSplineSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ //![1]
+ QSplineSeries *series = new QSplineSeries();
+ series->setName("spline");
+ //![1]
+
+ //![2]
+ series->append(0, 6);
+ series->append(2, 4);
+ series->append(3, 8);
+ series->append(7, 4);
+ series->append(10, 5);
+ *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
+ //![2]
+
+ //![3]
+ QChart *chart = new QChart();
+ chart->legend()->hide();
+ chart->addSeries(series);
+ chart->setTitle("Simple spline chart example");
+ chart->createDefaultAxes();
+ chart->axisY()->setRange(0, 10);
+ //![3]
+
+ //![4]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+ //![4]
+
+ //![5]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.show();
+ //![5]
+
+ return a.exec();
+}
diff --git a/examples/splinechart/splinechart.pro b/examples/charts/splinechart/splinechart.pro
index b2624f53..b2624f53 100644
--- a/examples/splinechart/splinechart.pro
+++ b/examples/charts/splinechart/splinechart.pro
diff --git a/examples/charts/stackedbarchart/main.cpp b/examples/charts/stackedbarchart/main.cpp
new file mode 100644
index 00000000..c94b18de
--- /dev/null
+++ b/examples/charts/stackedbarchart/main.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QStackedBarSeries>
+#include <QBarSet>
+#include <QLegend>
+#include <QBarCategoryAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QBarSet *set0 = new QBarSet("Jane");
+ QBarSet *set1 = new QBarSet("John");
+ QBarSet *set2 = new QBarSet("Axel");
+ QBarSet *set3 = new QBarSet("Mary");
+ QBarSet *set4 = new QBarSet("Samantha");
+
+ *set0 << 1 << 2 << 3 << 4 << 5 << 6;
+ *set1 << 5 << 0 << 0 << 4 << 0 << 7;
+ *set2 << 3 << 5 << 8 << 13 << 8 << 5;
+ *set3 << 5 << 6 << 7 << 3 << 4 << 5;
+ *set4 << 9 << 7 << 5 << 3 << 1 << 2;
+//![1]
+
+//![2]
+ QStackedBarSeries *series = new QStackedBarSeries();
+ series->append(set0);
+ series->append(set1);
+ series->append(set2);
+ series->append(set3);
+ series->append(set4);
+//![2]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->setTitle("Simple stackedbarchart example");
+ chart->setAnimationOptions(QChart::SeriesAnimations);
+//![3]
+
+//![4]
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
+ QBarCategoryAxis *axis = new QBarCategoryAxis();
+ axis->append(categories);
+ chart->createDefaultAxes();
+ chart->setAxisX(axis, series);
+//![4]
+
+//![5]
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
+//![5]
+
+//![6]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![6]
+
+//![7]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(420, 300);
+ window.show();
+//![7]
+
+ return a.exec();
+}
+
diff --git a/examples/stackedbarchart/stackedbarchart.pro b/examples/charts/stackedbarchart/stackedbarchart.pro
index f6a77b6a..f6a77b6a 100644
--- a/examples/stackedbarchart/stackedbarchart.pro
+++ b/examples/charts/stackedbarchart/stackedbarchart.pro
diff --git a/examples/charts/stackedbarchartdrilldown/drilldownchart.cpp b/examples/charts/stackedbarchartdrilldown/drilldownchart.cpp
new file mode 100644
index 00000000..1acfa172
--- /dev/null
+++ b/examples/charts/stackedbarchartdrilldown/drilldownchart.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "drilldownchart.h"
+#include <QBarCategoryAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+DrilldownChart::DrilldownChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
+ : QChart(QChart::ChartTypeCartesian, parent, wFlags),
+ m_currentSeries(0)
+{
+}
+
+void DrilldownChart::changeSeries(DrilldownBarSeries *series)
+{
+ if (m_currentSeries) {
+ removeSeries(m_currentSeries);
+ }
+
+ m_currentSeries = series;
+
+ // Reset axis
+ QBarCategoryAxis *axis = new QBarCategoryAxis();
+ axis->append(m_currentSeries->categories());
+
+ addSeries(series);
+
+ createDefaultAxes();
+ setAxisX(axis, series);
+ axisY()->setTitleText("Crops");
+
+ setTitle(series->name());
+}
+
+void DrilldownChart::handleClicked(int index, QBarSet *barset)
+{
+ Q_UNUSED(barset)
+ DrilldownBarSeries *series = static_cast<DrilldownBarSeries *>(sender());
+ changeSeries(series->drilldownSeries(index));
+}
+
+#include "moc_drilldownchart.cpp"
diff --git a/examples/charts/stackedbarchartdrilldown/drilldownchart.h b/examples/charts/stackedbarchartdrilldown/drilldownchart.h
new file mode 100644
index 00000000..c75216f7
--- /dev/null
+++ b/examples/charts/stackedbarchartdrilldown/drilldownchart.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DRILLDOWNCHART_H
+#define DRILLDOWNCHART_H
+
+#include <QChart>
+#include "drilldownseries.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+//! [1]
+class DrilldownChart : public QChart
+{
+ Q_OBJECT
+public:
+ explicit DrilldownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
+
+ void changeSeries(DrilldownBarSeries *series);
+
+public Q_SLOTS:
+ void handleClicked(int index, QBarSet *barset);
+
+private:
+ DrilldownBarSeries *m_currentSeries;
+};
+//! [1]
+
+#endif // DRILLDOWNCHART_H
diff --git a/examples/charts/stackedbarchartdrilldown/drilldownseries.cpp b/examples/charts/stackedbarchartdrilldown/drilldownseries.cpp
new file mode 100644
index 00000000..87d70b5a
--- /dev/null
+++ b/examples/charts/stackedbarchartdrilldown/drilldownseries.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "drilldownseries.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+DrilldownBarSeries::DrilldownBarSeries(QStringList categories, QObject *parent)
+ : QStackedBarSeries(parent)
+{
+ m_categories = categories;
+}
+
+void DrilldownBarSeries::mapDrilldownSeries(int index, DrilldownBarSeries *drilldownSeries)
+{
+ m_DrilldownSeries[index] = drilldownSeries;
+}
+
+DrilldownBarSeries *DrilldownBarSeries::drilldownSeries(int index)
+{
+ return m_DrilldownSeries[index];
+}
+
+QStringList DrilldownBarSeries::categories()
+{
+ return m_categories;
+}
+
+#include "moc_drilldownseries.cpp"
diff --git a/examples/charts/stackedbarchartdrilldown/drilldownseries.h b/examples/charts/stackedbarchartdrilldown/drilldownseries.h
new file mode 100644
index 00000000..5a340839
--- /dev/null
+++ b/examples/charts/stackedbarchartdrilldown/drilldownseries.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DRILLDOWNSERIES_H
+#define DRILLDOWNSERIES_H
+
+#include <QStackedBarSeries>
+#include <QMap>
+
+QT_CHARTS_USE_NAMESPACE
+
+//! [1]
+class DrilldownBarSeries : public QStackedBarSeries
+{
+ Q_OBJECT
+public:
+ DrilldownBarSeries(QStringList categories, QObject *parent = 0);
+
+ void mapDrilldownSeries(int index, DrilldownBarSeries *drilldownSeries);
+
+ DrilldownBarSeries *drilldownSeries(int index);
+
+ QStringList categories();
+
+private:
+ QMap<int, DrilldownBarSeries *> m_DrilldownSeries;
+ QStringList m_categories;
+};
+//! [1]
+
+#endif // DRILLDOWNSERIES_H
diff --git a/examples/charts/stackedbarchartdrilldown/main.cpp b/examples/charts/stackedbarchartdrilldown/main.cpp
new file mode 100644
index 00000000..6a46520d
--- /dev/null
+++ b/examples/charts/stackedbarchartdrilldown/main.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QBarSet>
+#include <QLegend>
+#include "drilldownseries.h"
+#include "drilldownchart.h"
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ QMainWindow window;
+
+//! [1]
+ DrilldownChart *drilldownChart = new DrilldownChart();
+ drilldownChart->setTheme(QChart::ChartThemeBlueIcy);
+ drilldownChart->setAnimationOptions(QChart::SeriesAnimations);
+//! [1]
+
+//! [2]
+ // Define categories
+ QStringList months;
+ months << "May" << "Jun" << "Jul" << "Aug" << "Sep";
+ QStringList weeks;
+ weeks << "week 1" << "week 2" << "week 3" << "week 4";
+ QStringList plants;
+ plants << "Habanero" << "Lemon Drop" << "Starfish" << "Aji Amarillo";
+//! [2]
+
+//! [3]
+ // Create drilldown structure
+ DrilldownBarSeries *seasonSeries = new DrilldownBarSeries(months, drilldownChart);
+ seasonSeries->setName("Crop by month - Season");
+
+ // Each month in season series has drilldown series for weekly data
+ for (int month = 0; month < months.count(); month++) {
+
+ // Create drilldown series for every week
+ DrilldownBarSeries *weeklySeries = new DrilldownBarSeries(weeks, drilldownChart);
+ seasonSeries->mapDrilldownSeries(month, weeklySeries);
+
+ // Drilling down from weekly data brings us back to season data.
+ for (int week = 0; week < weeks.count(); week++) {
+ weeklySeries->mapDrilldownSeries(week, seasonSeries);
+ weeklySeries->setName(QString("Crop by week - " + months.at(month)));
+ }
+
+ // Use clicked signal to implement drilldown
+ QObject::connect(weeklySeries, SIGNAL(clicked(int,QBarSet*)), drilldownChart, SLOT(handleClicked(int,QBarSet*)));
+ }
+
+ // Enable drilldown from season series using clicked signal
+ QObject::connect(seasonSeries, SIGNAL(clicked(int,QBarSet*)), drilldownChart, SLOT(handleClicked(int,QBarSet*)));
+//! [3]
+
+//! [4]
+ // Fill monthly and weekly series with data
+ foreach (QString plant, plants) {
+ QBarSet *monthlyCrop = new QBarSet(plant);
+ for (int month = 0; month < months.count(); month++) {
+ QBarSet *weeklyCrop = new QBarSet(plant);
+ for (int week = 0; week < weeks.count(); week++)
+ *weeklyCrop << (qrand() % 20);
+ // Get the drilldown series from season series and add crop to it.
+ seasonSeries->drilldownSeries(month)->append(weeklyCrop);
+ *monthlyCrop << weeklyCrop->sum();
+ }
+ seasonSeries->append(monthlyCrop);
+ }
+//! [4]
+
+//! [5]
+ // Show season series in initial view
+ drilldownChart->changeSeries(seasonSeries);
+ drilldownChart->setTitle(seasonSeries->name());
+//! [5]
+
+//! [6]
+ drilldownChart->axisX()->setGridLineVisible(false);
+ drilldownChart->legend()->setVisible(true);
+ drilldownChart->legend()->setAlignment(Qt::AlignBottom);
+//! [6]
+
+ QChartView *chartView = new QChartView(drilldownChart);
+ window.setCentralWidget(chartView);
+ window.resize(480, 300);
+ window.show();
+
+ return a.exec();
+}
+
diff --git a/examples/stackedbarchartdrilldown/stackedbarchartdrilldown.pro b/examples/charts/stackedbarchartdrilldown/stackedbarchartdrilldown.pro
index c10066f4..c10066f4 100644
--- a/examples/stackedbarchartdrilldown/stackedbarchartdrilldown.pro
+++ b/examples/charts/stackedbarchartdrilldown/stackedbarchartdrilldown.pro
diff --git a/examples/charts/temperaturerecords/main.cpp b/examples/charts/temperaturerecords/main.cpp
new file mode 100644
index 00000000..24caec8e
--- /dev/null
+++ b/examples/charts/temperaturerecords/main.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMainWindow>
+#include <QChartView>
+#include <QBarSeries>
+#include <QBarSet>
+#include <QLegend>
+#include <QBarCategoryAxis>
+#include <QStackedBarSeries>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QBarSet *low = new QBarSet("Min");
+ QBarSet *high = new QBarSet("Max");
+
+ *low << -52 << -50 << -45.3 << -37.0 << -25.6 << -8.0 << -6.0 << -11.8 << -19.7 << -32.8 << -43.0 << -48.0;
+ *high << 11.9 << 12.8 << 18.5 << 26.5 << 32.0 << 34.8 << 38.2 << 34.8 << 29.8 << 20.4 << 15.1 << 11.8;
+//![1]
+
+//![2]
+ QStackedBarSeries *series = new QStackedBarSeries();
+ series->append(low);
+ series->append(high);
+//![2]
+
+//![3]
+ QChart *chart = new QChart();
+ chart->addSeries(series);
+ chart->setTitle("Temperature records in celcius");
+ chart->setAnimationOptions(QChart::SeriesAnimations);
+//![3]
+
+//![4]
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
+
+ QBarCategoryAxis *axis = new QBarCategoryAxis();
+ axis->append(categories);
+ axis->setTitleText("Month");
+ chart->createDefaultAxes();
+ chart->setAxisX(axis, series);
+ chart->axisY(series)->setRange(-52, 52);
+ chart->axisY(series)->setTitleText("Temperature [&deg;C]");
+//![4]
+
+//![5]
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
+//![5]
+
+//![6]
+ QChartView *chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![6]
+
+//![7]
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(600, 300);
+ window.show();
+//![7]
+
+ return a.exec();
+}
diff --git a/examples/temperaturerecords/temperaturerecords.pro b/examples/charts/temperaturerecords/temperaturerecords.pro
index e2eb6be3..e2eb6be3 100644
--- a/examples/temperaturerecords/temperaturerecords.pro
+++ b/examples/charts/temperaturerecords/temperaturerecords.pro
diff --git a/examples/zoomlinechart/chart.cpp b/examples/charts/zoomlinechart/chart.cpp
index 890c6c03..890c6c03 100644
--- a/examples/zoomlinechart/chart.cpp
+++ b/examples/charts/zoomlinechart/chart.cpp
diff --git a/examples/charts/zoomlinechart/chart.h b/examples/charts/zoomlinechart/chart.h
new file mode 100644
index 00000000..a0ebb223
--- /dev/null
+++ b/examples/charts/zoomlinechart/chart.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHART_H
+#define CHART_H
+
+#include <QChart>
+
+class QGestureEvent;
+
+QT_CHARTS_USE_NAMESPACE
+
+//![1]
+class Chart : public QChart
+//![1]
+{
+public:
+ explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
+ ~Chart();
+
+protected:
+ bool sceneEvent(QEvent *event);
+
+private:
+ bool gestureEvent(QGestureEvent *event);
+
+private:
+
+};
+
+#endif // CHART_H
diff --git a/examples/zoomlinechart/chartview.cpp b/examples/charts/zoomlinechart/chartview.cpp
index 64369c62..64369c62 100644
--- a/examples/zoomlinechart/chartview.cpp
+++ b/examples/charts/zoomlinechart/chartview.cpp
diff --git a/examples/charts/zoomlinechart/chartview.h b/examples/charts/zoomlinechart/chartview.h
new file mode 100644
index 00000000..3ad7c85e
--- /dev/null
+++ b/examples/charts/zoomlinechart/chartview.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHARTVIEW_H
+#define CHARTVIEW_H
+
+#include <QChartView>
+#include <QRubberBand>
+
+QT_CHARTS_USE_NAMESPACE
+
+//![1]
+class ChartView : public QChartView
+//![1]
+{
+public:
+ ChartView(QChart *chart, QWidget *parent = 0);
+
+//![2]
+protected:
+ bool viewportEvent(QEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+ void keyPressEvent(QKeyEvent *event);
+//![2]
+
+private:
+ bool m_isTouching;
+};
+
+#endif
diff --git a/examples/charts/zoomlinechart/main.cpp b/examples/charts/zoomlinechart/main.cpp
new file mode 100644
index 00000000..7dd5865a
--- /dev/null
+++ b/examples/charts/zoomlinechart/main.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chart.h"
+#include "chartview.h"
+#include <QApplication>
+#include <QMainWindow>
+#include <qmath.h>
+#include <QLineSeries>
+#include <QValueAxis>
+
+QT_CHARTS_USE_NAMESPACE
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//![1]
+ QLineSeries *series = new QLineSeries();
+ for (int i = 0; i < 500; i++) {
+ QPointF p((qreal) i, qSin(M_PI / 50 * i) * 100);
+ p.ry() += qrand() % 20;
+ *series << p;
+ }
+//![1]
+
+ Chart *chart = new Chart();
+ chart->addSeries(series);
+ chart->setTitle("Zoom in/out example");
+ chart->setAnimationOptions(QChart::SeriesAnimations);
+ chart->legend()->hide();
+ chart->createDefaultAxes();
+
+ ChartView *chartView = new ChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+
+ QMainWindow window;
+ window.setCentralWidget(chartView);
+ window.resize(400, 300);
+ window.grabGesture(Qt::PanGesture);
+ window.grabGesture(Qt::PinchGesture);
+ window.show();
+
+ return a.exec();
+}
diff --git a/examples/zoomlinechart/zoomlinechart.pro b/examples/charts/zoomlinechart/zoomlinechart.pro
index c98161b2..c98161b2 100644
--- a/examples/zoomlinechart/zoomlinechart.pro
+++ b/examples/charts/zoomlinechart/zoomlinechart.pro
diff --git a/examples/customchart/main.cpp b/examples/customchart/main.cpp
deleted file mode 100644
index 8cd02711..00000000
--- a/examples/customchart/main.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QLineSeries>
-#include <QCategoryAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QLineSeries *series = new QLineSeries();
- *series << QPointF(0, 6) << QPointF(9, 4) << QPointF(15, 20) << QPointF(25, 12) << QPointF(29, 26);
- QChart *chart = new QChart();
- chart->legend()->hide();
- chart->addSeries(series);
-//![1]
-
-//![2]
- // Customize series
- QPen pen(QRgb(0xfdb157));
- pen.setWidth(5);
- series->setPen(pen);
-
- // Customize chart title
- QFont font;
- font.setPixelSize(18);
- chart->setTitleFont(font);
- chart->setTitleBrush(QBrush(Qt::white));
- chart->setTitle("Customchart example");
-
- // Customize chart background
- QLinearGradient backgroundGradient;
- backgroundGradient.setStart(QPointF(0, 0));
- backgroundGradient.setFinalStop(QPointF(0, 1));
- backgroundGradient.setColorAt(0.0, QRgb(0xd2d0d1));
- backgroundGradient.setColorAt(1.0, QRgb(0x4c4547));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- chart->setBackgroundBrush(backgroundGradient);
-
- // Customize plot area background
- QLinearGradient plotAreaGradient;
- plotAreaGradient.setStart(QPointF(0, 1));
- plotAreaGradient.setFinalStop(QPointF(1, 0));
- plotAreaGradient.setColorAt(0.0, QRgb(0x555555));
- plotAreaGradient.setColorAt(1.0, QRgb(0x55aa55));
- plotAreaGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- chart->setPlotAreaBackgroundBrush(plotAreaGradient);
- chart->setPlotAreaBackgroundVisible(true);
-//![2]
-
-//![3]
- QCategoryAxis *axisX = new QCategoryAxis();
- QCategoryAxis *axisY = new QCategoryAxis();
-
- // Customize axis label font
- QFont labelsFont;
- labelsFont.setPixelSize(12);
- axisX->setLabelsFont(labelsFont);
- axisY->setLabelsFont(labelsFont);
-
- // Customize axis colors
- QPen axisPen(QRgb(0xd18952));
- axisPen.setWidth(2);
- axisX->setLinePen(axisPen);
- axisY->setLinePen(axisPen);
-
- // Customize axis label colors
- QBrush axisBrush(Qt::white);
- axisX->setLabelsBrush(axisBrush);
- axisY->setLabelsBrush(axisBrush);
-
- // Customize grid lines and shades
- axisX->setGridLineVisible(false);
- axisY->setGridLineVisible(false);
- axisY->setShadesPen(Qt::NoPen);
- axisY->setShadesBrush(QBrush(QColor(0x99, 0xcc, 0xcc, 0x55)));
- axisY->setShadesVisible(true);
-//![3]
-
-//![4]
- axisX->append("low", 10);
- axisX->append("optimal", 20);
- axisX->append("high", 30);
- axisX->setRange(0, 30);
-
- axisY->append("slow", 10);
- axisY->append("med", 20);
- axisY->append("fast", 30);
- axisY->setRange(0, 30);
-
- chart->setAxisX(axisX, series);
- chart->setAxisY(axisY, series);
-//![4]
-
-//![5]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![5]
-
-//![6]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
-//![6]
-
- return a.exec();
-}
diff --git a/examples/datetimeaxis/main.cpp b/examples/datetimeaxis/main.cpp
deleted file mode 100644
index 1427276b..00000000
--- a/examples/datetimeaxis/main.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QLineSeries>
-#include <QDateTime>
-#include <QDateTimeAxis>
-#include <QFile>
-#include <QTextStream>
-#include <QDebug>
-#include <QValueAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
- qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
-
- //![1]
- QLineSeries *series = new QLineSeries();
- //![1]
-
- //![2]
- // data from http://www.swpc.noaa.gov/ftpdir/weekly/RecentIndices.txt
- // http://www.swpc.noaa.gov/ftpdir/weekly/README
- // http://www.weather.gov/disclaimer
- QFile sunSpots(":sun");
- if (!sunSpots.open(QIODevice::ReadOnly | QIODevice::Text)) {
- return 1;
- }
-
- QTextStream stream(&sunSpots);
- while (!stream.atEnd()) {
- QString line = stream.readLine();
- if (line.startsWith("#") || line.startsWith(":"))
- continue;
- QStringList values = line.split(" ", QString::SkipEmptyParts);
- QDateTime momentInTime;
- momentInTime.setDate(QDate(values[0].toInt(), values[1].toInt() , 15));
- series->append(momentInTime.toMSecsSinceEpoch(), values[2].toDouble());
- }
- sunSpots.close();
- //![2]
-
- //![3]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->legend()->hide();
- chart->setTitle("Sunspots count (by Space Weather Prediction Center)");
- //![3]
-
- //![4]
- QDateTimeAxis *axisX = new QDateTimeAxis;
- axisX->setTickCount(10);
- axisX->setFormat("MMM yyyy");
- axisX->setTitleText("Date");
- chart->addAxis(axisX, Qt::AlignBottom);
- series->attachAxis(axisX);
-
- QValueAxis *axisY = new QValueAxis;
- axisY->setLabelFormat("%i");
- axisY->setTitleText("Sunspots count");
- chart->addAxis(axisY, Qt::AlignLeft);
- series->attachAxis(axisY);
- //![4]
-
- //![5]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
- //![5]
-
- //![6]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(820, 600);
- window.show();
- //![6]
-
- return a.exec();
-}
diff --git a/examples/donutbreakdown/donutbreakdownchart.cpp b/examples/donutbreakdown/donutbreakdownchart.cpp
deleted file mode 100644
index 4886aa0a..00000000
--- a/examples/donutbreakdown/donutbreakdownchart.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "donutbreakdownchart.h"
-#include "mainslice.h"
-#include <QPieSlice>
-#include <QPieLegendMarker>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-//![1]
-DonutBreakdownChart::DonutBreakdownChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QChart(QChart::ChartTypeCartesian, parent, wFlags)
-{
- // create the series for main center pie
- m_mainSeries = new QPieSeries();
- m_mainSeries->setPieSize(0.7);
- QChart::addSeries(m_mainSeries);
-}
-//![1]
-
-//![2]
-void DonutBreakdownChart::addBreakdownSeries(QPieSeries *breakdownSeries, QColor color)
-{
- QFont font("Arial", 8);
-
- // add breakdown series as a slice to center pie
- MainSlice *mainSlice = new MainSlice(breakdownSeries);
- mainSlice->setName(breakdownSeries->name());
- mainSlice->setValue(breakdownSeries->sum());
- m_mainSeries->append(mainSlice);
-
- // customize the slice
- mainSlice->setBrush(color);
- mainSlice->setLabelVisible();
- mainSlice->setLabelColor(Qt::white);
- mainSlice->setLabelPosition(QPieSlice::LabelInsideHorizontal);
- mainSlice->setLabelFont(font);
-
- // position and customize the breakdown series
- breakdownSeries->setPieSize(0.8);
- breakdownSeries->setHoleSize(0.7);
- breakdownSeries->setLabelsVisible();
- foreach (QPieSlice *slice, breakdownSeries->slices()) {
- color = color.lighter(115);
- slice->setBrush(color);
- slice->setLabelFont(font);
- }
-
- // add the series to the chart
- QChart::addSeries(breakdownSeries);
-
- // recalculate breakdown donut segments
- recalculateAngles();
-
- // update customize legend markers
- updateLegendMarkers();
-}
-//![2]
-
-//![3]
-void DonutBreakdownChart::recalculateAngles()
-{
- qreal angle = 0;
- foreach (QPieSlice *slice, m_mainSeries->slices()) {
- QPieSeries *breakdownSeries = qobject_cast<MainSlice *>(slice)->breakdownSeries();
- breakdownSeries->setPieStartAngle(angle);
- angle += slice->percentage() * 360.0; // full pie is 360.0
- breakdownSeries->setPieEndAngle(angle);
- }
-}
-//![3]
-
-//![4]
-void DonutBreakdownChart::updateLegendMarkers()
-{
- // go through all markers
- foreach (QAbstractSeries *series, QChart::series()) {
- foreach (QLegendMarker *marker, legend()->markers(series)) {
- QPieLegendMarker *pieMarker = qobject_cast<QPieLegendMarker *>(marker);
- if (series == m_mainSeries) {
- // hide markers from main series
- pieMarker->setVisible(false);
- } else {
- // modify markers from breakdown series
- pieMarker->setLabel(QString("%1 %2%")
- .arg(pieMarker->slice()->label())
- .arg(pieMarker->slice()->percentage() * 100, 0, 'f', 2));
- pieMarker->setFont(QFont("Arial", 8));
- }
- }
- }
-}
-//![4]
diff --git a/examples/donutbreakdown/donutbreakdownchart.h b/examples/donutbreakdown/donutbreakdownchart.h
deleted file mode 100644
index ecf75d80..00000000
--- a/examples/donutbreakdown/donutbreakdownchart.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef DONUTBREAKDOWNCHART_H
-#define DONUTBREAKDOWNCHART_H
-
-#include <QChart>
-#include <QPieSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class DonutBreakdownChart : public QChart
-{
-public:
- DonutBreakdownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
- void addBreakdownSeries(QPieSeries *series, QColor color);
-
-private:
- void recalculateAngles();
- void updateLegendMarkers();
-
-private:
- QPieSeries *m_mainSeries;
-};
-
-#endif // DONUTBREAKDOWNCHART_H
diff --git a/examples/donutbreakdown/main.cpp b/examples/donutbreakdown/main.cpp
deleted file mode 100644
index bb19f4ee..00000000
--- a/examples/donutbreakdown/main.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QApplication>
-#include <QMainWindow>
-#include <QStatusBar>
-#include <QChartView>
-#include "donutbreakdownchart.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- //![1]
- // Graph is based on data of 'Total consumption of energy increased by 10 per cent in 2010'
- // Statistics Finland, 13 December 2011
- // http://www.stat.fi/til/ekul/2010/ekul_2010_2011-12-13_tie_001_en.html
-
- QPieSeries *series1 = new QPieSeries();
- series1->setName("Fossil fuels");
- series1->append("Oil", 353295);
- series1->append("Coal", 188500);
- series1->append("Natural gas", 148680);
- series1->append("Peat", 94545);
-
- QPieSeries *series2 = new QPieSeries();
- series2->setName("Renewables");
- series2->append("Wood fuels", 319663);
- series2->append("Hydro power", 45875);
- series2->append("Wind power", 1060);
-
- QPieSeries *series3 = new QPieSeries();
- series3->setName("Others");
- series3->append("Nuclear energy", 238789);
- series3->append("Import energy", 37802);
- series3->append("Other", 32441);
- //![1]
-
- //![2]
- DonutBreakdownChart *donutBreakdown = new DonutBreakdownChart();
- donutBreakdown->setAnimationOptions(QChart::AllAnimations);
- donutBreakdown->setTitle("Total consumption of energy in Finland 2010");
- donutBreakdown->legend()->setAlignment(Qt::AlignRight);
- donutBreakdown->addBreakdownSeries(series1, Qt::red);
- donutBreakdown->addBreakdownSeries(series2, Qt::darkGreen);
- donutBreakdown->addBreakdownSeries(series3, Qt::darkBlue);
- //![2]
-
- //![3]
- QMainWindow window;
- QChartView *chartView = new QChartView(donutBreakdown);
- chartView->setRenderHint(QPainter::Antialiasing);
- window.setCentralWidget(chartView);
- window.resize(800, 500);
- window.show();
- //![3]
-
- return a.exec();
-}
diff --git a/examples/donutbreakdown/mainslice.cpp b/examples/donutbreakdown/mainslice.cpp
deleted file mode 100644
index b907df19..00000000
--- a/examples/donutbreakdown/mainslice.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mainslice.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-//![1]
-MainSlice::MainSlice(QPieSeries *breakdownSeries, QObject *parent)
- : QPieSlice(parent),
- m_breakdownSeries(breakdownSeries)
-{
- connect(this, SIGNAL(percentageChanged()), this, SLOT(updateLabel()));
-}
-//![1]
-
-QPieSeries *MainSlice::breakdownSeries() const
-{
- return m_breakdownSeries;
-}
-
-void MainSlice::setName(QString name)
-{
- m_name = name;
-}
-
-QString MainSlice::name() const
-{
- return m_name;
-}
-
-//![2]
-void MainSlice::updateLabel()
-{
- this->setLabel(QString("%1 %2%").arg(m_name).arg(percentage() * 100, 0, 'f', 2));
-}
-//![2]
-
-#include "moc_mainslice.cpp"
-
diff --git a/examples/donutbreakdown/mainslice.h b/examples/donutbreakdown/mainslice.h
deleted file mode 100644
index 3d99e570..00000000
--- a/examples/donutbreakdown/mainslice.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAINSLICE_H
-#define MAINSLICE_H
-
-#include <QPieSlice>
-#include <QPieSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class MainSlice : public QPieSlice
-{
- Q_OBJECT
-public:
- MainSlice(QPieSeries *breakdownSeries, QObject *parent = 0);
-
- QPieSeries *breakdownSeries() const;
-
- void setName(QString name);
- QString name() const;
-
-public Q_SLOTS:
- void updateLabel();
-
-private:
- QPieSeries *m_breakdownSeries;
- QString m_name;
-};
-
-#endif // MAINSLICE_H
diff --git a/examples/donutchart/main.cpp b/examples/donutchart/main.cpp
deleted file mode 100644
index b47839c8..00000000
--- a/examples/donutchart/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QPieSeries>
-#include <QPieSlice>
-#include <QDebug>
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QPieSeries *series = new QPieSeries();
- series->setHoleSize(0.35);
- series->append("Protein 4.2%", 4.2);
- QPieSlice *slice = series->append("Fat 15.6%", 15.6);
- slice->setExploded();
- slice->setLabelVisible();
- series->append("Other 23.8%", 23.8);
- series->append("Carbs 56.4%", 56.4);
-//![1]
-
-//![2]
- QChartView *chartView = new QChartView();
- chartView->setRenderHint(QPainter::Antialiasing);
- chartView->chart()->setTitle("Donut with a lemon glaze (100g)");
- chartView->chart()->addSeries(series);
- chartView->chart()->legend()->setAlignment(Qt::AlignBottom);
- chartView->chart()->setTheme(QChart::ChartThemeBlueCerulean);
- chartView->chart()->legend()->setFont(QFont("Arial", 7));
-//![2]
-
-//![3]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
-//![3]
-
- return a.exec();
-}
diff --git a/examples/examples.pri b/examples/examples.pri
deleted file mode 100644
index ea89d8b8..00000000
--- a/examples/examples.pri
+++ /dev/null
@@ -1,33 +0,0 @@
-!include( ../config.pri ) {
- error( "Couldn't find the config.pri file!" )
-}
-
-DESTDIR = $$CHART_BUILD_BIN_DIR
-!ios {
-OBJECTS_DIR = $$CHART_BUILD_DIR/examples/$$TARGET
-MOC_DIR = $$CHART_BUILD_DIR/examples/$$TARGET
-UI_DIR = $$CHART_BUILD_DIR/examples/$$TARGET
-RCC_DIR = $$CHART_BUILD_DIR/examples/$$TARGET
-}
-TEMPLATE = app
-QT += core gui
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-
-# staticlib config causes problems when building executables
-staticlib: CONFIG-=staticlib
-
-android {
- # Workaround to fix android deployment, which seems to always look for target in
- # OUT_PWD instead of DESTDIR.
- COPY_PARAMETERS = "$$CHART_BUILD_BIN_DIR/lib$${TARGET}.so $$OUT_PWD/lib$${TARGET}.so"
- contains(QMAKE_HOST.os, Windows): COPY_PARAMETERS = $$replace(COPY_PARAMETERS, "/","\\")
- QMAKE_POST_LINK += $$QMAKE_COPY $$COPY_PARAMETERS
-
- contains(TARGET, qml.*) {
- charts_qmldir.files = $$CHART_BUILD_QML_PLUGIN_DIR/qmldir
- charts_qmldir.path = /assets/imports/QtCommercial/Chart
- charts_qmlplugin.files = $$CHART_BUILD_QML_PLUGIN_DIR/libqtcommercialchartqml.so
- charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
- INSTALLS += charts_qmldir charts_qmlplugin
- }
-}
diff --git a/examples/examples.pro b/examples/examples.pro
index 9985e63b..fadcde2f 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -1,45 +1,2 @@
-CURRENTLY_BUILDING_COMPONENTS = "examples"
-!include( ../config.pri ) {
- error( "Couldn't find the config.pri file!" )
-}
-
TEMPLATE = subdirs
-SUBDIRS += \
- areachart \
- customchart \
- linechart \
- percentbarchart \
- piechart \
- piechartdrilldown \
- scatterchart \
- scatterinteractions \
- splinechart \
- stackedbarchart \
- stackedbarchartdrilldown \
- zoomlinechart \
- modeldata \
- barchart \
- boxplotchart \
- legend \
- barmodelmapper \
- lineandbar \
- horizontalbarchart \
- horizontalstackedbarchart \
- horizontalpercentbarchart \
- donutbreakdown \
- temperaturerecords \
- donutchart \
- multiaxis \
- legendmarkers \
- logvalueaxis \
- polarchart
-
-!contains(QT_VERSION, ^5\\..*\\..*$)|qtHaveModule(declarative) {
- SUBDIRS += qmlboxplot \
- qmlpiechart
-}
-
-!linux-arm*: {
-SUBDIRS += \
- datetimeaxis
-}
+SUBDIRS += charts
diff --git a/examples/horizontalbarchart/main.cpp b/examples/horizontalbarchart/main.cpp
deleted file mode 100644
index 206f8a12..00000000
--- a/examples/horizontalbarchart/main.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QBarSeries>
-#include <QBarSet>
-#include <QLegend>
-#include <QBarCategoryAxis>
-#include <QValueAxis>
-#include <QHorizontalBarSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QBarSet *set0 = new QBarSet("Jane");
- QBarSet *set1 = new QBarSet("John");
- QBarSet *set2 = new QBarSet("Axel");
- QBarSet *set3 = new QBarSet("Mary");
- QBarSet *set4 = new QBarSet("Samantha");
-
- *set0 << 1 << 2 << 3 << 4 << 5 << 6;
- *set1 << 5 << 0 << 0 << 4 << 0 << 7;
- *set2 << 3 << 5 << 8 << 13 << 8 << 5;
- *set3 << 5 << 6 << 7 << 3 << 4 << 5;
- *set4 << 9 << 7 << 5 << 3 << 1 << 2;
-//![1]
-
-//![2]
- QHorizontalBarSeries *series = new QHorizontalBarSeries();
- series->append(set0);
- series->append(set1);
- series->append(set2);
- series->append(set3);
- series->append(set4);
-//![2]
-
-//![3]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Simple horizontal barchart example");
- chart->setAnimationOptions(QChart::SeriesAnimations);
-//![3]
-
-//![4]
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- QBarCategoryAxis *axisY = new QBarCategoryAxis();
- axisY->append(categories);
- chart->setAxisY(axisY, series);
- QValueAxis *axisX = new QValueAxis();
- chart->setAxisX(axisX, series);
- axisX->applyNiceNumbers();
-//![4]
-
-//![5]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
-//![5]
-
-//![6]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![6]
-
-//![7]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(420, 300);
- window.show();
-//![7]
-
- return a.exec();
-}
diff --git a/examples/horizontalpercentbarchart/main.cpp b/examples/horizontalpercentbarchart/main.cpp
deleted file mode 100644
index 29def46e..00000000
--- a/examples/horizontalpercentbarchart/main.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QBarSeries>
-#include <QBarSet>
-#include <QLegend>
-#include <QBarCategoryAxis>
-#include <QHorizontalPercentBarSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QBarSet *set0 = new QBarSet("Jane");
- QBarSet *set1 = new QBarSet("John");
- QBarSet *set2 = new QBarSet("Axel");
- QBarSet *set3 = new QBarSet("Mary");
- QBarSet *set4 = new QBarSet("Samantha");
-
- *set0 << 1 << 2 << 3 << 4 << 5 << 6;
- *set1 << 5 << 0 << 0 << 4 << 0 << 7;
- *set2 << 3 << 5 << 8 << 13 << 8 << 5;
- *set3 << 5 << 6 << 7 << 3 << 4 << 5;
- *set4 << 9 << 7 << 5 << 3 << 1 << 2;
-//![1]
-
-//![2]
- QHorizontalPercentBarSeries *series = new QHorizontalPercentBarSeries();
- series->append(set0);
- series->append(set1);
- series->append(set2);
- series->append(set3);
- series->append(set4);
-
-//![2]
-
-//![3]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Simple horizontal percent barchart example");
- chart->setAnimationOptions(QChart::SeriesAnimations);
-//![3]
-
-//![4]
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- QBarCategoryAxis *axis = new QBarCategoryAxis();
- axis->append(categories);
- chart->createDefaultAxes();
- chart->setAxisY(axis, series);
-//![4]
-
-//![5]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
-//![5]
-
-//![6]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![6]
-
-//![7]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(420, 300);
- window.show();
-//![7]
-
- return a.exec();
-}
diff --git a/examples/horizontalstackedbarchart/main.cpp b/examples/horizontalstackedbarchart/main.cpp
deleted file mode 100644
index 8ce6c372..00000000
--- a/examples/horizontalstackedbarchart/main.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QBarSeries>
-#include <QBarSet>
-#include <QLegend>
-#include <QBarCategoryAxis>
-#include <QHorizontalStackedBarSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QBarSet *set0 = new QBarSet("Jane");
- QBarSet *set1 = new QBarSet("John");
- QBarSet *set2 = new QBarSet("Axel");
- QBarSet *set3 = new QBarSet("Mary");
- QBarSet *set4 = new QBarSet("Samantha");
-
- *set0 << 1 << 2 << 3 << 4 << 5 << 6;
- *set1 << 5 << 0 << 0 << 4 << 0 << 7;
- *set2 << 3 << 5 << 8 << 13 << 8 << 5;
- *set3 << 5 << 6 << 7 << 3 << 4 << 5;
- *set4 << 9 << 7 << 5 << 3 << 1 << 2;
-//![1]
-
-//![2]
- QHorizontalStackedBarSeries *series = new QHorizontalStackedBarSeries();
- series->append(set0);
- series->append(set1);
- series->append(set2);
- series->append(set3);
- series->append(set4);
-
-//![2]
-
-//![3]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Simple horizontal stacked barchart example");
- chart->setAnimationOptions(QChart::SeriesAnimations);
-//![3]
-
-//![4]
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- QBarCategoryAxis *axis = new QBarCategoryAxis();
- axis->append(categories);
- chart->createDefaultAxes();
- chart->setAxisY(axis, series);
-//![4]
-
-//![5]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
-//![5]
-
-//![6]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![6]
-
-//![7]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(420, 300);
- window.show();
-//![7]
-
- return a.exec();
-}
diff --git a/examples/legend/main.cpp b/examples/legend/main.cpp
deleted file mode 100644
index 2fac3cd3..00000000
--- a/examples/legend/main.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mainwidget.h"
-
-#include <QApplication>
-#include <QMainWindow>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- MainWidget w;
- w.resize(720, 480);
- w.show();
-
- return a.exec();
-}
diff --git a/examples/legend/mainwidget.cpp b/examples/legend/mainwidget.cpp
deleted file mode 100644
index 8cf3fe53..00000000
--- a/examples/legend/mainwidget.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mainwidget.h"
-#include <QChart>
-#include <QChartView>
-#include <QPushButton>
-#include <QLabel>
-#include <QDebug>
-#include <QBarSet>
-#include <QBarSeries>
-#include <QLegend>
-#include <QFormLayout>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-MainWidget::MainWidget(QWidget *parent) :
- QWidget(parent)
-{
- // Create buttons for ui
- m_buttonLayout = new QGridLayout();
- QPushButton *detachLegendButton = new QPushButton("Toggle attached");
- connect(detachLegendButton, SIGNAL(clicked()), this, SLOT(toggleAttached()));
- m_buttonLayout->addWidget(detachLegendButton, 0, 0);
-
- QPushButton *addSetButton = new QPushButton("add barset");
- connect(addSetButton, SIGNAL(clicked()), this, SLOT(addBarset()));
- m_buttonLayout->addWidget(addSetButton, 2, 0);
- QPushButton *removeBarsetButton = new QPushButton("remove barset");
- connect(removeBarsetButton, SIGNAL(clicked()), this, SLOT(removeBarset()));
- m_buttonLayout->addWidget(removeBarsetButton, 3, 0);
-
- QPushButton *alignButton = new QPushButton("Align (Bottom)");
- connect(alignButton, SIGNAL(clicked()), this, SLOT(setLegendAlignment()));
- m_buttonLayout->addWidget(alignButton, 4, 0);
-
- QPushButton *boldButton = new QPushButton("Toggle bold");
- connect(boldButton, SIGNAL(clicked()), this, SLOT(toggleBold()));
- m_buttonLayout->addWidget(boldButton, 8, 0);
-
- QPushButton *italicButton = new QPushButton("Toggle italic");
- connect(italicButton, SIGNAL(clicked()), this, SLOT(toggleItalic()));
- m_buttonLayout->addWidget(italicButton, 9, 0);
-
- m_legendPosX = new QDoubleSpinBox();
- m_legendPosY = new QDoubleSpinBox();
- m_legendWidth = new QDoubleSpinBox();
- m_legendHeight = new QDoubleSpinBox();
-
- connect(m_legendPosX, SIGNAL(valueChanged(double)), this, SLOT(updateLegendLayout()));
- connect(m_legendPosY, SIGNAL(valueChanged(double)), this, SLOT(updateLegendLayout()));
- connect(m_legendWidth, SIGNAL(valueChanged(double)), this, SLOT(updateLegendLayout()));
- connect(m_legendHeight, SIGNAL(valueChanged(double)), this, SLOT(updateLegendLayout()));
-
- QFormLayout *legendLayout = new QFormLayout();
- legendLayout->addRow("HPos", m_legendPosX);
- legendLayout->addRow("VPos", m_legendPosY);
- legendLayout->addRow("Width", m_legendWidth);
- legendLayout->addRow("Height", m_legendHeight);
- m_legendSettings = new QGroupBox("Detached legend");
- m_legendSettings->setLayout(legendLayout);
- m_buttonLayout->addWidget(m_legendSettings);
- m_legendSettings->setVisible(false);
-
- // Create chart view with the chart
- m_chart = new QChart();
- m_chartView = new QChartView(m_chart, this);
-
- // Create spinbox to modify font size
- m_fontSize = new QDoubleSpinBox();
- m_fontSize->setValue(m_chart->legend()->font().pointSizeF());
- connect(m_fontSize, SIGNAL(valueChanged(double)), this, SLOT(fontSizeChanged()));
-
- QFormLayout *fontLayout = new QFormLayout();
- fontLayout->addRow("Legend font size", m_fontSize);
-
- // Create layout for grid and detached legend
- m_mainLayout = new QGridLayout();
- m_mainLayout->addLayout(m_buttonLayout, 0, 0);
- m_mainLayout->addLayout(fontLayout, 1, 0);
- m_mainLayout->addWidget(m_chartView, 0, 1, 3, 1);
- setLayout(m_mainLayout);
-
- createSeries();
-}
-
-void MainWidget::createSeries()
-{
- m_series = new QBarSeries();
- addBarset();
- addBarset();
- addBarset();
- addBarset();
-
- m_chart->addSeries(m_series);
- m_chart->setTitle("Legend detach example");
- m_chart->createDefaultAxes();
-//![1]
- m_chart->legend()->setVisible(true);
- m_chart->legend()->setAlignment(Qt::AlignBottom);
-//![1]
-
- m_chartView->setRenderHint(QPainter::Antialiasing);
-}
-
-void MainWidget::showLegendSpinbox()
-{
- m_legendSettings->setVisible(true);
- QRectF chartViewRect = m_chartView->rect();
-
- m_legendPosX->setMinimum(0);
- m_legendPosX->setMaximum(chartViewRect.width());
- m_legendPosX->setValue(150);
-
- m_legendPosY->setMinimum(0);
- m_legendPosY->setMaximum(chartViewRect.height());
- m_legendPosY->setValue(150);
-
- m_legendWidth->setMinimum(0);
- m_legendWidth->setMaximum(chartViewRect.width());
- m_legendWidth->setValue(150);
-
- m_legendHeight->setMinimum(0);
- m_legendHeight->setMaximum(chartViewRect.height());
- m_legendHeight->setValue(75);
-}
-
-void MainWidget::hideLegendSpinbox()
-{
- m_legendSettings->setVisible(false);
-}
-
-
-void MainWidget::toggleAttached()
-{
- QLegend *legend = m_chart->legend();
- if (legend->isAttachedToChart()) {
- //![2]
- legend->detachFromChart();
- m_chart->legend()->setBackgroundVisible(true);
- m_chart->legend()->setBrush(QBrush(QColor(128, 128, 128, 128)));
- m_chart->legend()->setPen(QPen(QColor(192, 192, 192, 192)));
- //![2]
- showLegendSpinbox();
- updateLegendLayout();
- } else {
- //![3]
- legend->attachToChart();
- legend->setBackgroundVisible(false);
- //![3]
- hideLegendSpinbox();
- }
- update();
-}
-
-void MainWidget::addBarset()
-{
- QBarSet *barSet = new QBarSet(QString("set ") + QString::number(m_series->count()));
- qreal delta = m_series->count() * 0.1;
- *barSet << 1 + delta << 2 + delta << 3 + delta << 4 + delta;
- m_series->append(barSet);
-}
-
-void MainWidget::removeBarset()
-{
- QList<QBarSet *> sets = m_series->barSets();
- if (sets.count() > 0) {
- m_series->remove(sets.at(sets.count() - 1));
- }
-}
-
-void MainWidget::setLegendAlignment()
-{
- QPushButton *button = qobject_cast<QPushButton *>(sender());
-
- switch (m_chart->legend()->alignment()) {
- case Qt::AlignTop:
- m_chart->legend()->setAlignment(Qt::AlignLeft);
- if (button)
- button->setText("Align (Left)");
- break;
- case Qt::AlignLeft:
- m_chart->legend()->setAlignment(Qt::AlignBottom);
- if (button)
- button->setText("Align (Bottom)");
- break;
- case Qt::AlignBottom:
- m_chart->legend()->setAlignment(Qt::AlignRight);
- if (button)
- button->setText("Align (Right)");
- break;
- default:
- if (button)
- button->setText("Align (Top)");
- m_chart->legend()->setAlignment(Qt::AlignTop);
- break;
- }
-}
-
-void MainWidget::toggleBold()
-{
- QFont font = m_chart->legend()->font();
- font.setBold(!font.bold());
- m_chart->legend()->setFont(font);
-}
-
-void MainWidget::toggleItalic()
-{
- QFont font = m_chart->legend()->font();
- font.setItalic(!font.italic());
- m_chart->legend()->setFont(font);
-}
-
-void MainWidget::fontSizeChanged()
-{
- QFont font = m_chart->legend()->font();
- font.setPointSizeF(m_fontSize->value());
- m_chart->legend()->setFont(font);
-}
-
-void MainWidget::updateLegendLayout()
-{
-//![4]
- m_chart->legend()->setGeometry(QRectF(m_legendPosX->value(),
- m_legendPosY->value(),
- m_legendWidth->value(),
- m_legendHeight->value()));
- m_chart->legend()->update();
-//![4]
-}
diff --git a/examples/legend/mainwidget.h b/examples/legend/mainwidget.h
deleted file mode 100644
index 99c98e0c..00000000
--- a/examples/legend/mainwidget.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAINWIDGET_H
-#define MAINWIDGET_H
-
-#include "qchartglobal.h"
-#include "qchart.h"
-#include "qchartview.h"
-#include <QWidget>
-#include <QGraphicsWidget>
-#include <QGridLayout>
-#include <QGraphicsGridLayout>
-#include <QDoubleSpinBox>
-#include <QGroupBox>
-#include <QBarSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class MainWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit MainWidget(QWidget *parent = 0);
- void createSeries();
- void showLegendSpinbox();
- void hideLegendSpinbox();
-
-public Q_SLOTS:
- void toggleAttached();
- void addBarset();
- void removeBarset();
-
- void setLegendAlignment();
-
- void toggleBold();
- void toggleItalic();
- void fontSizeChanged();
-
- void updateLegendLayout();
-
-private:
- QChart *m_chart;
- QBarSeries *m_series;
-
- QChartView *m_chartView;
- QGridLayout *m_mainLayout;
- QGridLayout *m_buttonLayout;
- QGridLayout *m_fontLayout;
-
- QDoubleSpinBox *m_fontSize;
-
- // For detached layout
- QGroupBox *m_legendSettings;
- QDoubleSpinBox *m_legendPosX;
- QDoubleSpinBox *m_legendPosY;
- QDoubleSpinBox *m_legendWidth;
- QDoubleSpinBox *m_legendHeight;
-};
-
-#endif // MAINWIDGET_H
diff --git a/examples/legendmarkers/mainwidget.cpp b/examples/legendmarkers/mainwidget.cpp
deleted file mode 100644
index 2a20f882..00000000
--- a/examples/legendmarkers/mainwidget.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mainwidget.h"
-#include <QChart>
-#include <QChartView>
-#include <QPushButton>
-#include <QLabel>
-#include <QDebug>
-#include <QLegend>
-#include <QFormLayout>
-#include <QLegendMarker>
-#include <QLineSeries>
-#include <QXYLegendMarker>
-#include <qmath.h>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-MainWidget::MainWidget(QWidget *parent) :
- QWidget(parent)
-{
- // Create chart view with the chart
- m_chart = new QChart();
- m_chartView = new QChartView(m_chart, this);
-
- // Create layout for grid and detached legend
- m_mainLayout = new QGridLayout();
- m_mainLayout->addWidget(m_chartView, 0, 1, 3, 1);
- setLayout(m_mainLayout);
-
- // Add few series
- addSeries();
- addSeries();
- addSeries();
- addSeries();
-
- connectMarkers();
-
- // Set the title and show legend
- m_chart->setTitle("Legendmarker example (click on legend)");
- m_chart->legend()->setVisible(true);
- m_chart->legend()->setAlignment(Qt::AlignBottom);
-
- m_chartView->setRenderHint(QPainter::Antialiasing);
-}
-
-void MainWidget::addSeries()
-{
- QLineSeries *series = new QLineSeries();
- m_series.append(series);
-
- series->setName(QString("line " + QString::number(m_series.count())));
-
- // Make some sine wave for data
- QList<QPointF> data;
- int offset = m_chart->series().count();
- for (int i = 0; i < 360; i++) {
- qreal x = offset * 20 + i;
- data.append(QPointF(i, qSin(2.0 * 3.141592 * x / 360.0)));
- }
-
- series->append(data);
- m_chart->addSeries(series);
-
- if (m_series.count() == 1) {
- m_chart->createDefaultAxes();
- }
-}
-
-void MainWidget::removeSeries()
-{
- // Remove last series from chart
- if (m_series.count() > 0) {
- QLineSeries *series = m_series.last();
- m_chart->removeSeries(series);
- m_series.removeLast();
- delete series;
- }
-}
-
-void MainWidget::connectMarkers()
-{
-//![1]
- // Connect all markers to handler
- foreach (QLegendMarker* marker, m_chart->legend()->markers()) {
- // Disconnect possible existing connection to avoid multiple connections
- QObject::disconnect(marker, SIGNAL(clicked()), this, SLOT(handleMarkerClicked()));
- QObject::connect(marker, SIGNAL(clicked()), this, SLOT(handleMarkerClicked()));
- }
-//![1]
-}
-
-void MainWidget::disconnectMarkers()
-{
-//![2]
- foreach (QLegendMarker* marker, m_chart->legend()->markers()) {
- QObject::disconnect(marker, SIGNAL(clicked()), this, SLOT(handleMarkerClicked()));
- }
-//![2]
-}
-
-void MainWidget::handleMarkerClicked()
-{
-//![3]
- QLegendMarker* marker = qobject_cast<QLegendMarker*> (sender());
- Q_ASSERT(marker);
-//![3]
-
-//![4]
- switch (marker->type())
-//![4]
- {
- case QLegendMarker::LegendMarkerTypeXY:
- {
-//![5]
- // Toggle visibility of series
- marker->series()->setVisible(!marker->series()->isVisible());
-
- // Turn legend marker back to visible, since hiding series also hides the marker
- // and we don't want it to happen now.
- marker->setVisible(true);
-//![5]
-
-//![6]
- // Dim the marker, if series is not visible
- qreal alpha = 1.0;
-
- if (!marker->series()->isVisible()) {
- alpha = 0.5;
- }
-
- QColor color;
- QBrush brush = marker->labelBrush();
- color = brush.color();
- color.setAlphaF(alpha);
- brush.setColor(color);
- marker->setLabelBrush(brush);
-
- brush = marker->brush();
- color = brush.color();
- color.setAlphaF(alpha);
- brush.setColor(color);
- marker->setBrush(brush);
-
- QPen pen = marker->pen();
- color = pen.color();
- color.setAlphaF(alpha);
- pen.setColor(color);
- marker->setPen(pen);
-
-//![6]
- break;
- }
- default:
- {
- qDebug() << "Unknown marker type";
- break;
- }
- }
-}
diff --git a/examples/legendmarkers/mainwidget.h b/examples/legendmarkers/mainwidget.h
deleted file mode 100644
index 3c01f7b3..00000000
--- a/examples/legendmarkers/mainwidget.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAINWIDGET_H
-#define MAINWIDGET_H
-
-#include "qchartglobal.h"
-#include "qchart.h"
-#include "qchartview.h"
-#include <QWidget>
-#include <QGraphicsWidget>
-#include <QGridLayout>
-#include <QGraphicsGridLayout>
-#include <QDoubleSpinBox>
-#include <QGroupBox>
-#include <QLineSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class MainWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit MainWidget(QWidget *parent = 0);
-
-public slots:
- void addSeries();
- void removeSeries();
- void connectMarkers();
- void disconnectMarkers();
-
- void handleMarkerClicked();
-
-private:
-
- QChart *m_chart;
- QList<QLineSeries *> m_series;
-
- QChartView *m_chartView;
- QGridLayout *m_mainLayout;
- QGridLayout *m_fontLayout;
-
-};
-
-#endif // MAINWIDGET_H
diff --git a/examples/lineandbar/main.cpp b/examples/lineandbar/main.cpp
deleted file mode 100644
index f4b46e91..00000000
--- a/examples/lineandbar/main.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QBarSeries>
-#include <QBarSet>
-#include <QLineSeries>
-#include <QLegend>
-#include <QBarCategoryAxis>
-#include <QValueAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QBarSet *set0 = new QBarSet("Jane");
- QBarSet *set1 = new QBarSet("John");
- QBarSet *set2 = new QBarSet("Axel");
- QBarSet *set3 = new QBarSet("Mary");
- QBarSet *set4 = new QBarSet("Sam");
-
- *set0 << 1 << 2 << 3 << 4 << 5 << 6;
- *set1 << 5 << 0 << 0 << 4 << 0 << 7;
- *set2 << 3 << 5 << 8 << 13 << 8 << 5;
- *set3 << 5 << 6 << 7 << 3 << 4 << 5;
- *set4 << 9 << 7 << 5 << 3 << 1 << 2;
-//![1]
-
-//![2]
- QBarSeries *barseries = new QBarSeries();
- barseries->append(set0);
- barseries->append(set1);
- barseries->append(set2);
- barseries->append(set3);
- barseries->append(set4);
-//![2]
-
-//![8]
- QLineSeries *lineseries = new QLineSeries();
- lineseries->setName("trend");
- lineseries->append(QPoint(0, 4));
- lineseries->append(QPoint(1, 15));
- lineseries->append(QPoint(2, 20));
- lineseries->append(QPoint(3, 4));
- lineseries->append(QPoint(4, 12));
- lineseries->append(QPoint(5, 17));
-//![8]
-
-//![3]
- QChart *chart = new QChart();
- chart->addSeries(barseries);
- chart->addSeries(lineseries);
- chart->setTitle("Line and barchart example");
-//![3]
-
-//![4]
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- QBarCategoryAxis *axisX = new QBarCategoryAxis();
- axisX->append(categories);
- chart->setAxisX(axisX, lineseries);
- chart->setAxisX(axisX, barseries);
- axisX->setRange(QString("Jan"), QString("Jun"));
-
- QValueAxis *axisY = new QValueAxis();
- chart->setAxisY(axisY, lineseries);
- chart->setAxisY(axisY, barseries);
- axisY->setRange(0, 20);
-//![4]
-
-//![5]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
-//![5]
-
-//![6]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![6]
-
-//![7]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(440, 300);
- window.show();
-//![7]
-
- return a.exec();
-}
diff --git a/examples/linechart/main.cpp b/examples/linechart/main.cpp
deleted file mode 100644
index d47d69f7..00000000
--- a/examples/linechart/main.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QLineSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QLineSeries *series = new QLineSeries();
-//![1]
-
-//![2]
- series->append(0, 6);
- series->append(2, 4);
- series->append(3, 8);
- series->append(7, 4);
- series->append(10, 5);
- *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
-//![2]
-
-//![3]
- QChart *chart = new QChart();
- chart->legend()->hide();
- chart->addSeries(series);
- chart->createDefaultAxes();
- chart->setTitle("Simple line chart example");
-//![3]
-
-//![4]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![4]
-
-
-//![5]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
-//![5]
-
- return a.exec();
-}
diff --git a/examples/logvalueaxis/main.cpp b/examples/logvalueaxis/main.cpp
deleted file mode 100644
index e1f09f09..00000000
--- a/examples/logvalueaxis/main.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QLineSeries>
-#include <QValueAxis>
-#include <QLogValueAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- //![1]
- QLineSeries *series = new QLineSeries();
- *series << QPointF(1, 1) << QPointF(2, 73) << QPointF(3, 268) << QPointF(4, 17) << QPointF(5, 4325) << QPointF(6, 723);
- //![1]
-
- //![2]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->legend()->hide();
- chart->setTitle("Logarithmic axis example");
- //![2]
-
- //![3]
- QValueAxis *axisX = new QValueAxis;
- axisX->setTitleText("Data point");
- axisX->setTickCount(6);
- axisX->setLabelFormat("%i");
- chart->addAxis(axisX, Qt::AlignBottom);
- series->attachAxis(axisX);
-
- QLogValueAxis *axisY = new QLogValueAxis;
- axisY->setLabelFormat("%g");
- axisY->setTitleText("Values");
- axisY->setBase(8);
- chart->addAxis(axisY, Qt::AlignLeft);
- series->attachAxis(axisY);
- //![3]
-
- //![4]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
- //![4]
-
- //![5]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
- //![5]
-
- return a.exec();
-}
diff --git a/examples/modeldata/tablewidget.cpp b/examples/modeldata/tablewidget.cpp
deleted file mode 100644
index abfa7bf5..00000000
--- a/examples/modeldata/tablewidget.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tablewidget.h"
-#include "customtablemodel.h"
-#include <QGridLayout>
-#include <QTableView>
-#include <QChart>
-#include <QChartView>
-#include <QLineSeries>
-#include <QVXYModelMapper>
-#include <QHeaderView>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-TableWidget::TableWidget(QWidget *parent)
- : QWidget(parent)
-{
- // create simple model for storing data
- // user's table data model
- //! [1]
- CustomTableModel *model = new CustomTableModel;
- //! [1]
-
- //! [2]
- // create table view and add model to it
- QTableView *tableView = new QTableView;
- tableView->setModel(model);
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
- tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
- tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
-#else
- tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
- tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
-#endif
- //! [2]
-
- //! [3]
- QChart *chart = new QChart;
- chart->setAnimationOptions(QChart::AllAnimations);
- //! [3]
-
- // series 1
- //! [4]
- QLineSeries *series = new QLineSeries;
- series->setName("Line 1");
- QVXYModelMapper *mapper = new QVXYModelMapper(this);
- mapper->setXColumn(0);
- mapper->setYColumn(1);
- mapper->setSeries(series);
- mapper->setModel(model);
- chart->addSeries(series);
- //! [4]
-
- //! [5]
- // for storing color hex from the series
- QString seriesColorHex = "#000000";
-
- // get the color of the series and use it for showing the mapped area
- seriesColorHex = "#" + QString::number(series->pen().color().rgb(), 16).right(6).toUpper();
- model->addMapping(seriesColorHex, QRect(0, 0, 2, model->rowCount()));
- //! [5]
-
-
- // series 2
- //! [6]
- series = new QLineSeries;
- series->setName("Line 2");
-
- mapper = new QVXYModelMapper(this);
- mapper->setXColumn(2);
- mapper->setYColumn(3);
- mapper->setSeries(series);
- mapper->setModel(model);
- chart->addSeries(series);
- //! [6]
-
- //! [7]
- // get the color of the series and use it for showing the mapped area
- seriesColorHex = "#" + QString::number(series->pen().color().rgb(), 16).right(6).toUpper();
- model->addMapping(seriesColorHex, QRect(2, 0, 2, model->rowCount()));
- //! [7]
-
- //! [8]
- chart->createDefaultAxes();
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
- chartView->setMinimumSize(640, 480);
- //! [8]
-
- //! [9]
- // create main layout
- QGridLayout *mainLayout = new QGridLayout;
- mainLayout->addWidget(tableView, 1, 0);
- mainLayout->addWidget(chartView, 1, 1);
- mainLayout->setColumnStretch(1, 1);
- mainLayout->setColumnStretch(0, 0);
- setLayout(mainLayout);
- //! [9]
-}
diff --git a/examples/multiaxis/main.cpp b/examples/multiaxis/main.cpp
deleted file mode 100644
index 37c905d8..00000000
--- a/examples/multiaxis/main.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QLineSeries>
-#include <QSplineSeries>
-#include <QValueAxis>
-#include <QCategoryAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- //![1]
- QChart *chart = new QChart();
- chart->legend()->hide();
- chart->setTitle("Multiaxis chart example");
- //![1]
-
- //![2]
- QValueAxis *axisX = new QValueAxis;
- axisX->setTickCount(10);
- chart->addAxis(axisX, Qt::AlignBottom);
- //![2]
-
- //![3]
- QSplineSeries *series = new QSplineSeries;
- *series << QPointF(1, 5) << QPointF(3.5, 18) << QPointF(4.8, 7.5) << QPointF(10, 2.5);
- chart->addSeries(series);
-
- QValueAxis *axisY = new QValueAxis;
- axisY->setLinePenColor(series->pen().color());
-
- chart->addAxis(axisY, Qt::AlignLeft);
- series->attachAxis(axisX);
- series->attachAxis(axisY);
- //![3]
-
- //![4]
- series = new QSplineSeries;
- *series << QPointF(1, 0.5) << QPointF(1.5, 4.5) << QPointF(2.4, 2.5) << QPointF(4.3, 12.5)
- << QPointF(5.2, 3.5) << QPointF(7.4, 16.5) << QPointF(8.3, 7.5) << QPointF(10, 17);
- chart->addSeries(series);
-
- QCategoryAxis *axisY3 = new QCategoryAxis;
- axisY3->append("Low", 5);
- axisY3->append("Medium", 12);
- axisY3->append("High", 17);
- axisY3->setLinePenColor(series->pen().color());
- axisY3->setGridLinePen((series->pen()));
-
- chart->addAxis(axisY3, Qt::AlignRight);
- series->attachAxis(axisX);
- series->attachAxis(axisY3);
- //![4]
-
- //![5]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
- //![5]
-
- //![6]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(800, 600);
- window.show();
- //![6]
-
- return a.exec();
-}
-
diff --git a/examples/percentbarchart/main.cpp b/examples/percentbarchart/main.cpp
deleted file mode 100644
index 649b29ba..00000000
--- a/examples/percentbarchart/main.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QPercentBarSeries>
-#include <QBarSet>
-#include <QLegend>
-#include <QBarCategoryAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QBarSet *set0 = new QBarSet("Jane");
- QBarSet *set1 = new QBarSet("John");
- QBarSet *set2 = new QBarSet("Axel");
- QBarSet *set3 = new QBarSet("Mary");
- QBarSet *set4 = new QBarSet("Samantha");
-
- *set0 << 1 << 2 << 3 << 4 << 5 << 6;
- *set1 << 5 << 0 << 0 << 4 << 0 << 7;
- *set2 << 3 << 5 << 8 << 13 << 8 << 5;
- *set3 << 5 << 6 << 7 << 3 << 4 << 5;
- *set4 << 9 << 7 << 5 << 3 << 1 << 2;
-//![1]
-
-//![2]
- QPercentBarSeries *series = new QPercentBarSeries();
- series->append(set0);
- series->append(set1);
- series->append(set2);
- series->append(set3);
- series->append(set4);
-//![2]
-
-//![3]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Simple percentbarchart example");
- chart->setAnimationOptions(QChart::SeriesAnimations);
-//![3]
-
-//![4]
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- QBarCategoryAxis *axis = new QBarCategoryAxis();
- axis->append(categories);
- chart->createDefaultAxes();
- chart->setAxisX(axis, series);
-//![4]
-
-//![5]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
-//![5]
-
-//![6]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![6]
-
-//![7]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(420, 300);
- window.show();
-//![7]
-
- return a.exec();
-}
-
diff --git a/examples/piechart/main.cpp b/examples/piechart/main.cpp
deleted file mode 100644
index 79a088e0..00000000
--- a/examples/piechart/main.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QPieSeries>
-#include <QPieSlice>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QPieSeries *series = new QPieSeries();
- series->append("Jane", 1);
- series->append("Joe", 2);
- series->append("Andy", 3);
- series->append("Barbara", 4);
- series->append("Axel", 5);
-//![1]
-
-//![2]
- QPieSlice *slice = series->slices().at(1);
- slice->setExploded();
- slice->setLabelVisible();
- slice->setPen(QPen(Qt::darkGreen, 2));
- slice->setBrush(Qt::green);
-//![2]
-
-//![3]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Simple piechart example");
- chart->legend()->hide();
-//![3]
-
-//![4]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![4]
-
-//![5]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
-//![5]
-
- return a.exec();
-}
diff --git a/examples/piechartdrilldown/drilldownchart.cpp b/examples/piechartdrilldown/drilldownchart.cpp
deleted file mode 100644
index 71cd1a06..00000000
--- a/examples/piechartdrilldown/drilldownchart.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "drilldownchart.h"
-#include "drilldownslice.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-DrilldownChart::DrilldownChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QChart(QChart::ChartTypeCartesian, parent, wFlags),
- m_currentSeries(0)
-{
-
-}
-
-DrilldownChart::~DrilldownChart()
-{
-
-}
-
-void DrilldownChart::changeSeries(QAbstractSeries *series)
-{
- // NOTE: if the series is owned by the chart it will be deleted
- // here the "window" owns the series...
- if (m_currentSeries)
- removeSeries(m_currentSeries);
- m_currentSeries = series;
- addSeries(series);
- setTitle(series->name());
-}
-
-void DrilldownChart::handleSliceClicked(QPieSlice *slice)
-{
- DrilldownSlice *drilldownSlice = static_cast<DrilldownSlice *>(slice);
- changeSeries(drilldownSlice->drilldownSeries());
-}
-
-#include "moc_drilldownchart.cpp"
diff --git a/examples/piechartdrilldown/drilldownchart.h b/examples/piechartdrilldown/drilldownchart.h
deleted file mode 100644
index 7e14083f..00000000
--- a/examples/piechartdrilldown/drilldownchart.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef DRILLDOWNCHART_H
-#define DRILLDOWNCHART_H
-
-#include <QChart>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QAbstractSeries;
-class QPieSlice;
-QTCOMMERCIALCHART_END_NAMESPACE
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class DrilldownChart : public QChart
-{
- Q_OBJECT
-public:
- explicit DrilldownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
- ~DrilldownChart();
- void changeSeries(QAbstractSeries *series);
-
-public Q_SLOTS:
- void handleSliceClicked(QPieSlice *slice);
-
-private:
- QAbstractSeries *m_currentSeries;
-};
-
-#endif // DRILLDOWNCHART_H
diff --git a/examples/piechartdrilldown/drilldownslice.cpp b/examples/piechartdrilldown/drilldownslice.cpp
deleted file mode 100644
index a2f8a6cc..00000000
--- a/examples/piechartdrilldown/drilldownslice.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "drilldownslice.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-DrilldownSlice::DrilldownSlice(qreal value, QString prefix, QAbstractSeries *drilldownSeries)
- : m_drilldownSeries(drilldownSeries),
- m_prefix(prefix)
-{
- setValue(value);
- updateLabel();
- setLabelFont(QFont("Arial", 8));
- connect(this, SIGNAL(percentageChanged()), this, SLOT(updateLabel()));
- connect(this, SIGNAL(hovered(bool)), this, SLOT(showHighlight(bool)));
-}
-
-DrilldownSlice::~DrilldownSlice()
-{
-
-}
-
-QAbstractSeries *DrilldownSlice::drilldownSeries() const
-{
- return m_drilldownSeries;
-}
-
-void DrilldownSlice::updateLabel()
-{
- QString label = m_prefix;
- label += " $";
- label += QString::number(this->value());
- label += ", ";
- label += QString::number(this->percentage() * 100, 'f', 1);
- label += "%";
- setLabel(label);
-}
-
-void DrilldownSlice::showHighlight(bool show)
-{
- setLabelVisible(show);
- setExploded(show);
-}
-
-#include "moc_drilldownslice.cpp"
diff --git a/examples/piechartdrilldown/drilldownslice.h b/examples/piechartdrilldown/drilldownslice.h
deleted file mode 100644
index ce9aae55..00000000
--- a/examples/piechartdrilldown/drilldownslice.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef DRILLDOWNSLICE_H
-#define DRILLDOWNSLICE_H
-
-#include <QPieSlice>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QAbstractSeries;
-QTCOMMERCIALCHART_END_NAMESPACE
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class DrilldownSlice : public QPieSlice
-{
- Q_OBJECT
-
-public:
- DrilldownSlice(qreal value, QString prefix, QAbstractSeries *drilldownSeries);
- virtual ~DrilldownSlice();
- QAbstractSeries *drilldownSeries() const;
-
-public Q_SLOTS:
- void updateLabel();
- void showHighlight(bool show);
-
-private:
- QAbstractSeries *m_drilldownSeries;
- QString m_prefix;
-};
-
-#endif // DRILLDOWNSLICE_H
diff --git a/examples/piechartdrilldown/main.cpp b/examples/piechartdrilldown/main.cpp
deleted file mode 100644
index 2fee9b87..00000000
--- a/examples/piechartdrilldown/main.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "drilldownchart.h"
-#include "drilldownslice.h"
-#include <QApplication>
-#include <QMainWindow>
-#include <QTime>
-#include <QChartView>
-#include <QLegend>
-#include <QPieSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
-
- QMainWindow window;
-
- DrilldownChart *chart = new DrilldownChart();
- chart->setTheme(QChart::ChartThemeLight);
- chart->setAnimationOptions(QChart::AllAnimations);
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignRight);
-
- QPieSeries *yearSeries = new QPieSeries(&window);
- yearSeries->setName("Sales by year - All");
-
- QList<QString> months;
- months << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
- QList<QString> names;
- names << "Jane" << "John" << "Axel" << "Mary" << "Susan" << "Bob";
-
- foreach (QString name, names) {
- QPieSeries *series = new QPieSeries(&window);
- series->setName("Sales by month - " + name);
-
- foreach (QString month, months)
- *series << new DrilldownSlice(qrand() % 1000, month, yearSeries);
-
- QObject::connect(series, SIGNAL(clicked(QPieSlice*)), chart, SLOT(handleSliceClicked(QPieSlice*)));
-
- *yearSeries << new DrilldownSlice(series->sum(), name, series);
- }
-
- QObject::connect(yearSeries, SIGNAL(clicked(QPieSlice*)), chart, SLOT(handleSliceClicked(QPieSlice*)));
-
- chart->changeSeries(yearSeries);
-
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
- window.setCentralWidget(chartView);
- window.resize(800, 500);
- window.show();
-
- return a.exec();
-}
diff --git a/examples/polarchart/chartview.cpp b/examples/polarchart/chartview.cpp
deleted file mode 100644
index 311a2ab4..00000000
--- a/examples/polarchart/chartview.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartview.h"
-#include <QMouseEvent>
-#include <QDebug>
-#include <QAbstractAxis>
-#include <QValueAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-ChartView::ChartView(QWidget *parent)
- : QChartView(parent)
-{
-}
-
-//![1]
-void ChartView::keyPressEvent(QKeyEvent *event)
-{
- switch (event->key()) {
- case Qt::Key_Plus:
- chart()->zoomIn();
- break;
- case Qt::Key_Minus:
- chart()->zoomOut();
- break;
- case Qt::Key_Left:
- chart()->scroll(-1.0, 0);
- break;
- case Qt::Key_Right:
- chart()->scroll(1.0, 0);
- break;
- case Qt::Key_Up:
- chart()->scroll(0, 1.0);
- break;
- case Qt::Key_Down:
- chart()->scroll(0, -1.0);
- break;
- case Qt::Key_Space:
- switchChartType();
- break;
- default:
- QGraphicsView::keyPressEvent(event);
- break;
- }
-}
-//![1]
-
-//![2]
-void ChartView::switchChartType()
-{
- QChart *newChart;
- QChart *oldChart = chart();
-
- if (oldChart->chartType() == QChart::ChartTypeCartesian)
- newChart = new QPolarChart();
- else
- newChart = new QChart();
-
- // Move series and axes from old chart to new one
- QList<QAbstractSeries *> seriesList = oldChart->series();
- QList<QAbstractAxis *> axisList = oldChart->axes();
- QList<QPair<qreal, qreal> > axisRanges;
-
- foreach (QAbstractAxis *axis, axisList) {
- QValueAxis *valueAxis = static_cast<QValueAxis *>(axis);
- axisRanges.append(QPair<qreal, qreal>(valueAxis->min(), valueAxis->max()));
- }
-
- foreach (QAbstractSeries *series, seriesList)
- oldChart->removeSeries(series);
-
- foreach (QAbstractAxis *axis, axisList) {
- oldChart->removeAxis(axis);
- newChart->addAxis(axis, axis->alignment());
- }
-
- foreach (QAbstractSeries *series, seriesList) {
- newChart->addSeries(series);
- foreach (QAbstractAxis *axis, axisList)
- series->attachAxis(axis);
- }
-
- int count = 0;
- foreach (QAbstractAxis *axis, axisList) {
- axis->setRange(axisRanges[count].first, axisRanges[count].second);
- count++;
- }
-
- newChart->setTitle(oldChart->title());
- setChart(newChart);
- delete oldChart;
-}
-//![2]
diff --git a/examples/polarchart/chartview.h b/examples/polarchart/chartview.h
deleted file mode 100644
index d968358b..00000000
--- a/examples/polarchart/chartview.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHARTVIEW_H
-#define CHARTVIEW_H
-
-#include <QChartView>
-#include <QPolarChart>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class ChartView : public QChartView
-{
-public:
- ChartView(QWidget *parent = 0);
-
-protected:
- void keyPressEvent(QKeyEvent *event);
-
-private:
- void switchChartType();
-};
-
-#endif
diff --git a/examples/polarchart/main.cpp b/examples/polarchart/main.cpp
deleted file mode 100644
index f4516ac4..00000000
--- a/examples/polarchart/main.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartview.h"
-#include <QApplication>
-#include <QMainWindow>
-#include <QScatterSeries>
-#include <QLineSeries>
-#include <QSplineSeries>
-#include <QAreaSeries>
-#include <QValueAxis>
-#include <QPolarChart>
-#include <QDebug>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- const qreal angularMin = -100;
- const qreal angularMax = 100;
-
- const qreal radialMin = -100;
- const qreal radialMax = 100;
-
- QScatterSeries *series1 = new QScatterSeries();
- series1->setName("scatter");
- for (int i = angularMin; i <= angularMax; i += 10)
- series1->append(i, (i / radialMax) * radialMax + 8.0);
-
- QSplineSeries *series2 = new QSplineSeries();
- series2->setName("spline");
- for (int i = angularMin; i <= angularMax; i += 10)
- series2->append(i, (i / radialMax) * radialMax);
-
- QLineSeries *series3 = new QLineSeries();
- series3->setName("star outer");
- qreal ad = (angularMax - angularMin) / 8;
- qreal rd = (radialMax - radialMin) / 3 * 1.3;
- series3->append(angularMin, radialMax);
- series3->append(angularMin + ad*1, radialMin + rd);
- series3->append(angularMin + ad*2, radialMax);
- series3->append(angularMin + ad*3, radialMin + rd);
- series3->append(angularMin + ad*4, radialMax);
- series3->append(angularMin + ad*5, radialMin + rd);
- series3->append(angularMin + ad*6, radialMax);
- series3->append(angularMin + ad*7, radialMin + rd);
- series3->append(angularMin + ad*8, radialMax);
-
- QLineSeries *series4 = new QLineSeries();
- series4->setName("star inner");
- ad = (angularMax - angularMin) / 8;
- rd = (radialMax - radialMin) / 3;
- series4->append(angularMin, radialMax);
- series4->append(angularMin + ad*1, radialMin + rd);
- series4->append(angularMin + ad*2, radialMax);
- series4->append(angularMin + ad*3, radialMin + rd);
- series4->append(angularMin + ad*4, radialMax);
- series4->append(angularMin + ad*5, radialMin + rd);
- series4->append(angularMin + ad*6, radialMax);
- series4->append(angularMin + ad*7, radialMin + rd);
- series4->append(angularMin + ad*8, radialMax);
-
- QAreaSeries *series5 = new QAreaSeries();
- series5->setName("star area");
- series5->setUpperSeries(series3);
- series5->setLowerSeries(series4);
- series5->setOpacity(0.5);
-
- //![1]
- QPolarChart *chart = new QPolarChart();
- //![1]
- chart->addSeries(series1);
- chart->addSeries(series2);
- chart->addSeries(series3);
- chart->addSeries(series4);
- chart->addSeries(series5);
-
- chart->setTitle("Use arrow keys to scroll, +/- to zoom, and space to switch chart type.");
-
- //![2]
- QValueAxis *angularAxis = new QValueAxis();
- angularAxis->setTickCount(9); // First and last ticks are co-located on 0/360 angle.
- angularAxis->setLabelFormat("%.1f");
- angularAxis->setShadesVisible(true);
- angularAxis->setShadesBrush(QBrush(QColor(249, 249, 255)));
- chart->addAxis(angularAxis, QPolarChart::PolarOrientationAngular);
-
- QValueAxis *radialAxis = new QValueAxis();
- radialAxis->setTickCount(9);
- radialAxis->setLabelFormat("%d");
- chart->addAxis(radialAxis, QPolarChart::PolarOrientationRadial);
- //![2]
-
- series1->attachAxis(radialAxis);
- series1->attachAxis(angularAxis);
- series2->attachAxis(radialAxis);
- series2->attachAxis(angularAxis);
- series3->attachAxis(radialAxis);
- series3->attachAxis(angularAxis);
- series4->attachAxis(radialAxis);
- series4->attachAxis(angularAxis);
- series5->attachAxis(radialAxis);
- series5->attachAxis(angularAxis);
-
- radialAxis->setRange(radialMin, radialMax);
- angularAxis->setRange(angularMin, angularMax);
-
- ChartView *chartView = new ChartView();
- chartView->setChart(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(800, 600);
- window.show();
-
- return a.exec();
-}
diff --git a/examples/qmlboxplot/main.cpp b/examples/qmlboxplot/main.cpp
deleted file mode 100644
index 0ba758b4..00000000
--- a/examples/qmlboxplot/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
-
- // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmlboxplot/main.qml"));
- viewer->setRenderHint(QPainter::Antialiasing, true);
- viewer->showExpanded();
-
- return app->exec();
-}
diff --git a/examples/qmlboxplot/qml/qmlboxplot/main.qml b/examples/qmlboxplot/qml/qmlboxplot/main.qml
deleted file mode 100644
index 11d927a6..00000000
--- a/examples/qmlboxplot/qml/qmlboxplot/main.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import QtCommercial.Chart 1.3
-
-ChartView {
- title: "Box Plot series"
- width: 400
- height: 300
- theme: ChartView.ChartThemeBrownSand
- legend.alignment: Qt.AlignBottom
-
- BoxPlotSeries {
- id: plotSeries
- name: "Income"
- BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] }
- BoxSet { label: "Feb"; values: [5, 6, 7.5, 8.6, 11.8] }
- BoxSet { label: "Mar"; values: [3.2, 5, 5.7, 8, 9.2] }
- BoxSet { label: "Apr"; values: [3.8, 5, 6.4, 7, 8] }
- BoxSet { label: "May"; values: [4, 5, 5.2, 6, 7] }
- }
-}
diff --git a/examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.h b/examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/examples/qmlboxplot/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/examples/qmlboxplot/qmlboxplot.pro b/examples/qmlboxplot/qmlboxplot.pro
deleted file mode 100644
index 194aef38..00000000
--- a/examples/qmlboxplot/qmlboxplot.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
-
-OTHER_FILES += \
- qml/qmlboxplot/main.qml
diff --git a/examples/qmlpiechart/main.cpp b/examples/qmlpiechart/main.cpp
deleted file mode 100644
index b12a10b2..00000000
--- a/examples/qmlpiechart/main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtDeclarative/QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
-
-Q_DECL_EXPORT int main(int argc, char *argv[])
-{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
-
- // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmlpiechart/main.qml"));
- viewer->setRenderHint(QPainter::Antialiasing, true);
- viewer->showExpanded();
-
- return app->exec();
-}
diff --git a/examples/qmlpiechart/qml/qmlpiechart/main.qml b/examples/qmlpiechart/qml/qmlpiechart/main.qml
deleted file mode 100644
index 77f4472e..00000000
--- a/examples/qmlpiechart/qml/qmlpiechart/main.qml
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//![1]
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
-
-ChartView {
- width: 400
- height: 300
- theme: ChartView.ChartThemeBrownSand
-
-//![1]
-//![2]
- PieSeries {
- id: pieSeries
- PieSlice { label: "eaten"; value: 94.9 }
- PieSlice { label: "not yet eaten"; value: 5.1 }
- }
-//![2]
-
- Component.onCompleted: {
- if (false) {
- //![4]
- pieSeries.append("don't care", 1.1);
- //![4]
-
- //![5]
- pieSeries.at(0).exploded = true;
- //![5]
- }
- }
-
-//![3]
-}
-//![3]
diff --git a/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.h b/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/examples/qmlpiechart/qmlpiechart.pro b/examples/qmlpiechart/qmlpiechart.pro
deleted file mode 100644
index b771d8dd..00000000
--- a/examples/qmlpiechart/qmlpiechart.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/qmlpiechart/*
-
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/examples/scatterchart/chartview.h b/examples/scatterchart/chartview.h
deleted file mode 100644
index 699100ff..00000000
--- a/examples/scatterchart/chartview.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHARTVIEW_H
-#define CHARTVIEW_H
-
-#include <QChartView>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class ChartView : public QChartView
-{
- Q_OBJECT
-public:
- explicit ChartView(QWidget *parent = 0);
-};
-
-#endif // CHARTVIEW_H
diff --git a/examples/scatterchart/main.cpp b/examples/scatterchart/main.cpp
deleted file mode 100644
index 43d5e4c6..00000000
--- a/examples/scatterchart/main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include "chartview.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![4]
- ChartView *chartView = new ChartView();
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
-//![4]
-
- return a.exec();
-}
diff --git a/examples/scatterinteractions/chartview.cpp b/examples/scatterinteractions/chartview.cpp
deleted file mode 100644
index e7ccd5c4..00000000
--- a/examples/scatterinteractions/chartview.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartview.h"
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-ChartView::ChartView(QWidget *parent)
- : QChartView(new QChart(), parent),
- m_scatter(0),
- m_scatter2(0)
-{
- setRenderHint(QPainter::Antialiasing);
-
- chart()->setTitle("Click to interact with scatter points");
-
- m_scatter = new QScatterSeries();
- m_scatter->setName("scatter1");
- for (qreal x(0.5); x <= 4.0; x += 0.5) {
- for (qreal y(0.5); y <= 4.0; y += 0.5) {
- *m_scatter << QPointF(x, y);
- }
- }
- m_scatter2 = new QScatterSeries();
- m_scatter2->setName("scatter2");
-
- chart()->addSeries(m_scatter2);
- chart()->addSeries(m_scatter);
- chart()->createDefaultAxes();
- chart()->axisX()->setRange(0, 4.5);
- chart()->axisY()->setRange(0, 4.5);
-
- connect(m_scatter, SIGNAL(clicked(QPointF)), this, SLOT(handleClickedPoint(QPointF)));
-}
-
-ChartView::~ChartView()
-{
-}
-
-void ChartView::handleClickedPoint(const QPointF &point)
-{
- QPointF clickedPoint = point;
- // Find the closest point from series 1
- QPointF closest(INT_MAX, INT_MAX);
- qreal distance(INT_MAX);
- foreach (QPointF currentPoint, m_scatter->points()) {
- qreal currentDistance = qSqrt((currentPoint.x() - clickedPoint.x())
- * (currentPoint.x() - clickedPoint.x())
- + (currentPoint.y() - clickedPoint.y())
- * (currentPoint.y() - clickedPoint.y()));
- if (currentDistance < distance) {
- distance = currentDistance;
- closest = currentPoint;
- }
- }
-
- // Remove the closes point from series 1 and append it to series 2
- m_scatter->remove(closest);
- m_scatter2->append(closest);
-}
diff --git a/examples/scatterinteractions/chartview.h b/examples/scatterinteractions/chartview.h
deleted file mode 100644
index d84ec6f5..00000000
--- a/examples/scatterinteractions/chartview.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHARTVIEW_H
-#define CHARTVIEW_H
-
-#include <QChartGlobal>
-#include <QChartView>
-#include <QScatterSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-class ChartView : public QChartView
-{
- Q_OBJECT
-
-public:
- ChartView(QWidget *parent = 0);
- ~ChartView();
-
-private Q_SLOTS:
- void handleClickedPoint(const QPointF &point);
-
-private:
- QScatterSeries *m_scatter;
- QScatterSeries *m_scatter2;
-};
-
-#endif // CHARTVIEW_H
diff --git a/examples/splinechart/main.cpp b/examples/splinechart/main.cpp
deleted file mode 100644
index bb4c28d6..00000000
--- a/examples/splinechart/main.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QSplineSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
- //![1]
- QSplineSeries *series = new QSplineSeries();
- series->setName("spline");
- //![1]
-
- //![2]
- series->append(0, 6);
- series->append(2, 4);
- series->append(3, 8);
- series->append(7, 4);
- series->append(10, 5);
- *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
- //![2]
-
- //![3]
- QChart *chart = new QChart();
- chart->legend()->hide();
- chart->addSeries(series);
- chart->setTitle("Simple spline chart example");
- chart->createDefaultAxes();
- chart->axisY()->setRange(0, 10);
- //![3]
-
- //![4]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
- //![4]
-
- //![5]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
- //![5]
-
- return a.exec();
-}
diff --git a/examples/stackedbarchart/main.cpp b/examples/stackedbarchart/main.cpp
deleted file mode 100644
index 3e83c39b..00000000
--- a/examples/stackedbarchart/main.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QStackedBarSeries>
-#include <QBarSet>
-#include <QLegend>
-#include <QBarCategoryAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QBarSet *set0 = new QBarSet("Jane");
- QBarSet *set1 = new QBarSet("John");
- QBarSet *set2 = new QBarSet("Axel");
- QBarSet *set3 = new QBarSet("Mary");
- QBarSet *set4 = new QBarSet("Samantha");
-
- *set0 << 1 << 2 << 3 << 4 << 5 << 6;
- *set1 << 5 << 0 << 0 << 4 << 0 << 7;
- *set2 << 3 << 5 << 8 << 13 << 8 << 5;
- *set3 << 5 << 6 << 7 << 3 << 4 << 5;
- *set4 << 9 << 7 << 5 << 3 << 1 << 2;
-//![1]
-
-//![2]
- QStackedBarSeries *series = new QStackedBarSeries();
- series->append(set0);
- series->append(set1);
- series->append(set2);
- series->append(set3);
- series->append(set4);
-//![2]
-
-//![3]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Simple stackedbarchart example");
- chart->setAnimationOptions(QChart::SeriesAnimations);
-//![3]
-
-//![4]
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- QBarCategoryAxis *axis = new QBarCategoryAxis();
- axis->append(categories);
- chart->createDefaultAxes();
- chart->setAxisX(axis, series);
-//![4]
-
-//![5]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
-//![5]
-
-//![6]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![6]
-
-//![7]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(420, 300);
- window.show();
-//![7]
-
- return a.exec();
-}
-
diff --git a/examples/stackedbarchartdrilldown/drilldownchart.cpp b/examples/stackedbarchartdrilldown/drilldownchart.cpp
deleted file mode 100644
index 1dd3df57..00000000
--- a/examples/stackedbarchartdrilldown/drilldownchart.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "drilldownchart.h"
-#include <QBarCategoryAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-DrilldownChart::DrilldownChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QChart(QChart::ChartTypeCartesian, parent, wFlags),
- m_currentSeries(0)
-{
-}
-
-void DrilldownChart::changeSeries(DrilldownBarSeries *series)
-{
- if (m_currentSeries) {
- removeSeries(m_currentSeries);
- }
-
- m_currentSeries = series;
-
- // Reset axis
- QBarCategoryAxis *axis = new QBarCategoryAxis();
- axis->append(m_currentSeries->categories());
-
- addSeries(series);
-
- createDefaultAxes();
- setAxisX(axis, series);
- axisY()->setTitleText("Crops");
-
- setTitle(series->name());
-}
-
-void DrilldownChart::handleClicked(int index, QBarSet *barset)
-{
- Q_UNUSED(barset)
- DrilldownBarSeries *series = static_cast<DrilldownBarSeries *>(sender());
- changeSeries(series->drilldownSeries(index));
-}
-
-#include "moc_drilldownchart.cpp"
diff --git a/examples/stackedbarchartdrilldown/drilldownchart.h b/examples/stackedbarchartdrilldown/drilldownchart.h
deleted file mode 100644
index 1eb7ead0..00000000
--- a/examples/stackedbarchartdrilldown/drilldownchart.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DRILLDOWNCHART_H
-#define DRILLDOWNCHART_H
-
-#include <QChart>
-#include "drilldownseries.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-//! [1]
-class DrilldownChart : public QChart
-{
- Q_OBJECT
-public:
- explicit DrilldownChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
-
- void changeSeries(DrilldownBarSeries *series);
-
-public Q_SLOTS:
- void handleClicked(int index, QBarSet *barset);
-
-private:
- DrilldownBarSeries *m_currentSeries;
-};
-//! [1]
-
-#endif // DRILLDOWNCHART_H
diff --git a/examples/stackedbarchartdrilldown/drilldownseries.cpp b/examples/stackedbarchartdrilldown/drilldownseries.cpp
deleted file mode 100644
index 2f3c2fb3..00000000
--- a/examples/stackedbarchartdrilldown/drilldownseries.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "drilldownseries.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-DrilldownBarSeries::DrilldownBarSeries(QStringList categories, QObject *parent)
- : QStackedBarSeries(parent)
-{
- m_categories = categories;
-}
-
-void DrilldownBarSeries::mapDrilldownSeries(int index, DrilldownBarSeries *drilldownSeries)
-{
- m_DrilldownSeries[index] = drilldownSeries;
-}
-
-DrilldownBarSeries *DrilldownBarSeries::drilldownSeries(int index)
-{
- return m_DrilldownSeries[index];
-}
-
-QStringList DrilldownBarSeries::categories()
-{
- return m_categories;
-}
-
-#include "moc_drilldownseries.cpp"
diff --git a/examples/stackedbarchartdrilldown/drilldownseries.h b/examples/stackedbarchartdrilldown/drilldownseries.h
deleted file mode 100644
index a9c86ad5..00000000
--- a/examples/stackedbarchartdrilldown/drilldownseries.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DRILLDOWNSERIES_H
-#define DRILLDOWNSERIES_H
-
-#include <QStackedBarSeries>
-#include <QMap>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-//! [1]
-class DrilldownBarSeries : public QStackedBarSeries
-{
- Q_OBJECT
-public:
- DrilldownBarSeries(QStringList categories, QObject *parent = 0);
-
- void mapDrilldownSeries(int index, DrilldownBarSeries *drilldownSeries);
-
- DrilldownBarSeries *drilldownSeries(int index);
-
- QStringList categories();
-
-private:
- QMap<int, DrilldownBarSeries *> m_DrilldownSeries;
- QStringList m_categories;
-};
-//! [1]
-
-#endif // DRILLDOWNSERIES_H
diff --git a/examples/stackedbarchartdrilldown/main.cpp b/examples/stackedbarchartdrilldown/main.cpp
deleted file mode 100644
index 2673ab32..00000000
--- a/examples/stackedbarchartdrilldown/main.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QBarSet>
-#include <QLegend>
-#include "drilldownseries.h"
-#include "drilldownchart.h"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
- QMainWindow window;
-
-//! [1]
- DrilldownChart *drilldownChart = new DrilldownChart();
- drilldownChart->setTheme(QChart::ChartThemeBlueIcy);
- drilldownChart->setAnimationOptions(QChart::SeriesAnimations);
-//! [1]
-
-//! [2]
- // Define categories
- QStringList months;
- months << "May" << "Jun" << "Jul" << "Aug" << "Sep";
- QStringList weeks;
- weeks << "week 1" << "week 2" << "week 3" << "week 4";
- QStringList plants;
- plants << "Habanero" << "Lemon Drop" << "Starfish" << "Aji Amarillo";
-//! [2]
-
-//! [3]
- // Create drilldown structure
- DrilldownBarSeries *seasonSeries = new DrilldownBarSeries(months, drilldownChart);
- seasonSeries->setName("Crop by month - Season");
-
- // Each month in season series has drilldown series for weekly data
- for (int month = 0; month < months.count(); month++) {
-
- // Create drilldown series for every week
- DrilldownBarSeries *weeklySeries = new DrilldownBarSeries(weeks, drilldownChart);
- seasonSeries->mapDrilldownSeries(month, weeklySeries);
-
- // Drilling down from weekly data brings us back to season data.
- for (int week = 0; week < weeks.count(); week++) {
- weeklySeries->mapDrilldownSeries(week, seasonSeries);
- weeklySeries->setName(QString("Crop by week - " + months.at(month)));
- }
-
- // Use clicked signal to implement drilldown
- QObject::connect(weeklySeries, SIGNAL(clicked(int,QBarSet*)), drilldownChart, SLOT(handleClicked(int,QBarSet*)));
- }
-
- // Enable drilldown from season series using clicked signal
- QObject::connect(seasonSeries, SIGNAL(clicked(int,QBarSet*)), drilldownChart, SLOT(handleClicked(int,QBarSet*)));
-//! [3]
-
-//! [4]
- // Fill monthly and weekly series with data
- foreach (QString plant, plants) {
- QBarSet *monthlyCrop = new QBarSet(plant);
- for (int month = 0; month < months.count(); month++) {
- QBarSet *weeklyCrop = new QBarSet(plant);
- for (int week = 0; week < weeks.count(); week++)
- *weeklyCrop << (qrand() % 20);
- // Get the drilldown series from season series and add crop to it.
- seasonSeries->drilldownSeries(month)->append(weeklyCrop);
- *monthlyCrop << weeklyCrop->sum();
- }
- seasonSeries->append(monthlyCrop);
- }
-//! [4]
-
-//! [5]
- // Show season series in initial view
- drilldownChart->changeSeries(seasonSeries);
- drilldownChart->setTitle(seasonSeries->name());
-//! [5]
-
-//! [6]
- drilldownChart->axisX()->setGridLineVisible(false);
- drilldownChart->legend()->setVisible(true);
- drilldownChart->legend()->setAlignment(Qt::AlignBottom);
-//! [6]
-
- QChartView *chartView = new QChartView(drilldownChart);
- window.setCentralWidget(chartView);
- window.resize(480, 300);
- window.show();
-
- return a.exec();
-}
-
diff --git a/examples/temperaturerecords/main.cpp b/examples/temperaturerecords/main.cpp
deleted file mode 100644
index 97ddfde5..00000000
--- a/examples/temperaturerecords/main.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QBarSeries>
-#include <QBarSet>
-#include <QLegend>
-#include <QBarCategoryAxis>
-#include <QStackedBarSeries>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QBarSet *low = new QBarSet("Min");
- QBarSet *high = new QBarSet("Max");
-
- *low << -52 << -50 << -45.3 << -37.0 << -25.6 << -8.0 << -6.0 << -11.8 << -19.7 << -32.8 << -43.0 << -48.0;
- *high << 11.9 << 12.8 << 18.5 << 26.5 << 32.0 << 34.8 << 38.2 << 34.8 << 29.8 << 20.4 << 15.1 << 11.8;
-//![1]
-
-//![2]
- QStackedBarSeries *series = new QStackedBarSeries();
- series->append(low);
- series->append(high);
-//![2]
-
-//![3]
- QChart *chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Temperature records in celcius");
- chart->setAnimationOptions(QChart::SeriesAnimations);
-//![3]
-
-//![4]
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
-
- QBarCategoryAxis *axis = new QBarCategoryAxis();
- axis->append(categories);
- axis->setTitleText("Month");
- chart->createDefaultAxes();
- chart->setAxisX(axis, series);
- chart->axisY(series)->setRange(-52, 52);
- chart->axisY(series)->setTitleText("Temperature [&deg;C]");
-//![4]
-
-//![5]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
-//![5]
-
-//![6]
- QChartView *chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![6]
-
-//![7]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(600, 300);
- window.show();
-//![7]
-
- return a.exec();
-}
diff --git a/examples/zoomlinechart/chart.h b/examples/zoomlinechart/chart.h
deleted file mode 100644
index 4dea7c79..00000000
--- a/examples/zoomlinechart/chart.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHART_H
-#define CHART_H
-
-#include <QChart>
-
-class QGestureEvent;
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-//![1]
-class Chart : public QChart
-//![1]
-{
-public:
- explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
- ~Chart();
-
-protected:
- bool sceneEvent(QEvent *event);
-
-private:
- bool gestureEvent(QGestureEvent *event);
-
-private:
-
-};
-
-#endif // CHART_H
diff --git a/examples/zoomlinechart/chartview.h b/examples/zoomlinechart/chartview.h
deleted file mode 100644
index 911a4de4..00000000
--- a/examples/zoomlinechart/chartview.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHARTVIEW_H
-#define CHARTVIEW_H
-
-#include <QChartView>
-#include <QRubberBand>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-//![1]
-class ChartView : public QChartView
-//![1]
-{
-public:
- ChartView(QChart *chart, QWidget *parent = 0);
-
-//![2]
-protected:
- bool viewportEvent(QEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void keyPressEvent(QKeyEvent *event);
-//![2]
-
-private:
- bool m_isTouching;
-};
-
-#endif
diff --git a/examples/zoomlinechart/main.cpp b/examples/zoomlinechart/main.cpp
deleted file mode 100644
index 5569c0c9..00000000
--- a/examples/zoomlinechart/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chart.h"
-#include "chartview.h"
-#include <QApplication>
-#include <QMainWindow>
-#include <qmath.h>
-#include <QLineSeries>
-#include <QValueAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QLineSeries *series = new QLineSeries();
- for (int i = 0; i < 500; i++) {
- QPointF p((qreal) i, qSin(M_PI / 50 * i) * 100);
- p.ry() += qrand() % 20;
- *series << p;
- }
-//![1]
-
- Chart *chart = new Chart();
- chart->addSeries(series);
- chart->setTitle("Zoom in/out example");
- chart->setAnimationOptions(QChart::SeriesAnimations);
- chart->legend()->hide();
- chart->createDefaultAxes();
-
- ChartView *chartView = new ChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.grabGesture(Qt::PanGesture);
- window.grabGesture(Qt::PinchGesture);
- window.show();
-
- return a.exec();
-}
diff --git a/features/qtcommercialchart.prf b/features/qtcommercialchart.prf
deleted file mode 100644
index 87599367..00000000
--- a/features/qtcommercialchart.prf
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtCommercialChart
-LIBRARY_NAME = QtCommercialChart
-ios:CONFIG(iphonesimulator, iphonesimulator|iphoneos):LIBRARY_NAME = $$join(LIBRARY_NAME,,,_iphonesimulator)
-CONFIG(debug, debug|release) {
- mac: LIBRARY_NAME = $$join(LIBRARY_NAME,,,_debug)
- win32: LIBRARY_NAME = $$join(LIBRARY_NAME,,,d)
-}
-
-LIBS += -l$$LIBRARY_NAME
diff --git a/plugins/declarative/declarative.pri b/plugins/declarative/declarative.pri
deleted file mode 100644
index e652c7c4..00000000
--- a/plugins/declarative/declarative.pri
+++ /dev/null
@@ -1,60 +0,0 @@
-!include( ../plugins.pri ) {
- error( "Couldn't find the plugins.pri file!" )
-}
-
-contains(DEFINES, CHARTS_FOR_QUICK2) {
- DESTDIR = $$CHART_BUILD_QML2_PLUGIN_DIR
-} else {
- DESTDIR = $$CHART_BUILD_QML_PLUGIN_DIR
-}
-
-INCLUDEPATH += $$CHART_BUILD_PRIVATE_HEADER_DIR
-ios:CONFIG(iphonesimulator, iphonesimulator|iphoneos):TARGET = $$join(TARGET,,,_iphonesimulator)
-CONFIG(debug, debug|release) {
- mac: TARGET = $$join(TARGET,,,_debug)
- win32: TARGET = $$join(TARGET,,,d)
-}
-
-SOURCES += \
- ../declarative/plugin.cpp \
- ../declarative/declarativechart.cpp \
- ../declarative/declarativexypoint.cpp \
- ../declarative/declarativexyseries.cpp \
- ../declarative/declarativelineseries.cpp \
- ../declarative/declarativesplineseries.cpp \
- ../declarative/declarativeareaseries.cpp \
- ../declarative/declarativescatterseries.cpp \
- ../declarative/declarativepieseries.cpp \
- ../declarative/declarativebarseries.cpp \
- ../declarative/declarativecategoryaxis.cpp \
- ../declarative/declarativemargins.cpp \
- ../declarative/declarativeaxes.cpp \
- ../declarative/declarativepolarchart.cpp \
- ../declarative/declarativeboxplotseries.cpp
-
-HEADERS += \
- ../declarative/declarativechart.h \
- ../declarative/declarativexypoint.h \
- ../declarative/declarativexyseries.h \
- ../declarative/declarativelineseries.h \
- ../declarative/declarativesplineseries.h \
- ../declarative/declarativeareaseries.h \
- ../declarative/declarativescatterseries.h \
- ../declarative/declarativepieseries.h \
- ../declarative/declarativebarseries.h \
- ../declarative/declarativecategoryaxis.h \
- ../declarative/declarativemargins.h \
- ../declarative/declarativeaxes.h \
- ../declarative/declarativepolarchart.h \
- ../declarative/shared_defines.h \
- ../declarative/declarativeboxplotseries.h
-
-TARGETPATH = QtCommercial/Chart
-target.path = $$IMPORT_INSTALL_PATH/$$TARGETPATH
-qmldir.files += $$_PRO_FILE_PWD_/qmldir
-qmldir.path += $$IMPORT_INSTALL_PATH/$$TARGETPATH
-INSTALLS += target qmldir
-
-QMLDIR_FILE = $$_PRO_FILE_PWD_/qmldir
-contains(QMAKE_HOST.os, Windows): QMLDIR_FILE = $$replace(QMLDIR_FILE, "/","\\")
-QMAKE_POST_LINK += $$QMAKE_COPY $$QMLDIR_FILE $$DESTDIR
diff --git a/plugins/declarative/declarativeareaseries.cpp b/plugins/declarative/declarativeareaseries.cpp
deleted file mode 100644
index 206550c2..00000000
--- a/plugins/declarative/declarativeareaseries.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativeareaseries.h"
-#include "declarativelineseries.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
- QAreaSeries(parent),
- m_axes(new DeclarativeAxes(this))
-{
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
- connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
-}
-
-void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries *series)
-{
- QAreaSeries::setUpperSeries(series);
-}
-
-DeclarativeLineSeries *DeclarativeAreaSeries::upperSeries() const
-{
- return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries());
-}
-
-void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries *series)
-{
- QAreaSeries::setLowerSeries(series);
-}
-
-DeclarativeLineSeries *DeclarativeAreaSeries::lowerSeries() const
-{
- return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
-}
-
-qreal DeclarativeAreaSeries::borderWidth() const
-{
- return pen().widthF();
-}
-
-void DeclarativeAreaSeries::setBorderWidth(qreal width)
-{
- if (width != pen().widthF()) {
- QPen p = pen();
- p.setWidthF(width);
- setPen(p);
- emit borderWidthChanged(width);
- }
-}
-
-QString DeclarativeAreaSeries::brushFilename() const
-{
- return m_brushFilename;
-}
-
-void DeclarativeAreaSeries::setBrushFilename(const QString &brushFilename)
-{
- QImage brushImage(brushFilename);
- if (QAreaSeries::brush().textureImage() != brushImage) {
- QBrush brush = QAreaSeries::brush();
- brush.setTextureImage(brushImage);
- QAreaSeries::setBrush(brush);
- m_brushFilename = brushFilename;
- m_brushImage = brushImage;
- emit brushFilenameChanged(brushFilename);
- }
-}
-
-void DeclarativeAreaSeries::handleBrushChanged()
-{
- // If the texture image of the brush has changed along the brush
- // the brush file name needs to be cleared.
- if (!m_brushFilename.isEmpty() && QAreaSeries::brush().textureImage() != m_brushImage) {
- m_brushFilename.clear();
- emit brushFilenameChanged(QString(""));
- }
-}
-
-void DeclarativeAreaSeries::setBrush(const QBrush &brush)
-{
- QAreaSeries::setBrush(brush);
- emit brushChanged();
-}
-
-QBrush DeclarativeAreaSeries::brush() const
-{
- return QAreaSeries::brush();
-}
-
-#include "moc_declarativeareaseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativeareaseries.h b/plugins/declarative/declarativeareaseries.h
deleted file mode 100644
index fd638ae6..00000000
--- a/plugins/declarative/declarativeareaseries.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVEAREASERIES_H
-#define DECLARATIVEAREASERIES_H
-
-#include "qareaseries.h"
-#include "declarativeaxes.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class DeclarativeLineSeries;
-
-class DeclarativeAreaSeries : public QAreaSeries
-{
- Q_OBJECT
- Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
- Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
- Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
- Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
- Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4)
-
-public:
- explicit DeclarativeAreaSeries(QObject *parent = 0);
- void setUpperSeries(DeclarativeLineSeries *series);
- DeclarativeLineSeries *upperSeries() const;
- void setLowerSeries(DeclarativeLineSeries *series);
- DeclarativeLineSeries *lowerSeries() const;
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
- Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
- Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- qreal borderWidth() const;
- void setBorderWidth(qreal borderWidth);
- QString brushFilename() const;
- void setBrushFilename(const QString &brushFilename);
- void setBrush(const QBrush &brush);
- QBrush brush() const;
-
-Q_SIGNALS:
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(1) void borderWidthChanged(qreal width);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
- Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
- Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
- Q_REVISION(4) void brushChanged();
- Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename);
-
-private Q_SLOTS:
- void handleBrushChanged();
-
-public:
- DeclarativeAxes *m_axes;
-
-private:
- QString m_brushFilename;
- QImage m_brushImage;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVEAREASERIES_H
diff --git a/plugins/declarative/declarativeaxes.cpp b/plugins/declarative/declarativeaxes.cpp
deleted file mode 100644
index b7319274..00000000
--- a/plugins/declarative/declarativeaxes.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativeaxes.h"
-#include "qabstractaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-DeclarativeAxes::DeclarativeAxes(QObject *parent) :
- QObject(parent),
- m_axisX(0),
- m_axisY(0),
- m_axisXTop(0),
- m_axisYRight(0)
-{
-}
-
-void DeclarativeAxes::setAxisX(QAbstractAxis *axis)
-{
- m_axisX = axis;
- emit axisXChanged(axis);
-}
-
-void DeclarativeAxes::setAxisY(QAbstractAxis *axis)
-{
- m_axisY = axis;
- emit axisYChanged(axis);
-}
-
-void DeclarativeAxes::setAxisXTop(QAbstractAxis *axis)
-{
- m_axisXTop = axis;
- emit axisXTopChanged(axis);
-}
-
-void DeclarativeAxes::setAxisYRight(QAbstractAxis *axis)
-{
- m_axisYRight = axis;
- emit axisYRightChanged(axis);
-}
-
-#include "moc_declarativeaxes.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativeaxes.h b/plugins/declarative/declarativeaxes.h
deleted file mode 100644
index d7ebbb52..00000000
--- a/plugins/declarative/declarativeaxes.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVEAXES_H
-#define DECLARATIVEAXES_H
-
-#include "qchartglobal.h"
-#include <QObject>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractAxis;
-
-class DeclarativeAxes : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged)
-
-public:
- explicit DeclarativeAxes(QObject *parent = 0);
-
- QAbstractAxis *axisX() { return m_axisX; }
- void setAxisX(QAbstractAxis *axis);
- QAbstractAxis *axisY() { return m_axisY; }
- void setAxisY(QAbstractAxis *axis);
- QAbstractAxis *axisXTop() { return m_axisXTop; }
- void setAxisXTop(QAbstractAxis *axis);
- QAbstractAxis *axisYRight() { return m_axisYRight; }
- void setAxisYRight(QAbstractAxis *axis);
-
-public:
- void emitAxisXChanged() { emit axisXChanged(m_axisX); }
- void emitAxisYChanged() { emit axisYChanged(m_axisY); }
- void emitAxisXTopChanged() { emit axisXTopChanged(m_axisXTop); }
- void emitAxisYRightChanged() { emit axisYRightChanged(m_axisYRight); }
-
-signals:
- void axisXChanged(QAbstractAxis *axis);
- void axisYChanged(QAbstractAxis *axis);
- void axisXTopChanged(QAbstractAxis *axis);
- void axisYRightChanged(QAbstractAxis *axis);
-
-private:
- QAbstractAxis *m_axisX;
- QAbstractAxis *m_axisY;
- QAbstractAxis *m_axisXTop;
- QAbstractAxis *m_axisYRight;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVEAXES_H
diff --git a/plugins/declarative/declarativebarseries.cpp b/plugins/declarative/declarativebarseries.cpp
deleted file mode 100644
index 1e734bb6..00000000
--- a/plugins/declarative/declarativebarseries.cpp
+++ /dev/null
@@ -1,509 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativebarseries.h"
-#include "qbarset.h"
-#include "qvbarmodelmapper.h"
-#include "qhbarmodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-DeclarativeBarSet::DeclarativeBarSet(QObject *parent)
- : QBarSet("", parent)
-{
- connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int,int)));
- connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int,int)));
- connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
-}
-
-void DeclarativeBarSet::handleCountChanged(int index, int count)
-{
- Q_UNUSED(index)
- Q_UNUSED(count)
- emit countChanged(QBarSet::count());
-}
-
-qreal DeclarativeBarSet::borderWidth() const
-{
- return pen().widthF();
-}
-
-void DeclarativeBarSet::setBorderWidth(qreal width)
-{
- if (width != pen().widthF()) {
- QPen p = pen();
- p.setWidthF(width);
- setPen(p);
- emit borderWidthChanged(width);
- }
-}
-
-QVariantList DeclarativeBarSet::values()
-{
- QVariantList values;
- for (int i(0); i < count(); i++)
- values.append(QVariant(QBarSet::at(i)));
- return values;
-}
-
-void DeclarativeBarSet::setValues(QVariantList values)
-{
- while (count())
- remove(count() - 1);
-
- if (values.at(0).canConvert(QVariant::Point)) {
- // Create list of values for appending if the first item is Qt.point
- int maxValue = 0;
- for (int i = 0; i < values.count(); i++) {
- if (values.at(i).canConvert(QVariant::Point) &&
- values.at(i).toPoint().x() > maxValue) {
- maxValue = values.at(i).toPoint().x();
- }
- }
-
- QVector<int> indexValueList;
- indexValueList.resize(maxValue + 1);
-
- for (int i = 0; i < values.count(); i++) {
- if (values.at(i).canConvert(QVariant::Point)) {
- indexValueList.replace(values.at(i).toPoint().x(), values.at(i).toPoint().y());
- }
- }
-
- for (int i = 0; i < indexValueList.count(); i++)
- QBarSet::append(indexValueList.at(i));
-
- } else {
- for (int i(0); i < values.count(); i++) {
- if (values.at(i).canConvert(QVariant::Double))
- QBarSet::append(values[i].toDouble());
- }
- }
-}
-
-QString DeclarativeBarSet::brushFilename() const
-{
- return m_brushFilename;
-}
-
-void DeclarativeBarSet::setBrushFilename(const QString &brushFilename)
-{
- QImage brushImage(brushFilename);
- if (QBarSet::brush().textureImage() != brushImage) {
- QBrush brush = QBarSet::brush();
- brush.setTextureImage(brushImage);
- QBarSet::setBrush(brush);
- m_brushFilename = brushFilename;
- m_brushImage = brushImage;
- emit brushFilenameChanged(brushFilename);
- }
-}
-
-void DeclarativeBarSet::handleBrushChanged()
-{
- // If the texture image of the brush has changed along the brush
- // the brush file name needs to be cleared.
- if (!m_brushFilename.isEmpty() && QBarSet::brush().textureImage() != m_brushImage) {
- m_brushFilename.clear();
- emit brushFilenameChanged(QString(""));
- }
-}
-
-// Declarative bar series ======================================================================================
-DeclarativeBarSeries::DeclarativeBarSeries(QDECLARATIVE_ITEM *parent) :
- QBarSeries(parent),
- m_axes(new DeclarativeAxes(this))
-{
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
-}
-
-void DeclarativeBarSeries::classBegin()
-{
-}
-
-void DeclarativeBarSeries::componentComplete()
-{
- foreach (QObject *child, children()) {
- if (qobject_cast<DeclarativeBarSet *>(child)) {
- QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
- } else if (qobject_cast<QVBarModelMapper *>(child)) {
- QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
- mapper->setSeries(this);
- } else if (qobject_cast<QHBarModelMapper *>(child)) {
- QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
- mapper->setSeries(this);
- }
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeBarSeries::seriesChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
-{
- // Empty implementation; the children are parsed in componentComplete instead
- Q_UNUSED(list);
- Q_UNUSED(element);
-}
-
-DeclarativeBarSet *DeclarativeBarSeries::at(int index)
-{
- QList<QBarSet *> setList = barSets();
- if (index >= 0 && index < setList.count())
- return qobject_cast<DeclarativeBarSet *>(setList[index]);
-
- return 0;
-}
-
-DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values)
-{
- DeclarativeBarSet *barset = new DeclarativeBarSet(this);
- barset->setLabel(label);
- barset->setValues(values);
- if (QBarSeries::insert(index, barset))
- return barset;
- delete barset;
- return 0;
-}
-
-// Declarative stacked bar series ==============================================================================
-DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDECLARATIVE_ITEM *parent) :
- QStackedBarSeries(parent),
- m_axes(0)
-{
- m_axes = new DeclarativeAxes(this);
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
-}
-
-void DeclarativeStackedBarSeries::classBegin()
-{
-}
-
-void DeclarativeStackedBarSeries::componentComplete()
-{
- foreach (QObject *child, children()) {
- if (qobject_cast<DeclarativeBarSet *>(child)) {
- QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
- } else if (qobject_cast<QVBarModelMapper *>(child)) {
- QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
- mapper->setSeries(this);
- } else if (qobject_cast<QHBarModelMapper *>(child)) {
- QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
- mapper->setSeries(this);
- }
- }
-}
-
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeStackedBarSeries::seriesChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeStackedBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
-{
- // Empty implementation; the children are parsed in componentComplete instead
- Q_UNUSED(list);
- Q_UNUSED(element);
-}
-
-DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index)
-{
- QList<QBarSet *> setList = barSets();
- if (index >= 0 && index < setList.count())
- return qobject_cast<DeclarativeBarSet *>(setList[index]);
-
- return 0;
-}
-
-DeclarativeBarSet *DeclarativeStackedBarSeries::insert(int index, QString label, QVariantList values)
-{
- DeclarativeBarSet *barset = new DeclarativeBarSet(this);
- barset->setLabel(label);
- barset->setValues(values);
- if (QStackedBarSeries::insert(index, barset))
- return barset;
- delete barset;
- return 0;
-}
-
-// Declarative percent bar series ==============================================================================
-DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDECLARATIVE_ITEM *parent) :
- QPercentBarSeries(parent),
- m_axes(0)
-{
- m_axes = new DeclarativeAxes(this);
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
-}
-
-void DeclarativePercentBarSeries::classBegin()
-{
-}
-
-void DeclarativePercentBarSeries::componentComplete()
-{
- foreach (QObject *child, children()) {
- if (qobject_cast<DeclarativeBarSet *>(child)) {
- QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
- } else if (qobject_cast<QVBarModelMapper *>(child)) {
- QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
- mapper->setSeries(this);
- } else if (qobject_cast<QHBarModelMapper *>(child)) {
- QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
- mapper->setSeries(this);
- }
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativePercentBarSeries::seriesChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativePercentBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
-{
- // Empty implementation; the children are parsed in componentComplete instead
- Q_UNUSED(list);
- Q_UNUSED(element);
-}
-
-DeclarativeBarSet *DeclarativePercentBarSeries::at(int index)
-{
- QList<QBarSet *> setList = barSets();
- if (index >= 0 && index < setList.count())
- return qobject_cast<DeclarativeBarSet *>(setList[index]);
-
- return 0;
-}
-
-DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label, QVariantList values)
-{
- DeclarativeBarSet *barset = new DeclarativeBarSet(this);
- barset->setLabel(label);
- barset->setValues(values);
- if (QPercentBarSeries::insert(index, barset))
- return barset;
- delete barset;
- return 0;
-}
-
-// Declarative horizontal bar series ===========================================================================
-DeclarativeHorizontalBarSeries::DeclarativeHorizontalBarSeries(QDECLARATIVE_ITEM *parent) :
- QHorizontalBarSeries(parent),
- m_axes(0)
-{
- m_axes = new DeclarativeAxes(this);
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
-}
-
-void DeclarativeHorizontalBarSeries::classBegin()
-{
-}
-
-void DeclarativeHorizontalBarSeries::componentComplete()
-{
- foreach (QObject *child, children()) {
- if (qobject_cast<DeclarativeBarSet *>(child)) {
- QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
- } else if (qobject_cast<QVBarModelMapper *>(child)) {
- QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
- mapper->setSeries(this);
- } else if (qobject_cast<QHBarModelMapper *>(child)) {
- QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
- mapper->setSeries(this);
- }
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalBarSeries::seriesChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeHorizontalBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
-{
- // Empty implementation; the children are parsed in componentComplete instead
- Q_UNUSED(list);
- Q_UNUSED(element);
-}
-
-DeclarativeBarSet *DeclarativeHorizontalBarSeries::at(int index)
-{
- QList<QBarSet *> setList = barSets();
- if (index >= 0 && index < setList.count())
- return qobject_cast<DeclarativeBarSet *>(setList[index]);
-
- return 0;
-}
-
-DeclarativeBarSet *DeclarativeHorizontalBarSeries::insert(int index, QString label, QVariantList values)
-{
- DeclarativeBarSet *barset = new DeclarativeBarSet(this);
- barset->setLabel(label);
- barset->setValues(values);
- if (QHorizontalBarSeries::insert(index, barset))
- return barset;
- delete barset;
- return 0;
-}
-
-// Declarative horizontal stacked bar series ===================================================================
-DeclarativeHorizontalStackedBarSeries::DeclarativeHorizontalStackedBarSeries(QDECLARATIVE_ITEM *parent) :
- QHorizontalStackedBarSeries(parent),
- m_axes(0)
-{
- m_axes = new DeclarativeAxes(this);
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
-}
-
-void DeclarativeHorizontalStackedBarSeries::classBegin()
-{
-}
-
-void DeclarativeHorizontalStackedBarSeries::componentComplete()
-{
- foreach (QObject *child, children()) {
- if (qobject_cast<DeclarativeBarSet *>(child)) {
- QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
- } else if (qobject_cast<QVBarModelMapper *>(child)) {
- QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
- mapper->setSeries(this);
- } else if (qobject_cast<QHBarModelMapper *>(child)) {
- QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
- mapper->setSeries(this);
- }
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalStackedBarSeries::seriesChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalStackedBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeHorizontalStackedBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
-{
- // Empty implementation; the children are parsed in componentComplete instead
- Q_UNUSED(list);
- Q_UNUSED(element);
-}
-
-DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::at(int index)
-{
- QList<QBarSet *> setList = barSets();
- if (index >= 0 && index < setList.count())
- return qobject_cast<DeclarativeBarSet *>(setList[index]);
-
- return 0;
-}
-
-DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::insert(int index, QString label, QVariantList values)
-{
- DeclarativeBarSet *barset = new DeclarativeBarSet(this);
- barset->setLabel(label);
- barset->setValues(values);
- if (QHorizontalStackedBarSeries::insert(index, barset))
- return barset;
- delete barset;
- return 0;
-}
-
-// Declarative horizontal percent bar series ===================================================================
-DeclarativeHorizontalPercentBarSeries::DeclarativeHorizontalPercentBarSeries(QDECLARATIVE_ITEM *parent) :
- QHorizontalPercentBarSeries(parent),
- m_axes(0)
-{
- m_axes = new DeclarativeAxes(this);
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
-}
-
-void DeclarativeHorizontalPercentBarSeries::classBegin()
-{
-}
-
-void DeclarativeHorizontalPercentBarSeries::componentComplete()
-{
- foreach (QObject *child, children()) {
- if (qobject_cast<DeclarativeBarSet *>(child)) {
- QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
- } else if (qobject_cast<QVBarModelMapper *>(child)) {
- QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
- mapper->setSeries(this);
- } else if (qobject_cast<QHBarModelMapper *>(child)) {
- QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
- mapper->setSeries(this);
- }
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalPercentBarSeries::seriesChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalPercentBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeHorizontalPercentBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
-{
- // Empty implementation; the children are parsed in componentComplete instead
- Q_UNUSED(list);
- Q_UNUSED(element);
-}
-
-DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::at(int index)
-{
- QList<QBarSet *> setList = barSets();
- if (index >= 0 && index < setList.count())
- return qobject_cast<DeclarativeBarSet *>(setList[index]);
-
- return 0;
-}
-
-DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::insert(int index, QString label, QVariantList values)
-{
- DeclarativeBarSet *barset = new DeclarativeBarSet(this);
- barset->setLabel(label);
- barset->setValues(values);
- if (QHorizontalPercentBarSeries::insert(index, barset))
- return barset;
- delete barset;
- return 0;
-}
-
-#include "moc_declarativebarseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativebarseries.h b/plugins/declarative/declarativebarseries.h
deleted file mode 100644
index 7b85f490..00000000
--- a/plugins/declarative/declarativebarseries.h
+++ /dev/null
@@ -1,415 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVEBARSERIES_H
-#define DECLARATIVEBARSERIES_H
-
-#include "qbarseries.h"
-#include "qstackedbarseries.h"
-#include "qpercentbarseries.h"
-#include "qhorizontalbarseries.h"
-#include "qhorizontalstackedbarseries.h"
-#include "qhorizontalpercentbarseries.h"
-#include "qbarset.h"
-#include "declarativeaxes.h"
-#include "shared_defines.h"
-
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQuick/QQuickItem>
-#include <QtQml/QQmlParserStatus>
-#else
-#include <QtDeclarative/QDeclarativeItem>
-#include <QtDeclarative/QDeclarativeParserStatus>
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QChart;
-
-class DeclarativeBarSet : public QBarSet
-{
- Q_OBJECT
- Q_PROPERTY(QVariantList values READ values WRITE setValues)
- Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 2)
-
-public:
- explicit DeclarativeBarSet(QObject *parent = 0);
- QVariantList values();
- void setValues(QVariantList values);
- qreal borderWidth() const;
- void setBorderWidth(qreal borderWidth);
- QString brushFilename() const;
- void setBrushFilename(const QString &brushFilename);
-
-public: // From QBarSet
- Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
- Q_INVOKABLE void remove(const int index, const int count = 1) { QBarSet::remove(index, count); }
- Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); }
- Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); }
-
-Q_SIGNALS:
- void countChanged(int count);
- Q_REVISION(1) void borderWidthChanged(qreal width);
- Q_REVISION(2) void brushFilenameChanged(const QString &brushFilename);
-
-private Q_SLOTS:
- void handleCountChanged(int index, int count);
- void handleBrushChanged();
-
-private:
- QString m_brushFilename;
- QImage m_brushImage;
-};
-
-class DeclarativeBarSeries : public QBarSeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "seriesChildren")
-
-public:
- explicit DeclarativeBarSeries(QDECLARATIVE_ITEM *parent = 0);
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
-
-public:
- Q_INVOKABLE DeclarativeBarSet *at(int index);
- Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
- Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
- Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); }
- Q_INVOKABLE void clear() { return QBarSeries::clear(); }
-
-public: // from QDeclarativeParserStatus
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
-
-public Q_SLOTS:
- static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
-
-public:
- DeclarativeAxes *m_axes;
-};
-
-class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "seriesChildren")
-
-public:
- explicit DeclarativeStackedBarSeries(QDECLARATIVE_ITEM *parent = 0);
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
-
-public:
- Q_INVOKABLE DeclarativeBarSet *at(int index);
- Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
- Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
- Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); }
- Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); }
-
-public: // from QDeclarativeParserStatus
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
-
-public Q_SLOTS:
- static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
-
-public:
- DeclarativeAxes *m_axes;
-};
-
-class DeclarativePercentBarSeries : public QPercentBarSeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "seriesChildren")
-
-public:
- explicit DeclarativePercentBarSeries(QDECLARATIVE_ITEM *parent = 0);
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
-
-public:
- Q_INVOKABLE DeclarativeBarSet *at(int index);
- Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
- Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
- Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); }
- Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); }
-
-public: // from QDeclarativeParserStatus
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
-
-public Q_SLOTS:
- static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
-
-public:
- DeclarativeAxes *m_axes;
-};
-
-class DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "seriesChildren")
-
-public:
- explicit DeclarativeHorizontalBarSeries(QDECLARATIVE_ITEM *parent = 0);
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
-
-public:
- Q_INVOKABLE DeclarativeBarSet *at(int index);
- Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
- Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
- Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalBarSeries::remove(barset); }
- Q_INVOKABLE void clear() { return QHorizontalBarSeries::clear(); }
-
-public: // from QDeclarativeParserStatus
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
-
-public Q_SLOTS:
- static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
-
-public:
- DeclarativeAxes *m_axes;
-};
-
-class DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "seriesChildren")
-
-public:
- explicit DeclarativeHorizontalStackedBarSeries(QDECLARATIVE_ITEM *parent = 0);
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
-
-public:
- Q_INVOKABLE DeclarativeBarSet *at(int index);
- Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
- Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
- Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalStackedBarSeries::remove(barset); }
- Q_INVOKABLE void clear() { return QHorizontalStackedBarSeries::clear(); }
-
-public: // from QDeclarativeParserStatus
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
-
-public Q_SLOTS:
- static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
-
-public:
- DeclarativeAxes *m_axes;
-};
-
-class DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "seriesChildren")
-
-public:
- explicit DeclarativeHorizontalPercentBarSeries(QDECLARATIVE_ITEM *parent = 0);
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
-
-public:
- Q_INVOKABLE DeclarativeBarSet *at(int index);
- Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
- Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
- Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalPercentBarSeries::remove(barset); }
- Q_INVOKABLE void clear() { return QHorizontalPercentBarSeries::clear(); }
-
-public: // from QDeclarativeParserStatus
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
-
-public Q_SLOTS:
- static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
-
-public:
- DeclarativeAxes *m_axes;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVEBARSERIES_H
diff --git a/plugins/declarative/declarativeboxplotseries.cpp b/plugins/declarative/declarativeboxplotseries.cpp
deleted file mode 100644
index 64f31e5d..00000000
--- a/plugins/declarative/declarativeboxplotseries.cpp
+++ /dev/null
@@ -1,401 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativebarseries.h"
-#include "declarativeboxplotseries.h"
-#include "qboxset.h"
-#include "qvboxplotmodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-#ifdef QDOC_QT5
-/*!
- \qmltype BoxSet
- \instantiates QBoxSet
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/declarativeboxset.qdocinc
-*/
-#else
-/*!
- \qmlclass BoxSet QBoxSet
-
- \include ../doc/src/declarativeboxset.qdocinc
-*/
-#endif
-/*!
- \qmlproperty string BoxSet::values
- The values on the box-and-whiskers set.
-*/
-/*!
- \qmlproperty string BoxSet::label
- Defines the label of the box-and-whiskers set.
-*/
-/*!
- \qmlproperty int BoxSet::count
- The count of values on the box-and-whiskers set
-*/
-/*!
- \qmlmethod void BoxSet::at(int index)
- Returns the value at \a index position.
-*/
-/*!
- \qmlmethod void BoxSet::append(qreal value)
- Appends new value \a value to the end of set.
-*/
-/*!
- \qmlmethod void BoxSet::clear()
- Sets all values on the set to 0.
-*/
-/*!
- \qmlmethod void BoxSet::setValue(int index, qreal value)
- Sets a new \a value on the \a index position.
-*/
-/*!
- \qmlsignal BoxSet::onClicked()
- This signal is emitted when the user clicks with a mouse on top of box-and-whiskers item.
-*/
-/*!
- \qmlsignal BoxSet::onHovered(bool status)
- The signal is emitted if mouse is hovered on top of box-and-whiskers item.
- Parameter \a status is true, if mouse entered on top of the item, and false if mouse left from top of the item.
-*/
-/*!
- \qmlsignal BoxSet::onPenChanged()
- This signal is emitted when the pen of the box-and-whiskers item has changed.
-*/
-/*!
- \qmlsignal BoxSet::onBrushChanged()
- This signal is emitted when the brush of the box-and-whiskers item has changed.
-*/
-/*!
- \qmlsignal BoxSet::onChangedValues()
- This signal is emitted when multiple values have been changed on the box-and-whiskers item.
-*/
-/*!
- \qmlsignal BoxSet::onChangedValue(int index)
- This signal is emitted values the value in the box-and-whiskers item has been modified.
- Parameter \a index indicates the position of the modified value.
-*/
-/*!
- \qmlsignal BoxSet::onCleared()
- This signal is emitted when all the values on the set are cleared to 0.
-*/
-
-
-#ifdef QDOC_QT5
-/*!
- \qmltype BoxPlotSeries
- \instantiates QBoxPlotSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/declarativeboxplotseries.qdocinc
-*/
-#else
-/*!
- \qmlclass BoxPlotSeries QBoxPlotSeries
-
- \include ../doc/src/declarativeboxplotseries.qdocinc
-*/
-#endif
-
-/*!
- \qmlmethod BoxPlotSeries::append(string label, VariantList values)
- Appends a new box-and-whiskers set with \a label and \a values to the series.
- */
-/*!
- \qmlmethod BoxPlotSeries::append(BoxSet box)
- Appends the \a box to the series.
-*/
-/*!
- \qmlmethod BoxPlotSeries::insert(int index, string label, VariantList values)
- Inserts a new box-and-whiskers set with \a label and \a values at the \a index position.
-*/
-/*!
- \qmlmethod BoxPlotSeries::remove(QBoxSet boxset)
- Removes the \a boxset from the series.
-*/
-/*!
- \qmlmethod BoxPlotSeries::clear()
- Removes all boxsets from the series. Deletes removed sets.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onClicked(BoxSet boxset);
- Signal is emitted when the user clicks the \a boxset on the chart.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onHovered(bool status, BoxSet boxset);
- Signal is emitted when there is change in hover \a status over \a boxset.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onCountChanged();
- Signal is emitted when there is change in count of box-and-whiskers items in the series.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onBoxsetsAdded()
- Signal is emitted when new box-and-whiskers sets are added to the series.
- */
-/*!
- \qmlsignal BoxPlotSeries::onBoxsetsRemoved()
- Signal is emitted when new box-and-whiskers sets are removed from the series.
- */
-/*!
- \qmlproperty AbstractAxis BoxPlotSeries::axisX
- The x axis used for the series. If you leave both axisX and axisXTop undefined, a BarCategoriesAxis is created for
- the series.
- \sa axisXTop
-*/
-/*!
- \qmlproperty AbstractAxis BoxPlotSeries::axisY
- The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
- the series.
- \sa axisYRight
-*/
-/*!
- \qmlproperty AbstractAxis BoxPlotSeries::axisXTop
- The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
- axisXTop, but not both.
- \sa axisX
-*/
-/*!
- \qmlproperty AbstractAxis BoxPlotSeries::axisYRight
- The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
- or axisYRight, but not both.
- \sa axisY
-*/
-/*!
- \qmlproperty bool BoxPlotSeries::boxOutlineVisible
- This property configures the visibility of the middle box outline.
-*/
-/*!
- \qmlproperty qreal BoxPlotSeries::boxWidth
- This property configures the width of the box-and-whiskers item. The value signifies the relative
- width of the box-and-whiskers item inside its own slot. The value can between 0.0 and 1.0. Negative values
- are clamped to 0.0 and values over 1.0 are clamped to 1.0.
-*/
-/*!
- \qmlproperty Pen BoxPlotSeries::pen
- This property configures the pen of the box-and-whiskers items.
-*/
-/*!
- \qmlproperty Brush BoxPlotSeries::brush
- This property configures the brush of the box-and-whiskers items.
-*/
-/*!
- \qmlproperty int BoxPlotSeries::count
- The count of sets in series.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onBoxOutlineVisibilityChanged()
- Signal is emitted when the middle box outline visibility is changed.
- */
-/*!
- \qmlsignal BoxPlotSeries::onBoxWidthChanged()
- Signal is emitted when the width of the box-and-whiskers item is changed.
- */
-/*!
- \qmlsignal BoxPlotSeries::onPenChanged()
- Signal is emitted when the pen for box-and-whiskers items has changed.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onBrushChanged()
- Signal is emitted when the brush for box-and-whiskers items has changed.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onClicked(BoxSet boxset)
- Signal is emitted when the user clicks the \a boxset on the chart.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onHovered(bool status, BoxSet boxset)
- Signal is emitted when there is change in hover \a status over \a boxset.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onAxisXChanged(AbstractAxis axis)
- Signal is emitted when there is change in X axis.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onAxisYChanged(AbstractAxis axis)
- Signal is emitted when there is change in Y axis.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onAxisXTopChanged(AbstractAxis axis)
- Signal is emitted when there is change in top X axis.
-*/
-/*!
- \qmlsignal BoxPlotSeries::onAxisYRightChanged(AbstractAxis axis)
- Signal is emitted when there is change in Y right axis.
-*/
-
-
-DeclarativeBoxSet::DeclarativeBoxSet(const QString label, QObject *parent)
- : QBoxSet(label, parent)
-{
- connect(this, SIGNAL(valuesChanged()), this, SIGNAL(changedValues()));
- connect(this, SIGNAL(valueChanged(int)), this, SIGNAL(changedValue(int)));
- connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
-}
-
-QVariantList DeclarativeBoxSet::values()
-{
- QVariantList values;
- for (int i(0); i < 5; i++)
- values.append(QVariant(QBoxSet::at(i)));
- return values;
-}
-
-void DeclarativeBoxSet::setValues(QVariantList values)
-{
- for (int i(0); i < values.count(); i++) {
- if (values.at(i).canConvert(QVariant::Double))
- QBoxSet::append(values[i].toDouble());
- }
-}
-
-QString DeclarativeBoxSet::brushFilename() const
-{
- return m_brushFilename;
-}
-
-void DeclarativeBoxSet::setBrushFilename(const QString &brushFilename)
-{
- QImage brushImage(brushFilename);
- if (QBoxSet::brush().textureImage() != brushImage) {
- QBrush brush = QBoxSet::brush();
- brush.setTextureImage(brushImage);
- QBoxSet::setBrush(brush);
- m_brushFilename = brushFilename;
- m_brushImage = brushImage;
- emit brushFilenameChanged(brushFilename);
- }
-}
-
-void DeclarativeBoxSet::handleBrushChanged()
-{
- // If the texture image of the brush has changed along the brush
- // the brush file name needs to be cleared.
- if (!m_brushFilename.isEmpty() && QBoxSet::brush().textureImage() != m_brushImage) {
- m_brushFilename.clear();
- emit brushFilenameChanged(QString(""));
- }
-}
-
-// =====================================================
-
-DeclarativeBoxPlotSeries::DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent) :
- QBoxPlotSeries(parent),
- m_axes(new DeclarativeAxes(this))
-{
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
- connect(this, SIGNAL(hovered(bool, QBoxSet*)), this, SLOT(onHovered(bool, QBoxSet*)));
- connect(this, SIGNAL(clicked(QBoxSet*)), this, SLOT(onClicked(QBoxSet*)));
- connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
-}
-
-void DeclarativeBoxPlotSeries::classBegin()
-{
-}
-
-void DeclarativeBoxPlotSeries::componentComplete()
-{
- foreach (QObject *child, children()) {
- if (qobject_cast<DeclarativeBoxSet *>(child)) {
- QBoxPlotSeries::append(qobject_cast<DeclarativeBoxSet *>(child));
- } else if (qobject_cast<QVBoxPlotModelMapper *>(child)) {
- QVBoxPlotModelMapper *mapper = qobject_cast<QVBoxPlotModelMapper *>(child);
- mapper->setSeries(this);
- }
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeBoxPlotSeries::seriesChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBoxPlotSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeBoxPlotSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
-{
- // Empty implementation; the children are parsed in componentComplete instead
- Q_UNUSED(list);
- Q_UNUSED(element);
-}
-
-DeclarativeBoxSet *DeclarativeBoxPlotSeries::at(int index)
-{
- QList<QBoxSet *> setList = boxSets();
- if (index >= 0 && index < setList.count())
- return qobject_cast<DeclarativeBoxSet *>(setList[index]);
-
- return 0;
-}
-
-DeclarativeBoxSet *DeclarativeBoxPlotSeries::insert(int index, const QString label, QVariantList values)
-{
- DeclarativeBoxSet *barset = new DeclarativeBoxSet(label, this);
- barset->setValues(values);
- if (QBoxPlotSeries::insert(index, barset))
- return barset;
- delete barset;
- return 0;
-}
-
-void DeclarativeBoxPlotSeries::onHovered(bool status, QBoxSet *boxset)
-{
- emit hovered(status, qobject_cast<DeclarativeBoxSet *>(boxset));
-}
-
-void DeclarativeBoxPlotSeries::onClicked(QBoxSet *boxset)
-{
- emit clicked(qobject_cast<DeclarativeBoxSet *>(boxset));
-}
-
-QString DeclarativeBoxPlotSeries::brushFilename() const
-{
- return m_brushFilename;
-}
-
-void DeclarativeBoxPlotSeries::setBrushFilename(const QString &brushFilename)
-{
- QImage brushImage(brushFilename);
- if (QBoxPlotSeries::brush().textureImage() != brushImage) {
- QBrush brush = QBoxPlotSeries::brush();
- brush.setTextureImage(brushImage);
- QBoxPlotSeries::setBrush(brush);
- m_brushFilename = brushFilename;
- m_brushImage = brushImage;
- emit brushFilenameChanged(brushFilename);
- }
-}
-
-void DeclarativeBoxPlotSeries::handleBrushChanged()
-{
- // If the texture image of the brush has changed along the brush
- // the brush file name needs to be cleared.
- if (!m_brushFilename.isEmpty() && QBoxPlotSeries::brush().textureImage() != m_brushImage) {
- m_brushFilename.clear();
- emit brushFilenameChanged(QString(""));
- }
-}
-
-#include "moc_declarativeboxplotseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativeboxplotseries.h b/plugins/declarative/declarativeboxplotseries.h
deleted file mode 100644
index 7bbb321a..00000000
--- a/plugins/declarative/declarativeboxplotseries.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVEBOXPLOT_H
-#define DECLARATIVEBOXPLOT_H
-
-#include "qboxset.h"
-#include "declarativeaxes.h"
-#include "qboxplotseries.h"
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQuick/QQuickItem>
-#include <QtQml/QQmlParserStatus>
-#else
-#include <QtDeclarative/QDeclarativeItem>
-#include <QtDeclarative/QDeclarativeParserStatus>
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativeBoxSet : public QBoxSet
-{
- Q_OBJECT
- Q_PROPERTY(QVariantList values READ values WRITE setValues)
- Q_PROPERTY(QString label READ label WRITE setLabel)
- Q_PROPERTY(int count READ count)
- Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
- Q_ENUMS(ValuePositions)
-
-public: // duplicate from QBoxSet
- enum ValuePositions {
- LowerExtreme = 0x0,
- LowerQuartile,
- Median,
- UpperQuartile,
- UpperExtreme
- };
-
-public:
- explicit DeclarativeBoxSet(const QString label = "", QObject *parent = 0);
- QVariantList values();
- void setValues(QVariantList values);
- QString brushFilename() const;
- void setBrushFilename(const QString &brushFilename);
-
-public: // From QBoxSet
- Q_INVOKABLE void append(qreal value) { QBoxSet::append(value); }
- Q_INVOKABLE void clear() {QBoxSet::clear(); }
- Q_INVOKABLE qreal at(int index) { return QBoxSet::at(index); }
- Q_INVOKABLE void setValue(int index, qreal value) { QBoxSet::setValue(index, value); }
-
-Q_SIGNALS:
- void changedValues();
- void changedValue(int index);
- Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename);
-
-private Q_SLOTS:
- void handleBrushChanged();
-
-private:
- QString m_brushFilename;
- QImage m_brushImage;
-};
-
-class DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
-#endif
- Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
- Q_CLASSINFO("DefaultProperty", "seriesChildren")
-
-public:
- explicit DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent = 0);
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
- QString brushFilename() const;
- void setBrushFilename(const QString &brushFilename);
-
-public:
- Q_INVOKABLE DeclarativeBoxSet *at(int index);
- Q_INVOKABLE DeclarativeBoxSet *append(const QString label, QVariantList values) { return insert(count(), label, values); }
- Q_INVOKABLE void append(DeclarativeBoxSet *box) { QBoxPlotSeries::append(box); }
- Q_INVOKABLE DeclarativeBoxSet *insert(int index, const QString label, QVariantList values);
- Q_INVOKABLE bool remove(DeclarativeBoxSet *box) { return QBoxPlotSeries::remove(qobject_cast<QBoxSet *>(box)); }
- Q_INVOKABLE void clear() { return QBoxPlotSeries::clear(); }
-
-public: // from QDeclarativeParserStatus
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- void axisXChanged(QAbstractAxis *axis);
- void axisYChanged(QAbstractAxis *axis);
- void axisXTopChanged(QAbstractAxis *axis);
- void axisYRightChanged(QAbstractAxis *axis);
- void clicked(DeclarativeBoxSet *boxset);
- void hovered(bool status, DeclarativeBoxSet *boxset);
- Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename);
-
-public Q_SLOTS:
- static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
- void onHovered(bool status, QBoxSet *boxset);
- void onClicked(QBoxSet *boxset);
-
-private Q_SLOTS:
- void handleBrushChanged();
-
-public:
- DeclarativeAxes *m_axes;
-
-private:
- QString m_brushFilename;
- QImage m_brushImage;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVEBOXPLOT_H
diff --git a/plugins/declarative/declarativecategoryaxis.cpp b/plugins/declarative/declarativecategoryaxis.cpp
deleted file mode 100644
index 49fa0d59..00000000
--- a/plugins/declarative/declarativecategoryaxis.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativecategoryaxis.h"
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-#ifdef QDOC_QT5
-/*!
- \qmltype CategoryRange
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/categoryrange.qdocinc
-*/
-#else
-/*!
- \qmlclass CategoryRange
-
- \include ../doc/src/categoryrange.qdocinc
-*/
-#endif
-
-DeclarativeCategoryRange::DeclarativeCategoryRange(QObject *parent) :
- QObject(parent),
- m_endValue(0),
- m_label(QString())
-{
-}
-
-DeclarativeCategoryAxis::DeclarativeCategoryAxis(QObject *parent) :
- QCategoryAxis(parent)
-{
-}
-
-void DeclarativeCategoryAxis::classBegin()
-{
-}
-
-void DeclarativeCategoryAxis::componentComplete()
-{
- QList<QPair<QString, qreal> > ranges;
- foreach (QObject *child, children()) {
- if (qobject_cast<DeclarativeCategoryRange *>(child)) {
- DeclarativeCategoryRange *range = qobject_cast<DeclarativeCategoryRange *>(child);
- ranges.append(QPair<QString, qreal>(range->label(), range->endValue()));
- }
- }
-
- // Sort and append the range objects according to end value
- qSort(ranges.begin(), ranges.end(), endValueLessThan);
- for (int i(0); i < ranges.count(); i++)
- append(ranges.at(i).first, ranges.at(i).second);
-}
-
-bool DeclarativeCategoryAxis::endValueLessThan(const QPair<QString, qreal> &value1, const QPair<QString, qreal> &value2)
-{
- return value1.second < value2.second;
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeCategoryAxis::axisChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeCategoryAxis::appendAxisChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeCategoryAxis::append(const QString &label, qreal categoryEndValue)
-{
- QCategoryAxis::append(label, categoryEndValue);
-}
-
-void DeclarativeCategoryAxis::remove(const QString &label)
-{
- QCategoryAxis::remove(label);
-}
-
-void DeclarativeCategoryAxis::replace(const QString &oldLabel, const QString &newLabel)
-{
- QCategoryAxis::replaceLabel(oldLabel, newLabel);
-}
-
-void DeclarativeCategoryAxis::appendAxisChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
-{
- // Empty implementation; the children are parsed in componentComplete instead
- Q_UNUSED(list)
- Q_UNUSED(element)
-}
-
-#include "moc_declarativecategoryaxis.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativecategoryaxis.h b/plugins/declarative/declarativecategoryaxis.h
deleted file mode 100644
index 999339fd..00000000
--- a/plugins/declarative/declarativecategoryaxis.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVECATEGORYAXIS_H
-#define DECLARATIVECATEGORYAXIS_H
-
-#include "qcategoryaxis.h"
-#include "shared_defines.h"
-
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQml/QQmlListProperty>
-#include <QtQml/QQmlParserStatus>
-#else
-#include <QtDeclarative/QDeclarativeListProperty>
-#include <QtDeclarative/QDeclarativeParserStatus>
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativeCategoryRange : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(qreal endValue READ endValue WRITE setEndValue)
- Q_PROPERTY(QString label READ label WRITE setLabel)
-
-public:
- explicit DeclarativeCategoryRange(QObject *parent = 0);
- qreal endValue() { return m_endValue; }
- void setEndValue(qreal endValue) { m_endValue = endValue; }
- QString label() { return m_label; }
- void setLabel(QString label) { m_label = label; }
-
-private:
- qreal m_endValue;
- QString m_label;
-};
-
-class DeclarativeCategoryAxis : public QCategoryAxis, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(QQmlListProperty<QObject> axisChildren READ axisChildren)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
- Q_PROPERTY(QDeclarativeListProperty<QObject> axisChildren READ axisChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "axisChildren")
-
-public:
- explicit DeclarativeCategoryAxis(QObject *parent = 0);
- QDECLARATIVE_LIST_PROPERTY<QObject> axisChildren();
-
-public: // from QDeclarativeParserStatus
- void classBegin();
- void componentComplete();
-
-public Q_SLOTS:
- Q_INVOKABLE void append(const QString &label, qreal categoryEndValue);
- Q_INVOKABLE void remove(const QString &label);
- Q_INVOKABLE void replace(const QString &oldLabel, const QString &newLabel);
- static void appendAxisChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
-
-private:
- static bool endValueLessThan(const QPair<QString, qreal> &value1, const QPair<QString, qreal> &value2);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVECATEGORYAXIS_H
diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp
deleted file mode 100644
index fec441d5..00000000
--- a/plugins/declarative/declarativechart.cpp
+++ /dev/null
@@ -1,1080 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativechart.h"
-#include <QPainter>
-#include "declarativelineseries.h"
-#include "declarativeareaseries.h"
-#include "declarativebarseries.h"
-#include "declarativepieseries.h"
-#include "declarativesplineseries.h"
-#include "declarativeboxplotseries.h"
-#include "declarativescatterseries.h"
-#include "qbarcategoryaxis.h"
-#include "qvalueaxis.h"
-#include "qlogvalueaxis.h"
-#include "qcategoryaxis.h"
-#include "qabstractseries_p.h"
-#include "declarativemargins.h"
-#include "chartdataset_p.h"
-#include "declarativeaxes.h"
-#include "qchart_p.h"
-#include "qpolarchart.h"
-
-#ifndef QT_ON_ARM
- #include "qdatetimeaxis.h"
-#endif
-
-#ifdef CHARTS_FOR_QUICK2
-#include <QGraphicsSceneMouseEvent>
-#include <QGraphicsSceneHoverEvent>
-#include <QApplication>
-#include <QTimer>
-#include <QThread>
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-#ifdef QDOC_QT5
-/*!
- \qmltype ChartView
- \instantiates DeclarativeChart
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/chartview.qdocinc
-*/
-#else
-/*!
- \qmlclass ChartView DeclarativeChart
-
- \include ../doc/src/chartview.qdocinc
-*/
-#endif
-
-/*!
- \qmlproperty Theme ChartView::theme
- Theme defines the visual appearance of the chart, including for example colors, fonts, line
- widths and chart background.
-*/
-
-/*!
- \qmlproperty Animation ChartView::animationOptions
- Animation configuration of the chart. One of ChartView.NoAnimation, ChartView.GridAxisAnimations,
- ChartView.SeriesAnimations or ChartView.AllAnimations.
-*/
-
-/*!
- \qmlproperty Font ChartView::titleFont
- The title font of the chart.
-
- See the Qt documentation for more details of Font.
-*/
-
-/*!
- \qmlproperty string ChartView::title
- The title of the chart, shown on top of the chart.
- \sa ChartView::titleColor
-*/
-
-/*!
- \qmlproperty color ChartView::titleColor
- The color of the title text.
-*/
-
-/*!
- \qmlproperty Legend ChartView::legend
- The legend of the chart. Legend lists all the series, pie slices and bar sets added on the chart.
-*/
-
-/*!
- \qmlproperty int ChartView::count
- The count of series added to the chart.
-*/
-
-/*!
- \qmlproperty color ChartView::backgroundColor
- The color of the chart's background. By default background color is defined by chart theme.
- \sa ChartView::theme
-*/
-
-/*!
- \qmlproperty real ChartView::backgroundRoundness
- The diameter of the rounding cirle at the corners of the chart background.
-*/
-
-/*!
- \qmlproperty color ChartView::plotAreaColor
- The color of the background of the chart's plot area. By default plot area background uses chart's
- background color.
- \sa ChartView::backgroundColor
-*/
-
-/*!
- \qmlproperty bool ChartView::dropShadowEnabled
- The chart's border drop shadow. Set to true to enable drop shadow.
-*/
-
-/*!
- \qmlproperty real ChartView::topMargin
- Deprecated; use margins instead.
-*/
-
-/*!
- \qmlproperty real ChartView::bottomMargin
- Deprecated; use margins instead.
-*/
-
-/*!
- \qmlproperty real ChartView::leftMargin
- Deprecated; use margins instead.
-*/
-
-/*!
- \qmlproperty real ChartView::rightMargin
- Deprecated; use margins instead.
-*/
-
-/*!
- \qmlproperty Margins ChartView::minimumMargins
- Deprecated; use margins instead.
- The minimum margins allowed between the outer bounds and the plotArea of the ChartView. Margins
- area of ChartView is used for drawing title, axes and legend. Please note that setting the
- properties of minimumMargins may be bigger than the defined value, depending on other ChartView
- properties that affect it's layout. If you need to know the actual plotting area used at any
- given time, you can check ChartView::plotArea instead.
-*/
-
-/*!
- \qmlproperty rect ChartView::plotArea
- The area on the ChartView that is used for drawing series. This is the ChartView rect without the
- margins.
- \sa ChartView::minimumMargins
-*/
-
-/*!
- \qmlproperty Margins ChartView::margins
- The minimum margins allowed between the outer bounds and the plotArea of the ChartView. Margins
- area of ChartView is used for drawing title, axes and legend.
-*/
-
-/*!
- \qmlproperty bool ChartView::localizeNumbers
- \since QtCharts 2.0
- When \c{true}, all generated numbers appearing in various series and axis labels will be
- localized using the default QLocale of the application, which defaults to the system locale.
- When \c{false}, the "C" locale is always used.
- Defaults to \c{false}.
-
- \sa locale
-*/
-
-/*!
- \qmlproperty locale ChartView::locale
- \since QtCharts 2.0
- Sets the locale used to format various chart labels when localizeNumbers is \c{true}.
- This also determines the locale used to format DateTimeAxis labels regardless of
- localizeNumbers property.
- Defaults to application default locale at the time the chart is constructed.
-
- \sa localizeNumbers
-*/
-
-/*!
- \qmlmethod AbstractSeries ChartView::series(int index)
- Returns the series with \a index on the chart. This allows you to loop through the series of a chart together with
- the count property of the chart.
-*/
-
-/*!
- \qmlmethod AbstractSeries ChartView::series(string name)
- Returns the first series on the chart with \a name. If there is no series with that name, returns null.
-*/
-
-/*!
- \qmlmethod AbstractSeries ChartView::createSeries(SeriesType type, string name, AbstractAxis axisX, AbstractAxis axisY)
- Creates a series object of \a type to the chart with name \a name, optional axis \a axisX and
- optional axis \a axisY. For example:
- \code
- // lineSeries is a LineSeries object that has already been added to the ChartView; re-use it's axes
- var myAxisX = chartView.axisX(lineSeries);
- var myAxisY = chartView.axisY(lineSeries);
- var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter series", myAxisX, myAxisY);
- \endcode
-*/
-
-/*!
- \qmlmethod ChartView::removeSeries(AbstractSeries series)
- Removes the \a series from the chart. The series object is also destroyed.
-*/
-
-/*!
- \qmlmethod ChartView::removeAllSeries()
- Removes all series from the chart. All the series objects are also destroyed.
-*/
-
-/*!
- \qmlmethod Axis ChartView::axisX(AbstractSeries series)
- The x-axis of the series.
-*/
-
-/*!
- \qmlmethod Axis ChartView::axisY(AbstractSeries series)
- The y-axis of the series.
-*/
-
-/*!
- \qmlmethod ChartView::zoomY(real factor)
- Zooms in by \a factor on the center of the chart.
-*/
-
-/*!
- \qmlmethod ChartView::scrollLeft(real pixels)
- Scrolls to left by \a pixels. This is a convenience function that suits for example for key navigation.
-*/
-
-/*!
- \qmlmethod ChartView::scrollRight(real pixels)
- Scrolls to right by \a pixels. This is a convenience function that suits for example for key navigation.
-*/
-
-/*!
- \qmlmethod ChartView::scrollUp(real pixels)
- Scrolls up by \a pixels. This is a convenience function that suits for example for key navigation.
-*/
-
-/*!
- \qmlmethod ChartView::scrollDown(real pixels)
- Scrolls down by \a pixels. This is a convenience function that suits for example for key navigation.
-*/
-
-/*!
- \qmlsignal ChartView::onPlotAreaChanged(rect plotArea)
- The plot area of the chart has changed. This may happen for example, if you modify minimumMargins
- or if you resize the chart, or if you modify font size related properties of the legend or chart
- title.
-*/
-
-/*!
- \qmlsignal ChartView::seriesAdded(AbstractSeries series)
- The \a series has been added to the chart.
-*/
-
-/*!
- \qmlsignal ChartView::seriesRemoved(AbstractSeries series)
- The \a series has been removed from the chart. Please note that \a series is no longer a valid
- object after the signal handler has completed.
-*/
-
-DeclarativeChart::DeclarativeChart(QDECLARATIVE_ITEM *parent)
- : QDECLARATIVE_PAINTED_ITEM(parent)
-{
- initChart(QChart::ChartTypeCartesian);
-}
-
-DeclarativeChart::DeclarativeChart(QChart::ChartType type, QDECLARATIVE_ITEM *parent)
- : QDECLARATIVE_PAINTED_ITEM(parent)
-{
- initChart(type);
-}
-
-void DeclarativeChart::initChart(QChart::ChartType type)
-{
-#ifdef CHARTS_FOR_QUICK2
- m_currentSceneImage = 0;
- m_guiThreadId = QThread::currentThreadId();
- m_paintThreadId = 0;
- m_updatePending = false;
-
- if (type == QChart::ChartTypePolar)
- m_chart = new QPolarChart();
- else
- m_chart = new QChart();
-
- m_scene = new QGraphicsScene(this);
- m_scene->addItem(m_chart);
-
- setAntialiasing(QQuickItem::antialiasing());
- connect(m_scene, SIGNAL(changed(QList<QRectF>)), this, SLOT(sceneChanged(QList<QRectF>)));
- connect(this, SIGNAL(antialiasingChanged(bool)), this, SLOT(handleAntialiasingChanged(bool)));
-
- setAcceptedMouseButtons(Qt::AllButtons);
- setAcceptHoverEvents(true);
-#else
- if (type == QChart::ChartTypePolar)
- m_chart = new QPolarChart(this);
- else
- m_chart = new QChart(this);
-
- setFlag(QGraphicsItem::ItemHasNoContents, false);
-#endif
-
- m_margins = new DeclarativeMargins(this);
- m_margins->setTop(m_chart->margins().top());
- m_margins->setLeft(m_chart->margins().left());
- m_margins->setRight(m_chart->margins().right());
- m_margins->setBottom(m_chart->margins().bottom());
- connect(m_margins, SIGNAL(topChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
- connect(m_margins, SIGNAL(bottomChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
- connect(m_margins, SIGNAL(leftChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
- connect(m_margins, SIGNAL(rightChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
- connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesAdded(QAbstractSeries*)));
- connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SIGNAL(seriesRemoved(QAbstractSeries*)));
-}
-
-void DeclarativeChart::handleSeriesAdded(QAbstractSeries *series)
-{
- emit seriesAdded(series);
-}
-
-void DeclarativeChart::changeMinimumMargins(int top, int bottom, int left, int right)
-{
- m_chart->setMargins(QMargins(left, top, right, bottom));
- emit minimumMarginsChanged();
- emit plotAreaChanged(m_chart->plotArea());
-}
-
-DeclarativeChart::~DeclarativeChart()
-{
- delete m_chart;
-#ifdef CHARTS_FOR_QUICK2
- m_sceneImageLock.lock();
- delete m_currentSceneImage;
- m_currentSceneImage = 0;
- m_sceneImageLock.unlock();
-#endif
-}
-
-void DeclarativeChart::childEvent(QChildEvent *event)
-{
- if (event->type() == QEvent::ChildAdded) {
- if (qobject_cast<QAbstractSeries *>(event->child())) {
- m_chart->addSeries(qobject_cast<QAbstractSeries *>(event->child()));
- }
- }
-}
-
-void DeclarativeChart::componentComplete()
-{
- foreach (QObject *child, children()) {
- if (qobject_cast<QAbstractSeries *>(child)) {
- // Add series to the chart
- QAbstractSeries *series = qobject_cast<QAbstractSeries *>(child);
- m_chart->addSeries(series);
-
- // Connect to axis changed signals (unless this is a pie series)
- if (!qobject_cast<DeclarativePieSeries *>(series)) {
- connect(series, SIGNAL(axisXChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*)));
- connect(series, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SLOT(handleAxisXTopSet(QAbstractAxis*)));
- connect(series, SIGNAL(axisYChanged(QAbstractAxis*)), this, SLOT(handleAxisYSet(QAbstractAxis*)));
- connect(series, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SLOT(handleAxisYRightSet(QAbstractAxis*)));
- }
-
- initializeAxes(series);
- }
- }
-
- QDECLARATIVE_ITEM::componentComplete();
-}
-
-void DeclarativeChart::handleAxisXSet(QAbstractAxis *axis)
-{
- QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
- if (axis && s) {
- if (!m_chart->axes(Qt::Horizontal).contains(axis))
- m_chart->setAxisX(axis, s);
- if (!s->attachedAxes().contains(axis))
- s->attachAxis(axis);
- } else {
- qWarning() << "Trying to set axisX to null.";
- }
-}
-
-void DeclarativeChart::handleAxisXTopSet(QAbstractAxis *axis)
-{
- QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
- if (axis && s) {
- if (!m_chart->axes(Qt::Horizontal).contains(axis)) {
- QList<QAbstractAxis *> oldAxes = m_chart->axes(Qt::Horizontal, s);
- foreach (QAbstractAxis* a, oldAxes) {
- m_chart->removeAxis(a);
- delete a;
- }
- m_chart->addAxis(axis, Qt::AlignTop);
- }
- if (!s->attachedAxes().contains(axis))
- s->attachAxis(axis);
- } else {
- qWarning() << "Trying to set axisXTop to null.";
- }
-}
-
-void DeclarativeChart::handleAxisYSet(QAbstractAxis *axis)
-{
- QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
- if (axis && s) {
- if (!m_chart->axes(Qt::Vertical).contains(axis))
- m_chart->setAxisY(axis, s);
- if (!s->attachedAxes().contains(axis))
- s->attachAxis(axis);
- } else {
- qWarning() << "Trying to set axisY to null.";
- }
-}
-
-void DeclarativeChart::handleAxisYRightSet(QAbstractAxis *axis)
-{
- QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
- if (axis && s) {
- if (!m_chart->axes(Qt::Vertical).contains(axis)) {
- QList<QAbstractAxis *> oldAxes = m_chart->axes((Qt::Vertical), s);
- foreach (QAbstractAxis* a, oldAxes) {
- m_chart->removeAxis(a);
- delete a;
- }
- m_chart->addAxis(axis, Qt::AlignRight);
- }
- if (!s->attachedAxes().contains(axis))
- s->attachAxis(axis);
- } else {
- qWarning() << "Trying to set axisYRight to null.";
- }
-}
-
-void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- if (newGeometry.isValid()) {
- if (newGeometry.width() > 0 && newGeometry.height() > 0) {
- m_chart->resize(newGeometry.width(), newGeometry.height());
- }
- }
- QDECLARATIVE_ITEM::geometryChanged(newGeometry, oldGeometry);
-
- // It would be better to trigger the plotAreaChanged signal from QChart::plotAreaChanged or
- // similar. Since that kind of a signal is not clearly needed in the C++ API the work-around is
- // to implement it here for the QML API purposes.
- emit plotAreaChanged(m_chart->plotArea());
-}
-
-#ifdef CHARTS_FOR_QUICK2
-void DeclarativeChart::sceneChanged(QList<QRectF> region)
-{
- Q_UNUSED(region);
-
- if (m_guiThreadId == m_paintThreadId) {
- // Rendering in gui thread, no need for shenannigans, just update
- update();
- } else {
- // Multi-threaded rendering, need to ensure scene is actually rendered in gui thread
- if (!m_updatePending) {
- m_updatePending = true;
- // Do async render to avoid some unnecessary renders.
- QTimer::singleShot(0, this, SLOT(renderScene()));
- }
- }
-}
-
-void DeclarativeChart::renderScene()
-{
- m_updatePending = false;
- m_sceneImageLock.lock();
- delete m_currentSceneImage;
- m_currentSceneImage = new QImage(m_chart->size().toSize(), QImage::Format_ARGB32);
- m_currentSceneImage->fill(Qt::transparent);
- QPainter painter(m_currentSceneImage);
- if (antialiasing())
- painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
- QRect renderRect(QPoint(0, 0), m_chart->size().toSize());
- m_scene->render(&painter, renderRect, renderRect);
- m_sceneImageLock.unlock();
-
- update();
-}
-
-void DeclarativeChart::paint(QPainter *painter)
-{
- if (!m_paintThreadId) {
- m_paintThreadId = QThread::currentThreadId();
- if (m_guiThreadId == m_paintThreadId) {
- // No need for scene image in single threaded rendering, so delete
- // the one that got made by default before the rendering type was
- // detected.
- delete m_currentSceneImage;
- m_currentSceneImage = 0;
- }
- }
-
- if (m_guiThreadId == m_paintThreadId) {
- QRectF renderRect(QPointF(0, 0), m_chart->size());
- m_scene->render(painter, renderRect, renderRect);
- } else {
- m_sceneImageLock.lock();
- if (m_currentSceneImage) {
- QRect imageRect(QPoint(0, 0), m_currentSceneImage->size());
- QRect itemRect(QPoint(0, 0), QSize(width(), height()));
- painter->drawImage(itemRect, *m_currentSceneImage, imageRect);
- }
- m_sceneImageLock.unlock();
- }
-}
-
-void DeclarativeChart::mousePressEvent(QMouseEvent *event)
-{
- m_mousePressScenePoint = event->pos();
- m_mousePressScreenPoint = event->globalPos();
- m_lastMouseMoveScenePoint = m_mousePressScenePoint;
- m_lastMouseMoveScreenPoint = m_mousePressScreenPoint;
- m_mousePressButton = event->button();
- m_mousePressButtons = event->buttons();
-
- QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMousePress);
- mouseEvent.setWidget(0);
- mouseEvent.setButtonDownScenePos(m_mousePressButton, m_mousePressScenePoint);
- mouseEvent.setButtonDownScreenPos(m_mousePressButton, m_mousePressScreenPoint);
- mouseEvent.setScenePos(m_mousePressScenePoint);
- mouseEvent.setScreenPos(m_mousePressScreenPoint);
- mouseEvent.setLastScenePos(m_lastMouseMoveScenePoint);
- mouseEvent.setLastScreenPos(m_lastMouseMoveScreenPoint);
- mouseEvent.setButtons(m_mousePressButtons);
- mouseEvent.setButton(m_mousePressButton);
- mouseEvent.setModifiers(event->modifiers());
- mouseEvent.setAccepted(false);
-
- QApplication::sendEvent(m_scene, &mouseEvent);
-}
-
-void DeclarativeChart::mouseReleaseEvent(QMouseEvent *event)
-{
- QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseRelease);
- mouseEvent.setWidget(0);
- mouseEvent.setButtonDownScenePos(m_mousePressButton, m_mousePressScenePoint);
- mouseEvent.setButtonDownScreenPos(m_mousePressButton, m_mousePressScreenPoint);
- mouseEvent.setScenePos(event->pos());
- mouseEvent.setScreenPos(event->globalPos());
- mouseEvent.setLastScenePos(m_lastMouseMoveScenePoint);
- mouseEvent.setLastScreenPos(m_lastMouseMoveScreenPoint);
- mouseEvent.setButtons(event->buttons());
- mouseEvent.setButton(event->button());
- mouseEvent.setModifiers(event->modifiers());
- mouseEvent.setAccepted(false);
-
- QApplication::sendEvent(m_scene, &mouseEvent);
-
- m_mousePressButtons = event->buttons();
- m_mousePressButton = Qt::NoButton;
-}
-
-void DeclarativeChart::hoverMoveEvent(QHoverEvent *event)
-{
- // Convert hover move to mouse move, since we don't seem to get actual mouse move events.
- // QGraphicsScene generates hover events from mouse move events, so we don't need
- // to pass hover events there.
- QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove);
- mouseEvent.setWidget(0);
- mouseEvent.setButtonDownScenePos(m_mousePressButton, m_mousePressScenePoint);
- mouseEvent.setButtonDownScreenPos(m_mousePressButton, m_mousePressScreenPoint);
- mouseEvent.setScenePos(event->pos());
- // Hover events do not have global pos in them, and the screen position doesn't seem to
- // matter anyway in this use case, so just pass event pos instead of trying to
- // calculate the real screen position.
- mouseEvent.setScreenPos(event->pos());
- mouseEvent.setLastScenePos(m_lastMouseMoveScenePoint);
- mouseEvent.setLastScreenPos(m_lastMouseMoveScreenPoint);
- mouseEvent.setButtons(m_mousePressButtons);
- mouseEvent.setButton(m_mousePressButton);
- mouseEvent.setModifiers(event->modifiers());
- m_lastMouseMoveScenePoint = mouseEvent.scenePos();
- m_lastMouseMoveScreenPoint = mouseEvent.screenPos();
- mouseEvent.setAccepted(false);
-
- QApplication::sendEvent(m_scene, &mouseEvent);
-}
-
-void DeclarativeChart::handleAntialiasingChanged(bool enable)
-{
- setAntialiasing(enable);
-}
-#endif
-
-void DeclarativeChart::setTheme(DeclarativeChart::Theme theme)
-{
- QChart::ChartTheme chartTheme = (QChart::ChartTheme) theme;
- if (chartTheme != m_chart->theme())
- m_chart->setTheme(chartTheme);
-}
-
-DeclarativeChart::Theme DeclarativeChart::theme()
-{
- return (DeclarativeChart::Theme) m_chart->theme();
-}
-
-void DeclarativeChart::setAnimationOptions(DeclarativeChart::Animation animations)
-{
- QChart::AnimationOption animationOptions = (QChart::AnimationOption) animations;
- if (animationOptions != m_chart->animationOptions())
- m_chart->setAnimationOptions(animationOptions);
-}
-
-DeclarativeChart::Animation DeclarativeChart::animationOptions()
-{
- if (m_chart->animationOptions().testFlag(QChart::AllAnimations))
- return DeclarativeChart::AllAnimations;
- else if (m_chart->animationOptions().testFlag(QChart::GridAxisAnimations))
- return DeclarativeChart::GridAxisAnimations;
- else if (m_chart->animationOptions().testFlag(QChart::SeriesAnimations))
- return DeclarativeChart::SeriesAnimations;
- else
- return DeclarativeChart::NoAnimation;
-}
-
-void DeclarativeChart::setTitle(QString title)
-{
- if (title != m_chart->title())
- m_chart->setTitle(title);
-}
-QString DeclarativeChart::title()
-{
- return m_chart->title();
-}
-
-QAbstractAxis *DeclarativeChart::axisX(QAbstractSeries *series)
-{
- QList<QAbstractAxis *> axes = m_chart->axes(Qt::Horizontal, series);
- if (axes.count())
- return axes[0];
- return 0;
-}
-
-QAbstractAxis *DeclarativeChart::axisY(QAbstractSeries *series)
-{
- QList<QAbstractAxis *> axes = m_chart->axes(Qt::Vertical, series);
- if (axes.count())
- return axes[0];
- return 0;
-}
-
-QLegend *DeclarativeChart::legend()
-{
- return m_chart->legend();
-}
-
-void DeclarativeChart::setTitleColor(QColor color)
-{
- QBrush b = m_chart->titleBrush();
- if (color != b.color()) {
- b.setColor(color);
- m_chart->setTitleBrush(b);
- emit titleColorChanged(color);
- }
-}
-
-QFont DeclarativeChart::titleFont() const
-{
- return m_chart->titleFont();
-}
-
-void DeclarativeChart::setTitleFont(const QFont &font)
-{
- m_chart->setTitleFont(font);
-}
-
-QColor DeclarativeChart::titleColor()
-{
- return m_chart->titleBrush().color();
-}
-
-void DeclarativeChart::setBackgroundColor(QColor color)
-{
- QBrush b = m_chart->backgroundBrush();
- if (b.style() != Qt::SolidPattern || color != b.color()) {
- b.setStyle(Qt::SolidPattern);
- b.setColor(color);
- m_chart->setBackgroundBrush(b);
- emit backgroundColorChanged();
- }
-}
-
-QColor DeclarativeChart::backgroundColor()
-{
- return m_chart->backgroundBrush().color();
-}
-
-void QtCommercialChart::DeclarativeChart::setPlotAreaColor(QColor color)
-{
- QBrush b = m_chart->plotAreaBackgroundBrush();
- if (b.style() != Qt::SolidPattern || color != b.color()) {
- b.setStyle(Qt::SolidPattern);
- b.setColor(color);
- m_chart->setPlotAreaBackgroundBrush(b);
- m_chart->setPlotAreaBackgroundVisible(true);
- emit plotAreaColorChanged();
- }
-}
-
-QColor QtCommercialChart::DeclarativeChart::plotAreaColor()
-{
- return m_chart->plotAreaBackgroundBrush().color();
-}
-
-void DeclarativeChart::setLocalizeNumbers(bool localize)
-{
- if (m_chart->localizeNumbers() != localize) {
- m_chart->setLocalizeNumbers(localize);
- emit localizeNumbersChanged();
- }
-}
-
-bool DeclarativeChart::localizeNumbers() const
-{
- return m_chart->localizeNumbers();
-}
-
-void QtCommercialChart::DeclarativeChart::setLocale(const QLocale &locale)
-{
- if (m_chart->locale() != locale) {
- m_chart->setLocale(locale);
- emit localeChanged();
- }
-}
-
-QLocale QtCommercialChart::DeclarativeChart::locale() const
-{
- return m_chart->locale();
-}
-
-int DeclarativeChart::count()
-{
- return m_chart->series().count();
-}
-
-void DeclarativeChart::setDropShadowEnabled(bool enabled)
-{
- if (enabled != m_chart->isDropShadowEnabled()) {
- m_chart->setDropShadowEnabled(enabled);
- dropShadowEnabledChanged(enabled);
- }
-}
-
-bool DeclarativeChart::dropShadowEnabled()
-{
- return m_chart->isDropShadowEnabled();
-}
-
-qreal DeclarativeChart::backgroundRoundness() const
-{
- return m_chart->backgroundRoundness();
-}
-
-void DeclarativeChart::setBackgroundRoundness(qreal diameter)
-{
- if (m_chart->backgroundRoundness() != diameter) {
- m_chart->setBackgroundRoundness(diameter);
- emit backgroundRoundnessChanged(diameter);
- }
-}
-
-qreal DeclarativeChart::topMargin()
-{
- qWarning() << "ChartView.topMargin is deprecated. Use margins instead.";
- return m_chart->margins().top();
-}
-
-qreal DeclarativeChart::bottomMargin()
-{
- qWarning() << "ChartView.bottomMargin is deprecated. Use margins instead.";
- return m_chart->margins().bottom();
-}
-
-qreal DeclarativeChart::leftMargin()
-{
- qWarning() << "ChartView.leftMargin is deprecated. Use margins instead.";
- return m_chart->margins().left();
-}
-
-qreal DeclarativeChart::rightMargin()
-{
- qWarning() << "ChartView.rightMargin is deprecated. Use margins instead.";
- return m_chart->margins().right();
-}
-
-void DeclarativeChart::zoom(qreal factor)
-{
- m_chart->zoom(factor);
-}
-
-void DeclarativeChart::scrollLeft(qreal pixels)
-{
- m_chart->scroll(-pixels, 0);
-}
-
-void DeclarativeChart::scrollRight(qreal pixels)
-{
- m_chart->scroll(pixels, 0);
-}
-
-void DeclarativeChart::scrollUp(qreal pixels)
-{
- m_chart->scroll(0, pixels);
-}
-
-void DeclarativeChart::scrollDown(qreal pixels)
-{
- m_chart->scroll(0, -pixels);
-}
-
-QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> DeclarativeChart::axes()
-{
- return QDECLARATIVE_LIST_PROPERTY<QAbstractAxis>(this, 0,
- &DeclarativeChart::axesAppendFunc,
- &DeclarativeChart::axesCountFunc,
-#ifdef CHARTS_FOR_QUICK2
- &DeclarativeChart::axesAtFunc,
- &DeclarativeChart::axesClearFunc);
-#else
- &DeclarativeChart::axesAtFunc);
-#endif
-}
-
-void DeclarativeChart::axesAppendFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, QAbstractAxis *element)
-{
- // Empty implementation
- Q_UNUSED(list);
- Q_UNUSED(element);
-}
-
-int DeclarativeChart::axesCountFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list)
-{
- if (qobject_cast<DeclarativeChart *>(list->object)) {
- DeclarativeChart *chart = qobject_cast<DeclarativeChart *>(list->object);
- return chart->m_chart->axes(Qt::Horizontal | Qt::Vertical).count();
- }
- return 0;
-}
-
-QAbstractAxis *DeclarativeChart::axesAtFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, int index)
-{
- if (qobject_cast<DeclarativeChart *>(list->object)) {
- DeclarativeChart *chart = qobject_cast<DeclarativeChart *>(list->object);
- QList<QAbstractAxis *> axes = chart->m_chart->axes(Qt::Horizontal | Qt::Vertical, chart->m_chart->series()[0]);
- return axes.at(index);
- }
- return 0;
-}
-
-void DeclarativeChart::axesClearFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list)
-{
- // Empty implementation
- Q_UNUSED(list);
-}
-
-
-QAbstractSeries *DeclarativeChart::series(int index)
-{
- if (index < m_chart->series().count()) {
- return m_chart->series().at(index);
- }
- return 0;
-}
-
-QAbstractSeries *DeclarativeChart::series(QString seriesName)
-{
- foreach (QAbstractSeries *series, m_chart->series()) {
- if (series->name() == seriesName)
- return series;
- }
- return 0;
-}
-
-QAbstractSeries *DeclarativeChart::createSeries(int type, QString name, QAbstractAxis *axisX, QAbstractAxis *axisY)
-{
- QAbstractSeries *series = 0;
-
- switch (type) {
- case DeclarativeChart::SeriesTypeLine:
- series = new DeclarativeLineSeries();
- break;
- case DeclarativeChart::SeriesTypeArea: {
- DeclarativeAreaSeries *area = new DeclarativeAreaSeries();
- area->setUpperSeries(new DeclarativeLineSeries());
- series = area;
- break;
- }
- case DeclarativeChart::SeriesTypeStackedBar:
- series = new DeclarativeStackedBarSeries();
- break;
- case DeclarativeChart::SeriesTypePercentBar:
- series = new DeclarativePercentBarSeries();
- break;
- case DeclarativeChart::SeriesTypeBar:
- series = new DeclarativeBarSeries();
- break;
- case DeclarativeChart::SeriesTypeHorizontalBar:
- series = new DeclarativeHorizontalBarSeries();
- break;
- case DeclarativeChart::SeriesTypeHorizontalPercentBar:
- series = new DeclarativeHorizontalPercentBarSeries();
- break;
- case DeclarativeChart::SeriesTypeHorizontalStackedBar:
- series = new DeclarativeHorizontalStackedBarSeries();
- break;
- case DeclarativeChart::SeriesTypeBoxPlot:
- series = new DeclarativeBoxPlotSeries();
- break;
- case DeclarativeChart::SeriesTypePie:
- series = new DeclarativePieSeries();
- break;
- case DeclarativeChart::SeriesTypeScatter:
- series = new DeclarativeScatterSeries();
- break;
- case DeclarativeChart::SeriesTypeSpline:
- series = new DeclarativeSplineSeries();
- break;
- default:
- qWarning() << "Illegal series type";
- }
-
- if (series) {
- // Connect to axis changed signals (unless this is a pie series)
- if (!qobject_cast<DeclarativePieSeries *>(series)) {
- connect(series, SIGNAL(axisXChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*)));
- connect(series, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*)));
- connect(series, SIGNAL(axisYChanged(QAbstractAxis*)), this, SLOT(handleAxisYSet(QAbstractAxis*)));
- connect(series, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SLOT(handleAxisYRightSet(QAbstractAxis*)));
- }
-
- series->setName(name);
- m_chart->addSeries(series);
-
- if (axisX)
- setAxisX(axisX, series);
- if (axisY)
- setAxisY(axisY, series);
-
- if (series->attachedAxes().count() < 2)
- initializeAxes(series);
- }
-
- return series;
-}
-
-void DeclarativeChart::removeSeries(QAbstractSeries *series)
-{
- if (series)
- m_chart->removeSeries(series);
- else
- qWarning("removeSeries: cannot remove null");
-}
-
-void DeclarativeChart::setAxisX(QAbstractAxis *axis, QAbstractSeries *series)
-{
- if (axis)
- m_chart->setAxisX(axis, series);
-}
-
-void DeclarativeChart::setAxisY(QAbstractAxis *axis, QAbstractSeries *series)
-{
- if (axis)
- m_chart->setAxisY(axis, series);
-}
-
-void DeclarativeChart::createDefaultAxes()
-{
- qWarning() << "ChartView.createDefaultAxes() is deprecated. Axes are created automatically.";
-}
-
-QAbstractAxis *DeclarativeChart::defaultAxis(Qt::Orientation orientation, QAbstractSeries *series)
-{
- if (!series) {
- qWarning() << "No axis type defined for null series";
- return 0;
- }
-
- foreach (QAbstractAxis *existingAxis, m_chart->axes(orientation)) {
- if (existingAxis->type() == series->d_ptr->defaultAxisType(orientation))
- return existingAxis;
- }
-
- switch (series->d_ptr->defaultAxisType(orientation)) {
- case QAbstractAxis::AxisTypeValue:
- return new QValueAxis(this);
- case QAbstractAxis::AxisTypeBarCategory:
- return new QBarCategoryAxis(this);
- case QAbstractAxis::AxisTypeCategory:
- return new QCategoryAxis(this);
-#ifndef QT_ON_ARM
- case QAbstractAxis::AxisTypeDateTime:
- return new QDateTimeAxis(this);
-#endif
- case QAbstractAxis::AxisTypeLogValue:
- return new QLogValueAxis(this);
- default:
- // assume AxisTypeNoAxis
- return 0;
- }
-}
-
-void DeclarativeChart::initializeAxes(QAbstractSeries *series)
-{
- if (qobject_cast<DeclarativeLineSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeLineSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativeScatterSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeScatterSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativeSplineSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeSplineSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativeAreaSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeAreaSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativeBarSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeBarSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativeStackedBarSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeStackedBarSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativePercentBarSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativePercentBarSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativeHorizontalBarSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeHorizontalBarSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativeHorizontalStackedBarSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeHorizontalStackedBarSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativeHorizontalPercentBarSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeHorizontalPercentBarSeries *>(series)->m_axes);
- else if (qobject_cast<DeclarativeBoxPlotSeries *>(series))
- doInitializeAxes(series, qobject_cast<DeclarativeBoxPlotSeries *>(series)->m_axes);
- // else: do nothing
-}
-
-void DeclarativeChart::doInitializeAxes(QAbstractSeries *series, DeclarativeAxes *axes)
-{
- // Initialize axis X
- if (axes->axisX())
- axes->emitAxisXChanged();
- else if (axes->axisXTop())
- axes->emitAxisXTopChanged();
- else
- axes->setAxisX(defaultAxis(Qt::Horizontal, series));
-
- // Initialize axis Y
- if (axes->axisY())
- axes->emitAxisYChanged();
- else if (axes->axisYRight())
- axes->emitAxisYRightChanged();
- else
- axes->setAxisY(defaultAxis(Qt::Vertical, series));
-}
-
-#include "moc_declarativechart.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativechart.h b/plugins/declarative/declarativechart.h
deleted file mode 100644
index a1b40d80..00000000
--- a/plugins/declarative/declarativechart.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVECHART_H
-#define DECLARATIVECHART_H
-
-#include <QtCore/QtGlobal>
-#include "shared_defines.h"
-
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQuick/QQuickItem>
-#include <QtQuick/QQuickPaintedItem>
-#include <QtWidgets/QGraphicsScene>
-#include <QtCore/QMutex>
-#else
-#include <QtDeclarative/QDeclarativeItem>
-#endif
-
-#include "qchart.h"
-#include <QtCore/QLocale>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativeMargins;
-class Domain;
-class DeclarativeAxes;
-
-class DeclarativeChart : public QDECLARATIVE_PAINTED_ITEM
-{
- Q_OBJECT
- Q_PROPERTY(Theme theme READ theme WRITE setTheme)
- Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions)
- Q_PROPERTY(QString title READ title WRITE setTitle)
- Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont)
- Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged)
- Q_PROPERTY(QLegend *legend READ legend CONSTANT)
- Q_PROPERTY(int count READ count)
- Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
- Q_PROPERTY(bool dropShadowEnabled READ dropShadowEnabled WRITE setDropShadowEnabled NOTIFY dropShadowEnabledChanged)
- Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness NOTIFY backgroundRoundnessChanged REVISION 3)
- Q_PROPERTY(qreal topMargin READ topMargin)
- Q_PROPERTY(qreal bottomMargin READ bottomMargin)
- Q_PROPERTY(qreal leftMargin READ leftMargin)
- Q_PROPERTY(qreal rightMargin READ rightMargin)
- Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins NOTIFY minimumMarginsChanged REVISION 1)
- Q_PROPERTY(DeclarativeMargins *margins READ margins NOTIFY marginsChanged REVISION 2)
- Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1)
- Q_PROPERTY(QColor plotAreaColor READ plotAreaColor WRITE setPlotAreaColor NOTIFY plotAreaColorChanged REVISION 3)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QAbstractAxis> axes READ axes REVISION 2)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QAbstractAxis> axes READ axes REVISION 2)
-#endif
- Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers NOTIFY localizeNumbersChanged REVISION 4)
- Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged REVISION 4)
- Q_ENUMS(Animation)
- Q_ENUMS(Theme)
- Q_ENUMS(SeriesType)
-
-public:
- // duplicating enums from QChart to make the QML api namings 1-to-1 with the C++ api
- enum Theme {
- ChartThemeLight = 0,
- ChartThemeBlueCerulean,
- ChartThemeDark,
- ChartThemeBrownSand,
- ChartThemeBlueNcs,
- ChartThemeHighContrast,
- ChartThemeBlueIcy,
- ChartThemeQt
- };
-
- enum Animation {
- NoAnimation = 0x0,
- GridAxisAnimations = 0x1,
- SeriesAnimations = 0x2,
- AllAnimations = 0x3
- };
-
- enum SeriesType {
- SeriesTypeLine,
- SeriesTypeArea,
- SeriesTypeBar,
- SeriesTypeStackedBar,
- SeriesTypePercentBar,
- SeriesTypeBoxPlot,
- SeriesTypePie,
- SeriesTypeScatter,
- SeriesTypeSpline,
- SeriesTypeHorizontalBar,
- SeriesTypeHorizontalStackedBar,
- SeriesTypeHorizontalPercentBar
- };
-
-public:
- DeclarativeChart(QDECLARATIVE_ITEM *parent = 0);
- ~DeclarativeChart();
-
-public: // From parent classes
- void childEvent(QChildEvent *event);
- void componentComplete();
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
-#ifdef CHARTS_FOR_QUICK2
- void paint(QPainter *painter);
-protected:
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void hoverMoveEvent(QHoverEvent *event);
-private Q_SLOTS:
- void handleAntialiasingChanged(bool enable);
- void sceneChanged(QList<QRectF> region);
- void renderScene();
-#endif
-
-public:
- void setTheme(DeclarativeChart::Theme theme);
- DeclarativeChart::Theme theme();
- void setAnimationOptions(DeclarativeChart::Animation animations);
- DeclarativeChart::Animation animationOptions();
- void setTitle(QString title);
- QString title();
- QLegend *legend();
- QFont titleFont() const;
- void setTitleFont(const QFont &font);
- void setTitleColor(QColor color);
- QColor titleColor();
- void setBackgroundColor(QColor color);
- QColor backgroundColor();
- Q_REVISION(3) void setPlotAreaColor(QColor color);
- Q_REVISION(3) QColor plotAreaColor();
- Q_REVISION(4) void setLocalizeNumbers(bool localize);
- Q_REVISION(4) bool localizeNumbers() const;
- Q_REVISION(4) void setLocale(const QLocale &locale);
- Q_REVISION(4) QLocale locale() const;
-
- int count();
- void setDropShadowEnabled(bool enabled);
- bool dropShadowEnabled();
- Q_REVISION(3) qreal backgroundRoundness() const;
- Q_REVISION(3) void setBackgroundRoundness(qreal diameter);
-
- // Margins & plotArea
- qreal topMargin();
- qreal bottomMargin();
- qreal leftMargin();
- qreal rightMargin();
- DeclarativeMargins *minimumMargins() { return m_margins; }
- Q_REVISION(2) DeclarativeMargins *margins() { return m_margins; }
- QRectF plotArea() { return m_chart->plotArea(); }
-
- // Axis handling
- QAbstractAxis *defaultAxis(Qt::Orientation orientation, QAbstractSeries *series);
- void initializeAxes(QAbstractSeries *series);
- void doInitializeAxes(QAbstractSeries *series, DeclarativeAxes *axes);
- QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> axes();
- static void axesAppendFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, QAbstractAxis *element);
- static int axesCountFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list);
- static QAbstractAxis *axesAtFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, int index);
- static void axesClearFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list);
-
-public:
- Q_INVOKABLE QAbstractSeries *series(int index);
- Q_INVOKABLE QAbstractSeries *series(QString seriesName);
- Q_INVOKABLE QAbstractSeries *createSeries(int type, QString name = "", QAbstractAxis *axisX = 0, QAbstractAxis *axisY = 0);
- Q_INVOKABLE void removeSeries(QAbstractSeries *series);
- Q_INVOKABLE void removeAllSeries() { m_chart->removeAllSeries(); }
- Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0);
- Q_INVOKABLE void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0);
- Q_INVOKABLE void createDefaultAxes();
- Q_INVOKABLE QAbstractAxis *axisX(QAbstractSeries *series = 0);
- Q_INVOKABLE QAbstractAxis *axisY(QAbstractSeries *series = 0);
- Q_INVOKABLE void zoom(qreal factor);
- Q_INVOKABLE void scrollLeft(qreal pixels);
- Q_INVOKABLE void scrollRight(qreal pixels);
- Q_INVOKABLE void scrollUp(qreal pixels);
- Q_INVOKABLE void scrollDown(qreal pixels);
-
-Q_SIGNALS:
- void axisLabelsChanged();
- void titleColorChanged(QColor color);
- void backgroundColorChanged();
- void dropShadowEnabledChanged(bool enabled);
- void minimumMarginsChanged();
- Q_REVISION(2) void marginsChanged();
- void plotAreaChanged(QRectF plotArea);
- void seriesAdded(QAbstractSeries *series);
- void seriesRemoved(QAbstractSeries *series);
- Q_REVISION(3) void plotAreaColorChanged();
- Q_REVISION(3) void backgroundRoundnessChanged(qreal diameter);
- Q_REVISION(4) void localizeNumbersChanged();
- Q_REVISION(4) void localeChanged();
-
-private Q_SLOTS:
- void changeMinimumMargins(int top, int bottom, int left, int right);
- void handleAxisXSet(QAbstractAxis *axis);
- void handleAxisYSet(QAbstractAxis *axis);
- void handleAxisXTopSet(QAbstractAxis *axis);
- void handleAxisYRightSet(QAbstractAxis *axis);
- void handleSeriesAdded(QAbstractSeries *series);
-
-protected:
- explicit DeclarativeChart(QChart::ChartType type, QDECLARATIVE_ITEM *parent);
-
-private:
- void initChart(QChart::ChartType type);
- // Extending QChart with DeclarativeChart is not possible because QObject does not support
- // multi inheritance, so we now have a QChart as a member instead
- QChart *m_chart;
-#ifdef CHARTS_FOR_QUICK2
- QGraphicsScene *m_scene;
- QPointF m_mousePressScenePoint;
- QPoint m_mousePressScreenPoint;
- QPointF m_lastMouseMoveScenePoint;
- QPoint m_lastMouseMoveScreenPoint;
- Qt::MouseButton m_mousePressButton;
- Qt::MouseButtons m_mousePressButtons;
- QMutex m_sceneImageLock;
- QImage *m_currentSceneImage;
- bool m_updatePending;
- Qt::HANDLE m_paintThreadId;
- Qt::HANDLE m_guiThreadId;
-#endif
- DeclarativeMargins *m_margins;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVECHART_H
diff --git a/plugins/declarative/declarativelineseries.cpp b/plugins/declarative/declarativelineseries.cpp
deleted file mode 100644
index 61cf4e8e..00000000
--- a/plugins/declarative/declarativelineseries.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativelineseries.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) :
- QLineSeries(parent),
- m_axes(new DeclarativeAxes(this))
-{
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
- connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
- connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
-}
-
-void DeclarativeLineSeries::handleCountChanged(int index)
-{
- Q_UNUSED(index)
- emit countChanged(points().count());
-}
-
-qreal DeclarativeLineSeries::width() const
-{
- return pen().widthF();
-}
-
-void DeclarativeLineSeries::setWidth(qreal width)
-{
- if (width != pen().widthF()) {
- QPen p = pen();
- p.setWidthF(width);
- setPen(p);
- emit widthChanged(width);
- }
-}
-
-Qt::PenStyle DeclarativeLineSeries::style() const
-{
- return pen().style();
-}
-
-void DeclarativeLineSeries::setStyle(Qt::PenStyle style)
-{
- if (style != pen().style()) {
- QPen p = pen();
- p.setStyle(style);
- setPen(p);
- emit styleChanged(style);
- }
-}
-
-Qt::PenCapStyle DeclarativeLineSeries::capStyle() const
-{
- return pen().capStyle();
-}
-
-void DeclarativeLineSeries::setCapStyle(Qt::PenCapStyle capStyle)
-{
- if (capStyle != pen().capStyle()) {
- QPen p = pen();
- p.setCapStyle(capStyle);
- setPen(p);
- emit capStyleChanged(capStyle);
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeLineSeries::declarativeChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeLineSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
-{
- Q_UNUSED(list)
- Q_UNUSED(element)
- // Empty implementation, children are parsed in componentComplete
-}
-
-#include "moc_declarativelineseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativelineseries.h b/plugins/declarative/declarativelineseries.h
deleted file mode 100644
index 3b904f27..00000000
--- a/plugins/declarative/declarativelineseries.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVELINESERIES_H
-#define DECLARATIVELINESERIES_H
-
-#include "qlineseries.h"
-#include "declarativexyseries.h"
-#include "declarativeaxes.h"
-#include "shared_defines.h"
-
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQml/QQmlListProperty>
-#include <QtQml/QQmlParserStatus>
-#else
-#include <QtDeclarative/QDeclarativeListProperty>
-#include <QtDeclarative/QDeclarativeParserStatus>
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
- Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
- Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1)
- Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1)
- Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "declarativeChildren")
-
-public:
- explicit DeclarativeLineSeries(QObject *parent = 0);
- QXYSeries *xySeries() { return this; }
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
- Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
- Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- qreal width() const;
- void setWidth(qreal width);
- Qt::PenStyle style() const;
- void setStyle(Qt::PenStyle style);
- Qt::PenCapStyle capStyle() const;
- void setCapStyle(Qt::PenCapStyle capStyle);
- QDECLARATIVE_LIST_PROPERTY<QObject> declarativeChildren();
-
-public: // from QDeclarativeParserStatus
- void classBegin() { DeclarativeXySeries::classBegin(); }
- void componentComplete() { DeclarativeXySeries::componentComplete(); }
-
-public:
- Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
- Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
- Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); }
- Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
- Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); }
- Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
- Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
- Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
-
-Q_SIGNALS:
- void countChanged(int count);
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
- Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
- Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
- Q_REVISION(1) void widthChanged(qreal width);
- Q_REVISION(1) void styleChanged(Qt::PenStyle style);
- Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle);
-
-public Q_SLOTS:
- static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
- void handleCountChanged(int index);
-
-public:
- DeclarativeAxes *m_axes;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVELINESERIES_H
diff --git a/plugins/declarative/declarativemargins.cpp b/plugins/declarative/declarativemargins.cpp
deleted file mode 100644
index 2010b3be..00000000
--- a/plugins/declarative/declarativemargins.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativemargins.h"
-#include <QDataStream>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-#ifdef QDOC_QT5
-/*!
- \qmltype Margins
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/margins.qdocinc
-*/
-#else
-/*!
- \qmlclass Margins
-
- \include ../doc/src/margins.qdocinc
-*/
-#endif
-
-/*!
- \qmlproperty int Margins::top
- The top margin.
-*/
-
-/*!
- \qmlproperty int Margins::bottom
- The bottom margin.
-*/
-
-/*!
- \qmlproperty int Margins::left
- The left margin.
-*/
-
-/*!
- \qmlproperty int Margins::right
- The right margin.
-*/
-
-DeclarativeMargins::DeclarativeMargins(QObject *parent) :
- QObject(parent)
-{
- QMargins::setTop(0);
- QMargins::setBottom(0);
- QMargins::setLeft(0);
- QMargins::setRight(0);
-}
-
-void DeclarativeMargins::setTop(int top)
-{
- if (top < 0) {
- qWarning() << "Cannot set top margin to a negative value:" << top;
- } else {
- if (top != QMargins::top()) {
- QMargins::setTop(top);
- emit topChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right());
- }
- }
-}
-
-void DeclarativeMargins::setBottom(int bottom)
-{
- if (bottom < 0) {
- qWarning() << "Cannot set bottom margin to a negative value:" << bottom;
- } else {
- if (bottom != QMargins::bottom()) {
- QMargins::setBottom(bottom);
- emit bottomChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right());
- }
- }
-}
-
-void DeclarativeMargins::setLeft(int left)
-{
- if (left < 0) {
- qWarning() << "Cannot set left margin to a negative value:" << left;
- } else {
- if (left != QMargins::left()) {
- QMargins::setLeft(left);
- emit leftChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right());
- }
- }
-}
-
-void DeclarativeMargins::setRight(int right)
-{
- if (right < 0) {
- qWarning() << "Cannot set left margin to a negative value:" << right;
- } else {
- if (right != QMargins::right()) {
- QMargins::setRight(right);
- emit rightChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right());
- }
- }
-}
-
-#include "moc_declarativemargins.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativemargins.h b/plugins/declarative/declarativemargins.h
deleted file mode 100644
index 56823eaa..00000000
--- a/plugins/declarative/declarativemargins.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVE_MARGINS_H
-#define DECLARATIVE_MARGINS_H
-
-#include "qchartglobal.h"
-#include <QObject>
-#include <QMargins>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativeMargins : public QObject, public QMargins
-{
- Q_OBJECT
- Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged)
- Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
- Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged)
- Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightChanged)
-
-public:
- explicit DeclarativeMargins(QObject *parent = 0);
- void setTop(int top);
- void setBottom(int bottom);
- void setLeft(int left);
- void setRight(int right);
-
-Q_SIGNALS:
- void topChanged(int top, int bottom, int left, int right);
- void bottomChanged(int top, int bottom, int left, int right);
- void leftChanged(int top, int bottom, int left, int right);
- void rightChanged(int top, int bottom, int left, int right);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVE_MARGINS_H
diff --git a/plugins/declarative/declarativepieseries.cpp b/plugins/declarative/declarativepieseries.cpp
deleted file mode 100644
index 9107c573..00000000
--- a/plugins/declarative/declarativepieseries.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativepieseries.h"
-#include "qpieslice.h"
-#include "qvpiemodelmapper.h"
-#include "qhpiemodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-DeclarativePieSlice::DeclarativePieSlice(QObject *parent)
- : QPieSlice(parent)
-{
- connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
-}
-
-QString DeclarativePieSlice::brushFilename() const
-{
- return m_brushFilename;
-}
-
-void DeclarativePieSlice::setBrushFilename(const QString &brushFilename)
-{
- QImage brushImage(brushFilename);
- if (QPieSlice::brush().textureImage() != brushImage) {
- QBrush brush = QPieSlice::brush();
- brush.setTextureImage(brushImage);
- QPieSlice::setBrush(brush);
- m_brushFilename = brushFilename;
- m_brushImage = brushImage;
- emit brushFilenameChanged(brushFilename);
- }
-}
-
-void DeclarativePieSlice::handleBrushChanged()
-{
- // If the texture image of the brush has changed along the brush
- // the brush file name needs to be cleared.
- if (!m_brushFilename.isEmpty() && QPieSlice::brush().textureImage() != m_brushImage) {
- m_brushFilename.clear();
- emit brushFilenameChanged(QString(""));
- }
-}
-
-// Declarative pie series =========================================================================
-DeclarativePieSeries::DeclarativePieSeries(QDECLARATIVE_ITEM *parent) :
- QPieSeries(parent)
-{
- connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>)));
- connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>)));
-}
-
-void DeclarativePieSeries::classBegin()
-{
-}
-
-void DeclarativePieSeries::componentComplete()
-{
- foreach (QObject *child, children()) {
- if (qobject_cast<QPieSlice *>(child)) {
- QPieSeries::append(qobject_cast<QPieSlice *>(child));
- } else if (qobject_cast<QVPieModelMapper *>(child)) {
- QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child);
- mapper->setSeries(this);
- } else if (qobject_cast<QHPieModelMapper *>(child)) {
- QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child);
- mapper->setSeries(this);
- }
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativePieSeries::seriesChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativePieSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
-{
- // Empty implementation; the children are parsed in componentComplete instead
- Q_UNUSED(list);
- Q_UNUSED(element);
-}
-
-QPieSlice *DeclarativePieSeries::at(int index)
-{
- QList<QPieSlice *> sliceList = slices();
- if (index >= 0 && index < sliceList.count())
- return sliceList[index];
-
- return 0;
-}
-
-QPieSlice *DeclarativePieSeries::find(QString label)
-{
- foreach (QPieSlice *slice, slices()) {
- if (slice->label() == label)
- return slice;
- }
- return 0;
-}
-
-DeclarativePieSlice *DeclarativePieSeries::append(QString label, qreal value)
-{
- DeclarativePieSlice *slice = new DeclarativePieSlice(this);
- slice->setLabel(label);
- slice->setValue(value);
- if (QPieSeries::append(slice))
- return slice;
- delete slice;
- return 0;
-}
-
-bool DeclarativePieSeries::remove(QPieSlice *slice)
-{
- return QPieSeries::remove(slice);
-}
-
-void DeclarativePieSeries::clear()
-{
- QPieSeries::clear();
-}
-
-void DeclarativePieSeries::handleAdded(QList<QPieSlice *> slices)
-{
- foreach (QPieSlice *slice, slices)
- emit sliceAdded(slice);
-}
-
-void DeclarativePieSeries::handleRemoved(QList<QPieSlice *> slices)
-{
- foreach (QPieSlice *slice, slices)
- emit sliceRemoved(slice);
-}
-
-#include "moc_declarativepieseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativepieseries.h b/plugins/declarative/declarativepieseries.h
deleted file mode 100644
index c95d90be..00000000
--- a/plugins/declarative/declarativepieseries.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVEPIESERIES_H
-#define DECLARATIVEPIESERIES_H
-
-#include "qpieseries.h"
-#include "qpieslice.h"
-#include "shared_defines.h"
-
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQuick/QQuickItem>
-#include <QtQml/QQmlParserStatus>
-#else
-#include <QtDeclarative/QDeclarativeItem>
-#include <QtDeclarative/QDeclarativeParserStatus>
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativePieSlice : public QPieSlice
-{
- Q_OBJECT
- Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged)
-
-public:
- explicit DeclarativePieSlice(QObject *parent = 0);
- QString brushFilename() const;
- void setBrushFilename(const QString &brushFilename);
-
-Q_SIGNALS:
- void brushFilenameChanged(const QString &brushFilename);
-
-private Q_SLOTS:
- void handleBrushChanged();
-
-private:
- QString m_brushFilename;
- QImage m_brushImage;
-};
-
-class DeclarativePieSeries : public QPieSeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
- Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "seriesChildren")
-
-public:
- explicit DeclarativePieSeries(QDECLARATIVE_ITEM *parent = 0);
- QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
- Q_INVOKABLE QPieSlice *at(int index);
- Q_INVOKABLE QPieSlice *find(QString label);
- Q_INVOKABLE DeclarativePieSlice *append(QString label, qreal value);
- Q_INVOKABLE bool remove(QPieSlice *slice);
- Q_INVOKABLE void clear();
-
-public:
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- void sliceAdded(QPieSlice *slice);
- void sliceRemoved(QPieSlice *slice);
-
-public Q_SLOTS:
- static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
- void handleAdded(QList<QPieSlice *> slices);
- void handleRemoved(QList<QPieSlice *> slices);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVEPIESERIES_H
diff --git a/plugins/declarative/declarativepolarchart.cpp b/plugins/declarative/declarativepolarchart.cpp
deleted file mode 100644
index f1c937a4..00000000
--- a/plugins/declarative/declarativepolarchart.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativepolarchart.h"
-#include "qchart.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-#ifdef QDOC_QT5
-/*!
- \qmltype PolarChartView
- \instantiates DeclarativePolarChart
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/declarativepolarchart.qdocinc
-*/
-#else
-/*!
- \qmlclass PolarChartView DeclarativePolarChart
-
- \include ../doc/src/declarativepolarchart.qdocinc
-*/
-#endif
-
-DeclarativePolarChart::DeclarativePolarChart(QDECLARATIVE_ITEM *parent)
- : DeclarativeChart(QChart::ChartTypePolar, parent)
-{
-}
-
-DeclarativePolarChart::~DeclarativePolarChart()
-{
-}
-
-#include "moc_declarativepolarchart.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativepolarchart.h b/plugins/declarative/declarativepolarchart.h
deleted file mode 100644
index 3790dc71..00000000
--- a/plugins/declarative/declarativepolarchart.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVEPOLARCHART_H
-#define DECLARATIVEPOLARCHART_H
-
-#include <QtCore/QtGlobal>
-#include "shared_defines.h"
-
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQuick/QQuickItem>
-#else
-#include <QtDeclarative/QDeclarativeItem>
-#endif
-
-#include "declarativechart.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativePolarChart : public DeclarativeChart
-{
- Q_OBJECT
-public:
- DeclarativePolarChart(QDECLARATIVE_ITEM *parent = 0);
- ~DeclarativePolarChart();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVEPOLARCHART_H
diff --git a/plugins/declarative/declarativescatterseries.cpp b/plugins/declarative/declarativescatterseries.cpp
deleted file mode 100644
index 9314db4d..00000000
--- a/plugins/declarative/declarativescatterseries.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativescatterseries.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
- QScatterSeries(parent),
- m_axes(new DeclarativeAxes(this))
-{
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
- connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
- connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
- connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
-}
-
-void DeclarativeScatterSeries::handleCountChanged(int index)
-{
- Q_UNUSED(index)
- emit countChanged(QScatterSeries::count());
-}
-
-qreal DeclarativeScatterSeries::borderWidth() const
-{
- return pen().widthF();
-}
-
-void DeclarativeScatterSeries::setBorderWidth(qreal width)
-{
- if (width != pen().widthF()) {
- QPen p = pen();
- p.setWidthF(width);
- setPen(p);
- emit borderWidthChanged(width);
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeScatterSeries::declarativeChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeScatterSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
-{
- Q_UNUSED(list)
- Q_UNUSED(element)
- // Empty implementation, children are parsed in componentComplete
-}
-
-QString DeclarativeScatterSeries::brushFilename() const
-{
- return m_brushFilename;
-}
-
-void DeclarativeScatterSeries::setBrushFilename(const QString &brushFilename)
-{
- QImage brushImage(brushFilename);
- if (QScatterSeries::brush().textureImage() != brushImage) {
- QBrush brush = QScatterSeries::brush();
- brush.setTextureImage(brushImage);
- QScatterSeries::setBrush(brush);
- m_brushFilename = brushFilename;
- m_brushImage = brushImage;
- emit brushFilenameChanged(brushFilename);
- }
-}
-
-void DeclarativeScatterSeries::setBrush(const QBrush &brush)
-{
- QScatterSeries::setBrush(brush);
- emit brushChanged();
-}
-
-QBrush DeclarativeScatterSeries::brush() const
-{
- return QScatterSeries::brush();
-}
-
-void DeclarativeScatterSeries::handleBrushChanged()
-{
- // If the texture image of the brush has changed along the brush
- // the brush file name needs to be cleared.
- if (!m_brushFilename.isEmpty() && QScatterSeries::brush().textureImage() != m_brushImage) {
- m_brushFilename.clear();
- emit brushFilenameChanged(QString(""));
- }
-}
-
-#include "moc_declarativescatterseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativescatterseries.h b/plugins/declarative/declarativescatterseries.h
deleted file mode 100644
index 73b1c0c4..00000000
--- a/plugins/declarative/declarativescatterseries.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVESCATTERSERIES_H
-#define DECLARATIVESCATTERSERIES_H
-
-#include "qscatterseries.h"
-#include "declarativexyseries.h"
-#include "declarativeaxes.h"
-#include "shared_defines.h"
-
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQml/QQmlListProperty>
-#include <QtQml/QQmlParserStatus>
-#else
-#include <QtDeclarative/QDeclarativeListProperty>
-#include <QtDeclarative/QDeclarativeParserStatus>
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
- Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
- Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
-#endif
- Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4)
- Q_CLASSINFO("DefaultProperty", "declarativeChildren")
-
-public:
- explicit DeclarativeScatterSeries(QObject *parent = 0);
- QXYSeries *xySeries() { return this; }
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
- Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
- Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- qreal borderWidth() const;
- void setBorderWidth(qreal borderWidth);
- QDECLARATIVE_LIST_PROPERTY<QObject> declarativeChildren();
- QString brushFilename() const;
- void setBrushFilename(const QString &brushFilename);
- void setBrush(const QBrush &brush);
- QBrush brush() const;
-
-public: // from QDeclarativeParserStatus
- void classBegin() { DeclarativeXySeries::classBegin(); }
- void componentComplete() { DeclarativeXySeries::componentComplete(); }
-
-public:
- Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
- Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
- Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); }
- Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
- Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); }
- Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
- Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
- Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
-
-Q_SIGNALS:
- void countChanged(int count);
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(1) void borderWidthChanged(qreal width);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
- Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
- Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
- Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename);
- Q_REVISION(4) void brushChanged();
-
-public Q_SLOTS:
- static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
- void handleCountChanged(int index);
-
-private Q_SLOTS:
- void handleBrushChanged();
-
-public:
- DeclarativeAxes *m_axes;
-
-private:
- QString m_brushFilename;
- QImage m_brushImage;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVESCATTERSERIES_H
diff --git a/plugins/declarative/declarativesplineseries.cpp b/plugins/declarative/declarativesplineseries.cpp
deleted file mode 100644
index d099f86b..00000000
--- a/plugins/declarative/declarativesplineseries.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativesplineseries.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) :
- QSplineSeries(parent),
- m_axes(new DeclarativeAxes(this))
-{
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
- connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
- connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
- connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
-}
-
-void DeclarativeSplineSeries::handleCountChanged(int index)
-{
- Q_UNUSED(index)
- emit countChanged(points().count());
-}
-
-qreal DeclarativeSplineSeries::width() const
-{
- return pen().widthF();
-}
-
-void DeclarativeSplineSeries::setWidth(qreal width)
-{
- if (width != pen().widthF()) {
- QPen p = pen();
- p.setWidthF(width);
- setPen(p);
- emit widthChanged(width);
- }
-}
-
-Qt::PenStyle DeclarativeSplineSeries::style() const
-{
- return pen().style();
-}
-
-void DeclarativeSplineSeries::setStyle(Qt::PenStyle style)
-{
- if (style != pen().style()) {
- QPen p = pen();
- p.setStyle(style);
- setPen(p);
- emit styleChanged(style);
- }
-}
-
-Qt::PenCapStyle DeclarativeSplineSeries::capStyle() const
-{
- return pen().capStyle();
-}
-
-void DeclarativeSplineSeries::setCapStyle(Qt::PenCapStyle capStyle)
-{
- if (capStyle != pen().capStyle()) {
- QPen p = pen();
- p.setCapStyle(capStyle);
- setPen(p);
- emit capStyleChanged(capStyle);
- }
-}
-
-QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeSplineSeries::declarativeChildren()
-{
- return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS);
-}
-
-void DeclarativeSplineSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
-{
- Q_UNUSED(list)
- Q_UNUSED(element)
- // Empty implementation, children are parsed in componentComplete
-}
-
-#include "moc_declarativesplineseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativesplineseries.h b/plugins/declarative/declarativesplineseries.h
deleted file mode 100644
index a47e0579..00000000
--- a/plugins/declarative/declarativesplineseries.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVESPLINESERIES_H
-#define DECLARATIVESPLINESERIES_H
-
-#include "qsplineseries.h"
-#include "declarativexyseries.h"
-#include "declarativeaxes.h"
-#include "shared_defines.h"
-
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQml/QQmlListProperty>
-#include <QtQml/QQmlParserStatus>
-#else
-#include <QtDeclarative/QDeclarativeListProperty>
-#include <QtDeclarative/QDeclarativeParserStatus>
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS
-{
- Q_OBJECT
-#ifdef CHARTS_FOR_QUICK2
- Q_INTERFACES(QQmlParserStatus)
-#else
- Q_INTERFACES(QDeclarativeParserStatus)
-#endif
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
- Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
- Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
- Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
- Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1)
- Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1)
- Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1)
-#ifdef CHARTS_FOR_QUICK2
- Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
-#else
- Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
-#endif
- Q_CLASSINFO("DefaultProperty", "declarativeChildren")
-
-public:
- explicit DeclarativeSplineSeries(QObject *parent = 0);
- QXYSeries *xySeries() { return this; }
- QAbstractAxis *axisX() { return m_axes->axisX(); }
- void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- QAbstractAxis *axisY() { return m_axes->axisY(); }
- void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
- Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
- Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
- Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
- Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
- Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
- Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
- qreal width() const;
- void setWidth(qreal width);
- Qt::PenStyle style() const;
- void setStyle(Qt::PenStyle style);
- Qt::PenCapStyle capStyle() const;
- void setCapStyle(Qt::PenCapStyle capStyle);
- QDECLARATIVE_LIST_PROPERTY<QObject> declarativeChildren();
-
-public: // from QDeclarativeParserStatus
- void classBegin() { DeclarativeXySeries::classBegin(); }
- void componentComplete() { DeclarativeXySeries::componentComplete(); }
-
-public:
- Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
- Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
- Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); }
- Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
- Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); }
- Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
- Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
- Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
-
-Q_SIGNALS:
- void countChanged(int count);
- Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
- Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
- Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
- Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
- Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
- Q_REVISION(1) void widthChanged(qreal width);
- Q_REVISION(1) void styleChanged(Qt::PenStyle style);
- Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle);
-
-public Q_SLOTS:
- static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
- void handleCountChanged(int index);
-
-public:
- DeclarativeAxes *m_axes;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVESPLINESERIES_H
diff --git a/plugins/declarative/declarativexypoint.cpp b/plugins/declarative/declarativexypoint.cpp
deleted file mode 100644
index b61ad2e4..00000000
--- a/plugins/declarative/declarativexypoint.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "declarativexypoint.h"
-#include <QDataStream>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-#ifdef QDOC_QT5
-/*!
- \qmltype XYPoint
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/declarativexypoint.qdocinc
-*/
-#else
-/*!
- \qmlclass XYPoint QPointF
-
- \include ../doc/src/declarativexypoint.qdocinc
-*/
-#endif
-
-/*!
- \qmlproperty real XYPoint::x
- The x-coordinate of the point.
-*/
-
-/*!
- \qmlproperty real XYPoint::y
- The y-coordinate of the point.
-*/
-
-DeclarativeXYPoint::DeclarativeXYPoint(QObject *parent) :
- QObject(parent)
-{
- setX(0.0);
- setY(0.0);
-}
-
-#include "moc_declarativexypoint.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativexypoint.h b/plugins/declarative/declarativexypoint.h
deleted file mode 100644
index 70d04185..00000000
--- a/plugins/declarative/declarativexypoint.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVE_XY_POINT_H
-#define DECLARATIVE_XY_POINT_H
-
-#include "qchartglobal.h"
-#include <QObject>
-#include <QPointF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class DeclarativeXYPoint : public QObject, public QPointF
-{
- Q_OBJECT
- Q_PROPERTY(qreal x READ x WRITE setX)
- Q_PROPERTY(qreal y READ y WRITE setY)
-
-public:
- explicit DeclarativeXYPoint(QObject *parent = 0);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVE_XY_POINT_H
diff --git a/plugins/declarative/declarativexyseries.cpp b/plugins/declarative/declarativexyseries.cpp
deleted file mode 100644
index 5ff69c50..00000000
--- a/plugins/declarative/declarativexyseries.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "declarativexyseries.h"
-#include "declarativexypoint.h"
-#include "qvxymodelmapper.h"
-#include "qhxymodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-DeclarativeXySeries::DeclarativeXySeries()
-{
-}
-
-DeclarativeXySeries::~DeclarativeXySeries()
-{
-}
-
-void DeclarativeXySeries::classBegin()
-{
-}
-
-void DeclarativeXySeries::componentComplete()
-{
- QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
- Q_ASSERT(series);
-
- foreach (QObject *child, series->children()) {
- if (qobject_cast<DeclarativeXYPoint *>(child)) {
- DeclarativeXYPoint *point = qobject_cast<DeclarativeXYPoint *>(child);
- series->append(point->x(), point->y());
- } else if (qobject_cast<QVXYModelMapper *>(child)) {
- QVXYModelMapper *mapper = qobject_cast<QVXYModelMapper *>(child);
- mapper->setSeries(series);
- } else if (qobject_cast<QHXYModelMapper *>(child)) {
- QHXYModelMapper *mapper = qobject_cast<QHXYModelMapper *>(child);
- mapper->setSeries(series);
- }
- }
-}
-
-void DeclarativeXySeries::append(qreal x, qreal y)
-{
- QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
- Q_ASSERT(series);
- series->append(x, y);
-}
-
-void DeclarativeXySeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
-{
- QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
- Q_ASSERT(series);
- series->replace(oldX, oldY, newX, newY);
-}
-
-void DeclarativeXySeries::replace(int index, qreal newX, qreal newY)
-{
- QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
- Q_ASSERT(series);
- series->replace(index, newX, newY);
-}
-
-void DeclarativeXySeries::remove(qreal x, qreal y)
-{
- QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
- Q_ASSERT(series);
- series->remove(x, y);
-}
-
-void DeclarativeXySeries::remove(int index)
-{
- QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
- Q_ASSERT(series);
- series->remove(index);
-}
-
-void DeclarativeXySeries::insert(int index, qreal x, qreal y)
-{
- QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
- Q_ASSERT(series);
- series->insert(index, QPointF(x, y));
-}
-
-void DeclarativeXySeries::clear()
-{
- QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
- Q_ASSERT(series);
- series->clear();
-}
-
-QPointF DeclarativeXySeries::at(int index)
-{
- QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
- Q_ASSERT(series);
- if (index >= 0 || index < series->count())
- return series->points().at(index);
- return QPointF(0, 0);
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativexyseries.h b/plugins/declarative/declarativexyseries.h
deleted file mode 100644
index 8ac8dd27..00000000
--- a/plugins/declarative/declarativexyseries.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DECLARATIVE_XY_SERIES_H
-#define DECLARATIVE_XY_SERIES_H
-
-#include <QXYSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QChart;
-class QAbstractSeries;
-
-class DeclarativeXySeries
-{
-public:
- explicit DeclarativeXySeries();
- ~DeclarativeXySeries();
-
-public:
- void classBegin();
- void componentComplete();
- virtual QXYSeries *xySeries() = 0;
-
- void append(qreal x, qreal y);
- void replace(qreal oldX, qreal oldY, qreal newX, qreal newY);
- void replace(int index, qreal newX, qreal newY);
- void remove(qreal x, qreal y);
- void remove(int index);
- void insert(int index, qreal x, qreal y);
- void clear();
- QPointF at(int index);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // DECLARATIVE_XY_SERIES_H
diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp
deleted file mode 100644
index 1dad0dc0..00000000
--- a/plugins/declarative/plugin.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qchart.h"
-#include "qabstractaxis.h"
-#include "qvalueaxis.h"
-#include "qlogvalueaxis.h"
-#include "declarativecategoryaxis.h"
-#include "qbarcategoryaxis.h"
-#include "declarativechart.h"
-#include "declarativepolarchart.h"
-#include "declarativexypoint.h"
-#include "declarativelineseries.h"
-#include "declarativesplineseries.h"
-#include "declarativeareaseries.h"
-#include "declarativescatterseries.h"
-#include "declarativebarseries.h"
-#include "declarativeboxplotseries.h"
-#include "declarativepieseries.h"
-#include "declarativeaxes.h"
-#include "qvxymodelmapper.h"
-#include "qhxymodelmapper.h"
-#include "qhpiemodelmapper.h"
-#include "qvpiemodelmapper.h"
-#include "qhbarmodelmapper.h"
-#include "qvbarmodelmapper.h"
-#include "declarativemargins.h"
-#include "qarealegendmarker.h"
-#include "qbarlegendmarker.h"
-#include "qpielegendmarker.h"
-#include "qxylegendmarker.h"
-#include "qboxplotmodelmapper.h"
-#include "qvboxplotmodelmapper.h"
-#ifndef QT_ON_ARM
- #include "qdatetimeaxis.h"
-#endif
-#include "shared_defines.h"
-#include <QAbstractItemModel>
-#ifdef CHARTS_FOR_QUICK2
-#include <QtQml/QQmlExtensionPlugin>
-#else
-#include <QtDeclarative/qdeclarativeextensionplugin.h>
-#include <QtDeclarative/qdeclarative.h>
-#endif
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-Q_DECLARE_METATYPE(QList<QPieSlice *>)
-Q_DECLARE_METATYPE(QList<QBarSet *>)
-Q_DECLARE_METATYPE(QList<QAbstractAxis *>)
-
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
-
-Q_DECLARE_METATYPE(DeclarativeChart *)
-Q_DECLARE_METATYPE(DeclarativePolarChart *)
-Q_DECLARE_METATYPE(DeclarativeMargins *)
-Q_DECLARE_METATYPE(DeclarativeAreaSeries *)
-Q_DECLARE_METATYPE(DeclarativeBarSeries *)
-Q_DECLARE_METATYPE(DeclarativeBarSet *)
-Q_DECLARE_METATYPE(DeclarativeBoxPlotSeries *)
-Q_DECLARE_METATYPE(DeclarativeBoxSet *)
-Q_DECLARE_METATYPE(DeclarativeLineSeries *)
-Q_DECLARE_METATYPE(DeclarativePieSeries *)
-Q_DECLARE_METATYPE(DeclarativePieSlice *)
-Q_DECLARE_METATYPE(DeclarativeScatterSeries *)
-Q_DECLARE_METATYPE(DeclarativeSplineSeries *)
-
-Q_DECLARE_METATYPE(QAbstractAxis *)
-Q_DECLARE_METATYPE(QValueAxis *)
-Q_DECLARE_METATYPE(QBarCategoryAxis *)
-Q_DECLARE_METATYPE(QCategoryAxis *)
-Q_DECLARE_METATYPE(QDateTimeAxis *)
-Q_DECLARE_METATYPE(QLogValueAxis *)
-
-Q_DECLARE_METATYPE(QLegend *)
-Q_DECLARE_METATYPE(QLegendMarker *)
-Q_DECLARE_METATYPE(QAreaLegendMarker *)
-Q_DECLARE_METATYPE(QBarLegendMarker *)
-Q_DECLARE_METATYPE(QPieLegendMarker *)
-
-Q_DECLARE_METATYPE(QHPieModelMapper *)
-Q_DECLARE_METATYPE(QHXYModelMapper *)
-Q_DECLARE_METATYPE(QPieModelMapper *)
-Q_DECLARE_METATYPE(QHBarModelMapper *)
-Q_DECLARE_METATYPE(QBarModelMapper *)
-Q_DECLARE_METATYPE(QVBarModelMapper *)
-Q_DECLARE_METATYPE(QVPieModelMapper *)
-Q_DECLARE_METATYPE(QVXYModelMapper *)
-Q_DECLARE_METATYPE(QXYLegendMarker *)
-Q_DECLARE_METATYPE(QXYModelMapper *)
-Q_DECLARE_METATYPE(QBoxPlotModelMapper *)
-Q_DECLARE_METATYPE(QVBoxPlotModelMapper *)
-
-
-Q_DECLARE_METATYPE(QAbstractSeries *)
-Q_DECLARE_METATYPE(QXYSeries *)
-Q_DECLARE_METATYPE(QAbstractBarSeries *)
-Q_DECLARE_METATYPE(QBarSeries *)
-Q_DECLARE_METATYPE(QBarSet *)
-Q_DECLARE_METATYPE(QAreaSeries *)
-Q_DECLARE_METATYPE(QHorizontalBarSeries *)
-Q_DECLARE_METATYPE(QHorizontalPercentBarSeries *)
-Q_DECLARE_METATYPE(QHorizontalStackedBarSeries *)
-Q_DECLARE_METATYPE(QLineSeries *)
-Q_DECLARE_METATYPE(QPercentBarSeries *)
-Q_DECLARE_METATYPE(QPieSeries *)
-Q_DECLARE_METATYPE(QPieSlice *)
-Q_DECLARE_METATYPE(QScatterSeries *)
-Q_DECLARE_METATYPE(QSplineSeries *)
-Q_DECLARE_METATYPE(QStackedBarSeries *)
-
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartQmlPlugin : public QDECLARATIVE_EXTENSION_PLUGIN
-{
- Q_OBJECT
-
-#ifdef CHARTS_FOR_QUICK2
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
-#else
-# if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface")
-# endif
-#endif
-
-public:
- virtual void registerTypes(const char *uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart"));
-
- qRegisterMetaType<QList<QPieSlice *> >();
- qRegisterMetaType<QList<QBarSet *> >();
- qRegisterMetaType<QList<QAbstractAxis *> >();
-
- // QtCommercial.Chart 1.0
- qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
- qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
- qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
- qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
- qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
- qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
- qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
- qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
- qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
- qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
- qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
- qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
- qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
- qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
- qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
- qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
- qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
- qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
-
- qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis");
- qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis");
- qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
- QLatin1String("Trying to create uncreatable: Legend."));
- qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
- QLatin1String("Trying to create uncreatable: XYSeries."));
- qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
- QLatin1String("Trying to create uncreatable: AbstractItemModel."));
- qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
- QLatin1String("Trying to create uncreatable: XYModelMapper."));
- qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
- QLatin1String("Trying to create uncreatable: PieModelMapper."));
- qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
- QLatin1String("Trying to create uncreatable: BarModelMapper."));
- qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
- QLatin1String("Trying to create uncreatable: AbstractSeries."));
- qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
- QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
- qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
- QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
- qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase",
- QLatin1String("Trying to create uncreatable: BarsetBase."));
- qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries",
- QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
- qmlRegisterUncreatableType<DeclarativeAxes>(uri, 1, 0, "DeclarativeAxes",
- QLatin1String("Trying to create uncreatable: DeclarativeAxes."));
-
- // QtCommercial.Chart 1.1
- qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView");
- qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries");
- qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries");
- qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries");
- qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries");
- qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries");
- qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries");
- qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries");
- qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries");
- qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries");
- qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
- qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
- qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
- qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis");
-#ifndef QT_ON_ARM
- qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
-#endif
- qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis");
- qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange");
- qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis");
- qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins",
- QLatin1String("Trying to create uncreatable: Margins."));
-
- // QtCommercial.Chart 1.2
- qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView");
- qmlRegisterType<DeclarativeScatterSeries, 2>(uri, 1, 2, "ScatterSeries");
- qmlRegisterType<DeclarativeLineSeries, 2>(uri, 1, 2, "LineSeries");
- qmlRegisterType<DeclarativeSplineSeries, 2>(uri, 1, 2, "SplineSeries");
- qmlRegisterType<DeclarativeAreaSeries, 2>(uri, 1, 2, "AreaSeries");
- qmlRegisterType<DeclarativeBarSeries, 2>(uri, 1, 2, "BarSeries");
- qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 1, 2, "StackedBarSeries");
- qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 1, 2, "PercentBarSeries");
- qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 1, 2, "HorizontalBarSeries");
- qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 1, 2, "HorizontalStackedBarSeries");
- qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 1, 2, "HorizontalPercentBarSeries");
-
- // QtCommercial.Chart 1.3
- qmlRegisterType<DeclarativeChart, 3>(uri, 1, 3, "ChartView");
- qmlRegisterType<DeclarativePolarChart, 1>(uri, 1, 3, "PolarChartView");
- qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 1, 3, "SplineSeries");
- qmlRegisterType<DeclarativeScatterSeries, 3>(uri, 1, 3, "ScatterSeries");
- qmlRegisterType<DeclarativeLineSeries, 3>(uri, 1, 3, "LineSeries");
- qmlRegisterType<DeclarativeAreaSeries, 3>(uri, 1, 3, "AreaSeries");
- qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis");
- qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries");
- qmlRegisterType<DeclarativeBoxSet>(uri, 1, 3, "BoxSet");
-
- // QtCommercial.Chart 1.4
- qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 1, 4, "AreaSeries");
- qmlRegisterType<DeclarativeBarSet, 2>(uri, 1, 4, "BarSet");
- qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 1, 4, "BoxPlotSeries");
- qmlRegisterType<DeclarativeBoxSet, 1>(uri, 1, 4, "BoxSet");
- qmlRegisterType<DeclarativePieSlice>(uri, 1, 4, "PieSlice");
- qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 1, 4, "ScatterSeries");
-
- // QtCommercial.Chart 2.0
- qmlRegisterType<QVBoxPlotModelMapper>(uri, 2, 0, "VBoxPlotModelMapper");
- qmlRegisterUncreatableType<QBoxPlotModelMapper>(uri, 2, 0, "BoxPlotModelMapper",
- QLatin1String("Trying to create uncreatable: BoxPlotModelMapper."));
-
- // Re-register latest revisions for 2.0
- qmlRegisterType<DeclarativeChart, 4>(uri, 2, 0, "ChartView");
- qmlRegisterType<DeclarativeLineSeries, 3>(uri, 2, 0, "LineSeries");
- qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 2, 0, "ScatterSeries");
- qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 2, 0, "SplineSeries");
- qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 2, 0, "AreaSeries");
- qmlRegisterType<DeclarativeBarSeries, 2>(uri, 2, 0, "BarSeries");
- qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 2, 0, "StackedBarSeries");
- qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 2, 0, "PercentBarSeries");
- qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 2, 0, "HorizontalBarSeries");
- qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 2, 0, "HorizontalStackedBarSeries");
- qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 2, 0, "HorizontalPercentBarSeries");
- qmlRegisterType<DeclarativeBarSet, 2>(uri, 2, 0, "BarSet");
- qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 2, 0, "BoxPlotSeries");
- qmlRegisterType<DeclarativeBoxSet, 1>(uri, 2, 0, "BoxSet");
- qmlRegisterType<DeclarativePieSlice>(uri, 2, 0, "PieSlice");
- qmlRegisterType<DeclarativePieSeries>(uri, 2, 0, "PieSeries");
- qmlRegisterType<DeclarativeXYPoint>(uri, 2, 0, "XYPoint");
- qmlRegisterType<QHXYModelMapper>(uri, 2, 0, "HXYModelMapper");
- qmlRegisterType<QVXYModelMapper>(uri, 2, 0, "VXYModelMapper");
- qmlRegisterType<QHPieModelMapper>(uri, 2, 0, "HPieModelMapper");
- qmlRegisterType<QVPieModelMapper>(uri, 2, 0, "VPieModelMapper");
- qmlRegisterType<QHBarModelMapper>(uri, 2, 0, "HBarModelMapper");
- qmlRegisterType<QVBarModelMapper>(uri, 2, 0, "VBarModelMapper");
- qmlRegisterType<QValueAxis>(uri, 2, 0, "ValueAxis");
-#ifndef QT_ON_ARM
- qmlRegisterType<QDateTimeAxis>(uri, 2, 0, "DateTimeAxis");
-#endif
- qmlRegisterType<DeclarativeCategoryAxis>(uri, 2, 0, "CategoryAxis");
- qmlRegisterType<DeclarativeCategoryRange>(uri, 2, 0, "CategoryRange");
- qmlRegisterType<QBarCategoryAxis>(uri, 2, 0, "BarCategoryAxis");
- qmlRegisterUncreatableType<QLegend>(uri, 2, 0, "Legend",
- QLatin1String("Trying to create uncreatable: Legend."));
- qmlRegisterUncreatableType<QXYSeries>(uri, 2, 0, "XYSeries",
- QLatin1String("Trying to create uncreatable: XYSeries."));
- qmlRegisterUncreatableType<QAbstractItemModel>(uri, 2, 0, "AbstractItemModel",
- QLatin1String("Trying to create uncreatable: AbstractItemModel."));
- qmlRegisterUncreatableType<QXYModelMapper>(uri, 2, 0, "XYModelMapper",
- QLatin1String("Trying to create uncreatable: XYModelMapper."));
- qmlRegisterUncreatableType<QPieModelMapper>(uri, 2, 0, "PieModelMapper",
- QLatin1String("Trying to create uncreatable: PieModelMapper."));
- qmlRegisterUncreatableType<QBarModelMapper>(uri, 2, 0, "BarModelMapper",
- QLatin1String("Trying to create uncreatable: BarModelMapper."));
- qmlRegisterUncreatableType<QAbstractSeries>(uri, 2, 0, "AbstractSeries",
- QLatin1String("Trying to create uncreatable: AbstractSeries."));
- qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 2, 0, "AbstractBarSeries",
- QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
- qmlRegisterUncreatableType<QAbstractAxis>(uri, 2, 0, "AbstractAxis",
- QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
- qmlRegisterUncreatableType<QBarSet>(uri, 2, 0, "BarSetBase",
- QLatin1String("Trying to create uncreatable: BarsetBase."));
- qmlRegisterUncreatableType<QPieSeries>(uri, 2, 0, "QPieSeries",
- QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
- qmlRegisterUncreatableType<DeclarativeAxes>(uri, 2, 0, "DeclarativeAxes",
- QLatin1String("Trying to create uncreatable: DeclarativeAxes."));
- qmlRegisterUncreatableType<DeclarativeMargins>(uri, 2, 0, "Margins",
- QLatin1String("Trying to create uncreatable: Margins."));
- qmlRegisterType<DeclarativePolarChart>(uri, 2, 0, "PolarChartView");
- qmlRegisterType<QLogValueAxis>(uri, 2, 0, "LogValueAxis");
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#include "plugin.moc"
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
- Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin))
-#endif
diff --git a/plugins/declarative/shared_defines.h b/plugins/declarative/shared_defines.h
deleted file mode 100644
index d30efb84..00000000
--- a/plugins/declarative/shared_defines.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SHARED_DEFINES_H
-#define SHARED_DEFINES_H
-
-#ifdef CHARTS_FOR_QUICK2
-#define QDECLARATIVE_ITEM QQuickItem
-#define QDECLARATIVE_PAINTED_ITEM QQuickPaintedItem
-#define QDECLARATIVE_LIST_PROPERTY QQmlListProperty
-#define QDECLARATIVE_EXTENSION_PLUGIN QQmlExtensionPlugin
-#define QDECLARATIVE_PARSER_STATUS QQmlParserStatus
-#define LIST_PROPERTY_PARAM_DEFAULTS ,0,0,0
-
-#else
-#define QDECLARATIVE_ITEM QDeclarativeItem
-#define QDECLARATIVE_PAINTED_ITEM QDeclarativeItem
-#define QDECLARATIVE_LIST_PROPERTY QDeclarativeListProperty
-#define QDECLARATIVE_EXTENSION_PLUGIN QDeclarativeExtensionPlugin
-#define QDECLARATIVE_PARSER_STATUS QDeclarativeParserStatus
-#define LIST_PROPERTY_PARAM_DEFAULTS ,0,0
-
-#endif
-
-#endif // SHARED_DEFINES_H
diff --git a/plugins/designer/designer.pro b/plugins/designer/designer.pro
index 14677945..4e9f0f47 100644
--- a/plugins/designer/designer.pro
+++ b/plugins/designer/designer.pro
@@ -1,17 +1,19 @@
-!include( ../plugins.pri ) {
- error( "Couldn't find the plugins.pri file!" )
-}
+CONFIG += plugin
-TARGET=qtcommercialchartdesigner
-DESTDIR = $$CHART_BUILD_DESIGNER_PLUGIN_DIR
-greaterThan(QT_MAJOR_VERSION, 4) {
- QT += designer
-} else {
- CONFIG += designer
-}
-HEADERS = qchartsplugin.h
-SOURCES = qchartsplugin.cpp
-RESOURCES = qchartsplugin.qrc
+TEMPLATE = lib
+
+TARGET = qtchartsdesigner
+
+QT += charts
+QT += designer
+
+INCLUDEPATH += $$PWD
+DEPENDPATH += $$PWD
+INCLUDEPATH += ../../../include
+
+HEADERS = $$PWD/qchartsplugin.h
+SOURCES = $$PWD/qchartsplugin.cpp
+RESOURCES = $$PWD/qchartsplugin.qrc
target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += target
diff --git a/plugins/designer/qchartsplugin.cpp b/plugins/designer/qchartsplugin.cpp
index b8f407ae..9cf3156d 100644
--- a/plugins/designer/qchartsplugin.cpp
+++ b/plugins/designer/qchartsplugin.cpp
@@ -19,10 +19,10 @@
****************************************************************************/
#include "qchartsplugin.h"
-#include "qchartview.h"
+#include <QtCharts/QChartView>
#include <QtPlugin>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
QChartsPlugin::QChartsPlugin(QObject *parent) :
QObject(parent)
@@ -35,21 +35,22 @@ QChartsPlugin::~QChartsPlugin()
QString QChartsPlugin::name() const
{
- return "QChartView";
+ return QStringLiteral("QtCharts::QChartView");
}
QString QChartsPlugin::includeFile() const
{
#ifdef linux
- QString myNewLine = "\n";
+ QString myNewLine = QStringLiteral("\n");
#endif
#ifdef WIN32
- QString myNewLine = "\n\r";
+ QString myNewLine = QStringLiteral("\n\r");
#endif
#ifdef __APPLE__
- QString myNewLine = "\n";
+ QString myNewLine = QStringLiteral("\n");
#endif
- return "<qchartview.h>" + myNewLine + "#include <chartsnamespace.h>";
+ return QStringLiteral("<QtCharts/QChartView>") + myNewLine
+ + QStringLiteral("#include <chartsnamespace.h>");
}
QString QChartsPlugin::group() const
@@ -59,12 +60,12 @@ QString QChartsPlugin::group() const
QIcon QChartsPlugin::icon() const
{
- return QIcon(":/images/qcharts.png");
+ return QIcon(QStringLiteral(":/images/qcharts.png"));
}
QString QChartsPlugin::toolTip() const
{
- return tr("An Qt Charts view widget");
+ return tr("A Qt Charts view widget");
}
QString QChartsPlugin::whatsThis() const
@@ -82,7 +83,20 @@ QWidget *QChartsPlugin::createWidget(QWidget *parent)
return new QChartView(new QChart(), parent);
}
-#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
- Q_EXPORT_PLUGIN2(qtcommercialchart, QChartsPlugin)
-#endif
+QString QChartsPlugin::domXml() const
+{
+ return QStringLiteral("\
+ <ui language=\"c++\">\
+ <widget class=\"QtCharts::QChartView\" name=\"chartview\">\
+ <property name=\"geometry\">\
+ <rect>\
+ <x>0</x>\
+ <y>0</y>\
+ <width>200</width>\
+ <height>200</height>\
+ </rect>\
+ </property>\
+ </widget>\
+ </ui>");
+}
diff --git a/plugins/designer/qchartsplugin.h b/plugins/designer/qchartsplugin.h
index 06ba7214..90d0abe7 100644
--- a/plugins/designer/qchartsplugin.h
+++ b/plugins/designer/qchartsplugin.h
@@ -25,10 +25,7 @@
class QChartsPlugin: public QObject, public QDesignerCustomWidgetInterface
{
-
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface")
-#endif
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
@@ -44,6 +41,7 @@ public:
QString whatsThis() const;
bool isContainer() const;
QWidget *createWidget(QWidget *parent);
+ QString domXml() const;
};
#endif /* QCHARTSPLUGIN_H */
diff --git a/plugins/plugins.pri b/plugins/plugins.pri
deleted file mode 100644
index 68c62d1d..00000000
--- a/plugins/plugins.pri
+++ /dev/null
@@ -1,14 +0,0 @@
-!include( ../config.pri ) {
- error( "Couldn't find the config.pri file!" )
-}
-
-TEMPLATE = lib
-
-CONFIG+= plugin
-OBJECTS_DIR = $$CHART_BUILD_DIR/plugins/$$TARGET
-MOC_DIR = $$CHART_BUILD_DIR/plugins/$$TARGET
-UI_DIR = $$CHART_BUILD_DIR/plugins/$$TARGET
-RCC_DIR = $$CHART_BUILD_DIR/plugins/$$TARGET
-
-# staticlib config causes problems when building executables
-staticlib: CONFIG-=staticlib
diff --git a/plugins/plugins.pro b/plugins/plugins.pro
index 6d70b7ec..e9000319 100644
--- a/plugins/plugins.pro
+++ b/plugins/plugins.pro
@@ -1,16 +1,5 @@
-!include( ../config.pri ) {
- error( "Couldn't find the config.pri file!" )
-}
TEMPLATE = subdirs
-contains(QT_VERSION, ^4\\.[0-7]\\.[0-3]\\s*$) | contains(QT_VERSION, ^4\\.[0-6]\\..*) {
- warning("QtCommercial.Charts QML API requires at least Qt 4.7.4. You are using $${QT_VERSION} so the QML API is disabled.")
-} else {
- contains(QT_VERSION, ^5\\..*\\..*$) {
- qtHaveModule(quick): SUBDIRS += quick2
- qtHaveModule(declarative): SUBDIRS += quick1
- } else {
- SUBDIRS += quick1
- }
-}
+SUBDIRS += designer
+
diff --git a/plugins/quick1/qmldir b/plugins/quick1/qmldir
deleted file mode 100644
index d4b6ae7d..00000000
--- a/plugins/quick1/qmldir
+++ /dev/null
@@ -1 +0,0 @@
-plugin qtcommercialchartqml
diff --git a/plugins/quick1/quick1.pro b/plugins/quick1/quick1.pro
deleted file mode 100644
index 17300d5c..00000000
--- a/plugins/quick1/quick1.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TARGET = qtcommercialchartqml
-QT += declarative
-IMPORT_INSTALL_PATH = $$[QT_INSTALL_IMPORTS]
-
-!include(../declarative/declarative.pri) {
- error( "Couldn't find the declarative.pri file!" )
-}
-
diff --git a/plugins/quick2/plugins.qmltypes b/plugins/quick2/plugins.qmltypes
deleted file mode 100644
index d7ad34a6..00000000
--- a/plugins/quick2/plugins.qmltypes
+++ /dev/null
@@ -1,2263 +0,0 @@
-import QtQuick.tooling 1.1
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtCommercial.Chart 2.0'
-
-Module {
- Component {
- name: "QGraphicsObject"
- defaultProperty: "children"
- prototype: "QObject"
- Property { name: "parent"; type: "QGraphicsObject"; isPointer: true }
- Property { name: "opacity"; type: "double" }
- Property { name: "enabled"; type: "bool" }
- Property { name: "visible"; type: "bool" }
- Property { name: "pos"; type: "QPointF" }
- Property { name: "x"; type: "double" }
- Property { name: "y"; type: "double" }
- Property { name: "z"; type: "double" }
- Property { name: "rotation"; type: "double" }
- Property { name: "scale"; type: "double" }
- Property { name: "transformOriginPoint"; type: "QPointF" }
- Property { name: "effect"; type: "QGraphicsEffect"; isPointer: true }
- Property {
- name: "children"
- type: "QDeclarativeListProperty<QGraphicsObject>"
- isReadonly: true
- }
- Property { name: "width"; type: "double" }
- Property { name: "height"; type: "double" }
- }
- Component {
- name: "QGraphicsWidget"
- defaultProperty: "children"
- prototype: "QGraphicsObject"
- Property { name: "palette"; type: "QPalette" }
- Property { name: "font"; type: "QFont" }
- Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
- Property { name: "size"; type: "QSizeF" }
- Property { name: "minimumSize"; type: "QSizeF" }
- Property { name: "preferredSize"; type: "QSizeF" }
- Property { name: "maximumSize"; type: "QSizeF" }
- Property { name: "sizePolicy"; type: "QSizePolicy" }
- Property { name: "focusPolicy"; type: "Qt::FocusPolicy" }
- Property { name: "windowFlags"; type: "Qt::WindowFlags" }
- Property { name: "windowTitle"; type: "string" }
- Property { name: "geometry"; type: "QRectF" }
- Property { name: "autoFillBackground"; type: "bool" }
- Property { name: "layout"; type: "QGraphicsLayout"; isPointer: true }
- Method { name: "close"; type: "bool" }
- }
- Component {
- name: "QtCommercialChart::DeclarativeAreaSeries"
- prototype: "QtCommercialChart::QAreaSeries"
- exports: [
- "QtCommercial.Chart/AreaSeries 1.0",
- "QtCommercial.Chart/AreaSeries 1.1",
- "QtCommercial.Chart/AreaSeries 1.2",
- "QtCommercial.Chart/AreaSeries 1.3",
- "QtCommercial.Chart/AreaSeries 1.4"
- ]
- exportMetaObjectRevisions: [0, 1, 2, 3, 4]
- Property { name: "upperSeries"; type: "DeclarativeLineSeries"; isPointer: true }
- Property { name: "lowerSeries"; type: "DeclarativeLineSeries"; isPointer: true }
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
- Property { name: "borderWidth"; revision: 1; type: "double" }
- Property { name: "brushFilename"; revision: 4; type: "string" }
- Property { name: "brush"; revision: 4; type: "QBrush" }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "borderWidthChanged"
- revision: 1
- Parameter { name: "width"; type: "double" }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisAngularChanged"
- revision: 3
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisRadialChanged"
- revision: 3
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal { name: "brushChanged"; revision: 4 }
- Signal {
- name: "brushFilenameChanged"
- revision: 4
- Parameter { name: "brushFilename"; type: "string" }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativeAxes"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/DeclarativeAxes 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
- Signal {
- name: "axisXChanged"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativeBarSeries"
- defaultProperty: "seriesChildren"
- prototype: "QtCommercialChart::QBarSeries"
- exports: [
- "QtCommercial.Chart/BarSeries 1.0",
- "QtCommercial.Chart/BarSeries 1.1",
- "QtCommercial.Chart/BarSeries 1.2"
- ]
- exportMetaObjectRevisions: [0, 1, 2]
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Method {
- name: "appendSeriesChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "at"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- type: "DeclarativeBarSet*"
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "insert"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "remove"
- type: "bool"
- Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
- }
- Method { name: "clear" }
- }
- Component {
- name: "QtCommercialChart::DeclarativeBarSet"
- prototype: "QtCommercialChart::QBarSet"
- exports: [
- "QtCommercial.Chart/BarSet 1.0",
- "QtCommercial.Chart/BarSet 1.1",
- "QtCommercial.Chart/BarSet 1.4"
- ]
- exportMetaObjectRevisions: [0, 0, 2]
- Property { name: "values"; type: "QVariantList" }
- Property { name: "borderWidth"; revision: 1; type: "double" }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "brushFilename"; revision: 2; type: "string" }
- Signal {
- name: "countChanged"
- Parameter { name: "count"; type: "int" }
- }
- Signal {
- name: "borderWidthChanged"
- revision: 1
- Parameter { name: "width"; type: "double" }
- }
- Signal {
- name: "brushFilenameChanged"
- revision: 2
- Parameter { name: "brushFilename"; type: "string" }
- }
- Method {
- name: "append"
- Parameter { name: "value"; type: "double" }
- }
- Method {
- name: "remove"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Method {
- name: "remove"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "replace"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "value"; type: "double" }
- }
- Method {
- name: "at"
- type: "double"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativeBoxPlotSeries"
- defaultProperty: "seriesChildren"
- prototype: "QtCommercialChart::QBoxPlotSeries"
- exports: [
- "QtCommercial.Chart/BoxPlotSeries 1.3",
- "QtCommercial.Chart/BoxPlotSeries 1.4"
- ]
- exportMetaObjectRevisions: [0, 1]
- Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
- Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "brushFilename"; revision: 1; type: "string" }
- Signal {
- name: "axisXChanged"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "clicked"
- Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
- }
- Signal {
- name: "hovered"
- Parameter { name: "status"; type: "bool" }
- Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
- }
- Signal {
- name: "brushFilenameChanged"
- revision: 1
- Parameter { name: "brushFilename"; type: "string" }
- }
- Method {
- name: "appendSeriesChildren"
- Parameter { name: "list"; type: "QDECLARATIVE_LIST_PROPERTY<QObject>"; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "onHovered"
- Parameter { name: "status"; type: "bool" }
- Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
- }
- Method {
- name: "onClicked"
- Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
- }
- Method {
- name: "at"
- type: "DeclarativeBoxSet*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- type: "DeclarativeBoxSet*"
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "append"
- Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
- }
- Method {
- name: "insert"
- type: "DeclarativeBoxSet*"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "remove"
- type: "bool"
- Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
- }
- Method { name: "clear" }
- }
- Component {
- name: "QtCommercialChart::DeclarativeBoxSet"
- prototype: "QtCommercialChart::QBoxSet"
- exports: [
- "QtCommercial.Chart/BoxSet 1.3",
- "QtCommercial.Chart/BoxSet 1.4"
- ]
- exportMetaObjectRevisions: [0, 1]
- Enum {
- name: "ValuePositions"
- values: {
- "LowerExtreme": 0,
- "LowerQuartile": 1,
- "Median": 2,
- "UpperQuartile": 3,
- "UpperExtreme": 4
- }
- }
- Property { name: "values"; type: "QVariantList" }
- Property { name: "label"; type: "string" }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "brushFilename"; revision: 1; type: "string" }
- Signal { name: "changedValues" }
- Signal {
- name: "changedValue"
- Parameter { name: "index"; type: "int" }
- }
- Signal {
- name: "brushFilenameChanged"
- revision: 1
- Parameter { name: "brushFilename"; type: "string" }
- }
- Method {
- name: "append"
- Parameter { name: "value"; type: "double" }
- }
- Method { name: "clear" }
- Method {
- name: "at"
- type: "double"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "setValue"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "value"; type: "double" }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativeCategoryAxis"
- defaultProperty: "axisChildren"
- prototype: "QtCommercialChart::QCategoryAxis"
- exports: ["QtCommercial.Chart/CategoryAxis 1.1"]
- exportMetaObjectRevisions: [0]
- Property { name: "axisChildren"; type: "QObject"; isList: true; isReadonly: true }
- Method {
- name: "append"
- Parameter { name: "label"; type: "string" }
- Parameter { name: "categoryEndValue"; type: "double" }
- }
- Method {
- name: "remove"
- Parameter { name: "label"; type: "string" }
- }
- Method {
- name: "replace"
- Parameter { name: "oldLabel"; type: "string" }
- Parameter { name: "newLabel"; type: "string" }
- }
- Method {
- name: "appendAxisChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativeCategoryRange"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/CategoryRange 1.1"]
- exportMetaObjectRevisions: [0]
- Property { name: "endValue"; type: "double" }
- Property { name: "label"; type: "string" }
- }
- Component {
- name: "QtCommercialChart::DeclarativeChart"
- defaultProperty: "data"
- prototype: "QQuickPaintedItem"
- exports: [
- "QtCommercial.Chart/ChartView 1.0",
- "QtCommercial.Chart/ChartView 1.1",
- "QtCommercial.Chart/ChartView 1.2",
- "QtCommercial.Chart/ChartView 1.3"
- ]
- exportMetaObjectRevisions: [0, 1, 2, 3]
- Enum {
- name: "Theme"
- values: {
- "ChartThemeLight": 0,
- "ChartThemeBlueCerulean": 1,
- "ChartThemeDark": 2,
- "ChartThemeBrownSand": 3,
- "ChartThemeBlueNcs": 4,
- "ChartThemeHighContrast": 5,
- "ChartThemeBlueIcy": 6,
- "ChartThemeQt": 7
- }
- }
- Enum {
- name: "Animation"
- values: {
- "NoAnimation": 0,
- "GridAxisAnimations": 1,
- "SeriesAnimations": 2,
- "AllAnimations": 3
- }
- }
- Enum {
- name: "SeriesType"
- values: {
- "SeriesTypeLine": 0,
- "SeriesTypeArea": 1,
- "SeriesTypeBar": 2,
- "SeriesTypeStackedBar": 3,
- "SeriesTypePercentBar": 4,
- "SeriesTypeBoxPlot": 5,
- "SeriesTypePie": 6,
- "SeriesTypeScatter": 7,
- "SeriesTypeSpline": 8,
- "SeriesTypeHorizontalBar": 9,
- "SeriesTypeHorizontalStackedBar": 10,
- "SeriesTypeHorizontalPercentBar": 11
- }
- }
- Property { name: "theme"; type: "Theme" }
- Property { name: "animationOptions"; type: "Animation" }
- Property { name: "title"; type: "string" }
- Property { name: "titleFont"; type: "QFont" }
- Property { name: "titleColor"; type: "QColor" }
- Property { name: "legend"; type: "QLegend"; isReadonly: true; isPointer: true }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "backgroundColor"; type: "QColor" }
- Property { name: "dropShadowEnabled"; type: "bool" }
- Property { name: "backgroundRoundness"; revision: 3; type: "double" }
- Property { name: "topMargin"; type: "double"; isReadonly: true }
- Property { name: "bottomMargin"; type: "double"; isReadonly: true }
- Property { name: "leftMargin"; type: "double"; isReadonly: true }
- Property { name: "rightMargin"; type: "double"; isReadonly: true }
- Property {
- name: "minimumMargins"
- revision: 1
- type: "DeclarativeMargins"
- isReadonly: true
- isPointer: true
- }
- Property {
- name: "margins"
- revision: 2
- type: "DeclarativeMargins"
- isReadonly: true
- isPointer: true
- }
- Property { name: "plotArea"; revision: 1; type: "QRectF"; isReadonly: true }
- Property { name: "plotAreaColor"; revision: 3; type: "QColor" }
- Property { name: "axes"; revision: 2; type: "QAbstractAxis"; isList: true; isReadonly: true }
- Signal { name: "axisLabelsChanged" }
- Signal {
- name: "titleColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "dropShadowEnabledChanged"
- Parameter { name: "enabled"; type: "bool" }
- }
- Signal { name: "marginsChanged"; revision: 2 }
- Signal {
- name: "plotAreaChanged"
- Parameter { name: "plotArea"; type: "QRectF" }
- }
- Signal {
- name: "seriesAdded"
- Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
- }
- Signal {
- name: "seriesRemoved"
- Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
- }
- Signal { name: "plotAreaColorChanged"; revision: 3 }
- Signal {
- name: "backgroundRoundnessChanged"
- revision: 3
- Parameter { name: "diameter"; type: "double" }
- }
- Method {
- name: "series"
- type: "QAbstractSeries*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "series"
- type: "QAbstractSeries*"
- Parameter { name: "seriesName"; type: "string" }
- }
- Method {
- name: "createSeries"
- type: "QAbstractSeries*"
- Parameter { name: "type"; type: "int" }
- Parameter { name: "name"; type: "string" }
- Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
- Parameter { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
- }
- Method {
- name: "createSeries"
- type: "QAbstractSeries*"
- Parameter { name: "type"; type: "int" }
- Parameter { name: "name"; type: "string" }
- Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
- }
- Method {
- name: "createSeries"
- type: "QAbstractSeries*"
- Parameter { name: "type"; type: "int" }
- Parameter { name: "name"; type: "string" }
- }
- Method {
- name: "createSeries"
- type: "QAbstractSeries*"
- Parameter { name: "type"; type: "int" }
- }
- Method {
- name: "removeSeries"
- Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
- }
- Method { name: "removeAllSeries" }
- Method {
- name: "setAxisX"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
- }
- Method {
- name: "setAxisX"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Method {
- name: "setAxisY"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
- }
- Method {
- name: "setAxisY"
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Method { name: "createDefaultAxes" }
- Method {
- name: "axisX"
- type: "QAbstractAxis*"
- Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
- }
- Method { name: "axisX"; type: "QAbstractAxis*" }
- Method {
- name: "axisY"
- type: "QAbstractAxis*"
- Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
- }
- Method { name: "axisY"; type: "QAbstractAxis*" }
- Method {
- name: "zoom"
- Parameter { name: "factor"; type: "double" }
- }
- Method {
- name: "scrollLeft"
- Parameter { name: "pixels"; type: "double" }
- }
- Method {
- name: "scrollRight"
- Parameter { name: "pixels"; type: "double" }
- }
- Method {
- name: "scrollUp"
- Parameter { name: "pixels"; type: "double" }
- }
- Method {
- name: "scrollDown"
- Parameter { name: "pixels"; type: "double" }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativeHorizontalBarSeries"
- defaultProperty: "seriesChildren"
- prototype: "QtCommercialChart::QHorizontalBarSeries"
- exports: [
- "QtCommercial.Chart/HorizontalBarSeries 1.1",
- "QtCommercial.Chart/HorizontalBarSeries 1.2"
- ]
- exportMetaObjectRevisions: [1, 2]
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Method {
- name: "appendSeriesChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "at"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- type: "DeclarativeBarSet*"
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "insert"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "remove"
- type: "bool"
- Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
- }
- Method { name: "clear" }
- }
- Component {
- name: "QtCommercialChart::DeclarativeHorizontalPercentBarSeries"
- defaultProperty: "seriesChildren"
- prototype: "QtCommercialChart::QHorizontalPercentBarSeries"
- exports: [
- "QtCommercial.Chart/HorizontalPercentBarSeries 1.1",
- "QtCommercial.Chart/HorizontalPercentBarSeries 1.2"
- ]
- exportMetaObjectRevisions: [1, 2]
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Method {
- name: "appendSeriesChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "at"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- type: "DeclarativeBarSet*"
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "insert"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "remove"
- type: "bool"
- Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
- }
- Method { name: "clear" }
- }
- Component {
- name: "QtCommercialChart::DeclarativeHorizontalStackedBarSeries"
- defaultProperty: "seriesChildren"
- prototype: "QtCommercialChart::QHorizontalStackedBarSeries"
- exports: [
- "QtCommercial.Chart/HorizontalStackedBarSeries 1.1",
- "QtCommercial.Chart/HorizontalStackedBarSeries 1.2"
- ]
- exportMetaObjectRevisions: [1, 2]
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Method {
- name: "appendSeriesChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "at"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- type: "DeclarativeBarSet*"
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "insert"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "remove"
- type: "bool"
- Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
- }
- Method { name: "clear" }
- }
- Component {
- name: "QtCommercialChart::DeclarativeLineSeries"
- defaultProperty: "declarativeChildren"
- prototype: "QtCommercialChart::QLineSeries"
- exports: [
- "QtCommercial.Chart/LineSeries 1.0",
- "QtCommercial.Chart/LineSeries 1.1",
- "QtCommercial.Chart/LineSeries 1.2",
- "QtCommercial.Chart/LineSeries 1.3"
- ]
- exportMetaObjectRevisions: [0, 1, 2, 3]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
- Property { name: "width"; revision: 1; type: "double" }
- Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
- Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
- Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "countChanged"
- Parameter { name: "count"; type: "int" }
- }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisAngularChanged"
- revision: 3
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisRadialChanged"
- revision: 3
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "widthChanged"
- revision: 1
- Parameter { name: "width"; type: "double" }
- }
- Signal {
- name: "styleChanged"
- revision: 1
- Parameter { name: "style"; type: "Qt::PenStyle" }
- }
- Signal {
- name: "capStyleChanged"
- revision: 1
- Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
- }
- Method {
- name: "appendDeclarativeChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "handleCountChanged"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "replace"
- Parameter { name: "oldX"; type: "double" }
- Parameter { name: "oldY"; type: "double" }
- Parameter { name: "newX"; type: "double" }
- Parameter { name: "newY"; type: "double" }
- }
- Method {
- name: "replace"
- revision: 3
- Parameter { name: "index"; type: "int" }
- Parameter { name: "newX"; type: "double" }
- Parameter { name: "newY"; type: "double" }
- }
- Method {
- name: "remove"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "remove"
- revision: 3
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "insert"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method { name: "clear" }
- Method {
- name: "at"
- type: "QPointF"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativeMargins"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/Margins 1.1"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "top"; type: "int" }
- Property { name: "bottom"; type: "int" }
- Property { name: "left"; type: "int" }
- Property { name: "right"; type: "int" }
- Signal {
- name: "topChanged"
- Parameter { name: "top"; type: "int" }
- Parameter { name: "bottom"; type: "int" }
- Parameter { name: "left"; type: "int" }
- Parameter { name: "right"; type: "int" }
- }
- Signal {
- name: "bottomChanged"
- Parameter { name: "top"; type: "int" }
- Parameter { name: "bottom"; type: "int" }
- Parameter { name: "left"; type: "int" }
- Parameter { name: "right"; type: "int" }
- }
- Signal {
- name: "leftChanged"
- Parameter { name: "top"; type: "int" }
- Parameter { name: "bottom"; type: "int" }
- Parameter { name: "left"; type: "int" }
- Parameter { name: "right"; type: "int" }
- }
- Signal {
- name: "rightChanged"
- Parameter { name: "top"; type: "int" }
- Parameter { name: "bottom"; type: "int" }
- Parameter { name: "left"; type: "int" }
- Parameter { name: "right"; type: "int" }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativePercentBarSeries"
- defaultProperty: "seriesChildren"
- prototype: "QtCommercialChart::QPercentBarSeries"
- exports: [
- "QtCommercial.Chart/PercentBarSeries 1.0",
- "QtCommercial.Chart/PercentBarSeries 1.1",
- "QtCommercial.Chart/PercentBarSeries 1.2"
- ]
- exportMetaObjectRevisions: [0, 1, 2]
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Method {
- name: "appendSeriesChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "at"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- type: "DeclarativeBarSet*"
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "insert"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "remove"
- type: "bool"
- Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
- }
- Method { name: "clear" }
- }
- Component {
- name: "QtCommercialChart::DeclarativePieSeries"
- defaultProperty: "seriesChildren"
- prototype: "QtCommercialChart::QPieSeries"
- exports: [
- "QtCommercial.Chart/PieSeries 1.0",
- "QtCommercial.Chart/PieSeries 1.1"
- ]
- exportMetaObjectRevisions: [0, 0]
- Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "sliceAdded"
- Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
- }
- Signal {
- name: "sliceRemoved"
- Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
- }
- Method {
- name: "appendSeriesChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "handleAdded"
- Parameter { name: "slices"; type: "QList<QPieSlice*>" }
- }
- Method {
- name: "handleRemoved"
- Parameter { name: "slices"; type: "QList<QPieSlice*>" }
- }
- Method {
- name: "at"
- type: "QPieSlice*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "find"
- type: "QPieSlice*"
- Parameter { name: "label"; type: "string" }
- }
- Method {
- name: "append"
- type: "DeclarativePieSlice*"
- Parameter { name: "label"; type: "string" }
- Parameter { name: "value"; type: "double" }
- }
- Method {
- name: "remove"
- type: "bool"
- Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
- }
- Method { name: "clear" }
- }
- Component {
- name: "QtCommercialChart::DeclarativePieSlice"
- prototype: "QtCommercialChart::QPieSlice"
- exports: ["QtCommercial.Chart/PieSlice 1.4"]
- exportMetaObjectRevisions: [0]
- Property { name: "brushFilename"; type: "string" }
- Signal {
- name: "brushFilenameChanged"
- Parameter { name: "brushFilename"; type: "string" }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativePolarChart"
- defaultProperty: "data"
- prototype: "QtCommercialChart::DeclarativeChart"
- exports: ["QtCommercial.Chart/PolarChartView 1.3"]
- exportMetaObjectRevisions: [1]
- }
- Component {
- name: "QtCommercialChart::DeclarativeScatterSeries"
- defaultProperty: "declarativeChildren"
- prototype: "QtCommercialChart::QScatterSeries"
- exports: [
- "QtCommercial.Chart/ScatterSeries 1.0",
- "QtCommercial.Chart/ScatterSeries 1.1",
- "QtCommercial.Chart/ScatterSeries 1.2",
- "QtCommercial.Chart/ScatterSeries 1.3",
- "QtCommercial.Chart/ScatterSeries 1.4"
- ]
- exportMetaObjectRevisions: [0, 1, 2, 3, 4]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
- Property { name: "borderWidth"; revision: 1; type: "double" }
- Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "brushFilename"; revision: 4; type: "string" }
- Property { name: "brush"; revision: 4; type: "QBrush" }
- Signal {
- name: "countChanged"
- Parameter { name: "count"; type: "int" }
- }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "borderWidthChanged"
- revision: 1
- Parameter { name: "width"; type: "double" }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisAngularChanged"
- revision: 3
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisRadialChanged"
- revision: 3
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "brushFilenameChanged"
- revision: 4
- Parameter { name: "brushFilename"; type: "string" }
- }
- Signal { name: "brushChanged"; revision: 4 }
- Method {
- name: "appendDeclarativeChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "handleCountChanged"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "replace"
- Parameter { name: "oldX"; type: "double" }
- Parameter { name: "oldY"; type: "double" }
- Parameter { name: "newX"; type: "double" }
- Parameter { name: "newY"; type: "double" }
- }
- Method {
- name: "replace"
- revision: 3
- Parameter { name: "index"; type: "int" }
- Parameter { name: "newX"; type: "double" }
- Parameter { name: "newY"; type: "double" }
- }
- Method {
- name: "remove"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "remove"
- revision: 3
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "insert"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method { name: "clear" }
- Method {
- name: "at"
- type: "QPointF"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativeSplineSeries"
- defaultProperty: "declarativeChildren"
- prototype: "QtCommercialChart::QSplineSeries"
- exports: [
- "QtCommercial.Chart/SplineSeries 1.0",
- "QtCommercial.Chart/SplineSeries 1.1",
- "QtCommercial.Chart/SplineSeries 1.2",
- "QtCommercial.Chart/SplineSeries 1.3"
- ]
- exportMetaObjectRevisions: [0, 1, 2, 3]
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
- Property { name: "width"; revision: 1; type: "double" }
- Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
- Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
- Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "countChanged"
- Parameter { name: "count"; type: "int" }
- }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisAngularChanged"
- revision: 3
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisRadialChanged"
- revision: 3
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "widthChanged"
- revision: 1
- Parameter { name: "width"; type: "double" }
- }
- Signal {
- name: "styleChanged"
- revision: 1
- Parameter { name: "style"; type: "Qt::PenStyle" }
- }
- Signal {
- name: "capStyleChanged"
- revision: 1
- Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
- }
- Method {
- name: "appendDeclarativeChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "handleCountChanged"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "replace"
- Parameter { name: "oldX"; type: "double" }
- Parameter { name: "oldY"; type: "double" }
- Parameter { name: "newX"; type: "double" }
- Parameter { name: "newY"; type: "double" }
- }
- Method {
- name: "replace"
- revision: 3
- Parameter { name: "index"; type: "int" }
- Parameter { name: "newX"; type: "double" }
- Parameter { name: "newY"; type: "double" }
- }
- Method {
- name: "remove"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "remove"
- revision: 3
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "insert"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method { name: "clear" }
- Method {
- name: "at"
- type: "QPointF"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QtCommercialChart::DeclarativeStackedBarSeries"
- defaultProperty: "seriesChildren"
- prototype: "QtCommercialChart::QStackedBarSeries"
- exports: [
- "QtCommercial.Chart/StackedBarSeries 1.0",
- "QtCommercial.Chart/StackedBarSeries 1.1",
- "QtCommercial.Chart/StackedBarSeries 1.2"
- ]
- exportMetaObjectRevisions: [0, 1, 2]
- Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
- Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
- Signal {
- name: "axisXChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYChanged"
- revision: 1
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisXTopChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Signal {
- name: "axisYRightChanged"
- revision: 2
- Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
- }
- Method {
- name: "appendSeriesChildren"
- Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
- Parameter { name: "element"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "at"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- }
- Method {
- name: "append"
- type: "DeclarativeBarSet*"
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "insert"
- type: "DeclarativeBarSet*"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "label"; type: "string" }
- Parameter { name: "values"; type: "QVariantList" }
- }
- Method {
- name: "remove"
- type: "bool"
- Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
- }
- Method { name: "clear" }
- }
- Component {
- name: "QtCommercialChart::DeclarativeXYPoint"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/XYPoint 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "x"; type: "double" }
- Property { name: "y"; type: "double" }
- }
- Component {
- name: "QtCommercialChart::LegendScroller"
- defaultProperty: "children"
- prototype: "QtCommercialChart::QLegend"
- }
- Component {
- name: "QtCommercialChart::QAbstractAxis"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/AbstractAxis 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "visible"; type: "bool" }
- Property { name: "lineVisible"; type: "bool" }
- Property { name: "linePen"; type: "QPen" }
- Property { name: "color"; type: "QColor" }
- Property { name: "labelsVisible"; type: "bool" }
- Property { name: "labelsPen"; type: "QPen" }
- Property { name: "labelsBrush"; type: "QBrush" }
- Property { name: "labelsAngle"; type: "int" }
- Property { name: "labelsFont"; type: "QFont" }
- Property { name: "labelsColor"; type: "QColor" }
- Property { name: "gridVisible"; type: "bool" }
- Property { name: "gridLinePen"; type: "QPen" }
- Property { name: "shadesVisible"; type: "bool" }
- Property { name: "shadesColor"; type: "QColor" }
- Property { name: "shadesBorderColor"; type: "QColor" }
- Property { name: "shadesPen"; type: "QPen" }
- Property { name: "shadesBrush"; type: "QBrush" }
- Property { name: "titleText"; type: "string" }
- Property { name: "titlePen"; type: "QPen" }
- Property { name: "titleBrush"; type: "QBrush" }
- Property { name: "titleVisible"; type: "bool" }
- Property { name: "titleFont"; type: "QFont" }
- Property { name: "orientation"; type: "Qt::Orientation"; isReadonly: true }
- Property { name: "alignment"; type: "Qt::Alignment"; isReadonly: true }
- Signal {
- name: "visibleChanged"
- Parameter { name: "visible"; type: "bool" }
- }
- Signal {
- name: "linePenChanged"
- Parameter { name: "pen"; type: "QPen" }
- }
- Signal {
- name: "lineVisibleChanged"
- Parameter { name: "visible"; type: "bool" }
- }
- Signal {
- name: "labelsVisibleChanged"
- Parameter { name: "visible"; type: "bool" }
- }
- Signal {
- name: "labelsPenChanged"
- Parameter { name: "pen"; type: "QPen" }
- }
- Signal {
- name: "labelsBrushChanged"
- Parameter { name: "brush"; type: "QBrush" }
- }
- Signal {
- name: "labelsFontChanged"
- Parameter { name: "pen"; type: "QFont" }
- }
- Signal {
- name: "labelsAngleChanged"
- Parameter { name: "angle"; type: "int" }
- }
- Signal {
- name: "gridLinePenChanged"
- Parameter { name: "pen"; type: "QPen" }
- }
- Signal {
- name: "gridVisibleChanged"
- Parameter { name: "visible"; type: "bool" }
- }
- Signal {
- name: "colorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "labelsColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "titleTextChanged"
- Parameter { name: "title"; type: "string" }
- }
- Signal {
- name: "titlePenChanged"
- Parameter { name: "pen"; type: "QPen" }
- }
- Signal {
- name: "titleBrushChanged"
- Parameter { name: "brush"; type: "QBrush" }
- }
- Signal {
- name: "titleVisibleChanged"
- Parameter { name: "visible"; type: "bool" }
- }
- Signal {
- name: "titleFontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "shadesVisibleChanged"
- Parameter { name: "visible"; type: "bool" }
- }
- Signal {
- name: "shadesColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "shadesBorderColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "shadesPenChanged"
- Parameter { name: "pen"; type: "QPen" }
- }
- Signal {
- name: "shadesBrushChanged"
- Parameter { name: "brush"; type: "QBrush" }
- }
- }
- Component {
- name: "QtCommercialChart::QAbstractBarSeries"
- prototype: "QtCommercialChart::QAbstractSeries"
- exports: ["QtCommercial.Chart/AbstractBarSeries 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "LabelsPosition"
- values: {
- "LabelsCenter": 0,
- "LabelsInsideEnd": 1,
- "LabelsInsideBase": 2,
- "LabelsOutsideEnd": 3
- }
- }
- Property { name: "barWidth"; type: "double" }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "labelsVisible"; type: "bool" }
- Property { name: "labelsFormat"; type: "string" }
- Property { name: "labelsPosition"; type: "LabelsPosition" }
- Signal {
- name: "clicked"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
- }
- Signal {
- name: "hovered"
- Parameter { name: "status"; type: "bool" }
- Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
- }
- Signal {
- name: "hovered"
- Parameter { name: "status"; type: "bool" }
- Parameter { name: "index"; type: "int" }
- Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
- }
- Signal {
- name: "labelsFormatChanged"
- Parameter { name: "format"; type: "string" }
- }
- Signal {
- name: "labelsPositionChanged"
- Parameter { name: "position"; type: "QAbstractBarSeries::LabelsPosition" }
- }
- Signal {
- name: "barsetsAdded"
- Parameter { name: "sets"; type: "QList<QBarSet*>" }
- }
- Signal {
- name: "barsetsRemoved"
- Parameter { name: "sets"; type: "QList<QBarSet*>" }
- }
- }
- Component {
- name: "QtCommercialChart::QAbstractSeries"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/AbstractSeries 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Enum {
- name: "SeriesType"
- values: {
- "SeriesTypeLine": 0,
- "SeriesTypeArea": 1,
- "SeriesTypeBar": 2,
- "SeriesTypeStackedBar": 3,
- "SeriesTypePercentBar": 4,
- "SeriesTypePie": 5,
- "SeriesTypeScatter": 6,
- "SeriesTypeSpline": 7,
- "SeriesTypeHorizontalBar": 8,
- "SeriesTypeHorizontalStackedBar": 9,
- "SeriesTypeHorizontalPercentBar": 10,
- "SeriesTypeBoxPlot": 11
- }
- }
- Property { name: "name"; type: "string" }
- Property { name: "visible"; type: "bool" }
- Property { name: "opacity"; type: "double" }
- Property { name: "type"; type: "SeriesType"; isReadonly: true }
- }
- Component {
- name: "QtCommercialChart::QAreaSeries"
- prototype: "QtCommercialChart::QAbstractSeries"
- Property { name: "upperSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
- Property { name: "lowerSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
- Property { name: "color"; type: "QColor" }
- Property { name: "borderColor"; type: "QColor" }
- Property { name: "pointLabelsFormat"; type: "string" }
- Property { name: "pointLabelsVisible"; type: "bool" }
- Property { name: "pointLabelsFont"; type: "QFont" }
- Property { name: "pointLabelsColor"; type: "QColor" }
- Signal {
- name: "clicked"
- Parameter { name: "point"; type: "QPointF" }
- }
- Signal {
- name: "hovered"
- Parameter { name: "point"; type: "QPointF" }
- Parameter { name: "state"; type: "bool" }
- }
- Signal { name: "selected" }
- Signal {
- name: "colorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "borderColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "pointLabelsFormatChanged"
- Parameter { name: "format"; type: "string" }
- }
- Signal {
- name: "pointLabelsVisibilityChanged"
- Parameter { name: "visible"; type: "bool" }
- }
- Signal {
- name: "pointLabelsFontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "pointLabelsColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- }
- Component {
- name: "QtCommercialChart::QBarCategoryAxis"
- prototype: "QtCommercialChart::QAbstractAxis"
- exports: [
- "QtCommercial.Chart/BarCategoriesAxis 1.0",
- "QtCommercial.Chart/BarCategoryAxis 1.1"
- ]
- exportMetaObjectRevisions: [0, 0]
- Property { name: "categories"; type: "QStringList" }
- Property { name: "min"; type: "string" }
- Property { name: "max"; type: "string" }
- Property { name: "count"; type: "int"; isReadonly: true }
- Signal {
- name: "minChanged"
- Parameter { name: "min"; type: "string" }
- }
- Signal {
- name: "maxChanged"
- Parameter { name: "max"; type: "string" }
- }
- Signal {
- name: "rangeChanged"
- Parameter { name: "min"; type: "string" }
- Parameter { name: "max"; type: "string" }
- }
- Method { name: "clear" }
- }
- Component {
- name: "QtCommercialChart::QBarModelMapper"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/BarModelMapper 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QtCommercialChart::QBarSeries"
- prototype: "QtCommercialChart::QAbstractBarSeries"
- }
- Component {
- name: "QtCommercialChart::QBarSet"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/BarSetBase 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "label"; type: "string" }
- Property { name: "pen"; type: "QPen" }
- Property { name: "brush"; type: "QBrush" }
- Property { name: "labelBrush"; type: "QBrush" }
- Property { name: "labelFont"; type: "QFont" }
- Property { name: "color"; type: "QColor" }
- Property { name: "borderColor"; type: "QColor" }
- Property { name: "labelColor"; type: "QColor" }
- Signal {
- name: "clicked"
- Parameter { name: "index"; type: "int" }
- }
- Signal {
- name: "hovered"
- Parameter { name: "status"; type: "bool" }
- }
- Signal {
- name: "hovered"
- Parameter { name: "status"; type: "bool" }
- Parameter { name: "index"; type: "int" }
- }
- Signal {
- name: "colorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "borderColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "labelColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "valuesAdded"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Signal {
- name: "valuesRemoved"
- Parameter { name: "index"; type: "int" }
- Parameter { name: "count"; type: "int" }
- }
- Signal {
- name: "valueChanged"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "QtCommercialChart::QBoxPlotModelMapper"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/BoxPlotModelMapper 2.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QtCommercialChart::QBoxPlotSeries"
- prototype: "QtCommercialChart::QAbstractSeries"
- Property { name: "boxOutlineVisible"; type: "bool" }
- Property { name: "boxWidth"; type: "double" }
- Property { name: "pen"; type: "QPen" }
- Property { name: "brush"; type: "QBrush" }
- Property { name: "count"; revision: 1; type: "int"; isReadonly: true }
- Signal {
- name: "clicked"
- Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
- }
- Signal {
- name: "hovered"
- Parameter { name: "status"; type: "bool" }
- Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
- }
- Signal { name: "boxOutlineVisibilityChanged" }
- Signal {
- name: "boxsetsAdded"
- Parameter { name: "sets"; type: "QList<QBoxSet*>" }
- }
- Signal {
- name: "boxsetsRemoved"
- Parameter { name: "sets"; type: "QList<QBoxSet*>" }
- }
- }
- Component {
- name: "QtCommercialChart::QBoxSet"
- prototype: "QObject"
- Property { name: "pen"; type: "QPen" }
- Property { name: "brush"; type: "QBrush" }
- Signal { name: "clicked" }
- Signal {
- name: "hovered"
- Parameter { name: "status"; type: "bool" }
- }
- Signal { name: "valuesChanged" }
- Signal {
- name: "valueChanged"
- Parameter { name: "index"; type: "int" }
- }
- Signal { name: "cleared" }
- }
- Component {
- name: "QtCommercialChart::QCategoryAxis"
- prototype: "QtCommercialChart::QValueAxis"
- Property { name: "startValue"; type: "double" }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "categoriesLabels"; type: "QStringList"; isReadonly: true }
- Signal { name: "categoriesChanged" }
- }
- Component {
- name: "QtCommercialChart::QDateTimeAxis"
- prototype: "QtCommercialChart::QAbstractAxis"
- exports: ["QtCommercial.Chart/DateTimeAxis 1.1"]
- exportMetaObjectRevisions: [0]
- Property { name: "tickCount"; type: "int" }
- Property { name: "min"; type: "QDateTime" }
- Property { name: "max"; type: "QDateTime" }
- Property { name: "format"; type: "string" }
- Signal {
- name: "minChanged"
- Parameter { name: "min"; type: "QDateTime" }
- }
- Signal {
- name: "maxChanged"
- Parameter { name: "max"; type: "QDateTime" }
- }
- Signal {
- name: "rangeChanged"
- Parameter { name: "min"; type: "QDateTime" }
- Parameter { name: "max"; type: "QDateTime" }
- }
- Signal {
- name: "formatChanged"
- Parameter { name: "format"; type: "string" }
- }
- Signal {
- name: "tickCountChanged"
- Parameter { name: "tick"; type: "int" }
- }
- }
- Component {
- name: "QtCommercialChart::QHBarModelMapper"
- prototype: "QtCommercialChart::QBarModelMapper"
- exports: ["QtCommercial.Chart/HBarModelMapper 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
- Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
- Property { name: "firstBarSetRow"; type: "int" }
- Property { name: "lastBarSetRow"; type: "int" }
- Property { name: "firstColumn"; type: "int" }
- Property { name: "columnCount"; type: "int" }
- Signal { name: "seriesReplaced" }
- Signal { name: "modelReplaced" }
- }
- Component {
- name: "QtCommercialChart::QHPieModelMapper"
- prototype: "QtCommercialChart::QPieModelMapper"
- exports: ["QtCommercial.Chart/HPieModelMapper 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "series"; type: "QPieSeries"; isPointer: true }
- Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
- Property { name: "valuesRow"; type: "int" }
- Property { name: "labelsRow"; type: "int" }
- Property { name: "firstColumn"; type: "int" }
- Property { name: "columnCount"; type: "int" }
- Signal { name: "seriesReplaced" }
- Signal { name: "modelReplaced" }
- }
- Component {
- name: "QtCommercialChart::QHXYModelMapper"
- prototype: "QtCommercialChart::QXYModelMapper"
- exports: ["QtCommercial.Chart/HXYModelMapper 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "series"; type: "QXYSeries"; isPointer: true }
- Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
- Property { name: "xRow"; type: "int" }
- Property { name: "yRow"; type: "int" }
- Property { name: "firstColumn"; type: "int" }
- Property { name: "columnCount"; type: "int" }
- Signal { name: "seriesReplaced" }
- Signal { name: "modelReplaced" }
- }
- Component {
- name: "QtCommercialChart::QHorizontalBarSeries"
- prototype: "QtCommercialChart::QAbstractBarSeries"
- }
- Component {
- name: "QtCommercialChart::QHorizontalPercentBarSeries"
- prototype: "QtCommercialChart::QAbstractBarSeries"
- }
- Component {
- name: "QtCommercialChart::QHorizontalStackedBarSeries"
- prototype: "QtCommercialChart::QAbstractBarSeries"
- }
- Component {
- name: "QtCommercialChart::QLegend"
- defaultProperty: "children"
- prototype: "QGraphicsWidget"
- exports: ["QtCommercial.Chart/Legend 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "alignment"; type: "Qt::Alignment" }
- Property { name: "backgroundVisible"; type: "bool" }
- Property { name: "color"; type: "QColor" }
- Property { name: "borderColor"; type: "QColor" }
- Property { name: "font"; type: "QFont" }
- Property { name: "labelColor"; type: "QColor" }
- Property { name: "reverseMarkers"; type: "bool" }
- Signal {
- name: "backgroundVisibleChanged"
- Parameter { name: "visible"; type: "bool" }
- }
- Signal {
- name: "colorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "borderColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "labelColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "reverseMarkersChanged"
- Parameter { name: "reverseMarkers"; type: "bool" }
- }
- }
- Component { name: "QtCommercialChart::QLineSeries"; prototype: "QtCommercialChart::QXYSeries" }
- Component {
- name: "QtCommercialChart::QLogValueAxis"
- prototype: "QtCommercialChart::QAbstractAxis"
- exports: ["QtCommercial.Chart/LogValueAxis 1.3"]
- exportMetaObjectRevisions: [0]
- Property { name: "min"; type: "double" }
- Property { name: "max"; type: "double" }
- Property { name: "labelFormat"; type: "string" }
- Property { name: "base"; type: "double" }
- Signal {
- name: "minChanged"
- Parameter { name: "min"; type: "double" }
- }
- Signal {
- name: "maxChanged"
- Parameter { name: "max"; type: "double" }
- }
- Signal {
- name: "rangeChanged"
- Parameter { name: "min"; type: "double" }
- Parameter { name: "max"; type: "double" }
- }
- Signal {
- name: "labelFormatChanged"
- Parameter { name: "format"; type: "string" }
- }
- Signal {
- name: "baseChanged"
- Parameter { name: "base"; type: "double" }
- }
- }
- Component {
- name: "QtCommercialChart::QPercentBarSeries"
- prototype: "QtCommercialChart::QAbstractBarSeries"
- }
- Component {
- name: "QtCommercialChart::QPieModelMapper"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/PieModelMapper 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QtCommercialChart::QPieSeries"
- prototype: "QtCommercialChart::QAbstractSeries"
- exports: ["QtCommercial.Chart/QPieSeries 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "horizontalPosition"; type: "double" }
- Property { name: "verticalPosition"; type: "double" }
- Property { name: "size"; type: "double" }
- Property { name: "startAngle"; type: "double" }
- Property { name: "endAngle"; type: "double" }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "sum"; type: "double"; isReadonly: true }
- Property { name: "holeSize"; type: "double" }
- Signal {
- name: "added"
- Parameter { name: "slices"; type: "QList<QPieSlice*>" }
- }
- Signal {
- name: "removed"
- Parameter { name: "slices"; type: "QList<QPieSlice*>" }
- }
- Signal {
- name: "clicked"
- Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
- }
- Signal {
- name: "hovered"
- Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
- Parameter { name: "state"; type: "bool" }
- }
- }
- Component {
- name: "QtCommercialChart::QPieSlice"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/PieSlice 1.0"]
- exportMetaObjectRevisions: [0]
- Enum {
- name: "LabelPosition"
- values: {
- "LabelOutside": 0,
- "LabelInsideHorizontal": 1,
- "LabelInsideTangential": 2,
- "LabelInsideNormal": 3
- }
- }
- Property { name: "label"; type: "string" }
- Property { name: "value"; type: "double" }
- Property { name: "labelVisible"; type: "bool" }
- Property { name: "labelPosition"; type: "LabelPosition" }
- Property { name: "exploded"; type: "bool" }
- Property { name: "pen"; type: "QPen" }
- Property { name: "borderColor"; type: "QColor" }
- Property { name: "borderWidth"; type: "int" }
- Property { name: "brush"; type: "QBrush" }
- Property { name: "color"; type: "QColor" }
- Property { name: "labelBrush"; type: "QBrush" }
- Property { name: "labelColor"; type: "QColor" }
- Property { name: "labelFont"; type: "QFont" }
- Property { name: "labelArmLengthFactor"; type: "double" }
- Property { name: "explodeDistanceFactor"; type: "double" }
- Property { name: "percentage"; type: "double"; isReadonly: true }
- Property { name: "startAngle"; type: "double"; isReadonly: true }
- Property { name: "angleSpan"; type: "double"; isReadonly: true }
- Signal { name: "clicked" }
- Signal {
- name: "hovered"
- Parameter { name: "state"; type: "bool" }
- }
- }
- Component {
- name: "QtCommercialChart::QScatterSeries"
- prototype: "QtCommercialChart::QXYSeries"
- Enum {
- name: "MarkerShape"
- values: {
- "MarkerShapeCircle": 0,
- "MarkerShapeRectangle": 1
- }
- }
- Property { name: "color"; type: "QColor" }
- Property { name: "borderColor"; type: "QColor" }
- Property { name: "markerShape"; type: "MarkerShape" }
- Property { name: "markerSize"; type: "double" }
- Property { name: "brush"; type: "QBrush" }
- Signal {
- name: "colorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "borderColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- }
- Component {
- name: "QtCommercialChart::QSplineSeries"
- prototype: "QtCommercialChart::QLineSeries"
- }
- Component {
- name: "QtCommercialChart::QStackedBarSeries"
- prototype: "QtCommercialChart::QAbstractBarSeries"
- }
- Component {
- name: "QtCommercialChart::QVBarModelMapper"
- prototype: "QtCommercialChart::QBarModelMapper"
- exports: ["QtCommercial.Chart/VBarModelMapper 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
- Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
- Property { name: "firstBarSetColumn"; type: "int" }
- Property { name: "lastBarSetColumn"; type: "int" }
- Property { name: "firstRow"; type: "int" }
- Property { name: "rowCount"; type: "int" }
- Signal { name: "seriesReplaced" }
- Signal { name: "modelReplaced" }
- }
- Component {
- name: "QtCommercialChart::QVBoxPlotModelMapper"
- prototype: "QtCommercialChart::QBoxPlotModelMapper"
- exports: ["QtCommercial.Chart/VBoxPlotModelMapper 2.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "series"; type: "QBoxPlotSeries"; isPointer: true }
- Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
- Property { name: "firstBoxSetColumn"; type: "int" }
- Property { name: "lastBoxSetColumn"; type: "int" }
- Property { name: "firstRow"; type: "int" }
- Property { name: "rowCount"; type: "int" }
- Signal { name: "seriesReplaced" }
- Signal { name: "modelReplaced" }
- }
- Component {
- name: "QtCommercialChart::QVPieModelMapper"
- prototype: "QtCommercialChart::QPieModelMapper"
- exports: ["QtCommercial.Chart/VPieModelMapper 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "series"; type: "QPieSeries"; isPointer: true }
- Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
- Property { name: "valuesColumn"; type: "int" }
- Property { name: "labelsColumn"; type: "int" }
- Property { name: "firstRow"; type: "int" }
- Property { name: "rowCount"; type: "int" }
- Signal { name: "seriesReplaced" }
- Signal { name: "modelReplaced" }
- }
- Component {
- name: "QtCommercialChart::QVXYModelMapper"
- prototype: "QtCommercialChart::QXYModelMapper"
- exports: ["QtCommercial.Chart/VXYModelMapper 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "series"; type: "QXYSeries"; isPointer: true }
- Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
- Property { name: "xColumn"; type: "int" }
- Property { name: "yColumn"; type: "int" }
- Property { name: "firstRow"; type: "int" }
- Property { name: "rowCount"; type: "int" }
- Signal { name: "seriesReplaced" }
- Signal { name: "modelReplaced" }
- }
- Component {
- name: "QtCommercialChart::QValueAxis"
- prototype: "QtCommercialChart::QAbstractAxis"
- exports: [
- "QtCommercial.Chart/ValueAxis 1.1",
- "QtCommercial.Chart/ValuesAxis 1.0"
- ]
- exportMetaObjectRevisions: [0, 0]
- Property { name: "tickCount"; type: "int" }
- Property { name: "niceNumbersEnabled"; type: "bool" }
- Property { name: "min"; type: "double" }
- Property { name: "max"; type: "double" }
- Property { name: "labelFormat"; type: "string" }
- Signal {
- name: "minChanged"
- Parameter { name: "min"; type: "double" }
- }
- Signal {
- name: "maxChanged"
- Parameter { name: "max"; type: "double" }
- }
- Signal {
- name: "rangeChanged"
- Parameter { name: "min"; type: "double" }
- Parameter { name: "max"; type: "double" }
- }
- Signal {
- name: "tickCountChanged"
- Parameter { name: "tickCount"; type: "int" }
- }
- Signal {
- name: "labelFormatChanged"
- Parameter { name: "format"; type: "string" }
- }
- Method { name: "applyNiceNumbers" }
- }
- Component {
- name: "QtCommercialChart::QXYModelMapper"
- prototype: "QObject"
- exports: ["QtCommercial.Chart/XYModelMapper 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- }
- Component {
- name: "QtCommercialChart::QXYSeries"
- prototype: "QtCommercialChart::QAbstractSeries"
- exports: ["QtCommercial.Chart/XYSeries 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Property { name: "pointsVisible"; type: "bool" }
- Property { name: "color"; type: "QColor" }
- Property { name: "pointLabelsFormat"; type: "string" }
- Property { name: "pointLabelsVisible"; type: "bool" }
- Property { name: "pointLabelsFont"; type: "QFont" }
- Property { name: "pointLabelsColor"; type: "QColor" }
- Signal {
- name: "clicked"
- Parameter { name: "point"; type: "QPointF" }
- }
- Signal {
- name: "hovered"
- Parameter { name: "point"; type: "QPointF" }
- Parameter { name: "state"; type: "bool" }
- }
- Signal {
- name: "pointReplaced"
- Parameter { name: "index"; type: "int" }
- }
- Signal {
- name: "pointRemoved"
- Parameter { name: "index"; type: "int" }
- }
- Signal {
- name: "pointAdded"
- Parameter { name: "index"; type: "int" }
- }
- Signal {
- name: "colorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal { name: "pointsReplaced" }
- Signal {
- name: "pointLabelsFormatChanged"
- Parameter { name: "format"; type: "string" }
- }
- Signal {
- name: "pointLabelsVisibilityChanged"
- Parameter { name: "visible"; type: "bool" }
- }
- Signal {
- name: "pointLabelsFontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "pointLabelsColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- }
-}
diff --git a/plugins/quick2/qmldir b/plugins/quick2/qmldir
deleted file mode 100644
index d0035f70..00000000
--- a/plugins/quick2/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module QtCommercial.Chart
-plugin qtcommercialchartqml2
-classname ChartQmlPlugin
diff --git a/plugins/quick2/quick2.pro b/plugins/quick2/quick2.pro
deleted file mode 100644
index 235ebc2c..00000000
--- a/plugins/quick2/quick2.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TARGET = qtcommercialchartqml2
-QT += quick qml widgets
-IMPORT_INSTALL_PATH = $$[QT_INSTALL_QML]
-DEFINES += CHARTS_FOR_QUICK2
-
-!include(../declarative/declarative.pri) {
- error( "Couldn't find the declarative.pri file!" )
-}
-qmldir.files += plugins.qmltypes
-TARGETPATH = QtCommercial.Chart
-QMAKE_MOC_OPTIONS += -Muri=$$TARGETPATH
diff --git a/qtcharts.pro b/qtcharts.pro
new file mode 100644
index 00000000..89737acf
--- /dev/null
+++ b/qtcharts.pro
@@ -0,0 +1,3 @@
+load(qt_parts)
+
+OTHER_FILES += README dist/*
diff --git a/src/animations/axisanimation.cpp b/src/animations/axisanimation.cpp
deleted file mode 100644
index 63514238..00000000
--- a/src/animations/axisanimation.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "axisanimation_p.h"
-#include "chartaxiselement_p.h"
-#include "qabstractaxis_p.h"
-
-Q_DECLARE_METATYPE(QVector<qreal>)
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-
-AxisAnimation::AxisAnimation(ChartAxisElement *axis)
- : ChartAnimation(axis),
- m_axis(axis),
- m_type(DefaultAnimation)
-{
- setDuration(ChartAnimationDuration);
- setEasingCurve(QEasingCurve::OutQuart);
-}
-
-AxisAnimation::~AxisAnimation()
-{
-}
-
-void AxisAnimation::setAnimationType(Animation type)
-{
- if (state() != QAbstractAnimation::Stopped)
- stop();
- m_type = type;
-}
-
-void AxisAnimation::setAnimationPoint(const QPointF &point)
-{
- if (state() != QAbstractAnimation::Stopped)
- stop();
- m_point = point;
-}
-
-void AxisAnimation::setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayout)
-{
- if (state() != QAbstractAnimation::Stopped) stop();
-
- switch (m_type) {
- case ZoomOutAnimation: {
- QRectF rect = m_axis->gridGeometry();
- oldLayout.resize(newLayout.count());
-
- for (int i = 0, j = oldLayout.count() - 1; i < (oldLayout.count() + 1) / 2; ++i, --j) {
- oldLayout[i] = m_axis->axis()->orientation() == Qt::Horizontal ? rect.left() : rect.bottom();
- oldLayout[j] = m_axis->axis()->orientation() == Qt::Horizontal ? rect.right() : rect.top();
- }
- }
- break;
- case ZoomInAnimation: {
- int index = qMin(oldLayout.count() * (m_axis->axis()->orientation() == Qt::Horizontal ? m_point.x() : (1 - m_point.y())), newLayout.count() - (qreal)1.0);
- oldLayout.resize(newLayout.count());
-
- for (int i = 0; i < oldLayout.count(); i++)
- oldLayout[i] = oldLayout[index];
- }
- break;
- case MoveForwardAnimation: {
- oldLayout.resize(newLayout.count());
-
- for (int i = 0, j = i + 1; i < oldLayout.count() - 1; ++i, ++j)
- oldLayout[i] = oldLayout[j];
- }
- break;
- case MoveBackwordAnimation: {
- oldLayout.resize(newLayout.count());
-
- for (int i = oldLayout.count() - 1, j = i - 1; i > 0; --i, --j)
- oldLayout[i] = oldLayout[j];
- }
- break;
- default: {
- oldLayout.resize(newLayout.count());
- QRectF rect = m_axis->gridGeometry();
- for (int i = 0, j = oldLayout.count() - 1; i < oldLayout.count(); ++i, --j)
- oldLayout[i] = m_axis->axis()->orientation() == Qt::Horizontal ? rect.left() : rect.top();
- }
- break;
- }
-
- QVariantAnimation::KeyValues value;
- setKeyValues(value); //workaround for wrong interpolation call
- setKeyValueAt(0.0, qVariantFromValue(oldLayout));
- setKeyValueAt(1.0, qVariantFromValue(newLayout));
-}
-
-QVariant AxisAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
-{
- QVector<qreal> startVector = qvariant_cast<QVector<qreal> >(start);
- QVector<qreal> endVecotr = qvariant_cast<QVector<qreal> >(end);
- QVector<qreal> result;
-
- Q_ASSERT(startVector.count() == endVecotr.count()) ;
-
- for (int i = 0; i < startVector.count(); i++) {
- qreal value = startVector[i] + ((endVecotr[i] - startVector[i]) * progress); //qBound(0.0, progress, 1.0));
- result << value;
- }
- return qVariantFromValue(result);
-}
-
-
-void AxisAnimation::updateCurrentValue(const QVariant &value)
-{
- if (state() != QAbstractAnimation::Stopped) { //workaround
- QVector<qreal> vector = qvariant_cast<QVector<qreal> >(value);
-// Q_ASSERT(vector.count() != 0);
- m_axis->setLayout(vector);
- m_axis->updateGeometry();
- }
-
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/animations/axisanimation_p.h b/src/animations/axisanimation_p.h
deleted file mode 100644
index 1bdc9f57..00000000
--- a/src/animations/axisanimation_p.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef AXISANIMATION_H
-#define AXISANIMATION_H
-
-#include "chartanimation_p.h"
-#include <QPointF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartAxisElement;
-
-class AxisAnimation: public ChartAnimation
-{
-public:
- enum Animation { DefaultAnimation, ZoomOutAnimation, ZoomInAnimation, MoveForwardAnimation, MoveBackwordAnimation};
- AxisAnimation(ChartAxisElement *axis);
- ~AxisAnimation();
- void setAnimationType(Animation type);
- void setAnimationPoint(const QPointF &point);
- void setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayout);
-protected:
- QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
- void updateCurrentValue(const QVariant &value);
-private:
- ChartAxisElement *m_axis;
- Animation m_type;
- QPointF m_point;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-
-
-#endif /* AXISANIMATION_H */
diff --git a/src/animations/baranimation.cpp b/src/animations/baranimation.cpp
deleted file mode 100644
index cd38ea9f..00000000
--- a/src/animations/baranimation.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "baranimation_p.h"
-#include "abstractbarchartitem_p.h"
-
-Q_DECLARE_METATYPE(QVector<QRectF>)
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-BarAnimation::BarAnimation(AbstractBarChartItem *item)
- : ChartAnimation(item),
- m_item(item)
-{
- setDuration(ChartAnimationDuration);
- setEasingCurve(QEasingCurve::OutQuart);
-}
-
-BarAnimation::~BarAnimation()
-{
-}
-
-QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
-{
- QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from);
- QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to);
- QVector<QRectF> result;
-
- Q_ASSERT(startVector.count() == endVector.count());
-
- for (int i = 0; i < startVector.count(); i++) {
- QRectF start = startVector[i].normalized();
- QRectF end = endVector[i].normalized();
- qreal x1 = start.left() + progress * (end.left() - start.left());
- qreal x2 = start.right() + progress * (end.right() - start.right());
- qreal y1 = start.top() + progress * (end.top() - start.top());
- qreal y2 = start.bottom() + progress * (end.bottom() - start.bottom());
-
- QRectF value(QPointF(x1, y1), QPointF(x2, y2));
- result << value.normalized();
- }
- return qVariantFromValue(result);
-}
-
-void BarAnimation::updateCurrentValue(const QVariant &value)
-{
- if (state() != QAbstractAnimation::Stopped) { //workaround
-
- QVector<QRectF> layout = qvariant_cast<QVector<QRectF> >(value);
- m_item->setLayout(layout);
- }
-}
-
-void BarAnimation::setup(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout)
-{
- QVariantAnimation::KeyValues value;
- setKeyValues(value); //workaround for wrong interpolation call
- setKeyValueAt(0.0, qVariantFromValue(oldLayout));
- setKeyValueAt(1.0, qVariantFromValue(newLayout));
-}
-
-#include "moc_baranimation_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/animations/baranimation_p.h b/src/animations/baranimation_p.h
deleted file mode 100644
index 756d344a..00000000
--- a/src/animations/baranimation_p.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef BARANIMATION_P_H
-#define BARANIMATION_P_H
-
-#include "chartanimation_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class AbstractBarChartItem;
-
-class BarAnimation : public ChartAnimation
-{
- Q_OBJECT
-
-public:
- BarAnimation(AbstractBarChartItem *item);
- ~BarAnimation();
-
-public: // from QVariantAnimation
- virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
- virtual void updateCurrentValue(const QVariant &value);
-
- void setup(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout);
-
-protected:
- AbstractBarChartItem *m_item;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // BARANIMATION_P_H
diff --git a/src/animations/boxplotanimation.cpp b/src/animations/boxplotanimation.cpp
deleted file mode 100644
index fc9a9619..00000000
--- a/src/animations/boxplotanimation.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "boxplotanimation_p.h"
-#include "boxplotchartitem_p.h"
-#include "boxwhiskersdata_p.h"
-#include "boxwhiskersanimation_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-BoxPlotAnimation::BoxPlotAnimation(BoxPlotChartItem *item)
- : QObject(item),
- m_item(item)
-{
-}
-
-BoxPlotAnimation::~BoxPlotAnimation()
-{
-}
-
-void BoxPlotAnimation::addBox(BoxWhiskers *box)
-{
- BoxWhiskersAnimation *animation = m_animations.value(box);
- if (!animation) {
- animation = new BoxWhiskersAnimation(box, this);
- m_animations.insert(box, animation);
- BoxWhiskersData start;
- start.m_lowerExtreme = box->m_data.m_median;
- start.m_lowerQuartile = box->m_data.m_median;
- start.m_median = box->m_data.m_median;
- start.m_upperQuartile = box->m_data.m_median;
- start.m_upperExtreme = box->m_data.m_median;
- animation->setup(start, box->m_data);
- } else {
- animation->stop();
- animation->setEndData(box->m_data);
- }
-}
-
-ChartAnimation *BoxPlotAnimation::boxAnimation(BoxWhiskers *box)
-{
- BoxWhiskersAnimation *animation = m_animations.value(box);
- if (animation)
- animation->m_changeAnimation = false;
-
- return animation;
-}
-
-ChartAnimation *BoxPlotAnimation::boxChangeAnimation(BoxWhiskers *box)
-{
- BoxWhiskersAnimation *animation = m_animations.value(box);
- animation->m_changeAnimation = true;
- animation->setEndData(box->m_data);
-
- return animation;
-}
-
-void BoxPlotAnimation::setAnimationStart(BoxWhiskers *box)
-{
- BoxWhiskersAnimation *animation = m_animations.value(box);
- animation->setStartData(box->m_data);
-}
-
-void BoxPlotAnimation::stopAll()
-{
- foreach (BoxWhiskers *box, m_animations.keys()) {
- BoxWhiskersAnimation *animation = m_animations.value(box);
- animation->stopAndDestroyLater();
- m_animations.remove(box);
- }
-}
-
-void BoxPlotAnimation::removeBoxAnimation(BoxWhiskers *box)
-{
- m_animations.remove(box);
-}
-
-#include "moc_boxplotanimation_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/animations/boxplotanimation_p.h b/src/animations/boxplotanimation_p.h
deleted file mode 100644
index f7da1f83..00000000
--- a/src/animations/boxplotanimation_p.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef BOXPLOTANIMATION_P_H
-#define BOXPLOTANIMATION_P_H
-
-#include "chartanimation_p.h"
-#include "boxwhiskers_p.h"
-#include "boxwhiskersdata_p.h"
-#include "boxwhiskersanimation_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class BoxPlotChartItem;
-
-class BoxPlotAnimation : public QObject
-{
- Q_OBJECT
-public:
- BoxPlotAnimation(BoxPlotChartItem *item);
- ~BoxPlotAnimation();
-
- void addBox(BoxWhiskers *box);
- ChartAnimation *boxAnimation(BoxWhiskers *box);
- ChartAnimation *boxChangeAnimation(BoxWhiskers *box);
-
- void setAnimationStart(BoxWhiskers *box);
- void stopAll();
- void removeBoxAnimation(BoxWhiskers *box);
-
-protected:
- BoxPlotChartItem *m_item;
- QHash<BoxWhiskers *, BoxWhiskersAnimation *> m_animations;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // BOXPLOTANIMATION_P_H
diff --git a/src/animations/boxwhiskersanimation.cpp b/src/animations/boxwhiskersanimation.cpp
deleted file mode 100644
index a8987173..00000000
--- a/src/animations/boxwhiskersanimation.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "boxwhiskersanimation_p.h"
-#include "boxplotanimation_p.h"
-#include "boxplotchartitem_p.h"
-#include "boxwhiskersdata_p.h"
-
-Q_DECLARE_METATYPE(QVector<QRectF>)
-Q_DECLARE_METATYPE(QTCOMMERCIALCHART_NAMESPACE::BoxWhiskersData)
-Q_DECLARE_METATYPE(qreal)
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation)
- : ChartAnimation(box),
- m_box(box),
- m_boxPlotAnimation(boxPlotAnimation)
-{
- setDuration(ChartAnimationDuration);
- setEasingCurve(QEasingCurve::OutQuart);
-}
-
-BoxWhiskersAnimation::~BoxWhiskersAnimation()
-{
- if (m_boxPlotAnimation)
- m_boxPlotAnimation->removeBoxAnimation(m_box);
-}
-
-QVariant BoxWhiskersAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
-{
- BoxWhiskersData startData = qvariant_cast<BoxWhiskersData>(from);
- BoxWhiskersData endData = qvariant_cast<BoxWhiskersData>(to);
- BoxWhiskersData result;
-
- if (m_changeAnimation) {
- result.m_lowerExtreme = startData.m_lowerExtreme + progress * (endData.m_lowerExtreme - startData.m_lowerExtreme);
- result.m_lowerQuartile = startData.m_lowerQuartile + progress * (endData.m_lowerQuartile - startData.m_lowerQuartile);
- result.m_median = startData.m_median + progress * (endData.m_median - startData.m_median);
- result.m_upperQuartile = startData.m_upperQuartile + progress * (endData.m_upperQuartile - startData.m_upperQuartile);
- result.m_upperExtreme = startData.m_upperExtreme + progress * (endData.m_upperExtreme - startData.m_upperExtreme);
- } else {
- result.m_lowerExtreme = endData.m_median + progress * (endData.m_lowerExtreme - endData.m_median);
- result.m_lowerQuartile = endData.m_median + progress * (endData.m_lowerQuartile - endData.m_median);
- result.m_median = endData.m_median;
- result.m_upperQuartile = endData.m_median + progress * (endData.m_upperQuartile - endData.m_median);
- result.m_upperExtreme = endData.m_median + progress * (endData.m_upperExtreme - endData.m_median);
- }
- result.m_index = endData.m_index;
- result.m_boxItems = endData.m_boxItems;
-
- result.m_maxX = endData.m_maxX;
- result.m_minX = endData.m_minX;
- result.m_maxY = endData.m_maxY;
- result.m_minY = endData.m_minY;
- result.m_seriesIndex = endData.m_seriesIndex;
- result.m_seriesCount = endData.m_seriesCount;
-
- return qVariantFromValue(result);
-}
-
-void BoxWhiskersAnimation::updateCurrentValue(const QVariant &value)
-{
- BoxWhiskersData data = qvariant_cast<BoxWhiskersData>(value);
- m_box->setLayout(data);
-}
-
-void BoxWhiskersAnimation::setup(const BoxWhiskersData &startData, const BoxWhiskersData &endData)
-{
- setKeyValueAt(0.0, qVariantFromValue(startData));
- setKeyValueAt(1.0, qVariantFromValue(endData));
-}
-
-void BoxWhiskersAnimation::setEndData(const BoxWhiskersData &endData)
-{
- if (state() != QAbstractAnimation::Stopped)
- stop();
-
- setEndValue(qVariantFromValue(endData));
-}
-
-void BoxWhiskersAnimation::setStartData(const BoxWhiskersData &endData)
-{
- if (state() != QAbstractAnimation::Stopped)
- stop();
-
- setStartValue(qVariantFromValue(endData));
-}
-
-#include "moc_boxwhiskersanimation_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/animations/boxwhiskersanimation_p.h b/src/animations/boxwhiskersanimation_p.h
deleted file mode 100644
index 4f3d4183..00000000
--- a/src/animations/boxwhiskersanimation_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef BOXWHISKERSANIMATION_P_H
-#define BOXWHISKERSANIMATION_P_H
-
-#include "chartanimation_p.h"
-#include "boxwhiskers_p.h"
-#include "boxwhiskersdata_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class BoxPlotChartItem;
-class BoxPlotAnimation;
-
-class BoxWhiskersAnimation : public ChartAnimation
-{
- Q_OBJECT
-
-public:
- BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation);
- ~BoxWhiskersAnimation();
-
-public: // from QVariantAnimation
- virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
- virtual void updateCurrentValue(const QVariant &value);
-
- void setup(const BoxWhiskersData &startData, const BoxWhiskersData &endData);
- void setEndData(const BoxWhiskersData &endData);
- void setStartData(const BoxWhiskersData &endData);
-
- void moveMedianLine(bool move);
-
-protected:
- friend class BoxPlotAnimation;
- BoxWhiskers *m_box;
- bool m_changeAnimation;
- BoxPlotAnimation *m_boxPlotAnimation;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // BOXWHISKERSANIMATION_P_H
diff --git a/src/animations/chartanimation.cpp b/src/animations/chartanimation.cpp
deleted file mode 100644
index 2f739ab3..00000000
--- a/src/animations/chartanimation.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartanimation_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartAnimation::ChartAnimation(QObject *parent) :
- QVariantAnimation(parent),
- m_destructing(false)
-{
-}
-
-void ChartAnimation::stopAndDestroyLater()
-{
- m_destructing = true;
- stop();
- deleteLater();
-}
-
-void ChartAnimation::startChartAnimation()
-{
- if (!m_destructing)
- start();
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-
diff --git a/src/animations/chartanimation_p.h b/src/animations/chartanimation_p.h
deleted file mode 100644
index d924aba7..00000000
--- a/src/animations/chartanimation_p.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTANIMATION_H
-#define CHARTANIMATION_H
-
-#include "qchartglobal.h"
-#include <QVariantAnimation>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-const static int ChartAnimationDuration = 1000;
-
-class ChartAnimation: public QVariantAnimation
-{
- Q_OBJECT
-public:
- ChartAnimation(QObject *parent = 0);
-
- void stopAndDestroyLater();
-
-public Q_SLOTS:
- void startChartAnimation();
-
-protected:
- bool m_destructing;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTANIMATION_H */
diff --git a/src/animations/pieanimation.cpp b/src/animations/pieanimation.cpp
deleted file mode 100644
index fa14419e..00000000
--- a/src/animations/pieanimation.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "pieanimation_p.h"
-#include "piesliceanimation_p.h"
-#include "piechartitem_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PieAnimation::PieAnimation(PieChartItem *item)
- : ChartAnimation(item),
- m_item(item)
-{
-}
-
-PieAnimation::~PieAnimation()
-{
-}
-
-ChartAnimation *PieAnimation::updateValue(PieSliceItem *sliceItem, const PieSliceData &sliceData)
-{
- PieSliceAnimation *animation = m_animations.value(sliceItem);
- if (!animation) {
- animation = new PieSliceAnimation(sliceItem);
- m_animations.insert(sliceItem, animation);
- } else {
- animation->stop();
- }
-
- animation->updateValue(sliceData);
- animation->setDuration(ChartAnimationDuration);
- animation->setEasingCurve(QEasingCurve::OutQuart);
-
- return animation;
-}
-
-ChartAnimation *PieAnimation::addSlice(PieSliceItem *sliceItem, const PieSliceData &sliceData, bool startupAnimation)
-{
- PieSliceAnimation *animation = new PieSliceAnimation(sliceItem);
- m_animations.insert(sliceItem, animation);
-
- PieSliceData startValue = sliceData;
- startValue.m_radius = 0;
- if (startupAnimation)
- startValue.m_startAngle = 0;
- else
- startValue.m_startAngle = sliceData.m_startAngle + (sliceData.m_angleSpan / 2);
- startValue.m_angleSpan = 0;
-
- if (sliceData.m_holeRadius > 0)
- startValue.m_radius = sliceData.m_holeRadius;
-
- animation->setValue(startValue, sliceData);
- animation->setDuration(ChartAnimationDuration);
- animation->setEasingCurve(QEasingCurve::OutQuart);
-
- return animation;
-}
-
-ChartAnimation *PieAnimation::removeSlice(PieSliceItem *sliceItem)
-{
- PieSliceAnimation *animation = m_animations.value(sliceItem);
- Q_ASSERT(animation);
- animation->stop();
-
- PieSliceData endValue = animation->currentSliceValue();
- if (endValue.m_holeRadius > 0)
- endValue.m_radius = endValue.m_holeRadius;
- else
- endValue.m_radius = 0;
- endValue.m_startAngle = endValue.m_startAngle + endValue.m_angleSpan;
- endValue.m_angleSpan = 0;
- endValue.m_isLabelVisible = false;
-
- animation->updateValue(endValue);
- animation->setDuration(ChartAnimationDuration);
- animation->setEasingCurve(QEasingCurve::OutQuart);
-
- // PieSliceItem is the parent of PieSliceAnimation so the animation will be deleted as well..
- connect(animation, SIGNAL(finished()), sliceItem, SLOT(deleteLater()));
- m_animations.remove(sliceItem);
-
- return animation;
-}
-
-void PieAnimation::updateCurrentValue(const QVariant &)
-{
- // nothing to do...
-}
-
-#include "moc_pieanimation_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/animations/pieanimation_p.h b/src/animations/pieanimation_p.h
deleted file mode 100644
index 9059e81a..00000000
--- a/src/animations/pieanimation_p.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef PIEANIMATION_P_H
-#define PIEANIMATION_P_H
-
-#include "chartanimation_p.h"
-#include "piechartitem_p.h"
-#include "piesliceanimation_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class PieChartItem;
-
-class PieAnimation : public ChartAnimation
-{
- Q_OBJECT
-
-public:
- PieAnimation(PieChartItem *item);
- ~PieAnimation();
- ChartAnimation *updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue);
- ChartAnimation *addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation);
- ChartAnimation *removeSlice(PieSliceItem *sliceItem);
-
-public: // from QVariantAnimation
- void updateCurrentValue(const QVariant &value);
-
-private:
- PieChartItem *m_item;
- QHash<PieSliceItem *, PieSliceAnimation *> m_animations;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/animations/piesliceanimation.cpp b/src/animations/piesliceanimation.cpp
deleted file mode 100644
index deacda04..00000000
--- a/src/animations/piesliceanimation.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "piesliceanimation_p.h"
-#include "piechartitem_p.h"
-
-Q_DECLARE_METATYPE(QTCOMMERCIALCHART_NAMESPACE::PieSliceData)
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-qreal linearPos(qreal start, qreal end, qreal pos)
-{
- return start + ((end - start) * pos);
-}
-
-QPointF linearPos(QPointF start, QPointF end, qreal pos)
-{
- qreal x = linearPos(start.x(), end.x(), pos);
- qreal y = linearPos(start.y(), end.y(), pos);
- return QPointF(x, y);
-}
-
-QPen linearPos(QPen start, QPen end, qreal pos)
-{
- QColor c;
- c.setRedF(linearPos(start.color().redF(), end.color().redF(), pos));
- c.setGreenF(linearPos(start.color().greenF(), end.color().greenF(), pos));
- c.setBlueF(linearPos(start.color().blueF(), end.color().blueF(), pos));
- end.setColor(c);
- return end;
-}
-
-QBrush linearPos(QBrush start, QBrush end, qreal pos)
-{
- QColor c;
- c.setRedF(linearPos(start.color().redF(), end.color().redF(), pos));
- c.setGreenF(linearPos(start.color().greenF(), end.color().greenF(), pos));
- c.setBlueF(linearPos(start.color().blueF(), end.color().blueF(), pos));
- end.setColor(c);
- return end;
-}
-
-PieSliceAnimation::PieSliceAnimation(PieSliceItem *sliceItem)
- : ChartAnimation(sliceItem),
- m_sliceItem(sliceItem),
- m_currentValue(m_sliceItem->m_data)
-{
-
-}
-
-PieSliceAnimation::~PieSliceAnimation()
-{
-}
-
-void PieSliceAnimation::setValue(const PieSliceData &startValue, const PieSliceData &endValue)
-{
- if (state() != QAbstractAnimation::Stopped)
- stop();
-
- m_currentValue = startValue;
-
- setKeyValueAt(0.0, qVariantFromValue(startValue));
- setKeyValueAt(1.0, qVariantFromValue(endValue));
-}
-
-void PieSliceAnimation::updateValue(const PieSliceData &endValue)
-{
- if (state() != QAbstractAnimation::Stopped)
- stop();
-
- setKeyValueAt(0.0, qVariantFromValue(m_currentValue));
- setKeyValueAt(1.0, qVariantFromValue(endValue));
-}
-
-PieSliceData PieSliceAnimation::currentSliceValue()
-{
- // NOTE:
- // We must use an internal current value because QVariantAnimation::currentValue() is updated
- // before the animation is actually started. So if we get 2 updateValue() calls in a row the currentValue()
- // will have the end value set from the first call and the second call will interpolate that instead of
- // the original current value as it was before the first call.
- return m_currentValue;
-}
-
-QVariant PieSliceAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
-{
- PieSliceData startValue = qvariant_cast<PieSliceData>(start);
- PieSliceData endValue = qvariant_cast<PieSliceData>(end);
-
- PieSliceData result;
- result = endValue;
- result.m_center = linearPos(startValue.m_center, endValue.m_center, progress);
- result.m_radius = linearPos(startValue.m_radius, endValue.m_radius, progress);
- result.m_startAngle = linearPos(startValue.m_startAngle, endValue.m_startAngle, progress);
- result.m_angleSpan = linearPos(startValue.m_angleSpan, endValue.m_angleSpan, progress);
- result.m_slicePen = linearPos(startValue.m_slicePen, endValue.m_slicePen, progress);
- result.m_sliceBrush = linearPos(startValue.m_sliceBrush, endValue.m_sliceBrush, progress);
- result.m_holeRadius = linearPos(startValue.m_holeRadius, endValue.m_holeRadius, progress);
-
- return qVariantFromValue(result);
-}
-
-void PieSliceAnimation::updateCurrentValue(const QVariant &value)
-{
- if (state() != QAbstractAnimation::Stopped) { //workaround
- m_currentValue = qvariant_cast<PieSliceData>(value);
- m_sliceItem->setLayout(m_currentValue);
- }
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/animations/piesliceanimation_p.h b/src/animations/piesliceanimation_p.h
deleted file mode 100644
index 4abd2ada..00000000
--- a/src/animations/piesliceanimation_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef PIESLICEANIMATION_P_H
-#define PIESLICEANIMATION_P_H
-
-#include "chartanimation_p.h"
-#include "piesliceitem_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class PieChartItem;
-
-class PieSliceAnimation : public ChartAnimation
-{
-public:
- PieSliceAnimation(PieSliceItem *sliceItem);
- ~PieSliceAnimation();
- void setValue(const PieSliceData &startValue, const PieSliceData &endValue);
- void updateValue(const PieSliceData &endValue);
- PieSliceData currentSliceValue();
-
-protected:
- QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
- void updateCurrentValue(const QVariant &value);
-
-private:
- PieSliceItem *m_sliceItem;
- PieSliceData m_currentValue;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/animations/scatteranimation.cpp b/src/animations/scatteranimation.cpp
deleted file mode 100644
index ca6acfd6..00000000
--- a/src/animations/scatteranimation.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "scatteranimation_p.h"
-#include "scatterchartitem_p.h"
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ScatterAnimation::ScatterAnimation(ScatterChartItem *item)
- : XYAnimation(item)
-{
-}
-
-ScatterAnimation::~ScatterAnimation()
-{
-}
-
-void ScatterAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
-{
- XYAnimation::updateState(newState, oldState);
-
- if (oldState == QAbstractAnimation::Running && newState == QAbstractAnimation::Stopped
- && animationType() == RemovePointAnimation) {
- // Removing a point from scatter chart will keep extra marker item after animation stops.
- // Also, if the removed point was not the last one in series, points after the removed one
- // will report wrong coordinates when clicked. To fix these issues, update geometry after
- // point removal animation has finished.
- chartItem()->updateGeometry();
- }
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/animations/scatteranimation_p.h b/src/animations/scatteranimation_p.h
deleted file mode 100644
index 294cdd0d..00000000
--- a/src/animations/scatteranimation_p.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef SCATTERANIMATION_P_H
-#define SCATTERANIMATION_P_H
-#include "xyanimation_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ScatterChartItem;
-
-class ScatterAnimation : public XYAnimation
-{
-public:
- ScatterAnimation(ScatterChartItem *item);
- ~ScatterAnimation();
-
-protected:
- void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/animations/splineanimation.cpp b/src/animations/splineanimation.cpp
deleted file mode 100644
index de6efa11..00000000
--- a/src/animations/splineanimation.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "splineanimation_p.h"
-#include "splinechartitem_p.h"
-#include <QDebug>
-
-Q_DECLARE_METATYPE(QVector<QPointF>)
-Q_DECLARE_METATYPE(SplineVector)
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-SplineAnimation::SplineAnimation(SplineChartItem *item)
- : XYAnimation(item),
- m_item(item),
- m_valid(false)
-{
-}
-
-SplineAnimation::~SplineAnimation()
-{
-}
-
-void SplineAnimation::setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldControlPoints, QVector<QPointF> &newControlPoints, int index)
-{
- if (newPoints.count() * 2 - 2 != newControlPoints.count() || newControlPoints.count() < 2) {
- m_valid = false;
- m_dirty = false;
- m_item->setGeometryPoints(newPoints);
- m_item->setControlGeometryPoints(newControlPoints);
- m_item->setDirty(false);
- m_item->updateGeometry();
- return;
- }
-
- m_type = NewAnimation;
-
- if (state() != QAbstractAnimation::Stopped) {
- stop();
- m_dirty = false;
- }
-
- if (!m_dirty) {
- m_dirty = true;
- m_oldSpline.first = oldPoints;
- m_oldSpline.second = oldControlPoints;
- }
-
- m_newSpline.first = newPoints;
- m_newSpline.second = newControlPoints;
-
-
- int x = m_oldSpline.first.count();
- int y = m_newSpline.first.count();
-
- if (x - y == 1 && index >= 0 && y > 0) {
- //remove point
- if (index > 0) {
- m_newSpline.first.insert(index, newPoints[index - 1]);
- m_newSpline.second.insert((index - 1) * 2, newPoints[index - 1]);
- m_newSpline.second.insert((index - 1) * 2 + 1, newPoints[index - 1]);
- } else {
- m_newSpline.first.insert(0, newPoints[index]);
- m_newSpline.second.insert(0, newPoints[index]);
- m_newSpline.second.insert(1, newPoints[index]);
- }
- m_index = index;
- m_type = RemovePointAnimation;
- }
-
- if (x - y == -1 && index >= 0) {
- //add point
- if (index > 0) {
- m_oldSpline.first.insert(index, newPoints[index - 1]);
- m_oldSpline.second.insert((index - 1) * 2, newPoints[index - 1]);
- m_oldSpline.second.insert((index - 1) * 2 + 1, newPoints[index - 1]);
- } else {
- m_oldSpline.first.insert(0, newPoints[index]);
- m_oldSpline.second.insert(0, newPoints[index]);
- m_oldSpline.second.insert(1, newPoints[index]);
- }
- m_index = index;
- m_type = AddPointAnimation;
- }
-
- x = m_oldSpline.first.count();
- y = m_newSpline.first.count();
-
- if (x != y) {
- m_type = NewAnimation;
- } else if (m_type == NewAnimation) {
- m_type = ReplacePointAnimation;
- }
-
-
- setKeyValueAt(0.0, qVariantFromValue(m_oldSpline));
- setKeyValueAt(1.0, qVariantFromValue(m_newSpline));
-
- m_valid = true;
-
-}
-
-QVariant SplineAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
-{
-
- SplineVector startPair = qvariant_cast< SplineVector >(start);
- SplineVector endPair = qvariant_cast< SplineVector >(end);
- SplineVector result;
-
- switch (animationType()) {
- case RemovePointAnimation:
- case AddPointAnimation:
- case ReplacePointAnimation: {
- if (startPair.first.count() != endPair.first.count())
- break;
- Q_ASSERT(startPair.first.count() * 2 - 2 == startPair.second.count());
- Q_ASSERT(endPair.first.count() * 2 - 2 == endPair.second.count());
- for (int i = 0; i < endPair.first.count(); i++) {
- qreal x = startPair.first[i].x() + ((endPair.first[i].x() - startPair.first[i].x()) * progress);
- qreal y = startPair.first[i].y() + ((endPair.first[i].y() - startPair.first[i].y()) * progress);
- result.first << QPointF(x, y);
- if (i + 1 >= endPair.first.count())
- continue;
- x = startPair.second[i * 2].x() + ((endPair.second[i * 2].x() - startPair.second[i * 2].x()) * progress);
- y = startPair.second[i * 2].y() + ((endPair.second[i * 2].y() - startPair.second[i * 2].y()) * progress);
- result.second << QPointF(x, y);
- x = startPair.second[i * 2 + 1].x() + ((endPair.second[i * 2 + 1].x() - startPair.second[i * 2 + 1].x()) * progress);
- y = startPair.second[i * 2 + 1].y() + ((endPair.second[i * 2 + 1].y() - startPair.second[i * 2 + 1].y()) * progress);
- result.second << QPointF(x, y);
- }
- }
- break;
- case NewAnimation: {
- Q_ASSERT(endPair.first.count() * 2 - 2 == endPair.second.count());
- int count = endPair.first.count() * qBound(qreal(0), progress, qreal(1));
- for (int i = 0; i < count; i++) {
- result.first << endPair.first[i];
- if (i + 1 == count)
- break;
- result.second << endPair.second[2 * i];
- result.second << endPair.second[2 * i + 1];
- }
- }
- break;
- default:
- qWarning() << "Unknown type of animation";
- break;
- }
-
- return qVariantFromValue(result);
-}
-
-void SplineAnimation::updateCurrentValue(const QVariant &value)
-{
- if (state() != QAbstractAnimation::Stopped && m_valid) { //workaround
- QPair<QVector<QPointF >, QVector<QPointF > > pair = qvariant_cast< QPair< QVector<QPointF>, QVector<QPointF> > >(value);
- m_item->setGeometryPoints(pair.first);
- m_item->setControlGeometryPoints(pair.second);
- m_item->updateGeometry();
- m_item->setDirty(true);
- m_dirty = false;
- }
-}
-
-void SplineAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
-{
- XYAnimation::updateState(newState, oldState);
-
- if (oldState == QAbstractAnimation::Running && newState == QAbstractAnimation::Stopped) {
- if (m_item->isDirty() && m_type == RemovePointAnimation) {
- if (!m_newSpline.first.isEmpty()) {
- if (m_index) {
- m_newSpline.first.remove(m_index);
- m_newSpline.second.remove((m_index - 1) * 2);
- m_newSpline.second.remove((m_index - 1) * 2);
- } else {
- m_newSpline.first.remove(0);
- m_newSpline.second.remove(0);
- m_newSpline.second.remove(0);
- }
- }
- m_item->setGeometryPoints(m_newSpline.first);
- m_item->setControlGeometryPoints(m_newSpline.second);
- }
- }
-
- if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
- if (!m_valid)
- stop();
- }
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/animations/splineanimation_p.h b/src/animations/splineanimation_p.h
deleted file mode 100644
index a316e392..00000000
--- a/src/animations/splineanimation_p.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef SPLINEANIMATION_P_H
-#define SPLINEANIMATION_P_H
-#include "xyanimation_p.h"
-#include <QPointF>
-
-typedef QPair<QVector<QPointF >, QVector<QPointF > > SplineVector;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class SplineChartItem;
-
-class SplineAnimation : public XYAnimation
-{
-public:
- SplineAnimation(SplineChartItem *item);
- ~SplineAnimation();
- void setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index = -1);
-
-protected:
- QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
- void updateCurrentValue(const QVariant &value);
- void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
-
-private:
- SplineVector m_oldSpline;
- SplineVector m_newSpline;
- SplineChartItem *m_item;
- bool m_valid;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/animations/xyanimation.cpp b/src/animations/xyanimation.cpp
deleted file mode 100644
index 18e35cd6..00000000
--- a/src/animations/xyanimation.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xyanimation_p.h"
-#include "xychart_p.h"
-#include <QDebug>
-
-Q_DECLARE_METATYPE(QVector<QPointF>)
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-XYAnimation::XYAnimation(XYChart *item)
- : ChartAnimation(item),
- m_type(NewAnimation),
- m_dirty(false),
- m_index(-1),
- m_item(item)
-{
- setDuration(ChartAnimationDuration);
- setEasingCurve(QEasingCurve::OutQuart);
-}
-
-XYAnimation::~XYAnimation()
-{
-}
-
-void XYAnimation::setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints, int index)
-{
- m_type = NewAnimation;
-
- if (state() != QAbstractAnimation::Stopped) {
- stop();
- m_dirty = false;
- }
-
- if (!m_dirty) {
- m_dirty = true;
- m_oldPoints = oldPoints;
- }
-
- m_newPoints = newPoints;
-
- int x = m_oldPoints.count();
- int y = m_newPoints.count();
- int diff = x - y;
- int requestedDiff = oldPoints.count() - y;
-
- // m_oldPoints can be whatever between 0 and actual points count if new animation setup
- // interrupts a previous animation, so only do remove and add animations if both
- // stored diff and requested diff indicate add or remove. Also ensure that index is not
- // invalid.
- if (diff == 1 && requestedDiff == 1 && index >= 0 && y > 0 && index <= y) {
- //remove point
- m_newPoints.insert(index, index > 0 ? newPoints[index - 1] : newPoints[index]);
- m_index = index;
- m_type = RemovePointAnimation;
- }
-
- if (diff == -1 && requestedDiff == -1 && index >= 0 && index <= x) {
- //add point
- m_oldPoints.insert(index, index > 0 ? newPoints[index - 1] : newPoints[index]);
- m_index = index;
- m_type = AddPointAnimation;
- }
-
- x = m_oldPoints.count();
- y = m_newPoints.count();
-
- if (x != y)
- m_type = NewAnimation;
- else if (m_type == NewAnimation)
- m_type = ReplacePointAnimation;
-
- setKeyValueAt(0.0, qVariantFromValue(m_oldPoints));
- setKeyValueAt(1.0, qVariantFromValue(m_newPoints));
-}
-
-QVariant XYAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
-{
- QVector<QPointF> startVector = qvariant_cast<QVector<QPointF> >(start);
- QVector<QPointF> endVector = qvariant_cast<QVector<QPointF> >(end);
- QVector<QPointF> result;
-
- switch (m_type) {
-
- case ReplacePointAnimation:
- case AddPointAnimation:
- case RemovePointAnimation: {
- if (startVector.count() != endVector.count())
- break;
-
- for (int i = 0; i < startVector.count(); i++) {
- qreal x = startVector[i].x() + ((endVector[i].x() - startVector[i].x()) * progress);
- qreal y = startVector[i].y() + ((endVector[i].y() - startVector[i].y()) * progress);
- result << QPointF(x, y);
- }
-
- }
- break;
- case NewAnimation: {
- for (int i = 0; i < endVector.count() * qBound(qreal(0), progress, qreal(1)); i++)
- result << endVector[i];
- }
- break;
- default:
- qWarning() << "Unknown type of animation";
- break;
- }
-
- return qVariantFromValue(result);
-}
-
-void XYAnimation::updateCurrentValue(const QVariant &value)
-{
- if (state() != QAbstractAnimation::Stopped) { //workaround
-
- QVector<QPointF> vector = qvariant_cast<QVector<QPointF> >(value);
- m_item->setGeometryPoints(vector);
- m_item->updateGeometry();
- m_item->setDirty(true);
- m_dirty = false;
-
- }
-}
-
-void XYAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
-{
- if (oldState == QAbstractAnimation::Running && newState == QAbstractAnimation::Stopped) {
- if (m_item->isDirty() && m_type == RemovePointAnimation) {
- if (!m_newPoints.isEmpty())
- m_newPoints.remove(m_index);
- m_item->setGeometryPoints(m_newPoints);
- }
- }
-}
-
-#include "moc_chartanimation_p.cpp"
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/animations/xyanimation_p.h b/src/animations/xyanimation_p.h
deleted file mode 100644
index 875da1b9..00000000
--- a/src/animations/xyanimation_p.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef XYANIMATION_P_H
-#define XYANIMATION_P_H
-
-#include "chartanimation_p.h"
-#include <QPointF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class XYChart;
-
-class XYAnimation : public ChartAnimation
-{
-protected:
- enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation };
-public:
- XYAnimation(XYChart *item);
- ~XYAnimation();
- void setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints, int index = -1);
- Animation animationType() const { return m_type; };
-
-protected:
- QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
- void updateCurrentValue(const QVariant &value);
- void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
- XYChart *chartItem() { return m_item; }
-protected:
- Animation m_type;
- bool m_dirty;
- int m_index;
-private:
- XYChart *m_item;
- QVector<QPointF> m_oldPoints;
- QVector<QPointF> m_newPoints;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/areachart/areachartitem.cpp b/src/areachart/areachartitem.cpp
deleted file mode 100644
index eec37e86..00000000
--- a/src/areachart/areachartitem.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "areachartitem_p.h"
-#include "qareaseries.h"
-#include "qareaseries_p.h"
-#include "qlineseries.h"
-#include "chartpresenter_p.h"
-#include "abstractdomain_p.h"
-#include <QPainter>
-#include <QGraphicsSceneMouseEvent>
-#include <QDebug>
-
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item)
- : ChartItem(areaSeries->d_func(),item),
- m_series(areaSeries),
- m_upper(0),
- m_lower(0),
- m_pointsVisible(false),
- m_pointLabelsVisible(false),
- m_pointLabelsFormat(areaSeries->pointLabelsFormat()),
- m_pointLabelsFont(areaSeries->pointLabelsFont()),
- m_pointLabelsColor(areaSeries->pointLabelsColor())
-{
- setAcceptHoverEvents(true);
- setZValue(ChartPresenter::LineChartZValue);
- if (m_series->upperSeries())
- m_upper = new AreaBoundItem(this, m_series->upperSeries());
- if (m_series->lowerSeries())
- m_lower = new AreaBoundItem(this, m_series->lowerSeries());
-
- QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
- QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
- QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
- QObject::connect(this, SIGNAL(clicked(QPointF)), areaSeries, SIGNAL(clicked(QPointF)));
- QObject::connect(this, SIGNAL(hovered(QPointF,bool)), areaSeries, SIGNAL(hovered(QPointF,bool)));
- QObject::connect(areaSeries, SIGNAL(pointLabelsFormatChanged(QString)),
- this, SLOT(handleUpdated()));
- QObject::connect(areaSeries, SIGNAL(pointLabelsVisibilityChanged(bool)),
- this, SLOT(handleUpdated()));
- QObject::connect(areaSeries, SIGNAL(pointLabelsFontChanged(QFont)),
- this, SLOT(handleUpdated()));
- QObject::connect(areaSeries, SIGNAL(pointLabelsColorChanged(QColor)),
- this, SLOT(handleUpdated()));
-
- handleUpdated();
-}
-
-AreaChartItem::~AreaChartItem()
-{
- delete m_upper;
- delete m_lower;
-}
-
-void AreaChartItem::setPresenter(ChartPresenter *presenter)
-{
- if (m_upper)
- m_upper->setPresenter(presenter);
- if (m_lower) {
- m_lower->setPresenter(presenter);
- }
- ChartItem::setPresenter(presenter);
-}
-
-QRectF AreaChartItem::boundingRect() const
-{
- return m_rect;
-}
-
-QPainterPath AreaChartItem::shape() const
-{
- return m_path;
-}
-
-void AreaChartItem::updatePath()
-{
- QPainterPath path;
- QRectF rect(QPointF(0,0),domain()->size());
-
- path = m_upper->path();
-
- if (m_lower) {
- // Note: Polarcharts always draw area correctly only when both series have equal width or are
- // fully displayed. If one series is partally off-chart, the connecting line between
- // the series does not attach to the end of the partially hidden series but to the point
- // where it intersects the axis line. The problem is especially noticeable when one of the series
- // is entirely off-chart, in which case the connecting line connects two ends of the
- // visible series.
- // This happens because we get the paths from linechart, which omits off-chart segments.
- // To properly fix, linechart would need to provide true full path, in right, left, and the rest
- // portions to enable proper clipping. However, combining those to single visually unified area
- // would be a nightmare, since they would have to be painted separately.
- path.connectPath(m_lower->path().toReversed());
- } else {
- QPointF first = path.pointAtPercent(0);
- QPointF last = path.pointAtPercent(1);
- if (presenter()->chartType() == QChart::ChartTypeCartesian) {
- path.lineTo(last.x(), rect.bottom());
- path.lineTo(first.x(), rect.bottom());
- } else { // polar
- path.lineTo(rect.center());
- }
- }
- path.closeSubpath();
-
- // Only zoom in if the bounding rect of the path fits inside int limits. QWidget::update() uses
- // a region that has to be compatible with QRect.
- if (path.boundingRect().height() <= INT_MAX
- && path.boundingRect().width() <= INT_MAX) {
- prepareGeometryChange();
- m_path = path;
- m_rect = path.boundingRect();
- update();
- }
-}
-
-void AreaChartItem::handleUpdated()
-{
- setVisible(m_series->isVisible());
- m_pointsVisible = m_series->pointsVisible();
- m_linePen = m_series->pen();
- m_brush = m_series->brush();
- m_pointPen = m_series->pen();
- m_pointPen.setWidthF(2 * m_pointPen.width());
- setOpacity(m_series->opacity());
- m_pointLabelsFormat = m_series->pointLabelsFormat();
- m_pointLabelsVisible = m_series->pointLabelsVisible();
- m_pointLabelsFont = m_series->pointLabelsFont();
- m_pointLabelsColor = m_series->pointLabelsColor();
- update();
-}
-
-void AreaChartItem::handleDomainUpdated()
-{
- if (m_upper) {
- AbstractDomain* d = m_upper->domain();
- d->setSize(domain()->size());
- d->setRange(domain()->minX(),domain()->maxX(),domain()->minY(),domain()->maxY());
- m_upper->handleDomainUpdated();
- }
-
- if (m_lower) {
- AbstractDomain* d = m_lower->domain();
- d->setSize(domain()->size());
- d->setRange(domain()->minX(),domain()->maxX(),domain()->minY(),domain()->maxY());
- m_lower->handleDomainUpdated();
- }
-}
-
-void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(widget)
- Q_UNUSED(option)
- painter->save();
- painter->setPen(m_linePen);
- painter->setBrush(m_brush);
- QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
- if (presenter()->chartType() == QChart::ChartTypePolar)
- painter->setClipRegion(QRegion(clipRect.toRect(), QRegion::Ellipse));
- else
- painter->setClipRect(clipRect);
- painter->drawPath(m_path);
- if (m_pointsVisible) {
- painter->setPen(m_pointPen);
- painter->drawPoints(m_upper->geometryPoints());
- if (m_lower)
- painter->drawPoints(m_lower->geometryPoints());
- }
-
- // Draw series point label
- if (m_pointLabelsVisible) {
- static const QString xPointTag(QLatin1String("@xPoint"));
- static const QString yPointTag(QLatin1String("@yPoint"));
- const int labelOffset = 2;
-
- painter->setFont(m_pointLabelsFont);
- painter->setPen(QPen(m_pointLabelsColor));
- QFontMetrics fm(painter->font());
-
- QString pointLabel = m_pointLabelsFormat;
-
- if (m_series->upperSeries()) {
- for (int i(0); i < m_series->upperSeries()->count(); i++) {
- pointLabel.replace(xPointTag,
- presenter()->numberToString(m_series->upperSeries()->at(i).x()));
- pointLabel.replace(yPointTag,
- presenter()->numberToString(m_series->upperSeries()->at(i).y()));
-
- // Position text in relation to the point
- int pointLabelWidth = fm.width(pointLabel);
- QPointF position(m_upper->geometryPoints().at(i));
- position.setX(position.x() - pointLabelWidth / 2);
- position.setY(position.y() - m_series->upperSeries()->pen().width() / 2 - labelOffset);
-
- painter->drawText(position, pointLabel);
- }
- }
-
- if (m_series->lowerSeries()) {
- for (int i(0); i < m_series->lowerSeries()->count(); i++) {
- pointLabel.replace(xPointTag,
- presenter()->numberToString(m_series->lowerSeries()->at(i).x()));
- pointLabel.replace(yPointTag,
- presenter()->numberToString(m_series->lowerSeries()->at(i).y()));
-
- // Position text in relation to the point
- int pointLabelWidth = fm.width(pointLabel);
- QPointF position(m_lower->geometryPoints().at(i));
- position.setX(position.x() - pointLabelWidth / 2);
- position.setY(position.y() - m_series->lowerSeries()->pen().width() / 2 - labelOffset);
-
- painter->drawText(position, pointLabel);
- }
- }
- }
-
- painter->restore();
-}
-
-void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- emit clicked(m_upper->domain()->calculateDomainPoint(event->pos()));
- ChartItem::mousePressEvent(event);
-}
-
-void AreaChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
-{
- emit hovered(domain()->calculateDomainPoint(event->pos()), true);
- event->accept();
-// QGraphicsItem::hoverEnterEvent(event);
-}
-
-void AreaChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
-{
- emit hovered(domain()->calculateDomainPoint(event->pos()), false);
- event->accept();
-// QGraphicsItem::hoverEnterEvent(event);
-}
-
-#include "moc_areachartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/areachart/areachartitem_p.h b/src/areachart/areachartitem_p.h
deleted file mode 100644
index 25ef8916..00000000
--- a/src/areachart/areachartitem_p.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef AREACHARTITEM_H
-#define AREACHARTITEM_H
-
-#include "qchartglobal.h"
-#include "linechartitem_p.h"
-#include "qareaseries.h"
-#include <QPen>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class AreaChartItem;
-
-class AreaChartItem : public ChartItem
-{
- Q_OBJECT
-public:
- AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item = 0);
- ~AreaChartItem();
-
- //from QGraphicsItem
- QRectF boundingRect() const;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
- QPainterPath shape() const;
-
- LineChartItem *upperLineItem() const { return m_upper; }
- LineChartItem *lowerLineItem() const { return m_lower; }
-
- void updatePath();
-
- void setPresenter(ChartPresenter *presenter);
- QAreaSeries *series() const { return m_series; }
-
-protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
-
-Q_SIGNALS:
- void clicked(const QPointF &point);
- void hovered(const QPointF &point, bool state);
-
-public Q_SLOTS:
- void handleUpdated();
- void handleDomainUpdated();
-
-private:
- QAreaSeries *m_series;
- LineChartItem *m_upper;
- LineChartItem *m_lower;
- QPainterPath m_path;
- QRectF m_rect;
- QPen m_linePen;
- QPen m_pointPen;
- QBrush m_brush;
- bool m_pointsVisible;
-
- bool m_pointLabelsVisible;
- QString m_pointLabelsFormat;
- QFont m_pointLabelsFont;
- QColor m_pointLabelsColor;
-
-};
-
-class AreaBoundItem : public LineChartItem
-{
-public:
- AreaBoundItem(AreaChartItem *area, QLineSeries *lineSeries,QGraphicsItem* item = 0)
- : LineChartItem(lineSeries, item), m_item(area)
- {
- // We do not actually want to draw anything from LineChartItem.
- // Drawing is done in AreaChartItem only.
- setVisible(false);
- }
- ~AreaBoundItem() {}
-
- void updateGeometry()
- {
- // Turn off points drawing from component line chart item, as that
- // messes up the fill for area series.
- suppressPoints();
- // Component lineseries are not necessarily themselves on the chart,
- // so get the chart type for them from area chart.
- forceChartType(m_item->series()->chart()->chartType());
- LineChartItem::updateGeometry();
- m_item->updatePath();
- }
-
-private:
- AreaChartItem *m_item;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/areachart/qareaseries.cpp b/src/areachart/qareaseries.cpp
deleted file mode 100644
index 92d7be2f..00000000
--- a/src/areachart/qareaseries.cpp
+++ /dev/null
@@ -1,655 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qareaseries.h"
-#include "qareaseries_p.h"
-#include "qlineseries.h"
-#include "areachartitem_p.h"
-#include "abstractdomain_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "qvalueaxis.h"
-#include "qarealegendmarker.h"
-#include "qchart_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QAreaSeries
- \inmodule Qt Charts
- \brief The QAreaSeries class is used for making area charts.
-
- \mainclass
-
- An area chart is used to show quantitative data. It is based on line chart, in the way that area between axis and the line
- is emphasized with color. Since the area chart is based on line chart, QAreaSeries constructor needs QLineSeries instance,
- which defines "upper" boundary of the area. "Lower" boundary is defined by default by axis X. Instead of axis X "lower" boundary can be specified by other line.
- In that case QAreaSeries should be initiated with two QLineSeries instances. Please note terms "upper" and "lower" boundary can be misleading in cases
- where "lower" boundary had bigger values than the "upper" one, however the main point that area between these two boundary lines will be filled.
-
- See the \l {AreaChart Example} {area chart example} to learn how to create a simple area chart.
- \image examples_areachart.png
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype AreaSeries
- \instantiates QAreaSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/areaseries.qdocinc
-*/
-#else
-/*!
- \qmlclass AreaSeries QAreaSeries
-
- \include ../doc/src/areaseries.qdocinc
-*/
-#endif
-
-/*!
- \property QAreaSeries::upperSeries
- \brief The upper one of the two line series used to define area series boundaries.
-*/
-/*!
- \qmlproperty LineSeries AreaSeries::upperSeries
- The upper one of the two line series used to define area series boundaries.
-*/
-
-/*!
- \property QAreaSeries::lowerSeries
- The lower one of the two line series used to define are series boundaries. Note if
- QAreaSeries was constructed without a\ lowerSeries this is null.
-*/
-/*!
- \qmlproperty LineSeries AreaSeries::lowerSeries
- The lower one of the two line series used to define are series boundaries. Note if
- AreaSeries was constructed without a\ lowerSeries this is null.
-*/
-
-/*!
- \property QAreaSeries::color
- Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
- \sa QAreaSeries::brush()
-*/
-/*!
- \qmlproperty color AreaSeries::color
- Fill (brush) color of the series.
-*/
-
-/*!
- \property QAreaSeries::borderColor
- Line (pen) color of the series. This is a convenience property for modifying the color of pen.
- \sa QAreaSeries::pen()
-*/
-/*!
- \qmlproperty color AreaSeries::borderColor
- Line (pen) color of the series.
-*/
-
-/*!
- \qmlproperty real AreaSeries::borderWidth
- The width of the border line. By default the width is 2.0.
-*/
-
-/*!
- \fn QPen QAreaSeries::pen() const
- \brief Returns the pen used to draw line for this series.
- \sa setPen()
-*/
-
-/*!
- \fn QPen QAreaSeries::brush() const
- \brief Returns the brush used to draw line for this series.
- \sa setBrush()
-*/
-
-/*!
- \qmlproperty QString AreaSeries::brushFilename
- The name of the file used as a brush image for the series.
-*/
-
-/*!
- \fn void QAreaSeries::colorChanged(QColor color)
- \brief Signal is emitted when the fill (brush) color has changed to \a color.
-*/
-/*!
- \qmlsignal AreaSeries::onColorChanged(color color)
- Signal is emitted when the fill (brush) color has changed to \a color.
-*/
-
-/*!
- \fn void QAreaSeries::borderColorChanged(QColor color)
- \brief Signal is emitted when the line (pen) color has changed to \a color.
-*/
-/*!
- \qmlsignal AreaSeries::onBorderColorChanged(color color)
- Signal is emitted when the line (pen) color has changed to \a color.
-*/
-
-/*!
- \fn void QAreaSeries::clicked(const QPointF& point)
- \brief Signal is emitted when user clicks the \a point on area chart.
-*/
-/*!
- \qmlsignal AreaSeries::onClicked(QPointF point)
- Signal is emitted when user clicks the \a point on area chart.
-*/
-
-/*!
- \fn void QAreaSeries::hovered(const QPointF &point, bool state)
- This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
- of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
- the series.
-*/
-/*!
- \qmlsignal AreaSeries::onHovered(point point, bool state)
- This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
- of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
- the series.
-*/
-
-/*!
- \fn void QAreaSeries::selected()
- The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
- implemented by the user of QAreaSeries API.
-*/
-/*!
- \qmlsignal AreaSeries::onSelected()
- The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
- implemented by the user of AreaSeries API.
-*/
-
-/*!
- \fn void QAreaSeriesPrivate::updated()
- \brief \internal
-*/
-
-/*!
- \property QAreaSeries::pointLabelsFormat
- The \a format used for showing labels with series points.
-
- QAreaSeries supports the following format tags:
- \table
- \row
- \li @xPoint \li The x value of the data point
- \row
- \li @yPoint \li The y value of the data point
- \endtable
-
- For example, the following usage of the format tags would produce labels that have the data
- point (x, y) shown inside brackets separated by a comma:
- \code
- series->setPointLabelsFormat("(@xPoint, @yPoint)");
- \endcode
-
- By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot
- area, labels on the edge of the plot area are cut. If the points are close to each other the
- labels may overlap.
-
- \sa QAreaSeries::pointLabelsVisible, QAreaSeries::pointLabelsFont, QAreaSeries::pointLabelsColor
-*/
-/*!
- \qmlproperty string AreaSeries::pointLabelsFormat
- The \a format used for showing labels with series points.
-
- \sa QAreaSeries::pointLabelsFormat, pointLabelsVisible, pointLabelsFont, pointLabelsColor
-*/
-/*!
- \fn void QAreaSeries::pointLabelsFormatChanged(const QString &format)
- Signal is emitted when the \a format of data point labels is changed.
-*/
-/*!
- \qmlsignal AreaSeries::onPointLabelsFormatChanged(string format)
- Signal is emitted when the \a format of data point labels is changed.
-*/
-
-/*!
- \property QAreaSeries::pointLabelsVisible
- Defines the visibility for data point labels. False by default.
-
- \sa QAreaSeries::pointLabelsFormat
-*/
-/*!
- \qmlproperty bool AreaSeries::pointLabelsVisible
- Defines the visibility for data point labels.
-
- \sa pointLabelsFormat
-*/
-/*!
- \fn void QAreaSeries::pointLabelsVisibilityChanged(bool visible)
- The visibility of the data point labels is changed to \a visible.
-*/
-/*!
- \qmlsignal AreaSeries::onPointLabelsVisibilityChanged(bool visible)
- The visibility of the data point labels is changed to \a visible.
-*/
-
-/*!
- \property QAreaSeries::pointLabelsFont
- Defines the font used for data point labels.
-
- \sa QAreaSeries::pointLabelsFormat
-*/
-/*!
- \qmlproperty font AreaSeries::pointLabelsFont
- Defines the font used for data point labels.
-
- \sa pointLabelsFormat
-*/
-/*!
- \fn void QAreaSeries::pointLabelsFontChanged(const QFont &font);
- The font used for data point labels is changed to \a font.
-*/
-/*!
- \qmlsignal AreaSeries::onPointLabelsFontChanged(Font font)
- The font used for data point labels is changed to \a font.
-*/
-
-/*!
- \property QAreaSeries::pointLabelsColor
- Defines the color used for data point labels. By default, the color is the color of the brush
- defined in theme for labels.
-
- \sa QAreaSeries::pointLabelsFormat
-*/
-/*!
- \qmlproperty font AreaSeries::pointLabelsColor
- Defines the color used for data point labels. By default, the color is the color of the brush
- defined in theme for labels.
-
- \sa pointLabelsFormat
-*/
-/*!
- \fn void QAreaSeries::pointLabelsColorChanged(const QColor &color);
- The color used for data point labels is changed to \a color.
-*/
-/*!
- \qmlsignal AreaSeries::onPointLabelsColorChanged(Color color)
- The color used for data point labels is changed to \a color.
-*/
-
-/*!
- Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a
- upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead.
- When series object is added to QChartView or QChart instance ownerships is transferred.
-*/
-QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries)
- : QAbstractSeries(*new QAreaSeriesPrivate(upperSeries, lowerSeries, this), upperSeries)
-{
-}
-
-/*!
- Constructs area series object without upper or lower series with \a parent object.
-*/
-QAreaSeries::QAreaSeries(QObject *parent)
- : QAbstractSeries(*new QAreaSeriesPrivate(0, 0, this), parent)
-{
-}
-
-/*!
- Destroys the object.
-*/
-QAreaSeries::~QAreaSeries()
-{
- Q_D(QAreaSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-
-/*!
- Returns QAbstractSeries::SeriesTypeArea.
-*/
-QAbstractSeries::SeriesType QAreaSeries::type() const
-{
- return QAbstractSeries::SeriesTypeArea;
-}
-
-/*!
- Sets the \a series that is to be used as the area chart upper series.
-*/
-void QAreaSeries::setUpperSeries(QLineSeries *series)
-{
- Q_D(QAreaSeries);
- if (d->m_upperSeries != series)
- d->m_upperSeries = series;
-}
-
-QLineSeries *QAreaSeries::upperSeries() const
-{
- Q_D(const QAreaSeries);
- return d->m_upperSeries;
-}
-
-/*!
- Sets the \a series that is to be used as the area chart lower series.
-*/
-void QAreaSeries::setLowerSeries(QLineSeries *series)
-{
- Q_D(QAreaSeries);
- d->m_lowerSeries = series;
-}
-
-QLineSeries *QAreaSeries::lowerSeries() const
-{
- Q_D(const QAreaSeries);
- return d->m_lowerSeries;
-}
-
-/*!
- Sets \a pen used for drawing area outline.
-*/
-void QAreaSeries::setPen(const QPen &pen)
-{
- Q_D(QAreaSeries);
- if (d->m_pen != pen) {
- d->m_pen = pen;
- emit d->updated();
- }
-}
-
-QPen QAreaSeries::pen() const
-{
- Q_D(const QAreaSeries);
- if (d->m_pen == QChartPrivate::defaultPen())
- return QPen();
- else
- return d->m_pen;
-}
-
-/*!
- Sets \a brush used for filling the area.
-*/
-void QAreaSeries::setBrush(const QBrush &brush)
-{
- Q_D(QAreaSeries);
- if (d->m_brush != brush) {
- bool emitColorChanged = brush.color() != d->m_brush.color();
- d->m_brush = brush;
- emit d->updated();
- if (emitColorChanged)
- emit colorChanged(brush.color());
- }
-}
-
-QBrush QAreaSeries::brush() const
-{
- Q_D(const QAreaSeries);
- if (d->m_brush == QChartPrivate::defaultBrush())
- return QBrush();
- else
- return d->m_brush;
-}
-
-void QAreaSeries::setColor(const QColor &color)
-{
- QBrush b = brush();
- if (b == QBrush())
- b.setStyle(Qt::SolidPattern);
- b.setColor(color);
- setBrush(b);
-}
-
-QColor QAreaSeries::color() const
-{
- return brush().color();
-}
-
-void QAreaSeries::setBorderColor(const QColor &color)
-{
- QPen p = pen();
- if (p.color() != color) {
- p.setColor(color);
- setPen(p);
- emit borderColorChanged(color);
- }
-}
-
-QColor QAreaSeries::borderColor() const
-{
- return pen().color();
-}
-
-/*!
- Sets if data points are \a visible and should be drawn on line.
-*/
-void QAreaSeries::setPointsVisible(bool visible)
-{
- Q_D(QAreaSeries);
- if (d->m_pointsVisible != visible) {
- d->m_pointsVisible = visible;
- emit d->updated();
- }
-}
-
-/*!
- Returns if the points are drawn for this series.
- \sa setPointsVisible()
-*/
-bool QAreaSeries::pointsVisible() const
-{
- Q_D(const QAreaSeries);
- return d->m_pointsVisible;
-}
-
-void QAreaSeries::setPointLabelsFormat(const QString &format)
-{
- Q_D(QAreaSeries);
- if (d->m_pointLabelsFormat != format) {
- d->m_pointLabelsFormat = format;
- emit pointLabelsFormatChanged(format);
- }
-}
-
-QString QAreaSeries::pointLabelsFormat() const
-{
- Q_D(const QAreaSeries);
- return d->m_pointLabelsFormat;
-}
-
-void QAreaSeries::setPointLabelsVisible(bool visible)
-{
- Q_D(QAreaSeries);
- if (d->m_pointLabelsVisible != visible) {
- d->m_pointLabelsVisible = visible;
- emit pointLabelsVisibilityChanged(visible);
- }
-}
-
-bool QAreaSeries::pointLabelsVisible() const
-{
- Q_D(const QAreaSeries);
- return d->m_pointLabelsVisible;
-}
-
-void QAreaSeries::setPointLabelsFont(const QFont &font)
-{
- Q_D(QAreaSeries);
- if (d->m_pointLabelsFont != font) {
- d->m_pointLabelsFont = font;
- emit pointLabelsFontChanged(font);
- }
-}
-
-QFont QAreaSeries::pointLabelsFont() const
-{
- Q_D(const QAreaSeries);
- return d->m_pointLabelsFont;
-}
-
-void QAreaSeries::setPointLabelsColor(const QColor &color)
-{
- Q_D(QAreaSeries);
- if (d->m_pointLabelsColor != color) {
- d->m_pointLabelsColor = color;
- emit pointLabelsColorChanged(color);
- }
-}
-
-QColor QAreaSeries::pointLabelsColor() const
-{
- Q_D(const QAreaSeries);
- if (d->m_pointLabelsColor == QChartPrivate::defaultPen().color())
- return QPen().color();
- else
- return d->m_pointLabelsColor;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q)
- : QAbstractSeriesPrivate(q),
- m_brush(QChartPrivate::defaultBrush()),
- m_pen(QChartPrivate::defaultPen()),
- m_upperSeries(upperSeries),
- m_lowerSeries(lowerSeries),
- m_pointsVisible(false),
- m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")),
- m_pointLabelsVisible(false),
- m_pointLabelsFont(QChartPrivate::defaultFont()),
- m_pointLabelsColor(QChartPrivate::defaultPen().color())
-{
-}
-
-void QAreaSeriesPrivate::initializeDomain()
-{
- Q_Q(QAreaSeries);
-
- qreal minX(domain()->minX());
- qreal minY(domain()->minY());
- qreal maxX(domain()->maxX());
- qreal maxY(domain()->maxY());
-
- QLineSeries *upperSeries = q->upperSeries();
- QLineSeries *lowerSeries = q->lowerSeries();
-
- if (upperSeries) {
- const QList<QPointF>& points = upperSeries->points();
-
- for (int i = 0; i < points.count(); i++) {
- qreal x = points[i].x();
- qreal y = points[i].y();
- minX = qMin(minX, x);
- minY = qMin(minY, y);
- maxX = qMax(maxX, x);
- maxY = qMax(maxY, y);
- }
- }
- if (lowerSeries) {
-
- const QList<QPointF>& points = lowerSeries->points();
-
- for (int i = 0; i < points.count(); i++) {
- qreal x = points[i].x();
- qreal y = points[i].y();
- minX = qMin(minX, x);
- minY = qMin(minY, y);
- maxX = qMax(maxX, x);
- maxY = qMax(maxY, y);
- }
- }
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-void QAreaSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QAreaSeries);
- AreaChartItem *area = new AreaChartItem(q,parent);
- m_item.reset(area);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
-{
- Q_Q(QAreaSeries);
- AreaChartItem *area = static_cast<AreaChartItem *>(m_item.data());
-
- if (q->upperSeries() && area->upperLineItem()->animation())
- area->upperLineItem()->animation()->stopAndDestroyLater();
- if (q->lowerSeries() && area->lowerLineItem()->animation())
- area->lowerLineItem()->animation()->stopAndDestroyLater();
-
- if (options.testFlag(QChart::SeriesAnimations)) {
- area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem()));
- if (q->lowerSeries())
- area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem()));
- } else {
- if (q->upperSeries())
- area->upperLineItem()->setAnimation(0);
- if (q->lowerSeries())
- area->lowerLineItem()->setAnimation(0);
- }
- QAbstractSeriesPrivate::initializeAnimations(options);
-}
-
-QList<QLegendMarker*> QAreaSeriesPrivate::createLegendMarkers(QLegend* legend)
-{
- Q_Q(QAreaSeries);
- QList<QLegendMarker*> list;
- return list << new QAreaLegendMarker(q,legend);
-}
-
-
-void QAreaSeriesPrivate::initializeAxes()
-{
-
-}
-
-QAbstractAxis::AxisType QAreaSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
-{
- Q_UNUSED(orientation);
- return QAbstractAxis::AxisTypeValue;
-}
-
-QAbstractAxis* QAreaSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
-{
- Q_UNUSED(orientation);
- return new QValueAxis;
-}
-
-void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
-{
- Q_Q(QAreaSeries);
-
- const QList<QGradient> gradients = theme->seriesGradients();
- const QList<QColor> colors = theme->seriesColors();
-
- if (forced || QChartPrivate::defaultPen() == m_pen) {
- QPen pen;
- pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
- pen.setWidthF(2);
- q->setPen(pen);
- }
-
- if (forced || QChartPrivate::defaultBrush() == m_brush) {
- QBrush brush(colors.at(index % colors.size()));
- q->setBrush(brush);
- }
-
- if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
- QColor color = theme->labelBrush().color();
- q->setPointLabelsColor(color);
- }
-}
-
-
-#include "moc_qareaseries.cpp"
-#include "moc_qareaseries_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/areachart/qareaseries.h b/src/areachart/qareaseries.h
deleted file mode 100644
index a7c74073..00000000
--- a/src/areachart/qareaseries.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAREASERIES_H
-#define QAREASERIES_H
-
-#include <qchartglobal.h>
-#include <qabstractseries.h>
-#include <QPen>
-#include <QBrush>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QLineSeries;
-class QAreaSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QAbstractSeries
-{
- Q_OBJECT
- Q_PROPERTY(QLineSeries *upperSeries READ upperSeries)
- Q_PROPERTY(QLineSeries *lowerSeries READ lowerSeries)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
- Q_PROPERTY(QString pointLabelsFormat READ pointLabelsFormat WRITE setPointLabelsFormat NOTIFY pointLabelsFormatChanged)
- Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged)
- Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged)
- Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged)
-
-public:
- explicit QAreaSeries(QObject *parent = 0);
- explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0);
- ~QAreaSeries();
-
-public:
- QAbstractSeries::SeriesType type() const;
-
- void setUpperSeries(QLineSeries *series);
- QLineSeries *upperSeries() const;
- void setLowerSeries(QLineSeries *series);
- QLineSeries *lowerSeries() const;
-
- void setPen(const QPen &pen);
- QPen pen() const;
-
- void setBrush(const QBrush &brush);
- QBrush brush() const;
-
- void setColor(const QColor &color);
- QColor color() const;
-
- void setBorderColor(const QColor &color);
- QColor borderColor() const;
-
- void setPointsVisible(bool visible = true);
- bool pointsVisible() const;
-
- void setPointLabelsFormat(const QString &format);
- QString pointLabelsFormat() const;
-
- void setPointLabelsVisible(bool visible = true);
- bool pointLabelsVisible() const;
-
- void setPointLabelsFont(const QFont &font);
- QFont pointLabelsFont() const;
-
- void setPointLabelsColor(const QColor &color);
- QColor pointLabelsColor() const;
-
-Q_SIGNALS:
- void clicked(const QPointF &point);
- void hovered(const QPointF &point, bool state);
- void selected();
- void colorChanged(QColor color);
- void borderColorChanged(QColor color);
- void pointLabelsFormatChanged(const QString &format);
- void pointLabelsVisibilityChanged(bool visible);
- void pointLabelsFontChanged(const QFont &font);
- void pointLabelsColorChanged(const QColor &color);
-
-private:
- Q_DECLARE_PRIVATE(QAreaSeries)
- Q_DISABLE_COPY(QAreaSeries)
- friend class AreaLegendMarker;
- friend class AreaChartItem;
- friend class QAreaLegendMarkerPrivate;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QAREASERIES_H
diff --git a/src/areachart/qareaseries_p.h b/src/areachart/qareaseries_p.h
deleted file mode 100644
index 4efe7a98..00000000
--- a/src/areachart/qareaseries_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QAREASERIES_P_H
-#define QAREASERIES_P_H
-
-#include "qabstractseries_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAreaSeries;
-
-class QAreaSeriesPrivate: public QAbstractSeriesPrivate
-{
- Q_OBJECT
-
-public:
- QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q);
-
- void initializeDomain();
- void initializeAxes();
- void initializeGraphics(QGraphicsItem* parent);
- void initializeTheme(int index, ChartTheme* theme, bool forced = false);
- void initializeAnimations(QChart::AnimationOptions options);
-
- QList<QLegendMarker *> createLegendMarkers(QLegend *legend);
-
- QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
- QAbstractAxis* createDefaultAxis(Qt::Orientation) const;
-
-Q_SIGNALS:
- void updated();
-
-protected:
- QBrush m_brush;
- QPen m_pen;
- QLineSeries *m_upperSeries;
- QLineSeries *m_lowerSeries;
- bool m_pointsVisible;
- QString m_pointLabelsFormat;
- bool m_pointLabelsVisible;
- QFont m_pointLabelsFont;
- QColor m_pointLabelsColor;
-private:
- Q_DECLARE_PUBLIC(QAreaSeries);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/axis/barcategoryaxis/chartbarcategoryaxisx.cpp b/src/axis/barcategoryaxis/chartbarcategoryaxisx.cpp
deleted file mode 100644
index af9932b3..00000000
--- a/src/axis/barcategoryaxis/chartbarcategoryaxisx.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "chartbarcategoryaxisx_p.h"
-#include "chartpresenter_p.h"
-#include "qbarcategoryaxis_p.h"
-#include "abstractchartlayout_p.h"
-#include <QDebug>
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartBarCategoryAxisX::ChartBarCategoryAxisX(QBarCategoryAxis *axis, QGraphicsItem* item)
- : HorizontalAxis(axis, item, true),
- m_categoriesAxis(axis)
-{
- QObject::connect(m_categoriesAxis,SIGNAL(categoriesChanged()),this, SLOT(handleCategoriesChanged()));
- handleCategoriesChanged();
-}
-
-ChartBarCategoryAxisX::~ChartBarCategoryAxisX()
-{
-}
-
-QVector<qreal> ChartBarCategoryAxisX::calculateLayout() const
-{
- QVector<qreal> points;
- const QRectF& gridRect = gridGeometry();
- qreal range = max() - min();
- const qreal delta = gridRect.width() / range;
-
- if (delta < 2)
- return points;
-
- qreal adjustedMin = min() + 0.5;
- qreal offset = (ceil(adjustedMin) - adjustedMin) * delta;
-
- int count = qFloor(range);
- if (count < 1)
- return points;
-
- points.resize(count + 2);
-
- for (int i = 0; i < count + 2; ++i)
- points[i] = offset + (qreal(i) * delta) + gridRect.left();
-
- return points;
-}
-
-QStringList ChartBarCategoryAxisX::createCategoryLabels(const QVector<qreal>& layout) const
-{
- QStringList result ;
- const QRectF &gridRect = gridGeometry();
- qreal d = (max() - min()) / gridRect.width();
-
- for (int i = 0; i < layout.count() - 1; ++i) {
- qreal x = qFloor((((layout[i] + layout[i + 1]) / 2 - gridRect.left()) * d + min() + 0.5));
- if ((x < m_categoriesAxis->categories().count()) && (x >= 0)) {
- result << m_categoriesAxis->categories().at(x);
- } else {
- // No label for x coordinate
- result << "";
- }
- }
- result << "";
- return result;
-}
-
-
-void ChartBarCategoryAxisX::updateGeometry()
-{
- const QVector<qreal>& layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createCategoryLabels(layout));
- HorizontalAxis::updateGeometry();
-}
-
-void ChartBarCategoryAxisX::handleCategoriesChanged()
-{
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-QSizeF ChartBarCategoryAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
- QSizeF base = HorizontalAxis::sizeHint(which, constraint);
- QStringList ticksList = m_categoriesAxis->categories();
-
- qreal width = 0; // Width is irrelevant for X axes with interval labels
- qreal height = 0;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- height = boundingRect.height() + labelPadding() + base.height() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize:{
- qreal labelHeight = 0.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelHeight = qMax(rect.height(), labelHeight);
- }
- height = labelHeight + labelPadding() + base.height() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
- return sh;
-}
-
-#include "moc_chartbarcategoryaxisx_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/barcategoryaxis/chartbarcategoryaxisx_p.h b/src/axis/barcategoryaxis/chartbarcategoryaxisx_p.h
deleted file mode 100644
index 24dd024c..00000000
--- a/src/axis/barcategoryaxis/chartbarcategoryaxisx_p.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTBARCATEGORYAXISX_H
-#define CHARTBARCATEGORYAXISX_H
-
-#include "horizontalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartPresenter;
-class QBarCategoryAxis;
-
-class ChartBarCategoryAxisX : public HorizontalAxis
-{
- Q_OBJECT
-public:
- ChartBarCategoryAxisX(QBarCategoryAxis *axis, QGraphicsItem* item = 0);
- ~ChartBarCategoryAxisX();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-private:
- QStringList createCategoryLabels(const QVector<qreal>& layout) const;
-public Q_SLOTS:
- void handleCategoriesChanged();
-
-private:
- QBarCategoryAxis *m_categoriesAxis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTBARCATEGORYAXISX_H */
diff --git a/src/axis/barcategoryaxis/chartbarcategoryaxisy.cpp b/src/axis/barcategoryaxis/chartbarcategoryaxisy.cpp
deleted file mode 100644
index 48f9f2f6..00000000
--- a/src/axis/barcategoryaxis/chartbarcategoryaxisy.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "chartbarcategoryaxisy_p.h"
-#include "chartpresenter_p.h"
-#include "qbarcategoryaxis_p.h"
-#include "abstractchartlayout_p.h"
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartBarCategoryAxisY::ChartBarCategoryAxisY(QBarCategoryAxis *axis, QGraphicsItem* item)
- : VerticalAxis(axis, item, true),
- m_categoriesAxis(axis)
-{
- QObject::connect( m_categoriesAxis,SIGNAL(categoriesChanged()),this, SLOT(handleCategoriesChanged()));
- handleCategoriesChanged();
-}
-
-ChartBarCategoryAxisY::~ChartBarCategoryAxisY()
-{
-}
-
-QVector<qreal> ChartBarCategoryAxisY::calculateLayout() const
-{
- QVector<qreal> points;
- const QRectF& gridRect = gridGeometry();
- qreal range = max() - min();
- const qreal delta = gridRect.height() / range;
-
- if (delta < 2)
- return points;
-
- qreal adjustedMin = min() + 0.5;
- qreal offset = (ceil(adjustedMin) - adjustedMin) * delta;
-
- int count = qFloor(range);
- if (count < 1)
- return points;
-
- points.resize(count + 2);
-
- for (int i = 0; i < count + 2; ++i)
- points[i] = gridRect.bottom() - (qreal(i) * delta) - offset;
-
- return points;
-}
-
-QStringList ChartBarCategoryAxisY::createCategoryLabels(const QVector<qreal>& layout) const
-{
- QStringList result;
- const QRectF &gridRect = gridGeometry();
- qreal d = (max() - min()) / gridRect.height();
-
- for (int i = 0; i < layout.count() - 1; ++i) {
- qreal x = qFloor(((gridRect.height() - (layout[i + 1] + layout[i]) / 2 + gridRect.top()) * d + min() + 0.5));
- if ((x < m_categoriesAxis->categories().count()) && (x >= 0)) {
- result << m_categoriesAxis->categories().at(x);
- } else {
- // No label for x coordinate
- result << "";
- }
- }
- result << "";
- return result;
-}
-
-void ChartBarCategoryAxisY::updateGeometry()
-{
- const QVector<qreal>& layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createCategoryLabels(layout));
- VerticalAxis::updateGeometry();
-}
-
-void ChartBarCategoryAxisY::handleCategoriesChanged()
-{
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-QSizeF ChartBarCategoryAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
- QSizeF base = VerticalAxis::sizeHint(which, constraint);
- QStringList ticksList = m_categoriesAxis->categories();
- qreal width = 0;
- qreal height = 0; // Height is irrelevant for Y axes with interval labels
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() + labelPadding() + base.width() + 1.0;
- if (base.width() > 0.0)
- width += labelPadding();
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize:{
- qreal labelWidth = 0.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelWidth = qMax(rect.width(), labelWidth);
- }
- width = labelWidth + labelPadding() + base.width() + 1.0;
- if (base.width() > 0.0)
- width += labelPadding();
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
- return sh;
-}
-
-#include "moc_chartbarcategoryaxisy_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/barcategoryaxis/chartbarcategoryaxisy_p.h b/src/axis/barcategoryaxis/chartbarcategoryaxisy_p.h
deleted file mode 100644
index 76eddfff..00000000
--- a/src/axis/barcategoryaxis/chartbarcategoryaxisy_p.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTBARCATEGORYAXISY_H
-#define CHARTBARCATEGORYAXISY_H
-
-#include "verticalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarCategoryAxis;
-class ChartPresenter;
-
-class ChartBarCategoryAxisY : public VerticalAxis
-{
- Q_OBJECT
-public:
- ChartBarCategoryAxisY(QBarCategoryAxis *axis, QGraphicsItem* item = 0);
- ~ChartBarCategoryAxisY();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-private:
- QStringList createCategoryLabels(const QVector<qreal>& layout) const;
-public Q_SLOTS:
- void handleCategoriesChanged();
-private:
- QBarCategoryAxis *m_categoriesAxis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTBARCATEGORYAXISY_H */
diff --git a/src/axis/barcategoryaxis/qbarcategoryaxis.cpp b/src/axis/barcategoryaxis/qbarcategoryaxis.cpp
deleted file mode 100644
index fa90de64..00000000
--- a/src/axis/barcategoryaxis/qbarcategoryaxis.cpp
+++ /dev/null
@@ -1,612 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbarcategoryaxis.h"
-#include "qbarcategoryaxis_p.h"
-#include "chartbarcategoryaxisx_p.h"
-#include "chartbarcategoryaxisy_p.h"
-#include "abstractdomain_p.h"
-#include "qchart.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-/*!
- \class QBarCategoryAxis
- \inmodule Qt Charts
- \brief The QBarCategoryAxis class is used for manipulating chart's axis.
- \mainclass
-
- QBarCategoryAxis can be setup to show axis line with tick marks, grid lines and shades.
- Categories are drawn between ticks. Note that you can use this also with lineseries too.
- See the \l {Line and BarChart Example} {Line and BarChart Example} to learn how to do that.
-
- Example code on how to use QBarCategoryAxis.
- \code
- QChartView *chartView = new QChartView;
- QBarSeries *series = new QBarSeries;
- // ...
- chartView->chart()->addSeries(series);
- chartView->chart()->createDefaultAxes();
-
- QBarCategoryAxis *axisX = new QBarCategoryAxis;
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- axisX->append(categories);
- axisX->setRange("Feb", "May");
- chartView->chart()->setAxisX(axisX, series);
- \endcode
-*/
-
-#ifdef QDOC_QT5
-/*!
- \qmltype BarCategoryAxis
- \instantiates QBarCategoryAxis
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/barcategoryaxis.qdocinc
-*/
-#else
-/*!
- \qmlclass BarCategoryAxis QBarCategoryAxis
-
- \include ../doc/src/barcategoryaxis.qdocinc
-*/
-#endif
-
-/*!
- \property QBarCategoryAxis::categories
- Defines the categories of axis
-*/
-/*!
- \qmlproperty QStringList BarCategoryAxis::categories
- Defines the categories of axis
-*/
-
-/*!
- \property QBarCategoryAxis::min
- Defines the minimum value on the axis.
-*/
-/*!
- \qmlproperty string BarCategoryAxis::min
- Defines the minimum value on the axis.
-*/
-
-/*!
- \property QBarCategoryAxis::max
- Defines the maximum value on the axis.
-*/
-/*!
- \qmlproperty string BarCategoryAxis::max
- Defines the maximum value on the axis.
-*/
-
-/*!
- \property QBarCategoryAxis::count
- The count of categories.
-*/
-/*!
- \qmlproperty int BarCategoryAxis::count
- The count of categories.
-*/
-
-/*!
- \fn void QBarCategoryAxis::categoriesChanged()
- Axis emits signal when the categories of the axis have changed.
-*/
-
-/*!
- \fn void QBarCategoryAxis::minChanged(const QString &min)
- Axis emits signal when \a min of axis has changed.
-*/
-/*!
- \qmlsignal BarCategoryAxis::onMinChanged(const QString &min)
- Axis emits signal when \a min of axis has changed.
-*/
-
-/*!
- \fn void QBarCategoryAxis::maxChanged(const QString &max)
- Axis emits signal when \a max of axis has changed.
-*/
-/*!
- \qmlsignal BarCategoryAxis::onMaxChanged(const QString &max)
- Axis emits signal when \a max of axis has changed.
-*/
-
-/*!
- \fn void QBarCategoryAxis::countChanged()
- Axis emits signal when the count of categories has changed.
-*/
-/*!
- \qmlsignal BarCategoryAxis::onCountChanged()
- Axis emits signal when the count of categories has changed.
-*/
-
-/*!
- \fn void QBarCategoryAxis::rangeChanged(const QString &min, const QString &max)
- Axis emits signal when \a min or \a max of axis has changed.
-*/
-
-/*!
- \qmlmethod void BarCategoryAxis::clear()
- Removes all categories. Sets the maximum and minimum of the axis's range to QString::null.
-*/
-
-/*!
- Constructs an axis object which is a child of \a parent.
-*/
-QBarCategoryAxis::QBarCategoryAxis(QObject *parent):
- QAbstractAxis(*new QBarCategoryAxisPrivate(this), parent)
-{
-}
-
-/*!
- Destroys the object
-*/
-QBarCategoryAxis::~QBarCategoryAxis()
-{
- Q_D(QBarCategoryAxis);
- if (d->m_chart)
- d->m_chart->removeAxis(this);
-}
-
-/*!
- \internal
-*/
-QBarCategoryAxis::QBarCategoryAxis(QBarCategoryAxisPrivate &d, QObject *parent)
- : QAbstractAxis(d, parent)
-{
-
-}
-
-/*!
- Appends \a categories to axis. A maximum of the axis will be changed to last category in \a categories.
- If there were no categories previously defined, minimum of axis will be also changed to first category in \a categories.
- A category has to be valid QStrings and can not be duplicated. Duplicated categories will not be appended.
-*/
-void QBarCategoryAxis::append(const QStringList &categories)
-{
- if (categories.isEmpty())
- return;
-
- Q_D(QBarCategoryAxis);
-
- int count = d->m_categories.count();
-
- foreach(QString category, categories) {
- if (!d->m_categories.contains(category) && !category.isNull()) {
- d->m_categories.append(category);
- }
- }
-
- if (d->m_categories.count() == count)
- return;
-
- if (count == 0)
- setRange(d->m_categories.first(), d->m_categories.last());
- else
- setRange(d->m_minCategory, d->m_categories.last());
-
- emit categoriesChanged();
- emit countChanged();
-}
-
-/*!
- Appends \a category to axis. A maximum of the axis will be changed to last \a category.
- If there were no categories previously defined, minimum of axis will be also changed to \a category.
- A \a category has to be valid QStrings and can not be duplicated. Duplicated categories will not be appended.
-*/
-void QBarCategoryAxis::append(const QString &category)
-{
- Q_D(QBarCategoryAxis);
-
- int count = d->m_categories.count();
-
- if (!d->m_categories.contains(category) && !category.isNull())
- d->m_categories.append(category);
-
- if (d->m_categories.count() == count)
- return;
-
- if (count == 0)
- setRange(d->m_categories.last(), d->m_categories.last());
- else
- setRange(d->m_minCategory, d->m_categories.last());
-
- emit categoriesChanged();
- emit countChanged();
-}
-
-/*!
- Removes \a category from axis. Removing category which is currently maximum or minimum
- will affect the axis range.
-*/
-void QBarCategoryAxis::remove(const QString &category)
-{
- Q_D(QBarCategoryAxis);
-
- if (d->m_categories.contains(category)) {
- d->m_categories.removeAt(d->m_categories.indexOf(category));
- if (!d->m_categories.isEmpty()) {
- if (d->m_minCategory == category) {
- setRange(d->m_categories.first(), d->m_maxCategory);
- } else if (d->m_maxCategory == category) {
- setRange(d->m_minCategory, d->m_categories.last());
- } else {
- d->updateCategoryDomain();
- }
- } else {
- setRange(QString::null, QString::null);
- }
- emit categoriesChanged();
- emit countChanged();
- }
-}
-
-/*!
- Inserts \a category to axis at \a index. A \a category has to be valid QStrings and can not be duplicated.
- If \a category is prepended or appended to categories, minimum and maximum of axis is updated accordingly.
-*/
-void QBarCategoryAxis::insert(int index, const QString &category)
-{
- Q_D(QBarCategoryAxis);
-
- int count = d->m_categories.count();
-
- if (!d->m_categories.contains(category) && !category.isNull())
- d->m_categories.insert(index, category);
-
- if (d->m_categories.count() == count)
- return;
-
- if (count == 0) {
- setRange(d->m_categories.first(), d->m_categories.first());
- } else if (index == 0) {
- setRange(d->m_categories.first(), d->m_maxCategory);
- } else if (index == count) {
- setRange(d->m_minCategory, d->m_categories.last());
- } else {
- d->updateCategoryDomain();
- }
-
- emit categoriesChanged();
- emit countChanged();
-}
-
-/*!
- Replaces \a oldCategory with \a newCategory. If \a oldCategory does not exist on the axis nothing is done.
- A \a newCategory has to be valid QStrings and can not be duplicated. In case of replacing minimum or maximum category,
- minimum and maximum of axis is updated accordingly.
-*/
-void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCategory)
-{
- Q_D(QBarCategoryAxis);
-
- int pos = d->m_categories.indexOf(oldCategory);
-
- if (pos != -1 && !d->m_categories.contains(newCategory) && !newCategory.isNull()) {
- d->m_categories.replace(pos, newCategory);
- if (d->m_minCategory == oldCategory)
- setRange(newCategory, d->m_maxCategory);
- else if (d->m_maxCategory == oldCategory)
- setRange(d->m_minCategory, newCategory);
-
- emit categoriesChanged();
- emit countChanged();
- }
-}
-
-/*!
- Removes all categories. Sets the maximum and minimum of the axis's range to QString::null.
- */
-void QBarCategoryAxis::clear()
-{
- Q_D(QBarCategoryAxis);
- d->m_categories.clear();
- setRange(QString::null, QString::null);
- emit categoriesChanged();
- emit countChanged();
-}
-
-/*!
- Set \a categories and discards the old ones, range of axis is adjusted to match first and last category in \a categories.
- A category has to be valid QStrings and can not be duplicated.
-*/
-void QBarCategoryAxis::setCategories(const QStringList &categories)
-{
- Q_D(QBarCategoryAxis);
- d->m_categories.clear();
- d->m_minCategory = QString::null;
- d->m_maxCategory = QString::null;
- d->m_min = 0;
- d->m_max = 0;
- d->m_count = 0;
- append(categories);
-}
-
-/*!
- Returns categories
-*/
-QStringList QBarCategoryAxis::categories()
-{
- Q_D(QBarCategoryAxis);
- return d->m_categories;
-}
-
-/*!
- Returns number of categories.
- */
-int QBarCategoryAxis::count() const
-{
- Q_D(const QBarCategoryAxis);
- return d->m_categories.count();
-}
-
-/*!
- Returns category at \a index. Index must be valid.
-*/
-QString QBarCategoryAxis::at(int index) const
-{
- Q_D(const QBarCategoryAxis);
- return d->m_categories.at(index);
-}
-
-/*!
- Sets minimum category to \a min.
-*/
-void QBarCategoryAxis::setMin(const QString &min)
-{
- Q_D(QBarCategoryAxis);
- d->setRange(min, d->m_maxCategory);
-}
-
-/*!
- Returns minimum category.
-*/
-QString QBarCategoryAxis::min() const
-{
- Q_D(const QBarCategoryAxis);
- return d->m_minCategory;
-}
-
-/*!
- Sets maximum category to \a max.
-*/
-void QBarCategoryAxis::setMax(const QString &max)
-{
- Q_D(QBarCategoryAxis);
- d->setRange(d->m_minCategory, max);
-}
-
-/*!
- Returns maximum category
-*/
-QString QBarCategoryAxis::max() const
-{
- Q_D(const QBarCategoryAxis);
- return d->m_maxCategory;
-}
-
-/*!
- Sets range from \a minCategory to \a maxCategory
-*/
-void QBarCategoryAxis::setRange(const QString &minCategory, const QString &maxCategory)
-{
- Q_D(QBarCategoryAxis);
- d->setRange(minCategory,maxCategory);
-}
-
-/*!
- Returns the type of the axis
-*/
-QAbstractAxis::AxisType QBarCategoryAxis::type() const
-{
- return AxisTypeBarCategory;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QBarCategoryAxisPrivate::QBarCategoryAxisPrivate(QBarCategoryAxis *q)
- : QAbstractAxisPrivate(q),
- m_min(0.0),
- m_max(0.0),
- m_count(0)
-{
-
-}
-
-QBarCategoryAxisPrivate::~QBarCategoryAxisPrivate()
-{
-
-}
-
-void QBarCategoryAxisPrivate::setMin(const QVariant &min)
-{
- setRange(min, m_maxCategory);
-}
-
-void QBarCategoryAxisPrivate::setMax(const QVariant &max)
-{
- setRange(m_minCategory, max);
-}
-
-void QBarCategoryAxisPrivate::setRange(const QVariant &min, const QVariant &max)
-{
- QString value1 = min.toString();
- QString value2 = max.toString();
- setRange(value1, value2);
-}
-
-void QBarCategoryAxisPrivate::setRange(qreal min, qreal max)
-{
- Q_Q(QBarCategoryAxis);
-
- bool categoryChanged = false;
- bool changed = false;
-
- if (min > max)
- return;
-
- if (!qFuzzyIsNull(m_min - min)) {
- m_min = min;
- changed = true;
-
- int imin = m_min + 0.5;
- if (imin >= 0 && imin < m_categories.count()) {
- QString minCategory = m_categories.at(imin);
- if (m_minCategory != minCategory && !minCategory.isEmpty()) {
- m_minCategory = minCategory;
- categoryChanged = true;
- emit q->minChanged(minCategory);
- }
- }
-
- }
-
- if (!qFuzzyIsNull(m_max - max)) {
- m_max = max;
- changed = true;
-
- int imax = m_max - 0.5;
- if (imax >= 0 && imax < m_categories.count()) {
- QString maxCategory = m_categories.at(imax);
- if (m_maxCategory != maxCategory && !maxCategory.isEmpty()) {
- m_maxCategory = maxCategory;
- categoryChanged = true;
- emit q->maxChanged(maxCategory);
- }
- }
- }
-
- if (categoryChanged){
- emit q->rangeChanged(m_minCategory, m_maxCategory);
- }
-
- if (changed) {
- emit rangeChanged(m_min,m_max);
- }
-}
-
-void QBarCategoryAxisPrivate::setRange(const QString &minCategory, const QString &maxCategory)
-{
- Q_Q(QBarCategoryAxis);
- bool changed = false;
-
- //special case in case or clearing all categories
- if (minCategory.isNull() && maxCategory.isNull()) {
- m_minCategory = minCategory;
- m_maxCategory = maxCategory;
- m_min = 0;
- m_max = 0;
- m_count = 0;
- emit q->minChanged(minCategory);
- emit q->maxChanged(maxCategory);
- emit q->rangeChanged(m_minCategory, m_maxCategory);
- emit rangeChanged(m_min,m_max);
- return;
- }
-
- if (m_categories.indexOf(maxCategory) < m_categories.indexOf(minCategory))
- return;
-
- if (!minCategory.isNull() && (m_minCategory != minCategory || m_minCategory.isNull())
- && m_categories.contains(minCategory)) {
- m_minCategory = minCategory;
- m_min = m_categories.indexOf(m_minCategory) - 0.5;
- changed = true;
- emit q->minChanged(minCategory);
- }
-
- if (!maxCategory.isNull() && (m_maxCategory != maxCategory || m_maxCategory.isNull())
- && m_categories.contains(maxCategory)) {
- m_maxCategory = maxCategory;
- m_max = m_categories.indexOf(m_maxCategory) + 0.5;
- changed = true;
- emit q->maxChanged(maxCategory);
- }
-
- if (changed) {
- m_count = m_max - m_min;
- emit q->rangeChanged(m_minCategory, m_maxCategory);
- emit rangeChanged(m_min,m_max);
- }
-}
-
-void QBarCategoryAxisPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QBarCategoryAxis);
- ChartAxisElement* axis(0);
- if (orientation() == Qt::Vertical)
- axis = new ChartBarCategoryAxisY(q,parent);
- if (orientation() == Qt::Horizontal)
- axis = new ChartBarCategoryAxisX(q,parent);
-
- m_item.reset(axis);
- QAbstractAxisPrivate::initializeGraphics(parent);
-}
-
-void QBarCategoryAxisPrivate::updateCategoryDomain()
-{
- bool changed = false;
-
- qreal tmpMin = m_categories.indexOf(m_minCategory) - 0.5;
- if (!qFuzzyIsNull(m_min - tmpMin)) {
- m_min = tmpMin;
- changed = true;
- }
- qreal tmpMax = m_categories.indexOf(m_maxCategory) + 0.5;
- if (!qFuzzyIsNull(m_max - tmpMax)) {
- m_max = tmpMax;
- changed = true;
- }
- m_count = m_max - m_min;
-
- if (changed)
- emit rangeChanged(m_min,m_max);
-}
-
-
-void QBarCategoryAxisPrivate::initializeDomain(AbstractDomain *domain)
-{
- Q_Q(QBarCategoryAxis);
- if (m_max == m_min) {
- int min;
- int max;
- if (orientation() == Qt::Vertical) {
- min = domain->minY() + 0.5;
- max = domain->maxY() - 0.5;
- } else {
- min = domain->minX() + 0.5;
- max = domain->maxX() - 0.5;
- }
-
- if (min > 0 && min < m_categories.count() && max > 0 && max < m_categories.count())
- q->setRange(m_categories.at(min), m_categories.at(max));
- } else {
- if (orientation() == Qt::Vertical)
- domain->setRangeY(m_min, m_max);
- else
- domain->setRangeX(m_min, m_max);
- }
-}
-
-#include "moc_qbarcategoryaxis.cpp"
-#include "moc_qbarcategoryaxis_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/barcategoryaxis/qbarcategoryaxis.h b/src/axis/barcategoryaxis/qbarcategoryaxis.h
deleted file mode 100644
index 8f40b5c2..00000000
--- a/src/axis/barcategoryaxis/qbarcategoryaxis.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBARCATEGORYAXIS_H
-#define QBARCATEGORYAXIS_H
-
-#include "qabstractaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarCategoryAxisPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QBarCategoryAxis : public QAbstractAxis
-{
- Q_OBJECT
- Q_PROPERTY(QStringList categories READ categories WRITE setCategories NOTIFY categoriesChanged)
- Q_PROPERTY(QString min READ min WRITE setMin NOTIFY minChanged)
- Q_PROPERTY(QString max READ max WRITE setMax NOTIFY maxChanged)
- Q_PROPERTY(int count READ count NOTIFY countChanged)
-
-public:
- explicit QBarCategoryAxis(QObject *parent = 0);
- ~QBarCategoryAxis();
-
-protected:
- QBarCategoryAxis(QBarCategoryAxisPrivate &d, QObject *parent = 0);
-
-public:
- AxisType type() const;
- void append(const QStringList &categories);
- void append(const QString &category);
- void remove(const QString &category);
- void insert(int index, const QString &category);
- void replace(const QString &oldCategory, const QString &newCategory);
- Q_INVOKABLE void clear();
- void setCategories(const QStringList &categories);
- QStringList categories();
- int count() const;
- QString at(int index) const;
-
- //range handling
- void setMin(const QString &minCategory);
- QString min() const;
- void setMax(const QString &maxCategory);
- QString max() const;
- void setRange(const QString &minCategory, const QString &maxCategory);
-
-Q_SIGNALS:
- void categoriesChanged();
- void minChanged(const QString &min);
- void maxChanged(const QString &max);
- void rangeChanged(const QString &min, const QString &max);
- void countChanged();
-
-private:
- Q_DECLARE_PRIVATE(QBarCategoryAxis)
- Q_DISABLE_COPY(QBarCategoryAxis)
- friend class ChartBarCategoryAxisX;
- friend class ChartBarCategoryAxisY;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARCATEGORYAXIS_H
diff --git a/src/axis/barcategoryaxis/qbarcategoryaxis_p.h b/src/axis/barcategoryaxis/qbarcategoryaxis_p.h
deleted file mode 100644
index 85fab82d..00000000
--- a/src/axis/barcategoryaxis/qbarcategoryaxis_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QBARCATEGORYAXIS_P_H
-#define QBARCATEGORYAXIS_P_H
-
-#include "qbarcategoryaxis.h"
-#include "qabstractaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class AbstractDomain;
-
-class QBarCategoryAxisPrivate : public QAbstractAxisPrivate
-{
- Q_OBJECT
-
-public:
- QBarCategoryAxisPrivate(QBarCategoryAxis *q);
- ~QBarCategoryAxisPrivate();
-
-public:
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain(AbstractDomain *domain);
- void updateCategoryDomain();
-
- //interface for manipulating range form base class
- void setRange(const QVariant &min, const QVariant &max);
- void setMin(const QVariant &min);
- void setMax(const QVariant &max);
-
- //interface manipulating range form domain
- qreal min() { return m_min; }
- qreal max() { return m_max; }
- void setRange(qreal min,qreal max);
-
-private:
- //range handling
- void setRange(const QString &minCategory, const QString &maxCategory);
-
-private:
- QStringList m_categories;
- QString m_minCategory;
- QString m_maxCategory;
- qreal m_min;
- qreal m_max;
- int m_count;
-
-private:
- Q_DECLARE_PUBLIC(QBarCategoryAxis);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARCATEGORYAXIS_P_H
diff --git a/src/axis/cartesianchartaxis.cpp b/src/axis/cartesianchartaxis.cpp
deleted file mode 100644
index 89f3e2f0..00000000
--- a/src/axis/cartesianchartaxis.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cartesianchartaxis_p.h"
-#include "qabstractaxis.h"
-#include "qabstractaxis_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include "abstractdomain_p.h"
-#include "linearrowitem_p.h"
-#include <QValueAxis>
-#include <QLogValueAxis>
-#include <QGraphicsLayout>
-#include <QTextDocument>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-CartesianChartAxis::CartesianChartAxis(QAbstractAxis *axis, QGraphicsItem *item , bool intervalAxis)
- : ChartAxisElement(axis, item, intervalAxis)
-{
- Q_ASSERT(item);
-}
-
-
-CartesianChartAxis::~CartesianChartAxis()
-{
-}
-
-void CartesianChartAxis::createItems(int count)
-{
- if (arrowItems().size() == 0) {
- QGraphicsLineItem *arrow = new LineArrowItem(this, this);
- arrow->setPen(axis()->linePen());
- arrowGroup()->addToGroup(arrow);
- }
-
- if (intervalAxis() && gridItems().size() == 0) {
- for (int i = 0 ; i < 2 ; i ++){
- QGraphicsLineItem *item = new QGraphicsLineItem(this);
- item->setPen(axis()->gridLinePen());
- gridGroup()->addToGroup(item);
- }
- }
-
- QGraphicsTextItem *title = titleItem();
- title->setFont(axis()->titleFont());
- title->setDefaultTextColor(axis()->titleBrush().color());
- title->setHtml(axis()->titleText());
-
- for (int i = 0; i < count; ++i) {
- QGraphicsLineItem *arrow = new QGraphicsLineItem(this);
- QGraphicsLineItem *grid = new QGraphicsLineItem(this);
- QGraphicsTextItem *label = new QGraphicsTextItem(this);
- label->document()->setDocumentMargin(ChartPresenter::textMargin());
- arrow->setPen(axis()->linePen());
- grid->setPen(axis()->gridLinePen());
- label->setFont(axis()->labelsFont());
- label->setDefaultTextColor(axis()->labelsBrush().color());
- label->setRotation(axis()->labelsAngle());
- arrowGroup()->addToGroup(arrow);
- gridGroup()->addToGroup(grid);
- labelGroup()->addToGroup(label);
-
- if ((gridItems().size()) % 2 && gridItems().size() > 2) {
- QGraphicsRectItem* shades = new QGraphicsRectItem(this);
- shades->setPen(axis()->shadesPen());
- shades->setBrush(axis()->shadesBrush());
- shadeGroup()->addToGroup(shades);
- }
- }
-
-}
-
-void CartesianChartAxis::deleteItems(int count)
-{
- QList<QGraphicsItem *> lines = gridItems();
- QList<QGraphicsItem *> labels = labelItems();
- QList<QGraphicsItem *> shades = shadeItems();
- QList<QGraphicsItem *> axis = arrowItems();
-
- for (int i = 0; i < count; ++i) {
- if (lines.size() % 2 && lines.size() > 1)
- delete(shades.takeLast());
- delete(lines.takeLast());
- delete(labels.takeLast());
- delete(axis.takeLast());
- }
-}
-
-void CartesianChartAxis::updateLayout(QVector<qreal> &layout)
-{
- int diff = ChartAxisElement::layout().size() - layout.size();
-
- if (diff > 0)
- deleteItems(diff);
- else if (diff < 0)
- createItems(-diff);
-
- if (animation()) {
- switch (presenter()->state()) {
- case ChartPresenter::ZoomInState:
- animation()->setAnimationType(AxisAnimation::ZoomInAnimation);
- animation()->setAnimationPoint(presenter()->statePoint());
- break;
- case ChartPresenter::ZoomOutState:
- animation()->setAnimationType(AxisAnimation::ZoomOutAnimation);
- animation()->setAnimationPoint(presenter()->statePoint());
- break;
- case ChartPresenter::ScrollUpState:
- case ChartPresenter::ScrollLeftState:
- animation()->setAnimationType(AxisAnimation::MoveBackwordAnimation);
- break;
- case ChartPresenter::ScrollDownState:
- case ChartPresenter::ScrollRightState:
- animation()->setAnimationType(AxisAnimation::MoveForwardAnimation);
- break;
- case ChartPresenter::ShowState:
- animation()->setAnimationType(AxisAnimation::DefaultAnimation);
- break;
- }
- animation()->setValues(ChartAxisElement::layout(), layout);
- presenter()->startAnimation(animation());
- } else {
- setLayout(layout);
- updateGeometry();
- }
-}
-
-bool CartesianChartAxis::isEmpty()
-{
- return axisGeometry().isEmpty()
- || gridGeometry().isEmpty()
- || qFuzzyCompare(min(), max());
-}
-
-void CartesianChartAxis::setGeometry(const QRectF &axis, const QRectF &grid)
-{
- m_gridRect = grid;
- setAxisGeometry(axis);
-
- if (isEmpty())
- return;
-
- QVector<qreal> layout = calculateLayout();
- updateLayout(layout);
-}
-
-QSizeF CartesianChartAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(which);
- Q_UNUSED(constraint);
- return QSizeF();
-}
-
-void CartesianChartAxis::handleArrowPenChanged(const QPen &pen)
-{
- foreach (QGraphicsItem *item, arrowItems())
- static_cast<QGraphicsLineItem *>(item)->setPen(pen);
-}
-
-void CartesianChartAxis::handleGridPenChanged(const QPen &pen)
-{
- foreach (QGraphicsItem *item, gridItems())
- static_cast<QGraphicsLineItem *>(item)->setPen(pen);
-}
-
-void CartesianChartAxis::handleShadesBrushChanged(const QBrush &brush)
-{
- foreach (QGraphicsItem *item, shadeItems())
- static_cast<QGraphicsRectItem *>(item)->setBrush(brush);
-}
-
-void CartesianChartAxis::handleShadesPenChanged(const QPen &pen)
-{
- foreach (QGraphicsItem *item, shadeItems())
- static_cast<QGraphicsRectItem *>(item)->setPen(pen);
-}
-
-#include "moc_cartesianchartaxis_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/cartesianchartaxis_p.h b/src/axis/cartesianchartaxis_p.h
deleted file mode 100644
index 11475912..00000000
--- a/src/axis/cartesianchartaxis_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CARTESIANCHARTAXIS_H
-#define CARTESIANCHARTAXIS_H
-
-#include "qchartglobal.h"
-#include "chartaxiselement_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractAxis;
-
-class CartesianChartAxis : public ChartAxisElement
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsLayoutItem)
-public:
-
- CartesianChartAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
- ~CartesianChartAxis();
-
- void setGeometry(const QRectF &axis, const QRectF &grid);
- QRectF gridGeometry() const { return m_gridRect; }
- bool isEmpty();
-
- virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
-
-protected:
- void setGeometry(const QRectF &size) { Q_UNUSED(size);}
- virtual void updateGeometry() = 0;
- void updateLayout(QVector<qreal> &layout);
-
-public Q_SLOTS:
- virtual void handleArrowPenChanged(const QPen &pen);
- virtual void handleGridPenChanged(const QPen &pen);
- virtual void handleShadesBrushChanged(const QBrush &brush);
- virtual void handleShadesPenChanged(const QPen &pen);
-
-private:
- void createItems(int count);
- void deleteItems(int count);
-
-private:
- QRectF m_gridRect;
-
- friend class AxisAnimation;
- friend class LineArrowItem;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CARTESIANCHARTAXIS_H */
diff --git a/src/axis/categoryaxis/chartcategoryaxisx.cpp b/src/axis/categoryaxis/chartcategoryaxisx.cpp
deleted file mode 100644
index 9d9a72c6..00000000
--- a/src/axis/categoryaxis/chartcategoryaxisx.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartcategoryaxisx_p.h"
-#include "qcategoryaxis.h"
-#include "qabstractaxis.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartCategoryAxisX::ChartCategoryAxisX(QCategoryAxis *axis, QGraphicsItem* item)
- : HorizontalAxis(axis, item, true),
- m_axis(axis)
-{
- QObject::connect(axis, SIGNAL(categoriesChanged()), this, SLOT(handleCategoriesChanged()));
-}
-
-ChartCategoryAxisX::~ChartCategoryAxisX()
-{
-}
-
-QVector<qreal> ChartCategoryAxisX::calculateLayout() const
-{
- int tickCount = m_axis->categoriesLabels().count() + 1;
- QVector<qreal> points;
-
- if (tickCount < 2)
- return points;
-
- const QRectF &gridRect = gridGeometry();
- qreal range = max() - min();
- if (range > 0) {
- points.resize(tickCount);
- qreal scale = gridRect.width() / range;
- for (int i = 0; i < tickCount; ++i) {
- if (i < tickCount - 1) {
- qreal x = (m_axis->startValue(m_axis->categoriesLabels().at(i)) - min()) * scale + gridRect.left();
- points[i] = x;
- } else {
- qreal x = (m_axis->endValue(m_axis->categoriesLabels().at(i - 1)) - min()) * scale + gridRect.left();
- points[i] = x;
- }
- }
- }
-
- return points;
-}
-
-void ChartCategoryAxisX::updateGeometry()
-{
- setLabels(m_axis->categoriesLabels() << "");
- HorizontalAxis::updateGeometry();
-}
-
-QSizeF ChartCategoryAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
- QSizeF base = HorizontalAxis::sizeHint(which, constraint);
- QStringList ticksList = m_axis->categoriesLabels();
- qreal width = 0; // Width is irrelevant for X axes with interval labels
- qreal height = 0;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- height = boundingRect.height() + labelPadding() + base.height() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelHeight = 0.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelHeight = qMax(rect.height(), labelHeight);
- }
- height = labelHeight + labelPadding() + base.height() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-void ChartCategoryAxisX::handleCategoriesChanged()
-{
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
-}
-
-#include "moc_chartcategoryaxisx_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/categoryaxis/chartcategoryaxisx_p.h b/src/axis/categoryaxis/chartcategoryaxisx_p.h
deleted file mode 100644
index 4e92c189..00000000
--- a/src/axis/categoryaxis/chartcategoryaxisx_p.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTCATEGORYAXISX_H
-#define CHARTCATEGORYAXISX_H
-
-#include "horizontalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QCategoryAxis;
-
-class ChartCategoryAxisX : public HorizontalAxis
-{
- Q_OBJECT
-public:
- ChartCategoryAxisX(QCategoryAxis *axis, QGraphicsItem* item = 0);
- ~ChartCategoryAxisX();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-
-public Q_SLOTS:
- void handleCategoriesChanged();
-
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-
-private:
- QCategoryAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTCATEGORYAXISX_H */
diff --git a/src/axis/categoryaxis/chartcategoryaxisy.cpp b/src/axis/categoryaxis/chartcategoryaxisy.cpp
deleted file mode 100644
index abc6d3d1..00000000
--- a/src/axis/categoryaxis/chartcategoryaxisy.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartcategoryaxisy_p.h"
-#include "qcategoryaxis.h"
-#include "qabstractaxis.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartCategoryAxisY::ChartCategoryAxisY(QCategoryAxis *axis, QGraphicsItem* item)
- : VerticalAxis(axis, item, true),
- m_axis(axis)
-{
- QObject::connect(axis, SIGNAL(categoriesChanged()), this, SLOT(handleCategoriesChanged()));
-}
-
-ChartCategoryAxisY::~ChartCategoryAxisY()
-{
-}
-
-QVector<qreal> ChartCategoryAxisY::calculateLayout() const
-{
- int tickCount = m_axis->categoriesLabels().count() + 1;
- QVector<qreal> points;
-
- if (tickCount < 2)
- return points;
-
- const QRectF &gridRect = gridGeometry();
- qreal range = max() - min();
- if (range > 0) {
- points.resize(tickCount);
- qreal scale = gridRect.height() / range;
- for (int i = 0; i < tickCount; ++i) {
- if (i < tickCount - 1) {
- qreal y = -(m_axis->startValue(m_axis->categoriesLabels().at(i)) - min()) * scale + gridRect.bottom();
- points[i] = y;
- } else {
- qreal y = -(m_axis->endValue(m_axis->categoriesLabels().at(i - 1)) - min()) * scale + gridRect.bottom();
- points[i] = y;
- }
- }
- }
-
- return points;
-}
-
-void ChartCategoryAxisY::updateGeometry()
-{
- setLabels(m_axis->categoriesLabels() << "");
- VerticalAxis::updateGeometry();
-}
-
-QSizeF ChartCategoryAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
- QSizeF base = VerticalAxis::sizeHint(which, constraint);
- QStringList ticksList = m_axis->categoriesLabels();
- qreal width = 0;
- qreal height = 0; // Height is irrelevant for Y axes with interval labels
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() + labelPadding() + base.width() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelWidth = 0.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelWidth = qMax(rect.width(), labelWidth);
- }
- width = labelWidth + labelPadding() + base.width() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
- return sh;
-}
-
-void ChartCategoryAxisY::handleCategoriesChanged()
-{
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
-}
-
-#include "moc_chartcategoryaxisy_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/categoryaxis/chartcategoryaxisy_p.h b/src/axis/categoryaxis/chartcategoryaxisy_p.h
deleted file mode 100644
index e690ce92..00000000
--- a/src/axis/categoryaxis/chartcategoryaxisy_p.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTCATEGORYAXISY_H
-#define CHARTCATEGORYAXISY_H
-
-#include "verticalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QCategoryAxis;
-
-class ChartCategoryAxisY : public VerticalAxis
-{
- Q_OBJECT
-public:
- ChartCategoryAxisY(QCategoryAxis *axis, QGraphicsItem* item = 0);
- ~ChartCategoryAxisY();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-
-public Q_SLOTS:
- void handleCategoriesChanged();
-
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-
-private:
- QCategoryAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTCATEGORYAXISY_H */
diff --git a/src/axis/categoryaxis/polarchartcategoryaxisangular.cpp b/src/axis/categoryaxis/polarchartcategoryaxisangular.cpp
deleted file mode 100644
index 58bbd9c3..00000000
--- a/src/axis/categoryaxis/polarchartcategoryaxisangular.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartcategoryaxisangular_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include "qcategoryaxis.h"
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartCategoryAxisAngular::PolarChartCategoryAxisAngular(QCategoryAxis *axis, QGraphicsItem *item)
- : PolarChartAxisAngular(axis, item, true)
-{
- QObject::connect(axis, SIGNAL(categoriesChanged()), this, SLOT(handleCategoriesChanged()));
-}
-
-PolarChartCategoryAxisAngular::~PolarChartCategoryAxisAngular()
-{
-}
-
-QVector<qreal> PolarChartCategoryAxisAngular::calculateLayout() const
-{
- QCategoryAxis *catAxis = static_cast<QCategoryAxis *>(axis());
- int tickCount = catAxis->categoriesLabels().count() + 1;
- QVector<qreal> points;
-
- if (tickCount < 2)
- return points;
-
- qreal range = max() - min();
- if (range > 0) {
- points.resize(tickCount);
- qreal scale = 360.0 / range;
- qreal angle;
- for (int i = 0; i < tickCount; ++i) {
- if (i < tickCount - 1)
- angle = (catAxis->startValue(catAxis->categoriesLabels().at(i)) - min()) * scale;
- else
- angle = (catAxis->endValue(catAxis->categoriesLabels().at(i - 1)) - min()) * scale;
- points[i] = angle;
- }
- }
-
- return points;
-}
-
-void PolarChartCategoryAxisAngular::createAxisLabels(const QVector<qreal> &layout)
-{
- Q_UNUSED(layout);
- setLabels(static_cast<QCategoryAxis *>(axis())->categoriesLabels() << "");
-}
-
-void PolarChartCategoryAxisAngular::handleCategoriesChanged()
-{
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
-}
-
-
-#include "moc_polarchartcategoryaxisangular_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/categoryaxis/polarchartcategoryaxisangular_p.h b/src/axis/categoryaxis/polarchartcategoryaxisangular_p.h
deleted file mode 100644
index 34b08e9d..00000000
--- a/src/axis/categoryaxis/polarchartcategoryaxisangular_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTCATEGORYAXISANGULAR_P_H
-#define POLARCHARTCATEGORYAXISANGULAR_P_H
-
-#include "polarchartaxisangular_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QCategoryAxis;
-
-class PolarChartCategoryAxisAngular : public PolarChartAxisAngular
-{
- Q_OBJECT
-
-public:
- PolarChartCategoryAxisAngular(QCategoryAxis *axis, QGraphicsItem *item);
- ~PolarChartCategoryAxisAngular();
-
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-public Q_SLOTS:
- void handleCategoriesChanged();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTCATEGORYAXISANGULAR_P_H
diff --git a/src/axis/categoryaxis/polarchartcategoryaxisradial.cpp b/src/axis/categoryaxis/polarchartcategoryaxisradial.cpp
deleted file mode 100644
index 98a36855..00000000
--- a/src/axis/categoryaxis/polarchartcategoryaxisradial.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartcategoryaxisradial_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include "qcategoryaxis.h"
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartCategoryAxisRadial::PolarChartCategoryAxisRadial(QCategoryAxis *axis, QGraphicsItem *item)
- : PolarChartAxisRadial(axis, item, true)
-{
- QObject::connect(axis, SIGNAL(categoriesChanged()), this, SLOT(handleCategoriesChanged()));
-}
-
-PolarChartCategoryAxisRadial::~PolarChartCategoryAxisRadial()
-{
-}
-
-QVector<qreal> PolarChartCategoryAxisRadial::calculateLayout() const
-{
- QCategoryAxis *catAxis = static_cast<QCategoryAxis *>(axis());
- int tickCount = catAxis->categoriesLabels().count() + 1;
- QVector<qreal> points;
-
- if (tickCount < 2)
- return points;
-
- qreal range = max() - min();
- if (range > 0) {
- points.resize(tickCount);
- qreal scale = (axisGeometry().width() / 2) / range;
- qreal angle;
- for (int i = 0; i < tickCount; ++i) {
- if (i < tickCount - 1)
- angle = (catAxis->startValue(catAxis->categoriesLabels().at(i)) - min()) * scale;
- else
- angle = (catAxis->endValue(catAxis->categoriesLabels().at(i - 1)) - min()) * scale;
- points[i] = angle;
- }
- }
-
- return points;
-}
-
-void PolarChartCategoryAxisRadial::createAxisLabels(const QVector<qreal> &layout)
-{
- Q_UNUSED(layout);
- setLabels(static_cast<QCategoryAxis *>(axis())->categoriesLabels() << "");
-}
-
-void PolarChartCategoryAxisRadial::handleCategoriesChanged()
-{
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
-}
-
-#include "moc_polarchartcategoryaxisradial_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/categoryaxis/polarchartcategoryaxisradial_p.h b/src/axis/categoryaxis/polarchartcategoryaxisradial_p.h
deleted file mode 100644
index 8df118e6..00000000
--- a/src/axis/categoryaxis/polarchartcategoryaxisradial_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTCATEGORYAXISRADIAL_P_H
-#define POLARCHARTCATEGORYAXISRADIAL_P_H
-
-#include "polarchartaxisradial_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QCategoryAxis;
-
-class PolarChartCategoryAxisRadial : public PolarChartAxisRadial
-{
- Q_OBJECT
-
-public:
- PolarChartCategoryAxisRadial(QCategoryAxis *axis, QGraphicsItem *item);
- ~PolarChartCategoryAxisRadial();
-
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-public Q_SLOTS:
- void handleCategoriesChanged();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTCATEGORYAXISRADIAL_P_H
diff --git a/src/axis/categoryaxis/qcategoryaxis.cpp b/src/axis/categoryaxis/qcategoryaxis.cpp
deleted file mode 100644
index 8d4d73f0..00000000
--- a/src/axis/categoryaxis/qcategoryaxis.cpp
+++ /dev/null
@@ -1,342 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcategoryaxis.h"
-#include "qcategoryaxis_p.h"
-#include "chartcategoryaxisx_p.h"
-#include "chartcategoryaxisy_p.h"
-#include "polarchartcategoryaxisangular_p.h"
-#include "polarchartcategoryaxisradial_p.h"
-#include "qchart.h"
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-/*!
- \class QCategoryAxis
- \inmodule Qt Charts
- \brief The QCategoryAxis class allows putting a named ranges on the axis.
- \mainclass
-
- This class can be used when the underlying data needs to be given extra meaning.
- Unlike with the QBarCategoryAxis the QCategoryAxis allows the categories ranges widths to be specified freely.
-
- Example code on how to use QCategoryAxis:
- \table
- \row
- \li \br
- \br
- \code
- QChartView *chartView = new QChartView;
- QLineSeries *series = new QLineSeries;
- // ...
- chartView->chart()->addSeries(series);
-
- QCategoryAxis *axisY = new QCategoryAxis;
- axisY->setMin(0);
- axisY->setMax(52);
- axisY->setStartValue(15);
- axisY->append("First", 20);
- axisY->append("Second", 37);
- axisY->append("Third", 52);
- chartView->chart()->setAxisY(axisY, series);
- \endcode
- \li \br
- \inlineimage api_category_axis.png
- \endtable
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype CategoryAxis
- \instantiates QCategoryAxis
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/categoryaxis.qdocinc
-*/
-#else
-/*!
- \qmlclass CategoryAxis QCategoryAxis
-
- \include ../doc/src/categoryaxis.qdocinc
-*/
-#endif
-
-/*!
- \property QCategoryAxis::startValue
- Defines the low end of the first category on the axis.
-*/
-/*!
- \qmlproperty int CategoryAxis::startValue
- Defines the low end of the first category on the axis.
-*/
-
-/*!
- \property QCategoryAxis::count
- The count of categories.
-*/
-/*!
- \qmlproperty int CategoryAxis::count
- The count of categories.
-*/
-
-/*!
- \property QCategoryAxis::categoriesLabels
- The category labels as a string list.
-*/
-/*!
- \qmlproperty StringList CategoryAxis::categoriesLabels
- The category labels as a list of strings.
-*/
-
-/*!
- \fn void QCategoryAxis::categoriesChanged()
- Axis emits signal when the categories of the axis have changed.
-*/
-
-
-/*!
- Constructs an axis object which is a child of \a parent.
-*/
-QCategoryAxis::QCategoryAxis(QObject *parent):
- QValueAxis(*new QCategoryAxisPrivate(this), parent)
-{
-}
-
-/*!
- Destroys the object
-*/
-QCategoryAxis::~QCategoryAxis()
-{
- Q_D(QCategoryAxis);
- if (d->m_chart)
- d->m_chart->removeAxis(this);
-}
-
-/*!
- \internal
-*/
-QCategoryAxis::QCategoryAxis(QCategoryAxisPrivate &d, QObject *parent): QValueAxis(d, parent)
-{
-
-}
-
-/*!
- \qmlmethod CategoryAxis::append(string label, real endValue)
- Appends new category to the axis with an \a label. Category label has to be unique.
- Parameter \a endValue specifies the high end limit of the category.
- It has to be greater than the high end limit of the previous category.
- Otherwise the method returns without adding a new category.
-*/
-/*!
- Appends new category to the axis with an \a categoryLabel.
- Category label has to be unique.
- Parameter \a categoryEndValue specifies the high end limit of the category.
- It has to be greater than the high end limit of the previous category.
- Otherwise the method returns without adding a new category.
-*/
-void QCategoryAxis::append(const QString &categoryLabel, qreal categoryEndValue)
-{
- Q_D(QCategoryAxis);
-
- if (!d->m_categories.contains(categoryLabel)) {
- if (d->m_categories.isEmpty()) {
- Range range(d->m_categoryMinimum, categoryEndValue);
- d->m_categoriesMap.insert(categoryLabel, range);
- d->m_categories.append(categoryLabel);
- emit categoriesChanged();
- } else if (categoryEndValue > endValue(d->m_categories.last())) {
- Range previousRange = d->m_categoriesMap.value(d->m_categories.last());
- d->m_categoriesMap.insert(categoryLabel, Range(previousRange.second, categoryEndValue));
- d->m_categories.append(categoryLabel);
- emit categoriesChanged();
- }
- }
-}
-
-/*!
- Sets \a min to be the low end limit of the first category on the axis.
- If there is already some categories added to the axis then passed value must be lower than the high end value of the already defined first category range.
- Otherwise nothing is done.
-*/
-void QCategoryAxis::setStartValue(qreal min)
-{
- Q_D(QCategoryAxis);
- if (d->m_categories.isEmpty()) {
- d->m_categoryMinimum = min;
- emit categoriesChanged();
- } else {
- Range range = d->m_categoriesMap.value(d->m_categories.first());
- if (min < range.second) {
- d->m_categoriesMap.insert(d->m_categories.first(), Range(min, range.second));
- emit categoriesChanged();
- }
- }
-}
-
-/*!
- Returns the low end limit of the category specified by an \a categoryLabel
-*/
-qreal QCategoryAxis::startValue(const QString &categoryLabel) const
-{
- Q_D(const QCategoryAxis);
- if (categoryLabel.isEmpty())
- return d->m_categoryMinimum;
- return d->m_categoriesMap.value(categoryLabel).first;
-}
-
-/*!
- Returns the high end limit of the interval specified by an \a categoryLabel
-*/
-qreal QCategoryAxis::endValue(const QString &categoryLabel) const
-{
- Q_D(const QCategoryAxis);
- return d->m_categoriesMap.value(categoryLabel).second;
-}
-
-/*!
- \qmlmethod CategoryAxis::remove(string label)
- Removes a category specified by the \a label from the axis
-*/
-/*!
- Removes an interval specified by the \a categoryLabel from the axis
-*/
-void QCategoryAxis::remove(const QString &categoryLabel)
-{
- Q_D(QCategoryAxis);
- int labelIndex = d->m_categories.indexOf(categoryLabel);
-
- // check if such label exists
- if (labelIndex != -1) {
- d->m_categories.removeAt(labelIndex);
- d->m_categoriesMap.remove(categoryLabel);
-
- // the range of the interval that follows (if exists) needs to be updated
- if (labelIndex < d->m_categories.count()) {
- QString label = d->m_categories.at(labelIndex);
- Range range = d->m_categoriesMap.value(label);
-
- // set the range
- if (labelIndex == 0) {
- range.first = d->m_categoryMinimum;
- d->m_categoriesMap.insert(label, range);
- } else {
- range.first = d->m_categoriesMap.value(d->m_categories.at(labelIndex - 1)).second;
- d->m_categoriesMap.insert(label, range);
- }
- }
- emit categoriesChanged();
- }
-}
-
-/*!
- \qmlmethod CategoryAxis::replace(string oldLabel, string newLabel)
- Replaces \a oldLabel of an existing category with a \a newLabel.
- If the old label does not exist the method returns without making any changes.
-*/
-/*!
- Replaces \a oldLabel of an existing category with a \a newLabel
- If the old label does not exist the method returns without making any changes.
- */
-void QCategoryAxis::replaceLabel(const QString &oldLabel, const QString &newLabel)
-{
- Q_D(QCategoryAxis);
- int labelIndex = d->m_categories.indexOf(oldLabel);
-
- // check if such label exists
- if (labelIndex != -1) {
- d->m_categories.replace(labelIndex, newLabel);
- Range range = d->m_categoriesMap.value(oldLabel);
- d->m_categoriesMap.remove(oldLabel);
- d->m_categoriesMap.insert(newLabel, range);
- emit categoriesChanged();
- }
-}
-
-/*!
- Returns the list of the intervals labels
- */
-QStringList QCategoryAxis::categoriesLabels()
-{
- Q_D(QCategoryAxis);
- return d->m_categories;
-}
-
-/*!
- Returns number of intervals.
- */
-int QCategoryAxis::count() const
-{
- Q_D(const QCategoryAxis);
- return d->m_categories.count();
-}
-
-/*!
- Returns the type of the axis
-*/
-QAbstractAxis::AxisType QCategoryAxis::type() const
-{
- return QAbstractAxis::AxisTypeCategory;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QCategoryAxisPrivate::QCategoryAxisPrivate(QCategoryAxis *q)
- : QValueAxisPrivate(q),
- m_categoryMinimum(0)
-{
-
-}
-
-QCategoryAxisPrivate::~QCategoryAxisPrivate()
-{
-
-}
-
-int QCategoryAxisPrivate::ticksCount() const
-{
- return m_categories.count() + 1;
-}
-
-void QCategoryAxisPrivate::initializeGraphics(QGraphicsItem *parent)
-{
- Q_Q(QCategoryAxis);
- ChartAxisElement *axis(0);
- if (m_chart->chartType() == QChart::ChartTypeCartesian) {
- if (orientation() == Qt::Vertical)
- axis = new ChartCategoryAxisY(q,parent);
- else if (orientation() == Qt::Horizontal)
- axis = new ChartCategoryAxisX(q,parent);
- }
-
- if (m_chart->chartType() == QChart::ChartTypePolar) {
- if (orientation() == Qt::Vertical)
- axis = new PolarChartCategoryAxisRadial(q, parent);
- if (orientation() == Qt::Horizontal)
- axis = new PolarChartCategoryAxisAngular(q, parent);
- }
-
- m_item.reset(axis);
- QAbstractAxisPrivate::initializeGraphics(parent);
-}
-
-#include "moc_qcategoryaxis.cpp"
-#include "moc_qcategoryaxis_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/categoryaxis/qcategoryaxis.h b/src/axis/categoryaxis/qcategoryaxis.h
deleted file mode 100644
index cd6f21e1..00000000
--- a/src/axis/categoryaxis/qcategoryaxis.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCATEGORYAXIS_H
-#define QCATEGORYAXIS_H
-
-#include "qabstractaxis.h"
-#include "qvalueaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QCategoryAxisPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QCategoryAxis : public QValueAxis
-{
- Q_OBJECT
- Q_PROPERTY(qreal startValue READ startValue WRITE setStartValue)
- Q_PROPERTY(int count READ count)
- Q_PROPERTY(QStringList categoriesLabels READ categoriesLabels)
-
-public:
- explicit QCategoryAxis(QObject *parent = 0);
- ~QCategoryAxis();
-
-protected:
- QCategoryAxis(QCategoryAxisPrivate &d, QObject *parent = 0);
-
-public:
- AxisType type() const;
-
- void append(const QString &label, qreal categoryEndValue);
- void remove(const QString &label);
- void replaceLabel(const QString &oldLabel, const QString &newLabel);
-
- qreal startValue(const QString &categoryLabel = QString()) const;
- void setStartValue(qreal min);
-
- qreal endValue(const QString &categoryLabel) const;
-
- QStringList categoriesLabels();
- int count() const;
-
-Q_SIGNALS:
- void categoriesChanged();
-
-private:
- Q_DECLARE_PRIVATE(QCategoryAxis)
- Q_DISABLE_COPY(QCategoryAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QCATEGORYAXIS_H
diff --git a/src/axis/categoryaxis/qcategoryaxis_p.h b/src/axis/categoryaxis/qcategoryaxis_p.h
deleted file mode 100644
index 0a223ae3..00000000
--- a/src/axis/categoryaxis/qcategoryaxis_p.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QCATEGORYAXIS_P_H
-#define QCATEGORYAXIS_P_H
-
-#include "qcategoryaxis.h"
-#include "qvalueaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-typedef QPair<qreal, qreal> Range;
-
-class QCategoryAxisPrivate : public QValueAxisPrivate
-{
- Q_OBJECT
-
-public:
- QCategoryAxisPrivate(QCategoryAxis *q);
- ~QCategoryAxisPrivate();
-
- void initializeGraphics(QGraphicsItem* parent);
- int ticksCount() const;
-
-private:
- QMap<QString , Range> m_categoriesMap;
- QStringList m_categories;
- qreal m_categoryMinimum;
-
-private:
- Q_DECLARE_PUBLIC(QCategoryAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QCATEGORYAXIS_P_H
diff --git a/src/axis/chartaxiselement.cpp b/src/axis/chartaxiselement.cpp
deleted file mode 100644
index c006b166..00000000
--- a/src/axis/chartaxiselement.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartaxiselement_p.h"
-#include "qabstractaxis_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include <qmath.h>
-#include <QDateTime>
-#include <QTextDocument>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-static const char *labelFormatMatchString = "%[\\-\\+#\\s\\d\\.lhjztL]*([dicuoxfegXFEG])";
-static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.(\\d+)([defgiEG])(.*)$";
-static QRegExp *labelFormatMatcher = 0;
-static QRegExp *labelFormatMatcherLocalized = 0;
-class StaticLabelFormatMatcherDeleter
-{
-public:
- StaticLabelFormatMatcherDeleter() {}
- ~StaticLabelFormatMatcherDeleter() {
- delete labelFormatMatcher;
- delete labelFormatMatcherLocalized;
- }
-};
-static StaticLabelFormatMatcherDeleter staticLabelFormatMatcherDeleter;
-
-ChartAxisElement::ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
- : ChartElement(item),
- m_axis(axis),
- m_animation(0),
- m_grid(new QGraphicsItemGroup(item)),
- m_arrow(new QGraphicsItemGroup(item)),
- m_shades(new QGraphicsItemGroup(item)),
- m_labels(new QGraphicsItemGroup(item)),
- m_title(new QGraphicsTextItem(item)),
- m_intervalAxis(intervalAxis)
-
-{
- //initial initialization
- m_arrow->setHandlesChildEvents(false);
- m_arrow->setZValue(ChartPresenter::AxisZValue);
- m_labels->setZValue(ChartPresenter::AxisZValue);
- m_shades->setZValue(ChartPresenter::ShadesZValue);
- m_grid->setZValue(ChartPresenter::GridZValue);
- m_title->setZValue(ChartPresenter::GridZValue);
- m_title->document()->setDocumentMargin(ChartPresenter::textMargin());
- handleVisibleChanged(axis->isVisible());
- connectSlots();
-
- setFlag(QGraphicsItem::ItemHasNoContents, true);
-}
-
-ChartAxisElement::~ChartAxisElement()
-{
-}
-
-void ChartAxisElement::connectSlots()
-{
- QObject::connect(axis(), SIGNAL(visibleChanged(bool)), this, SLOT(handleVisibleChanged(bool)));
- QObject::connect(axis(), SIGNAL(lineVisibleChanged(bool)), this, SLOT(handleArrowVisibleChanged(bool)));
- QObject::connect(axis(), SIGNAL(gridVisibleChanged(bool)), this, SLOT(handleGridVisibleChanged(bool)));
- QObject::connect(axis(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool)));
- QObject::connect(axis(), SIGNAL(shadesVisibleChanged(bool)), this, SLOT(handleShadesVisibleChanged(bool)));
- QObject::connect(axis(), SIGNAL(labelsAngleChanged(int)), this, SLOT(handleLabelsAngleChanged(int)));
- QObject::connect(axis(), SIGNAL(linePenChanged(const QPen&)), this, SLOT(handleArrowPenChanged(const QPen&)));
- QObject::connect(axis(), SIGNAL(labelsPenChanged(const QPen&)), this, SLOT(handleLabelsPenChanged(const QPen&)));
- QObject::connect(axis(), SIGNAL(labelsBrushChanged(const QBrush&)), this, SLOT(handleLabelsBrushChanged(const QBrush&)));
- QObject::connect(axis(), SIGNAL(labelsFontChanged(const QFont&)), this, SLOT(handleLabelsFontChanged(const QFont&)));
- QObject::connect(axis(), SIGNAL(gridLinePenChanged(const QPen&)), this, SLOT(handleGridPenChanged(const QPen&)));
- QObject::connect(axis(), SIGNAL(shadesPenChanged(const QPen&)), this, SLOT(handleShadesPenChanged(const QPen&)));
- QObject::connect(axis(), SIGNAL(shadesBrushChanged(const QBrush&)), this, SLOT(handleShadesBrushChanged(const QBrush&)));
- QObject::connect(axis(), SIGNAL(titleTextChanged(const QString&)), this, SLOT(handleTitleTextChanged(const QString&)));
- QObject::connect(axis(), SIGNAL(titleFontChanged(const QFont&)), this, SLOT(handleTitleFontChanged(const QFont&)));
- QObject::connect(axis(), SIGNAL(titlePenChanged(const QPen&)), this, SLOT(handleTitlePenChanged(const QPen&)));
- QObject::connect(axis(), SIGNAL(titleBrushChanged(const QBrush&)), this, SLOT(handleTitleBrushChanged(const QBrush&)));
- QObject::connect(axis(), SIGNAL(titleVisibleChanged(bool)), this, SLOT(handleTitleVisibleChanged(bool)));
- QObject::connect(axis()->d_ptr.data(), SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(handleRangeChanged(qreal, qreal)));
-}
-
-void ChartAxisElement::handleArrowVisibleChanged(bool visible)
-{
- m_arrow->setVisible(visible);
-}
-
-void ChartAxisElement::handleGridVisibleChanged(bool visible)
-{
- m_grid->setVisible(visible);
-}
-
-void ChartAxisElement::handleLabelsVisibleChanged(bool visible)
-{
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
- m_labels->setVisible(visible);
-}
-
-void ChartAxisElement::handleShadesVisibleChanged(bool visible)
-{
- m_shades->setVisible(visible);
-}
-
-void ChartAxisElement::handleTitleVisibleChanged(bool visible)
-{
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
- m_title->setVisible(visible);
-}
-
-void ChartAxisElement::handleLabelsAngleChanged(int angle)
-{
- foreach (QGraphicsItem *item, m_labels->childItems())
- item->setRotation(angle);
-
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
-}
-
-void ChartAxisElement::handleLabelsPenChanged(const QPen &pen)
-{
- Q_UNUSED(pen)
-}
-
-void ChartAxisElement::handleLabelsBrushChanged(const QBrush &brush)
-{
- foreach (QGraphicsItem *item, m_labels->childItems())
- static_cast<QGraphicsTextItem *>(item)->setDefaultTextColor(brush.color());
-}
-
-void ChartAxisElement::handleLabelsFontChanged(const QFont &font)
-{
- foreach (QGraphicsItem *item, m_labels->childItems())
- static_cast<QGraphicsTextItem *>(item)->setFont(font);
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
-}
-
-void ChartAxisElement::handleTitleTextChanged(const QString &title)
-{
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
- if (title.isEmpty() || !m_title->isVisible())
- m_title->setHtml(title);
-}
-
-void ChartAxisElement::handleTitlePenChanged(const QPen &pen)
-{
- Q_UNUSED(pen)
-}
-
-void ChartAxisElement::handleTitleBrushChanged(const QBrush &brush)
-{
- m_title->setDefaultTextColor(brush.color());
-}
-
-void ChartAxisElement::handleTitleFontChanged(const QFont &font)
-{
- if (m_title->font() != font) {
- m_title->setFont(font);
- QGraphicsLayoutItem::updateGeometry();
- presenter()->layout()->invalidate();
- }
-}
-
-void ChartAxisElement::handleVisibleChanged(bool visible)
-{
- setVisible(visible);
- if (!visible) {
- m_grid->setVisible(visible);
- m_arrow->setVisible(visible);
- m_shades->setVisible(visible);
- m_labels->setVisible(visible);
- m_title->setVisible(visible);
- } else {
- m_grid->setVisible(axis()->isGridLineVisible());
- m_arrow->setVisible(axis()->isLineVisible());
- m_shades->setVisible(axis()->shadesVisible());
- m_labels->setVisible(axis()->labelsVisible());
- m_title->setVisible(axis()->isTitleVisible());
- }
-
- if (presenter()) presenter()->layout()->invalidate();
-}
-
-void ChartAxisElement::handleRangeChanged(qreal min, qreal max)
-{
- Q_UNUSED(min);
- Q_UNUSED(max);
-
- if (!isEmpty()) {
- QVector<qreal> layout = calculateLayout();
- updateLayout(layout);
- QSizeF before = effectiveSizeHint(Qt::PreferredSize);
- QSizeF after = sizeHint(Qt::PreferredSize);
-
- if (before != after) {
- QGraphicsLayoutItem::updateGeometry();
- // We don't want to call invalidate on layout, since it will change minimum size of
- // component, which we would like to avoid since it causes nasty flips when scrolling
- // or zooming, instead recalculate layout and use plotArea for extra space.
- presenter()->layout()->setGeometry(presenter()->layout()->geometry());
- }
- }
-}
-
-bool ChartAxisElement::isEmpty()
-{
- return axisGeometry().isEmpty()
- || gridGeometry().isEmpty()
- || qFuzzyCompare(min(), max());
-}
-
-qreal ChartAxisElement::min() const
-{
- return m_axis->d_ptr->min();
-}
-
-qreal ChartAxisElement::max() const
-{
- return m_axis->d_ptr->max();
-}
-
-QString ChartAxisElement::formatLabel(const QString &formatSpec, const QByteArray &array,
- qreal value, int precision, const QString &preStr,
- const QString &postStr) const
-{
- QString retVal;
- if (!formatSpec.isEmpty()) {
- if (formatSpec.at(0) == QLatin1Char('d')
- || formatSpec.at(0) == QLatin1Char('i')
- || formatSpec.at(0) == QLatin1Char('c')) {
- if (presenter()->localizeNumbers())
- retVal = preStr + presenter()->locale().toString(qint64(value)) + postStr;
- else
- retVal = QString().sprintf(array, qint64(value));
- } else if (formatSpec.at(0) == QLatin1Char('u')
- || formatSpec.at(0) == QLatin1Char('o')
- || formatSpec.at(0) == QLatin1Char('x')
- || formatSpec.at(0) == QLatin1Char('X')) {
- // These formats are not supported by localized numbers
- retVal = QString().sprintf(array, quint64(value));
- } else if (formatSpec.at(0) == QLatin1Char('f')
- || formatSpec.at(0) == QLatin1Char('F')
- || formatSpec.at(0) == QLatin1Char('e')
- || formatSpec.at(0) == QLatin1Char('E')
- || formatSpec.at(0) == QLatin1Char('g')
- || formatSpec.at(0) == QLatin1Char('G')) {
- if (presenter()->localizeNumbers()) {
- retVal = preStr
- + presenter()->locale().toString(value, formatSpec.at(0).toLatin1(),
- precision)
- + postStr;
- } else {
- retVal = QString().sprintf(array, value);
- }
- }
- }
- return retVal;
-}
-
-QStringList ChartAxisElement::createValueLabels(qreal min, qreal max, int ticks,
- const QString &format) const
-{
- QStringList labels;
-
- if (max <= min || ticks < 1)
- return labels;
-
- if (format.isNull()) {
- int n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0) + 1;
- for (int i = 0; i < ticks; i++) {
- qreal value = min + (i * (max - min) / (ticks - 1));
- labels << presenter()->numberToString(value, 'f', n);
- }
- } else {
- QByteArray array = format.toLatin1();
- QString formatSpec;
- QString preStr;
- QString postStr;
- int precision = 6; // Six is the default precision in Qt API
- if (presenter()->localizeNumbers()) {
- if (!labelFormatMatcherLocalized)
- labelFormatMatcherLocalized = new QRegExp(labelFormatMatchLocalizedString);
- if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
- preStr = labelFormatMatcherLocalized->cap(1);
- if (!labelFormatMatcherLocalized->cap(2).isEmpty())
- precision = labelFormatMatcherLocalized->cap(2).toInt();
- formatSpec = labelFormatMatcherLocalized->cap(3);
- postStr = labelFormatMatcherLocalized->cap(4);
- }
- } else {
- if (!labelFormatMatcher)
- labelFormatMatcher = new QRegExp(labelFormatMatchString);
- if (labelFormatMatcher->indexIn(format, 0) != -1)
- formatSpec = labelFormatMatcher->cap(1);
- }
- for (int i = 0; i < ticks; i++) {
- qreal value = min + (i * (max - min) / (ticks - 1));
- labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
- }
- }
-
- return labels;
-}
-
-QStringList ChartAxisElement::createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
- const QString &format) const
-{
- QStringList labels;
-
- if (max <= min || ticks < 1)
- return labels;
-
- int firstTick;
- if (base > 1)
- firstTick = ceil(log10(min) / log10(base));
- else
- firstTick = ceil(log10(max) / log10(base));
-
- if (format.isNull()) {
- int n = 0;
- if (ticks > 1)
- n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0);
- n++;
- for (int i = firstTick; i < ticks + firstTick; i++) {
- qreal value = qPow(base, i);
- labels << presenter()->numberToString(value, 'f', n);
- }
- } else {
- QByteArray array = format.toLatin1();
- QString formatSpec;
- QString preStr;
- QString postStr;
- int precision = 6; // Six is the default precision in Qt API
- if (presenter()->localizeNumbers()) {
- if (!labelFormatMatcherLocalized)
- labelFormatMatcherLocalized = new QRegExp(labelFormatMatchLocalizedString);
- if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
- preStr = labelFormatMatcherLocalized->cap(1);
- if (!labelFormatMatcherLocalized->cap(2).isEmpty())
- precision = labelFormatMatcherLocalized->cap(2).toInt();
- formatSpec = labelFormatMatcherLocalized->cap(3);
- postStr = labelFormatMatcherLocalized->cap(4);
- }
- } else {
- if (!labelFormatMatcher)
- labelFormatMatcher = new QRegExp(labelFormatMatchString);
- if (labelFormatMatcher->indexIn(format, 0) != -1)
- formatSpec = labelFormatMatcher->cap(1);
- }
- for (int i = firstTick; i < ticks + firstTick; i++) {
- qreal value = qPow(base, i);
- labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
- }
- }
-
- return labels;
-}
-
-QStringList ChartAxisElement::createDateTimeLabels(qreal min, qreal max,int ticks,
- const QString &format) const
-{
- QStringList labels;
-
- if (max <= min || ticks < 1)
- return labels;
-
- int n = qMax(int(-floor(log10((max - min) / (ticks - 1)))), 0);
- n++;
- for (int i = 0; i < ticks; i++) {
- qreal value = min + (i * (max - min) / (ticks - 1));
- labels << presenter()->locale().toString(QDateTime::fromMSecsSinceEpoch(value), format);
- }
- return labels;
-}
-
-void ChartAxisElement::axisSelected()
-{
- emit clicked();
-}
-
-#include "moc_chartaxiselement_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/chartaxiselement_p.h b/src/axis/chartaxiselement_p.h
deleted file mode 100644
index c561d9d8..00000000
--- a/src/axis/chartaxiselement_p.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTAXISELEMENT_H
-#define CHARTAXISELEMENT_H
-
-#include "qchartglobal.h"
-#include "chartelement_p.h"
-#include "axisanimation_p.h"
-#include <QGraphicsItem>
-#include <QGraphicsLayoutItem>
-#include <QFont>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartPresenter;
-class QAbstractAxis;
-
-class ChartAxisElement : public ChartElement, public QGraphicsLayoutItem
-{
- Q_OBJECT
-
- using QGraphicsLayoutItem::setGeometry;
-public:
- ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
- ~ChartAxisElement();
-
- virtual QRectF gridGeometry() const = 0;
- virtual void setGeometry(const QRectF &axis, const QRectF &grid) = 0;
- virtual bool isEmpty() = 0;
-
- void setAnimation(AxisAnimation *animation) { m_animation = animation; }
- AxisAnimation *animation() const { return m_animation; }
-
- QAbstractAxis *axis() const { return m_axis; }
- void setLayout(QVector<qreal> &layout) { m_layout = layout; }
- QVector<qreal> &layout() { return m_layout; } // Modifiable reference
- inline qreal labelPadding() const { return qreal(4.0); }
- inline qreal titlePadding() const { return qreal(2.0); }
- void setLabels(const QStringList &labels) { m_labelsList = labels; }
- QStringList labels() const { return m_labelsList; }
-
- qreal min() const;
- qreal max() const;
-
- QRectF axisGeometry() const { return m_axisRect; }
- void setAxisGeometry(const QRectF &axisGeometry) { m_axisRect = axisGeometry; }
-
- void axisSelected();
-
- //this flag indicates that axis is used to show intervals it means labels are in between ticks
- bool intervalAxis() const { return m_intervalAxis; }
-
- QStringList createValueLabels(qreal max, qreal min, int ticks, const QString &format) const;
- QStringList createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
- const QString &format) const;
- QStringList createDateTimeLabels(qreal max, qreal min, int ticks, const QString &format) const;
-
- // from QGraphicsLayoutItem
- QRectF boundingRect() const
- {
- return QRectF();
- }
-
- // from QGraphicsLayoutItem
- void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)
- {
- }
-
-protected:
- virtual QVector<qreal> calculateLayout() const = 0;
- virtual void updateLayout(QVector<qreal> &layout) = 0;
-
- QList<QGraphicsItem *> gridItems() { return m_grid->childItems(); }
- QList<QGraphicsItem *> labelItems() { return m_labels->childItems(); }
- QList<QGraphicsItem *> shadeItems() { return m_shades->childItems(); }
- QList<QGraphicsItem *> arrowItems() { return m_arrow->childItems(); }
- QGraphicsTextItem *titleItem() const { return m_title.data(); }
- QGraphicsItemGroup *gridGroup() { return m_grid.data(); }
- QGraphicsItemGroup *labelGroup() { return m_labels.data(); }
- QGraphicsItemGroup *shadeGroup() { return m_shades.data(); }
- QGraphicsItemGroup *arrowGroup() { return m_arrow.data(); }
-
-public Q_SLOTS:
- void handleVisibleChanged(bool visible);
- void handleArrowVisibleChanged(bool visible);
- void handleGridVisibleChanged(bool visible);
- void handleLabelsVisibleChanged(bool visible);
- void handleShadesVisibleChanged(bool visible);
- void handleLabelsAngleChanged(int angle);
- virtual void handleShadesBrushChanged(const QBrush &brush) = 0;
- virtual void handleShadesPenChanged(const QPen &pen) = 0;
- virtual void handleArrowPenChanged(const QPen &pen) = 0;
- virtual void handleGridPenChanged(const QPen &pen) = 0;
- void handleLabelsPenChanged(const QPen &pen);
- void handleLabelsBrushChanged(const QBrush &brush);
- void handleLabelsFontChanged(const QFont &font);
- void handleTitlePenChanged(const QPen &pen);
- void handleTitleBrushChanged(const QBrush &brush);
- void handleTitleFontChanged(const QFont &font);
- void handleTitleTextChanged(const QString &title);
- void handleTitleVisibleChanged(bool visible);
- void handleRangeChanged(qreal min, qreal max);
-
-Q_SIGNALS:
- void clicked();
-
-private:
- void connectSlots();
- QString formatLabel(const QString &formatSpec, const QByteArray &array,
- qreal value, int precision, const QString &preStr,
- const QString &postStr) const;
-
- QAbstractAxis *m_axis;
- AxisAnimation *m_animation;
- QVector<qreal> m_layout;
- QStringList m_labelsList;
- QRectF m_axisRect;
- QScopedPointer<QGraphicsItemGroup> m_grid;
- QScopedPointer<QGraphicsItemGroup> m_arrow;
- QScopedPointer<QGraphicsItemGroup> m_shades;
- QScopedPointer<QGraphicsItemGroup> m_labels;
- QScopedPointer<QGraphicsTextItem> m_title;
- bool m_intervalAxis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTAXISELEMENT_H */
diff --git a/src/axis/datetimeaxis/chartdatetimeaxisx.cpp b/src/axis/datetimeaxis/chartdatetimeaxisx.cpp
deleted file mode 100644
index 4298a137..00000000
--- a/src/axis/datetimeaxis/chartdatetimeaxisx.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartdatetimeaxisx_p.h"
-#include "chartpresenter_p.h"
-#include "qdatetimeaxis.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <QDateTime>
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartDateTimeAxisX::ChartDateTimeAxisX(QDateTimeAxis *axis, QGraphicsItem *item)
- : HorizontalAxis(axis, item),
- m_axis(axis)
-{
- QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
- QObject::connect(m_axis, SIGNAL(formatChanged(QString)), this, SLOT(handleFormatChanged(QString)));
-}
-
-ChartDateTimeAxisX::~ChartDateTimeAxisX()
-{
-}
-
-QVector<qreal> ChartDateTimeAxisX::calculateLayout() const
-{
- int tickCount = m_axis->tickCount();
-
- Q_ASSERT(tickCount >= 2);
-
- QVector<qreal> points;
- points.resize(tickCount);
- const QRectF &gridRect = gridGeometry();
- const qreal deltaX = gridRect.width() / (qreal(tickCount) - 1.0);
- for (int i = 0; i < tickCount; ++i)
- points[i] = qreal(i) * deltaX + gridRect.left();
- return points;
-}
-
-void ChartDateTimeAxisX::updateGeometry()
-{
- const QVector<qreal>& layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createDateTimeLabels(min(), max(), layout.size(), m_axis->format()));
- HorizontalAxis::updateGeometry();
-}
-
-void ChartDateTimeAxisX::handleTickCountChanged(int tick)
-{
- Q_UNUSED(tick)
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void ChartDateTimeAxisX::handleFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-QSizeF ChartDateTimeAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
-
- QSizeF base = HorizontalAxis::sizeHint(which, constraint);
- QStringList ticksList = createDateTimeLabels(min(), max(), m_axis->tickCount(), m_axis->format());
- // Width of horizontal axis sizeHint indicates the maximum distance labels can extend past
- // first and last ticks. Base width is irrelevant.
- qreal width = 0;
- qreal height = 0;
-
- if (ticksList.empty())
- return sh;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() / 2.0;
- height = boundingRect.height() + labelPadding() + base.height() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelHeight = 0.0;
- qreal firstWidth = -1.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelHeight = qMax(rect.height(), labelHeight);
- width = rect.width();
- if (firstWidth < 0.0)
- firstWidth = width;
- }
- height = labelHeight + labelPadding() + base.height() + 1.0;
- width = qMax(width, firstWidth) / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-#include "moc_chartdatetimeaxisx_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/datetimeaxis/chartdatetimeaxisx_p.h b/src/axis/datetimeaxis/chartdatetimeaxisx_p.h
deleted file mode 100644
index 2a8fc045..00000000
--- a/src/axis/datetimeaxis/chartdatetimeaxisx_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTDATETIMEAXISX_H
-#define CHARTDATETIMEAXISX_H
-
-#include "horizontalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QDateTimeAxis;
-
-class ChartDateTimeAxisX : public HorizontalAxis
-{
- Q_OBJECT
-public:
- ChartDateTimeAxisX(QDateTimeAxis *axis, QGraphicsItem* item = 0);
- ~ChartDateTimeAxisX();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-private Q_SLOTS:
- void handleTickCountChanged(int tick);
- void handleFormatChanged(const QString &format);
-
-private:
- QDateTimeAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTDATETIMEAXISX_H */
diff --git a/src/axis/datetimeaxis/chartdatetimeaxisy.cpp b/src/axis/datetimeaxis/chartdatetimeaxisy.cpp
deleted file mode 100644
index a0c7d0e6..00000000
--- a/src/axis/datetimeaxis/chartdatetimeaxisy.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartdatetimeaxisy_p.h"
-#include "chartpresenter_p.h"
-#include "qdatetimeaxis.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <QDateTime>
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartDateTimeAxisY::ChartDateTimeAxisY(QDateTimeAxis *axis, QGraphicsItem *item)
- : VerticalAxis(axis, item),
- m_axis(axis)
-{
- QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
- QObject::connect(m_axis, SIGNAL(formatChanged(QString)), this, SLOT(handleFormatChanged(QString)));
-}
-
-ChartDateTimeAxisY::~ChartDateTimeAxisY()
-{
-}
-
-QVector<qreal> ChartDateTimeAxisY::calculateLayout() const
-{
- int tickCount = m_axis->tickCount();
-
- Q_ASSERT(tickCount >= 2);
-
- QVector<qreal> points;
- points.resize(tickCount);
- const QRectF &gridRect = gridGeometry();
- const qreal deltaY = gridRect.height() / (qreal(tickCount) - 1.0);
- for (int i = 0; i < tickCount; ++i)
- points[i] = qreal(i) * -deltaY + gridRect.bottom();
-
- return points;
-}
-
-void ChartDateTimeAxisY::updateGeometry()
-{
- const QVector<qreal> &layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createDateTimeLabels(min(), max(), layout.size(), m_axis->format()));
- VerticalAxis::updateGeometry();
-}
-
-void ChartDateTimeAxisY::handleTickCountChanged(int tick)
-{
- Q_UNUSED(tick)
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void ChartDateTimeAxisY::handleFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-QSizeF ChartDateTimeAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
-
- QSizeF base = VerticalAxis::sizeHint(which, constraint);
- QStringList ticksList = createDateTimeLabels(min(), max(), m_axis->tickCount(), m_axis->format());
- qreal width = 0;
- // Height of vertical axis sizeHint indicates the maximum distance labels can extend past
- // first and last ticks. Base height is irrelevant.
- qreal height = 0;
-
- if (ticksList.empty())
- return sh;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() + labelPadding() + base.width() + 1.0;
- height = boundingRect.height() / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelWidth = 0.0;
- qreal firstHeight = -1.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelWidth = qMax(rect.width(), labelWidth);
- height = rect.height();
- if (firstHeight < 0.0)
- firstHeight = height;
- }
- width = labelWidth + labelPadding() + base.width() + 2.0; //two pixels of tolerance
- height = qMax(height, firstHeight) / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-#include "moc_chartdatetimeaxisy_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/datetimeaxis/chartdatetimeaxisy_p.h b/src/axis/datetimeaxis/chartdatetimeaxisy_p.h
deleted file mode 100644
index eea7e7d1..00000000
--- a/src/axis/datetimeaxis/chartdatetimeaxisy_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTDATETIMEAXISY_H
-#define CHARTDATETIMEAXISY_H
-
-#include "verticalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QDateTimeAxis;
-
-class ChartDateTimeAxisY : public VerticalAxis
-{
- Q_OBJECT
-public:
- ChartDateTimeAxisY(QDateTimeAxis *axis, QGraphicsItem* item = 0);
- ~ChartDateTimeAxisY();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-private Q_SLOTS:
- void handleTickCountChanged(int tick);
- void handleFormatChanged(const QString &format);
-
-private:
- QDateTimeAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTDATETIMEAXISY_H */
diff --git a/src/axis/datetimeaxis/polarchartdatetimeaxisangular.cpp b/src/axis/datetimeaxis/polarchartdatetimeaxisangular.cpp
deleted file mode 100644
index 05127734..00000000
--- a/src/axis/datetimeaxis/polarchartdatetimeaxisangular.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartdatetimeaxisangular_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include "qdatetimeaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartDateTimeAxisAngular::PolarChartDateTimeAxisAngular(QDateTimeAxis *axis, QGraphicsItem *item)
- : PolarChartAxisAngular(axis, item)
-{
- QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
- QObject::connect(axis, SIGNAL(formatChanged(QString)), this, SLOT(handleFormatChanged(QString)));
-}
-
-PolarChartDateTimeAxisAngular::~PolarChartDateTimeAxisAngular()
-{
-}
-
-QVector<qreal> PolarChartDateTimeAxisAngular::calculateLayout() const
-{
- int tickCount = static_cast<QDateTimeAxis *>(axis())->tickCount();
- Q_ASSERT(tickCount >= 2);
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- const qreal d = 360.0 / qreal(tickCount - 1);
-
- for (int i = 0; i < tickCount; ++i) {
- qreal angularCoordinate = qreal(i) * d;
- points[i] = angularCoordinate;
- }
-
- return points;
-}
-void PolarChartDateTimeAxisAngular::createAxisLabels(const QVector<qreal> &layout)
-{
- QStringList labelList = createDateTimeLabels(min(), max(), layout.size(), static_cast<QDateTimeAxis *>(axis())->format());
- setLabels(labelList);
-}
-
-void PolarChartDateTimeAxisAngular::handleTickCountChanged(int tick)
-{
- Q_UNUSED(tick);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void PolarChartDateTimeAxisAngular::handleFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-#include "moc_polarchartdatetimeaxisangular_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/datetimeaxis/polarchartdatetimeaxisangular_p.h b/src/axis/datetimeaxis/polarchartdatetimeaxisangular_p.h
deleted file mode 100644
index a8fd13b3..00000000
--- a/src/axis/datetimeaxis/polarchartdatetimeaxisangular_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTDATETIMEAXISANGULAR_P_H
-#define POLARCHARTDATETIMEAXISANGULAR_P_H
-
-#include "polarchartaxisangular_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QDateTimeAxis;
-
-class PolarChartDateTimeAxisAngular : public PolarChartAxisAngular
-{
- Q_OBJECT
-public:
- PolarChartDateTimeAxisAngular(QDateTimeAxis *axis, QGraphicsItem *item);
- ~PolarChartDateTimeAxisAngular();
-
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-private Q_SLOTS:
- void handleTickCountChanged(int tick);
- void handleFormatChanged(const QString &format);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTDATETIMEAXISANGULAR_P_H
diff --git a/src/axis/datetimeaxis/polarchartdatetimeaxisradial.cpp b/src/axis/datetimeaxis/polarchartdatetimeaxisradial.cpp
deleted file mode 100644
index 0b152c7f..00000000
--- a/src/axis/datetimeaxis/polarchartdatetimeaxisradial.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartdatetimeaxisradial_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include "qdatetimeaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartDateTimeAxisRadial::PolarChartDateTimeAxisRadial(QDateTimeAxis *axis, QGraphicsItem *item)
- : PolarChartAxisRadial(axis, item)
-{
- QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
- QObject::connect(axis, SIGNAL(formatChanged(QString)), this, SLOT(handleFormatChanged(QString)));
-}
-
-PolarChartDateTimeAxisRadial::~PolarChartDateTimeAxisRadial()
-{
-}
-
-QVector<qreal> PolarChartDateTimeAxisRadial::calculateLayout() const
-{
- int tickCount = static_cast<QDateTimeAxis *>(axis())->tickCount();
- Q_ASSERT(tickCount >= 2);
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- const qreal d = (axisGeometry().width() / 2) / qreal(tickCount - 1);
-
- for (int i = 0; i < tickCount; ++i) {
- qreal radialCoordinate = qreal(i) * d;
- points[i] = radialCoordinate;
- }
-
- return points;
-}
-void PolarChartDateTimeAxisRadial::createAxisLabels(const QVector<qreal> &layout)
-{
- setLabels(createDateTimeLabels(min(), max(), layout.size(), static_cast<QDateTimeAxis *>(axis())->format()));
-}
-
-void PolarChartDateTimeAxisRadial::handleTickCountChanged(int tick)
-{
- Q_UNUSED(tick);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void PolarChartDateTimeAxisRadial::handleFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-#include "moc_polarchartdatetimeaxisradial_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/datetimeaxis/polarchartdatetimeaxisradial_p.h b/src/axis/datetimeaxis/polarchartdatetimeaxisradial_p.h
deleted file mode 100644
index 5df327e1..00000000
--- a/src/axis/datetimeaxis/polarchartdatetimeaxisradial_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTDATETIMEAXISRADIAL_P_H
-#define POLARCHARTDATETIMEAXISRADIAL_P_H
-
-#include "polarchartaxisradial_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QDateTimeAxis;
-
-class PolarChartDateTimeAxisRadial : public PolarChartAxisRadial
-{
- Q_OBJECT
-public:
- PolarChartDateTimeAxisRadial(QDateTimeAxis *axis, QGraphicsItem *item);
- ~PolarChartDateTimeAxisRadial();
-
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-private Q_SLOTS:
- void handleTickCountChanged(int tick);
- void handleFormatChanged(const QString &format);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTDATETIMEAXISRADIAL_P_H
diff --git a/src/axis/datetimeaxis/qdatetimeaxis.cpp b/src/axis/datetimeaxis/qdatetimeaxis.cpp
deleted file mode 100644
index 83c09fbb..00000000
--- a/src/axis/datetimeaxis/qdatetimeaxis.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdatetimeaxis.h"
-#include "qdatetimeaxis_p.h"
-#include "chartdatetimeaxisx_p.h"
-#include "chartdatetimeaxisy_p.h"
-#include "polarchartdatetimeaxisangular_p.h"
-#include "polarchartdatetimeaxisradial_p.h"
-#include "abstractdomain_p.h"
-#include "qchart.h"
-#include <float.h>
-#include <cmath>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-/*!
- \class QDateTimeAxis
- \inmodule Qt Charts
- \brief The QDateTimeAxis class is used for manipulating chart's axis.
- \mainclass
-
- The labels can be configured by setting an appropriate DateTime format.
- QDateTimeAxis works correctly with dates from 4714 BCE to 287396 CE.
- There are also other limitiation related to QDateTime. Please refer to QDateTime documentation.
- QDateTimeAxis can be setup to show axis line with tick marks, grid lines and shades.
-
- Note: QDateTimeAxis is disabled on ARM architecture.
-
- \image api_datatime_axis.png
-
- QDateTimeAxis can be used with any QXYSeries.
- To add a data point to the series QDateTime::toMSecsSinceEpoch() is used.
- \code
- QLineSeries *series = new QLineSeries;
-
- QDateTime xValue;
- xValue.setDate(QDate(2012, 1 , 18));
- xValue.setTime(QTime(9, 34));
- qreal yValue = 12;
- series->append(xValue.toMSecsSinceEpoch(), yValue);
-
- xValue.setDate(QDate(2013, 5 , 11));
- xValue.setTime(QTime(11, 14));
- qreal yValue = 22;
- series->append(xValue.toMSecsSinceEpoch(), yValue);
- \endcode
-
- Adding the series to the chart and setting up the QDateTimeAxis.
- \code
- QChartView *chartView = new QChartView;
- chartView->chart()->addSeries(series);
-
- // ...
- QDateTimeAxis *axisX = new QDateTimeAxis;
- axisX->setFormat("dd-MM-yyyy h:mm");
- chartView->chart()->setAxisX(axisX, series);
- \endcode
-*/
-
-#ifdef QDOC_QT5
-/*!
- \qmltype DateTimeAxis
- \instantiates QDateTimeAxis
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/datetimeaxis.qdocinc
-*/
-#else
-/*!
- \qmlclass DateTimeAxis QDateTimeAxis
-
- \include ../doc/src/datetimeaxis.qdocinc
-*/
-#endif
-
-/*!
- \property QDateTimeAxis::min
- Defines the minimum value on the axis.
- When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
-*/
-/*!
- \qmlproperty datetime DateTimeAxis::min
- Defines the minimum value on the axis.
- When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
-*/
-
-/*!
- \property QDateTimeAxis::max
- Defines the maximum value on the axis.
- When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
-*/
-/*!
- \qmlproperty datetime DateTimeAxis::max
- Defines the maximum value on the axis.
- When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
-*/
-
-/*!
- \fn void QDateTimeAxis::minChanged(QDateTime min)
- Axis emits signal when \a min of axis has changed.
-*/
-/*!
- \qmlsignal DateTimeAxis::onMinChanged(datetime min)
- Axis emits signal when \a min of axis has changed.
-*/
-
-/*!
- \fn void QDateTimeAxis::maxChanged(QDateTime max)
- Axis emits signal when \a max of axis has changed.
-*/
-/*!
- \qmlsignal DateTimeAxis::onMaxChanged(datetime max)
- Axis emits signal when \a max of axis has changed.
-*/
-
-/*!
- \fn void QDateTimeAxis::rangeChanged(QDateTime min, QDateTime max)
- Axis emits signal when \a min or \a max of axis has changed.
-*/
-
-/*!
- \property QDateTimeAxis::tickCount
- The number of tick marks for the axis.
-*/
-
-/*!
- \qmlproperty int DateTimeAxis::tickCount
- The number of tick marks for the axis.
-*/
-
-/*!
- \property QDateTimeAxis::format
- The format string that is used when creating label for the axis out of a QDateTime object.
- Check QDateTime documentation for information on how the string should be defined.
-
- \sa QChart::locale
-*/
-/*!
- \qmlproperty string DateTimeAxis::format
- The format string that is used when creating label for the axis out of a QDateTime object.
- Check QDateTime documentation for information on how the string should be defined.
-*/
-
-/*!
- \fn void QDateTimeAxis::tickCountChanged(int tickCount)
- Axis emits signal when \a tickCount number on axis have changed.
-*/
-/*!
- \qmlsignal DateTimeAxis::tickCountChanged(int tickCount)
- Axis emits signal when \a tickCount number on axis have changed.
-*/
-
-/*!
- \fn void QDateTimeAxis::formatChanged(QString format)
- Axis emits signal when \a format of the axis has changed.
-*/
-/*!
- \qmlsignal DateTimeAxis::onFormatChanged(string format)
- Axis emits signal when \a format of the axis has changed.
-*/
-
-/*!
- Constructs an axis object which is a child of \a parent.
-*/
-QDateTimeAxis::QDateTimeAxis(QObject *parent) :
- QAbstractAxis(*new QDateTimeAxisPrivate(this), parent)
-{
-
-}
-
-/*!
- \internal
-*/
-QDateTimeAxis::QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
-{
-
-}
-
-/*!
- Destroys the object.
-*/
-QDateTimeAxis::~QDateTimeAxis()
-{
- Q_D(QDateTimeAxis);
- if (d->m_chart)
- d->m_chart->removeAxis(this);
-}
-
-void QDateTimeAxis::setMin(QDateTime min)
-{
- Q_D(QDateTimeAxis);
- if (min.isValid())
- d->setRange(min.toMSecsSinceEpoch(), qMax(d->m_max, qreal(min.toMSecsSinceEpoch())));
-}
-
-QDateTime QDateTimeAxis::min() const
-{
- Q_D(const QDateTimeAxis);
- return QDateTime::fromMSecsSinceEpoch(d->m_min);
-}
-
-void QDateTimeAxis::setMax(QDateTime max)
-{
- Q_D(QDateTimeAxis);
- if (max.isValid())
- d->setRange(qMin(d->m_min, qreal(max.toMSecsSinceEpoch())), max.toMSecsSinceEpoch());
-}
-
-QDateTime QDateTimeAxis::max() const
-{
- Q_D(const QDateTimeAxis);
- return QDateTime::fromMSecsSinceEpoch(d->m_max);
-}
-
-/*!
- Sets range from \a min to \a max on the axis.
- If min is greater than max then this function returns without making any changes.
-*/
-void QDateTimeAxis::setRange(QDateTime min, QDateTime max)
-{
- Q_D(QDateTimeAxis);
- if (!min.isValid() || !max.isValid() || min > max)
- return;
-
- d->setRange(min.toMSecsSinceEpoch(),max.toMSecsSinceEpoch());
-}
-
-void QDateTimeAxis::setFormat(QString format)
-{
- Q_D(QDateTimeAxis);
- if (d->m_format != format) {
- d->m_format = format;
- emit formatChanged(format);
- }
-}
-
-QString QDateTimeAxis::format() const
-{
- Q_D(const QDateTimeAxis);
- return d->m_format;
-}
-
-/*!
- Sets \a count for ticks on the axis.
-*/
-void QDateTimeAxis::setTickCount(int count)
-{
- Q_D(QDateTimeAxis);
- if (d->m_tickCount != count && count >= 2) {
- d->m_tickCount = count;
- emit tickCountChanged(count);
- }
-}
-
-/*!
- \fn int QDateTimeAxis::tickCount() const
- Return number of ticks on the axis.
-*/
-int QDateTimeAxis::tickCount() const
-{
- Q_D(const QDateTimeAxis);
- return d->m_tickCount;
-}
-
-/*!
- Returns the type of the axis.
-*/
-QAbstractAxis::AxisType QDateTimeAxis::type() const
-{
- return AxisTypeDateTime;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QDateTimeAxisPrivate::QDateTimeAxisPrivate(QDateTimeAxis *q)
- : QAbstractAxisPrivate(q),
- m_min(0),
- m_max(0),
- m_tickCount(5)
-{
- m_format = "dd-MM-yyyy\nh:mm";
-}
-
-QDateTimeAxisPrivate::~QDateTimeAxisPrivate()
-{
-
-}
-
-void QDateTimeAxisPrivate::setRange(qreal min,qreal max)
-{
- Q_Q(QDateTimeAxis);
-
- bool changed = false;
-
- if (m_min != min) {
- m_min = min;
- changed = true;
- emit q->minChanged(QDateTime::fromMSecsSinceEpoch(min));
- }
-
- if (m_max != max) {
- m_max = max;
- changed = true;
- emit q->maxChanged(QDateTime::fromMSecsSinceEpoch(max));
- }
-
- if (changed) {
- emit q->rangeChanged(QDateTime::fromMSecsSinceEpoch(min), QDateTime::fromMSecsSinceEpoch(max));
- emit rangeChanged(m_min,m_max);
- }
-}
-
-
-void QDateTimeAxisPrivate::setMin(const QVariant &min)
-{
- Q_Q(QDateTimeAxis);
- if (min.canConvert(QVariant::DateTime))
- q->setMin(min.toDateTime());
-}
-
-void QDateTimeAxisPrivate::setMax(const QVariant &max)
-{
-
- Q_Q(QDateTimeAxis);
- if (max.canConvert(QVariant::DateTime))
- q->setMax(max.toDateTime());
-}
-
-void QDateTimeAxisPrivate::setRange(const QVariant &min, const QVariant &max)
-{
- Q_Q(QDateTimeAxis);
- if (min.canConvert(QVariant::DateTime) && max.canConvert(QVariant::DateTime))
- q->setRange(min.toDateTime(), max.toDateTime());
-}
-
-void QDateTimeAxisPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QDateTimeAxis);
- ChartAxisElement *axis(0);
- if (m_chart->chartType() == QChart::ChartTypeCartesian) {
- if (orientation() == Qt::Vertical)
- axis = new ChartDateTimeAxisY(q,parent);
- if (orientation() == Qt::Horizontal)
- axis = new ChartDateTimeAxisX(q,parent);
- }
-
- if (m_chart->chartType() == QChart::ChartTypePolar) {
- if (orientation() == Qt::Vertical)
- axis = new PolarChartDateTimeAxisRadial(q, parent);
- if (orientation() == Qt::Horizontal)
- axis = new PolarChartDateTimeAxisAngular(q, parent);
- }
-
- m_item.reset(axis);
- QAbstractAxisPrivate::initializeGraphics(parent);
-}
-
-void QDateTimeAxisPrivate::initializeDomain(AbstractDomain *domain)
-{
- if (m_max == m_min) {
- if (orientation() == Qt::Vertical)
- setRange(domain->minY(), domain->maxY());
- else
- setRange(domain->minX(), domain->maxX());
- } else {
- if (orientation() == Qt::Vertical)
- domain->setRangeY(m_min, m_max);
- else
- domain->setRangeX(m_min, m_max);
- }
-}
-
-#include "moc_qdatetimeaxis.cpp"
-#include "moc_qdatetimeaxis_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/datetimeaxis/qdatetimeaxis.h b/src/axis/datetimeaxis/qdatetimeaxis.h
deleted file mode 100644
index b106f201..00000000
--- a/src/axis/datetimeaxis/qdatetimeaxis.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDATETIMEAXIS_H
-#define QDATETIMEAXIS_H
-
-#include "qabstractaxis.h"
-
-class QDateTime;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QDateTimeAxisPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QDateTimeAxis : public QAbstractAxis
-{
- Q_OBJECT
- Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount NOTIFY tickCountChanged)
- Q_PROPERTY(QDateTime min READ min WRITE setMin NOTIFY minChanged)
- Q_PROPERTY(QDateTime max READ max WRITE setMax NOTIFY maxChanged)
- Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
-
-public:
- explicit QDateTimeAxis(QObject *parent = 0);
- ~QDateTimeAxis();
-
-protected:
- QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent = 0);
-
-public:
- AxisType type() const;
-
- //range handling
- void setMin(QDateTime min);
- QDateTime min() const;
- void setMax(QDateTime max);
- QDateTime max() const;
- void setRange(QDateTime min, QDateTime max);
-
- void setFormat(QString format);
- QString format() const;
-
- //ticks handling
- void setTickCount(int count);
- int tickCount() const;
-
-Q_SIGNALS:
- void minChanged(QDateTime min);
- void maxChanged(QDateTime max);
- void rangeChanged(QDateTime min, QDateTime max);
- void formatChanged(QString format);
- void tickCountChanged(int tick);
-
-private:
- Q_DECLARE_PRIVATE(QDateTimeAxis)
- Q_DISABLE_COPY(QDateTimeAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QDATETIMEAXIS_H
diff --git a/src/axis/datetimeaxis/qdatetimeaxis_p.h b/src/axis/datetimeaxis/qdatetimeaxis_p.h
deleted file mode 100644
index 601c0622..00000000
--- a/src/axis/datetimeaxis/qdatetimeaxis_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QDATETIMEAXIS_P_H
-#define QDATETIMEAXIS_P_H
-
-#include "qdatetimeaxis.h"
-#include "qabstractaxis_p.h"
-#include <QDateTime>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QDateTimeAxisPrivate : public QAbstractAxisPrivate
-{
- Q_OBJECT
-public:
- QDateTimeAxisPrivate(QDateTimeAxis *q);
- ~QDateTimeAxisPrivate();
-
-public:
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain(AbstractDomain *domain);
-
- //interface for manipulating range form base class
- void setMin(const QVariant &min);
- void setMax(const QVariant &max);
- void setRange(const QVariant &min, const QVariant &max);
-
- //interface manipulating range form domain
- qreal min() { return m_min; }
- qreal max() { return m_max; }
- void setRange(qreal min,qreal max);
-
-protected:
- int tickCount() const;
-
-protected:
- qreal m_min;
- qreal m_max;
- int m_tickCount;
- QString m_format;
- Q_DECLARE_PUBLIC(QDateTimeAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QDATETIMEAXIS_P_H
diff --git a/src/axis/horizontalaxis.cpp b/src/axis/horizontalaxis.cpp
deleted file mode 100644
index 7e4b057f..00000000
--- a/src/axis/horizontalaxis.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "horizontalaxis_p.h"
-#include "qabstractaxis_p.h"
-#include "chartpresenter_p.h"
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-HorizontalAxis::HorizontalAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
- : CartesianChartAxis(axis, item, intervalAxis)
-{
-}
-
-HorizontalAxis::~HorizontalAxis()
-{
-}
-
-void HorizontalAxis::updateGeometry()
-{
- const QVector<qreal> &layout = ChartAxisElement::layout();
-
- if (layout.isEmpty())
- return;
-
- QStringList labelList = labels();
-
- QList<QGraphicsItem *> lines = gridItems();
- QList<QGraphicsItem *> labels = labelItems();
- QList<QGraphicsItem *> shades = shadeItems();
- QList<QGraphicsItem *> arrow = arrowItems();
- QGraphicsTextItem *title = titleItem();
-
- Q_ASSERT(labels.size() == labelList.size());
- Q_ASSERT(layout.size() == labelList.size());
-
- const QRectF &axisRect = axisGeometry();
- const QRectF &gridRect = gridGeometry();
-
- //arrow
- QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem *>(arrow.at(0));
-
- if (axis()->alignment() == Qt::AlignTop)
- arrowItem->setLine(gridRect.left(), axisRect.bottom(), gridRect.right(), axisRect.bottom());
- else if (axis()->alignment() == Qt::AlignBottom)
- arrowItem->setLine(gridRect.left(), axisRect.top(), gridRect.right(), axisRect.top());
-
- qreal width = 0;
- const QLatin1String ellipsis("...");
-
- //title
- QRectF titleBoundingRect;
- QString titleText = axis()->titleText();
- qreal availableSpace = axisRect.height() - labelPadding();
- if (!titleText.isEmpty() && titleItem()->isVisible()) {
- availableSpace -= titlePadding() * 2.0;
- qreal minimumLabelHeight = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...").height();
- qreal titleSpace = availableSpace - minimumLabelHeight;
- title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
- gridRect.width(), titleSpace,
- titleBoundingRect));
- title->setTextWidth(titleBoundingRect.width());
-
- titleBoundingRect = title->boundingRect();
-
- QPointF center = gridRect.center() - titleBoundingRect.center();
- if (axis()->alignment() == Qt::AlignTop)
- title->setPos(center.x(), axisRect.top() + titlePadding());
- else if (axis()->alignment() == Qt::AlignBottom)
- title->setPos(center.x(), axisRect.bottom() - titleBoundingRect.height() - titlePadding());
-
- availableSpace -= titleBoundingRect.height();
- }
-
- for (int i = 0; i < layout.size(); ++i) {
- //items
- QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem*>(lines.at(i));
- QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem*>(arrow.at(i + 1));
- QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labels.at(i));
-
- //grid line
- gridItem->setLine(layout[i], gridRect.top(), layout[i], gridRect.bottom());
-
- //label text wrapping
- QString text = labelList.at(i);
- QRectF boundingRect;
- // don't truncate empty labels
- if (text.isEmpty()) {
- labelItem->setHtml(text);
- } else {
- qreal labelWidth = axisRect.width() / layout.count() - (2 * labelPadding());
- QString truncatedText = ChartPresenter::truncatedText(axis()->labelsFont(), text,
- axis()->labelsAngle(),
- labelWidth,
- availableSpace, boundingRect);
- labelItem->setTextWidth(ChartPresenter::textBoundingRect(axis()->labelsFont(),
- truncatedText).width());
- labelItem->setHtml(truncatedText);
- }
-
- //label transformation origin point
- const QRectF& rect = labelItem->boundingRect();
- QPointF center = rect.center();
- labelItem->setTransformOriginPoint(center.x(), center.y());
- qreal heightDiff = rect.height() - boundingRect.height();
- qreal widthDiff = rect.width() - boundingRect.width();
-
- //ticks and label position
- if (axis()->alignment() == Qt::AlignTop) {
- labelItem->setPos(layout[i] - center.x(), axisRect.bottom() - rect.height() + (heightDiff / 2.0) - labelPadding());
- tickItem->setLine(layout[i], axisRect.bottom(), layout[i], axisRect.bottom() - labelPadding());
- } else if (axis()->alignment() == Qt::AlignBottom) {
- labelItem->setPos(layout[i] - center.x(), axisRect.top() - (heightDiff / 2.0) + labelPadding());
- tickItem->setLine(layout[i], axisRect.top(), layout[i], axisRect.top() + labelPadding());
- }
-
- //label in between
- bool forceHide = false;
- if (intervalAxis() && (i + 1) != layout.size()) {
- qreal leftBound = qMax(layout[i], gridRect.left());
- qreal rightBound = qMin(layout[i + 1], gridRect.right());
- const qreal delta = rightBound - leftBound;
- // Hide label in case visible part of the category at the grid edge is too narrow
- if (delta < boundingRect.width()
- && (leftBound == gridRect.left() || rightBound == gridRect.right())
- && !intervalAxis()) {
- forceHide = true;
- } else {
- labelItem->setPos(leftBound + (delta / 2.0) - center.x(), labelItem->pos().y());
- }
- }
-
- //label overlap detection - compensate one pixel for rounding errors
- if ((labelItem->pos().x() < width && labelItem->toPlainText() == ellipsis) || forceHide ||
- (labelItem->pos().x() + (widthDiff / 2.0)) < (axisRect.left() - 1.0) ||
- (labelItem->pos().x() + (widthDiff / 2.0) - 1.0) > axisRect.right()) {
- labelItem->setVisible(false);
- } else {
- labelItem->setVisible(true);
- width = boundingRect.width() + labelItem->pos().x();
- }
-
- //shades
- if ((i + 1) % 2 && i > 1) {
- QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem *>(shades.at(i / 2 - 1));
- qreal leftBound = qMax(layout[i - 1], gridRect.left());
- qreal rightBound = qMin(layout[i], gridRect.right());
- rectItem->setRect(leftBound, gridRect.top(), rightBound - leftBound, gridRect.height());
- if (rectItem->rect().width() <= 0.0)
- rectItem->setVisible(false);
- else
- rectItem->setVisible(true);
- }
-
- // check if the grid line and the axis tick should be shown
- qreal x = gridItem->line().p1().x();
- if (x < gridRect.left() || x > gridRect.right()) {
- gridItem->setVisible(false);
- tickItem->setVisible(false);
- } else {
- gridItem->setVisible(true);
- tickItem->setVisible(true);
- }
-
- }
-
- //begin/end grid line in case labels between
- if (intervalAxis()) {
- QGraphicsLineItem *gridLine;
- gridLine = static_cast<QGraphicsLineItem *>(lines.at(layout.size()));
- gridLine->setLine(gridRect.right(), gridRect.top(), gridRect.right(), gridRect.bottom());
- gridLine->setVisible(true);
- gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size()+1));
- gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.left(), gridRect.bottom());
- gridLine->setVisible(true);
- }
-}
-
-QSizeF HorizontalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint);
- QSizeF sh(0,0);
-
- if (axis()->titleText().isEmpty() || !titleItem()->isVisible())
- return sh;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), "...");
- sh = QSizeF(titleRect.width(), titleRect.height() + (titlePadding() * 2.0));
- break;
- }
- case Qt::MaximumSize:
- case Qt::PreferredSize: {
- QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
- sh = QSizeF(titleRect.width(), titleRect.height() + (titlePadding() * 2.0));
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/horizontalaxis_p.h b/src/axis/horizontalaxis_p.h
deleted file mode 100644
index a91d869e..00000000
--- a/src/axis/horizontalaxis_p.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef HORIZONTALAXIS_P_H_
-#define HORIZONTALAXIS_P_H_
-
-#include "cartesianchartaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class HorizontalAxis : public CartesianChartAxis
-{
-public:
- HorizontalAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
- ~HorizontalAxis();
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
-protected:
- void updateGeometry();
-
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/axis/linearrowitem_p.h b/src/axis/linearrowitem_p.h
deleted file mode 100644
index ca9c101a..00000000
--- a/src/axis/linearrowitem_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef LINEARROWITEM_P_H
-#define LINEARROWITEM_P_H
-
-#include "chartaxiselement_p.h"
-#include "qabstractaxis_p.h"
-#include <QGraphicsLineItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class LineArrowItem: public QGraphicsLineItem
-{
-public:
- explicit LineArrowItem(ChartAxisElement *axis, QGraphicsItem *parent = 0)
- : QGraphicsLineItem(parent),
- m_axis(axis),
- m_axisOrientation(axis->axis()->orientation())
- {
- }
-
-protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *event)
- {
- Q_UNUSED(event)
- m_axis->axisSelected();
- }
-
- QRectF boundingRect() const
- {
- return shape().boundingRect();
- }
-
- QPainterPath shape() const
- {
- QPainterPath path = QGraphicsLineItem::shape();
- QRectF rect = path.boundingRect();
- path.addRect(rect.adjusted(0, 0, m_axisOrientation != Qt::Horizontal ? 8 : 0, m_axisOrientation != Qt::Vertical ? 8 : 0));
- return path;
- }
-
-private:
- ChartAxisElement *m_axis;
- Qt::Orientation m_axisOrientation;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* LINEARROWITEM_P_H */
diff --git a/src/axis/logvalueaxis/chartlogvalueaxisx.cpp b/src/axis/logvalueaxis/chartlogvalueaxisx.cpp
deleted file mode 100644
index 8b365e19..00000000
--- a/src/axis/logvalueaxis/chartlogvalueaxisx.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartlogvalueaxisx_p.h"
-#include "chartpresenter_p.h"
-#include "qlogvalueaxis.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartLogValueAxisX::ChartLogValueAxisX(QLogValueAxis *axis, QGraphicsItem *item)
- : HorizontalAxis(axis, item),
- m_axis(axis)
-{
- QObject::connect(m_axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
- QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-ChartLogValueAxisX::~ChartLogValueAxisX()
-{
-}
-
-QVector<qreal> ChartLogValueAxisX::calculateLayout() const
-{
- QVector<qreal> points;
-
- qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
- qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
- qreal leftEdge = logMin < logMax ? logMin : logMax;
- qreal ceilEdge = ceil(leftEdge);
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
-
- points.resize(tickCount);
- const QRectF &gridRect = gridGeometry();
- const qreal deltaX = gridRect.width() / qAbs(logMax - logMin);
- for (int i = 0; i < tickCount; ++i)
- points[i] = (ceilEdge + qreal(i)) * deltaX - leftEdge * deltaX + gridRect.left();
-
- return points;
-}
-
-void ChartLogValueAxisX::updateGeometry()
-{
- const QVector<qreal>& layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), layout.size(), m_axis->labelFormat()));
- HorizontalAxis::updateGeometry();
-}
-
-void ChartLogValueAxisX::handleBaseChanged(qreal base)
-{
- Q_UNUSED(base);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-void ChartLogValueAxisX::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-QSizeF ChartLogValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
-
- QSizeF base = HorizontalAxis::sizeHint(which, constraint);
- QStringList ticksList;
- qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
- qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
- if (m_axis->max() > m_axis->min() && tickCount > 0)
- ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
- else
- ticksList.append(QString(" "));
- // Width of horizontal axis sizeHint indicates the maximum distance labels can extend past
- // first and last ticks. Base width is irrelevant.
- qreal width = 0;
- qreal height = 0;
-
- switch (which) {
- case Qt::MinimumSize:{
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() / 2.0;
- height = boundingRect.height() + labelPadding() + base.height() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelHeight = 0.0;
- qreal firstWidth = -1.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelHeight = qMax(rect.height(), labelHeight);
- width = rect.width();
- if (firstWidth < 0.0)
- firstWidth = width;
- }
- height = labelHeight + labelPadding() + base.height() + 1.0;
- width = qMax(width, firstWidth) / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-#include "moc_chartlogvalueaxisx_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/chartlogvalueaxisx_p.h b/src/axis/logvalueaxis/chartlogvalueaxisx_p.h
deleted file mode 100644
index 318d8780..00000000
--- a/src/axis/logvalueaxis/chartlogvalueaxisx_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTLOGVALUEAXISX_H
-#define CHARTLOGVALUEAXISX_H
-
-#include "horizontalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxis;
-
-class ChartLogValueAxisX : public HorizontalAxis
-{
- Q_OBJECT
-
-public:
- ChartLogValueAxisX(QLogValueAxis *axis, QGraphicsItem *item);
- ~ChartLogValueAxisX();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-
-private Q_SLOTS:
- void handleBaseChanged(qreal base);
- void handleLabelFormatChanged(const QString &format);
-
-private:
- QLogValueAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTLOGVALUEAXISX_H */
diff --git a/src/axis/logvalueaxis/chartlogvalueaxisy.cpp b/src/axis/logvalueaxis/chartlogvalueaxisy.cpp
deleted file mode 100644
index 556ddfe4..00000000
--- a/src/axis/logvalueaxis/chartlogvalueaxisy.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartlogvalueaxisy_p.h"
-#include "chartpresenter_p.h"
-#include "qlogvalueaxis.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartLogValueAxisY::ChartLogValueAxisY(QLogValueAxis *axis, QGraphicsItem *item)
- : VerticalAxis(axis, item),
- m_axis(axis)
-{
- QObject::connect(m_axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
- QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-ChartLogValueAxisY::~ChartLogValueAxisY()
-{
-}
-
-QVector<qreal> ChartLogValueAxisY::calculateLayout() const
-{
- QVector<qreal> points;
- qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
- qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
- qreal leftEdge = logMin < logMax ? logMin : logMax;
- qreal ceilEdge = ceil(leftEdge);
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
-
- points.resize(tickCount);
- const QRectF &gridRect = gridGeometry();
- const qreal deltaY = gridRect.height() / qAbs(logMax - logMin);
- for (int i = 0; i < tickCount; ++i)
- points[i] = (ceilEdge + qreal(i)) * -deltaY - leftEdge * -deltaY + gridRect.bottom();
-
- return points;
-}
-
-
-void ChartLogValueAxisY::updateGeometry()
-{
- const QVector<qreal> &layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), layout.size(), m_axis->labelFormat()));
- VerticalAxis::updateGeometry();
-}
-
-void ChartLogValueAxisY::handleBaseChanged(qreal base)
-{
- Q_UNUSED(base);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-void ChartLogValueAxisY::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-QSizeF ChartLogValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
-
- QSizeF base = VerticalAxis::sizeHint(which, constraint);
- QStringList ticksList;
- qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
- qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
- if (m_axis->max() > m_axis->min() && tickCount > 0)
- ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
- else
- ticksList.append(QString(" "));
- qreal width = 0;
- // Height of vertical axis sizeHint indicates the maximum distance labels can extend past
- // first and last ticks. Base height is irrelevant.
- qreal height = 0;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() + labelPadding() + base.width() + 1.0;
- height = boundingRect.height() / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelWidth = 0.0;
- qreal firstHeight = -1.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelWidth = qMax(rect.width(), labelWidth);
- height = rect.height();
- if (firstHeight < 0.0)
- firstHeight = height;
- }
- width = labelWidth + labelPadding() + base.width() + 2.0; //two pixels of tolerance
- height = qMax(height, firstHeight) / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-#include "moc_chartlogvalueaxisy_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/chartlogvalueaxisy_p.h b/src/axis/logvalueaxis/chartlogvalueaxisy_p.h
deleted file mode 100644
index 8c42024c..00000000
--- a/src/axis/logvalueaxis/chartlogvalueaxisy_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTLOGVALUEAXISY_H
-#define CHARTLOGVALUEAXISY_H
-
-#include "verticalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxis;
-
-class ChartLogValueAxisY : public VerticalAxis
-{
- Q_OBJECT
-
-public:
- ChartLogValueAxisY(QLogValueAxis *axis, QGraphicsItem *item);
- ~ChartLogValueAxisY();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-
-private Q_SLOTS:
- void handleBaseChanged(qreal base);
- void handleLabelFormatChanged(const QString &format);
-
-private:
- QLogValueAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTLOGVALUEAXISY_H */
diff --git a/src/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp b/src/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp
deleted file mode 100644
index 97bdf532..00000000
--- a/src/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartlogvalueaxisangular_p.h"
-#include "abstractchartlayout_p.h"
-#include "chartpresenter_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartLogValueAxisAngular::PolarChartLogValueAxisAngular(QLogValueAxis *axis, QGraphicsItem *item)
- : PolarChartAxisAngular(axis, item)
-{
- QObject::connect(axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
- QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-PolarChartLogValueAxisAngular::~PolarChartLogValueAxisAngular()
-{
-}
-
-QVector<qreal> PolarChartLogValueAxisAngular::calculateLayout() const
-{
- QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
- const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base());
- const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base());
- const qreal startEdge = logMin < logMax ? logMin : logMax;
- const qreal delta = 360.0 / qAbs(logMax - logMin);
- const qreal initialSpan = (ceil(startEdge) - startEdge) * delta;
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- for (int i = 0; i < tickCount; ++i) {
- qreal angularCoordinate = initialSpan + (delta * qreal(i));
- points[i] = angularCoordinate;
- }
-
- return points;
-}
-
-void PolarChartLogValueAxisAngular::createAxisLabels(const QVector<qreal> &layout)
-{
- QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
- setLabels(createLogValueLabels(logValueAxis->min(),
- logValueAxis->max(),
- logValueAxis->base(),
- layout.size(),
- logValueAxis->labelFormat()));
-}
-
-void PolarChartLogValueAxisAngular::handleBaseChanged(qreal base)
-{
- Q_UNUSED(base);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void PolarChartLogValueAxisAngular::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-#include "moc_polarchartlogvalueaxisangular_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h b/src/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h
deleted file mode 100644
index 5ba36aef..00000000
--- a/src/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTLOGVALUEAXISANGULAR_P_H
-#define POLARCHARTLOGVALUEAXISANGULAR_P_H
-
-#include "polarchartaxisangular_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxis;
-
-class PolarChartLogValueAxisAngular : public PolarChartAxisAngular
-{
- Q_OBJECT
-public:
- PolarChartLogValueAxisAngular(QLogValueAxis *axis, QGraphicsItem *item);
- ~PolarChartLogValueAxisAngular();
-
-protected:
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-private Q_SLOTS:
- void handleBaseChanged(qreal base);
- void handleLabelFormatChanged(const QString &format);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTLOGVALUEAXISANGULAR_P_H
diff --git a/src/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp b/src/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp
deleted file mode 100644
index 72b9bd33..00000000
--- a/src/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartlogvalueaxisradial_p.h"
-#include "abstractchartlayout_p.h"
-#include "chartpresenter_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartLogValueAxisRadial::PolarChartLogValueAxisRadial(QLogValueAxis *axis, QGraphicsItem *item)
- : PolarChartAxisRadial(axis, item)
-{
- QObject::connect(axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
- QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-PolarChartLogValueAxisRadial::~PolarChartLogValueAxisRadial()
-{
-}
-
-QVector<qreal> PolarChartLogValueAxisRadial::calculateLayout() const
-{
- QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
- const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base());
- const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base());
- const qreal innerEdge = logMin < logMax ? logMin : logMax;
- const qreal outerEdge = logMin > logMax ? logMin : logMax;
- const qreal delta = (axisGeometry().width() / 2.0) / qAbs(logMax - logMin);
- const qreal initialSpan = (ceil(innerEdge) - innerEdge) * delta;
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
-
- // Extra tick if outer edge is exactly at the tick
- if (outerEdge == ceil(outerEdge))
- tickCount++;
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- for (int i = 0; i < tickCount; ++i) {
- qreal radialCoordinate = initialSpan + (delta * qreal(i));
- points[i] = radialCoordinate;
- }
-
- return points;
-}
-
-void PolarChartLogValueAxisRadial::createAxisLabels(const QVector<qreal> &layout)
-{
- QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
- setLabels(createLogValueLabels(logValueAxis->min(),
- logValueAxis->max(),
- logValueAxis->base(),
- layout.size(),
- logValueAxis->labelFormat()));
-}
-
-void PolarChartLogValueAxisRadial::handleBaseChanged(qreal base)
-{
- Q_UNUSED(base);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void PolarChartLogValueAxisRadial::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-#include "moc_polarchartlogvalueaxisradial_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h b/src/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h
deleted file mode 100644
index fcba0aa2..00000000
--- a/src/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTLOGVALUEAXISRADIAL_P_H
-#define POLARCHARTLOGVALUEAXISRADIAL_P_H
-
-#include "polarchartaxisradial_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxis;
-
-class PolarChartLogValueAxisRadial : public PolarChartAxisRadial
-{
- Q_OBJECT
-public:
- PolarChartLogValueAxisRadial(QLogValueAxis *axis, QGraphicsItem *item);
- ~PolarChartLogValueAxisRadial();
-
-protected:
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-private Q_SLOTS:
- void handleBaseChanged(qreal base);
- void handleLabelFormatChanged(const QString &format);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTLOGVALUEAXISRADIAL_P_H
diff --git a/src/axis/logvalueaxis/qlogvalueaxis.cpp b/src/axis/logvalueaxis/qlogvalueaxis.cpp
deleted file mode 100644
index 3a76b896..00000000
--- a/src/axis/logvalueaxis/qlogvalueaxis.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlogvalueaxis.h"
-#include "qlogvalueaxis_p.h"
-#include "chartlogvalueaxisx_p.h"
-#include "chartlogvalueaxisy_p.h"
-#include "polarchartlogvalueaxisangular_p.h"
-#include "polarchartlogvalueaxisradial_p.h"
-#include "abstractdomain_p.h"
-#include <float.h>
-#include <cmath>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-/*!
- \class QLogValueAxis
- \inmodule Qt Charts
- \brief The QLogValueAxis class is used for manipulating chart's axis.
- \mainclass
-
- \note If a QLogValueAxis is attached to a series with one or more points with
- negative or zero values on the associated dimension, the series will not be
- plotted at all. This is particularly relevant when XYModelMappers are used,
- since empty cells in models typically contain zero values.
-*/
-
-#ifdef QDOC_QT5
-/*!
- \qmltype LogValueAxis
- \instantiates QLogValueAxis
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/logvalueaxis.qdocinc
-*/
-#else
-/*!
- \qmlclass LogValueAxis QLogValueAxis
-
- \include ../doc/src/logvalueaxis.qdocinc
-*/
-#endif
-
-/*!
- \property QLogValueAxis::min
- Defines the minimum value on the axis.
- When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
- Value has to be greater than 0.
-*/
-/*!
- \qmlproperty real LogValueAxis::min
- Defines the minimum value on the axis.
- When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
- Value has to be greater than 0.
-*/
-
-/*!
- \property QLogValueAxis::max
- Defines the maximum value on the axis.
- When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
- Value has to be greater than 0.
-*/
-/*!
- \qmlproperty real LogValueAxis::max
- Defines the maximum value on the axis.
- When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
- Value has to be greater than 0.
-*/
-
-/*!
- \property QLogValueAxis::base
- Defines the base of the logarithm.
- Value has to be greater than 0 and not equal 1
-*/
-/*!
- \qmlproperty real LogValueAxis::base
- Defines the maximum value on the axis.
- Defines the base of the logarithm.
- Value has to be greater than 0 and not equal 1
-*/
-
-/*!
- \property QLogValueAxis::labelFormat
- Defines the label format of the axis.
- Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
- See QString::sprintf() for additional details.
-*/
-/*!
- \qmlproperty real LogValueAxis::labelFormat
- Defines the label format of the axis.
- Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
- See QString::sprintf() for additional details.
-*/
-
-/*!
- \fn void QLogValueAxis::minChanged(qreal min)
- Axis emits signal when \a min of axis has changed.
-*/
-/*!
- \qmlsignal LogValueAxis::onMinChanged(qreal min)
- Axis emits signal when \a min of axis has changed.
-*/
-
-/*!
- \fn void QLogValueAxis::maxChanged(qreal max)
- Axis emits signal when \a max of axis has changed.
-*/
-/*!
- \qmlsignal LogValueAxis::onMaxChanged(qreal max)
- Axis emits signal when \a max of axis has changed.
-*/
-
-/*!
- \fn void QLogValueAxis::rangeChanged(qreal min, qreal max)
- Axis emits signal when \a min or \a max of axis has changed.
-*/
-
-/*!
- \fn void QLogValueAxis::labelFormatChanged(const QString &format)
- Axis emits signal when \a format of axis labels has changed.
-*/
-/*!
- \qmlsignal LogValueAxis::labelFormatChanged(const QString &format)
- Axis emits signal when \a format of axis labels has changed.
-*/
-
-/*!
- \fn void QLogValueAxis::baseChanged(qreal base)
- Axis emits signal when \a base of logarithm of the axis has changed.
-*/
-/*!
- \qmlsignal LogValueAxis::baseChanged(qreal base)
- Axis emits signal when \a base of logarithm of the axis has changed.
-*/
-
-/*!
- Constructs an axis object which is a child of \a parent.
-*/
-QLogValueAxis::QLogValueAxis(QObject *parent) :
- QAbstractAxis(*new QLogValueAxisPrivate(this), parent)
-{
-
-}
-
-/*!
- \internal
-*/
-QLogValueAxis::QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
-{
-
-}
-
-/*!
- Destroys the object
-*/
-QLogValueAxis::~QLogValueAxis()
-{
- Q_D(QLogValueAxis);
- if (d->m_chart)
- d->m_chart->removeAxis(this);
-}
-
-void QLogValueAxis::setMin(qreal min)
-{
- Q_D(QLogValueAxis);
- setRange(min, qMax(d->m_max, min));
-}
-
-qreal QLogValueAxis::min() const
-{
- Q_D(const QLogValueAxis);
- return d->m_min;
-}
-
-void QLogValueAxis::setMax(qreal max)
-{
- Q_D(QLogValueAxis);
- setRange(qMin(d->m_min, max), max);
-}
-
-qreal QLogValueAxis::max() const
-{
- Q_D(const QLogValueAxis);
- return d->m_max;
-}
-
-/*!
- Sets range from \a min to \a max on the axis.
- If min is greater than max then this function returns without making any changes.
-*/
-void QLogValueAxis::setRange(qreal min, qreal max)
-{
- Q_D(QLogValueAxis);
- bool changed = false;
-
- if (min > max)
- return;
-
- if (min > 0) {
- if (!qFuzzyCompare(d->m_min, min)) {
- d->m_min = min;
- changed = true;
- emit minChanged(min);
- }
-
- if (!qFuzzyCompare(d->m_max, max)) {
- d->m_max = max;
- changed = true;
- emit maxChanged(max);
- }
-
- if (changed) {
- emit rangeChanged(min, max);
- emit d->rangeChanged(min,max);
- }
- }
-}
-
-void QLogValueAxis::setLabelFormat(const QString &format)
-{
- Q_D(QLogValueAxis);
- d->m_format = format;
- emit labelFormatChanged(format);
-}
-
-QString QLogValueAxis::labelFormat() const
-{
- Q_D(const QLogValueAxis);
- return d->m_format;
-}
-
-void QLogValueAxis::setBase(qreal base)
-{
- // check if base is correct
- if (qFuzzyCompare(base, 1))
- return;
-
- if (base > 0) {
- Q_D(QLogValueAxis);
- d->m_base = base;
- emit baseChanged(base);
- }
-}
-
-qreal QLogValueAxis::base() const
-{
- Q_D(const QLogValueAxis);
- return d->m_base;
-}
-
-/*!
- Returns the type of the axis
-*/
-QAbstractAxis::AxisType QLogValueAxis::type() const
-{
- return AxisTypeLogValue;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QLogValueAxisPrivate::QLogValueAxisPrivate(QLogValueAxis *q)
- : QAbstractAxisPrivate(q),
- m_min(1),
- m_max(1),
- m_base(10),
- m_format(QString::null)
-{
-}
-
-QLogValueAxisPrivate::~QLogValueAxisPrivate()
-{
-
-}
-
-void QLogValueAxisPrivate::setMin(const QVariant &min)
-{
- Q_Q(QLogValueAxis);
- bool ok;
- qreal value = min.toReal(&ok);
- if (ok)
- q->setMin(value);
-}
-
-void QLogValueAxisPrivate::setMax(const QVariant &max)
-{
-
- Q_Q(QLogValueAxis);
- bool ok;
- qreal value = max.toReal(&ok);
- if (ok)
- q->setMax(value);
-}
-
-void QLogValueAxisPrivate::setRange(const QVariant &min, const QVariant &max)
-{
- Q_Q(QLogValueAxis);
- bool ok1;
- bool ok2;
- qreal value1 = min.toReal(&ok1);
- qreal value2 = max.toReal(&ok2);
- if (ok1 && ok2)
- q->setRange(value1, value2);
-}
-
-void QLogValueAxisPrivate::setRange(qreal min, qreal max)
-{
- Q_Q(QLogValueAxis);
- bool changed = false;
-
- if (min > max)
- return;
-
- if (min > 0) {
- if (!qFuzzyCompare(m_min, min)) {
- m_min = min;
- changed = true;
- emit q->minChanged(min);
- }
-
- if (!qFuzzyCompare(m_max, max)) {
- m_max = max;
- changed = true;
- emit q->maxChanged(max);
- }
-
- if (changed) {
- emit rangeChanged(min,max);
- emit q->rangeChanged(min, max);
- }
- }
-}
-
-void QLogValueAxisPrivate::initializeGraphics(QGraphicsItem *parent)
-{
- Q_Q(QLogValueAxis);
- ChartAxisElement *axis(0);
-
- if (m_chart->chartType() == QChart::ChartTypeCartesian) {
- if (orientation() == Qt::Vertical)
- axis = new ChartLogValueAxisY(q,parent);
- if (orientation() == Qt::Horizontal)
- axis = new ChartLogValueAxisX(q,parent);
- }
-
- if (m_chart->chartType() == QChart::ChartTypePolar) {
- if (orientation() == Qt::Vertical)
- axis = new PolarChartLogValueAxisRadial(q, parent);
- if (orientation() == Qt::Horizontal)
- axis = new PolarChartLogValueAxisAngular(q, parent);
- }
-
- m_item.reset(axis);
- QAbstractAxisPrivate::initializeGraphics(parent);
-}
-
-
-void QLogValueAxisPrivate::initializeDomain(AbstractDomain *domain)
-{
- if (orientation() == Qt::Vertical) {
- if (!qFuzzyCompare(m_max, m_min)) {
- domain->setRangeY(m_min, m_max);
- } else if ( domain->minY() > 0) {
- setRange(domain->minY(), domain->maxY());
- } else if (domain->maxY() > 0) {
- domain->setRangeY(m_min, domain->maxY());
- } else {
- domain->setRangeY(1, 10);
- }
- }
- if (orientation() == Qt::Horizontal) {
- if (!qFuzzyCompare(m_max, m_min)) {
- domain->setRangeX(m_min, m_max);
- } else if (domain->minX() > 0){
- setRange(domain->minX(), domain->maxX());
- } else if (domain->maxX() > 0) {
- domain->setRangeX(m_min, domain->maxX());
- } else {
- domain->setRangeX(1, 10);
- }
- }
-}
-
-#include "moc_qlogvalueaxis.cpp"
-#include "moc_qlogvalueaxis_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/qlogvalueaxis.h b/src/axis/logvalueaxis/qlogvalueaxis.h
deleted file mode 100644
index 51de0ba7..00000000
--- a/src/axis/logvalueaxis/qlogvalueaxis.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOGVALUEAXIS_H
-#define QLOGVALUEAXIS_H
-
-#include "qabstractaxis.h"
-
-class QDateTime;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxisPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QLogValueAxis : public QAbstractAxis
-{
- Q_OBJECT
- Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
- Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
- Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
- Q_PROPERTY(qreal base READ base WRITE setBase NOTIFY baseChanged)
-
-public:
- explicit QLogValueAxis(QObject *parent = 0);
- ~QLogValueAxis();
-
-protected:
- QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent = 0);
-
-public:
- AxisType type() const;
-
- //range handling
- void setMin(qreal min);
- qreal min() const;
- void setMax(qreal max);
- qreal max() const;
- void setRange(qreal min, qreal max);
-
- void setLabelFormat(const QString &format);
- QString labelFormat() const;
-
- void setBase(qreal base);
- qreal base() const;
-
-Q_SIGNALS:
- void minChanged(qreal min);
- void maxChanged(qreal max);
- void rangeChanged(qreal min, qreal max);
- void labelFormatChanged(const QString &format);
- void baseChanged(qreal base);
-
-private:
- Q_DECLARE_PRIVATE(QLogValueAxis)
- Q_DISABLE_COPY(QLogValueAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QLOGVALUEAXIS_H
diff --git a/src/axis/logvalueaxis/qlogvalueaxis_p.h b/src/axis/logvalueaxis/qlogvalueaxis_p.h
deleted file mode 100644
index a82af5b2..00000000
--- a/src/axis/logvalueaxis/qlogvalueaxis_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QLOGVALUEAXIS_P_H
-#define QLOGVALUEAXIS_P_H
-
-#include "qlogvalueaxis.h"
-#include "qabstractaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxisPrivate : public QAbstractAxisPrivate
-{
- Q_OBJECT
- public:
- QLogValueAxisPrivate(QLogValueAxis *q);
- ~QLogValueAxisPrivate();
-
- public:
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain(AbstractDomain *domain);
-
- qreal min() { return m_min; }
- qreal max() { return m_max; }
- void setRange(qreal min,qreal max);
-
- protected:
- void setMin(const QVariant &min);
- void setMax(const QVariant &max);
- void setRange(const QVariant &min, const QVariant &max);
- int tickCount() const;
-
- protected:
- qreal m_min;
- qreal m_max;
- qreal m_base;
- QString m_format;
- Q_DECLARE_PUBLIC(QLogValueAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QLOGVALUEAXIS_P_H
diff --git a/src/axis/polarchartaxis.cpp b/src/axis/polarchartaxis.cpp
deleted file mode 100644
index dee88bc1..00000000
--- a/src/axis/polarchartaxis.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartaxis_p.h"
-#include "qabstractaxis_p.h"
-#include "chartpresenter_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartAxis::PolarChartAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
- : ChartAxisElement(axis, item, intervalAxis)
-{
-}
-
-PolarChartAxis::~PolarChartAxis()
-{
-
-}
-
-void PolarChartAxis::setGeometry(const QRectF &axis, const QRectF &grid)
-{
- Q_UNUSED(grid);
- setAxisGeometry(axis);
-
- if (isEmpty())
- return;
-
- QVector<qreal> layout = calculateLayout();
- updateLayout(layout);
-}
-
-QRectF PolarChartAxis::gridGeometry() const
-{
- return QRectF();
-}
-
-void PolarChartAxis::updateLayout(QVector<qreal> &layout)
-{
- int diff = ChartAxisElement::layout().size() - layout.size();
-
- if (animation()) {
- switch (presenter()->state()) {
- case ChartPresenter::ZoomInState:
- case ChartPresenter::ZoomOutState:
- case ChartPresenter::ScrollUpState:
- case ChartPresenter::ScrollLeftState:
- case ChartPresenter::ScrollDownState:
- case ChartPresenter::ScrollRightState:
- case ChartPresenter::ShowState:
- animation()->setAnimationType(AxisAnimation::DefaultAnimation);
- break;
- }
- // Update to "old" geometry before starting animation to avoid incorrectly sized
- // axes lingering in wrong position compared to series plot before animation can kick in.
- // Note that the position mismatch still exists even with this update, but it will be
- // far less ugly.
- updateGeometry();
- }
-
- if (diff > 0)
- deleteItems(diff);
- else if (diff < 0)
- createItems(-diff);
-
- if (animation()) {
- animation()->setValues(ChartAxisElement::layout(), layout);
- presenter()->startAnimation(animation());
- } else {
- setLayout(layout);
- updateGeometry();
- }
-}
-
-bool PolarChartAxis::isEmpty()
-{
- return !axisGeometry().isValid() || qFuzzyIsNull(min() - max());
-}
-
-void PolarChartAxis::deleteItems(int count)
-{
- QList<QGraphicsItem *> gridLines = gridItems();
- QList<QGraphicsItem *> labels = labelItems();
- QList<QGraphicsItem *> shades = shadeItems();
- QList<QGraphicsItem *> axis = arrowItems();
-
- for (int i = 0; i < count; ++i) {
- if (gridItems().size() == 1 || (((gridLines.size() + 1) % 2) && gridLines.size() > 0))
- delete(shades.takeLast());
- delete(gridLines.takeLast());
- delete(labels.takeLast());
- delete(axis.takeLast());
- }
-}
-
-void PolarChartAxis::handleShadesBrushChanged(const QBrush &brush)
-{
- foreach (QGraphicsItem *item, shadeItems())
- static_cast<QGraphicsPathItem *>(item)->setBrush(brush);
-}
-
-void PolarChartAxis::handleShadesPenChanged(const QPen &pen)
-{
- foreach (QGraphicsItem *item, shadeItems())
- static_cast<QGraphicsPathItem *>(item)->setPen(pen);
-}
-
-#include "moc_polarchartaxis_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/polarchartaxis_p.h b/src/axis/polarchartaxis_p.h
deleted file mode 100644
index 388109a4..00000000
--- a/src/axis/polarchartaxis_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTAXIS_P_H
-#define POLARCHARTAXIS_P_H
-
-#include "chartaxiselement_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class PolarChartAxis : public ChartAxisElement
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsLayoutItem)
-public:
- PolarChartAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
- ~PolarChartAxis();
-
- void setGeometry(const QRectF &axis, const QRectF &grid);
- virtual qreal preferredAxisRadius(const QSizeF &maxSize) = 0;
- int tickWidth() { return 3; }
-
-public: // from ChartAxisElement
- QRectF gridGeometry() const;
- bool isEmpty();
-
-protected:
- void updateLayout(QVector<qreal> &layout);
-
-protected: // virtual functions
- virtual void createItems(int count) = 0;
- virtual void createAxisLabels(const QVector<qreal> &layout) = 0;
-
-public Q_SLOTS:
- virtual void handleShadesBrushChanged(const QBrush &brush);
- virtual void handleShadesPenChanged(const QPen &pen);
-
-private:
- void deleteItems(int count);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTAXIS_P_H
diff --git a/src/axis/polarchartaxisangular.cpp b/src/axis/polarchartaxisangular.cpp
deleted file mode 100644
index 91d396ac..00000000
--- a/src/axis/polarchartaxisangular.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartaxisangular_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include "qabstractaxis.h"
-#include "qabstractaxis_p.h"
-#include <QDebug>
-#include <qmath.h>
-#include <QTextDocument>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartAxisAngular::PolarChartAxisAngular(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
- : PolarChartAxis(axis, item, intervalAxis)
-{
-}
-
-PolarChartAxisAngular::~PolarChartAxisAngular()
-{
-}
-
-void PolarChartAxisAngular::updateGeometry()
-{
- QGraphicsLayoutItem::updateGeometry();
-
- const QVector<qreal> &layout = this->layout();
- if (layout.isEmpty())
- return;
-
- createAxisLabels(layout);
- QStringList labelList = labels();
- QPointF center = axisGeometry().center();
- QList<QGraphicsItem *> arrowItemList = arrowItems();
- QList<QGraphicsItem *> gridItemList = gridItems();
- QList<QGraphicsItem *> labelItemList = labelItems();
- QList<QGraphicsItem *> shadeItemList = shadeItems();
- QGraphicsTextItem *title = titleItem();
-
- QGraphicsEllipseItem *axisLine = static_cast<QGraphicsEllipseItem *>(arrowItemList.at(0));
- axisLine->setRect(axisGeometry());
-
- qreal radius = axisGeometry().height() / 2.0;
-
- QRectF previousLabelRect;
- QRectF firstLabelRect;
-
- qreal labelHeight = 0;
-
- bool firstShade = true;
- bool nextTickVisible = false;
- if (layout.size())
- nextTickVisible = !(layout.at(0) < 0.0 || layout.at(0) > 360.0);
-
- for (int i = 0; i < layout.size(); ++i) {
- qreal angularCoordinate = layout.at(i);
-
- QGraphicsLineItem *gridLineItem = static_cast<QGraphicsLineItem *>(gridItemList.at(i));
- QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrowItemList.at(i + 1));
- QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labelItemList.at(i));
- QGraphicsPathItem *shadeItem = 0;
- if (i == 0)
- shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
- else if (i % 2)
- shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at((i / 2) + 1));
-
- // Ignore ticks outside valid range
- bool currentTickVisible = nextTickVisible;
- if ((i == layout.size() - 1)
- || layout.at(i + 1) < 0.0
- || layout.at(i + 1) > 360.0) {
- nextTickVisible = false;
- } else {
- nextTickVisible = true;
- }
-
- qreal labelCoordinate = angularCoordinate;
- qreal labelVisible = currentTickVisible;
- if (intervalAxis()) {
- qreal farEdge;
- if (i == (layout.size() - 1))
- farEdge = 360.0;
- else
- farEdge = qMin(qreal(360.0), layout.at(i + 1));
-
- // Adjust the labelCoordinate to show it if next tick is visible
- if (nextTickVisible)
- labelCoordinate = qMax(qreal(0.0), labelCoordinate);
-
- labelCoordinate = (labelCoordinate + farEdge) / 2.0;
- // Don't display label once the category gets too small near the axis
- if (labelCoordinate < 5.0 || labelCoordinate > 355.0)
- labelVisible = false;
- else
- labelVisible = true;
- }
-
- // Need this also in label calculations, so determine it first
- QLineF tickLine(QLineF::fromPolar(radius - tickWidth(), 90.0 - angularCoordinate).p2(),
- QLineF::fromPolar(radius + tickWidth(), 90.0 - angularCoordinate).p2());
- tickLine.translate(center);
-
- // Angular axis label
- if (axis()->labelsVisible() && labelVisible) {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
- labelList.at(i),
- axis()->labelsAngle());
- labelItem->setTextWidth(boundingRect.width());
- labelItem->setHtml(labelList.at(i));
- const QRectF &rect = labelItem->boundingRect();
- QPointF labelCenter = rect.center();
- labelItem->setTransformOriginPoint(labelCenter.x(), labelCenter.y());
- boundingRect.moveCenter(labelCenter);
- QPointF positionDiff(rect.topLeft() - boundingRect.topLeft());
-
- QPointF labelPoint;
- if (intervalAxis()) {
- QLineF labelLine = QLineF::fromPolar(radius + tickWidth(), 90.0 - labelCoordinate);
- labelLine.translate(center);
- labelPoint = labelLine.p2();
- } else {
- labelPoint = tickLine.p2();
- }
-
- QRectF labelRect = moveLabelToPosition(labelCoordinate, labelPoint, boundingRect);
- labelItem->setPos(labelRect.topLeft() + positionDiff);
-
- // Store height for title calculations
- qreal labelClearance = axisGeometry().top() - labelRect.top();
- labelHeight = qMax(labelHeight, labelClearance);
-
- // Label overlap detection
- if (i && (previousLabelRect.intersects(labelRect) || firstLabelRect.intersects(labelRect))) {
- labelVisible = false;
- } else {
- // Store labelRect for future comparison. Some area is deducted to make things look
- // little nicer, as usually intersection happens at label corner with angular labels.
- labelRect.adjust(-2.0, -4.0, -2.0, -4.0);
- if (firstLabelRect.isEmpty())
- firstLabelRect = labelRect;
-
- previousLabelRect = labelRect;
- labelVisible = true;
- }
- }
-
- labelItem->setVisible(labelVisible);
- if (!currentTickVisible) {
- gridLineItem->setVisible(false);
- tickItem->setVisible(false);
- if (shadeItem)
- shadeItem->setVisible(false);
- continue;
- }
-
- // Angular grid line
- QLineF gridLine = QLineF::fromPolar(radius, 90.0 - angularCoordinate);
- gridLine.translate(center);
- gridLineItem->setLine(gridLine);
- gridLineItem->setVisible(true);
-
- // Tick
- tickItem->setLine(tickLine);
- tickItem->setVisible(true);
-
- // Shades
- if (i % 2 || (i == 0 && !nextTickVisible)) {
- QPainterPath path;
- path.moveTo(center);
- if (i == 0) {
- // If first tick is also the last, we need to custom fill the first partial arc
- // or it won't get filled.
- path.arcTo(axisGeometry(), 90.0 - layout.at(0), layout.at(0));
- path.closeSubpath();
- } else {
- qreal nextCoordinate;
- if (!nextTickVisible) // Last visible tick
- nextCoordinate = 360.0;
- else
- nextCoordinate = layout.at(i + 1);
- qreal arcSpan = angularCoordinate - nextCoordinate;
- path.arcTo(axisGeometry(), 90.0 - angularCoordinate, arcSpan);
- path.closeSubpath();
-
- // Add additional arc for first shade item if there is a partial arc to be filled
- if (firstShade) {
- QGraphicsPathItem *specialShadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
- if (layout.at(i - 1) > 0.0) {
- QPainterPath specialPath;
- specialPath.moveTo(center);
- specialPath.arcTo(axisGeometry(), 90.0 - layout.at(i - 1), layout.at(i - 1));
- specialPath.closeSubpath();
- specialShadeItem->setPath(specialPath);
- specialShadeItem->setVisible(true);
- } else {
- specialShadeItem->setVisible(false);
- }
- }
- }
- shadeItem->setPath(path);
- shadeItem->setVisible(true);
- firstShade = false;
- }
- }
-
- // Title, centered above the chart
- QString titleText = axis()->titleText();
- if (!titleText.isEmpty() && axis()->isTitleVisible()) {
- QRectF truncatedRect;
- qreal availableTitleHeight = axisGeometry().height() - labelPadding() - titlePadding() * 2.0;
- qreal minimumLabelHeight = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...").height();
- availableTitleHeight -= minimumLabelHeight;
- title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
- axisGeometry().width(), availableTitleHeight,
- truncatedRect));
- title->setTextWidth(truncatedRect.width());
-
- QRectF titleBoundingRect = title->boundingRect();
- QPointF titleCenter = center - titleBoundingRect.center();
- title->setPos(titleCenter.x(), axisGeometry().top() - titlePadding() * 2.0 - titleBoundingRect.height() - labelHeight);
- }
-}
-
-Qt::Orientation PolarChartAxisAngular::orientation() const
-{
- return Qt::Horizontal;
-}
-
-void PolarChartAxisAngular::createItems(int count)
-{
- if (arrowItems().count() == 0) {
- // angular axis line
- QGraphicsEllipseItem *arrow = new QGraphicsEllipseItem(presenter()->rootItem());
- arrow->setPen(axis()->linePen());
- arrowGroup()->addToGroup(arrow);
- }
-
- QGraphicsTextItem *title = titleItem();
- title->setFont(axis()->titleFont());
- title->setDefaultTextColor(axis()->titleBrush().color());
- title->setHtml(axis()->titleText());
-
- for (int i = 0; i < count; ++i) {
- QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
- QGraphicsLineItem *grid = new QGraphicsLineItem(presenter()->rootItem());
- QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
- label->document()->setDocumentMargin(ChartPresenter::textMargin());
- arrow->setPen(axis()->linePen());
- grid->setPen(axis()->gridLinePen());
- label->setFont(axis()->labelsFont());
- label->setDefaultTextColor(axis()->labelsBrush().color());
- label->setRotation(axis()->labelsAngle());
- arrowGroup()->addToGroup(arrow);
- gridGroup()->addToGroup(grid);
- labelGroup()->addToGroup(label);
- if (gridItems().size() == 1 || (((gridItems().size() + 1) % 2) && gridItems().size() > 0)) {
- QGraphicsPathItem *shade = new QGraphicsPathItem(presenter()->rootItem());
- shade->setPen(axis()->shadesPen());
- shade->setBrush(axis()->shadesBrush());
- shadeGroup()->addToGroup(shade);
- }
- }
-}
-
-void PolarChartAxisAngular::handleArrowPenChanged(const QPen &pen)
-{
- bool first = true;
- foreach (QGraphicsItem *item, arrowItems()) {
- if (first) {
- first = false;
- // First arrow item is the outer circle of axis
- static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
- } else {
- static_cast<QGraphicsLineItem *>(item)->setPen(pen);
- }
- }
-}
-
-void PolarChartAxisAngular::handleGridPenChanged(const QPen &pen)
-{
- foreach (QGraphicsItem *item, gridItems())
- static_cast<QGraphicsLineItem *>(item)->setPen(pen);
-}
-
-QSizeF PolarChartAxisAngular::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(which);
- Q_UNUSED(constraint);
- return QSizeF(-1, -1);
-}
-
-qreal PolarChartAxisAngular::preferredAxisRadius(const QSizeF &maxSize)
-{
- qreal radius = maxSize.height() / 2.0;
- if (maxSize.width() < maxSize.height())
- radius = maxSize.width() / 2.0;
-
- if (axis()->labelsVisible()) {
- QVector<qreal> layout = calculateLayout();
- if (layout.isEmpty())
- return radius;
-
- createAxisLabels(layout);
- QStringList labelList = labels();
- QFont font = axis()->labelsFont();
-
- QRectF maxRect;
- maxRect.setSize(maxSize);
- maxRect.moveCenter(QPointF(0.0, 0.0));
-
- // This is a horrible way to find out the maximum radius for angular axis and its labels.
- // It just increments the radius down until everyhing fits the constraint size.
- // Proper way would be to actually calculate it but this seems to work reasonably fast as it is.
- bool nextTickVisible = false;
- for (int i = 0; i < layout.size(); ) {
- if ((i == layout.size() - 1)
- || layout.at(i + 1) < 0.0
- || layout.at(i + 1) > 360.0) {
- nextTickVisible = false;
- } else {
- nextTickVisible = true;
- }
-
- qreal labelCoordinate = layout.at(i);
- qreal labelVisible;
-
- if (intervalAxis()) {
- qreal farEdge;
- if (i == (layout.size() - 1))
- farEdge = 360.0;
- else
- farEdge = qMin(qreal(360.0), layout.at(i + 1));
-
- // Adjust the labelCoordinate to show it if next tick is visible
- if (nextTickVisible)
- labelCoordinate = qMax(qreal(0.0), labelCoordinate);
-
- labelCoordinate = (labelCoordinate + farEdge) / 2.0;
- }
-
- if (labelCoordinate < 0.0 || labelCoordinate > 360.0)
- labelVisible = false;
- else
- labelVisible = true;
-
- if (!labelVisible) {
- i++;
- continue;
- }
-
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), labelList.at(i), axis()->labelsAngle());
- QPointF labelPoint = QLineF::fromPolar(radius + tickWidth(), 90.0 - labelCoordinate).p2();
-
- boundingRect = moveLabelToPosition(labelCoordinate, labelPoint, boundingRect);
- QRectF intersectRect = maxRect.intersected(boundingRect);
- if (boundingRect.isEmpty() || intersectRect == boundingRect) {
- i++;
- } else {
- qreal reduction(0.0);
- // If there is no intersection, reduce by smallest dimension of label rect to be on the safe side
- if (intersectRect.isEmpty()) {
- reduction = qMin(boundingRect.height(), boundingRect.width());
- } else {
- // Approximate needed radius reduction is the amount label rect exceeds max rect in either dimension.
- // Could be further optimized by figuring out the proper math how to calculate exact needed reduction.
- reduction = qMax(boundingRect.height() - intersectRect.height(),
- boundingRect.width() - intersectRect.width());
- }
- // Typically the approximated reduction is little low, so add one
- radius -= (reduction + 1.0);
-
- if (radius < 1.0) // safeguard
- return 1.0;
- }
- }
- }
-
- if (!axis()->titleText().isEmpty() && axis()->isTitleVisible()) {
- QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
-
- radius -= titlePadding() + (titleRect.height() / 2.0);
- if (radius < 1.0) // safeguard
- return 1.0;
- }
-
- return radius;
-}
-
-QRectF PolarChartAxisAngular::moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const
-{
- if (angularCoordinate == 0.0)
- labelRect.moveCenter(labelPoint + QPointF(0, -labelRect.height() / 2.0));
- else if (angularCoordinate < 90.0)
- labelRect.moveBottomLeft(labelPoint);
- else if (angularCoordinate == 90.0)
- labelRect.moveCenter(labelPoint + QPointF(labelRect.width() / 2.0 + 2.0, 0)); // +2 so that it does not hit the radial axis
- else if (angularCoordinate < 180.0)
- labelRect.moveTopLeft(labelPoint);
- else if (angularCoordinate == 180.0)
- labelRect.moveCenter(labelPoint + QPointF(0, labelRect.height() / 2.0));
- else if (angularCoordinate < 270.0)
- labelRect.moveTopRight(labelPoint);
- else if (angularCoordinate == 270.0)
- labelRect.moveCenter(labelPoint + QPointF(-labelRect.width() / 2.0 - 2.0, 0)); // -2 so that it does not hit the radial axis
- else if (angularCoordinate < 360.0)
- labelRect.moveBottomRight(labelPoint);
- else
- labelRect.moveCenter(labelPoint + QPointF(0, -labelRect.height() / 2.0));
- return labelRect;
-}
-
-#include "moc_polarchartaxisangular_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/polarchartaxisangular_p.h b/src/axis/polarchartaxisangular_p.h
deleted file mode 100644
index 3a005749..00000000
--- a/src/axis/polarchartaxisangular_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTAXISANGULAR_P_H
-#define POLARCHARTAXISANGULAR_P_H
-
-#include "polarchartaxis_p.h"
-#include "qvalueaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class PolarChartAxisAngular : public PolarChartAxis
-{
- Q_OBJECT
-public:
- PolarChartAxisAngular(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
- ~PolarChartAxisAngular();
-
- Qt::Orientation orientation() const;
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
-
- virtual void updateGeometry();
- virtual void createItems(int count);
-
- qreal preferredAxisRadius(const QSizeF &maxSize);
-
-public Q_SLOTS:
- virtual void handleArrowPenChanged(const QPen &pen);
- virtual void handleGridPenChanged(const QPen &pen);
-
-private:
- QRectF moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTAXISANGULAR_P_H
diff --git a/src/axis/polarchartaxisradial.cpp b/src/axis/polarchartaxisradial.cpp
deleted file mode 100644
index 01000bac..00000000
--- a/src/axis/polarchartaxisradial.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartaxisradial_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include "qabstractaxis_p.h"
-#include "linearrowitem_p.h"
-#include <QTextDocument>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartAxisRadial::PolarChartAxisRadial(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
- : PolarChartAxis(axis, item, intervalAxis)
-{
-}
-
-PolarChartAxisRadial::~PolarChartAxisRadial()
-{
-}
-
-void PolarChartAxisRadial::updateGeometry()
-{
- const QVector<qreal> &layout = this->layout();
- if (layout.isEmpty())
- return;
-
- createAxisLabels(layout);
- QStringList labelList = labels();
- QPointF center = axisGeometry().center();
- QList<QGraphicsItem *> arrowItemList = arrowItems();
- QList<QGraphicsItem *> gridItemList = gridItems();
- QList<QGraphicsItem *> labelItemList = labelItems();
- QList<QGraphicsItem *> shadeItemList = shadeItems();
- QGraphicsTextItem* title = titleItem();
- qreal radius = axisGeometry().height() / 2.0;
-
- QLineF line(center, center + QPointF(0, -radius));
- QGraphicsLineItem *axisLine = static_cast<QGraphicsLineItem *>(arrowItemList.at(0));
- axisLine->setLine(line);
-
- QRectF previousLabelRect;
- bool firstShade = true;
- bool nextTickVisible = false;
- if (layout.size())
- nextTickVisible = !(layout.at(0) < 0.0 || layout.at(0) > radius);
-
- for (int i = 0; i < layout.size(); ++i) {
- qreal radialCoordinate = layout.at(i);
-
- QGraphicsEllipseItem *gridItem = static_cast<QGraphicsEllipseItem *>(gridItemList.at(i));
- QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrowItemList.at(i + 1));
- QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labelItemList.at(i));
- QGraphicsPathItem *shadeItem = 0;
- if (i == 0)
- shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
- else if (i % 2)
- shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at((i / 2) + 1));
-
- // Ignore ticks outside valid range
- bool currentTickVisible = nextTickVisible;
- if ((i == layout.size() - 1)
- || layout.at(i + 1) < 0.0
- || layout.at(i + 1) > radius) {
- nextTickVisible = false;
- } else {
- nextTickVisible = true;
- }
-
- qreal labelCoordinate = radialCoordinate;
- qreal labelVisible = currentTickVisible;
- qreal labelPad = labelPadding() / 2.0;
- if (intervalAxis()) {
- qreal farEdge;
- if (i == (layout.size() - 1))
- farEdge = radius;
- else
- farEdge = qMin(radius, layout.at(i + 1));
-
- // Adjust the labelCoordinate to show it if next tick is visible
- if (nextTickVisible)
- labelCoordinate = qMax(qreal(0.0), labelCoordinate);
-
- labelCoordinate = (labelCoordinate + farEdge) / 2.0;
- if (labelCoordinate > 0.0 && labelCoordinate < radius)
- labelVisible = true;
- else
- labelVisible = false;
- }
-
- // Radial axis label
- if (axis()->labelsVisible() && labelVisible) {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
- labelList.at(i),
- axis()->labelsAngle());
- labelItem->setTextWidth(boundingRect.width());
- labelItem->setHtml(labelList.at(i));
- QRectF labelRect = labelItem->boundingRect();
- QPointF labelCenter = labelRect.center();
- labelItem->setTransformOriginPoint(labelCenter.x(), labelCenter.y());
- boundingRect.moveCenter(labelCenter);
- QPointF positionDiff(labelRect.topLeft() - boundingRect.topLeft());
- QPointF labelPoint = center;
- if (intervalAxis())
- labelPoint += QPointF(labelPad, -labelCoordinate - (boundingRect.height() / 2.0));
- else
- labelPoint += QPointF(labelPad, labelPad - labelCoordinate);
- labelRect.moveTopLeft(labelPoint);
- labelItem->setPos(labelRect.topLeft() + positionDiff);
-
- // Label overlap detection
- labelRect.setSize(boundingRect.size());
- if ((i && previousLabelRect.intersects(labelRect))
- || !axisGeometry().contains(labelRect)) {
- labelVisible = false;
- } else {
- previousLabelRect = labelRect;
- labelVisible = true;
- }
- }
-
- labelItem->setVisible(labelVisible);
- if (!currentTickVisible) {
- gridItem->setVisible(false);
- tickItem->setVisible(false);
- if (shadeItem)
- shadeItem->setVisible(false);
- continue;
- }
-
- // Radial grid line
- QRectF gridRect;
- gridRect.setWidth(radialCoordinate * 2.0);
- gridRect.setHeight(radialCoordinate * 2.0);
- gridRect.moveCenter(center);
-
- gridItem->setRect(gridRect);
- gridItem->setVisible(true);
-
- // Tick
- QLineF tickLine(-tickWidth(), 0.0, tickWidth(), 0.0);
- tickLine.translate(center.rx(), gridRect.top());
- tickItem->setLine(tickLine);
- tickItem->setVisible(true);
-
- // Shades
- if (i % 2 || (i == 0 && !nextTickVisible)) {
- QPainterPath path;
- if (i == 0) {
- // If first tick is also the last, we need to custom fill the inner circle
- // or it won't get filled.
- QRectF innerCircle(0.0, 0.0, layout.at(0) * 2.0, layout.at(0) * 2.0);
- innerCircle.moveCenter(center);
- path.addEllipse(innerCircle);
- } else {
- QRectF otherGridRect;
- if (!nextTickVisible) { // Last visible tick
- otherGridRect = axisGeometry();
- } else {
- qreal otherGridRectDimension = layout.at(i + 1) * 2.0;
- otherGridRect.setWidth(otherGridRectDimension);
- otherGridRect.setHeight(otherGridRectDimension);
- otherGridRect.moveCenter(center);
- }
- path.addEllipse(gridRect);
- path.addEllipse(otherGridRect);
-
- // Add additional shading in first visible shade item if there is a partial tick
- // to be filled at the center (log & category axes)
- if (firstShade) {
- QGraphicsPathItem *specialShadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
- if (layout.at(i - 1) > 0.0) {
- QRectF innerCircle(0.0, 0.0, layout.at(i - 1) * 2.0, layout.at(i - 1) * 2.0);
- innerCircle.moveCenter(center);
- QPainterPath specialPath;
- specialPath.addEllipse(innerCircle);
- specialShadeItem->setPath(specialPath);
- specialShadeItem->setVisible(true);
- } else {
- specialShadeItem->setVisible(false);
- }
- }
- }
- shadeItem->setPath(path);
- shadeItem->setVisible(true);
- firstShade = false;
- }
- }
-
- // Title, along the 0 axis
- QString titleText = axis()->titleText();
- if (!titleText.isEmpty() && axis()->isTitleVisible()) {
- QRectF truncatedRect;
- title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
- radius, radius, truncatedRect));
- title->setTextWidth(truncatedRect.width());
-
- QRectF titleBoundingRect = title->boundingRect();
- QPointF titleCenter = titleBoundingRect.center();
- QPointF arrowCenter = axisLine->boundingRect().center();
- QPointF titleCenterDiff = arrowCenter - titleCenter;
- title->setPos(titleCenterDiff.x() - titlePadding() - (titleBoundingRect.height() / 2.0), titleCenterDiff.y());
- title->setTransformOriginPoint(titleCenter);
- title->setRotation(270.0);
- }
-
- QGraphicsLayoutItem::updateGeometry();
-}
-
-Qt::Orientation PolarChartAxisRadial::orientation() const
-{
- return Qt::Vertical;
-}
-
-void PolarChartAxisRadial::createItems(int count)
-{
- if (arrowItems().count() == 0) {
- // radial axis center line
- QGraphicsLineItem *arrow = new LineArrowItem(this, presenter()->rootItem());
- arrow->setPen(axis()->linePen());
- arrowGroup()->addToGroup(arrow);
- }
-
- QGraphicsTextItem *title = titleItem();
- title->setFont(axis()->titleFont());
- title->setDefaultTextColor(axis()->titleBrush().color());
- title->setHtml(axis()->titleText());
-
- for (int i = 0; i < count; ++i) {
- QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
- QGraphicsEllipseItem *grid = new QGraphicsEllipseItem(presenter()->rootItem());
- QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
- label->document()->setDocumentMargin(ChartPresenter::textMargin());
- arrow->setPen(axis()->linePen());
- grid->setPen(axis()->gridLinePen());
- label->setFont(axis()->labelsFont());
- label->setDefaultTextColor(axis()->labelsBrush().color());
- label->setRotation(axis()->labelsAngle());
- arrowGroup()->addToGroup(arrow);
- gridGroup()->addToGroup(grid);
- labelGroup()->addToGroup(label);
- if (gridItems().size() == 1 || (((gridItems().size() + 1) % 2) && gridItems().size() > 0)) {
- QGraphicsPathItem *shade = new QGraphicsPathItem(presenter()->rootItem());
- shade->setPen(axis()->shadesPen());
- shade->setBrush(axis()->shadesBrush());
- shadeGroup()->addToGroup(shade);
- }
- }
-}
-
-void PolarChartAxisRadial::handleArrowPenChanged(const QPen &pen)
-{
- foreach (QGraphicsItem *item, arrowItems())
- static_cast<QGraphicsLineItem *>(item)->setPen(pen);
-}
-
-void PolarChartAxisRadial::handleGridPenChanged(const QPen &pen)
-{
- foreach (QGraphicsItem *item, gridItems())
- static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
-}
-
-QSizeF PolarChartAxisRadial::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(which);
- Q_UNUSED(constraint);
- return QSizeF(-1.0, -1.0);
-}
-
-qreal PolarChartAxisRadial::preferredAxisRadius(const QSizeF &maxSize)
-{
- qreal radius = maxSize.height() / 2.0;
- if (maxSize.width() < maxSize.height())
- radius = maxSize.width() / 2.0;
- return radius;
-}
-
-#include "moc_polarchartaxisradial_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/polarchartaxisradial_p.h b/src/axis/polarchartaxisradial_p.h
deleted file mode 100644
index 696c53ec..00000000
--- a/src/axis/polarchartaxisradial_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTAXISRADIAL_P_H
-#define POLARCHARTAXISRADIAL_P_H
-
-#include "polarchartaxis_p.h"
-#include "qvalueaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class PolarChartAxisRadial : public PolarChartAxis
-{
- Q_OBJECT
-public:
- PolarChartAxisRadial(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
- ~PolarChartAxisRadial();
-
- Qt::Orientation orientation() const;
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
-
- virtual void updateGeometry();
- virtual void createItems(int count);
-
- qreal preferredAxisRadius(const QSizeF &maxSize);
-
-public Q_SLOTS:
- virtual void handleArrowPenChanged(const QPen &pen);
- virtual void handleGridPenChanged(const QPen &pen);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTAXISRADIAL_P_H
diff --git a/src/axis/qabstractaxis.cpp b/src/axis/qabstractaxis.cpp
deleted file mode 100644
index 4f6e86c3..00000000
--- a/src/axis/qabstractaxis.cpp
+++ /dev/null
@@ -1,1015 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractaxis.h"
-#include "qabstractaxis_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "qchart_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QAbstractAxis
- \inmodule Qt Charts
- \brief The QAbstractAxis class is used for manipulating chart's axis.
- \mainclass
-
- Each series can be bound to one or more horizontal and vertical axes, but mixing axis types
- that would result in different domains is not supported, such as specifying
- QValueAxis and QLogValueAxis on the same orientation.
-
- Properties and visibility of various axis elements such as axis line, title, labels, grid lines,
- and shades can be individually controlled.
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype AbstractAxis
- \instantiates QAbstractAxis
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/abstractaxis.qdocinc
-*/
-#else
-/*!
- \qmlclass AbstractAxis QAbstractAxis
-
- \include ../doc/src/abstractaxis.qdocinc
-*/
-#endif
-
-/*!
- \enum QAbstractAxis::AxisType
-
- The type of the series object.
-
- \value AxisTypeNoAxis
- \value AxisTypeValue
- \value AxisTypeBarCategory
- \value AxisTypeCategory
- \value AxisTypeDateTime
- \value AxisTypeLogValue
-*/
-
-/*!
- *\fn void QAbstractAxis::type() const
- Returns the type of the axis
-*/
-
-/*!
- \property QAbstractAxis::lineVisible
- The visibility of the axis line
-*/
-/*!
- \qmlproperty bool AbstractAxis::lineVisible
- The visibility of the axis line
-*/
-
-/*!
- \property QAbstractAxis::linePen
- The pen of the line.
-*/
-
-/*!
- \property QAbstractAxis::labelsVisible
- Defines if axis labels are visible.
-*/
-/*!
- \qmlproperty bool AbstractAxis::labelsVisible
- Defines if axis labels are visible.
-*/
-
-/*!
- \property QAbstractAxis::labelsPen
- \deprecated
- The pen of the labels.
-*/
-
-/*!
- \property QAbstractAxis::labelsBrush
- The brush of the labels. Only the color of the brush is relevant.
-*/
-
-/*!
- \property QAbstractAxis::visible
- The visibility of the axis.
-*/
-/*!
- \qmlproperty bool AbstractAxis::visible
- The visibility of the axis.
-*/
-
-/*!
- \property QAbstractAxis::gridVisible
- The visibility of the grid lines.
-*/
-/*!
- \qmlproperty bool AbstractAxis::gridVisible
- The visibility of the grid lines.
-*/
-
-/*!
- \property QAbstractAxis::color
- The color of the axis and ticks.
-*/
-/*!
- \qmlproperty color AbstractAxis::color
- The color of the axis and ticks.
-*/
-
-/*!
- \property QAbstractAxis::gridLinePen
- The pen of the grid line.
-*/
-
-/*!
- \property QAbstractAxis::labelsFont
- The font of the axis labels.
-*/
-
-/*!
- \qmlproperty Font AbstractAxis::labelsFont
- The font of the axis labels.
-
- See the Qt documentation for more details of Font.
-*/
-
-/*!
- \property QAbstractAxis::labelsColor
- The color of the axis labels.
-*/
-/*!
- \qmlproperty color AbstractAxis::labelsColor
- The color of the axis labels.
-*/
-
-/*!
- \property QAbstractAxis::labelsAngle
- The angle of the axis labels in degrees.
-*/
-/*!
- \qmlproperty int AbstractAxis::labelsAngle
- The angle of the axis labels in degrees.
-*/
-
-/*!
- \property QAbstractAxis::shadesVisible
- The visibility of the axis shades.
-*/
-/*!
- \qmlproperty bool AbstractAxis::shadesVisible
- The visibility of the axis shades.
-*/
-
-/*!
- \property QAbstractAxis::shadesColor
- The fill (brush) color of the axis shades.
-*/
-/*!
- \qmlproperty color AbstractAxis::shadesColor
- The fill (brush) color of the axis shades.
-*/
-
-/*!
- \property QAbstractAxis::shadesBorderColor
- The border (pen) color of the axis shades.
-*/
-/*!
- \qmlproperty color AbstractAxis::shadesBorderColor
- The border (pen) color of the axis shades.
-*/
-
-/*!
- \property QAbstractAxis::shadesPen
- The pen of the axis shades (area between grid lines).
-*/
-
-/*!
- \property QAbstractAxis::shadesBrush
- The brush of the axis shades (area between grid lines).
-*/
-
-/*!
- \property QAbstractAxis::titleVisible
- The visibility of the axis title. By default the value is true.
-*/
-/*!
- \qmlproperty bool AbstractAxis::titleVisible
- The visibility of the axis title. By default the value is true.
-*/
-
-/*!
- \property QAbstractAxis::titleText
- The title of the axis. Empty by default. Axis titles support html formatting.
-*/
-/*!
- \qmlproperty String AbstractAxis::titleText
- The title of the axis. Empty by default. Axis titles support html formatting.
-*/
-
-/*!
- \property QAbstractAxis::titlePen
- \deprecated
- The pen of the title text.
-*/
-
-/*!
- \property QAbstractAxis::titleBrush
- The brush of the title text. Only the color of the brush is relevant.
-*/
-
-/*!
- \property QAbstractAxis::titleFont
- The font of the title of the axis.
-*/
-/*!
- \qmlproperty Font AbstractAxis::titleFont
- The font of the title of the axis.
-*/
-
-/*!
- \property QAbstractAxis::orientation
- The orientation of the axis. Fixed to either Qt::Horizontal or Qt::Vertical when you add the axis to a chart.
-*/
-/*!
- \qmlproperty Qt.Orientation AbstractAxis::orientation
- The orientation of the axis. Fixed to either Qt.Horizontal or Qt.Vertical when the axis is set to a series.
-*/
-
-/*!
- \property QAbstractAxis::alignment
- The alignment of the axis. Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop.
-*/
-/*!
- \qmlproperty alignment AbstractAxis::alignment
- The alignment of the axis. Can be Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom, or Qt.AlignTop.
-*/
-
-/*!
- \fn void QAbstractAxis::visibleChanged(bool visible)
- Visibility of the axis has changed to \a visible.
-*/
-/*!
- \qmlsignal AbstractAxis::onVisibleChanged(bool visible)
- Visibility of the axis has changed to \a visible.
-*/
-
-/*!
- \fn void QAbstractAxis::linePenChanged(const QPen& pen)
- The pen of the line of the axis has changed to \a pen.
-*/
-
-/*!
- \fn void QAbstractAxis::lineVisibleChanged(bool visible)
- Visibility of the axis line has changed to \a visible.
-*/
-/*!
- \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible)
- Visibility of the axis line has changed to \a visible.
-*/
-
-/*!
- \fn void QAbstractAxis::labelsVisibleChanged(bool visible)
- Visibility of the labels of the axis has changed to \a visible.
-*/
-/*!
- \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible)
- Visibility of the labels of the axis has changed to \a visible.
-*/
-
-/*!
- \fn void QAbstractAxis::labelsFontChanged(const QFont& font)
- The font of the axis labels has changed to \a font.
-*/
-/*!
- \qmlsignal AbstractAxis::onLabelsFontChanged(Font font)
- The font of the axis labels has changed to \a font.
-*/
-
-/*!
- \fn void QAbstractAxis::labelsPenChanged(const QPen& pen)
- \deprecated
- The pen of the axis labels has changed to \a pen.
-*/
-
-/*!
- \fn void QAbstractAxis::labelsBrushChanged(const QBrush& brush)
- The brush of the axis labels has changed to \a brush.
-*/
-
-/*!
- \fn void QAbstractAxis::labelsAngleChanged(int angle)
- The angle of the axis labels has changed to \a angle.
-*/
-/*!
- \qmlsignal AbstractAxis::onLabelsAngleChanged(int angle)
- The angle of the axis labels has changed to \a angle.
-*/
-
-/*!
- \fn void QAbstractAxis::gridVisibleChanged(bool visible)
- Visibility of the grid lines of the axis has changed to \a visible.
-*/
-/*!
- \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible)
- Visibility of the grid lines of the axis has changed to \a visible.
-*/
-
-/*!
- \fn void QAbstractAxis::gridLinePenChanged(const QPen& pen)
- The pen of the grid line has changed to \a pen.
-*/
-
-/*!
- \fn void QAbstractAxis::colorChanged(QColor color)
- Emitted if the \a color of the axis is changed.
-*/
-/*!
- \qmlsignal AbstractAxis::onColorChanged(QColor color)
- Emitted if the \a color of the axis is changed.
-*/
-
-/*!
- \fn void QAbstractAxis::labelsColorChanged(QColor color)
- Emitted if the \a color of the axis labels is changed.
-*/
-/*!
- \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color)
- Emitted if the \a color of the axis labels is changed.
-*/
-
-/*!
- \fn void QAbstractAxis::titleVisibleChanged(bool visible)
- Visibility of the title text of the axis has changed to \a visible.
-*/
-/*!
- \qmlsignal AbstractAxis::onTitleVisibleChanged(bool visible)
- Visibility of the title text of the axis has changed to \a visible.
-*/
-
-/*!
- \fn void QAbstractAxis::titleTextChanged(const QString& text)
- The text of the axis title has changed to \a text.
-*/
-/*!
- \qmlsignal AbstractAxis::onTitleTextChanged(String text)
- The text of the axis title has changed to \a text.
-*/
-
-/*!
- \fn void QAbstractAxis::titlePenChanged(const QPen& pen)
- \deprecated
- The pen of the axis shades has changed to \a pen.
-*/
-
-/*!
- \fn void QAbstractAxis::titleBrushChanged(const QBrush& brush)
- The brush of the axis title has changed to \a brush.
-*/
-
-/*!
- \fn void QAbstractAxis::titleFontChanged(const QFont& font)
- The font of the axis title has changed to \a font.
-*/
-/*!
- \qmlsignal AbstractAxis::onTitleFontChanged(Font font)
- The font of the axis title has changed to \a font.
-*/
-
-/*!
- \fn void QAbstractAxis::shadesVisibleChanged(bool)
- Emitted if the visibility of the axis shades is changed to \a visible.
-*/
-/*!
- \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible)
- Emitted if the visibility of the axis shades is changed to \a visible.
-*/
-
-/*!
- \fn void QAbstractAxis::shadesColorChanged(QColor color)
- Emitted if the \a color of the axis shades is changed.
-*/
-/*!
- \qmlsignal AbstractAxis::onShadesColorChanged(QColor color)
- Emitted if the \a color of the axis shades is changed.
-*/
-
-/*!
- \fn void QAbstractAxis::shadesBorderColorChanged(QColor)
- Emitted if the border \a color of the axis shades is changed.
-*/
-/*!
- \qmlsignal AbstractAxis::onBorderColorChanged(QColor color)
- Emitted if the border \a color of the axis shades is changed.
-*/
-
-/*!
- \fn void QAbstractAxis::shadesBrushChanged(const QBrush& brush)
- The brush of the axis shades has changed to \a brush.
-*/
-
-/*!
- \fn void QAbstractAxis::shadesPenChanged(const QPen& pen)
- The pen of the axis shades has changed to \a pen.
-*/
-
-/*!
- \internal
- Constructs new axis object which is a child of \a parent. Ownership is taken by
- QChart when axis added.
-*/
-
-QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent)
- : QObject(parent),
- d_ptr(&d)
-{
-}
-
-/*!
- Destructor of the axis object. When axis is added to chart, chart object takes ownership.
-*/
-
-QAbstractAxis::~QAbstractAxis()
-{
- if (d_ptr->m_chart)
- qFatal("Still binded axis detected !");
-}
-
-/*!
- Sets \a pen used to draw axis line and ticks.
- */
-void QAbstractAxis::setLinePen(const QPen &pen)
-{
- if (d_ptr->m_axisPen != pen) {
- d_ptr->m_axisPen = pen;
- emit linePenChanged(pen);
- }
-}
-
-/*!
- Returns pen used to draw axis and ticks.
-*/
-QPen QAbstractAxis::linePen() const
-{
- if (d_ptr->m_axisPen == QChartPrivate::defaultPen())
- return QPen();
- else
- return d_ptr->m_axisPen;
-}
-
-void QAbstractAxis::setLinePenColor(QColor color)
-{
- QPen p = d_ptr->m_axisPen;
- if (p.color() != color) {
- p.setColor(color);
- setLinePen(p);
- emit colorChanged(color);
- }
-}
-
-QColor QAbstractAxis::linePenColor() const
-{
- return linePen().color();
-}
-
-/*!
- Sets if axis and ticks are \a visible.
- */
-void QAbstractAxis::setLineVisible(bool visible)
-{
- if (d_ptr->m_arrowVisible != visible) {
- d_ptr->m_arrowVisible = visible;
- emit lineVisibleChanged(visible);
- }
-}
-
-bool QAbstractAxis::isLineVisible() const
-{
- return d_ptr->m_arrowVisible;
-}
-
-void QAbstractAxis::setGridLineVisible(bool visible)
-{
- if (d_ptr->m_gridLineVisible != visible) {
- d_ptr->m_gridLineVisible = visible;
- emit gridVisibleChanged(visible);
- }
-}
-
-bool QAbstractAxis::isGridLineVisible() const
-{
- return d_ptr->m_gridLineVisible;
-}
-
-/*!
- Sets \a pen used to draw grid line.
-*/
-void QAbstractAxis::setGridLinePen(const QPen &pen)
-{
- if (d_ptr->m_gridLinePen != pen) {
- d_ptr->m_gridLinePen = pen;
- emit gridLinePenChanged(pen);
- }
-}
-
-/*!
- Returns pen used to draw grid.
-*/
-QPen QAbstractAxis::gridLinePen() const
-{
- if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen())
- return QPen();
- else
- return d_ptr->m_gridLinePen;
-}
-
-void QAbstractAxis::setLabelsVisible(bool visible)
-{
- if (d_ptr->m_labelsVisible != visible) {
- d_ptr->m_labelsVisible = visible;
- emit labelsVisibleChanged(visible);
- }
-}
-
-bool QAbstractAxis::labelsVisible() const
-{
- return d_ptr->m_labelsVisible;
-}
-
-void QAbstractAxis::setLabelsPen(const QPen &pen)
-{
- if (d_ptr->m_labelsPen != pen) {
- d_ptr->m_labelsPen = pen;
- emit labelsPenChanged(pen);
- }
-}
-
-QPen QAbstractAxis::labelsPen() const
-{
- if (d_ptr->m_labelsPen == QChartPrivate::defaultPen())
- return QPen();
- else
- return d_ptr->m_labelsPen;
-}
-
-/*!
- Sets \a brush used to draw labels.
- */
-void QAbstractAxis::setLabelsBrush(const QBrush &brush)
-{
- if (d_ptr->m_labelsBrush != brush) {
- d_ptr->m_labelsBrush = brush;
- emit labelsBrushChanged(brush);
- }
-}
-
-/*!
- Returns brush used to draw labels.
-*/
-QBrush QAbstractAxis::labelsBrush() const
-{
- if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush())
- return QBrush();
- else
- return d_ptr->m_labelsBrush;
-}
-
-/*!
- Sets \a font used to draw labels.
-*/
-void QAbstractAxis::setLabelsFont(const QFont &font)
-{
- if (d_ptr->m_labelsFont != font) {
- d_ptr->m_labelsFont = font;
- emit labelsFontChanged(font);
- }
-}
-
-/*!
- Returns font used to draw labels.
-*/
-QFont QAbstractAxis::labelsFont() const
-{
- if (d_ptr->m_labelsFont == QChartPrivate::defaultFont())
- return QFont();
- else
- return d_ptr->m_labelsFont;
-}
-
-void QAbstractAxis::setLabelsAngle(int angle)
-{
- if (d_ptr->m_labelsAngle != angle) {
- d_ptr->m_labelsAngle = angle;
- emit labelsAngleChanged(angle);
- }
-}
-
-int QAbstractAxis::labelsAngle() const
-{
- return d_ptr->m_labelsAngle;
-}
-void QAbstractAxis::setLabelsColor(QColor color)
-{
- QBrush b = d_ptr->m_labelsBrush;
- if (b.color() != color) {
- b.setColor(color);
- setLabelsBrush(b);
- emit labelsColorChanged(color);
- }
-}
-
-QColor QAbstractAxis::labelsColor() const
-{
- return labelsBrush().color();
-}
-
-void QAbstractAxis::setTitleVisible(bool visible)
-{
- if (d_ptr->m_titleVisible != visible) {
- d_ptr->m_titleVisible = visible;
- emit titleVisibleChanged(visible);
- }
-}
-
-bool QAbstractAxis::isTitleVisible() const
-{
- return d_ptr->m_titleVisible;
-}
-
-void QAbstractAxis::setTitlePen(const QPen &pen)
-{
- if (d_ptr->m_titlePen != pen) {
- d_ptr->m_titlePen = pen;
- emit titlePenChanged(pen);
- }
-}
-
-QPen QAbstractAxis::titlePen() const
-{
- if (d_ptr->m_titlePen == QChartPrivate::defaultPen())
- return QPen();
- else
- return d_ptr->m_titlePen;
-}
-
-/*!
- Sets \a brush used to draw title.
- */
-void QAbstractAxis::setTitleBrush(const QBrush &brush)
-{
- if (d_ptr->m_titleBrush != brush) {
- d_ptr->m_titleBrush = brush;
- emit titleBrushChanged(brush);
- }
-}
-
-/*!
- Returns brush used to draw title.
-*/
-QBrush QAbstractAxis::titleBrush() const
-{
- if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush())
- return QBrush();
- else
- return d_ptr->m_titleBrush;
-}
-
-/*!
- Sets \a font used to draw title.
-*/
-void QAbstractAxis::setTitleFont(const QFont &font)
-{
- if (d_ptr->m_titleFont != font) {
- d_ptr->m_titleFont = font;
- emit titleFontChanged(font);
- }
-}
-
-/*!
- Returns font used to draw title.
-*/
-QFont QAbstractAxis::titleFont() const
-{
- if (d_ptr->m_titleFont == QChartPrivate::defaultFont())
- return QFont();
- else
- return d_ptr->m_titleFont;
-}
-
-void QAbstractAxis::setTitleText(const QString &title)
-{
- if (d_ptr->m_title != title) {
- d_ptr->m_title = title;
- emit titleTextChanged(title);
- }
-}
-
-QString QAbstractAxis::titleText() const
-{
- return d_ptr->m_title;
-}
-
-
-void QAbstractAxis::setShadesVisible(bool visible)
-{
- if (d_ptr->m_shadesVisible != visible) {
- d_ptr->m_shadesVisible = visible;
- emit shadesVisibleChanged(visible);
- }
-}
-
-bool QAbstractAxis::shadesVisible() const
-{
- return d_ptr->m_shadesVisible;
-}
-
-/*!
- Sets \a pen used to draw shades.
-*/
-void QAbstractAxis::setShadesPen(const QPen &pen)
-{
- if (d_ptr->m_shadesPen != pen) {
- d_ptr->m_shadesPen = pen;
- emit shadesPenChanged(pen);
- }
-}
-
-/*!
- Returns pen used to draw shades.
-*/
-QPen QAbstractAxis::shadesPen() const
-{
- if (d_ptr->m_shadesPen == QChartPrivate::defaultPen())
- return QPen();
- else
- return d_ptr->m_shadesPen;
-}
-
-/*!
- Sets \a brush used to draw shades.
-*/
-void QAbstractAxis::setShadesBrush(const QBrush &brush)
-{
- if (d_ptr->m_shadesBrush != brush) {
- d_ptr->m_shadesBrush = brush;
- emit shadesBrushChanged(brush);
- }
-}
-
-/*!
- Returns brush used to draw shades.
-*/
-QBrush QAbstractAxis::shadesBrush() const
-{
- if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush())
- return QBrush(Qt::SolidPattern);
- else
- return d_ptr->m_shadesBrush;
-}
-
-void QAbstractAxis::setShadesColor(QColor color)
-{
- QBrush b = d_ptr->m_shadesBrush;
- if (b.color() != color) {
- b.setColor(color);
- setShadesBrush(b);
- emit shadesColorChanged(color);
- }
-}
-
-QColor QAbstractAxis::shadesColor() const
-{
- return shadesBrush().color();
-}
-
-void QAbstractAxis::setShadesBorderColor(QColor color)
-{
- QPen p = d_ptr->m_shadesPen;
- if (p.color() != color) {
- p.setColor(color);
- setShadesPen(p);
- emit shadesColorChanged(color);
- }
-}
-
-QColor QAbstractAxis::shadesBorderColor() const
-{
- return shadesPen().color();
-}
-
-
-bool QAbstractAxis::isVisible() const
-{
- return d_ptr->m_visible;
-}
-
-/*!
- Sets axis, shades, labels and grid lines to be visible.
-*/
-void QAbstractAxis::setVisible(bool visible)
-{
- if (d_ptr->m_visible != visible) {
- d_ptr->m_visible = visible;
- emit visibleChanged(visible);
- }
-}
-
-
-/*!
- Sets axis, shades, labels and grid lines to be visible.
-*/
-void QAbstractAxis::show()
-{
- setVisible(true);
-}
-
-/*!
- Sets axis, shades, labels and grid lines to not be visible.
-*/
-void QAbstractAxis::hide()
-{
- setVisible(false);
-}
-
-/*!
- Sets the minimum value shown on the axis.
- Depending on the actual axis type the \a min parameter is converted to appropriate type.
- If the conversion is impossible then the function call does nothing
-*/
-void QAbstractAxis::setMin(const QVariant &min)
-{
- d_ptr->setMin(min);
-}
-
-/*!
- Sets the maximum value shown on the axis.
- Depending on the actual axis type the \a max parameter is converted to appropriate type.
- If the conversion is impossible then the function call does nothing
-*/
-void QAbstractAxis::setMax(const QVariant &max)
-{
- d_ptr->setMax(max);
-}
-
-/*!
- Sets the range shown on the axis.
- Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types.
- If the conversion is impossible then the function call does nothing.
-*/
-void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
-{
- d_ptr->setRange(min, max);
-}
-
-
-/*!
- Returns the orientation in which the axis is being used (Vertical or Horizontal)
-*/
-Qt::Orientation QAbstractAxis::orientation()
-{
- return d_ptr->orientation();
-}
-
-Qt::Alignment QAbstractAxis::alignment() const
-{
- return d_ptr->alignment();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q)
- : q_ptr(q),
- m_chart(0),
- m_alignment(0),
- m_orientation(Qt::Orientation(0)),
- m_visible(true),
- m_arrowVisible(true),
- m_axisPen(QChartPrivate::defaultPen()),
- m_axisBrush(QChartPrivate::defaultBrush()),
- m_gridLineVisible(true),
- m_gridLinePen(QChartPrivate::defaultPen()),
- m_labelsVisible(true),
- m_labelsPen(QChartPrivate::defaultPen()),
- m_labelsBrush(QChartPrivate::defaultBrush()),
- m_labelsFont(QChartPrivate::defaultFont()),
- m_labelsAngle(0),
- m_titleVisible(true),
- m_titlePen(QChartPrivate::defaultPen()),
- m_titleBrush(QChartPrivate::defaultBrush()),
- m_titleFont(QChartPrivate::defaultFont()),
- m_shadesVisible(false),
- m_shadesPen(QChartPrivate::defaultPen()),
- m_shadesBrush(QChartPrivate::defaultBrush()),
- m_shadesOpacity(1.0),
- m_dirty(false)
-{
-}
-
-QAbstractAxisPrivate::~QAbstractAxisPrivate()
-{
-}
-
-void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment)
-{
- switch(alignment) {
- case Qt::AlignTop:
- case Qt::AlignBottom:
- m_orientation = Qt::Horizontal;
- break;
- case Qt::AlignLeft:
- case Qt::AlignRight:
- m_orientation = Qt::Vertical;
- break;
- default:
- qWarning()<<"No alignment specified !";
- break;
- };
- m_alignment=alignment;
-}
-
-void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced)
-{
- if (forced || QChartPrivate::defaultPen() == m_axisPen)
- q_ptr->setLinePen(theme->axisLinePen());
-
- if (forced || QChartPrivate::defaultPen() == m_gridLinePen)
- q_ptr->setGridLinePen(theme->girdLinePen());
-
- if (forced || QChartPrivate::defaultBrush() == m_labelsBrush)
- q_ptr->setLabelsBrush(theme->labelBrush());
- if (forced || QChartPrivate::defaultPen() == m_labelsPen)
- q_ptr->setLabelsPen(Qt::NoPen); // NoPen for performance reasons
- if (forced || QChartPrivate::defaultFont() == m_labelsFont)
- q_ptr->setLabelsFont(theme->labelFont());
-
- if (forced || QChartPrivate::defaultBrush() == m_titleBrush)
- q_ptr->setTitleBrush(theme->labelBrush());
- if (forced || QChartPrivate::defaultPen() == m_titlePen)
- q_ptr->setTitlePen(Qt::NoPen); // NoPen for performance reasons
- if (forced || QChartPrivate::defaultFont() == m_titleFont) {
- QFont font(m_labelsFont);
- font.setBold(true);
- q_ptr->setTitleFont(font);
- }
-
- if (forced || QChartPrivate::defaultBrush() == m_shadesBrush)
- q_ptr->setShadesBrush(theme->backgroundShadesBrush());
- if (forced || QChartPrivate::defaultPen() == m_shadesPen)
- q_ptr->setShadesPen(theme->backgroundShadesPen());
-
- bool axisX = m_orientation == Qt::Horizontal;
- if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth
- || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX)
- || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) {
- q_ptr->setShadesVisible(true);
- } else if (forced) {
- q_ptr->setShadesVisible(false);
- }
-}
-
-void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max)
-{
- setRange(min,max);
-}
-
-void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_UNUSED(parent);
-}
-
-void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options)
-{
- ChartAxisElement *axis = m_item.data();
- Q_ASSERT(axis);
- if (axis->animation())
- axis->animation()->stopAndDestroyLater();
-
- if (options.testFlag(QChart::GridAxisAnimations))
- axis->setAnimation(new AxisAnimation(axis));
- else
- axis->setAnimation(0);
-}
-
-
-
-#include "moc_qabstractaxis.cpp"
-#include "moc_qabstractaxis_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/qabstractaxis.h b/src/axis/qabstractaxis.h
deleted file mode 100644
index da8bb487..00000000
--- a/src/axis/qabstractaxis.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTAXIS_H
-#define QABSTRACTAXIS_H
-
-#include <qchartglobal.h>
-#include <QPen>
-#include <QFont>
-#include <QVariant>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractAxisPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject
-{
- Q_OBJECT
- //visibility
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
- //arrow
- Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged)
- Q_PROPERTY(QPen linePen READ linePen WRITE setLinePen NOTIFY linePenChanged)
- Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged)
- //labels
- Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
- Q_PROPERTY(QPen labelsPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged)
- Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged)
- Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged)
- Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged)
- Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged)
- //grid
- Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged)
- Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged)
- //shades
- Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
- Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
- Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged)
- Q_PROPERTY(QPen shadesPen READ shadesPen WRITE setShadesPen NOTIFY shadesPenChanged)
- Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged)
- //title
- Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged)
- Q_PROPERTY(QPen titlePen READ titlePen WRITE setTitlePen NOTIFY titlePenChanged)
- Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged)
- Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibleChanged)
- Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont NOTIFY titleFontChanged)
- //orientation
- Q_PROPERTY(Qt::Orientation orientation READ orientation)
- //aligment
- Q_PROPERTY(Qt::Alignment alignment READ alignment)
-
-public:
-
- enum AxisType {
- AxisTypeNoAxis = 0x0,
- AxisTypeValue = 0x1,
- AxisTypeBarCategory = 0x2,
- AxisTypeCategory = 0x3,
- AxisTypeDateTime = 0x4,
- AxisTypeLogValue = 0x5
- };
-
- Q_DECLARE_FLAGS(AxisTypes, AxisType)
-
-protected:
- explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = 0);
-
-public:
- ~QAbstractAxis();
-
- virtual AxisType type() const = 0;
-
- //visibility handling
- bool isVisible() const;
- void setVisible(bool visible = true);
- void show();
- void hide();
-
- //arrow handling
- bool isLineVisible() const;
- void setLineVisible(bool visible = true);
- void setLinePen(const QPen &pen);
- QPen linePen() const;
- void setLinePenColor(QColor color);
- QColor linePenColor() const;
-
- //grid handling
- bool isGridLineVisible() const;
- void setGridLineVisible(bool visible = true);
- void setGridLinePen(const QPen &pen);
- QPen gridLinePen() const;
-
- //labels handling
- bool labelsVisible() const;
- void setLabelsVisible(bool visible = true);
- void setLabelsPen(const QPen &pen);
- QPen labelsPen() const;
- void setLabelsBrush(const QBrush &brush);
- QBrush labelsBrush() const;
- void setLabelsFont(const QFont &font);
- QFont labelsFont() const;
- void setLabelsAngle(int angle);
- int labelsAngle() const;
- void setLabelsColor(QColor color);
- QColor labelsColor() const;
-
- //title handling
- bool isTitleVisible() const;
- void setTitleVisible(bool visible = true);
- void setTitlePen(const QPen &pen);
- QPen titlePen() const;
- void setTitleBrush(const QBrush &brush);
- QBrush titleBrush() const;
- void setTitleFont(const QFont &font);
- QFont titleFont() const;
- void setTitleText(const QString &title);
- QString titleText() const;
-
- //shades handling
- bool shadesVisible() const;
- void setShadesVisible(bool visible = true);
- void setShadesPen(const QPen &pen);
- QPen shadesPen() const;
- void setShadesBrush(const QBrush &brush);
- QBrush shadesBrush() const;
- void setShadesColor(QColor color);
- QColor shadesColor() const;
- void setShadesBorderColor(QColor color);
- QColor shadesBorderColor() const;
-
- Qt::Orientation orientation();
- Qt::Alignment alignment() const;
-
- //range handling
- void setMin(const QVariant &min);
- void setMax(const QVariant &max);
- void setRange(const QVariant &min, const QVariant &max);
-
-Q_SIGNALS:
- void visibleChanged(bool visible);
- void linePenChanged(const QPen &pen);
- void lineVisibleChanged(bool visible);
- void labelsVisibleChanged(bool visible);
- void labelsPenChanged(const QPen &pen);
- void labelsBrushChanged(const QBrush &brush);
- void labelsFontChanged(const QFont &pen);
- void labelsAngleChanged(int angle);
- void gridLinePenChanged(const QPen &pen);
- void gridVisibleChanged(bool visible);
- void colorChanged(QColor color);
- void labelsColorChanged(QColor color);
- void titleTextChanged(const QString &title);
- void titlePenChanged(const QPen &pen);
- void titleBrushChanged(const QBrush &brush);
- void titleVisibleChanged(bool visible);
- void titleFontChanged(const QFont &font);
- void shadesVisibleChanged(bool visible);
- void shadesColorChanged(QColor color);
- void shadesBorderColorChanged(QColor color);
- void shadesPenChanged(const QPen &pen);
- void shadesBrushChanged(const QBrush &brush);
-
-protected:
- QScopedPointer<QAbstractAxisPrivate> d_ptr;
- Q_DISABLE_COPY(QAbstractAxis)
- friend class ChartDataSet;
- friend class ChartPresenter;
- friend class ChartThemeManager;
- friend class AbstractDomain;
- friend class ChartAxisElement;
- friend class XYChart;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QABSTRACTAXIS_H
diff --git a/src/axis/qabstractaxis_p.h b/src/axis/qabstractaxis_p.h
deleted file mode 100644
index bdc519e7..00000000
--- a/src/axis/qabstractaxis_p.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QABSTRACTAXIS_P_H
-#define QABSTRACTAXIS_P_H
-
-#include "qabstractaxis.h"
-#include "chartaxiselement_p.h"
-#include "qchart.h"
-#include <QDebug>
-
-class QGraphicsItem;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartPresenter;
-class AbstractDomain;
-class QChart;
-class QAbstractSeries;
-class ChartTheme;
-class ChartElement;
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT QAbstractAxisPrivate : public QObject
-{
- Q_OBJECT
-public:
- QAbstractAxisPrivate(QAbstractAxis *q);
- ~QAbstractAxisPrivate();
-
-public:
- Qt::Alignment alignment() const { return m_alignment; }
- Qt::Orientation orientation() const { return m_orientation; }
- void setAlignment( Qt::Alignment alignment);
-
- virtual void initializeDomain(AbstractDomain *domain) = 0;
- virtual void initializeGraphics(QGraphicsItem *parent) = 0;
- virtual void initializeTheme(ChartTheme* theme, bool forced = false);
- virtual void initializeAnimations(QChart::AnimationOptions options);
-
- //interface for manipulating range form base class
- virtual void setMin(const QVariant &min) = 0;
- virtual void setMax(const QVariant &max) = 0;
- virtual void setRange(const QVariant &min, const QVariant &max) = 0;
-
- //interface manipulating range form domain
- virtual void setRange(qreal min, qreal max) = 0;
- virtual qreal min() = 0;
- virtual qreal max() = 0;
-
- ChartAxisElement *axisItem() { return m_item.data(); }
-
-public Q_SLOTS:
- void handleRangeChanged(qreal min, qreal max);
-
-Q_SIGNALS:
- void rangeChanged(qreal min, qreal max);
-
-protected:
- QAbstractAxis *q_ptr;
- QChart *m_chart;
- QScopedPointer<ChartAxisElement> m_item;
-
-private:
- QList<QAbstractSeries*> m_series;
-
- Qt::Alignment m_alignment;
- Qt::Orientation m_orientation;
-
- bool m_visible;
-
- bool m_arrowVisible;
- QPen m_axisPen;
- QBrush m_axisBrush;
-
- bool m_gridLineVisible;
- QPen m_gridLinePen;
-
- bool m_labelsVisible;
- QPen m_labelsPen;
- QBrush m_labelsBrush;
- QFont m_labelsFont;
- int m_labelsAngle;
-
- bool m_titleVisible;
- QPen m_titlePen;
- QBrush m_titleBrush;
- QFont m_titleFont;
- QString m_title;
-
- bool m_shadesVisible;
- QPen m_shadesPen;
- QBrush m_shadesBrush;
- qreal m_shadesOpacity;
-
- bool m_dirty;
-
- friend class QAbstractAxis;
- friend class ChartDataSet;
- friend class ChartPresenter;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/axis/valueaxis/chartvalueaxisx.cpp b/src/axis/valueaxis/chartvalueaxisx.cpp
deleted file mode 100644
index 8e3b5ef9..00000000
--- a/src/axis/valueaxis/chartvalueaxisx.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartvalueaxisx_p.h"
-#include "qabstractaxis.h"
-#include "chartpresenter_p.h"
-#include "qvalueaxis.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <qmath.h>
-#include <QDebug>
-
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartValueAxisX::ChartValueAxisX(QValueAxis *axis, QGraphicsItem *item )
- : HorizontalAxis(axis, item),
- m_axis(axis)
-{
- QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
- QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-ChartValueAxisX::~ChartValueAxisX()
-{
-}
-
-QVector<qreal> ChartValueAxisX::calculateLayout() const
-{
- int tickCount = m_axis->tickCount();
-
- Q_ASSERT(tickCount >= 2);
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- const QRectF &gridRect = gridGeometry();
- const qreal deltaX = gridRect.width() / (qreal(tickCount) - 1.0);
- for (int i = 0; i < tickCount; ++i)
- points[i] = qreal(i) * deltaX + gridRect.left();
- return points;
-}
-
-void ChartValueAxisX::updateGeometry()
-{
- const QVector<qreal>& layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createValueLabels(min(), max(), layout.size(), m_axis->labelFormat()));
- HorizontalAxis::updateGeometry();
-}
-
-void ChartValueAxisX::handleTickCountChanged(int tick)
-{
- Q_UNUSED(tick);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-void ChartValueAxisX::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-QSizeF ChartValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
-
- QSizeF base = HorizontalAxis::sizeHint(which, constraint);
- QStringList ticksList = createValueLabels(min(),max(),m_axis->tickCount(),m_axis->labelFormat());
- // Width of horizontal axis sizeHint indicates the maximum distance labels can extend past
- // first and last ticks. Base width is irrelevant.
- qreal width = 0;
- qreal height = 0;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() / 2.0;
- height = boundingRect.height() + labelPadding() + base.height() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelHeight = 0.0;
- qreal firstWidth = -1.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelHeight = qMax(rect.height(), labelHeight);
- width = rect.width();
- if (firstWidth < 0.0)
- firstWidth = width;
- }
- height = labelHeight + labelPadding() + base.height() + 1.0;
- width = qMax(width, firstWidth) / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
- return sh;
-}
-
-#include "moc_chartvalueaxisx_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/valueaxis/chartvalueaxisx_p.h b/src/axis/valueaxis/chartvalueaxisx_p.h
deleted file mode 100644
index 0a2832c1..00000000
--- a/src/axis/valueaxis/chartvalueaxisx_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTVALUEAXISX_H
-#define CHARTVALUEAXISX_H
-
-#include "horizontalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QValueAxis;
-
-class ChartValueAxisX : public HorizontalAxis
-{
- Q_OBJECT
-public:
- ChartValueAxisX(QValueAxis *axis, QGraphicsItem *item = 0);
- ~ChartValueAxisX();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-private Q_SLOTS:
- void handleTickCountChanged(int tick);
- void handleLabelFormatChanged(const QString &format);
-
-private:
- QValueAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTVALUEAXISX_H */
diff --git a/src/axis/valueaxis/chartvalueaxisy.cpp b/src/axis/valueaxis/chartvalueaxisy.cpp
deleted file mode 100644
index a726d53a..00000000
--- a/src/axis/valueaxis/chartvalueaxisy.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartvalueaxisy_p.h"
-#include "qabstractaxis.h"
-#include "chartpresenter_p.h"
-#include "qvalueaxis.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartValueAxisY::ChartValueAxisY(QValueAxis *axis, QGraphicsItem *item)
- : VerticalAxis(axis, item),
- m_axis(axis)
-{
- QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
- QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-ChartValueAxisY::~ChartValueAxisY()
-{
-}
-
-QVector<qreal> ChartValueAxisY::calculateLayout() const
-{
- int tickCount = m_axis->tickCount();
-
- Q_ASSERT(tickCount >= 2);
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- const QRectF &gridRect = gridGeometry();
-
- const qreal deltaY = gridRect.height() / (qreal(tickCount) - 1.0);
- for (int i = 0; i < tickCount; ++i)
- points[i] = qreal(i) * -deltaY + gridRect.bottom();
-
- return points;
-}
-
-void ChartValueAxisY::updateGeometry()
-{
- const QVector<qreal> &layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createValueLabels(min(),max(),layout.size(),m_axis->labelFormat()));
- VerticalAxis::updateGeometry();
-}
-
-void ChartValueAxisY::handleTickCountChanged(int tick)
-{
- Q_UNUSED(tick);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-void ChartValueAxisY::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-QSizeF ChartValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
- QSizeF base = VerticalAxis::sizeHint(which, constraint);
- QStringList ticksList = createValueLabels(min(),max(),m_axis->tickCount(),m_axis->labelFormat());
- qreal width = 0;
- // Height of vertical axis sizeHint indicates the maximum distance labels can extend past
- // first and last ticks. Base height is irrelevant.
- qreal height = 0;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() + labelPadding() + base.width() + 1.0;
- height = boundingRect.height() / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelWidth = 0.0;
- qreal firstHeight = -1.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelWidth = qMax(rect.width(), labelWidth);
- height = rect.height();
- if (firstHeight < 0.0)
- firstHeight = height;
- }
- width = labelWidth + labelPadding() + base.width() + 2.0; //two pixels of tolerance
- height = qMax(height, firstHeight) / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
- return sh;
-}
-
-#include "moc_chartvalueaxisy_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/valueaxis/chartvalueaxisy_p.h b/src/axis/valueaxis/chartvalueaxisy_p.h
deleted file mode 100644
index e2415dbf..00000000
--- a/src/axis/valueaxis/chartvalueaxisy_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTVALUEAXISY_H
-#define CHARTVALUEAXISY_H
-
-#include "verticalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QValueAxis;
-
-class ChartValueAxisY : public VerticalAxis
-{
- Q_OBJECT
-public:
- ChartValueAxisY(QValueAxis *axis, QGraphicsItem *item = 0);
- ~ChartValueAxisY();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-private Q_SLOTS:
- void handleTickCountChanged(int tick);
- void handleLabelFormatChanged(const QString &format);
-
-private:
- QValueAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTVALUEAXISY_H */
diff --git a/src/axis/valueaxis/polarchartvalueaxisangular.cpp b/src/axis/valueaxis/polarchartvalueaxisangular.cpp
deleted file mode 100644
index 6668f63b..00000000
--- a/src/axis/valueaxis/polarchartvalueaxisangular.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartvalueaxisangular_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartValueAxisAngular::PolarChartValueAxisAngular(QValueAxis *axis, QGraphicsItem *item)
- : PolarChartAxisAngular(axis, item)
-{
- QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
- QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-PolarChartValueAxisAngular::~PolarChartValueAxisAngular()
-{
-}
-
-QVector<qreal> PolarChartValueAxisAngular::calculateLayout() const
-{
- int tickCount = static_cast<QValueAxis *>(axis())->tickCount();
- Q_ASSERT(tickCount >= 2);
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- const qreal d = 360.0 / qreal(tickCount - 1);
-
- for (int i = 0; i < tickCount; ++i) {
- qreal angularCoordinate = qreal(i) * d;
- points[i] = angularCoordinate;
- }
-
- return points;
-}
-
-void PolarChartValueAxisAngular::createAxisLabels(const QVector<qreal> &layout)
-{
- QStringList labelList = createValueLabels(min(), max(), layout.size(), static_cast<QValueAxis *>(axis())->labelFormat());
- setLabels(labelList);
-}
-
-void PolarChartValueAxisAngular::handleTickCountChanged(int tick)
-{
- Q_UNUSED(tick);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void PolarChartValueAxisAngular::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-#include "moc_polarchartvalueaxisangular_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/valueaxis/polarchartvalueaxisangular_p.h b/src/axis/valueaxis/polarchartvalueaxisangular_p.h
deleted file mode 100644
index 4b79968c..00000000
--- a/src/axis/valueaxis/polarchartvalueaxisangular_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTVALUEAXISANGULAR_P_H
-#define POLARCHARTVALUEAXISANGULAR_P_H
-
-#include "polarchartaxisangular_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QValueAxis;
-
-class PolarChartValueAxisAngular : public PolarChartAxisAngular
-{
- Q_OBJECT
-public:
- PolarChartValueAxisAngular(QValueAxis *axis, QGraphicsItem *item);
- ~PolarChartValueAxisAngular();
-
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-private Q_SLOTS:
- void handleTickCountChanged(int tick);
- void handleLabelFormatChanged(const QString &format);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTVALUEAXISANGULAR_P_H
diff --git a/src/axis/valueaxis/polarchartvalueaxisradial.cpp b/src/axis/valueaxis/polarchartvalueaxisradial.cpp
deleted file mode 100644
index 6317a8ec..00000000
--- a/src/axis/valueaxis/polarchartvalueaxisradial.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartvalueaxisradial_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartValueAxisRadial::PolarChartValueAxisRadial(QValueAxis *axis, QGraphicsItem *item)
- : PolarChartAxisRadial(axis, item)
-{
- QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
- QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-PolarChartValueAxisRadial::~PolarChartValueAxisRadial()
-{
-}
-
-QVector<qreal> PolarChartValueAxisRadial::calculateLayout() const
-{
- int tickCount = static_cast<QValueAxis *>(axis())->tickCount();
- Q_ASSERT(tickCount >= 2);
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- const qreal d = (axisGeometry().width() / 2) / qreal(tickCount - 1);
-
- for (int i = 0; i < tickCount; ++i) {
- qreal radialCoordinate = qreal(i) * d;
- points[i] = radialCoordinate;
- }
-
- return points;
-}
-
-void PolarChartValueAxisRadial::createAxisLabels(const QVector<qreal> &layout)
-{
- setLabels(createValueLabels(min(), max(), layout.size(), static_cast<QValueAxis *>(axis())->labelFormat()));
-}
-
-void PolarChartValueAxisRadial::handleTickCountChanged(int tick)
-{
- Q_UNUSED(tick);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void PolarChartValueAxisRadial::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-#include "moc_polarchartvalueaxisradial_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/valueaxis/polarchartvalueaxisradial_p.h b/src/axis/valueaxis/polarchartvalueaxisradial_p.h
deleted file mode 100644
index e718da8e..00000000
--- a/src/axis/valueaxis/polarchartvalueaxisradial_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTVALUEAXISRADIAL_P_H
-#define POLARCHARTVALUEAXISRADIAL_P_H
-
-#include "polarchartaxisradial_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QValueAxis;
-
-class PolarChartValueAxisRadial : public PolarChartAxisRadial
-{
- Q_OBJECT
-public:
- PolarChartValueAxisRadial(QValueAxis *axis, QGraphicsItem *item);
- ~PolarChartValueAxisRadial();
-
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-private Q_SLOTS:
- void handleTickCountChanged(int tick);
- void handleLabelFormatChanged(const QString &format);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTVALUEAXISRADIAL_P_H
diff --git a/src/axis/valueaxis/qvalueaxis.cpp b/src/axis/valueaxis/qvalueaxis.cpp
deleted file mode 100644
index 8656ebd4..00000000
--- a/src/axis/valueaxis/qvalueaxis.cpp
+++ /dev/null
@@ -1,451 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvalueaxis.h"
-#include "qvalueaxis_p.h"
-#include "chartvalueaxisx_p.h"
-#include "chartvalueaxisy_p.h"
-#include "abstractdomain_p.h"
-#include "polarchartvalueaxisangular_p.h"
-#include "polarchartvalueaxisradial_p.h"
-#include "chartdataset_p.h"
-#include "chartpresenter_p.h"
-#include "charttheme_p.h"
-
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-/*!
- \class QValueAxis
- \inmodule Qt Charts
- \brief The QValueAxis class is used for manipulating chart's axis.
- \mainclass
-
- ValueAxis can be setup to show axis line with tick marks, grid lines and shades.
- Values of axis are drawn to position of ticks.
-
- Example code on how to use QValueAxis.
- \code
- QChartView *chartView = new QChartView;
- QLineSeries *series = new QLineSeries;
- // ...
- chartView->chart()->addSeries(series);
-
- QValueAxis *axisX = new QValueAxis;
- axisX->setRange(10, 20.5);
- axisX->setTickCount(10);
- axisX->setLabelFormat("%.2f");
- chartView->chart()->setAxisX(axisX, series);
- \endcode
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype ValueAxis
- \instantiates QValueAxis
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/valueaxis.qdocinc
-*/
-#else
-/*!
- \qmlclass ValueAxis QValueAxis
-
- \include ../doc/src/valueaxis.qdocinc
-*/
-#endif
-
-/*!
- \property QValueAxis::min
- Defines the minimum value on the axis.
- When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
-*/
-/*!
- \qmlproperty real ValueAxis::min
- Defines the minimum value on the axis.
- When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
-*/
-
-/*!
- \property QValueAxis::max
- Defines the maximum value on the axis.
- When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
-*/
-/*!
- \qmlproperty real ValueAxis::max
- Defines the maximum value on the axis.
- When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
-*/
-
-/*!
- \property QValueAxis::tickCount
- Defines the number of ticks on the axis. This indicates how many grid lines are draw on the chart.
- The default value is 5, and it can not be below 2.
-*/
-/*!
- \qmlproperty real ValueAxis::tickCount
- Defines the number of ticks on the axis. This indicates how many grid lines are draw on the chart.
- The default value is 5, and it can not be below 2.
-*/
-
-/*!
- \property QValueAxis::labelFormat
- Defines the label format of the axis.
- Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, and c.
- See QString::sprintf() for additional details.
-
- If the QChart::localizeNumbers is \c{true}, the supported specifiers are limited to: d, e, E, f,
- g, G, and i. Also, only the precision modifier is supported. The rest of the formatting comes from
- the default QLocale of the application.
-*/
-/*!
- \qmlproperty real ValueAxis::labelFormat
- Defines the label format of the axis.
- Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, and c.
- See QString::sprintf() for additional details.
-
- If the ChartView::localizeNumbers is \c{true}, the supported specifiers are limited to: d, e, E, f,
- g, G, and i. Also, only the precision modifier is supported. The rest of the formatting comes from
- the default QLocale of the application.
-*/
-
-/*!
- \fn void QValueAxis::minChanged(qreal min)
- Axis emits signal when \a min of axis has changed.
-*/
-/*!
- \qmlsignal ValueAxis::onMinChanged(real min)
- Axis emits signal when \a min of axis has changed.
-*/
-
-/*!
- \fn void QValueAxis::maxChanged(qreal max)
- Axis emits signal when \a max of axis has changed.
-*/
-/*!
- \qmlsignal ValueAxis::onMaxChanged(real max)
- Axis emits signal when \a max of axis has changed.
-*/
-
-/*!
- \fn void QValueAxis::tickCountChanged(int tickCount)
- Axis emits signal when \a tickCount of axis has changed.
-*/
-/*!
- \qmlsignal ValueAxis::tickCountChanged(int tickCount)
- Axis emits signal when \a tickCount of axis has changed.
-*/
-
-/*!
- \fn void QValueAxis::rangeChanged(qreal min, qreal max)
- Axis emits signal when \a min or \a max of axis has changed.
-*/
-
-/*!
- \fn void QValueAxis::labelFormatChanged(const QString &format)
- Axis emits signal when \a format of axis labels has changed.
-*/
-/*!
- \qmlsignal ValueAxis::labelFormatChanged(const QString &format)
- Axis emits signal when \a format of axis labels has changed.
-*/
-
-/*!
- \property QValueAxis::niceNumbersEnabled
- \obsolete
- Using this function can lead to unexpected behavior. Use applyNiceNumbers() instead.
-*/
-
-/*!
- \qmlproperty bool ValueAxis::niceNumbersEnabled
- Deprecated; Using this function can lead to unexpected behavior. Use applyNiceNumbers() instead.
-*/
-
-/*!
- Constructs an axis object which is a child of \a parent.
-*/
-QValueAxis::QValueAxis(QObject *parent) :
- QAbstractAxis(*new QValueAxisPrivate(this), parent)
-{
-
-}
-
-/*!
- \internal
-*/
-QValueAxis::QValueAxis(QValueAxisPrivate &d, QObject *parent)
- : QAbstractAxis(d, parent)
-{
-
-}
-
-/*!
- Destroys the object
-*/
-QValueAxis::~QValueAxis()
-{
- Q_D(QValueAxis);
- if (d->m_chart)
- d->m_chart->removeAxis(this);
-}
-
-void QValueAxis::setMin(qreal min)
-{
- Q_D(QValueAxis);
- setRange(min, qMax(d->m_max, min));
-}
-
-qreal QValueAxis::min() const
-{
- Q_D(const QValueAxis);
- return d->m_min;
-}
-
-void QValueAxis::setMax(qreal max)
-{
- Q_D(QValueAxis);
- setRange(qMin(d->m_min, max), max);
-}
-
-qreal QValueAxis::max() const
-{
- Q_D(const QValueAxis);
- return d->m_max;
-}
-
-/*!
- Sets range from \a min to \a max on the axis.
- If min is greater than max then this function returns without making any changes.
-*/
-void QValueAxis::setRange(qreal min, qreal max)
-{
- Q_D(QValueAxis);
- d->setRange(min,max);
-}
-
-void QValueAxis::setTickCount(int count)
-{
- Q_D(QValueAxis);
- if (d->m_tickCount != count && count >= 2) {
- d->m_tickCount = count;
- emit tickCountChanged(count);
- }
-}
-
-int QValueAxis::tickCount() const
-{
- Q_D(const QValueAxis);
- return d->m_tickCount;
-}
-
-void QValueAxis::setNiceNumbersEnabled(bool enable)
-{
- Q_D(QValueAxis);
- qWarning() << "Deprecated; Using this function can lead to unexpected behavior. " \
- "Use applyNiceNumbers() instead.";
- if(enable) {
- QObject::connect(this,SIGNAL(rangeChanged(qreal,qreal)),this,SLOT(applyNiceNumbers()));
- QObject::connect(this,SIGNAL(tickCountChanged(int)),this,SLOT(applyNiceNumbers()));
- applyNiceNumbers();
- }
- else {
- QObject::disconnect(this,SIGNAL(rangeChanged(qreal,qreal)),this,SLOT(applyNiceNumbers()));
- QObject::disconnect(this,SIGNAL(tickCountChanged(int)),this,SLOT(applyNiceNumbers()));
- }
- d->m_niceNumbersEnabled=enable;
-}
-
-bool QValueAxis::niceNumbersEnabled() const
-{
- Q_D(const QValueAxis);
- qWarning() << "Deprecated; Using this function can lead to unexpected behavior. " \
- "Use applyNiceNumbers() instead.";
- return d->m_niceNumbersEnabled;
-}
-
-void QValueAxis::setLabelFormat(const QString &format)
-{
- Q_D(QValueAxis);
- d->m_format = format;
- emit labelFormatChanged(format);
-}
-
-QString QValueAxis::labelFormat() const
-{
- Q_D(const QValueAxis);
- return d->m_format;
-}
-
-/*!
- Returns the type of the axis
-*/
-QAbstractAxis::AxisType QValueAxis::type() const
-{
- return AxisTypeValue;
-}
-
-/*!
- This method modifies range and number of ticks on the axis to look "nice". Algorithm considers numbers that
- can be expressed as form of 1*10^n, 2* 10^n or 5*10^n as a nice numbers. These numbers are used for spacing the ticks.
- This method will modify the current range and number of ticks.
- \sa setRange(), setTickCount()
-*/
-void QValueAxis::applyNiceNumbers()
-{
- Q_D(QValueAxis);
- if(d->m_applying) return;
- qreal min = d->m_min;
- qreal max = d->m_max;
- int ticks = d->m_tickCount;
- AbstractDomain::looseNiceNumbers(min,max,ticks);
- d->m_applying=true;
- d->setRange(min,max);
- setTickCount(ticks);
- d->m_applying=false;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QValueAxisPrivate::QValueAxisPrivate(QValueAxis *q)
- : QAbstractAxisPrivate(q),
- m_min(0),
- m_max(0),
- m_tickCount(5),
- m_format(QString::null),
- m_applying(false),
- m_niceNumbersEnabled(false)
-{
-
-}
-
-QValueAxisPrivate::~QValueAxisPrivate()
-{
-
-}
-
-void QValueAxisPrivate::setMin(const QVariant &min)
-{
- Q_Q(QValueAxis);
- bool ok;
- qreal value = min.toReal(&ok);
- if (ok)
- q->setMin(value);
-}
-
-void QValueAxisPrivate::setMax(const QVariant &max)
-{
- Q_Q(QValueAxis);
- bool ok;
- qreal value = max.toReal(&ok);
- if (ok)
- q->setMax(value);
-}
-
-void QValueAxisPrivate::setRange(const QVariant &min, const QVariant &max)
-{
- Q_Q(QValueAxis);
- bool ok1;
- bool ok2;
- qreal value1 = min.toReal(&ok1);
- qreal value2 = max.toReal(&ok2);
- if (ok1 && ok2)
- q->setRange(value1, value2);
-}
-
-void QValueAxisPrivate::setRange(qreal min, qreal max)
-{
- Q_Q(QValueAxis);
- bool changed = false;
-
- if (min > max)
- return;
-
- bool changeMin = false;
- if (m_min == 0 || min == 0)
- changeMin = !qFuzzyCompare(1 + m_min, 1 + min);
- else
- changeMin = !qFuzzyCompare(m_min, min);
-
- bool changeMax = false;
- if (m_max == 0 || max == 0)
- changeMax = !qFuzzyCompare(1 + m_max, 1 + max);
- else
- changeMax = !qFuzzyCompare(m_max, max);
-
- if (changeMin) {
- m_min = min;
- changed = true;
- emit q->minChanged(min);
- }
-
- if (changeMax) {
- m_max = max;
- changed = true;
- emit q->maxChanged(max);
- }
-
- if (changed) {
- emit rangeChanged(min,max);
- emit q->rangeChanged(min, max);
- }
-}
-
-void QValueAxisPrivate::initializeGraphics(QGraphicsItem *parent)
-{
- Q_Q(QValueAxis);
- ChartAxisElement *axis(0);
-
- if (m_chart->chartType() == QChart::ChartTypeCartesian) {
- if (orientation() == Qt::Vertical)
- axis = new ChartValueAxisY(q,parent);
- if (orientation() == Qt::Horizontal)
- axis = new ChartValueAxisX(q,parent);
- }
-
- if (m_chart->chartType() == QChart::ChartTypePolar) {
- if (orientation() == Qt::Vertical)
- axis = new PolarChartValueAxisRadial(q, parent);
- if (orientation() == Qt::Horizontal)
- axis = new PolarChartValueAxisAngular(q, parent);
- }
-
- m_item.reset(axis);
- QAbstractAxisPrivate::initializeGraphics(parent);
-}
-
-
-void QValueAxisPrivate::initializeDomain(AbstractDomain *domain)
-{
- if (orientation() == Qt::Vertical) {
- if (!qFuzzyIsNull(m_max - m_min))
- domain->setRangeY(m_min, m_max);
- else
- setRange(domain->minY(), domain->maxY());
- }
- if (orientation() == Qt::Horizontal) {
- if (!qFuzzyIsNull(m_max - m_min))
- domain->setRangeX(m_min, m_max);
- else
- setRange(domain->minX(), domain->maxX());
- }
-}
-
-#include "moc_qvalueaxis.cpp"
-#include "moc_qvalueaxis_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/valueaxis/qvalueaxis.h b/src/axis/valueaxis/qvalueaxis.h
deleted file mode 100644
index 2cbbd762..00000000
--- a/src/axis/valueaxis/qvalueaxis.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVALUEAXIS_H
-#define QVALUEAXIS_H
-
-#include "qabstractaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QValueAxisPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QValueAxis : public QAbstractAxis
-{
- Q_OBJECT
- Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount NOTIFY tickCountChanged)
- Q_PROPERTY(bool niceNumbersEnabled READ niceNumbersEnabled WRITE setNiceNumbersEnabled)
- Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
- Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
- Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
-
-public:
- explicit QValueAxis(QObject *parent = 0);
- ~QValueAxis();
-
-protected:
- QValueAxis(QValueAxisPrivate &d, QObject *parent = 0);
-
-public:
- AxisType type() const;
-
- //range handling
- void setMin(qreal min);
- qreal min() const;
- void setMax(qreal max);
- qreal max() const;
- void setRange(qreal min, qreal max);
-
- //ticks handling
- void setTickCount(int count);
- int tickCount() const;
-
- void setLabelFormat(const QString &format);
- QString labelFormat() const;
-
- void setNiceNumbersEnabled(bool enable = true);
- bool niceNumbersEnabled() const;
-
-public Q_SLOTS:
- void applyNiceNumbers();
-
-Q_SIGNALS:
- void minChanged(qreal min);
- void maxChanged(qreal max);
- void rangeChanged(qreal min, qreal max);
- void tickCountChanged(int tickCount);
- void labelFormatChanged(const QString &format);
-
-private:
- Q_DECLARE_PRIVATE(QValueAxis)
- Q_DISABLE_COPY(QValueAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QVALUEAXIS_H
diff --git a/src/axis/valueaxis/qvalueaxis_p.h b/src/axis/valueaxis/qvalueaxis_p.h
deleted file mode 100644
index 0a0eeb56..00000000
--- a/src/axis/valueaxis/qvalueaxis_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QVALUEAXIS_P_H
-#define QVALUEAXIS_P_H
-
-#include "qvalueaxis.h"
-#include "qabstractaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QValueAxisPrivate : public QAbstractAxisPrivate
-{
- Q_OBJECT
-public:
- QValueAxisPrivate(QValueAxis *q);
- ~QValueAxisPrivate();
-
-public:
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain(AbstractDomain *domain);
-
- qreal min() { return m_min; };
- qreal max() { return m_max; };
- void setRange(qreal min,qreal max);
-
-protected:
- void setMin(const QVariant &min);
- void setMax(const QVariant &max);
- void setRange(const QVariant &min, const QVariant &max);
-
-private:
- qreal m_min;
- qreal m_max;
- int m_tickCount;
- QString m_format;
- bool m_applying;
- bool m_niceNumbersEnabled;
- Q_DECLARE_PUBLIC(QValueAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QVALUEAXIS_P_H
diff --git a/src/axis/verticalaxis.cpp b/src/axis/verticalaxis.cpp
deleted file mode 100644
index 7aa559df..00000000
--- a/src/axis/verticalaxis.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "verticalaxis_p.h"
-#include "qabstractaxis.h"
-#include "chartpresenter_p.h"
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-VerticalAxis::VerticalAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
- : CartesianChartAxis(axis, item, intervalAxis)
-{
-}
-
-VerticalAxis::~VerticalAxis()
-{
-}
-
-void VerticalAxis::updateGeometry()
-{
- const QVector<qreal> &layout = ChartAxisElement::layout();
-
- if (layout.isEmpty())
- return;
-
- QStringList labelList = labels();
-
- QList<QGraphicsItem *> lines = gridItems();
- QList<QGraphicsItem *> labels = labelItems();
- QList<QGraphicsItem *> shades = shadeItems();
- QList<QGraphicsItem *> arrow = arrowItems();
- QGraphicsTextItem *title = titleItem();
-
- Q_ASSERT(labels.size() == labelList.size());
- Q_ASSERT(layout.size() == labelList.size());
-
- const QRectF &axisRect = axisGeometry();
- const QRectF &gridRect = gridGeometry();
-
- qreal height = axisRect.bottom();
-
-
- //arrow
- QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem*>(arrow.at(0));
-
- //arrow position
- if (axis()->alignment() == Qt::AlignLeft)
- arrowItem->setLine(axisRect.right(), gridRect.top(), axisRect.right(), gridRect.bottom());
- else if (axis()->alignment() == Qt::AlignRight)
- arrowItem->setLine(axisRect.left(), gridRect.top(), axisRect.left(), gridRect.bottom());
-
- //title
- QRectF titleBoundingRect;
- QString titleText = axis()->titleText();
- qreal availableSpace = axisRect.width() - labelPadding();
- if (!titleText.isEmpty() && titleItem()->isVisible()) {
- availableSpace -= titlePadding() * 2.0;
- qreal minimumLabelWidth = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...").width();
- qreal titleSpace = availableSpace - minimumLabelWidth;
- title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(90.0),
- titleSpace, gridRect.height(),
- titleBoundingRect));
- title->setTextWidth(titleBoundingRect.height());
-
- titleBoundingRect = title->boundingRect();
-
- QPointF center = gridRect.center() - titleBoundingRect.center();
- if (axis()->alignment() == Qt::AlignLeft)
- title->setPos(axisRect.left() - titleBoundingRect.width() / 2.0 + titleBoundingRect.height() / 2.0 + titlePadding(), center.y());
- else if (axis()->alignment() == Qt::AlignRight)
- title->setPos(axisRect.right() - titleBoundingRect.width() / 2.0 - titleBoundingRect.height() / 2.0 - titlePadding(), center.y());
-
- title->setTransformOriginPoint(titleBoundingRect.center());
- title->setRotation(270);
-
- availableSpace -= titleBoundingRect.height();
- }
-
- for (int i = 0; i < layout.size(); ++i) {
- //items
- QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem *>(lines.at(i));
- QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrow.at(i + 1));
- QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labels.at(i));
-
- //grid line
- gridItem->setLine(gridRect.left(), layout[i], gridRect.right(), layout[i]);
-
- //label text wrapping
- QString text = labelList.at(i);
- QRectF boundingRect;
- // don't truncate empty labels
- if (text.isEmpty()) {
- labelItem->setHtml(text);
- } else {
- qreal labelHeight = (axisRect.height() / layout.count()) - (2 * labelPadding());
- QString truncatedText = ChartPresenter::truncatedText(axis()->labelsFont(), text,
- axis()->labelsAngle(),
- availableSpace,
- labelHeight, boundingRect);
- labelItem->setTextWidth(ChartPresenter::textBoundingRect(axis()->labelsFont(),
- truncatedText).width());
- labelItem->setHtml(truncatedText);
- }
-
- //label transformation origin point
- const QRectF &rect = labelItem->boundingRect();
- QPointF center = rect.center();
- labelItem->setTransformOriginPoint(center.x(), center.y());
- qreal widthDiff = rect.width() - boundingRect.width();
- qreal heightDiff = rect.height() - boundingRect.height();
-
- //ticks and label position
- if (axis()->alignment() == Qt::AlignLeft) {
- labelItem->setPos(axisRect.right() - rect.width() + (widthDiff / 2.0) - labelPadding(), layout[i] - center.y());
- tickItem->setLine(axisRect.right() - labelPadding(), layout[i], axisRect.right(), layout[i]);
- } else if (axis()->alignment() == Qt::AlignRight) {
- labelItem->setPos(axisRect.left() + labelPadding() - (widthDiff / 2.0), layout[i] - center.y());
- tickItem->setLine(axisRect.left(), layout[i], axisRect.left() + labelPadding(), layout[i]);
- }
-
- //label in between
- bool forceHide = false;
- if (intervalAxis() && (i + 1) != layout.size()) {
- qreal lowerBound = qMin(layout[i], gridRect.bottom());
- qreal upperBound = qMax(layout[i + 1], gridRect.top());
- const qreal delta = lowerBound - upperBound;
- // Hide label in case visible part of the category at the grid edge is too narrow
- if (delta < boundingRect.height()
- && (lowerBound == gridRect.bottom() || upperBound == gridRect.top())
- && !intervalAxis()) {
- forceHide = true;
- } else {
- labelItem->setPos(labelItem->pos().x() , lowerBound - (delta / 2.0) - center.y());
- }
- }
-
- //label overlap detection - compensate one pixel for rounding errors
- if (labelItem->pos().y() + boundingRect.height() > height || forceHide ||
- (labelItem->pos().y() + (heightDiff / 2.0) - 1.0) > axisRect.bottom() ||
- labelItem->pos().y() + (heightDiff / 2.0) < (axisRect.top() - 1.0)) {
- labelItem->setVisible(false);
- }
- else {
- labelItem->setVisible(true);
- height=labelItem->pos().y();
- }
-
- //shades
- if ((i + 1) % 2 && i > 1) {
- QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem *>(shades.at(i / 2 - 1));
- qreal lowerBound = qMin(layout[i - 1], gridRect.bottom());
- qreal upperBound = qMax(layout[i], gridRect.top());
- rectItem->setRect(gridRect.left(), upperBound, gridRect.width(), lowerBound - upperBound);
- if (rectItem->rect().height() <= 0.0)
- rectItem->setVisible(false);
- else
- rectItem->setVisible(true);
- }
-
- // check if the grid line and the axis tick should be shown
- qreal y = gridItem->line().p1().y();
- if ((y < gridRect.top() || y > gridRect.bottom()))
- {
- gridItem->setVisible(false);
- tickItem->setVisible(false);
- }else{
- gridItem->setVisible(true);
- tickItem->setVisible(true);
- }
-
- }
- //begin/end grid line in case labels between
- if (intervalAxis()) {
- QGraphicsLineItem *gridLine;
- gridLine = static_cast<QGraphicsLineItem *>(lines.at(layout.size()));
- gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.right(), gridRect.top());
- gridLine->setVisible(true);
- gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size() + 1));
- gridLine->setLine(gridRect.left(), gridRect.bottom(), gridRect.right(), gridRect.bottom());
- gridLine->setVisible(true);
- }
-}
-
-QSizeF VerticalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint);
- QSizeF sh(0, 0);
-
- if (axis()->titleText().isEmpty() || !titleItem()->isVisible())
- return sh;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), "...");
- sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
- break;
- }
- case Qt::MaximumSize:
- case Qt::PreferredSize: {
- QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
- sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/verticalaxis_p.h b/src/axis/verticalaxis_p.h
deleted file mode 100644
index 960c5090..00000000
--- a/src/axis/verticalaxis_p.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef VERTICALAXIS_P_H_
-#define VERTICALAXIS_P_H_
-
-#include "cartesianchartaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class VerticalAxis : public CartesianChartAxis
-{
-public:
- VerticalAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
- ~VerticalAxis();
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
-protected:
- void updateGeometry();
-
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* VERTICALAXIS_P_H_ */
diff --git a/src/barchart/abstractbarchartitem.cpp b/src/barchart/abstractbarchartitem.cpp
deleted file mode 100644
index 23874bfe..00000000
--- a/src/barchart/abstractbarchartitem.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "abstractbarchartitem_p.h"
-#include "bar_p.h"
-#include "qbarset.h"
-#include "qbarset_p.h"
-#include "qabstractbarseries.h"
-#include "qabstractbarseries_p.h"
-#include "qchart.h"
-#include "chartpresenter_p.h"
-#include "charttheme_p.h"
-#include "baranimation_p.h"
-#include "chartdataset_p.h"
-#include <QPainter>
-#include <QTextDocument>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-AbstractBarChartItem::AbstractBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) :
- ChartItem(series->d_func(),item),
- m_animation(0),
- m_series(series)
-{
-
- setFlag(ItemClipsChildrenToShape);
- connect(series->d_func(), SIGNAL(updatedLayout()), this, SLOT(handleLayoutChanged()));
- connect(series->d_func(), SIGNAL(updatedBars()), this, SLOT(handleUpdatedBars()));
- connect(series->d_func(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool)));
- connect(series->d_func(), SIGNAL(restructuredBars()), this, SLOT(handleDataStructureChanged()));
- connect(series, SIGNAL(visibleChanged()), this, SLOT(handleVisibleChanged()));
- connect(series, SIGNAL(opacityChanged()), this, SLOT(handleOpacityChanged()));
- connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(handleUpdatedBars()));
- connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(positionLabels()));
- connect(series, SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)),
- this, SLOT(handleLabelsPositionChanged()));
- setZValue(ChartPresenter::BarSeriesZValue);
- handleDataStructureChanged();
- handleVisibleChanged();
- handleUpdatedBars();
-}
-
-AbstractBarChartItem::~AbstractBarChartItem()
-{
-}
-
-void AbstractBarChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
-}
-
-QRectF AbstractBarChartItem::boundingRect() const
-{
- return m_rect;
-}
-
-void AbstractBarChartItem::applyLayout(const QVector<QRectF> &layout)
-{
- QSizeF size = geometry().size();
- if (geometry().size().isValid()) {
- if (m_animation) {
- if (m_layout.count() == 0 || m_oldSize != size) {
- initializeLayout();
- m_oldSize = size;
- }
- m_animation->setup(m_layout, layout);
- presenter()->startAnimation(m_animation);
- } else {
- setLayout(layout);
- update();
- }
- }
-}
-
-void AbstractBarChartItem::setAnimation(BarAnimation *animation)
-{
- m_animation = animation;
-}
-
-void AbstractBarChartItem::setLayout(const QVector<QRectF> &layout)
-{
- if (layout.count() != m_bars.count())
- return;
-
- m_layout = layout;
-
- for (int i = 0; i < m_bars.count(); i++)
- m_bars.at(i)->setRect(layout.at(i));
-
- positionLabels();
-}
-//handlers
-
-void AbstractBarChartItem::handleDomainUpdated()
-{
- m_domainMinX = domain()->minX();
- m_domainMaxX = domain()->maxX();
- m_domainMinY = domain()->minY();
- m_domainMaxY = domain()->maxY();
-
- QRectF rect(QPointF(0,0),domain()->size());
-
- if(m_rect != rect){
- prepareGeometryChange();
- m_rect = rect;
- }
-
- handleLayoutChanged();
-}
-
-void AbstractBarChartItem::handleLayoutChanged()
-{
- if ((m_rect.width() <= 0) || (m_rect.height() <= 0))
- return; // rect size zero.
- QVector<QRectF> layout = calculateLayout();
- applyLayout(layout);
- handleUpdatedBars();
-}
-
-void AbstractBarChartItem::handleLabelsVisibleChanged(bool visible)
-{
- foreach (QGraphicsTextItem *label, m_labels)
- label->setVisible(visible);
- update();
-}
-
-void AbstractBarChartItem::handleDataStructureChanged()
-{
- foreach (QGraphicsItem *item, childItems())
- delete item;
-
- m_bars.clear();
- m_labels.clear();
- m_layout.clear();
-
- // Create new graphic items for bars
- for (int c = 0; c < m_series->d_func()->categoryCount(); c++) {
- for (int s = 0; s < m_series->count(); s++) {
- QBarSet *set = m_series->d_func()->barsetAt(s);
-
- // Bars
- Bar *bar = new Bar(set, c, this);
- m_bars.append(bar);
- connect(bar, SIGNAL(clicked(int,QBarSet*)), m_series, SIGNAL(clicked(int,QBarSet*)));
- connect(bar, SIGNAL(hovered(bool,QBarSet*)), m_series, SIGNAL(hovered(bool,QBarSet*)));
- connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), m_series, SIGNAL(hovered(bool, int, QBarSet*)));
- connect(bar, SIGNAL(clicked(int,QBarSet*)), set, SIGNAL(clicked(int)));
- connect(bar, SIGNAL(hovered(bool,QBarSet*)), set, SIGNAL(hovered(bool)));
- connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), set, SIGNAL(hovered(bool, int)));
- // m_layout.append(QRectF(0, 0, 1, 1));
-
- // Labels
- QGraphicsTextItem *newLabel = new QGraphicsTextItem(this);
- newLabel->document()->setDocumentMargin(ChartPresenter::textMargin());
- m_labels.append(newLabel);
- }
- }
-
- if(themeManager()) themeManager()->updateSeries(m_series);
- handleLayoutChanged();
- handleVisibleChanged();
-}
-
-void AbstractBarChartItem::handleVisibleChanged()
-{
- bool visible = m_series->isVisible();
- if (visible)
- handleLabelsVisibleChanged(m_series->isLabelsVisible());
- else
- handleLabelsVisibleChanged(visible);
-
- foreach (QGraphicsItem *bar, m_bars)
- bar->setVisible(visible);
-}
-
-void AbstractBarChartItem::handleOpacityChanged()
-{
- foreach (QGraphicsItem *item, childItems())
- item->setOpacity(m_series->opacity());
-}
-
-void AbstractBarChartItem::handleUpdatedBars()
-{
- if (!m_series->d_func()->blockBarUpdate()) {
- // Handle changes in pen, brush, labels etc.
- int categoryCount = m_series->d_func()->categoryCount();
- int setCount = m_series->count();
- int itemIndex(0);
- static const QString valueTag(QLatin1String("@value"));
-
- for (int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- QBarSetPrivate *barSet = m_series->d_func()->barsetAt(set)->d_ptr.data();
- Bar *bar = m_bars.at(itemIndex);
- bar->setPen(barSet->m_pen);
- bar->setBrush(barSet->m_brush);
- bar->update();
-
- QGraphicsTextItem *label = m_labels.at(itemIndex);
- QString valueLabel;
- if (presenter()) { // At startup presenter is not yet set, yet somehow update comes
- if (m_series->labelsFormat().isEmpty()) {
- valueLabel = presenter()->numberToString(barSet->value(category));
- } else {
- valueLabel = m_series->labelsFormat();
- valueLabel.replace(valueTag,
- presenter()->numberToString(barSet->value(category)));
- }
- }
- label->setHtml(valueLabel);
- label->setFont(barSet->m_labelFont);
- label->setDefaultTextColor(barSet->m_labelBrush.color());
- label->update();
- itemIndex++;
- }
- }
- }
-}
-
-void AbstractBarChartItem::handleLabelsPositionChanged()
-{
- positionLabels();
-}
-
-void AbstractBarChartItem::positionLabels()
-{
- for (int i = 0; i < m_layout.count(); i++) {
- QGraphicsTextItem *label = m_labels.at(i);
- qreal xPos = 0;
- qreal yPos = m_layout.at(i).center().y() - label->boundingRect().center().y();
-
- int offset = m_bars.at(i)->pen().width() / 2 + 2;
- if (m_series->labelsPosition() == QAbstractBarSeries::LabelsCenter)
- xPos = m_layout.at(i).center().x() - label->boundingRect().center().x();
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideEnd)
- xPos = m_layout.at(i).right() - label->boundingRect().width() - offset;
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideBase)
- xPos = m_layout.at(i).left() + offset;
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsOutsideEnd)
- xPos = m_layout.at(i).right() + offset;
-
- label->setPos(xPos, yPos);
- label->setZValue(zValue() + 1);
- }
-}
-
-#include "moc_abstractbarchartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/abstractbarchartitem_p.h b/src/barchart/abstractbarchartitem_p.h
deleted file mode 100644
index 2aa00ac4..00000000
--- a/src/barchart/abstractbarchartitem_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-
-#ifndef ABSTRACTBARCHARTITEM_H
-#define ABSTRACTBARCHARTITEM_H
-
-#include "chartitem_p.h"
-#include "qabstractbarseries.h"
-#include <QPen>
-#include <QBrush>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class Bar;
-class QAxisCategories;
-class QChart;
-class BarAnimation;
-
-class AbstractBarChartItem : public ChartItem
-{
- Q_OBJECT
-public:
- AbstractBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
- virtual ~AbstractBarChartItem();
-
-public:
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
- QRectF boundingRect() const;
-
- virtual QVector<QRectF> calculateLayout() = 0;
- virtual void initializeLayout() = 0;
- virtual void applyLayout(const QVector<QRectF> &layout);
- virtual void setAnimation(BarAnimation *animation);
- void setLayout(const QVector<QRectF> &layout);
- void updateLayout(const QVector<QRectF> &layout);
- QRectF geometry() const { return m_rect;}
-
-public Q_SLOTS:
- void handleDomainUpdated();
- void handleLayoutChanged();
- void handleLabelsVisibleChanged(bool visible);
- void handleDataStructureChanged(); // structure of of series has changed, recreate graphic items
- void handleVisibleChanged();
- void handleOpacityChanged();
- virtual void handleUpdatedBars();
- void handleLabelsPositionChanged();
- virtual void positionLabels();
-
-protected:
-
- qreal m_domainMinX;
- qreal m_domainMaxX;
- qreal m_domainMinY;
- qreal m_domainMaxY;
-
- QRectF m_rect;
- QVector<QRectF> m_layout;
-
- BarAnimation *m_animation;
-
- QAbstractBarSeries *m_series; // Not owned.
- QList<Bar *> m_bars;
- QList<QGraphicsTextItem *> m_labels;
- QSizeF m_oldSize;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // ABSTRACTBARCHARTITEM_H
diff --git a/src/barchart/bar.cpp b/src/barchart/bar.cpp
deleted file mode 100644
index f9a5897d..00000000
--- a/src/barchart/bar.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "bar_p.h"
-#include <QPainter>
-#include <QGraphicsSceneEvent>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-Bar::Bar(QBarSet *barset, int index, QGraphicsItem *parent) : QGraphicsRectItem(parent),
- m_index(index),
- m_barset(barset),
- m_hovering(false)
-{
- setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
- setAcceptHoverEvents(true);
-}
-
-Bar::~Bar()
-{
- // End hover event, if bar is deleted during it
- if (m_hovering) {
- emit hovered(false, m_barset);
- emit hovered(false, m_index, m_barset);
- }
-}
-
-void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- Q_UNUSED(event)
- emit clicked(m_index, m_barset);
- QGraphicsItem::mousePressEvent(event);
-}
-
-void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
-{
- Q_UNUSED(event)
- m_hovering = true;
- emit hovered(true, m_barset);
- emit hovered(true, m_index, m_barset);
-
-}
-
-void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
-{
- Q_UNUSED(event)
- m_hovering = false;
- emit hovered(false, m_barset);
- emit hovered(false, m_index, m_barset);
-}
-
-#include "moc_bar_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/bar_p.h b/src/barchart/bar_p.h
deleted file mode 100644
index 041923b0..00000000
--- a/src/barchart/bar_p.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef BAR_H
-#define BAR_H
-
-#include "qchartglobal.h"
-#include <QGraphicsRectItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarSet;
-
-// Single visual bar item of chart
-class Bar : public QObject, public QGraphicsRectItem
-{
- Q_OBJECT
-public:
- Bar(QBarSet *barset, int index, QGraphicsItem *parent = 0);
- ~Bar();
-
-public:
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
-
-Q_SIGNALS:
- void clicked(int index, QBarSet *barset);
- void hovered(bool status, QBarSet *barset);
- void hovered(bool status, int index, QBarSet *barset);
-
-private:
- int m_index;
- QBarSet *m_barset;
- bool m_hovering;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // BAR_H
diff --git a/src/barchart/horizontal/bar/horizontalbarchartitem.cpp b/src/barchart/horizontal/bar/horizontalbarchartitem.cpp
deleted file mode 100644
index 6fc9e751..00000000
--- a/src/barchart/horizontal/bar/horizontalbarchartitem.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "horizontalbarchartitem_p.h"
-#include "qabstractbarseries_p.h"
-#include "qbarset_p.h"
-#include "bar_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-HorizontalBarChartItem::HorizontalBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item)
- : AbstractBarChartItem(series, item)
-{
-}
-
-void HorizontalBarChartItem::initializeLayout()
-{
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- m_layout.clear();
- for(int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- QRectF rect;
- QPointF topLeft;
- QPointF bottomRight;
- if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
- topLeft = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2 + set/setCount * barWidth), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2 + (set + 1)/setCount * barWidth), m_validData);
- } else {
- topLeft = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2 + set/setCount * barWidth), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2 + (set + 1)/setCount * barWidth), m_validData);
- }
-
- if (!m_validData)
- return;
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- m_layout.append(rect.normalized());
- }
- }
-}
-
-QVector<QRectF> HorizontalBarChartItem::calculateLayout()
-{
- QVector<QRectF> layout;
-
- // Use temporary qreals for accuracy
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- for(int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- qreal value = m_series->barSets().at(set)->at(category);
- QRectF rect;
- QPointF topLeft;
- if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
- topLeft = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2 + set/setCount * barWidth), m_validData);
- else
- topLeft = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2 + set/setCount * barWidth), m_validData);
-
- QPointF bottomRight = domain()->calculateGeometryPoint(QPointF(value, category - barWidth / 2 + (set + 1)/setCount * barWidth), m_validData);
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- layout.append(rect.normalized());
- }
- }
- return layout;
-}
-
-#include "moc_horizontalbarchartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/horizontal/bar/horizontalbarchartitem_p.h b/src/barchart/horizontal/bar/horizontalbarchartitem_p.h
deleted file mode 100644
index 9991caa2..00000000
--- a/src/barchart/horizontal/bar/horizontalbarchartitem_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef HORIZONTALBARCHARTITEM_H
-#define HORIZONTALBARCHARTITEM_H
-
-#include "abstractbarchartitem_p.h"
-#include <QGraphicsItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class HorizontalBarChartItem : public AbstractBarChartItem
-{
- Q_OBJECT
-public:
- HorizontalBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
-
-private:
- virtual QVector<QRectF> calculateLayout();
- void initializeLayout();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // HORIZONTALBARCHARTITEM_H
diff --git a/src/barchart/horizontal/bar/qhorizontalbarseries.cpp b/src/barchart/horizontal/bar/qhorizontalbarseries.cpp
deleted file mode 100644
index fdcfd6f9..00000000
--- a/src/barchart/horizontal/bar/qhorizontalbarseries.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qhorizontalbarseries.h"
-#include "qhorizontalbarseries_p.h"
-#include "horizontalbarchartitem_p.h"
-#include "qbarcategoryaxis.h"
-
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QHorizontalBarSeries
- \inmodule Qt Charts
- \brief Series for creating horizontal bar chart.
- \mainclass
-
- QHorizontalBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
- as groups, where bars in same category are grouped next to each other. QHorizontalBarSeries groups the data
- from sets to categories, which are defined by a QStringList.
-
- See the \l {HorizontalBarChart Example} {horizontal bar chart example} to learn how to create a horizontal bar chart.
- \image examples_horizontalbarchart.png
-
- \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype HorizontalBarSeries
- \instantiates QHorizontalBarSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/horizontalbarseries.qdocinc
-*/
-#else
-/*!
- \qmlclass HorizontalBarSeries QHorizontalBarSeries
-
- \include ../doc/src/horizontalbarseries.qdocinc
-*/
-#endif
-
-/*!
- Constructs empty QHorizontalBarSeries.
- QHorizontalBarSeries is QObject which is a child of a \a parent.
-*/
-QHorizontalBarSeries::QHorizontalBarSeries(QObject *parent)
- : QAbstractBarSeries(*new QHorizontalBarSeriesPrivate(this), parent)
-{
-}
-
-/*!
- Destructor.
- Removes series from chart.
-*/
-QHorizontalBarSeries::~QHorizontalBarSeries()
-{
- Q_D(QHorizontalBarSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-
-/*!
- Returns QChartSeries::SeriesTypeHorizontalBar.
-*/
-QAbstractSeries::SeriesType QHorizontalBarSeries::type() const
-{
- return QAbstractSeries::SeriesTypeHorizontalBar;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q)
- : QAbstractBarSeriesPrivate(q)
-{
-
-}
-
-void QHorizontalBarSeriesPrivate::initializeDomain()
-{
- qreal minX(domain()->minX());
- qreal minY(domain()->minY());
- qreal maxX(domain()->maxX());
- qreal maxY(domain()->maxY());
-
- qreal y = categoryCount();
- minX = qMin(minX, min());
- minY = qMin(minY, - (qreal)0.5);
- maxX = qMax(maxX, max());
- maxY = qMax(maxY, y - (qreal)0.5);
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-void QHorizontalBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QHorizontalBarSeries);
- HorizontalBarChartItem *bar = new HorizontalBarChartItem(q,parent);
- m_item.reset(bar);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-#include "moc_qhorizontalbarseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/horizontal/bar/qhorizontalbarseries.h b/src/barchart/horizontal/bar/qhorizontalbarseries.h
deleted file mode 100644
index 0631c05e..00000000
--- a/src/barchart/horizontal/bar/qhorizontalbarseries.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHORIZONTALBARSERIES_H
-#define QHORIZONTALBARSERIES_H
-
-#include <qabstractbarseries.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QHorizontalBarSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QHorizontalBarSeries : public QAbstractBarSeries
-{
- Q_OBJECT
-public:
- explicit QHorizontalBarSeries(QObject *parent = 0);
- ~QHorizontalBarSeries();
- QAbstractSeries::SeriesType type() const;
-
-private:
- Q_DECLARE_PRIVATE(QHorizontalBarSeries)
- Q_DISABLE_COPY(QHorizontalBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QHORIZONTALBARSERIES_H
diff --git a/src/barchart/horizontal/bar/qhorizontalbarseries_p.h b/src/barchart/horizontal/bar/qhorizontalbarseries_p.h
deleted file mode 100644
index 9cafcca8..00000000
--- a/src/barchart/horizontal/bar/qhorizontalbarseries_p.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QHORIZONTALBARSERIES_P_H
-#define QHORIZONTALBARSERIES_P_H
-
-#include "qabstractbarseries_p.h"
-#include "abstractdomain_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QHorizontalBarSeriesPrivate: public QAbstractBarSeriesPrivate
-{
-public:
- QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q);
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain();
-private:
- Q_DECLARE_PUBLIC(QHorizontalBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QHORIZONTALBARSERIES_P_H
diff --git a/src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp b/src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp
deleted file mode 100644
index 9dd875dd..00000000
--- a/src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "horizontalpercentbarchartitem_p.h"
-#include "qabstractbarseries_p.h"
-#include "qbarset_p.h"
-#include "bar_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-HorizontalPercentBarChartItem::HorizontalPercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item)
- : AbstractBarChartItem(series, item)
-{
-}
-
-void HorizontalPercentBarChartItem::initializeLayout()
-{
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- m_layout.clear();
- for(int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- QRectF rect;
- QPointF topLeft;
- QPointF bottomRight;
- if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
- topLeft = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category + barWidth / 2), m_validData);
- } else {
- topLeft = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(0, category + barWidth / 2), m_validData);
- }
-
- if (!m_validData)
- return;
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- m_layout.append(rect.normalized());
- }
- }
-}
-
-QVector<QRectF> HorizontalPercentBarChartItem::calculateLayout()
-{
- QVector<QRectF> layout;
-
- // Use temporary qreals for accuracy
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- for(int category = 0; category < categoryCount; category++) {
- qreal sum = 0;
- qreal categorySum = m_series->d_func()->categorySum(category);
- for (int set = 0; set < setCount; set++) {
- qreal value = m_series->barSets().at(set)->at(category);
- QRectF rect;
- qreal topX = 0;
- if (sum > 0)
- topX = 100 * sum / categorySum;
- qreal bottomX = 0;
- qreal newSum = value + sum;
- if (newSum > 0)
- bottomX = 100 * newSum / categorySum;
- QPointF topLeft;
- if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
- topLeft = domain()->calculateGeometryPoint(QPointF(set ? topX : domain()->minX(), category - barWidth/2), m_validData);
- else
- topLeft = domain()->calculateGeometryPoint(QPointF(set ? topX : 0, category - barWidth/2), m_validData);
- QPointF bottomRight = domain()->calculateGeometryPoint(QPointF(bottomX, category + barWidth/2), m_validData);
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- layout.append(rect.normalized());
- sum = newSum;
- }
- }
- return layout;
-}
-
-void HorizontalPercentBarChartItem::handleUpdatedBars()
-{
- // Handle changes in pen, brush, labels etc.
- int categoryCount = m_series->d_func()->categoryCount();
- int setCount = m_series->count();
- int itemIndex(0);
- static const QString valueTag(QLatin1String("@value"));
-
- for (int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- QBarSetPrivate *barSet = m_series->d_func()->barsetAt(set)->d_ptr.data();
- Bar *bar = m_bars.at(itemIndex);
- bar->setPen(barSet->m_pen);
- bar->setBrush(barSet->m_brush);
- bar->update();
-
- QGraphicsTextItem *label = m_labels.at(itemIndex);
- qreal p = m_series->d_func()->percentageAt(set, category) * 100.0;
- QString vString(presenter()->numberToString(p, 'f', 0));
- QString valueLabel;
- if (m_series->labelsFormat().isEmpty()) {
- vString.append("%");
- valueLabel = vString;
- } else {
- valueLabel = m_series->labelsFormat();
- valueLabel.replace(valueTag, vString);
- }
- label->setHtml(valueLabel);
- label->setFont(barSet->m_labelFont);
- label->setDefaultTextColor(barSet->m_labelBrush.color());
- label->update();
- itemIndex++;
- }
- }
-}
-
-#include "moc_horizontalpercentbarchartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h b/src/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h
deleted file mode 100644
index 5e313521..00000000
--- a/src/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef HORIZONTALPERCENTBARCHARTITEM_P_H
-#define HORIZONTALPERCENTBARCHARTITEM_P_H
-
-#include "abstractbarchartitem_p.h"
-#include <QGraphicsItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class HorizontalPercentBarChartItem : public AbstractBarChartItem
-{
- Q_OBJECT
-public:
- HorizontalPercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
- void handleUpdatedBars();
-
-private:
- virtual QVector<QRectF> calculateLayout();
- void initializeLayout();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // HORIZONTALPERCENTBARCHARTITEM_P_H
diff --git a/src/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp b/src/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp
deleted file mode 100644
index 846f77d4..00000000
--- a/src/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qhorizontalpercentbarseries.h"
-#include "qhorizontalpercentbarseries_p.h"
-#include "horizontalpercentbarchartitem_p.h"
-
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QHorizontalPercentBarSeries
- \inmodule Qt Charts
- \brief Series for creating horizontal percent bar chart.
- \mainclass
-
- QHorizontalPercentBarSeries represents a series of data shown as bars. The purpose of this
- class is to draw bars as groups, where bars in same category are grouped next to each other.
- QHorizontalPercentBarSeries groups the data from sets to categories, which are defined by a
- QStringList. Bars with zero value are not drawn.
-
- See the \l {HorizontalPercentBarChart Example} {horizontal percent bar chart example} to learn
- how to create a horizontal percent bar chart.
- \image examples_horizontalpercentbarchart.png
-
- \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries,
- QHorizontalStackedBarSeries, QHorizontalBarSeries
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype HorizontalPercentBarSeries
- \instantiates QHorizontalPercentBarSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/horizontalpercentbarseries.qdocinc
-*/
-#else
-/*!
- \qmlclass HorizontalPercentBarSeries QHorizontalPercentBarSeries
-
- \include ../doc/src/horizontalpercentbarseries.qdocinc
-*/
-#endif
-
-/*!
- Constructs empty QHorizontalPercentBarSeries.
- QHorizontalPercentBarSeries is QObject which is a child of a \a parent.
-*/
-QHorizontalPercentBarSeries::QHorizontalPercentBarSeries(QObject *parent) :
- QAbstractBarSeries(*new QHorizontalPercentBarSeriesPrivate(this), parent)
-{
-}
-
-/*!
- Returns QAbstractSeries::SeriesTypeHorizontalPercentBar.
-*/
-QAbstractSeries::SeriesType QHorizontalPercentBarSeries::type() const
-{
- return QAbstractSeries::SeriesTypeHorizontalPercentBar;
-}
-
-/*!
- Destructor.
- Removes series from chart.
-*/
-QHorizontalPercentBarSeries::~QHorizontalPercentBarSeries()
-{
- Q_D(QHorizontalPercentBarSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QHorizontalPercentBarSeriesPrivate::QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q) : QAbstractBarSeriesPrivate(q)
-{
-
-}
-
-void QHorizontalPercentBarSeriesPrivate::initializeDomain()
-{
- qreal minX(domain()->minX());
- qreal minY(domain()->minY());
- qreal maxX(domain()->maxX());
- qreal maxY(domain()->maxY());
-
- qreal y = categoryCount();
- minX = 0;
- maxX = 100;
- minY = qMin(minY, - (qreal)0.5);
- maxY = qMax(maxY, y - (qreal)0.5);
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-void QHorizontalPercentBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QHorizontalPercentBarSeries);
- HorizontalPercentBarChartItem *bar = new HorizontalPercentBarChartItem(q,parent);
- m_item.reset(bar);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-#include "moc_qhorizontalpercentbarseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/horizontal/percent/qhorizontalpercentbarseries.h b/src/barchart/horizontal/percent/qhorizontalpercentbarseries.h
deleted file mode 100644
index 72ceb44e..00000000
--- a/src/barchart/horizontal/percent/qhorizontalpercentbarseries.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHORIZONTALPERCENTBARSERIES_H
-#define QHORIZONTALPERCENTBARSERIES_H
-
-#include <qabstractbarseries.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QHorizontalPercentBarSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QHorizontalPercentBarSeries : public QAbstractBarSeries
-{
- Q_OBJECT
-public:
- explicit QHorizontalPercentBarSeries(QObject *parent = 0);
- ~QHorizontalPercentBarSeries();
- QAbstractSeries::SeriesType type() const;
-
-private:
- Q_DECLARE_PRIVATE(QHorizontalPercentBarSeries)
- Q_DISABLE_COPY(QHorizontalPercentBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QHORIZONTALPERCENTBARSERIES_H
diff --git a/src/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h b/src/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h
deleted file mode 100644
index 60de7425..00000000
--- a/src/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QHORIZONTALPERCENTBARSERIES_P_H
-#define QHORIZONTALPERCENTBARSERIES_P_H
-
-#include "qabstractbarseries_p.h"
-#include "abstractdomain_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QHorizontalPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
-{
-public:
- QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q);
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain();
-private:
- Q_DECLARE_PUBLIC(QHorizontalPercentBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QHORIZONTALPERCENTBARSERIES_P_H
diff --git a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp b/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp
deleted file mode 100644
index ad80ec72..00000000
--- a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "horizontalstackedbarchartitem_p.h"
-#include "qabstractbarseries_p.h"
-#include "qbarset_p.h"
-#include "bar_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-HorizontalStackedBarChartItem::HorizontalStackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item)
- : AbstractBarChartItem(series, item)
-{
-}
-
-void HorizontalStackedBarChartItem::initializeLayout()
-{
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- m_layout.clear();
- for(int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- QRectF rect;
- QPointF topLeft;
- QPointF bottomRight;
- if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
- topLeft = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category + barWidth / 2), m_validData);
- } else {
- topLeft = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(0, category + barWidth / 2), m_validData);
- }
-
- if (!m_validData)
- return;
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- m_layout.append(rect.normalized());
- }
- }
-}
-
-QVector<QRectF> HorizontalStackedBarChartItem::calculateLayout()
-{
- QVector<QRectF> layout;
-
- // Use temporary qreals for accuracy
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- for(int category = 0; category < categoryCount; category++) {
- qreal positiveSum = 0;
- qreal negativeSum = 0;
- for (int set = 0; set < setCount; set++) {
- qreal value = m_series->barSets().at(set)->at(category);
- QRectF rect;
- QPointF topLeft;
- QPointF bottomRight;
- if (value < 0) {
- bottomRight = domain()->calculateGeometryPoint(QPointF(value + negativeSum, category - barWidth / 2), m_validData);
- if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
- topLeft = domain()->calculateGeometryPoint(QPointF(set ? negativeSum : domain()->minX(), category + barWidth / 2), m_validData);
- else
- topLeft = domain()->calculateGeometryPoint(QPointF(set ? negativeSum : 0, category + barWidth / 2), m_validData);
- negativeSum += value;
- } else {
- bottomRight = domain()->calculateGeometryPoint(QPointF(value + positiveSum, category - barWidth / 2), m_validData);
- if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
- topLeft = domain()->calculateGeometryPoint(QPointF(set ? positiveSum : domain()->minX(), category + barWidth / 2), m_validData);
- else
- topLeft = domain()->calculateGeometryPoint(QPointF(set ? positiveSum : 0, category + barWidth / 2), m_validData);
- positiveSum += value;
- }
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- layout.append(rect.normalized());
- }
- }
- return layout;
-}
-
-#include "moc_horizontalstackedbarchartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h b/src/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h
deleted file mode 100644
index 4e91a8b3..00000000
--- a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef HORIZONTALSTACKEDBARCHARTITEM_P_H
-#define HORIZONTALSTACKEDBARCHARTITEM_P_H
-
-#include "abstractbarchartitem_p.h"
-#include <QGraphicsItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class HorizontalStackedBarChartItem : public AbstractBarChartItem
-{
- Q_OBJECT
-public:
- HorizontalStackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
-
-private:
- virtual QVector<QRectF> calculateLayout();
- void initializeLayout();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // HORIZONTALSTACKEDBARCHARTITEM_P_H
diff --git a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp
deleted file mode 100644
index a5d8f519..00000000
--- a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qhorizontalstackedbarseries.h"
-#include "qhorizontalstackedbarseries_p.h"
-#include "horizontalstackedbarchartitem_p.h"
-
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-/*!
- \class QHorizontalStackedBarSeries
- \inmodule Qt Charts
- \brief Series for creating horizontal stacked bar chart.
- \mainclass
-
- QHorizontalStackedBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
- as groups, where bars in same category are grouped next to each other. QHorizontalStackedBarSeries groups the data
- from sets to categories, which are defined by a QStringList.
-
- See the \l {HorizontalStackedBarChart Example} {horizontal stacked bar chart example} to learn how to create a horizontal stacked bar chart.
- \image examples_horizontalstackedbarchart.png
-
- \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalPercentBarSeries, QHorizontalBarSeries
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype HorizontalStackedBarSeries
- \instantiates QHorizontalStackedBarSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/horizontalstackedbarseries.qdocinc
-*/
-#else
-/*!
- \qmlclass HorizontalStackedBarSeries QHorizontalStackedBarSeries
-
- \include ../doc/src/horizontalstackedbarseries.qdocinc
-*/
-#endif
-
-/*!
- Constructs empty QHorizontalStackedBarSeries.
- QHorizontalStackedBarSeries is QObject which is a child of a \a parent.
-*/
-QHorizontalStackedBarSeries::QHorizontalStackedBarSeries(QObject *parent)
- : QAbstractBarSeries(*new QHorizontalStackedBarSeriesPrivate(this), parent)
-{
-}
-
-/*!
- Destructor.
- Removes series from chart.
-*/
-QHorizontalStackedBarSeries::~QHorizontalStackedBarSeries()
-{
- Q_D(QHorizontalStackedBarSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-
-/*!
- Returns QAbstractSeries::SeriesTypeHorizontalStackedBar.
-*/
-QAbstractSeries::SeriesType QHorizontalStackedBarSeries::type() const
-{
- return QAbstractSeries::SeriesTypeHorizontalStackedBar;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QHorizontalStackedBarSeriesPrivate::QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q) : QAbstractBarSeriesPrivate(q)
-{
-
-}
-
-void QHorizontalStackedBarSeriesPrivate::initializeDomain()
-{
- qreal minX(domain()->minX());
- qreal minY(domain()->minY());
- qreal maxX(domain()->maxX());
- qreal maxY(domain()->maxY());
-
- qreal y = categoryCount();
- minX = qMin(minX, bottom());
- minY = qMin(minY, - (qreal)0.5);
- maxX = qMax(maxX, top());
- maxY = qMax(maxY, y - (qreal)0.5);
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-void QHorizontalStackedBarSeriesPrivate::initializeGraphics(QGraphicsItem *parent)
-{
- Q_Q(QHorizontalStackedBarSeries);
- HorizontalStackedBarChartItem *bar = new HorizontalStackedBarChartItem(q,parent);
- m_item.reset(bar);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-#include "moc_qhorizontalstackedbarseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.h b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.h
deleted file mode 100644
index 5db21851..00000000
--- a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHORIZONTALSTACKEDBARSERIES_H
-#define QHORIZONTALSTACKEDBARSERIES_H
-
-#include <qabstractbarseries.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QHorizontalStackedBarSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QHorizontalStackedBarSeries : public QAbstractBarSeries
-{
- Q_OBJECT
-public:
- explicit QHorizontalStackedBarSeries(QObject *parent = 0);
- ~QHorizontalStackedBarSeries();
- QAbstractSeries::SeriesType type() const;
-
-private:
- Q_DECLARE_PRIVATE(QHorizontalStackedBarSeries)
- Q_DISABLE_COPY(QHorizontalStackedBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QHORIZONTALSTACKEDBARSERIES_H
diff --git a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h b/src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h
deleted file mode 100644
index 869cf593..00000000
--- a/src/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QHORIZONTALSTACKEDBARSERIES_P_H
-#define QHORIZONTALSTACKEDBARSERIES_P_H
-
-#include "qabstractbarseries_p.h"
-#include "abstractdomain_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QHorizontalStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate
-{
-public:
- QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q);
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain();
-private:
- Q_DECLARE_PUBLIC(QHorizontalStackedBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QHORIZONTALSTACKEDBARSERIES_P_H
diff --git a/src/barchart/qabstractbarseries.cpp b/src/barchart/qabstractbarseries.cpp
deleted file mode 100644
index 564ee3a6..00000000
--- a/src/barchart/qabstractbarseries.cpp
+++ /dev/null
@@ -1,1028 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractbarseries.h"
-#include "qabstractbarseries_p.h"
-#include "qbarset.h"
-#include "qbarset_p.h"
-#include "abstractdomain_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "qvalueaxis.h"
-#include "qbarcategoryaxis.h"
-#include "qbarlegendmarker.h"
-#include "baranimation_p.h"
-#include "abstractbarchartitem_p.h"
-#include "qchart_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QAbstractBarSeries
- \inmodule Qt Charts
- \brief Series for creating a bar chart.
- \mainclass
-
- QAbstractBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars to
- the position defined by data. Single bar is defined by QPointF, where x value is the x-coordinate of the bar
- and y-value is the height of the bar. The category names are ignored with this series and x-axis
- shows the x-values.
-
- See the \l {BarChart Example} {bar chart example} to learn how to create a simple bar chart.
- \image examples_barchart.png
-
- \sa QBarSet, QStackedBarSeries, QPercentBarSeries
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype AbstractBarSeries
- \instantiates QAbstractBarSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/abstractbarseries.qdocinc
-*/
-#else
-/*!
- \qmlclass AbstractBarSeries QAbstractBarSeries
-
- \include ../doc/src/abstractbarseries.qdocinc
-*/
-#endif
-
-/*!
- \qmlproperty AbstractAxis AbstractBarSeries::axisX
- The x axis used for the series. If you leave both axisX and axisXTop undefined, a BarCategoriesAxis is created for
- the series.
- \sa axisXTop
-*/
-
-/*!
- \qmlproperty AbstractAxis AbstractBarSeries::axisY
- The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
- the series.
- \sa axisYRight
-*/
-
-/*!
- \qmlproperty AbstractAxis AbstractBarSeries::axisXTop
- The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
- axisXTop, but not both.
- \sa axisX
-*/
-
-/*!
- \qmlproperty AbstractAxis AbstractBarSeries::axisYRight
- The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
- or axisYRight, but not both.
- \sa axisY
-*/
-
-/*!
- \property QAbstractBarSeries::barWidth
- The width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars
- is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen
- is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
- Note that with QBarSeries this value means the width of one group of bars instead of just one bar.
- \sa QBarSeries
-*/
-/*!
- \qmlproperty real AbstractBarSeries::barWidth
- The width of the bars of the series. The unit of width is the unit of x-axis. The minimum width for bars
- is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen
- is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
- Note that with QBarSeries this value means the width of one group of bars instead of just one bar.
-*/
-
-/*!
- \property QAbstractBarSeries::count
- Holds the number of sets in series.
-*/
-/*!
- \qmlproperty int AbstractBarSeries::count
- Holds the number of sets in series.
-*/
-
-/*!
- \property QAbstractBarSeries::labelsVisible
- Defines the visibility of the labels in series
-*/
-/*!
- \qmlproperty bool AbstractBarSeries::labelsVisible
- Defines the visibility of the labels in series
-*/
-
-/*!
- \property QAbstractBarSeries::labelsFormat
- The \a format used for showing labels in series.
-
- QAbstractBarSeries supports the following format tag:
- \table
- \row
- \li @value \li The value of the bar
- \endtable
-
- For example, the following usage of the format tags would produce labels that show the value
- followed by unit ('u'):
- \code
- series->setLabelsFormat("@value u");
- \endcode
-
- By default, the labels shows the value of the bar. For percent bar series '%' is added after
- the value. The labels are shown on the plot area, labels on the edge of the plot area are cut.
- If the bars are close to each other the labels may overlap.
-
- \sa QAbstractBarSeries::labelsVisible, QAbstractBarSeries::labelsPosition
-*/
-/*!
- \qmlproperty string AbstractBarSeries::labelsFormat
- The format used for showing labels in series.
-
- \sa QAbstractBarSeries::labelsFormat, labelsVisible, labelsPosition
-*/
-/*!
- \fn void QAbstractBarSeries::labelsFormatChanged(const QString &format)
- Signal is emitted when the \a format of data value labels is changed.
-*/
-/*!
- \qmlsignal XYSeries::onLabelsFormatChanged(string format)
- Signal is emitted when the \a format of data value labels is changed.
-*/
-
-/*!
- \enum QAbstractBarSeries::LabelsPosition
-
- This enum describes the position of the data value labels.
-
- \value LabelsCenter Label is in the center of the bar.
- \value LabelsInsideEnd Label is inside the bar at the high end of it.
- \value LabelsInsideBase Label is inside the bar at the low end of it.
- \value LabelsOutsideEnd Label is outside the bar at the high end of it.
- */
-
-/*!
- \property QAbstractBarSeries::labelsPosition
- Defines the \a position of value labels.
-
- \sa QAbstractBarSeries::labelsVisible, QAbstractBarSeries::labelsFormat
-*/
-/*!
- \qmlproperty string AbstractBarSeries::labelsPosition
- Defines the \a position of value labels.
-
- \sa labelsVisible, labelsFormat
-*/
-/*!
- \fn void QAbstractBarSeries::labelsPositionChanged(QAbstractBarSeries::LabelsPosition position)
- Signal is emitted when the \a position of value labels is changed.
-*/
-/*!
- \qmlsignal AbstractBarSeries::onLabelsPositionChanged(LabelsPosition position)
- Signal is emitted when the \a position of value labels is changed.
-*/
-
-/*!
- \fn void QAbstractBarSeries::clicked(int index, QBarSet *barset)
- The signal is emitted if the user clicks with a mouse on top of QBarSet \a barset.
- Clicked bar inside set is indexed by \a index
-*/
-/*!
- \qmlsignal AbstractBarSeries::onClicked(int index, BarSet barset)
- The signal is emitted if the user clicks with a mouse on top of BarSet.
- Clicked bar inside set is indexed by \a index
-*/
-
-/*!
- \fn void QAbstractBarSeries::hovered(bool status, QBarSet* barset)
-
- The signal is emitted if mouse is hovered on top of series.
- Parameter \a barset is the pointer of barset, where hover happened.
- Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
-*/
-
-/*!
- \fn void QAbstractBarSeries::hovered(bool status, int index, QBarSet* barset)
-
- The signal is emitted if mouse is hovered on top of series.
- Parameter \a barset is the pointer of barset, where hover happened.
- Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
- Hovered bar inside the set is indexed by \a index.
-*/
-/*!
- \qmlsignal AbstractBarSeries::onHovered(bool status, int index, BarSet barset)
-
- The signal is emitted if mouse is hovered on top of series.
- Parameter \a barset is the pointer of barset, where hover happened.
- Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
- Hovered bar inside the set is indexed by \a index.
-*/
-
-/*!
- \fn void QAbstractBarSeries::countChanged()
- This signal is emitted when barset count has been changed, for example by append or remove.
-*/
-/*!
- \qmlsignal AbstractBarSeries::onCountChanged()
- This signal is emitted when barset count has been changed, for example by append or remove.
-*/
-
-/*!
- \fn void QAbstractBarSeries::labelsVisibleChanged()
- This signal is emitted when labels visibility have changed.
- \sa isLabelsVisible(), setLabelsVisible()
-*/
-
-/*!
- \fn void QAbstractBarSeries::barsetsAdded(QList<QBarSet*> sets)
- This signal is emitted when \a sets have been added to the series.
- \sa append(), insert()
-*/
-/*!
- \qmlsignal AbstractBarSeries::onBarsetsAdded(BarSet barset)
- Emitted when \a barset has been added to the series.
-*/
-
-/*!
- \fn void QAbstractBarSeries::barsetsRemoved(QList<QBarSet*> sets)
- This signal is emitted when \a sets have been removed from the series.
- \sa remove()
-*/
-/*!
- \qmlsignal AbstractBarSeries::onBarsetsRemoved(BarSet barset)
- Emitted when \a barset has been removed from the series.
-*/
-
-/*!
- \qmlmethod BarSet AbstractBarSeries::at(int index)
- Returns bar set at \a index. Returns null if the index is not valid.
-*/
-
-/*!
- \qmlmethod BarSet AbstractBarSeries::append(string label, VariantList values)
- Adds a new bar set with \a label and \a values to \a index. Values is a list of reals.
- For example:
- \code
- myBarSeries.append("set 1", [0, 0.2, 0.2, 0.5, 0.4, 1.5, 0.9]);
- \endcode
-*/
-
-/*!
- \qmlmethod BarSet AbstractBarSeries::insert(int index, string label, VariantList values)
- Inserts a new bar set with \a label and \a values to \a index. Values can be a list of reals or a list of XYPoints.
- If index is zero or smaller, the new barset is prepended. If the index is count or bigger, the new barset is
- appended.
- \sa AbstractBarSeries::append()
-*/
-
-/*!
- \qmlmethod bool AbstractBarSeries::remove(BarSet barset)
- Removes the barset from the series. Returns true if successful, false otherwise.
-*/
-
-/*!
- \qmlmethod AbstractBarSeries::clear()
- Removes all barsets from the series.
-*/
-
-/*!
- Destructs abstractbarseries and owned barsets.
-*/
-QAbstractBarSeries::~QAbstractBarSeries()
-{
-
-}
-
-/*!
- \internal
-*/
-QAbstractBarSeries::QAbstractBarSeries(QAbstractBarSeriesPrivate &o, QObject *parent)
- : QAbstractSeries(o, parent)
-{
- Q_D(QAbstractSeries);
- QObject::connect(this, SIGNAL(countChanged()), d, SIGNAL(countChanged()));
-}
-
-/*!
- Sets the width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars
- is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen
- is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
- Note that with \link QBarSeries \endlink this value means the width of one group of bars instead of just one bar.
-*/
-void QAbstractBarSeries::setBarWidth(qreal width)
-{
- Q_D(QAbstractBarSeries);
- d->setBarWidth(width);
-}
-
-/*!
- Returns the width of the bars of the series.
- \sa setBarWidth()
-*/
-qreal QAbstractBarSeries::barWidth() const
-{
- Q_D(const QAbstractBarSeries);
- return d->barWidth();
-}
-
-/*!
- Adds a set of bars to series. Takes ownership of \a set. If the set is null or is already in series, it won't be appended.
- Returns true, if appending succeeded.
-*/
-bool QAbstractBarSeries::append(QBarSet *set)
-{
- Q_D(QAbstractBarSeries);
- bool success = d->append(set);
- if (success) {
- QList<QBarSet *> sets;
- sets.append(set);
- set->setParent(this);
- emit barsetsAdded(sets);
- emit countChanged();
- }
- return success;
-}
-
-/*!
- Removes barset from series. Releases ownership of \a set. Deletes the set, if remove
- was successful.
- Returns true, if set was removed.
-*/
-bool QAbstractBarSeries::remove(QBarSet *set)
-{
- Q_D(QAbstractBarSeries);
- bool success = d->remove(set);
- if (success) {
- QList<QBarSet *> sets;
- sets.append(set);
- set->setParent(0);
- emit barsetsRemoved(sets);
- emit countChanged();
- delete set;
- set = 0;
- }
- return success;
-}
-
-/*!
- Takes a single \a set from the series. Does not delete the barset object.
-
- NOTE: The series remains as the barset's parent object. You must set the
- parent object to take full ownership.
-
- Returns true if take was successful.
-*/
-bool QAbstractBarSeries::take(QBarSet *set)
-{
- Q_D(QAbstractBarSeries);
- bool success = d->remove(set);
- if (success) {
- QList<QBarSet *> sets;
- sets.append(set);
- emit barsetsRemoved(sets);
- emit countChanged();
- }
- return success;
-}
-
-/*!
- Adds a list of barsets to series. Takes ownership of \a sets.
- Returns true, if all sets were appended successfully. If any of the sets is null or is already appended to series,
- nothing is appended and function returns false. If any of the sets is in list more than once, nothing is appended
- and function returns false.
-*/
-bool QAbstractBarSeries::append(QList<QBarSet *> sets)
-{
- Q_D(QAbstractBarSeries);
- bool success = d->append(sets);
- if (success) {
- emit barsetsAdded(sets);
- emit countChanged();
- }
- return success;
-}
-
-/*!
- Insert a set of bars to series at \a index postion. Takes ownership of \a set. If the set is null or is already in series, it won't be appended.
- Returns true, if inserting succeeded.
-
-*/
-bool QAbstractBarSeries::insert(int index, QBarSet *set)
-{
- Q_D(QAbstractBarSeries);
- bool success = d->insert(index, set);
- if (success) {
- QList<QBarSet *> sets;
- sets.append(set);
- emit barsetsAdded(sets);
- emit countChanged();
- }
- return success;
-}
-
-/*!
- Removes all barsets from the series. Deletes removed sets.
-*/
-void QAbstractBarSeries::clear()
-{
- Q_D(QAbstractBarSeries);
- QList<QBarSet *> sets = barSets();
- bool success = d->remove(sets);
- if (success) {
- emit barsetsRemoved(sets);
- emit countChanged();
- foreach (QBarSet *set, sets)
- delete set;
- }
-}
-
-/*!
- Returns number of sets in series.
-*/
-int QAbstractBarSeries::count() const
-{
- Q_D(const QAbstractBarSeries);
- return d->m_barSets.count();
-}
-
-/*!
- Returns a list of sets in series. Keeps ownership of sets.
- */
-QList<QBarSet *> QAbstractBarSeries::barSets() const
-{
- Q_D(const QAbstractBarSeries);
- return d->m_barSets;
-}
-
-/*!
- Sets the visibility of labels in series to \a visible
-*/
-void QAbstractBarSeries::setLabelsVisible(bool visible)
-{
- Q_D(QAbstractBarSeries);
- if (d->m_labelsVisible != visible) {
- d->setLabelsVisible(visible);
- emit labelsVisibleChanged();
- }
-}
-
-/*!
- Returns the visibility of labels
-*/
-bool QAbstractBarSeries::isLabelsVisible() const
-{
- Q_D(const QAbstractBarSeries);
- return d->m_labelsVisible;
-}
-
-void QAbstractBarSeries::setLabelsFormat(const QString &format)
-{
- Q_D(QAbstractBarSeries);
- if (d->m_labelsFormat != format) {
- d->m_labelsFormat = format;
- emit labelsFormatChanged(format);
- }
-}
-
-QString QAbstractBarSeries::labelsFormat() const
-{
- Q_D(const QAbstractBarSeries);
- return d->m_labelsFormat;
-}
-
-void QAbstractBarSeries::setLabelsPosition(QAbstractBarSeries::LabelsPosition position)
-{
- Q_D(QAbstractBarSeries);
- if (d->m_labelsPosition != position) {
- d->m_labelsPosition = position;
- emit labelsPositionChanged(position);
- }
-}
-
-QAbstractBarSeries::LabelsPosition QAbstractBarSeries::labelsPosition() const
-{
- Q_D(const QAbstractBarSeries);
- return d->m_labelsPosition;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QAbstractBarSeriesPrivate::QAbstractBarSeriesPrivate(QAbstractBarSeries *q) :
- QAbstractSeriesPrivate(q),
- m_barWidth(0.5), // Default value is 50% of category width
- m_labelsVisible(false),
- m_visible(true),
- m_blockBarUpdate(false),
- m_labelsFormat(),
- m_labelsPosition(QAbstractBarSeries::LabelsCenter)
-{
-}
-
-int QAbstractBarSeriesPrivate::categoryCount() const
-{
- // No categories defined. return count of longest set.
- int count = 0;
- for (int i = 0; i < m_barSets.count(); i++) {
- if (m_barSets.at(i)->count() > count)
- count = m_barSets.at(i)->count();
- }
-
- return count;
-}
-
-void QAbstractBarSeriesPrivate::setBarWidth(qreal width)
-{
- if (width < 0.0)
- width = 0.0;
- m_barWidth = width;
- emit updatedLayout();
-}
-
-qreal QAbstractBarSeriesPrivate::barWidth() const
-{
- return m_barWidth;
-}
-
-QBarSet *QAbstractBarSeriesPrivate::barsetAt(int index)
-{
- return m_barSets.at(index);
-}
-
-void QAbstractBarSeriesPrivate::setVisible(bool visible)
-{
- m_visible = visible;
- emit visibleChanged();
-}
-
-void QAbstractBarSeriesPrivate::setLabelsVisible(bool visible)
-{
- m_labelsVisible = visible;
- emit labelsVisibleChanged(visible);
-}
-
-qreal QAbstractBarSeriesPrivate::min()
-{
- if (m_barSets.count() <= 0)
- return 0;
-
- qreal min = INT_MAX;
-
- for (int i = 0; i < m_barSets.count(); i++) {
- int categoryCount = m_barSets.at(i)->count();
- for (int j = 0; j < categoryCount; j++) {
- qreal temp = m_barSets.at(i)->at(j);
- if (temp < min)
- min = temp;
- }
- }
- return min;
-}
-
-qreal QAbstractBarSeriesPrivate::max()
-{
- if (m_barSets.count() <= 0)
- return 0;
-
- qreal max = INT_MIN;
-
- for (int i = 0; i < m_barSets.count(); i++) {
- int categoryCount = m_barSets.at(i)->count();
- for (int j = 0; j < categoryCount; j++) {
- qreal temp = m_barSets.at(i)->at(j);
- if (temp > max)
- max = temp;
- }
- }
-
- return max;
-}
-
-qreal QAbstractBarSeriesPrivate::valueAt(int set, int category)
-{
- if ((set < 0) || (set >= m_barSets.count()))
- return 0; // No set, no value.
- else if ((category < 0) || (category >= m_barSets.at(set)->count()))
- return 0; // No category, no value.
-
- return m_barSets.at(set)->at(category);
-}
-
-qreal QAbstractBarSeriesPrivate::percentageAt(int set, int category)
-{
- if ((set < 0) || (set >= m_barSets.count()))
- return 0; // No set, no value.
- else if ((category < 0) || (category >= m_barSets.at(set)->count()))
- return 0; // No category, no value.
-
- qreal value = m_barSets.at(set)->at(category);
- qreal sum = categorySum(category);
- if (qFuzzyCompare(sum, 0))
- return 0;
-
- return value / sum;
-}
-
-qreal QAbstractBarSeriesPrivate::categorySum(int category)
-{
- qreal sum(0);
- int count = m_barSets.count(); // Count sets
- for (int set = 0; set < count; set++) {
- if (category < m_barSets.at(set)->count())
- sum += m_barSets.at(set)->at(category);
- }
- return sum;
-}
-
-qreal QAbstractBarSeriesPrivate::absoluteCategorySum(int category)
-{
- qreal sum(0);
- int count = m_barSets.count(); // Count sets
- for (int set = 0; set < count; set++) {
- if (category < m_barSets.at(set)->count())
- sum += qAbs(m_barSets.at(set)->at(category));
- }
- return sum;
-}
-
-qreal QAbstractBarSeriesPrivate::maxCategorySum()
-{
- qreal max = INT_MIN;
- int count = categoryCount();
- for (int i = 0; i < count; i++) {
- qreal sum = categorySum(i);
- if (sum > max)
- max = sum;
- }
- return max;
-}
-
-qreal QAbstractBarSeriesPrivate::minX()
-{
- if (m_barSets.count() <= 0)
- return 0;
-
- qreal min = INT_MAX;
-
- for (int i = 0; i < m_barSets.count(); i++) {
- int categoryCount = m_barSets.at(i)->count();
- for (int j = 0; j < categoryCount; j++) {
- qreal temp = m_barSets.at(i)->d_ptr.data()->m_values.at(j).x();
- if (temp < min)
- min = temp;
- }
- }
- return min;
-}
-
-qreal QAbstractBarSeriesPrivate::maxX()
-{
- if (m_barSets.count() <= 0)
- return 0;
-
- qreal max = INT_MIN;
-
- for (int i = 0; i < m_barSets.count(); i++) {
- int categoryCount = m_barSets.at(i)->count();
- for (int j = 0; j < categoryCount; j++) {
- qreal temp = m_barSets.at(i)->d_ptr.data()->m_values.at(j).x();
- if (temp > max)
- max = temp;
- }
- }
-
- return max;
-}
-
-qreal QAbstractBarSeriesPrivate::categoryTop(int category)
-{
- // Returns top (sum of all positive values) of category.
- // Returns 0, if all values are negative
- qreal top(0);
- int count = m_barSets.count();
- for (int set = 0; set < count; set++) {
- if (category < m_barSets.at(set)->count()) {
- qreal temp = m_barSets.at(set)->at(category);
- if (temp > 0) {
- top += temp;
- }
- }
- }
- return top;
-}
-
-qreal QAbstractBarSeriesPrivate::categoryBottom(int category)
-{
- // Returns bottom (sum of all negative values) of category
- // Returns 0, if all values are positive
- qreal bottom(0);
- int count = m_barSets.count();
- for (int set = 0; set < count; set++) {
- if (category < m_barSets.at(set)->count()) {
- qreal temp = m_barSets.at(set)->at(category);
- if (temp < 0) {
- bottom += temp;
- }
- }
- }
- return bottom;
-}
-
-qreal QAbstractBarSeriesPrivate::top()
-{
- // Returns top of all categories
- qreal top(0);
- int count = categoryCount();
- for (int i = 0; i < count; i++) {
- qreal temp = categoryTop(i);
- if (temp > top)
- top = temp;
- }
- return top;
-}
-
-qreal QAbstractBarSeriesPrivate::bottom()
-{
- // Returns bottom of all categories
- qreal bottom(0);
- int count = categoryCount();
- for (int i = 0; i < count; i++) {
- qreal temp = categoryBottom(i);
- if (temp < bottom)
- bottom = temp;
- }
- return bottom;
-}
-
-bool QAbstractBarSeriesPrivate::blockBarUpdate()
-{
- return m_blockBarUpdate;
-}
-
-void QAbstractBarSeriesPrivate::initializeDomain()
-{
- qreal minX(domain()->minX());
- qreal minY(domain()->minY());
- qreal maxX(domain()->maxX());
- qreal maxY(domain()->maxY());
-
- qreal seriesMinX = this->minX();
- qreal seriesMaxX = this->maxX();
- qreal y = max();
- minX = qMin(minX, seriesMinX - (qreal)0.5);
- minY = qMin(minY, y);
- maxX = qMax(maxX, seriesMaxX + (qreal)0.5);
- maxY = qMax(maxY, y);
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-QList<QLegendMarker*> QAbstractBarSeriesPrivate::createLegendMarkers(QLegend* legend)
-{
- Q_Q(QAbstractBarSeries);
- QList<QLegendMarker*> markers;
-
- foreach(QBarSet* set, q->barSets()) {
- QBarLegendMarker* marker = new QBarLegendMarker(q,set,legend);
- markers << marker;
- }
- return markers;
-}
-
-
-bool QAbstractBarSeriesPrivate::append(QBarSet *set)
-{
- if ((m_barSets.contains(set)) || (set == 0))
- return false; // Fail if set is already in list or set is null.
-
- m_barSets.append(set);
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
- QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
-
- emit restructuredBars(); // this notifies barchartitem
- return true;
-}
-
-bool QAbstractBarSeriesPrivate::remove(QBarSet *set)
-{
- if (!m_barSets.contains(set))
- return false; // Fail if set is not in list
-
- m_barSets.removeOne(set);
- QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
- QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
-
- emit restructuredBars(); // this notifies barchartitem
- return true;
-}
-
-bool QAbstractBarSeriesPrivate::append(QList<QBarSet * > sets)
-{
- foreach (QBarSet *set, sets) {
- if ((set == 0) || (m_barSets.contains(set)))
- return false; // Fail if any of the sets is null or is already appended.
- if (sets.count(set) != 1)
- return false; // Also fail if same set is more than once in given list.
- }
-
- foreach (QBarSet *set, sets) {
- m_barSets.append(set);
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
- QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
- }
-
- emit restructuredBars(); // this notifies barchartitem
- return true;
-}
-
-bool QAbstractBarSeriesPrivate::remove(QList<QBarSet * > sets)
-{
- if (sets.count() == 0)
- return false;
-
- foreach (QBarSet *set, sets) {
- if ((set == 0) || (!m_barSets.contains(set)))
- return false; // Fail if any of the sets is null or is not in series
- if (sets.count(set) != 1)
- return false; // Also fail if same set is more than once in given list.
- }
-
- foreach (QBarSet *set, sets) {
- m_barSets.removeOne(set);
- QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
- QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
- }
-
- emit restructuredBars(); // this notifies barchartitem
-
- return true;
-}
-
-bool QAbstractBarSeriesPrivate::insert(int index, QBarSet *set)
-{
- if ((m_barSets.contains(set)) || (set == 0))
- return false; // Fail if set is already in list or set is null.
-
- m_barSets.insert(index, set);
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
- QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
-
- emit restructuredBars(); // this notifies barchartitem
- return true;
-}
-
-void QAbstractBarSeriesPrivate::initializeAxes()
-{
- Q_Q(QAbstractBarSeries);
-
- foreach(QAbstractAxis* axis, m_axes) {
-
- if (axis->type() == QAbstractAxis::AxisTypeBarCategory) {
- switch (q->type()) {
- case QAbstractSeries::SeriesTypeHorizontalBar:
- case QAbstractSeries::SeriesTypeHorizontalPercentBar:
- case QAbstractSeries::SeriesTypeHorizontalStackedBar:
- if (axis->orientation() == Qt::Vertical)
- populateCategories(qobject_cast<QBarCategoryAxis *>(axis));
- break;
- case QAbstractSeries::SeriesTypeBar:
- case QAbstractSeries::SeriesTypePercentBar:
- case QAbstractSeries::SeriesTypeStackedBar:
- case QAbstractSeries::SeriesTypeBoxPlot:
- if (axis->orientation() == Qt::Horizontal)
- populateCategories(qobject_cast<QBarCategoryAxis *>(axis));
- break;
- default:
- qWarning() << "Unexpected series type";
- break;
- }
- }
- }
-}
-
-QAbstractAxis::AxisType QAbstractBarSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
-{
- Q_Q(const QAbstractBarSeries);
-
- switch (q->type()) {
- case QAbstractSeries::SeriesTypeHorizontalBar:
- case QAbstractSeries::SeriesTypeHorizontalPercentBar:
- case QAbstractSeries::SeriesTypeHorizontalStackedBar:
- if (orientation == Qt::Vertical)
- return QAbstractAxis::AxisTypeBarCategory;
- break;
- case QAbstractSeries::SeriesTypeBar:
- case QAbstractSeries::SeriesTypePercentBar:
- case QAbstractSeries::SeriesTypeStackedBar:
- case QAbstractSeries::SeriesTypeBoxPlot:
- if (orientation == Qt::Horizontal)
- return QAbstractAxis::AxisTypeBarCategory;
- break;
- default:
- qWarning() << "Unexpected series type";
- break;
- }
- return QAbstractAxis::AxisTypeValue;
-
-}
-
-void QAbstractBarSeriesPrivate::populateCategories(QBarCategoryAxis *axis)
-{
- QStringList categories;
- if (axis->categories().isEmpty()) {
- for (int i(1); i < categoryCount() + 1; i++)
- categories << presenter()->numberToString(i);
- axis->append(categories);
- }
-}
-
-QAbstractAxis* QAbstractBarSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
-{
- if (defaultAxisType(orientation) == QAbstractAxis::AxisTypeBarCategory)
- return new QBarCategoryAxis;
- else
- return new QValueAxis;
-}
-
-void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
-{
- m_blockBarUpdate = true; // Ensures that the bars are not updated before the theme is ready
-
- const QList<QGradient> gradients = theme->seriesGradients();
-
- qreal takeAtPos = 0.5;
- qreal step = 0.2;
- if (m_barSets.count() > 1) {
- step = 1.0 / (qreal) m_barSets.count();
- if (m_barSets.count() % gradients.count())
- step *= gradients.count();
- else
- step *= (gradients.count() - 1);
- }
-
- for (int i(0); i < m_barSets.count(); i++) {
- int colorIndex = (index + i) % gradients.count();
- if (i > 0 && i %gradients.count() == 0) {
- // There is no dedicated base color for each sets, generate more colors
- takeAtPos += step;
- if (takeAtPos == 1.0)
- takeAtPos += step;
- takeAtPos -= (int) takeAtPos;
- }
- if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->d_ptr->m_brush)
- m_barSets.at(i)->setBrush(ChartThemeManager::colorAt(gradients.at(colorIndex), takeAtPos));
-
- // Pick label color from the opposite end of the gradient.
- // 0.3 as a boundary seems to work well.
- if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->d_ptr->m_labelBrush) {
- if (takeAtPos < 0.3)
- m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 1));
- else
- m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0));
- }
- if (forced || QChartPrivate::defaultPen() == m_barSets.at(i)->d_ptr->m_pen) {
- QColor c = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0);
- m_barSets.at(i)->setPen(c);
- }
- }
- m_blockBarUpdate = false;
- emit updatedBars();
-}
-
-void QAbstractBarSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
-{
- AbstractBarChartItem *bar = static_cast<AbstractBarChartItem *>(m_item.data());
- Q_ASSERT(bar);
- if (bar->animation())
- bar->animation()->stopAndDestroyLater();
-
- if (options.testFlag(QChart::SeriesAnimations))
- bar->setAnimation(new BarAnimation(bar));
- else
- bar->setAnimation(0);
- QAbstractSeriesPrivate::initializeAnimations(options);
-}
-
-#include "moc_qabstractbarseries.cpp"
-#include "moc_qabstractbarseries_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/qabstractbarseries.h b/src/barchart/qabstractbarseries.h
deleted file mode 100644
index cf23ab90..00000000
--- a/src/barchart/qabstractbarseries.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTBARSERIES_H
-#define QABSTRACTBARSERIES_H
-
-#include <qabstractseries.h>
-#include <QStringList>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarSet;
-class QAbstractBarSeriesPrivate;
-
-// Container for series
-class QTCOMMERCIALCHART_EXPORT QAbstractBarSeries : public QAbstractSeries
-{
- Q_OBJECT
- Q_PROPERTY(qreal barWidth READ barWidth WRITE setBarWidth)
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
- Q_PROPERTY(QString labelsFormat READ labelsFormat WRITE setLabelsFormat NOTIFY labelsFormatChanged)
- Q_PROPERTY(LabelsPosition labelsPosition READ labelsPosition WRITE setLabelsPosition NOTIFY labelsPositionChanged)
- Q_ENUMS(LabelsPosition)
-
-public:
- enum LabelsPosition {
- LabelsCenter = 0,
- LabelsInsideEnd,
- LabelsInsideBase,
- LabelsOutsideEnd
- };
-
-public:
- virtual ~QAbstractBarSeries();
-
- void setBarWidth(qreal width);
- qreal barWidth() const;
-
- bool append(QBarSet *set);
- bool remove(QBarSet *set);
- bool take(QBarSet *set);
- bool append(QList<QBarSet *> sets);
- bool insert(int index, QBarSet *set);
- int count() const;
- QList<QBarSet *> barSets() const;
- void clear();
-
- void setLabelsVisible(bool visible = true);
- bool isLabelsVisible() const;
-
- void setLabelsFormat(const QString &format);
- QString labelsFormat() const;
-
- void setLabelsPosition(QAbstractBarSeries::LabelsPosition position);
- QAbstractBarSeries::LabelsPosition labelsPosition() const;
-
-protected:
- explicit QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *parent = 0);
-
-Q_SIGNALS:
- void clicked(int index, QBarSet *barset);
- void hovered(bool status, QBarSet *barset);
- void hovered(bool status, int index, QBarSet *barset);
- void countChanged();
- void labelsVisibleChanged();
- void labelsFormatChanged(const QString &format);
- void labelsPositionChanged(QAbstractBarSeries::LabelsPosition position);
-
- void barsetsAdded(QList<QBarSet *> sets);
- void barsetsRemoved(QList<QBarSet *> sets);
-
-protected:
- Q_DECLARE_PRIVATE(QAbstractBarSeries)
- friend class AbstractBarChartItem;
- friend class PercentBarChartItem;
- friend class StackedBarChartItem;
- friend class BoxPlotChartItem;
- friend class BarChartItem;
- friend class HorizontalBarChartItem;
- friend class HorizontalStackedBarChartItem;
- friend class HorizontalPercentBarChartItem;
- friend class BarSet;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QABSTRACTBARSERIES_H
diff --git a/src/barchart/qabstractbarseries_p.h b/src/barchart/qabstractbarseries_p.h
deleted file mode 100644
index 0cedc331..00000000
--- a/src/barchart/qabstractbarseries_p.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QABSTRACTBARSERIES_P_H
-#define QABSTRACTBARSERIES_P_H
-
-#include "qabstractbarseries.h"
-#include "qabstractseries_p.h"
-#include <QStringList>
-#include <QAbstractSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarModelMapper;
-class QBarCategoryAxis;
-class QLegendMarker;
-
-class QAbstractBarSeriesPrivate : public QAbstractSeriesPrivate
-{
- Q_OBJECT
-public:
- QAbstractBarSeriesPrivate(QAbstractBarSeries *parent);
- int categoryCount() const;
-
- void setBarWidth(qreal width);
- qreal barWidth() const;
-
- void setVisible(bool visible);
- void setLabelsVisible(bool visible);
-
- void initializeDomain();
- void initializeAxes();
- void initializeAnimations(QChart::AnimationOptions options);
- void initializeTheme(int index, ChartTheme* theme, bool forced = false);
-
- QList<QLegendMarker*> createLegendMarkers(QLegend *legend);
-
- virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
- QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
-
- bool append(QBarSet *set);
- bool remove(QBarSet *set);
- bool append(QList<QBarSet *> sets);
- bool remove(QList<QBarSet *> sets);
- bool insert(int index, QBarSet *set);
-
- QBarSet *barsetAt(int index);
- qreal min();
- qreal max();
- qreal valueAt(int set, int category);
- qreal percentageAt(int set, int category);
- qreal categorySum(int category);
- qreal absoluteCategorySum(int category);
- qreal maxCategorySum();
- qreal minX();
- qreal maxX();
- qreal categoryTop(int category);
- qreal categoryBottom(int category);
- qreal top();
- qreal bottom();
-
- bool blockBarUpdate();
-
-Q_SIGNALS:
- void clicked(int index, QBarSet *barset);
- void updatedBars();
- void updatedLayout();
- void restructuredBars();
- void labelsVisibleChanged(bool visible);
- void visibleChanged();
-
-private:
- void populateCategories(QBarCategoryAxis *axis);
-
-protected:
- QList<QBarSet *> m_barSets;
- qreal m_barWidth;
- bool m_labelsVisible;
- bool m_visible;
- bool m_blockBarUpdate;
- QString m_labelsFormat;
- QAbstractBarSeries::LabelsPosition m_labelsPosition;
-
-private:
- Q_DECLARE_PUBLIC(QAbstractBarSeries)
- friend class HorizontalBarChartItem;
- friend class BarChartItem;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QABSTRACTBARSERIES_P_H
diff --git a/src/barchart/qbarmodelmapper.cpp b/src/barchart/qbarmodelmapper.cpp
deleted file mode 100644
index 1e87a1ab..00000000
--- a/src/barchart/qbarmodelmapper.cpp
+++ /dev/null
@@ -1,561 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbarmodelmapper.h"
-#include "qbarmodelmapper_p.h"
-#include "qabstractbarseries.h"
-#include "qbarset.h"
-#include "qchart.h"
-#include <QAbstractItemModel>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-QBarModelMapper::QBarModelMapper(QObject *parent) :
- QObject(parent),
- d_ptr(new QBarModelMapperPrivate(this))
-{
-}
-
-QAbstractItemModel *QBarModelMapper::model() const
-{
- Q_D(const QBarModelMapper);
- return d->m_model;
-}
-
-void QBarModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model == 0)
- return;
-
- Q_D(QBarModelMapper);
- if (d->m_model)
- disconnect(d->m_model, 0, d, 0);
-
- d->m_model = model;
- d->initializeBarFromModel();
- // connect signals from the model
- connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
- connect(d->m_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), d, SLOT(modelHeaderDataUpdated(Qt::Orientation,int,int)));
- connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
-}
-
-QAbstractBarSeries *QBarModelMapper::series() const
-{
- Q_D(const QBarModelMapper);
- return d->m_series;
-}
-
-void QBarModelMapper::setSeries(QAbstractBarSeries *series)
-{
- Q_D(QBarModelMapper);
- if (d->m_series)
- disconnect(d->m_series, 0, d, 0);
-
- if (series == 0)
- return;
-
- d->m_series = series;
- d->initializeBarFromModel();
- // connect the signals from the series
- connect(d->m_series, SIGNAL(barsetsAdded(QList<QBarSet*>)), d, SLOT(barSetsAdded(QList<QBarSet*>)));
- connect(d->m_series, SIGNAL(barsetsRemoved(QList<QBarSet*>)), d, SLOT(barSetsRemoved(QList<QBarSet*>)));
- connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
-}
-
-/*!
- Returns which row/column of the model contains the first values of the QBarSets in the series.
- The default value is 0.
-*/
-int QBarModelMapper::first() const
-{
- Q_D(const QBarModelMapper);
- return d->m_first;
-}
-
-/*!
- Sets which row of the model contains the \a first values of the QBarSets in the series.
- The default value is 0.
-*/
-void QBarModelMapper::setFirst(int first)
-{
- Q_D(QBarModelMapper);
- d->m_first = qMax(first, 0);
- d->initializeBarFromModel();
-}
-
-/*!
- Returns the number of rows/columns of the model that are mapped as the data for QAbstractBarSeries
- Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
-*/
-int QBarModelMapper::count() const
-{
- Q_D(const QBarModelMapper);
- return d->m_count;
-}
-
-/*!
- Sets the \a count of rows/columns of the model that are mapped as the data for QAbstractBarSeries
- Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
-*/
-void QBarModelMapper::setCount(int count)
-{
- Q_D(QBarModelMapper);
- d->m_count = qMax(count, -1);
- d->initializeBarFromModel();
-}
-
-/*!
- Returns the orientation that is used when QBarModelMapper accesses the model.
- This mean whether the consecutive values of the bar set are read from row (Qt::Horizontal)
- or from columns (Qt::Vertical)
-*/
-Qt::Orientation QBarModelMapper::orientation() const
-{
- Q_D(const QBarModelMapper);
- return d->m_orientation;
-}
-
-/*!
- Returns the \a orientation that is used when QBarModelMapper accesses the model.
- This mean whether the consecutive values of the pie are read from row (Qt::Horizontal)
- or from columns (Qt::Vertical)
-*/
-void QBarModelMapper::setOrientation(Qt::Orientation orientation)
-{
- Q_D(QBarModelMapper);
- d->m_orientation = orientation;
- d->initializeBarFromModel();
-}
-
-/*!
- Returns which section of the model is used as the data source for the first bar set
-*/
-int QBarModelMapper::firstBarSetSection() const
-{
- Q_D(const QBarModelMapper);
- return d->m_firstBarSetSection;
-}
-
-/*!
- Sets the model section that is used as the data source for the first bar set
- Parameter \a firstBarSetSection specifies the section of the model.
-*/
-void QBarModelMapper::setFirstBarSetSection(int firstBarSetSection)
-{
- Q_D(QBarModelMapper);
- d->m_firstBarSetSection = qMax(-1, firstBarSetSection);
- d->initializeBarFromModel();
-}
-
-/*!
- Returns which section of the model is used as the data source for the last bar set
-*/
-int QBarModelMapper::lastBarSetSection() const
-{
- Q_D(const QBarModelMapper);
- return d->m_lastBarSetSection;
-}
-
-/*!
- Sets the model section that is used as the data source for the last bar set
- Parameter \a lastBarSetSection specifies the section of the model.
-*/
-void QBarModelMapper::setLastBarSetSection(int lastBarSetSection)
-{
- Q_D(QBarModelMapper);
- d->m_lastBarSetSection = qMax(-1, lastBarSetSection);
- d->initializeBarFromModel();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QBarModelMapperPrivate::QBarModelMapperPrivate(QBarModelMapper *q) :
- QObject(q),
- m_series(0),
- m_model(0),
- m_first(0),
- m_count(-1),
- m_orientation(Qt::Vertical),
- m_firstBarSetSection(-1),
- m_lastBarSetSection(-1),
- m_seriesSignalsBlock(false),
- m_modelSignalsBlock(false),
- q_ptr(q)
-{
-}
-
-void QBarModelMapperPrivate::blockModelSignals(bool block)
-{
- m_modelSignalsBlock = block;
-}
-
-void QBarModelMapperPrivate::blockSeriesSignals(bool block)
-{
- m_seriesSignalsBlock = block;
-}
-
-QBarSet *QBarModelMapperPrivate::barSet(QModelIndex index)
-{
- if (!index.isValid())
- return 0;
-
- if (m_orientation == Qt::Vertical && index.column() >= m_firstBarSetSection && index.column() <= m_lastBarSetSection) {
- if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) {
- return m_series->barSets().at(index.column() - m_firstBarSetSection);
- }
- } else if (m_orientation == Qt::Horizontal && index.row() >= m_firstBarSetSection && index.row() <= m_lastBarSetSection) {
- if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count))
- return m_series->barSets().at(index.row() - m_firstBarSetSection);
- }
- return 0; // This part of model has not been mapped to any slice
-}
-
-QModelIndex QBarModelMapperPrivate::barModelIndex(int barSection, int posInBar)
-{
- if (m_count != -1 && posInBar >= m_count)
- return QModelIndex(); // invalid
-
- if (barSection < m_firstBarSetSection || barSection > m_lastBarSetSection)
- return QModelIndex(); // invalid
-
- if (m_orientation == Qt::Vertical)
- return m_model->index(posInBar + m_first, barSection);
- else
- return m_model->index(barSection, posInBar + m_first);
-}
-
-void QBarModelMapperPrivate::handleSeriesDestroyed()
-{
- m_series = 0;
-}
-
-void QBarModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
-{
- Q_UNUSED(topLeft)
- Q_UNUSED(bottomRight)
-
- if (m_model == 0 || m_series == 0)
- return;
-
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- QModelIndex index;
- for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
- for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
- index = topLeft.sibling(row, column);
- QBarSet *bar = barSet(index);
- if (bar) {
- if (m_orientation == Qt::Vertical)
- bar->replace(row - m_first, m_model->data(index).toReal());
- else
- bar->replace(column - m_first, m_model->data(index).toReal());
- }
- }
- }
- blockSeriesSignals(false);
-}
-
-void QBarModelMapperPrivate::modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last)
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (orientation != m_orientation) {
- for (int section = first; section <= last; section++) {
- if (section >= m_firstBarSetSection && section <= m_lastBarSetSection) {
- QBarSet *bar = m_series->barSets().at(section - m_firstBarSetSection);
- if (bar)
- bar->setLabel(m_model->headerData(section, orientation).toString());
- }
- }
- }
- blockSeriesSignals(false);
-}
-
-void QBarModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent)
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Vertical)
- insertData(start, end);
- else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize
- initializeBarFromModel();
- blockSeriesSignals(false);
-}
-
-void QBarModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent)
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Vertical)
- removeData(start, end);
- else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize
- initializeBarFromModel();
- blockSeriesSignals(false);
-}
-
-void QBarModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent)
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Horizontal)
- insertData(start, end);
- else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize
- initializeBarFromModel();
- blockSeriesSignals(false);
-}
-
-void QBarModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent)
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Horizontal)
- removeData(start, end);
- else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize
- initializeBarFromModel();
- blockSeriesSignals(false);
-}
-
-void QBarModelMapperPrivate::handleModelDestroyed()
-{
- m_model = 0;
-}
-
-void QBarModelMapperPrivate::insertData(int start, int end)
-{
- Q_UNUSED(end)
- Q_UNUSED(start)
- Q_UNUSED(end)
- // Currently barchart needs to be fully recalculated when change is made.
- // Re-initialize
- initializeBarFromModel();
-}
-
-void QBarModelMapperPrivate::removeData(int start, int end)
-{
- Q_UNUSED(end)
- Q_UNUSED(start)
- Q_UNUSED(end)
- // Currently barchart needs to be fully recalculated when change is made.
- // Re-initialize
- initializeBarFromModel();
-}
-
-void QBarModelMapperPrivate::barSetsAdded(QList<QBarSet *> sets)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (sets.count() == 0)
- return;
-
- int firstIndex = m_series->barSets().indexOf(sets.at(0));
- if (firstIndex == -1)
- return;
-
- int maxCount = 0;
- for (int i = 0; i < sets.count(); i++) {
- if (sets.at(i)->count() > m_count)
- maxCount = sets.at(i)->count();
- }
-
- if (m_count != -1 && m_count < maxCount)
- m_count = maxCount;
-
- m_lastBarSetSection += sets.count();
-
- blockModelSignals();
- int modelCapacity = m_orientation == Qt::Vertical ? m_model->rowCount() - m_first : m_model->columnCount() - m_first;
- if (maxCount > modelCapacity) {
- if (m_orientation == Qt::Vertical)
- m_model->insertRows(m_model->rowCount(), maxCount - modelCapacity);
- else
- m_model->insertColumns(m_model->columnCount(), maxCount - modelCapacity);
- }
-
- if (m_orientation == Qt::Vertical)
- m_model->insertColumns(firstIndex + m_firstBarSetSection, sets.count());
- else
- m_model->insertRows(firstIndex + m_firstBarSetSection, sets.count());
-
-
- for (int i = firstIndex + m_firstBarSetSection; i < firstIndex + m_firstBarSetSection + sets.count(); i++) {
- m_model->setHeaderData(i, m_orientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical, sets.at(i - firstIndex - m_firstBarSetSection)->label());
- for (int j = 0; j < sets.at(i - firstIndex - m_firstBarSetSection)->count(); j++)
- m_model->setData(barModelIndex(i, j), sets.at(i - firstIndex - m_firstBarSetSection)->at(j));
- }
- blockModelSignals(false);
- initializeBarFromModel();
-}
-
-void QBarModelMapperPrivate::barSetsRemoved(QList<QBarSet *> sets)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (sets.count() == 0)
- return;
-
- int firstIndex = m_barSets.indexOf(sets.at(0));
- if (firstIndex == -1)
- return;
-
- m_lastBarSetSection -= sets.count();
-
- for (int i = firstIndex + sets.count() - 1; i >= firstIndex; i--)
- m_barSets.removeAt(i);
-
- blockModelSignals();
- if (m_orientation == Qt::Vertical)
- m_model->removeColumns(firstIndex + m_firstBarSetSection, sets.count());
- else
- m_model->removeRows(firstIndex + m_firstBarSetSection, sets.count());
- blockModelSignals(false);
- initializeBarFromModel();
-}
-
-void QBarModelMapperPrivate::valuesAdded(int index, int count)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (m_count != -1)
- m_count += count;
-
- int barSetIndex = m_barSets.indexOf(qobject_cast<QBarSet *>(QObject::sender()));
-
- blockModelSignals();
- if (m_orientation == Qt::Vertical)
- m_model->insertRows(index + m_first, count);
- else
- m_model->insertColumns(index + m_first, count);
-
- for (int j = index; j < index + count; j++)
- m_model->setData(barModelIndex(barSetIndex + m_firstBarSetSection, j), m_barSets.at(barSetIndex)->at(j));
-
- blockModelSignals(false);
- initializeBarFromModel();
-}
-
-void QBarModelMapperPrivate::valuesRemoved(int index, int count)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (m_count != -1)
- m_count -= count;
-
- blockModelSignals();
- if (m_orientation == Qt::Vertical)
- m_model->removeRows(index + m_first, count);
- else
- m_model->removeColumns(index + m_first, count);
-
- blockModelSignals(false);
- initializeBarFromModel();
-}
-
-void QBarModelMapperPrivate::barLabelChanged()
-{
- if (m_seriesSignalsBlock)
- return;
-
- int barSetIndex = m_barSets.indexOf(qobject_cast<QBarSet *>(QObject::sender()));
-
- blockModelSignals();
- m_model->setHeaderData(barSetIndex + m_firstBarSetSection, m_orientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical, m_barSets.at(barSetIndex)->label());
- blockModelSignals(false);
- initializeBarFromModel();
-}
-
-void QBarModelMapperPrivate::barValueChanged(int index)
-{
- if (m_seriesSignalsBlock)
- return;
-
- int barSetIndex = m_barSets.indexOf(qobject_cast<QBarSet *>(QObject::sender()));
-
- blockModelSignals();
- m_model->setData(barModelIndex(barSetIndex + m_firstBarSetSection, index), m_barSets.at(barSetIndex)->at(index));
- blockModelSignals(false);
- initializeBarFromModel();
-}
-
-void QBarModelMapperPrivate::initializeBarFromModel()
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- blockSeriesSignals();
- // clear current content
- m_series->clear();
- m_barSets.clear();
-
- // create the initial bar sets
- for (int i = m_firstBarSetSection; i <= m_lastBarSetSection; i++) {
- int posInBar = 0;
- QModelIndex barIndex = barModelIndex(i, posInBar);
- // check if there is such model index
- if (barIndex.isValid()) {
- QBarSet *barSet = new QBarSet(m_model->headerData(i, m_orientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical).toString());
- while (barIndex.isValid()) {
- barSet->append(m_model->data(barIndex, Qt::DisplayRole).toDouble());
- posInBar++;
- barIndex = barModelIndex(i, posInBar);
- }
- connect(barSet, SIGNAL(valuesAdded(int,int)), this, SLOT(valuesAdded(int,int)));
- connect(barSet, SIGNAL(valuesRemoved(int,int)), this, SLOT(valuesRemoved(int,int)));
- connect(barSet, SIGNAL(valueChanged(int)), this, SLOT(barValueChanged(int)));
- connect(barSet, SIGNAL(labelChanged()), this, SLOT(barLabelChanged()));
- m_series->append(barSet);
- m_barSets.append(barSet);
- } else {
- break;
- }
- }
- blockSeriesSignals(false);
-}
-
-#include "moc_qbarmodelmapper.cpp"
-#include "moc_qbarmodelmapper_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/qbarmodelmapper.h b/src/barchart/qbarmodelmapper.h
deleted file mode 100644
index b8d3b16a..00000000
--- a/src/barchart/qbarmodelmapper.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBARMODELMAPPER_H
-#define QBARMODELMAPPER_H
-
-#include "qchartglobal.h"
-#include <QObject>
-
-class QAbstractItemModel;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarModelMapperPrivate;
-class QAbstractBarSeries;
-
-class QTCOMMERCIALCHART_EXPORT QBarModelMapper : public QObject
-{
- Q_OBJECT
-
-protected:
- explicit QBarModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QAbstractBarSeries *series() const;
- void setSeries(QAbstractBarSeries *series);
-
- int first() const;
- void setFirst(int first);
-
- int count() const;
- void setCount(int count);
-
- int firstBarSetSection() const;
- void setFirstBarSetSection(int firstBarSetSection);
-
- int lastBarSetSection() const;
- void setLastBarSetSection(int lastBarSetSection);
-
- Qt::Orientation orientation() const;
- void setOrientation(Qt::Orientation orientation);
-
-protected:
- QBarModelMapperPrivate * const d_ptr;
- Q_DECLARE_PRIVATE(QBarModelMapper)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARMODELMAPPER_H
diff --git a/src/barchart/qbarmodelmapper_p.h b/src/barchart/qbarmodelmapper_p.h
deleted file mode 100644
index d578a9d7..00000000
--- a/src/barchart/qbarmodelmapper_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QBARMODELMAPPER_P_H
-#define QBARMODELMAPPER_P_H
-
-#include <QObject>
-#include "qbarmodelmapper.h"
-
-class QModelIndex;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarSet;
-
-class QBarModelMapperPrivate : public QObject
-{
- Q_OBJECT
-public:
- explicit QBarModelMapperPrivate(QBarModelMapper *q);
-
-public Q_SLOTS:
- // for the model
- void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
- void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
- void modelRowsAdded(QModelIndex parent, int start, int end);
- void modelRowsRemoved(QModelIndex parent, int start, int end);
- void modelColumnsAdded(QModelIndex parent, int start, int end);
- void modelColumnsRemoved(QModelIndex parent, int start, int end);
- void handleModelDestroyed();
-
- // for the series
- void barSetsAdded(QList<QBarSet *> sets);
- void barSetsRemoved(QList<QBarSet *> sets);
- void valuesAdded(int index, int count);
- void valuesRemoved(int index, int count);
- void barLabelChanged();
- void barValueChanged(int index);
- void handleSeriesDestroyed();
-
- void initializeBarFromModel();
-
-private:
- QBarSet *barSet(QModelIndex index);
- QModelIndex barModelIndex(int barSection, int posInBar);
- void insertData(int start, int end);
- void removeData(int start, int end);
- void blockModelSignals(bool block = true);
- void blockSeriesSignals(bool block = true);
-
-private:
- QAbstractBarSeries *m_series;
- QList<QBarSet *> m_barSets;
- QAbstractItemModel *m_model;
- int m_first;
- int m_count;
- Qt::Orientation m_orientation;
- int m_firstBarSetSection;
- int m_lastBarSetSection;
- bool m_seriesSignalsBlock;
- bool m_modelSignalsBlock;
-
-private:
- QBarModelMapper *q_ptr;
- Q_DECLARE_PUBLIC(QBarModelMapper)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARMODELMAPPER_P_H
diff --git a/src/barchart/qbarset.cpp b/src/barchart/qbarset.cpp
deleted file mode 100644
index 7a320f95..00000000
--- a/src/barchart/qbarset.cpp
+++ /dev/null
@@ -1,678 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbarset.h"
-#include "qbarset_p.h"
-#include "charthelpers_p.h"
-#include "qchart_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QBarSet
- \inmodule Qt Charts
- \brief Building block for different bar charts.
-
- QBarSet represents one set of bars. Set of bars contains one data value for each category.
- First value of set is assumed to belong to first category, second to second category and so on.
- If set has fewer values than there are categories, then the missing values are assumed to be
- at the end of set. For missing values in middle of a set, numerical value of zero is used.
-
- \mainclass
-
- \sa QAbstractBarSeries, QBarSeries, QStackedBarSeries, QPercentBarSeries
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype BarSet
- \instantiates QBarSet
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/barset.qdocinc
-*/
-#else
-/*!
- \qmlclass BarSet QBarSet
-
- \include ../doc/src/barset.qdocinc
-*/
-#endif
-
-/*!
- \property QBarSet::label
- Defines the label of the bar set.
-*/
-/*!
- \qmlproperty string BarSet::label
- Defines the label of the bar set.
-*/
-
-/*!
- \property QBarSet::pen
- \brief Defines the pen used by the bar set.
-*/
-
-/*!
- \property QBarSet::brush
- \brief Defines the brush used by the bar set.
-*/
-
-/*!
- \qmlproperty QString BarSet::brushFilename
- The name of the file used as a brush for the set.
-*/
-
-/*!
- \property QBarSet::labelBrush
- \brief Defines the brush used by the bar set's label.
-*/
-
-/*!
- \property QBarSet::labelFont
- \brief Defines the font used by the bar set's label.
-*/
-
-/*!
- \qmlproperty Font BarSet::labelFont
- Defines the font used by the bar set's label.
-
- See the Qt documentation for more details of Font.
-*/
-
-/*!
- \property QBarSet::color
- The fill (brush) color of the bar set.
-*/
-/*!
- \qmlproperty color BarSet::color
- The fill (brush) color of the bar set.
-*/
-
-/*!
- \property QBarSet::borderColor
- The line (pen) color of the bar set.
-*/
-/*!
- \qmlproperty color BarSet::borderColor
- The line (pen) color of the bar set.
-*/
-
-/*!
- \qmlproperty real BarSet::borderWidth
- The width of the border line. By default the width is 2.0.
-*/
-
-/*!
- \property QBarSet::labelColor
- The text (label) color of the bar set.
-*/
-/*!
- \qmlproperty color BarSet::labelColor
- The text (label) color of the bar set.
-*/
-
-/*!
- \fn void QBarSet::clicked(int index)
-
- The signal is emitted if the user clicks with a mouse on top of bar set.
- Clicked bar inside set is indexed by \a index
-*/
-
-/*!
- \fn void QBarSet::hovered(bool status)
-
- The signal is emitted if mouse is hovered on top of bar set.
- Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set.
-*/
-
-/*!
- \fn void QBarSet::hovered(bool status, int index)
-
- The signal is emitted if mouse is hovered on top of bar set.
- Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set.
- Hovered bar inside the set is indexed by \a index.
-*/
-
-
-/*!
- \fn void QBarSet::labelChanged()
- This signal is emitted when the label of the bar set has changed.
- \sa label
-*/
-/*!
- \qmlsignal BarSet::onLabelChanged()
- This signal is emitted when the label of the bar set has changed.
-*/
-
-/*!
- \fn void QBarSet::penChanged()
- This signal is emitted when the pen of the bar set has changed.
- \sa pen
-*/
-
-/*!
- \fn void QBarSet::brushChanged()
- This signal is emitted when the brush of the bar set has changed.
- \sa brush
-*/
-
-/*!
- \fn void QBarSet::labelBrushChanged()
- This signal is emitted when the brush of the bar set's label has changed.
- \sa labelBrush
-*/
-
-/*!
- \fn void QBarSet::labelFontChanged()
- This signal is emitted when the font of the bar set's label has changed.
- \sa labelBrush
-*/
-
-/*!
- \fn void QBarSet::colorChanged(QColor)
- This signal is emitted when the fill (brush) color of the set has changed to \a color.
-*/
-/*!
- \qmlsignal BarSet::onColorChanged(color color)
- This signal is emitted when the fill (brush) color of the set has changed to \a color.
-*/
-
-/*!
- \fn void QBarSet::borderColorChanged(QColor)
- This signal is emitted when the line (pen) color of the set has changed to \a color.
-*/
-/*!
- \qmlsignal BarSet::onBorderColorChanged(color color)
- This signal is emitted when the line (pen) color of the set has changed to \a color.
-*/
-
-/*!
- \fn void QBarSet::labelColorChanged(QColor)
- This signal is emitted when the text (label) color of the set has changed to \a color.
-*/
-/*!
- \qmlsignal BarSet::onLabelColorChanged(color color)
- This signal is emitted when the text (label) color of the set has changed to \a color.
-*/
-
-/*!
- \fn void QBarSet::valuesAdded(int index, int count)
- This signal is emitted when new values have been added to the set.
- Parameter \a index indicates the position of the first inserted value.
- Parameter \a count is the number of inserted values.
- \sa append(), insert()
-*/
-/*!
- \qmlsignal BarSet::onValuesAdded(int index, int count)
- This signal is emitted when new values have been added to the set.
- Parameter \a index indicates the position of the first inserted value.
- Parameter \a count is the number of inserted values.
-*/
-
-/*!
- \fn void QBarSet::valuesRemoved(int index, int count)
- This signal is emitted values have been removed from the set.
- Parameter \a index indicates the position of the first removed value.
- Parameter \a count is the number of removed values.
- \sa remove()
-*/
-/*!
- \qmlsignal BarSet::onValuesRemoved(int index, int count)
- This signal is emitted values have been removed from the set.
- Parameter \a index indicates the position of the first removed value.
- Parameter \a count is the number of removed values.
-*/
-
-/*!
- \fn void QBarSet::valueChanged(int index)
- This signal is emitted values the value in the set has been modified.
- Parameter \a index indicates the position of the modified value.
- \sa at()
-*/
-/*!
- \qmlsignal BarSet::onValueChanged(int index)
- This signal is emitted values the value in the set has been modified.
- Parameter \a index indicates the position of the modified value.
-*/
-
-/*!
- \qmlproperty int BarSet::count
- The count of values on the bar set
-*/
-
-/*!
- \qmlproperty QVariantList BarSet::values
- The values of the bar set. You can set either a list of reals or a list of points as values. If you set a list of
- reals as values, the values are automatically completed to points by using the index of a value as it's
- x-coordinate. For example the following sets have equal values:
- \code
- myBarSet1.values = [0, 5, 1, 5];
- myBarSet2.values = [Qt.point(0, 0), Qt.point(1, 5), Qt.point(2, 1), Qt.point(3, 5)];
- \endcode
-*/
-
-/*!
- Constructs QBarSet with a label of \a label and with parent of \a parent.
-*/
-QBarSet::QBarSet(const QString label, QObject *parent)
- : QObject(parent),
- d_ptr(new QBarSetPrivate(label, this))
-{
-}
-
-/*!
- Destroys the bar set.
-*/
-QBarSet::~QBarSet()
-{
- // NOTE: d_ptr destroyed by QObject
-}
-
-/*!
- Sets new \a label for set.
-*/
-void QBarSet::setLabel(const QString label)
-{
- d_ptr->m_label = label;
- emit labelChanged();
-}
-
-/*!
- Returns label of the set.
-*/
-QString QBarSet::label() const
-{
- return d_ptr->m_label;
-}
-
-/*!
- Appends new value \a value to the end of set.
-*/
-void QBarSet::append(const qreal value)
-{
- // Convert to QPointF
- int index = d_ptr->m_values.count();
- d_ptr->append(QPointF(d_ptr->m_values.count(), value));
- emit valuesAdded(index, 1);
-}
-
-/*!
- Appends a list of reals to set. Works like append with single real value. The \a values in list
- are appended to end of bar set.
- \sa append()
-*/
-void QBarSet::append(const QList<qreal> &values)
-{
- int index = d_ptr->m_values.count();
- d_ptr->append(values);
- emit valuesAdded(index, values.count());
-}
-
-/*!
- Convenience operator. Same as append, with real \a value.
- \sa append()
-*/
-QBarSet &QBarSet::operator << (const qreal &value)
-{
- append(value);
- return *this;
-}
-
-/*!
- Inserts new \a value on the \a index position.
- The value that is currently at this postion is moved to position index + 1
- \sa remove()
-*/
-void QBarSet::insert(const int index, const qreal value)
-{
- d_ptr->insert(index, value);
- emit valuesAdded(index, 1);
-}
-
-/*!
- Removes \a count number of values from the set starting at \a index.
- \sa insert()
-*/
-void QBarSet::remove(const int index, const int count)
-{
- int removedCount = d_ptr->remove(index, count);
- if (removedCount > 0)
- emit valuesRemoved(index, removedCount);
- return;
-}
-
-/*!
- Sets a new value \a value to set, indexed by \a index.
-*/
-void QBarSet::replace(const int index, const qreal value)
-{
- if (index >= 0 && index < d_ptr->m_values.count()) {
- d_ptr->replace(index, value);
- emit valueChanged(index);
- }
-}
-
-
-/*!
- Returns value of set indexed by \a index.
- If the index is out of bounds 0.0 is returned.
-*/
-qreal QBarSet::at(const int index) const
-{
- if (index < 0 || index >= d_ptr->m_values.count())
- return 0;
- return d_ptr->m_values.at(index).y();
-}
-
-/*!
- Returns value of set indexed by \a index.
- If the index is out of bounds 0.0 is returned.
-*/
-qreal QBarSet::operator [](const int index) const
-{
- return at(index);
-}
-
-/*!
- Returns count of values in set.
-*/
-int QBarSet::count() const
-{
- return d_ptr->m_values.count();
-}
-
-/*!
- Returns sum of all values in the bar set.
-*/
-qreal QBarSet::sum() const
-{
- qreal total(0);
- for (int i = 0; i < d_ptr->m_values.count(); i++)
- total += d_ptr->m_values.at(i).y();
- return total;
-}
-
-/*!
- Sets pen for set. Bars of this set are drawn using \a pen
-*/
-void QBarSet::setPen(const QPen &pen)
-{
- if (d_ptr->m_pen != pen) {
- d_ptr->m_pen = pen;
- emit d_ptr->updatedBars();
- emit penChanged();
- }
-}
-
-/*!
- Returns pen of the set.
-*/
-QPen QBarSet::pen() const
-{
- if (d_ptr->m_pen == QChartPrivate::defaultPen())
- return QPen();
- else
- return d_ptr->m_pen;
-}
-
-/*!
- Sets brush for the set. Bars of this set are drawn using \a brush.
-*/
-void QBarSet::setBrush(const QBrush &brush)
-{
- if (d_ptr->m_brush != brush) {
- d_ptr->m_brush = brush;
- emit d_ptr->updatedBars();
- emit brushChanged();
- }
-}
-
-/*!
- Returns brush of the set.
-*/
-QBrush QBarSet::brush() const
-{
- if (d_ptr->m_brush == QChartPrivate::defaultBrush())
- return QBrush();
- else
- return d_ptr->m_brush;
-}
-
-/*!
- Sets \a brush of the values that are drawn on top of this bar set.
-*/
-void QBarSet::setLabelBrush(const QBrush &brush)
-{
- if (d_ptr->m_labelBrush != brush) {
- d_ptr->m_labelBrush = brush;
- emit d_ptr->updatedBars();
- emit labelBrushChanged();
- }
-}
-
-/*!
- Returns brush of the values that are drawn on top of this bar set.
-*/
-QBrush QBarSet::labelBrush() const
-{
- if (d_ptr->m_labelBrush == QChartPrivate::defaultBrush())
- return QBrush();
- else
- return d_ptr->m_labelBrush;
-}
-
-/*!
- Sets the \a font for values that are drawn on top of this bar set.
-*/
-void QBarSet::setLabelFont(const QFont &font)
-{
- if (d_ptr->m_labelFont != font) {
- d_ptr->m_labelFont = font;
- emit d_ptr->updatedBars();
- emit labelFontChanged();
- }
-
-}
-
-/*!
- Returns the pen for values that are drawn on top of this bar set.
-*/
-QFont QBarSet::labelFont() const
-{
- return d_ptr->m_labelFont;
-}
-
-/*!
- Returns the color of the brush of bar set.
-*/
-QColor QBarSet::color()
-{
- return brush().color();
-}
-
-/*!
- Sets the \a color of brush for this bar set.
-*/
-void QBarSet::setColor(QColor color)
-{
- QBrush b = brush();
- if ((b.color() != color) || (b.style() == Qt::NoBrush)) {
- b.setColor(color);
- if (b.style() == Qt::NoBrush) {
- // Set tyle to Qt::SolidPattern. (Default is Qt::NoBrush)
- // This prevents theme to override color defined in QML side:
- // BarSet { label: "Bob"; color:"red"; values: [1,2,3] }
- // The color must be obeyed, since user wanted it.
- b.setStyle(Qt::SolidPattern);
- }
- setBrush(b);
- emit colorChanged(color);
- }
-}
-
-/*!
- Returns the color of pen of this bar set.
-*/
-QColor QBarSet::borderColor()
-{
- return pen().color();
-}
-
-/*!
- Sets the color of pen for this bar set.
-*/
-void QBarSet::setBorderColor(QColor color)
-{
- QPen p = pen();
- if (p.color() != color) {
- p.setColor(color);
- setPen(p);
- emit borderColorChanged(color);
- }
-}
-
-/*!
- Returns the color of labels of this bar set.
-*/
-QColor QBarSet::labelColor()
-{
- return labelBrush().color();
-}
-
-/*!
- Sets the color of labels for this bar set.
-*/
-void QBarSet::setLabelColor(QColor color)
-{
- QBrush b = labelBrush();
- if (b == QBrush())
- b.setStyle(Qt::SolidPattern);
-
- if (b.color() != color) {
- b.setColor(color);
- setLabelBrush(b);
- emit labelColorChanged(color);
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QBarSetPrivate::QBarSetPrivate(const QString label, QBarSet *parent) : QObject(parent),
- q_ptr(parent),
- m_label(label),
- m_pen(QChartPrivate::defaultPen()),
- m_brush(QChartPrivate::defaultBrush()),
- m_labelBrush(QChartPrivate::defaultBrush())
-{
-}
-
-QBarSetPrivate::~QBarSetPrivate()
-{
-}
-
-void QBarSetPrivate::append(QPointF value)
-{
- if (isValidValue(value)) {
- m_values.append(value);
- emit restructuredBars();
- }
-}
-
-void QBarSetPrivate::append(QList<QPointF> values)
-{
- for (int i = 0; i < values.count(); i++) {
- if (isValidValue(values.at(i)))
- m_values.append(values.at(i));
- }
- emit restructuredBars();
-}
-
-void QBarSetPrivate::append(QList<qreal> values)
-{
- int index = m_values.count();
- for (int i = 0; i < values.count(); i++) {
- if (isValidValue(values.at(i))) {
- m_values.append(QPointF(index, values.at(i)));
- index++;
- }
- }
- emit restructuredBars();
-}
-
-void QBarSetPrivate::insert(const int index, const qreal value)
-{
- m_values.insert(index, QPointF(index, value));
- emit restructuredBars();
-}
-
-void QBarSetPrivate::insert(const int index, const QPointF value)
-{
- m_values.insert(index, value);
- emit restructuredBars();
-}
-
-int QBarSetPrivate::remove(const int index, const int count)
-{
- int removeCount = count;
-
- if ((index < 0) || (m_values.count() == 0))
- return 0; // Invalid index or not values in list, remove nothing.
- else if ((index + count) > m_values.count())
- removeCount = m_values.count() - index; // Trying to remove more items than list has. Limit amount to be removed.
-
- int c = 0;
- while (c < removeCount) {
- m_values.removeAt(index);
- c++;
- }
- emit restructuredBars();
- return removeCount;
-}
-
-void QBarSetPrivate::replace(const int index, const qreal value)
-{
- m_values.replace(index, QPointF(index, value));
- emit updatedLayout();
-}
-
-void QBarSetPrivate::replace(const int index, const QPointF value)
-{
- m_values.replace(index, value);
- emit updatedLayout();
-}
-
-qreal QBarSetPrivate::pos(const int index)
-{
- if (index < 0 || index >= m_values.count())
- return 0;
- return m_values.at(index).x();
-}
-
-qreal QBarSetPrivate::value(const int index)
-{
- if (index < 0 || index >= m_values.count())
- return 0;
- return m_values.at(index).y();
-}
-
-#include "moc_qbarset.cpp"
-#include "moc_qbarset_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/qbarset.h b/src/barchart/qbarset.h
deleted file mode 100644
index 1ce09c7e..00000000
--- a/src/barchart/qbarset.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBARSET_H
-#define QBARSET_H
-
-#include <qchartglobal.h>
-#include <QPen>
-#include <QBrush>
-#include <QFont>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QBarSetPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QBarSet : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
- Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
- Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged)
- Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
- Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
-
-public:
- explicit QBarSet(const QString label, QObject *parent = 0);
- virtual ~QBarSet();
-
- void setLabel(const QString label);
- QString label() const;
-
- void append(const qreal value);
- void append(const QList<qreal> &values);
-
- QBarSet &operator << (const qreal &value);
-
- void insert(const int index, const qreal value);
- void remove(const int index, const int count = 1);
- void replace(const int index, const qreal value);
- qreal at(const int index) const;
- qreal operator [](const int index) const;
- int count() const;
- qreal sum() const;
-
- void setPen(const QPen &pen);
- QPen pen() const;
-
- void setBrush(const QBrush &brush);
- QBrush brush() const;
-
- void setLabelBrush(const QBrush &brush);
- QBrush labelBrush() const;
-
- void setLabelFont(const QFont &font);
- QFont labelFont() const;
-
- QColor color();
- void setColor(QColor color);
-
- QColor borderColor();
- void setBorderColor(QColor color);
-
- QColor labelColor();
- void setLabelColor(QColor color);
-
-Q_SIGNALS:
- void clicked(int index);
- void hovered(bool status);
- void hovered(bool status, int index);
- void penChanged();
- void brushChanged();
- void labelChanged();
- void labelBrushChanged();
- void labelFontChanged();
- void colorChanged(QColor color);
- void borderColorChanged(QColor color);
- void labelColorChanged(QColor color);
-
- void valuesAdded(int index, int count);
- void valuesRemoved(int index, int count);
- void valueChanged(int index);
-
-private:
- QScopedPointer<QBarSetPrivate> d_ptr;
- Q_DISABLE_COPY(QBarSet)
- friend class QAbstractBarSeries;
- friend class BarLegendMarker;
- friend class AbstractBarChartItem;
- friend class QAbstractBarSeriesPrivate;
- friend class StackedBarChartItem;
- friend class PercentBarChartItem;
- friend class BarChartItem;
- friend class HorizontalBarChartItem;
- friend class HorizontalStackedBarChartItem;
- friend class HorizontalPercentBarChartItem;
- friend class BoxPlotChartItem;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARSET_H
diff --git a/src/barchart/qbarset_p.h b/src/barchart/qbarset_p.h
deleted file mode 100644
index 789a30a8..00000000
--- a/src/barchart/qbarset_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QBARSET_P_H
-#define QBARSET_P_H
-
-#include "qbarset.h"
-#include <QMap>
-#include <QPen>
-#include <QBrush>
-#include <QFont>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarSetPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QBarSetPrivate(const QString label, QBarSet *parent);
- ~QBarSetPrivate();
-
- void append(QPointF value);
- void append(QList<QPointF> values);
- void append(QList<qreal> values);
-
- void insert(const int index, const qreal value);
- void insert(const int index, const QPointF value);
- int remove(const int index, const int count);
-
- void replace(const int index, const qreal value);
- void replace(const int index, const QPointF value);
-
- qreal pos(const int index);
- qreal value(const int index);
-
-Q_SIGNALS:
- void restructuredBars();
- void updatedBars();
- void updatedLayout();
-
-public:
- QBarSet * const q_ptr;
- QString m_label;
- QList<QPointF> m_values;
- QPen m_pen;
- QBrush m_brush;
- QBrush m_labelBrush;
- QFont m_labelFont;
-
- friend class QBarSet;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARSETPRIVATE_P_H
diff --git a/src/barchart/qhbarmodelmapper.cpp b/src/barchart/qhbarmodelmapper.cpp
deleted file mode 100644
index 3aa1c8ec..00000000
--- a/src/barchart/qhbarmodelmapper.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qhbarmodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QHBarModelMapper
- \inmodule Qt Charts
- \brief Horizontal model mapper for bar series.
- \mainclass
-
- Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
- Horizontal model mapper is used to create a connection between QAbstractBarSeries and QAbstractItemModel derived model object.
- Model mapper maintains equal size of all the BarSets.
- Adding/removing value from the BarSet causes the the same change in the rest of the BarSets added to the same series.
- \note Used model has to support adding/removing rows/columns and modifying the data of the cells.
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype HBarModelMapper
- \instantiates QHBarModelMapper
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/hbarmodelmapper.qdocinc
-*/
-#else
-/*!
- \qmlclass HBarModelMapper QHBarModelMapper
-
- \include ../doc/src/hbarmodelmapper.qdocinc
-*/
-#endif
-
-/*!
- \property QHBarModelMapper::series
- \brief Defines the QPieSeries object that is used by the mapper.
-
- All the data in the series is discarded when it is set to the mapper.
- When new series is specified the old series is disconnected (it preserves its data)
-*/
-/*!
- \qmlproperty AbstractBarSeries HBarModelMapper::series
- Defines the AbstractBarSeries based object that is used by the mapper. All the data in the series is discarded when it is
- set to the mapper. When new series is specified the old series is disconnected (it preserves its data).
-*/
-
-/*!
- \property QHBarModelMapper::model
- \brief Defines the model that is used by the mapper.
-*/
-/*!
- \qmlproperty SomeModel HBarModelMapper::model
- The QAbstractItemModel based model that is used by the mapper. You need to implement the model
- and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
- the data of the cells.
-*/
-
-/*!
- \property QHBarModelMapper::firstBarSetRow
- \brief Defines which column of the model is used as the data source for the first bar set.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int HBarModelMapper::firstBarSetRow
- Defines which column of the model is used as the data source for the first bar set. The default value is -1
- (invalid mapping).
-*/
-
-/*!
- \property QHBarModelMapper::lastBarSetRow
- \brief Defines which column of the model is used as the data source for the last bar set.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int HBarModelMapper::lastBarSetRow
- Defines which column of the model is used as the data source for the last bar set. The default value is -1
- (invalid mapping).
-*/
-
-/*!
- \property QHBarModelMapper::firstColumn
- \brief Defines which column of the model contains the first values of the QBarSets in the series.
-
- Minimal and default value is: 0
-*/
-/*!
- \qmlproperty int HBarModelMapper::firstColumn
- Defines which column of the model contains the first values of the QBarSets in the series.
- The default value is 0.
-*/
-
-/*!
- \property QHBarModelMapper::columnCount
- \brief Defines the number of columns of the model that are mapped as the data for QAbstractBarSeries.
-
- Minimal and default value is: -1 (count limited by the number of columns in the model)
-*/
-/*!
- \qmlproperty int HBarModelMapper::columnCount
- Defines the number of columns of the model that are mapped as the data for QAbstractBarSeries. The default value is
- -1 (count limited by the number of columns in the model)
-*/
-
-/*!
- \fn void QHBarModelMapper::seriesReplaced()
-
- Emitted when the series to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QHBarModelMapper::modelReplaced()
-
- Emitted when the model to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QHBarModelMapper::firstBarSetRowChanged()
-
- Emitted when the firstBarSetRow has changed.
-*/
-
-/*!
- \fn void QHBarModelMapper::lastBarSetRowChanged()
-
- Emitted when the lastBarSetRow has changed.
-*/
-
-/*!
- \fn void QHBarModelMapper::firstColumnChanged()
- Emitted when the firstColumn has changed.
-*/
-
-/*!
- \fn void QHBarModelMapper::columnCountChanged()
- Emitted when the columnCount has changed.
-*/
-
-/*!
- Constructs a mapper object which is a child of \a parent.
-*/
-QHBarModelMapper::QHBarModelMapper(QObject *parent) :
- QBarModelMapper(parent)
-{
- QBarModelMapper::setOrientation(Qt::Horizontal);
-}
-
-QAbstractItemModel *QHBarModelMapper::model() const
-{
- return QBarModelMapper::model();
-}
-
-void QHBarModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model != QBarModelMapper::model()) {
- QBarModelMapper::setModel(model);
- emit modelReplaced();
- }
-}
-
-QAbstractBarSeries *QHBarModelMapper::series() const
-{
- return QBarModelMapper::series();
-}
-
-void QHBarModelMapper::setSeries(QAbstractBarSeries *series)
-{
- if (series != QBarModelMapper::series()) {
- QBarModelMapper::setSeries(series);
- emit seriesReplaced();
- }
-}
-
-int QHBarModelMapper::firstBarSetRow() const
-{
- return QBarModelMapper::firstBarSetSection();
-}
-
-void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow)
-{
- if (firstBarSetRow != firstBarSetSection()) {
- QBarModelMapper::setFirstBarSetSection(firstBarSetRow);
- emit firstBarSetRowChanged();
- }
-}
-
-int QHBarModelMapper::lastBarSetRow() const
-{
- return QBarModelMapper::lastBarSetSection();
-}
-
-void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow)
-{
- if (lastBarSetRow != lastBarSetSection()) {
- QBarModelMapper::setLastBarSetSection(lastBarSetRow);
- emit lastBarSetRowChanged();
- }
-}
-
-int QHBarModelMapper::firstColumn() const
-{
- return QBarModelMapper::first();
-}
-
-void QHBarModelMapper::setFirstColumn(int firstColumn)
-{
- if (firstColumn != first()) {
- QBarModelMapper::setFirst(firstColumn);
- emit firstColumnChanged();
- }
-}
-
-int QHBarModelMapper::columnCount() const
-{
- return QBarModelMapper::count();
-}
-
-void QHBarModelMapper::setColumnCount(int columnCount)
-{
- if (columnCount != count()) {
- QBarModelMapper::setCount(columnCount);
- emit columnCountChanged();
- }
-}
-
-#include "moc_qhbarmodelmapper.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/qhbarmodelmapper.h b/src/barchart/qhbarmodelmapper.h
deleted file mode 100644
index 03e84b5f..00000000
--- a/src/barchart/qhbarmodelmapper.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHBARMODELMAPPER_H
-#define QHBARMODELMAPPER_H
-
-#include <QBarModelMapper>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper
-{
- Q_OBJECT
- Q_PROPERTY(QAbstractBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
- Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
- Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow NOTIFY firstBarSetRowChanged)
- Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow NOTIFY lastBarSetRowChanged)
- Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged)
- Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
-
-public:
- explicit QHBarModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QAbstractBarSeries *series() const;
- void setSeries(QAbstractBarSeries *series);
-
- int firstBarSetRow() const;
- void setFirstBarSetRow(int firstBarSetRow);
-
- int lastBarSetRow() const;
- void setLastBarSetRow(int lastBarSetRow);
-
- int firstColumn() const;
- void setFirstColumn(int firstColumn);
-
- int columnCount() const;
- void setColumnCount(int columnCount);
-
-Q_SIGNALS:
- void seriesReplaced();
- void modelReplaced();
- void firstBarSetRowChanged();
- void lastBarSetRowChanged();
- void firstColumnChanged();
- void columnCountChanged();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QHBARMODELMAPPER_H
diff --git a/src/barchart/qvbarmodelmapper.cpp b/src/barchart/qvbarmodelmapper.cpp
deleted file mode 100644
index c32f5c91..00000000
--- a/src/barchart/qvbarmodelmapper.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvbarmodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QVBarModelMapper
- \inmodule Qt Charts
- \brief Vertical model mapper for bar series.
- \mainclass
-
- Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
- Vertical model mapper is used to create a connection between QAbstractBarSeries and QAbstractItemModel derived model object.
- Model mapper maintains equal size of all the BarSets.
- Adding/removing value from the BarSet causes the the same change in the rest of the BarSets added to the same series.
- \note Used model has to support adding/removing rows/columns and modifying the data of the cells.
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype VBarModelMapper
- \instantiates QVBarModelMapper
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/vbarmodelmapper.qdocinc
-*/
-#else
-/*!
- \qmlclass VBarModelMapper QVBarModelMapper
-
- \include ../doc/src/vbarmodelmapper.qdocinc
-*/
-#endif
-
-/*!
- \property QVBarModelMapper::series
- \brief Defines the QBarSeries object that is used by the mapper.
-
- All the data in the series is discarded when it is set to the mapper.
- When new series is specified the old series is disconnected (it preserves its data)
-*/
-/*!
- \qmlproperty AbstractBarSeries VBarModelMapper::series
- Defines the AbstractBarSeries based object that is used by the mapper. All the data in the series is discarded when it is
- set to the mapper. When new series is specified the old series is disconnected (it preserves its data).
-*/
-
-/*!
- \property QVBarModelMapper::model
- \brief Defines the model that is used by the mapper.
-*/
-/*!
- \qmlproperty SomeModel VBarModelMapper::model
- The QAbstractItemModel based model that is used by the mapper. You need to implement the model
- and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
- the data of the cells.
-*/
-
-/*!
- \property QVBarModelMapper::firstBarSetColumn
- \brief Defines which column of the model is used as the data source for the first bar set.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int VBarModelMapper::firstBarSetColumn
- Defines which column of the model is used as the data source for the first bar set. Default value
- is: -1 (invalid mapping).
-*/
-
-/*!
- \property QVBarModelMapper::lastBarSetColumn
- \brief Defines which column of the model is used as the data source for the last bar set.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int VBarModelMapper::lastBarSetColumn
- Defines which column of the model is used as the data source for the last bar set. Default
- value is: -1 (invalid mapping).
-*/
-
-/*!
- \property QVBarModelMapper::firstRow
- \brief Defines which row of the model contains the first values of the QBarSets in the series.
-
- Minimal and default value is: 0
-*/
-/*!
- \qmlproperty int VBarModelMapper::firstRow
- Defines which row of the model contains the first values of the QBarSets in the series.
- The default value is 0.
-*/
-
-/*!
- \property QVBarModelMapper::rowCount
- \brief Defines the number of rows of the model that are mapped as the data for QAbstractBarSeries.
-
- Minimal and default value is: -1 (count limited by the number of rows in the model)
-*/
-/*!
- \qmlproperty int VBarModelMapper::rowCount
- Defines the number of rows of the model that are mapped as the data for QAbstractBarSeries. The default value is
- -1 (count limited by the number of rows in the model)
-*/
-
-/*!
- \fn void QVBarModelMapper::seriesReplaced()
-
- Emitted when the series to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QVBarModelMapper::modelReplaced()
-
- Emitted when the model to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QVBarModelMapper::firstBarSetColumnChanged()
- Emitted when the firstBarSetColumn has changed.
-*/
-
-/*!
- \fn void QVBarModelMapper::lastBarSetColumnChanged()
- Emitted when the lastBarSetColumn has changed.
-*/
-
-/*!
- \fn void QVBarModelMapper::firstRowChanged()
- Emitted when the firstRow has changed.
-*/
-
-/*!
- \fn void QVBarModelMapper::rowCountChanged()
- Emitted when the rowCount has changed.
-*/
-
-/*!
- Constructs a mapper object which is a child of \a parent.
-*/
-QVBarModelMapper::QVBarModelMapper(QObject *parent) :
- QBarModelMapper(parent)
-{
- QBarModelMapper::setOrientation(Qt::Vertical);
-}
-
-QAbstractItemModel *QVBarModelMapper::model() const
-{
- return QBarModelMapper::model();
-}
-
-void QVBarModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model != QBarModelMapper::model()) {
- QBarModelMapper::setModel(model);
- emit modelReplaced();
- }
-}
-
-QAbstractBarSeries *QVBarModelMapper::series() const
-{
- return QBarModelMapper::series();
-}
-
-void QVBarModelMapper::setSeries(QAbstractBarSeries *series)
-{
- if (series != QBarModelMapper::series()) {
- QBarModelMapper::setSeries(series);
- emit seriesReplaced();
- }
-}
-
-int QVBarModelMapper::firstBarSetColumn() const
-{
- return QBarModelMapper::firstBarSetSection();
-}
-
-void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn)
-{
- if (firstBarSetColumn != firstBarSetSection()) {
- QBarModelMapper::setFirstBarSetSection(firstBarSetColumn);
- emit firstBarSetColumnChanged();
- }
-}
-
-int QVBarModelMapper::lastBarSetColumn() const
-{
- return QBarModelMapper::lastBarSetSection();
-}
-
-void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn)
-{
- if (lastBarSetColumn != lastBarSetSection()) {
- QBarModelMapper::setLastBarSetSection(lastBarSetColumn);
- emit lastBarSetColumnChanged();
- }
-}
-
-int QVBarModelMapper::firstRow() const
-{
- return QBarModelMapper::first();
-}
-
-void QVBarModelMapper::setFirstRow(int firstRow)
-{
- if (firstRow != first()) {
- QBarModelMapper::setFirst(firstRow);
- emit firstRowChanged();
- }
-}
-
-int QVBarModelMapper::rowCount() const
-{
- return QBarModelMapper::count();
-}
-
-void QVBarModelMapper::setRowCount(int rowCount)
-{
- if (rowCount != count()) {
- QBarModelMapper::setCount(rowCount);
- emit rowCountChanged();
- }
-}
-
-#include "moc_qvbarmodelmapper.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/qvbarmodelmapper.h b/src/barchart/qvbarmodelmapper.h
deleted file mode 100644
index 1fd377d1..00000000
--- a/src/barchart/qvbarmodelmapper.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVBARMODELMAPPER_H
-#define QVBARMODELMAPPER_H
-
-#include <QBarModelMapper>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper
-{
- Q_OBJECT
- Q_PROPERTY(QAbstractBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
- Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
- Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn NOTIFY firstBarSetColumnChanged)
- Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn NOTIFY lastBarSetColumnChanged)
- Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
- Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
-
-public:
- explicit QVBarModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QAbstractBarSeries *series() const;
- void setSeries(QAbstractBarSeries *series);
-
- int firstBarSetColumn() const;
- void setFirstBarSetColumn(int firstBarSetColumn);
-
- int lastBarSetColumn() const;
- void setLastBarSetColumn(int lastBarSetColumn);
-
- int firstRow() const;
- void setFirstRow(int firstRow);
-
- int rowCount() const;
- void setRowCount(int rowCount);
-
-Q_SIGNALS:
- void seriesReplaced();
- void modelReplaced();
- void firstBarSetColumnChanged();
- void lastBarSetColumnChanged();
- void firstRowChanged();
- void rowCountChanged();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QVBARMODELMAPPER_H
diff --git a/src/barchart/vertical/bar/barchartitem.cpp b/src/barchart/vertical/bar/barchartitem.cpp
deleted file mode 100644
index 9a57325a..00000000
--- a/src/barchart/vertical/bar/barchartitem.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "barchartitem_p.h"
-#include "bar_p.h"
-#include "qabstractbarseries_p.h"
-#include "qbarset.h"
-#include "qbarset_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-BarChartItem::BarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) :
- AbstractBarChartItem(series, item)
-{
- connect(series, SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)),
- this, SLOT(handleLabelsPositionChanged()));
- connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(positionLabels()));
-}
-
-void BarChartItem::initializeLayout()
-{
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- m_layout.clear();
- for(int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- QRectF rect;
- QPointF topLeft;
- QPointF bottomRight;
-
- if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
- topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + set/setCount * barWidth, domain()->minY()), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/setCount * barWidth, domain()->minY()), m_validData);
- } else {
- topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + set/setCount * barWidth, 0), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/setCount * barWidth, 0), m_validData);
- }
-
- if (!m_validData)
- return;
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- m_layout.append(rect.normalized());
- }
- }
-}
-
-QVector<QRectF> BarChartItem::calculateLayout()
-{
- QVector<QRectF> layout;
-
- // Use temporary qreals for accuracy
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- for(int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- qreal value = m_series->barSets().at(set)->at(category);
- QRectF rect;
- QPointF topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set)/(setCount) * barWidth, value), m_validData);
- QPointF bottomRight;
- if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
- bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/(setCount) * barWidth, domain()->minY()), m_validData);
- else
- bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/(setCount) * barWidth, 0), m_validData);
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- layout.append(rect.normalized());
- }
- }
-
- return layout;
-}
-
-void BarChartItem::handleLabelsPositionChanged()
-{
- positionLabels();
-}
-
-void BarChartItem::positionLabels()
-{
- for (int i = 0; i < m_layout.count(); i++) {
- QGraphicsTextItem *label = m_labels.at(i);
- qreal xPos = m_layout.at(i).center().x() - label->boundingRect().center().x();
- qreal yPos = 0;
-
- int offset = m_bars.at(i)->pen().width() / 2 + 2;
- if (m_series->labelsPosition() == QAbstractBarSeries::LabelsCenter)
- yPos = m_layout.at(i).center().y() - label->boundingRect().center().y();
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideEnd)
- yPos = m_layout.at(i).top() - offset;
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideBase)
- yPos = m_layout.at(i).bottom() - label->boundingRect().height() + offset;
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsOutsideEnd)
- yPos = m_layout.at(i).top() - label->boundingRect().height() + offset;
-
- label->setPos(xPos, yPos);
- label->setZValue(zValue() + 1);
- }
-}
-
-#include "moc_barchartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/vertical/bar/barchartitem_p.h b/src/barchart/vertical/bar/barchartitem_p.h
deleted file mode 100644
index b94e9c34..00000000
--- a/src/barchart/vertical/bar/barchartitem_p.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-
-#ifndef BARCHARTITEM_H
-#define BARCHARTITEM_H
-
-#include "abstractbarchartitem_p.h"
-#include "qstackedbarseries.h"
-#include <QGraphicsItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class BarChartItem : public AbstractBarChartItem
-{
- Q_OBJECT
-public:
- BarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
-
-private slots:
- void handleLabelsPositionChanged();
- void positionLabels();
-
-private:
- virtual QVector<QRectF> calculateLayout();
- void initializeLayout();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // BARCHARTITEM_H
diff --git a/src/barchart/vertical/bar/qbarseries.cpp b/src/barchart/vertical/bar/qbarseries.cpp
deleted file mode 100644
index 780f5837..00000000
--- a/src/barchart/vertical/bar/qbarseries.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbarseries.h"
-#include "qbarseries_p.h"
-#include "barchartitem_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "qvalueaxis.h"
-#include "qbarcategoryaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QBarSeries
- \inmodule Qt Charts
- \brief Series for creating bar chart.
- \mainclass
-
- QBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
- as groups, where bars in same category are grouped next to each other. QBarSeries groups the data
- from sets to categories, which are defined by a QStringList.
-
- See the \l {BarChart Example} {bar chart example} to learn how to create a grouped bar chart.
- \image examples_barchart.png
-
- \sa QBarSet, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype BarSeries
- \instantiates QBarSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/barseries.qdocinc
-*/
-#else
-/*!
- \qmlclass BarSeries QBarSeries
-
- \include ../doc/src/barseries.qdocinc
-*/
-#endif
-
-/*!
- Constructs empty QBarSeries.
- QBarSeries is QObject which is a child of a \a parent.
-*/
-QBarSeries::QBarSeries(QObject *parent)
- : QAbstractBarSeries(*new QBarSeriesPrivate(this), parent)
-{
-
-}
-
-/*!
- Returns QAbstractSeries::SeriesTypeBar.
-*/
-QAbstractSeries::SeriesType QBarSeries::type() const
-{
- return QAbstractSeries::SeriesTypeBar;
-}
-
-/*!
- Destructor. Removes series from chart.
-*/
-QBarSeries::~QBarSeries()
-{
- Q_D(QBarSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) : QAbstractBarSeriesPrivate(q)
-{
-
-}
-
-void QBarSeriesPrivate::initializeDomain()
-{
- qreal minX(domain()->minX());
- qreal minY(domain()->minY());
- qreal maxX(domain()->maxX());
- qreal maxY(domain()->maxY());
-
- qreal x = categoryCount();
- minX = qMin(minX, - (qreal)0.5);
- minY = qMin(minY, min());
- maxX = qMax(maxX, x - (qreal)0.5);
- maxY = qMax(maxY, max());
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-
-void QBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QBarSeries);
- BarChartItem *bar = new BarChartItem(q,parent);
- m_item.reset(bar);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-#include "moc_qbarseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/barchart/vertical/bar/qbarseries.h b/src/barchart/vertical/bar/qbarseries.h
deleted file mode 100644
index 4e38543e..00000000
--- a/src/barchart/vertical/bar/qbarseries.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBARSERIES_H
-#define QBARSERIES_H
-
-#include <qabstractbarseries.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QBarSeries : public QAbstractBarSeries
-{
- Q_OBJECT
-public:
- explicit QBarSeries(QObject *parent = 0);
- ~QBarSeries();
- QAbstractSeries::SeriesType type() const;
-
-private:
- Q_DECLARE_PRIVATE(QBarSeries)
- Q_DISABLE_COPY(QBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARSERIES_H
diff --git a/src/barchart/vertical/bar/qbarseries_p.h b/src/barchart/vertical/bar/qbarseries_p.h
deleted file mode 100644
index e6d3a8a7..00000000
--- a/src/barchart/vertical/bar/qbarseries_p.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QBARSERIES_P_H
-#define QBARSERIES_P_H
-
-#include "qabstractbarseries_p.h"
-#include "abstractdomain_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-
-class QBarSeriesPrivate: public QAbstractBarSeriesPrivate
-{
-public:
- QBarSeriesPrivate(QBarSeries *q);
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain();
-
-private:
- Q_DECLARE_PUBLIC(QBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARSERIES_P_H
diff --git a/src/barchart/vertical/percent/percentbarchartitem.cpp b/src/barchart/vertical/percent/percentbarchartitem.cpp
deleted file mode 100644
index d5a8430b..00000000
--- a/src/barchart/vertical/percent/percentbarchartitem.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "percentbarchartitem_p.h"
-#include "bar_p.h"
-#include "qabstractbarseries_p.h"
-#include "qbarset.h"
-#include "qbarset_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PercentBarChartItem::PercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) :
- AbstractBarChartItem(series, item)
-{
- connect(series, SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)),
- this, SLOT(handleLabelsPositionChanged()));
- connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(positionLabels()));
-}
-
-void PercentBarChartItem::initializeLayout()
-{
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- m_layout.clear();
- for(int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- QRectF rect;
- QPointF topLeft;
- QPointF bottomRight;
-
- if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
- topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, domain()->minY()), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, domain()->minY()), m_validData);
- } else {
- topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, 0), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, 0), m_validData);
- }
-
- if (!m_validData)
- return;
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- m_layout.append(rect.normalized());
- }
- }
-}
-
-QVector<QRectF> PercentBarChartItem::calculateLayout()
-{
- QVector<QRectF> layout;
-
- // Use temporary qreals for accuracy
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- for(int category = 0; category < categoryCount; category++) {
- qreal sum = 0;
- qreal categorySum = m_series->d_func()->categorySum(category);
- for (int set = 0; set < setCount; set++) {
- qreal value = m_series->barSets().at(set)->at(category);
- QRectF rect;
- qreal topY = 0;
- qreal newSum = value + sum;
- if (newSum > 0)
- topY = 100 * newSum / categorySum;
- qreal bottomY = 0;
- if (sum > 0)
- bottomY = 100 * sum / categorySum;
- QPointF topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth/2, topY), m_validData);
- QPointF bottomRight;
- if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
- bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth/2, set ? bottomY : domain()->minY()), m_validData);
- else
- bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth/2, set ? bottomY : 0), m_validData);
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- layout.append(rect.normalized());
- sum = newSum;
- }
- }
- return layout;
-}
-
-void PercentBarChartItem::handleUpdatedBars()
-{
- // Handle changes in pen, brush, labels etc.
- int categoryCount = m_series->d_func()->categoryCount();
- int setCount = m_series->count();
- int itemIndex(0);
- static const QString valueTag(QLatin1String("@value"));
-
- for (int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- QBarSetPrivate *barSet = m_series->d_func()->barsetAt(set)->d_ptr.data();
- Bar *bar = m_bars.at(itemIndex);
- bar->setPen(barSet->m_pen);
- bar->setBrush(barSet->m_brush);
- bar->update();
-
- QGraphicsTextItem *label = m_labels.at(itemIndex);
- qreal p = m_series->d_func()->percentageAt(set, category) * 100.0;
- QString vString(presenter()->numberToString(p, 'f', 0));
- QString valueLabel;
- if (m_series->labelsFormat().isEmpty()) {
- vString.append("%");
- valueLabel = vString;
- } else {
- valueLabel = m_series->labelsFormat();
- valueLabel.replace(valueTag, vString);
- }
- label->setHtml(valueLabel);
- label->setFont(barSet->m_labelFont);
- label->setDefaultTextColor(barSet->m_labelBrush.color());
- label->update();
- itemIndex++;
- }
- }
-}
-
-void PercentBarChartItem::handleLabelsPositionChanged()
-{
- positionLabels();
-}
-
-void PercentBarChartItem::positionLabels()
-{
- for (int i = 0; i < m_layout.count(); i++) {
- QGraphicsTextItem *label = m_labels.at(i);
- qreal xPos = m_layout.at(i).center().x() - label->boundingRect().center().x();
- qreal yPos = 0;
-
- int offset = m_bars.at(i)->pen().width() / 2 + 2;
- if (m_series->labelsPosition() == QAbstractBarSeries::LabelsCenter)
- yPos = m_layout.at(i).center().y() - label->boundingRect().center().y();
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideEnd)
- yPos = m_layout.at(i).top() - offset;
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideBase)
- yPos = m_layout.at(i).bottom() - label->boundingRect().height() + offset;
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsOutsideEnd)
- yPos = m_layout.at(i).top() - label->boundingRect().height() + offset;
-
- label->setPos(xPos, yPos);
- label->setZValue(zValue() + 1);
- }
-}
-
-#include "moc_percentbarchartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/vertical/percent/percentbarchartitem_p.h b/src/barchart/vertical/percent/percentbarchartitem_p.h
deleted file mode 100644
index da9fb897..00000000
--- a/src/barchart/vertical/percent/percentbarchartitem_p.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-
-#ifndef PERCENTBARCHARTITEM_H
-#define PERCENTBARCHARTITEM_H
-
-#include "abstractbarchartitem_p.h"
-#include <QGraphicsItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractBarSeries;
-
-class PercentBarChartItem : public AbstractBarChartItem
-{
- Q_OBJECT
-public:
- PercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
- void handleUpdatedBars();
-
-private slots:
- void handleLabelsPositionChanged();
- void positionLabels();
-
-private:
- virtual QVector<QRectF> calculateLayout();
- void initializeLayout();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // PERCENTBARCHARTITEM_H
diff --git a/src/barchart/vertical/percent/qpercentbarseries.cpp b/src/barchart/vertical/percent/qpercentbarseries.cpp
deleted file mode 100644
index 2fde3658..00000000
--- a/src/barchart/vertical/percent/qpercentbarseries.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpercentbarseries.h"
-#include "qpercentbarseries_p.h"
-#include "percentbarchartitem_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "qvalueaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QPercentBarSeries
- \inmodule Qt Charts
- \brief Series for creating percent bar chart.
- \mainclass
-
- QPercentBarSeries represents a series of data shown as bars. The purpose of this class is to
- draw bars as stacks, where each bar is shown as percentage of all bars in that category.
- QPercentBarSeries groups the data from sets to categories, which are defined by a QStringList.
- Bars with zero value are not drawn.
-
- See the \l {PercentbarChart Example} {percent bar chart example} to learn how to create a
- percent bar chart.
- \image examples_percentbarchart.png
-
- \sa QBarSet, QStackedBarSeries, QAbstractBarSeries
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype PercentBarSeries
- \instantiates QPercentBarSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/persentbarseries.qdocinc
-*/
-#else
-/*!
- \qmlclass PercentBarSeries QPercentBarSeries
-
- \include ../doc/src/persentbarseries.qdocinc
-*/
-#endif
-
-/*!
- Constructs empty QPercentBarSeries.
- QPercentBarSeries is QObject which is a child of a \a parent.
-*/
-QPercentBarSeries::QPercentBarSeries(QObject *parent)
- : QAbstractBarSeries(*new QPercentBarSeriesPrivate(this), parent)
-{
-}
-
-/*!
- Destructor. Removes series from chart.
-*/
-QPercentBarSeries::~QPercentBarSeries()
-{
- Q_D(QPercentBarSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-
-/*!
- Returns QAbstractSeries::SeriesTypePercentBar.
-*/
-QAbstractSeries::SeriesType QPercentBarSeries::type() const
-{
- return QAbstractSeries::SeriesTypePercentBar;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QPercentBarSeriesPrivate::QPercentBarSeriesPrivate(QPercentBarSeries *q) : QAbstractBarSeriesPrivate(q)
-{
-
-}
-
-void QPercentBarSeriesPrivate::initializeDomain()
-{
- qreal minX(domain()->minX());
- qreal minY(domain()->minY());
- qreal maxX(domain()->maxX());
- qreal maxY(domain()->maxY());
-
- qreal x = categoryCount();
- minX = qMin(minX, - (qreal)0.5);
- maxX = qMax(maxX, x - (qreal)0.5);
- minY = 0;
- maxY = 100;
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-
-void QPercentBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QPercentBarSeries);
- PercentBarChartItem *bar = new PercentBarChartItem(q,parent);
- m_item.reset(bar);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-#include "moc_qpercentbarseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/barchart/vertical/percent/qpercentbarseries.h b/src/barchart/vertical/percent/qpercentbarseries.h
deleted file mode 100644
index d6745771..00000000
--- a/src/barchart/vertical/percent/qpercentbarseries.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPERCENTBARSERIES_H
-#define QPERCENTBARSERIES_H
-
-#include <QStringList>
-#include <qabstractbarseries.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QPercentBarSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QPercentBarSeries : public QAbstractBarSeries
-{
- Q_OBJECT
-public:
- explicit QPercentBarSeries(QObject *parent = 0);
- ~QPercentBarSeries();
- QAbstractSeries::SeriesType type() const;
-
-private:
- Q_DECLARE_PRIVATE(QPercentBarSeries)
- Q_DISABLE_COPY(QPercentBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QPERCENTBARSERIES_H
diff --git a/src/barchart/vertical/percent/qpercentbarseries_p.h b/src/barchart/vertical/percent/qpercentbarseries_p.h
deleted file mode 100644
index 1ab08430..00000000
--- a/src/barchart/vertical/percent/qpercentbarseries_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QPERCENTBARSERIES_P_H
-#define QPERCENTBARSERIES_P_H
-
-#include "qabstractbarseries_p.h"
-#include "abstractdomain_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-
-class QPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
-{
-public:
- QPercentBarSeriesPrivate(QPercentBarSeries *q);
- void initializeDomain();
- void initializeGraphics(QGraphicsItem* parent);
-private:
- Q_DECLARE_PUBLIC(QPercentBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/barchart/vertical/stacked/qstackedbarseries.cpp b/src/barchart/vertical/stacked/qstackedbarseries.cpp
deleted file mode 100644
index 6ca42806..00000000
--- a/src/barchart/vertical/stacked/qstackedbarseries.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qstackedbarseries.h"
-#include "qstackedbarseries_p.h"
-#include "stackedbarchartitem_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "qvalueaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QStackedBarSeries
- \inmodule Qt Charts
- \brief Series for creating stacked bar chart.
- \mainclass
-
- QStackedBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
- as stacks, where bars in same category are stacked on top of each other.
- QStackedBarSeries groups the data from sets to categories, which are defined by QStringList.
-
- See the \l {StackedbarChart Example} {stacked bar chart example} to learn how to create a stacked bar chart.
- \image examples_stackedbarchart.png
-
- \sa QBarSet, QPercentBarSeries, QAbstractBarSeries
-*/
-
-#ifdef QDOC_QT5
-/*!
- \qmltype StackedBarSeries
- \instantiates QStackedBarSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/stackedbarseries.qdocinc
-*/
-#else
-/*!
- \qmlclass StackedBarSeries QStackedBarSeries
-
- \include ../doc/src/stackedbarseries.qdocinc
-*/
-#endif
-
-/*!
- Constructs empty QStackedBarSeries.
- QStackedBarSeries is QObject which is a child of a \a parent.
-*/
-QStackedBarSeries::QStackedBarSeries(QObject *parent)
- : QAbstractBarSeries(*new QStackedBarSeriesPrivate(this), parent)
-{
-}
-
-/*!
- Destructor. Removes series from chart.
-*/
-QStackedBarSeries::~QStackedBarSeries()
-{
- Q_D(QStackedBarSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-/*!
- Returns QAbstractSeries::SeriesTypeStackedBar.
-*/
-QAbstractSeries::SeriesType QStackedBarSeries::type() const
-{
- return QAbstractSeries::SeriesTypeStackedBar;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QStackedBarSeriesPrivate::QStackedBarSeriesPrivate(QStackedBarSeries *q) : QAbstractBarSeriesPrivate(q)
-{
-
-}
-
-void QStackedBarSeriesPrivate::initializeDomain()
-{
- qreal minX(domain()->minX());
- qreal minY(domain()->minY());
- qreal maxX(domain()->maxX());
- qreal maxY(domain()->maxY());
-
- qreal x = categoryCount();
- minX = qMin(minX, - (qreal)0.5);
- minY = qMin(minY, bottom());
- maxX = qMax(maxX, x - (qreal)0.5);
- maxY = qMax(maxY, top());
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-void QStackedBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QStackedBarSeries);
- StackedBarChartItem *bar = new StackedBarChartItem(q,parent);
- m_item.reset(bar);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-#include "moc_qstackedbarseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/barchart/vertical/stacked/qstackedbarseries.h b/src/barchart/vertical/stacked/qstackedbarseries.h
deleted file mode 100644
index ca262e03..00000000
--- a/src/barchart/vertical/stacked/qstackedbarseries.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSTACKEDBARSERIES_H
-#define QSTACKEDBARSERIES_H
-
-#include <QStringList>
-#include <qabstractbarseries.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QStackedBarSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QStackedBarSeries : public QAbstractBarSeries
-{
- Q_OBJECT
-public:
- explicit QStackedBarSeries(QObject *parent = 0);
- ~QStackedBarSeries();
- QAbstractSeries::SeriesType type() const;
-
-private:
- Q_DECLARE_PRIVATE(QStackedBarSeries)
- Q_DISABLE_COPY(QStackedBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QSTACKEDBARSERIES_H
diff --git a/src/barchart/vertical/stacked/qstackedbarseries_p.h b/src/barchart/vertical/stacked/qstackedbarseries_p.h
deleted file mode 100644
index 99e0934a..00000000
--- a/src/barchart/vertical/stacked/qstackedbarseries_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QSTACKEDBARSERIES_P_H
-#define QSTACKEDBARSERIES_P_H
-
-#include "qabstractbarseries_p.h"
-#include "abstractdomain_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-
-class QStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate
-{
-public:
- QStackedBarSeriesPrivate(QStackedBarSeries *q);
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain();
-private:
- Q_DECLARE_PUBLIC(QStackedBarSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/barchart/vertical/stacked/stackedbarchartitem.cpp b/src/barchart/vertical/stacked/stackedbarchartitem.cpp
deleted file mode 100644
index 72bc650a..00000000
--- a/src/barchart/vertical/stacked/stackedbarchartitem.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "stackedbarchartitem_p.h"
-#include "bar_p.h"
-#include "qbarset_p.h"
-#include "qabstractbarseries_p.h"
-#include "qbarset.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-StackedBarChartItem::StackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) :
- AbstractBarChartItem(series, item)
-{
- connect(series, SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)),
- this, SLOT(handleLabelsPositionChanged()));
- connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(positionLabels()));
-}
-
-void StackedBarChartItem::initializeLayout()
-{
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- m_layout.clear();
- for(int category = 0; category < categoryCount; category++) {
- for (int set = 0; set < setCount; set++) {
- QRectF rect;
- QPointF topLeft;
- QPointF bottomRight;
-
- if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
- topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, domain()->minY()), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, domain()->minY()), m_validData);
- } else {
- topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, 0), m_validData);
- bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, 0), m_validData);
- }
-
- if (!m_validData)
- return;
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- m_layout.append(rect.normalized());
- }
- }
-}
-
-QVector<QRectF> StackedBarChartItem::calculateLayout()
-{
- QVector<QRectF> layout;
- // Use temporary qreals for accuracy
- qreal categoryCount = m_series->d_func()->categoryCount();
- qreal setCount = m_series->count();
- qreal barWidth = m_series->d_func()->barWidth();
-
- for(int category = 0; category < categoryCount; category++) {
- qreal positiveSum = 0;
- qreal negativeSum = 0;
- for (int set = 0; set < setCount; set++) {
- qreal value = m_series->barSets().at(set)->at(category);
- QRectF rect;
- QPointF topLeft;
- QPointF bottomRight;
- if (value < 0) {
- bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, value + negativeSum), m_validData);
- if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
- topLeft = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, set ? negativeSum : domain()->minY()), m_validData);
- else
- topLeft = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, set ? negativeSum : 0), m_validData);
- negativeSum += value;
- } else {
- topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, value + positiveSum), m_validData);
- if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
- bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, set ? positiveSum : domain()->minY()), m_validData);
- else
- bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, set ? positiveSum : 0), m_validData);
- positiveSum += value;
- }
-
- rect.setTopLeft(topLeft);
- rect.setBottomRight(bottomRight);
- layout.append(rect.normalized());
- }
- }
- return layout;
-}
-
-void StackedBarChartItem::handleLabelsPositionChanged()
-{
- positionLabels();
-}
-
-void StackedBarChartItem::positionLabels()
-{
- for (int i = 0; i < m_layout.count(); i++) {
- QGraphicsTextItem *label = m_labels.at(i);
- qreal xPos = m_layout.at(i).center().x() - label->boundingRect().center().x();
- qreal yPos = 0;
-
- int offset = m_bars.at(i)->pen().width() / 2 + 2;
- if (m_series->labelsPosition() == QAbstractBarSeries::LabelsCenter)
- yPos = m_layout.at(i).center().y() - label->boundingRect().center().y();
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideEnd)
- yPos = m_layout.at(i).top() - offset;
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideBase)
- yPos = m_layout.at(i).bottom() - label->boundingRect().height() + offset;
- else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsOutsideEnd)
- yPos = m_layout.at(i).top() - label->boundingRect().height() + offset;
-
- label->setPos(xPos, yPos);
- label->setZValue(zValue() + 1);
- }
-}
-
-#include "moc_stackedbarchartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/barchart/vertical/stacked/stackedbarchartitem_p.h b/src/barchart/vertical/stacked/stackedbarchartitem_p.h
deleted file mode 100644
index f6f645a0..00000000
--- a/src/barchart/vertical/stacked/stackedbarchartitem_p.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-
-#ifndef STACKEDBARCHARTITEM_H
-#define STACKEDBARCHARTITEM_H
-
-#include "abstractbarchartitem_p.h"
-#include "qstackedbarseries.h"
-#include <QGraphicsItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class StackedBarChartItem : public AbstractBarChartItem
-{
- Q_OBJECT
-public:
- StackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item =0);
-
-private slots:
- void handleLabelsPositionChanged();
- void positionLabels();
-
-private:
- virtual QVector<QRectF> calculateLayout();
- void initializeLayout();
-
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // STACKEDBARCHARTITEM_H
diff --git a/src/boxplotchart/boxplotchartitem.cpp b/src/boxplotchart/boxplotchartitem.cpp
deleted file mode 100644
index 430e903b..00000000
--- a/src/boxplotchart/boxplotchartitem.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "boxplotchartitem_p.h"
-#include "qboxplotseries_p.h"
-#include "bar_p.h"
-#include "qboxset_p.h"
-#include "qabstractbarseries_p.h"
-#include "qboxset.h"
-#include "boxwhiskers_p.h"
-#include <QPainter>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-BoxPlotChartItem::BoxPlotChartItem(QBoxPlotSeries *series, QGraphicsItem *item) :
- ChartItem(series->d_func(), item),
- m_series(series),
- m_animation(0)
-{
- connect(series, SIGNAL(boxsetsRemoved(QList<QBoxSet *>)), this, SLOT(handleBoxsetRemove(QList<QBoxSet *>)));
- connect(series->d_func(), SIGNAL(restructuredBoxes()), this, SLOT(handleDataStructureChanged()));
- connect(series->d_func(), SIGNAL(updatedLayout()), this, SLOT(handleLayoutChanged()));
- connect(series->d_func(), SIGNAL(updatedBoxes()), this, SLOT(handleUpdatedBars()));
- connect(series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdatedBars()));
- // QBoxPlotSeriesPrivate calls handleDataStructureChanged(), don't do it here
- setZValue(ChartPresenter::BoxPlotSeriesZValue);
-}
-
-BoxPlotChartItem::~BoxPlotChartItem()
-{
-}
-
-void BoxPlotChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(painter);
- Q_UNUSED(option);
- Q_UNUSED(widget);
-}
-
-void BoxPlotChartItem::setAnimation(BoxPlotAnimation *animation)
-{
- m_animation = animation;
- if (m_animation) {
- foreach (BoxWhiskers *item, m_boxTable.values())
- m_animation->addBox(item);
- handleDomainUpdated();
- }
-}
-
-void BoxPlotChartItem::handleDataStructureChanged()
-{
- int setCount = m_series->count();
-
- for (int s = 0; s < setCount; s++) {
- QBoxSet *set = m_series->d_func()->boxSetAt(s);
-
- BoxWhiskers *box = m_boxTable.value(set);
- if (!box) {
- // Item is not yet created, make a box and add it to hash table
- box = new BoxWhiskers(set, domain(), this);
- m_boxTable.insert(set, box);
- connect(box, SIGNAL(clicked(QBoxSet *)), m_series, SIGNAL(clicked(QBoxSet *)));
- connect(box, SIGNAL(hovered(bool, QBoxSet *)), m_series, SIGNAL(hovered(bool, QBoxSet *)));
- connect(box, SIGNAL(clicked(QBoxSet *)), set, SIGNAL(clicked()));
- connect(box, SIGNAL(hovered(bool, QBoxSet *)), set, SIGNAL(hovered(bool)));
-
- // Set the decorative issues for the newly created box
- // so that the brush and pen already defined for the set are kept.
- if (set->brush() == Qt::NoBrush)
- box->setBrush(m_series->brush());
- else
- box->setBrush(set->brush());
- if (set->pen() == Qt::NoPen)
- box->setPen(m_series->pen());
- else
- box->setPen(set->pen());
- box->setBoxOutlined(m_series->boxOutlineVisible());
- box->setBoxWidth(m_series->boxWidth());
- }
- updateBoxGeometry(box, s);
-
- box->updateGeometry(domain());
-
- if (m_animation)
- m_animation->addBox(box);
- }
-
- handleDomainUpdated();
-}
-
-void BoxPlotChartItem::handleUpdatedBars()
-{
- foreach (BoxWhiskers *item, m_boxTable.values()) {
- item->setBrush(m_series->brush());
- item->setPen(m_series->pen());
- item->setBoxOutlined(m_series->boxOutlineVisible());
- item->setBoxWidth(m_series->boxWidth());
- }
- // Override with QBoxSet specific settings
- foreach (QBoxSet *set, m_boxTable.keys()) {
- if (set->brush().style() != Qt::NoBrush)
- m_boxTable.value(set)->setBrush(set->brush());
- if (set->pen().style() != Qt::NoPen)
- m_boxTable.value(set)->setPen(set->pen());
- }
-}
-
-void BoxPlotChartItem::handleBoxsetRemove(QList<QBoxSet*> barSets)
-{
- foreach (QBoxSet *set, barSets) {
- BoxWhiskers *boxItem = m_boxTable.value(set);
- m_boxTable.remove(set);
- delete boxItem;
- }
-}
-
-void BoxPlotChartItem::handleDomainUpdated()
-{
- if ((domain()->size().width() <= 0) || (domain()->size().height() <= 0))
- return;
-
- // Set my bounding rect to same as domain size. Add one pixel at the top (-1.0) and the bottom as 0.0 would
- // snip a bit off from the whisker at the grid line
- m_boundingRect.setRect(0.0, -1.0, domain()->size().width(), domain()->size().height() + 1.0);
-
- foreach (BoxWhiskers *item, m_boxTable.values()) {
- item->updateGeometry(domain());
-
- // If the animation is set, start the animation for each BoxWhisker item
- if (m_animation)
- presenter()->startAnimation(m_animation->boxAnimation(item));
- }
-}
-
-void BoxPlotChartItem::handleLayoutChanged()
-{
- foreach (BoxWhiskers *item, m_boxTable.values()) {
- if (m_animation)
- m_animation->setAnimationStart(item);
-
- item->setBoxWidth(m_series->boxWidth());
-
- bool dirty = updateBoxGeometry(item, item->m_data.m_index);
- if (dirty && m_animation)
- presenter()->startAnimation(m_animation->boxChangeAnimation(item));
- else
- item->updateGeometry(domain());
- }
-}
-
-QRectF BoxPlotChartItem::boundingRect() const
-{
- return m_boundingRect;
-}
-
-void BoxPlotChartItem::initializeLayout()
-{
-}
-
-QVector<QRectF> BoxPlotChartItem::calculateLayout()
-{
- return QVector<QRectF>();
-}
-
-bool BoxPlotChartItem::updateBoxGeometry(BoxWhiskers *box, int index)
-{
- bool changed = false;
-
- QBoxSet *set = m_series->d_func()->boxSetAt(index);
- BoxWhiskersData &data = box->m_data;
-
- if ((data.m_lowerExtreme != set->at(0)) || (data.m_lowerQuartile != set->at(1)) ||
- (data.m_median != set->at(2)) || (data.m_upperQuartile != set->at(3)) || (data.m_upperExtreme != set->at(4))) {
- changed = true;
- }
-
- data.m_lowerExtreme = set->at(0);
- data.m_lowerQuartile = set->at(1);
- data.m_median = set->at(2);
- data.m_upperQuartile = set->at(3);
- data.m_upperExtreme = set->at(4);
- data.m_index = index;
- data.m_boxItems = m_series->count();
-
- data.m_maxX = domain()->maxX();
- data.m_minX = domain()->minX();
- data.m_maxY = domain()->maxY();
- data.m_minY = domain()->minY();
-
- data.m_seriesIndex = m_seriesIndex;
- data.m_seriesCount = m_seriesCount;
-
- return changed;
-}
-
-#include "moc_boxplotchartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/boxplotchart/boxplotchartitem_p.h b/src/boxplotchart/boxplotchartitem_p.h
deleted file mode 100644
index e6a06a9c..00000000
--- a/src/boxplotchart/boxplotchartitem_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-
-#ifndef BOXPLOTCHARTITEM_H
-#define BOXPLOTCHARTITEM_H
-
-#include "boxwhiskers_p.h"
-#include "qboxplotseries.h"
-#include "chartitem_p.h"
-#include "boxplotanimation_p.h"
-#include "qboxset.h"
-#include <QGraphicsItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class BoxPlotSeriesPrivate;
-
-class BoxPlotChartItem : public ChartItem
-{
- Q_OBJECT
-public:
- BoxPlotChartItem(QBoxPlotSeries *series, QGraphicsItem *item = 0);
- ~BoxPlotChartItem();
-
- void setAnimation(BoxPlotAnimation *animation);
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
- QRectF boundingRect() const;
-
-public Q_SLOTS:
- void handleDataStructureChanged();
- void handleDomainUpdated();
- void handleLayoutChanged();
- void handleUpdatedBars();
- void handleBoxsetRemove(QList<QBoxSet *> barSets);
-
-private:
- virtual QVector<QRectF> calculateLayout();
- void initializeLayout();
- bool updateBoxGeometry(BoxWhiskers *box, int index);
-
-protected:
- friend class QBoxPlotSeriesPrivate;
- QBoxPlotSeries *m_series; // Not owned.
- QList<BoxWhiskers *> m_boxes;
- QHash<QBoxSet *, BoxWhiskers *> m_boxTable;
- int m_seriesIndex;
- int m_seriesCount;
-
- BoxPlotAnimation *m_animation;
-
- QRectF m_boundingRect;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // BOXPLOTCHARTITEM_H
diff --git a/src/boxplotchart/boxwhiskers.cpp b/src/boxplotchart/boxwhiskers.cpp
deleted file mode 100644
index 151c8668..00000000
--- a/src/boxplotchart/boxwhiskers.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "boxwhiskers_p.h"
-#include <QPainter>
-#include <QWidget>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-BoxWhiskers::BoxWhiskers(QBoxSet *set, AbstractDomain *domain, QGraphicsObject *parent) :
- QGraphicsObject(parent),
- m_boxSet(set),
- m_domain(domain)
-{
- setAcceptHoverEvents(true);
- setAcceptedMouseButtons(Qt::MouseButtonMask);
-}
-
-BoxWhiskers::~BoxWhiskers()
-{
-}
-
-void BoxWhiskers::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- Q_UNUSED(event)
- emit clicked(m_boxSet);
-}
-
-void BoxWhiskers::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
-{
- Q_UNUSED(event)
- emit hovered(true, m_boxSet);
-}
-
-void BoxWhiskers::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
-{
- Q_UNUSED(event)
- emit hovered(false, m_boxSet);
-}
-
-void BoxWhiskers::setBrush(const QBrush &brush)
-{
- m_brush = brush;
- m_outlinePen.setColor(m_brush.color());
- update();
-}
-
-void BoxWhiskers::setPen(const QPen &pen)
-{
- qreal widthDiff = pen.widthF() - m_pen.widthF();
- m_boundingRect.adjust(-widthDiff, -widthDiff, widthDiff, widthDiff);
-
- m_pen = pen;
- m_medianPen = pen;
- m_medianPen.setCapStyle(Qt::FlatCap);
- m_outlinePen = pen;
- m_outlinePen.setStyle(Qt::SolidLine);
- m_outlinePen.setColor(m_brush.color());
-
- update();
-}
-
-void BoxWhiskers::setBoxWidth(const qreal width)
-{
- m_boxWidth = width;
-}
-
-void BoxWhiskers::setLayout(const BoxWhiskersData &data)
-{
- m_data = data;
-
- updateGeometry(m_domain);
- update();
-}
-
-QSizeF BoxWhiskers::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(which)
- Q_UNUSED(constraint)
-
- return QSizeF();
-}
-
-void BoxWhiskers::setGeometry(const QRectF &rect)
-{
- Q_UNUSED(rect)
-}
-
-QRectF BoxWhiskers::boundingRect() const
-{
- return m_boundingRect;
-}
-
-void BoxWhiskers::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option)
- Q_UNUSED(widget)
-
- painter->save();
- painter->setBrush(m_brush);
- painter->setClipRect(parentItem()->boundingRect());
- painter->setPen(m_pen);
- painter->drawPath(m_boxPath);
- if (!m_boxOutlined)
- painter->setPen(m_outlinePen);
- painter->drawRect(m_middleBox);
- painter->setPen(m_medianPen);
- qreal halfLine = m_pen.widthF() / 2.0;
- painter->drawLine(QLineF(m_geometryLeft - halfLine, m_geometryMedian,
- m_geometryRight + halfLine, m_geometryMedian));
- painter->restore();
-}
-
-void BoxWhiskers::updateGeometry(AbstractDomain *domain)
-{
- m_domain = domain;
-
- prepareGeometryChange();
-
- QPainterPath path;
- m_boxPath = path;
- m_boundingRect = m_boxPath.boundingRect();
-
- qreal columnWidth = 1.0 / m_data.m_seriesCount;
- qreal left = ((1.0 - m_boxWidth) / 2.0) * columnWidth + columnWidth * m_data.m_seriesIndex + m_data.m_index - 0.5;
- qreal barWidth = m_boxWidth * columnWidth;
-
- QPointF geometryPoint = m_domain->calculateGeometryPoint(QPointF(left, m_data.m_upperExtreme), m_validData);
- if (!m_validData)
- return;
- m_geometryLeft = geometryPoint.x();
- qreal geometryUpperExtreme = geometryPoint.y();
- geometryPoint = m_domain->calculateGeometryPoint(QPointF(left + barWidth, m_data.m_upperQuartile), m_validData);
- if (!m_validData)
- return;
- m_geometryRight = geometryPoint.x();
- qreal geometryUpperQuartile = geometryPoint.y();
- geometryPoint = m_domain->calculateGeometryPoint(QPointF(left, m_data.m_lowerQuartile), m_validData);
- if (!m_validData)
- return;
- qreal geometryLowerQuartile = geometryPoint.y();
- geometryPoint = m_domain->calculateGeometryPoint(QPointF(left, m_data.m_lowerExtreme), m_validData);
- if (!m_validData)
- return;
- qreal geometryLowerExtreme = geometryPoint.y();
- geometryPoint = m_domain->calculateGeometryPoint(QPointF(left, m_data.m_median), m_validData);
- if (!m_validData)
- return;
- m_geometryMedian = geometryPoint.y();
-
- // Upper whisker
- path.moveTo(m_geometryLeft, geometryUpperExtreme);
- path.lineTo(m_geometryRight, geometryUpperExtreme);
- path.moveTo((m_geometryLeft + m_geometryRight) / 2.0, geometryUpperExtreme);
- path.lineTo((m_geometryLeft + m_geometryRight) / 2.0, geometryUpperQuartile);
-
- // Middle Box
- m_middleBox.setCoords(m_geometryLeft, geometryUpperQuartile, m_geometryRight, geometryLowerQuartile);
-
- // Lower whisker
- path.moveTo(m_geometryLeft, geometryLowerExtreme);
- path.lineTo(m_geometryRight, geometryLowerExtreme);
- path.moveTo((m_geometryLeft + m_geometryRight) / 2.0, geometryLowerQuartile);
- path.lineTo((m_geometryLeft + m_geometryRight) / 2.0, geometryLowerExtreme);
-
- path.closeSubpath();
-
- m_boxPath = path;
- m_boundingRect = m_boxPath.boundingRect();
-
- qreal extra = m_pen.widthF();
- m_boundingRect.adjust(-extra, -extra, extra, extra);
-}
-
-#include "moc_boxwhiskers_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/boxplotchart/boxwhiskers_p.h b/src/boxplotchart/boxwhiskers_p.h
deleted file mode 100644
index f6d1837a..00000000
--- a/src/boxplotchart/boxwhiskers_p.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef BOXWHISKERS_H
-#define BOXWHISKERS_H
-
-#include "boxwhiskersdata_p.h"
-#include "qchartglobal.h"
-#include "abstractdomain_p.h"
-#include <QBoxSet>
-#include <QGraphicsRectItem>
-#include <QGraphicsLineItem>
-#include <QGraphicsLayoutItem>
-#include <QPainterPath>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarSet;
-
-class BoxWhiskers : public QGraphicsObject
-{
- Q_OBJECT
-
-public:
- BoxWhiskers(QBoxSet *set, AbstractDomain *domain, QGraphicsObject *parent);
- ~BoxWhiskers();
-
- void setBrush(const QBrush &brush);
- void setPen(const QPen &pen);
- void setLayout(const BoxWhiskersData &data);
- void setBoxOutlined(const bool outlined) { m_boxOutlined = outlined; }
- void setBoxWidth(const qreal width);
-
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
-
- QRectF boundingRect() const;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
-
- void updateGeometry(AbstractDomain *domain);
-protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
- void setGeometry(const QRectF &rect);
-
-Q_SIGNALS:
- void clicked(QBoxSet *boxset);
- void hovered(bool status, QBoxSet *boxset);
-
-private:
- friend class BoxPlotChartItem;
- friend class BoxPlotAnimation;
-
- QBoxSet *m_boxSet;
- AbstractDomain *m_domain;
- QPainterPath m_boxPath;
- QRectF m_boundingRect;
- bool m_hovering;
- bool m_validData;
- QBrush m_brush;
- QPen m_pen;
- QPen m_medianPen;
- QPen m_outlinePen;
- bool m_boxOutlined;
- qreal m_boxWidth;
- BoxWhiskersData m_data;
- QSizeF m_domainSize;
- QRectF m_middleBox;
- qreal m_geometryMedian;
- qreal m_geometryLeft;
- qreal m_geometryRight;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // BOXWHISKERS_H
diff --git a/src/boxplotchart/boxwhiskersdata_p.h b/src/boxplotchart/boxwhiskersdata_p.h
deleted file mode 100644
index 653f51c3..00000000
--- a/src/boxplotchart/boxwhiskersdata_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef BOXWHISKERSDATA_P_H
-#define BOXWHISKERSDATA_P_H
-
-#include "qchartglobal.h"
-#include <QSizeF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class BoxWhiskersData
-{
-public:
- BoxWhiskersData() :
- m_lowerExtreme(0.0),
- m_lowerQuartile(0.0),
- m_median(0.0),
- m_upperQuartile(0.0),
- m_upperExtreme(0.0),
- m_index(0),
- m_boxItems(0),
- m_maxX(0.0),
- m_minX(0.0),
- m_maxY(0.0),
- m_minY(0.0),
- m_seriesIndex(0),
- m_seriesCount(0)
- {
- }
-
- // Box related statistics
- qreal m_lowerExtreme;
- qreal m_lowerQuartile;
- qreal m_median;
- qreal m_upperQuartile;
- qreal m_upperExtreme;
- int m_index;
- int m_boxItems;
-
- // Domain boundaries, axis
- qreal m_maxX;
- qreal m_minX;
- qreal m_maxY;
- qreal m_minY;
-
- // Serieses related data
- int m_seriesIndex;
- int m_seriesCount;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // BOXWHISKERSDATA_P_H
diff --git a/src/boxplotchart/qboxplotmodelmapper.cpp b/src/boxplotchart/qboxplotmodelmapper.cpp
deleted file mode 100644
index cf84e479..00000000
--- a/src/boxplotchart/qboxplotmodelmapper.cpp
+++ /dev/null
@@ -1,489 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qboxplotmodelmapper.h"
-#include "qboxplotmodelmapper_p.h"
-#include "qboxplotseries.h"
-#include "qboxset.h"
-#include "qchart.h"
-#include <QAbstractItemModel>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-QBoxPlotModelMapper::QBoxPlotModelMapper(QObject *parent) :
- QObject(parent),
- d_ptr(new QBoxPlotModelMapperPrivate(this))
-{
-}
-
-QAbstractItemModel *QBoxPlotModelMapper::model() const
-{
- Q_D(const QBoxPlotModelMapper);
- return d->m_model;
-}
-
-void QBoxPlotModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model == 0)
- return;
-
- Q_D(QBoxPlotModelMapper);
- if (d->m_model)
- disconnect(d->m_model, 0, d, 0);
-
- d->m_model = model;
- d->initializeBoxFromModel();
- // connect signals from the model
- connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
- connect(d->m_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), d, SLOT(modelHeaderDataUpdated(Qt::Orientation,int,int)));
- connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
-}
-
-QBoxPlotSeries *QBoxPlotModelMapper::series() const
-{
- Q_D(const QBoxPlotModelMapper);
- return d->m_series;
-}
-
-void QBoxPlotModelMapper::setSeries(QBoxPlotSeries *series)
-{
- Q_D(QBoxPlotModelMapper);
- if (d->m_series)
- disconnect(d->m_series, 0, d, 0);
-
- if (series == 0)
- return;
-
- d->m_series = series;
- d->initializeBoxFromModel();
- // connect the signals from the series
- connect(d->m_series, SIGNAL(boxsetsAdded(QList<QBoxSet *>)), d, SLOT(boxSetsAdded(QList<QBoxSet *>)));
- connect(d->m_series, SIGNAL(boxsetsRemoved(QList<QBoxSet *>)), d, SLOT(boxSetsRemoved(QList<QBoxSet *>)));
- connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
-}
-
-/*!
- Returns which row/column of the model contains the first values of the QBoxSets in the series.
- The default value is 0.
-*/
-int QBoxPlotModelMapper::first() const
-{
- Q_D(const QBoxPlotModelMapper);
- return d->m_first;
-}
-
-/*!
- Sets which row/column of the model contains the \a first values of the QBoxSets in the series.
- The default value is 0.
-*/
-void QBoxPlotModelMapper::setFirst(int first)
-{
- Q_D(QBoxPlotModelMapper);
- d->m_first = qMax(first, 0);
- d->initializeBoxFromModel();
-}
-
-/*!
- Returns the number of rows/columns of the model that are mapped as the data for QBoxPlotSeries
- Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
-*/
-int QBoxPlotModelMapper::count() const
-{
- Q_D(const QBoxPlotModelMapper);
- return d->m_count;
-}
-
-/*!
- Sets the \a count of rows/columns of the model that are mapped as the data for QBoxPlotSeries
- Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
-*/
-void QBoxPlotModelMapper::setCount(int count)
-{
- Q_D(QBoxPlotModelMapper);
- d->m_count = qMax(count, -1);
- d->initializeBoxFromModel();
-}
-
-/*!
- Returns the orientation that is used when QBoxPlotModelMapper accesses the model.
- This means whether the consecutive values of the box-and-whiskers set are read from row (Qt::Horizontal)
- or from columns (Qt::Vertical)
-*/
-Qt::Orientation QBoxPlotModelMapper::orientation() const
-{
- Q_D(const QBoxPlotModelMapper);
- return d->m_orientation;
-}
-
-/*!
- Returns the \a orientation that is used when QBoxPlotModelMapper accesses the model.
- This mean whether the consecutive values of the box-and-whiskers set are read from row (Qt::Horizontal)
- or from columns (Qt::Vertical)
-*/
-void QBoxPlotModelMapper::setOrientation(Qt::Orientation orientation)
-{
- Q_D(QBoxPlotModelMapper);
- d->m_orientation = orientation;
- d->initializeBoxFromModel();
-}
-
-/*!
- Returns which section of the model is used as the data source for the first box set
-*/
-int QBoxPlotModelMapper::firstBoxSetSection() const
-{
- Q_D(const QBoxPlotModelMapper);
- return d->m_firstBoxSetSection;
-}
-
-/*!
- Sets the model section that is used as the data source for the first box set
- Parameter \a firstBoxSetSection specifies the section of the model.
-*/
-void QBoxPlotModelMapper::setFirstBoxSetSection(int firstBoxSetSection)
-{
- Q_D(QBoxPlotModelMapper);
- d->m_firstBoxSetSection = qMax(-1, firstBoxSetSection);
- d->initializeBoxFromModel();
-}
-
-/*!
- Returns which section of the model is used as the data source for the last box set
-*/
-int QBoxPlotModelMapper::lastBoxSetSection() const
-{
- Q_D(const QBoxPlotModelMapper);
- return d->m_lastBoxSetSection;
-}
-
-/*!
- Sets the model section that is used as the data source for the last box set
- Parameter \a lastBoxSetSection specifies the section of the model.
-*/
-void QBoxPlotModelMapper::setLastBoxSetSection(int lastBoxSetSection)
-{
- Q_D(QBoxPlotModelMapper);
- d->m_lastBoxSetSection = qMax(-1, lastBoxSetSection);
- d->initializeBoxFromModel();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QBoxPlotModelMapperPrivate::QBoxPlotModelMapperPrivate(QBoxPlotModelMapper *q) :
- QObject(q),
- m_series(0),
- m_model(0),
- m_first(0),
- m_count(-1),
- m_orientation(Qt::Vertical),
- m_firstBoxSetSection(-1),
- m_lastBoxSetSection(-1),
- m_seriesSignalsBlock(false),
- m_modelSignalsBlock(false),
- q_ptr(q)
-{
-}
-
-void QBoxPlotModelMapperPrivate::blockModelSignals(bool block)
-{
- m_modelSignalsBlock = block;
-}
-
-void QBoxPlotModelMapperPrivate::blockSeriesSignals(bool block)
-{
- m_seriesSignalsBlock = block;
-}
-
-QBoxSet *QBoxPlotModelMapperPrivate::boxSet(QModelIndex index)
-{
- if (!index.isValid())
- return 0;
-
- if (m_orientation == Qt::Vertical && index.column() >= m_firstBoxSetSection && index.column() <= m_lastBoxSetSection) {
- if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count))
- return m_series->boxSets().at(index.column() - m_firstBoxSetSection);
- } else if (m_orientation == Qt::Horizontal && index.row() >= m_firstBoxSetSection && index.row() <= m_lastBoxSetSection) {
- if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count))
- return m_series->boxSets().at(index.row() - m_firstBoxSetSection);
- }
- return 0; // This part of model has not been mapped to any boxset
-}
-
-QModelIndex QBoxPlotModelMapperPrivate::boxModelIndex(int boxSection, int posInBar)
-{
- if (m_count != -1 && posInBar >= m_count)
- return QModelIndex(); // invalid
-
- if (boxSection < m_firstBoxSetSection || boxSection > m_lastBoxSetSection)
- return QModelIndex(); // invalid
-
- if (m_orientation == Qt::Vertical)
- return m_model->index(posInBar + m_first, boxSection);
- else
- return m_model->index(boxSection, posInBar + m_first);
-}
-
-void QBoxPlotModelMapperPrivate::handleSeriesDestroyed()
-{
- m_series = 0;
-}
-
-void QBoxPlotModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
-{
- Q_UNUSED(topLeft)
- Q_UNUSED(bottomRight)
-
- if (m_model == 0 || m_series == 0)
- return;
-
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- QModelIndex index;
- for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
- for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
- index = topLeft.sibling(row, column);
- QBoxSet *box = boxSet(index);
- if (box) {
- if (m_orientation == Qt::Vertical)
- box->setValue(row - m_first, m_model->data(index).toReal());
- else
- box->setValue(column - m_first, m_model->data(index).toReal());
- }
- }
- }
- blockSeriesSignals(false);
-}
-
-void QBoxPlotModelMapperPrivate::modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last)
-{
- Q_UNUSED(orientation);
- Q_UNUSED(first);
- Q_UNUSED(last);
-}
-
-void QBoxPlotModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent)
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Vertical)
- insertData(start, end);
- else if (start <= m_firstBoxSetSection || start <= m_lastBoxSetSection) // if the changes affect the map - reinitialize
- initializeBoxFromModel();
- blockSeriesSignals(false);
-}
-
-void QBoxPlotModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent)
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Vertical)
- removeData(start, end);
- else if (start <= m_firstBoxSetSection || start <= m_lastBoxSetSection) // if the changes affect the map - reinitialize
- initializeBoxFromModel();
- blockSeriesSignals(false);
-}
-
-void QBoxPlotModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent)
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Horizontal)
- insertData(start, end);
- else if (start <= m_firstBoxSetSection || start <= m_lastBoxSetSection) // if the changes affect the map - reinitialize
- initializeBoxFromModel();
- blockSeriesSignals(false);
-}
-
-void QBoxPlotModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent)
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Horizontal)
- removeData(start, end);
- else if (start <= m_firstBoxSetSection || start <= m_lastBoxSetSection) // if the changes affect the map - reinitialize
- initializeBoxFromModel();
- blockSeriesSignals(false);
-}
-
-void QBoxPlotModelMapperPrivate::handleModelDestroyed()
-{
- m_model = 0;
-}
-
-void QBoxPlotModelMapperPrivate::insertData(int start, int end)
-{
- Q_UNUSED(end)
- Q_UNUSED(start)
- Q_UNUSED(end)
- // Currently boxplotchart needs to be fully recalculated when change is made.
- // Re-initialize
- initializeBoxFromModel();
-}
-
-void QBoxPlotModelMapperPrivate::removeData(int start, int end)
-{
- Q_UNUSED(end)
- Q_UNUSED(start)
- Q_UNUSED(end)
- // Currently boxplotchart needs to be fully recalculated when change is made.
- // Re-initialize
- initializeBoxFromModel();
-}
-
-void QBoxPlotModelMapperPrivate::boxSetsAdded(QList<QBoxSet *> sets)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (sets.count() == 0)
- return;
-
- int firstIndex = m_series->boxSets().indexOf(sets.at(0));
- if (firstIndex == -1)
- return;
-
- int maxCount = 0;
- for (int i = 0; i < sets.count(); i++) {
- if (sets.at(i)->count() > m_count)
- maxCount = sets.at(i)->count();
- }
-
- if (m_count != -1 && m_count < maxCount)
- m_count = maxCount;
-
- m_lastBoxSetSection += sets.count();
-
- blockModelSignals();
- int modelCapacity = m_orientation == Qt::Vertical ? m_model->rowCount() - m_first : m_model->columnCount() - m_first;
- if (maxCount > modelCapacity) {
- if (m_orientation == Qt::Vertical)
- m_model->insertRows(m_model->rowCount(), maxCount - modelCapacity);
- else
- m_model->insertColumns(m_model->columnCount(), maxCount - modelCapacity);
- }
-
- if (m_orientation == Qt::Vertical)
- m_model->insertColumns(firstIndex + m_firstBoxSetSection, sets.count());
- else
- m_model->insertRows(firstIndex + m_firstBoxSetSection, sets.count());
-
-
- for (int i = firstIndex + m_firstBoxSetSection; i < firstIndex + m_firstBoxSetSection + sets.count(); i++) {
- for (int j = 0; j < sets.at(i - firstIndex - m_firstBoxSetSection)->count(); j++)
- m_model->setData(boxModelIndex(i, j), sets.at(i - firstIndex - m_firstBoxSetSection)->at(j));
- }
- blockModelSignals(false);
- initializeBoxFromModel();
-}
-
-void QBoxPlotModelMapperPrivate::boxSetsRemoved(QList<QBoxSet *> sets)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (sets.count() == 0)
- return;
-
- int firstIndex = m_boxSets.indexOf(sets.at(0));
- if (firstIndex == -1)
- return;
-
- m_lastBoxSetSection -= sets.count();
-
- for (int i = firstIndex + sets.count() - 1; i >= firstIndex; i--)
- m_boxSets.removeAt(i);
-
- blockModelSignals();
- if (m_orientation == Qt::Vertical)
- m_model->removeColumns(firstIndex + m_firstBoxSetSection, sets.count());
- else
- m_model->removeRows(firstIndex + m_firstBoxSetSection, sets.count());
- blockModelSignals(false);
- initializeBoxFromModel();
-}
-
-void QBoxPlotModelMapperPrivate::boxValueChanged(int index)
-{
- if (m_seriesSignalsBlock)
- return;
-
- int boxSetIndex = m_boxSets.indexOf(qobject_cast<QBoxSet *>(QObject::sender()));
-
- blockModelSignals();
- m_model->setData(boxModelIndex(boxSetIndex + m_firstBoxSetSection, index), m_boxSets.at(boxSetIndex)->at(index));
- blockModelSignals(false);
- initializeBoxFromModel();
-}
-
-void QBoxPlotModelMapperPrivate::initializeBoxFromModel()
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- blockSeriesSignals();
- // clear current content
- m_series->clear();
- m_boxSets.clear();
-
- // create the initial box-and-whiskers sets
- for (int i = m_firstBoxSetSection; i <= m_lastBoxSetSection; i++) {
- int posInBar = 0;
- QModelIndex boxIndex = boxModelIndex(i, posInBar);
- // check if there is such model index
- if (boxIndex.isValid()) {
- QBoxSet *boxSet = new QBoxSet();
- while (boxIndex.isValid()) {
- boxSet->append(m_model->data(boxIndex, Qt::DisplayRole).toDouble());
- posInBar++;
- boxIndex = boxModelIndex(i, posInBar);
- }
- connect(boxSet, SIGNAL(valueChanged(int)), this, SLOT(boxValueChanged(int)));
- m_series->append(boxSet);
- m_boxSets.append(boxSet);
- } else {
- break;
- }
- }
- blockSeriesSignals(false);
-}
-
-#include "moc_qboxplotmodelmapper.cpp"
-#include "moc_qboxplotmodelmapper_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/boxplotchart/qboxplotmodelmapper.h b/src/boxplotchart/qboxplotmodelmapper.h
deleted file mode 100644
index 6e2a8c9c..00000000
--- a/src/boxplotchart/qboxplotmodelmapper.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBOXPLOTMODELMAPPER_H
-#define QBOXPLOTMODELMAPPER_H
-
-#include "qchartglobal.h"
-#include <QObject>
-
-class QAbstractItemModel;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBoxPlotModelMapperPrivate;
-class QBoxPlotSeries;
-
-class QTCOMMERCIALCHART_EXPORT QBoxPlotModelMapper : public QObject
-{
- Q_OBJECT
-
-protected:
- explicit QBoxPlotModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QBoxPlotSeries *series() const;
- void setSeries(QBoxPlotSeries *series);
-
- int first() const;
- void setFirst(int first);
-
- int count() const;
- void setCount(int count);
-
- int firstBoxSetSection() const;
- void setFirstBoxSetSection(int firstBoxSetSection);
-
- int lastBoxSetSection() const;
- void setLastBoxSetSection(int lastBoxSetSection);
-
- Qt::Orientation orientation() const;
- void setOrientation(Qt::Orientation orientation);
-
-protected:
- QBoxPlotModelMapperPrivate * const d_ptr;
- Q_DECLARE_PRIVATE(QBoxPlotModelMapper)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBOXPLOTMODELMAPPER_H
diff --git a/src/boxplotchart/qboxplotmodelmapper_p.h b/src/boxplotchart/qboxplotmodelmapper_p.h
deleted file mode 100644
index cbaef258..00000000
--- a/src/boxplotchart/qboxplotmodelmapper_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QBOXPLOTMODELMAPPER_P_H
-#define QBOXPLOTMODELMAPPER_P_H
-
-#include <QObject>
-#include "qboxplotmodelmapper.h"
-
-class QModelIndex;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBoxSet;
-
-class QBoxPlotModelMapperPrivate : public QObject
-{
- Q_OBJECT
-public:
- explicit QBoxPlotModelMapperPrivate(QBoxPlotModelMapper *q);
-
-public Q_SLOTS:
- // for the model
- void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
- void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
- void modelRowsAdded(QModelIndex parent, int start, int end);
- void modelRowsRemoved(QModelIndex parent, int start, int end);
- void modelColumnsAdded(QModelIndex parent, int start, int end);
- void modelColumnsRemoved(QModelIndex parent, int start, int end);
- void handleModelDestroyed();
-
- // for the series
- void boxSetsAdded(QList<QBoxSet *> sets);
- void boxSetsRemoved(QList<QBoxSet *> sets);
- void boxValueChanged(int index);
- void handleSeriesDestroyed();
-
- void initializeBoxFromModel();
-
-private:
- QBoxSet *boxSet(QModelIndex index);
- QModelIndex boxModelIndex(int boxSection, int posInBox);
- void insertData(int start, int end);
- void removeData(int start, int end);
- void blockModelSignals(bool block = true);
- void blockSeriesSignals(bool block = true);
-
-private:
- QBoxPlotSeries *m_series;
- QList<QBoxSet *> m_boxSets;
- QAbstractItemModel *m_model;
- int m_first;
- int m_count;
- Qt::Orientation m_orientation;
- int m_firstBoxSetSection;
- int m_lastBoxSetSection;
- bool m_seriesSignalsBlock;
- bool m_modelSignalsBlock;
-
-private:
- QBoxPlotModelMapper *q_ptr;
- Q_DECLARE_PUBLIC(QBoxPlotModelMapper)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBOXPLOTMODELMAPPER_P_H
diff --git a/src/boxplotchart/qboxplotseries.cpp b/src/boxplotchart/qboxplotseries.cpp
deleted file mode 100644
index 4f562d79..00000000
--- a/src/boxplotchart/qboxplotseries.cpp
+++ /dev/null
@@ -1,690 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qboxplotseries.h"
-#include "qboxplotseries_p.h"
-#include "qboxplotlegendmarker.h"
-#include "qbarcategoryaxis.h"
-#include "boxplotchartitem_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "qvalueaxis.h"
-#include "charttheme_p.h"
-#include "boxplotanimation_p.h"
-#include "qchart_p.h"
-#include "qboxset.h"
-#include "qboxset_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QBoxPlotSeries
- \inmodule Qt Charts
- \brief Series for creating box-and-whiskers chart
- \mainclass
-
- QBoxPlotSeries represents a series of data shown as box-and-whisker bars. The purpose of this class is to act as
- a container for single box-and-whisker items. Each item is drawn to own slot. If chart includes multiple instances of
- QBoxPlotSeries then box-and-whiskers items with the same index are drawn to same slot.
-
- See the \l {Box and Whiskers Example} {box-and-whiskers chart example} to learn how to create a box-and-whiskers chart.
- \image examples_boxplotchart.png
-
- \sa QBoxSet
-*/
-/*!
- \fn QBoxPlotSeries::boxsetsAdded(QList<QBoxSet *> sets)
- \brief Signal is emitted when a new \a sets of box-and-whiskers data is added to the series.
-*/
-/*!
- \fn QBoxPlotSeries::boxsetsRemoved(QList<QBoxSet *> sets)
- \brief Signal is emitted when \a sets of box-and-whiskers data is removed from the series.
-*/
-/*!
- \fn QBoxPlotSeries::clicked(QBoxSet *boxset)
- \brief Signal is emitted when the user clicks the \a boxset on the chart.
-*/
-/*!
- \fn QBoxPlotSeries::hovered(bool status, QBoxSet *boxset)
- \brief Signal is emitted when there is change in hover \a status over \a boxset.
-*/
-/*!
- \fn QBoxPlotSeries::countChanged()
- \brief Signal is emitted when there is change in count of box-and-whiskers items in the series.
-*/
-/*!
- \property QBoxPlotSeries::boxOutlineVisible
- \brief This property configures the visibility of the middle box outline.
-*/
-/*!
- \property QBoxPlotSeries::boxWidth
- \brief This property configures the width of the box-and-whiskers item. The value signifies the relative
- width of the box-and-whiskers item inside its own slot. The value can between 0.0 and 1.0. Negative values
- are clamped to 0.0 and values over 1.0 are clamped to 1.0.
-*/
-/*!
- \property QBoxPlotSeries::pen
- \brief This property configures the pen of the box-and-whiskers items.
-*/
-/*!
- \property QBoxPlotSeries::brush
- \brief This property configures the brush of the box-and-whiskers items.
-*/
-/*!
- \property QBoxPlotSeries::count
- \brief The count of sets in series.
-*/
-
-/*!
- \qmlproperty QString BoxPlotSeries::brushFilename
- The name of the file used as a brush for the series.
-*/
-
-/*!
- \fn void QBoxPlotSeries::boxOutlineVisibilityChanged()
- Signal is emitted when the middle box outline visibility is changed.
-*/
-/*!
- \fn void QBoxPlotSeries::boxWidthChanged()
- Signal is emitted when the width of the box-and-whiskers item is changed.
-*/
-/*!
- \fn void QBoxPlotSeries::penChanged()
- This signal is emitted when the pen of the box-and-whiskers has changed.
- \sa brush
-*/
-/*!
- \fn void QBoxPlotSeries::brushChanged()
- This signal is emitted when the brush of the box-and-whiskers has changed.
- \sa brush
-*/
-/*!
- \fn virtual SeriesType QBoxPlotSeries::type() const
- \brief Returns type of series.
- \sa QAbstractSeries, SeriesType
-*/
-
-/*!
- Constructs empty QBoxPlotSeries.
- QBoxPlotSeries is QObject which is a child of a \a parent.
-*/
-QBoxPlotSeries::QBoxPlotSeries(QObject *parent)
- : QAbstractSeries(*new QBoxPlotSeriesPrivate(this), parent)
-{
-}
-
-/*!
- Destructor. Removes series from chart.
-*/
-QBoxPlotSeries::~QBoxPlotSeries()
-{
- Q_D(QBoxPlotSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-
-/*!
- Adds a single box and whiskers set to series. Takes ownership of the \a set. If the set is null or is already in series, it won't be appended.
- Returns true, if appending succeeded.
-*/
-bool QBoxPlotSeries::append(QBoxSet *set)
-{
- Q_D(QBoxPlotSeries);
-
- bool success = d->append(set);
- if (success) {
- QList<QBoxSet *> sets;
- sets.append(set);
- set->setParent(this);
- emit boxsetsAdded(sets);
- emit countChanged();
- }
- return success;
-}
-
-/*!
- Removes boxset from the series. Deletes the \a set and returns true if successful.
-*/
-bool QBoxPlotSeries::remove(QBoxSet *set)
-{
- Q_D(QBoxPlotSeries);
- bool success = d->remove(set);
- if (success) {
- QList<QBoxSet *> sets;
- sets.append(set);
- set->setParent(0);
- emit boxsetsRemoved(sets);
- emit countChanged();
- delete set;
- set = 0;
- }
- return success;
-}
-
-/*!
- Takes a single \a set from the series. Does not delete the boxset object.
-
- NOTE: The series remains as the boxset's parent object. You must set the
- parent object to take full ownership.
-
- Returns true if take was successful.
-*/
-bool QBoxPlotSeries::take(QBoxSet *set)
-{
- Q_D(QBoxPlotSeries);
-
- bool success = d->remove(set);
- if (success) {
- QList<QBoxSet *> sets;
- sets.append(set);
- emit boxsetsRemoved(sets);
- emit countChanged();
- }
- return success;
-}
-
-/*!
- Adds a list of boxsets to series. Takes ownership of the \a sets.
- Returns true, if all sets were appended successfully. If any of the sets is null or is already appended to series,
- nothing is appended and function returns false. If any of the sets is in list more than once, nothing is appended
- and function returns false.
-*/
-bool QBoxPlotSeries::append(QList<QBoxSet *> sets)
-{
- Q_D(QBoxPlotSeries);
- bool success = d->append(sets);
- if (success) {
- emit boxsetsAdded(sets);
- emit countChanged();
- }
- return success;
-}
-
-/*!
- Insert a box-and-whiskers set to the series at \a index postion. Takes ownership of the \a set. If the set is null or
- is already in series, it won't be appended. Returns true, if inserting succeeded.
-
-*/
-bool QBoxPlotSeries::insert(int index, QBoxSet *set)
-{
- Q_D(QBoxPlotSeries);
- bool success = d->insert(index, set);
- if (success) {
- QList<QBoxSet *> sets;
- sets.append(set);
- emit boxsetsAdded(sets);
- emit countChanged();
- }
- return success;
-}
-
-/*!
- Removes all boxsets from the series. Deletes removed sets.
-*/
-void QBoxPlotSeries::clear()
-{
- Q_D(QBoxPlotSeries);
- QList<QBoxSet *> sets = boxSets();
- bool success = d->remove(sets);
- if (success) {
- emit boxsetsRemoved(sets);
- emit countChanged();
- foreach (QBoxSet *set, sets)
- delete set;
- }
-}
-
-/*!
- Returns number of sets in series.
-*/
-int QBoxPlotSeries::count() const
-{
- Q_D(const QBoxPlotSeries);
- return d->m_boxSets.count();
-}
-
-/*!
- Returns a list of sets in series. Keeps ownership of sets.
- */
-QList<QBoxSet *> QBoxPlotSeries::boxSets() const
-{
- Q_D(const QBoxPlotSeries);
- return d->m_boxSets;
-}
-
-/*
- Returns QAbstractSeries::SeriesTypeBoxPlot.
-*/
-QAbstractSeries::SeriesType QBoxPlotSeries::type() const
-{
- return QAbstractSeries::SeriesTypeBoxPlot;
-}
-
-void QBoxPlotSeries::setBoxOutlineVisible(bool visible)
-{
- Q_D(QBoxPlotSeries);
-
- if (d->m_boxOutlineVisible != visible) {
- d->m_boxOutlineVisible = visible;
- emit d->updated();
- emit boxOutlineVisibilityChanged();
- }
-}
-
-bool QBoxPlotSeries::boxOutlineVisible()
-{
- Q_D(QBoxPlotSeries);
-
- return d->m_boxOutlineVisible;
-}
-
-void QBoxPlotSeries::setBoxWidth(qreal width)
-{
- Q_D(QBoxPlotSeries);
-
- if (width != d->m_boxWidth) {
- if (width < 0.0)
- width = 0.0;
- if (width > 1.0)
- width = 1.0;
- d->m_boxWidth = width;
- emit d->updatedLayout();
- emit boxWidthChanged();
- }
-}
-
-qreal QBoxPlotSeries::boxWidth()
-{
- Q_D(QBoxPlotSeries);
-
- return d->m_boxWidth;
-}
-
-void QBoxPlotSeries::setBrush(const QBrush &brush)
-{
- Q_D(QBoxPlotSeries);
-
- if (d->m_brush != brush) {
- d->m_brush = brush;
- emit d->updated();
- emit brushChanged();
- }
-}
-
-QBrush QBoxPlotSeries::brush() const
-{
- Q_D(const QBoxPlotSeries);
-
- return d->m_brush;
-}
-
-void QBoxPlotSeries::setPen(const QPen &pen)
-{
- Q_D(QBoxPlotSeries);
-
- if (d->m_pen != pen) {
- d->m_pen = pen;
- emit d->updated();
- emit penChanged();
- }
-}
-
-QPen QBoxPlotSeries::pen() const
-{
- Q_D(const QBoxPlotSeries);
-
- return d->m_pen;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QBoxPlotSeriesPrivate::QBoxPlotSeriesPrivate(QBoxPlotSeries *q)
- : QAbstractSeriesPrivate(q),
- m_pen(QChartPrivate::defaultPen()),
- m_brush(QChartPrivate::defaultBrush()),
- m_boxOutlineVisible(true),
- m_boxWidth(0.5)
-{
-}
-
-QBoxPlotSeriesPrivate::~QBoxPlotSeriesPrivate()
-{
- disconnect(this, 0, 0, 0);
-}
-
-void QBoxPlotSeriesPrivate::initializeDomain()
-{
- qreal minX(domain()->minX());
- qreal minY(domain()->minY());
- qreal maxX(domain()->maxX());
- qreal maxY(domain()->maxY());
-
- qreal x = m_boxSets.count();
- minX = qMin(minX, qreal(-0.5));
- minY = qMin(minY, min());
- maxX = qMax(maxX, x - qreal(0.5));
- maxY = qMax(maxY, max());
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-void QBoxPlotSeriesPrivate::initializeAxes()
-{
- foreach (QAbstractAxis* axis, m_axes) {
- if (axis->type() == QAbstractAxis::AxisTypeBarCategory) {
- if (axis->orientation() == Qt::Horizontal)
- populateCategories(qobject_cast<QBarCategoryAxis *>(axis));
- }
- }
-}
-
-QAbstractAxis::AxisType QBoxPlotSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
-{
- if (orientation == Qt::Horizontal)
- return QAbstractAxis::AxisTypeBarCategory;
-
- return QAbstractAxis::AxisTypeValue;
-}
-
-QAbstractAxis* QBoxPlotSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
-{
- if (defaultAxisType(orientation) == QAbstractAxis::AxisTypeBarCategory)
- return new QBarCategoryAxis;
- else
- return new QValueAxis;
-}
-
-void QBoxPlotSeriesPrivate::populateCategories(QBarCategoryAxis *axis)
-{
- QStringList categories;
- if (axis->categories().isEmpty()) {
- for (int i(1); i < m_boxSets.count() + 1; i++) {
- QBoxSet *set = m_boxSets.at(i - 1);
- if (set->label().isEmpty())
- categories << presenter()->numberToString(i);
- else
- categories << set->label();
- }
- axis->append(categories);
- }
-}
-
-void QBoxPlotSeriesPrivate::initializeGraphics(QGraphicsItem *parent)
-{
- Q_Q(QBoxPlotSeries);
-
- BoxPlotChartItem *boxPlot = new BoxPlotChartItem(q, parent);
- m_item.reset(boxPlot);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-
- if (m_chart) {
- connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesChange(QAbstractSeries*)) );
- connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SLOT(handleSeriesRemove(QAbstractSeries*)) );
-
- QList<QAbstractSeries *> serieses = m_chart->series();
-
- // Tries to find this series from the Chart's list of series and deduce the index
- int index = 0;
- foreach (QAbstractSeries *s, serieses) {
- if (s->type() == QAbstractSeries::SeriesTypeBoxPlot) {
- if (q == static_cast<QBoxPlotSeries *>(s)) {
- boxPlot->m_seriesIndex = index;
- m_index = index;
- }
- index++;
- }
- }
- boxPlot->m_seriesCount = index;
- }
-
- // Make BoxPlotChartItem to instantiate box & whisker items
- boxPlot->handleDataStructureChanged();
-}
-
-void QBoxPlotSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
-{
- Q_Q(QBoxPlotSeries);
-
- const QList<QGradient> gradients = theme->seriesGradients();
-
- if (forced || QChartPrivate::defaultBrush() == m_brush) {
- QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.5);
- q->setBrush(brushColor);
- }
-
- if (forced || QChartPrivate::defaultPen() == m_pen) {
- QPen pen = theme->outlinePen();
- pen.setCosmetic(true);
- q->setPen(pen);
- }
-}
-
-void QBoxPlotSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
-{
- BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data());
- Q_ASSERT(item);
- if (item->animation())
- item->animation()->stopAndDestroyLater();
-
- if (options.testFlag(QChart::SeriesAnimations))
- m_animation = new BoxPlotAnimation(item);
- else
- m_animation = 0;
- item->setAnimation(m_animation);
-
- QAbstractSeriesPrivate::initializeAnimations(options);
-}
-
-QList<QLegendMarker*> QBoxPlotSeriesPrivate::createLegendMarkers(QLegend *legend)
-{
- Q_Q(QBoxPlotSeries);
- QList<QLegendMarker *> list;
- return list << new QBoxPlotLegendMarker(q, legend);
-}
-
-void QBoxPlotSeriesPrivate::handleSeriesRemove(QAbstractSeries *series)
-{
- Q_Q(QBoxPlotSeries);
-
- QBoxPlotSeries *removedSeries = static_cast<QBoxPlotSeries *>(series);
-
- if (q == removedSeries && m_animation) {
- m_animation->stopAll();
- QObject::disconnect(m_chart->d_ptr->m_dataset, 0, removedSeries->d_func(), 0);
- }
-
- // Test if series removed is me, then don't do anything
- if (q != removedSeries) {
- BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data());
- if (item) {
- item->m_seriesCount = item->m_seriesCount - 1;
- if (removedSeries->d_func()->m_index < m_index) {
- m_index--;
- item->m_seriesIndex = m_index;
- }
-
- item->handleDataStructureChanged();
- }
- }
-}
-
-void QBoxPlotSeriesPrivate::handleSeriesChange(QAbstractSeries *series)
-{
- Q_UNUSED(series);
-
- Q_Q(QBoxPlotSeries);
-
- BoxPlotChartItem *boxPlot = static_cast<BoxPlotChartItem *>(m_item.data());
-
- if (m_chart) {
- QList<QAbstractSeries *> serieses = m_chart->series();
-
- // Tries to find this series from the Chart's list of series and deduce the index
- int index = 0;
- foreach (QAbstractSeries *s, serieses) {
- if (s->type() == QAbstractSeries::SeriesTypeBoxPlot) {
- if (q == static_cast<QBoxPlotSeries *>(s)) {
- boxPlot->m_seriesIndex = index;
- m_index = index;
- }
- index++;
- }
- }
- boxPlot->m_seriesCount = index;
- }
-
- boxPlot->handleDataStructureChanged();
-}
-
-bool QBoxPlotSeriesPrivate::append(QBoxSet *set)
-{
- if (m_boxSets.contains(set) || (set == 0) || set->d_ptr->m_series)
- return false; // Fail if set is already in list or set is null.
-
- m_boxSets.append(set);
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
- QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
- set->d_ptr->m_series = this;
-
- emit restructuredBoxes(); // this notifies boxplotchartitem
- return true;
-}
-
-bool QBoxPlotSeriesPrivate::remove(QBoxSet *set)
-{
- if (!m_boxSets.contains(set))
- return false; // Fail if set is not in list
-
- set->d_ptr->m_series = 0;
- m_boxSets.removeOne(set);
- QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
- QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
-
- emit restructuredBoxes(); // this notifies boxplotchartitem
- return true;
-}
-
-bool QBoxPlotSeriesPrivate::append(QList<QBoxSet *> sets)
-{
- foreach (QBoxSet *set, sets) {
- if ((set == 0) || m_boxSets.contains(set) || set->d_ptr->m_series)
- return false; // Fail if any of the sets is null or is already appended.
- if (sets.count(set) != 1)
- return false; // Also fail if same set is more than once in given list.
- }
-
- foreach (QBoxSet *set, sets) {
- m_boxSets.append(set);
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
- QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
- set->d_ptr->m_series = this;
- }
-
- emit restructuredBoxes(); // this notifies boxplotchartitem
- return true;
-}
-
-bool QBoxPlotSeriesPrivate::remove(QList<QBoxSet *> sets)
-{
- if (sets.count() == 0)
- return false;
-
- foreach (QBoxSet *set, sets) {
- if ((set == 0) || (!m_boxSets.contains(set)))
- return false; // Fail if any of the sets is null or is not in series
- if (sets.count(set) != 1)
- return false; // Also fail if same set is more than once in given list.
- }
-
- foreach (QBoxSet *set, sets) {
- set->d_ptr->m_series = 0;
- m_boxSets.removeOne(set);
- QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
- QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
- }
-
- emit restructuredBoxes(); // this notifies boxplotchartitem
-
- return true;
-}
-
-bool QBoxPlotSeriesPrivate::insert(int index, QBoxSet *set)
-{
- if ((m_boxSets.contains(set)) || (set == 0) || set->d_ptr->m_series)
- return false; // Fail if set is already in list or set is null.
-
- m_boxSets.insert(index, set);
- set->d_ptr->m_series = this;
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
- QObject::connect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
- QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
-
- emit restructuredBoxes(); // this notifies boxplotchartitem
- return true;
-}
-
-QBoxSet *QBoxPlotSeriesPrivate::boxSetAt(int index)
-{
- return m_boxSets.at(index);
-}
-
-qreal QBoxPlotSeriesPrivate::min()
-{
- if (m_boxSets.count() <= 0)
- return 0;
-
- qreal min = m_boxSets.at(0)->at(0);
-
- foreach (QBoxSet *set, m_boxSets) {
- for (int i = 0; i < 5; i++) {
- if (set->at(i) < min)
- min = set->at(i);
- }
- }
-
- return min;
-}
-
-qreal QBoxPlotSeriesPrivate::max()
-{
- if (m_boxSets.count() <= 0)
- return 0;
-
- qreal max = m_boxSets.at(0)->at(0);
-
- foreach (QBoxSet *set, m_boxSets) {
- for (int i = 0; i < 5; i++) {
- if (set->at(i) > max)
- max = set->at(i);
- }
- }
-
- return max;
-}
-
-#include "moc_qboxplotseries.cpp"
-#include "moc_qboxplotseries_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/boxplotchart/qboxplotseries.h b/src/boxplotchart/qboxplotseries.h
deleted file mode 100644
index f1b819a3..00000000
--- a/src/boxplotchart/qboxplotseries.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBOXPLOTSERIES_H
-#define QBOXPLOTSERIES_H
-
-#include <qchartglobal.h>
-#include <qboxset.h>
-#include <qabstractseries.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBoxPlotSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QBoxPlotSeries : public QAbstractSeries
-{
- Q_OBJECT
- Q_PROPERTY(bool boxOutlineVisible READ boxOutlineVisible WRITE setBoxOutlineVisible NOTIFY boxOutlineVisibilityChanged)
- Q_PROPERTY(qreal boxWidth READ boxWidth WRITE setBoxWidth NOTIFY boxWidthChanged)
- Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
- Q_PROPERTY(int count READ count NOTIFY countChanged REVISION 1)
-public:
- explicit QBoxPlotSeries(QObject *parent = 0);
- ~QBoxPlotSeries();
-
- bool append(QBoxSet *box);
- bool remove(QBoxSet *box);
- bool take(QBoxSet *box);
- bool append(QList<QBoxSet *> boxes);
- bool insert(int index, QBoxSet *box);
- int count() const;
- QList<QBoxSet *> boxSets() const;
- void clear();
-
- QAbstractSeries::SeriesType type() const;
-
- void setBoxOutlineVisible(bool visible);
- bool boxOutlineVisible();
- void setBoxWidth(qreal width);
- qreal boxWidth();
- void setBrush(const QBrush &brush);
- QBrush brush() const;
- void setPen(const QPen &pen);
- QPen pen() const;
-
-Q_SIGNALS:
- void clicked(QBoxSet *boxset);
- void hovered(bool status, QBoxSet *boxset);
- void countChanged();
- void penChanged();
- void brushChanged();
- void boxOutlineVisibilityChanged();
- void boxWidthChanged();
-
- void boxsetsAdded(QList<QBoxSet *> sets);
- void boxsetsRemoved(QList<QBoxSet *> sets);
-
-private:
- Q_DECLARE_PRIVATE(QBoxPlotSeries)
- Q_DISABLE_COPY(QBoxPlotSeries)
- friend class BoxPlotChartItem;
- friend class QBoxPlotLegendMarkerPrivate;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBOXPLOTSERIES_H
diff --git a/src/boxplotchart/qboxplotseries_p.h b/src/boxplotchart/qboxplotseries_p.h
deleted file mode 100644
index 4c87b0d8..00000000
--- a/src/boxplotchart/qboxplotseries_p.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QBOXPLOTSERIES_P_H
-#define QBOXPLOTSERIES_P_H
-
-#include "qboxplotseries.h"
-#include "qabstractbarseries_p.h"
-#include "abstractdomain_p.h"
-#include "qbarset.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class BoxPlotAnimation;
-
-class QBoxPlotSeriesPrivate : public QAbstractSeriesPrivate
-{
- Q_OBJECT
-
-public:
- QBoxPlotSeriesPrivate(QBoxPlotSeries *q);
- ~QBoxPlotSeriesPrivate();
-
- void initializeGraphics(QGraphicsItem *parent);
- void initializeDomain();
- void initializeAxes();
- void initializeAnimations(QChart::AnimationOptions options);
- void initializeTheme(int index, ChartTheme *theme, bool forced = false);
-
- QList<QLegendMarker*> createLegendMarkers(QLegend *legend);
-
- virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
- QAbstractAxis *createDefaultAxis(Qt::Orientation orientation) const;
-
- bool append(QBoxSet *set);
- bool remove(QBoxSet *set);
- bool append(QList<QBoxSet *> sets);
- bool remove(QList<QBoxSet *> sets);
- bool insert(int index, QBoxSet *set);
- QBoxSet *boxSetAt(int index);
-
- qreal max();
- qreal min();
-
-private:
- void populateCategories(QBarCategoryAxis *axis);
-
-Q_SIGNALS:
- void updated();
- void clicked(int index, QBoxSet *barset);
- void updatedBoxes();
- void updatedLayout();
- void restructuredBoxes();
-
-private slots:
- void handleSeriesChange(QAbstractSeries *series);
- void handleSeriesRemove(QAbstractSeries *series);
-
-protected:
- QList<QBoxSet *> m_boxSets;
- QPen m_pen;
- QBrush m_brush;
- bool m_boxOutlineVisible;
- int m_index;
- BoxPlotAnimation *m_animation;
- qreal m_boxWidth;
-
-private:
- Q_DECLARE_PUBLIC(QBoxPlotSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/boxplotchart/qboxset.cpp b/src/boxplotchart/qboxset.cpp
deleted file mode 100644
index 5ccf0a44..00000000
--- a/src/boxplotchart/qboxset.cpp
+++ /dev/null
@@ -1,336 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qboxset.h"
-#include "qboxset_p.h"
-#include "charthelpers_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QBoxSet
- \inmodule Qt Charts
- \brief Building block for box-and-whiskers chart
-
- QBoxSet represents one box-and-whiskers item. It takes five values to create a graphical representation
- of range and three medians. There are two ways to give the values. The first one is with constructor
- or stream operator (<<). The values have to be given in the following order: lower extreme,
- lower quartile, median, upper quartile and upper extreme. The Second method is to create an empty QBoxSet instance and
- give the values using setValue method.
-
- \mainclass
-
- \sa QBoxPlotSeries
-*/
-/*!
- \enum QBoxSet::ValuePositions
-
- \value LowerExtreme
- \value LowerQuartile
- \value Median
- \value UpperQuartile
- \value UpperExtreme
-*/
-/*!
- \property QBoxSet::pen
- \brief Defines the pen used by the box-and-whiskers set.
-*/
-/*!
- \property QBoxSet::brush
- \brief Defines the brush used by the box-and-whiskers set.
-*/
-
-/*!
- \qmlproperty QString BoxSet::brushFilename
- The name of the file used as a brush for the box-and-whiskers set.
-*/
-
-/*!
- \fn void QBoxSet::clicked()
- The signal is emitted if the user clicks with a mouse on top of box-and-whisker item.
-*/
-/*!
- \fn void QBoxSet::hovered(bool status)
-
- The signal is emitted if mouse is hovered on top of box-and-whisker item.
- Parameter \a status is true, if mouse entered on top of item, false if mouse left from top of item.
-*/
-/*!
- \fn void QBoxSet::penChanged()
- This signal is emitted when the pen of the box-and-whisker item has changed.
- \sa pen
-*/
-/*!
- \fn void QBoxSet::brushChanged()
- This signal is emitted when the brush of the box-and-whisker item has changed.
- \sa brush
-*/
-/*!
- \fn void QBoxSet::valuesChanged()
- This signal is emitted when multiple values have been changed on the box-and-whisker item.
- \sa append()
-*/
-/*!
- \fn void QBoxSet::valueChanged(int index)
- This signal is emitted values the value in the box-and-whisker item has been modified.
- Parameter \a index indicates the position of the modified value.
- \sa at()
-*/
-/*!
- \fn void QBoxSet::cleared()
- This signal is emitted when all the values on the set are cleared to 0.
-*/
-
-/*!
- Constructs QBoxSet with optional \a label and parent of \a parent
-*/
-QBoxSet::QBoxSet(const QString label, QObject *parent)
- : QObject(parent),
- d_ptr(new QBoxSetPrivate(label, this))
-{
-}
-
-/*!
- Constructs QBoxSet with given ordered values. \a le for lower extreme, \a lq for lower quartile, \a m for median,
- \a uq for upper quartile and \a ue for upper quartile. \a label and \a parent are optional.
- */
-QBoxSet::QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label, QObject *parent)
- : QObject(parent),
- d_ptr(new QBoxSetPrivate(label, this))
-{
- d_ptr->append(le);
- d_ptr->append(lq);
- d_ptr->append(m);
- d_ptr->append(uq);
- d_ptr->append(ue);
-}
-
-/*!
- Destroys the boxset
-*/
-QBoxSet::~QBoxSet()
-{
-}
-
-/*!
- Appends new value \a value to the end of set.
-*/
-void QBoxSet::append(const qreal value)
-{
- if (d_ptr->append(value))
- emit valueChanged(d_ptr->m_appendCount - 1);
-}
-
-/*!
- Appends a list of reals to set. Works like append with single real value. The \a values in list
- are appended to end of boxset.
- \sa append()
-*/
-void QBoxSet::append(const QList<qreal> &values)
-{
- if (d_ptr->append(values))
- emit valuesChanged();
-}
-
-/*!
- Sets new \a label for set.
-*/
-void QBoxSet::setLabel(const QString label)
-{
- d_ptr->m_label = label;
-}
-
-/*!
- Returns label of the set.
-*/
-QString QBoxSet::label() const
-{
- return d_ptr->m_label;
-}
-
-/*!
- Convenience operator. Same as append, with real \a value.
- \sa append()
-*/
-QBoxSet &QBoxSet::operator << (const qreal &value)
-{
- append(value);
- return *this;
-}
-
-/*!
- Sets a new \a value on the \a index position. For \a index ValuePositions can be used.
-*/
-void QBoxSet::setValue(const int index, const qreal value)
-{
- d_ptr->setValue(index, value);
- emit valueChanged(index);
-}
-
-/*!
- Sets all values on the set to 0.
- */
-void QBoxSet::clear()
-{
- d_ptr->clear();
- emit cleared();
-}
-
-/*!
- Returns value of set indexed by \a index. For \a index ValuePositions can be used.
- If the index is out of bounds 0.0 is returned.
-*/
-qreal QBoxSet::at(const int index) const
-{
- if (index < 0 || index >= 5)
- return 0;
- return d_ptr->m_values[index];
-}
-
-/*!
- Returns value of set indexed by \a index. For \a index ValuePositions can be used.
- If the index is out of bounds 0.0 is returned.
-*/
-qreal QBoxSet::operator [](const int index) const
-{
- return at(index);
-}
-
-/*!
- Returns count of values appended to the set.
-*/
-int QBoxSet::count() const
-{
- return d_ptr->m_appendCount;
-}
-
-/*!
- Sets pen for set. Boxes of this set are drawn using \a pen
-*/
-void QBoxSet::setPen(const QPen &pen)
-{
- if (d_ptr->m_pen != pen) {
- d_ptr->m_pen = pen;
- emit d_ptr->updatedBox();
- emit penChanged();
- }
-}
-
-/*!
- Returns pen of the set.
-*/
-QPen QBoxSet::pen() const
-{
- return d_ptr->m_pen;
-}
-
-/*!
- Sets brush for the set. Boxes of this set are drawn using \a brush
-*/
-void QBoxSet::setBrush(const QBrush &brush)
-{
- if (d_ptr->m_brush != brush) {
- d_ptr->m_brush = brush;
- emit d_ptr->updatedBox();
- emit brushChanged();
- }
-}
-
-/*!
- Returns brush of the set.
-*/
-QBrush QBoxSet::brush() const
-{
- return d_ptr->m_brush;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QBoxSetPrivate::QBoxSetPrivate(const QString label, QBoxSet *parent) : QObject(parent),
- q_ptr(parent),
- m_label(label),
- m_valuesCount(5),
- m_appendCount(0),
- m_pen(QPen(Qt::NoPen)),
- m_brush(QBrush(Qt::NoBrush)),
- m_series(0)
-{
- m_values = new qreal[m_valuesCount];
-}
-
-QBoxSetPrivate::~QBoxSetPrivate()
-{
-}
-
-bool QBoxSetPrivate::append(qreal value)
-{
- if (isValidValue(value) && m_appendCount < m_valuesCount) {
- m_values[m_appendCount++] = value;
- emit restructuredBox();
-
- return true;
- }
- return false;
-}
-
-bool QBoxSetPrivate::append(QList<qreal> values)
-{
- bool success = false;
-
- for (int i = 0; i < values.count(); i++) {
- if (isValidValue(values.at(i)) && m_appendCount < m_valuesCount) {
- success = true;
- m_values[m_appendCount++] = values.at(i);
- }
- }
-
- if (success)
- emit restructuredBox();
-
- return success;
-}
-
-void QBoxSetPrivate::clear()
-{
- m_appendCount = 0;
- for (int i = 0; i < m_valuesCount; i++)
- m_values[i] = 0.0;
- emit restructuredBox();
-}
-
-void QBoxSetPrivate::setValue(const int index, const qreal value)
-{
- if (index < m_valuesCount) {
- m_values[index] = value;
- emit updatedLayout();
- }
-}
-
-qreal QBoxSetPrivate::value(const int index)
-{
- if (index < 0 || index >= m_valuesCount)
- return 0;
- return m_values[index];
-}
-
-#include "moc_qboxset.cpp"
-#include "moc_qboxset_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/boxplotchart/qboxset.h b/src/boxplotchart/qboxset.h
deleted file mode 100644
index f54cbe61..00000000
--- a/src/boxplotchart/qboxset.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBOXSET_H
-#define QBOXSET_H
-
-#include <qchartglobal.h>
-#include <QPen>
-#include <QBrush>
-#include <QFont>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QBoxSetPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QBoxSet : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
-
-public:
- enum ValuePositions {
- LowerExtreme,
- LowerQuartile,
- Median,
- UpperQuartile,
- UpperExtreme
- };
-
-public:
- explicit QBoxSet(const QString label = QString(), QObject *parent = 0);
- explicit QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label = QString(), QObject *parent = 0);
- virtual ~QBoxSet();
-
- void append(const qreal value);
- void append(const QList<qreal> &values);
-
- void clear();
-
- void setLabel(const QString label);
- QString label() const;
-
- QBoxSet &operator << (const qreal &value);
-
- void setValue(const int index, const qreal value);
- qreal at(const int index) const;
- qreal operator [](const int index) const;
- int count() const;
-
- void setPen(const QPen &pen);
- QPen pen() const;
-
- void setBrush(const QBrush &brush);
- QBrush brush() const;
-
-Q_SIGNALS:
- void clicked();
- void hovered(bool status);
- void penChanged();
- void brushChanged();
-
- void valuesChanged();
- void valueChanged(int index);
- void cleared();
-
-private:
- QScopedPointer<QBoxSetPrivate> d_ptr;
- Q_DISABLE_COPY(QBoxSet)
- friend class BarLegendMarker;
- friend class BarChartItem;
- friend class BoxPlotChartItem;
- friend class QBoxPlotSeriesPrivate;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBOXSET_H
diff --git a/src/boxplotchart/qboxset_p.h b/src/boxplotchart/qboxset_p.h
deleted file mode 100644
index e34d8e18..00000000
--- a/src/boxplotchart/qboxset_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QBOXSET_P_H
-#define QBOXSET_P_H
-
-#include "qboxset.h"
-#include <QMap>
-#include <QPen>
-#include <QBrush>
-#include <QFont>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBoxPlotSeriesPrivate;
-
-class QBoxSetPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QBoxSetPrivate(const QString label, QBoxSet *parent);
- ~QBoxSetPrivate();
-
- bool append(qreal value);
- bool append(QList<qreal> values);
-
- int remove(const int index, const int count);
- void clear();
-
- void setValue(const int index, const qreal value);
-
- qreal value(const int index);
-
-Q_SIGNALS:
- void restructuredBox();
- void updatedBox();
- void updatedLayout();
-
-private:
- const QBoxSet *q_ptr;
- QString m_label;
- const int m_valuesCount;
- qreal *m_values;
- int m_appendCount;
- QPen m_pen;
- QBrush m_brush;
- QBrush m_labelBrush;
- QFont m_labelFont;
- QBoxPlotSeriesPrivate *m_series;
-
- friend class QBoxSet;
- friend class QBoxPlotSeriesPrivate;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBOXSET_P_H
diff --git a/src/boxplotchart/qvboxplotmodelmapper.cpp b/src/boxplotchart/qvboxplotmodelmapper.cpp
deleted file mode 100644
index fa870905..00000000
--- a/src/boxplotchart/qvboxplotmodelmapper.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvboxplotmodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QVBoxPlotModelMapper
- \inmodule Qt Charts
- \brief Vertical model mapper for bar series
- \mainclass
-
- Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
- Vertical model mapper is used to create a connection between QBoxPlotSeries and QAbstractItemModel derived model object.
- Model mapper maintains equal size of all the QBoxSets.
- \note used model has to support adding/removing rows/columns and modifying the data of the cells.
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype VBoxPlotModelMapper
- \instantiates QVBoxPlotModelMapper
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/vboxplotmodelmapper.qdocinc
-*/
-#else
-/*!
- \qmlclass VBoxPlotModelMapper QVBoxPlotModelMapper
-
- \include ../doc/src/vboxplotmodelmapper.qdocinc
-*/
-#endif
-
-/*!
- \property QVBoxPlotModelMapper::series
- \brief Defines the QBoxPlotSeries object that is used by the mapper.
-
- All the data in the series is discarded when it is set to the mapper.
- When new series is specified the old series is disconnected (it preserves its data)
-*/
-/*!
- \qmlproperty AbstractBarSeries VBoxPlotModelMapper::series
- Defines the AbstractBarSeries based object that is used by the mapper. All the data in the series is discarded when it is
- set to the mapper. When new series is specified the old series is disconnected (it preserves its data).
-*/
-
-/*!
- \property QVBoxPlotModelMapper::model
- \brief Defines the model that is used by the mapper.
-*/
-/*!
- \qmlproperty SomeModel VBoxPlotModelMapper::model
- The QAbstractItemModel based model that is used by the mapper. You need to implement the model
- and expose it to QML. \note the model has to support adding/removing rows/columns and modifying
- the data of the cells.
-*/
-
-/*!
- \property QVBoxPlotModelMapper::firstBoxSetColumn
- \brief Defines which column of the model is used as the data source for the first box-and-whiskers set.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int VBarModelMapper::firstBoxSetColumn
- Defines which column of the model is used as the data source for the first box-and-whiskers set. Default value
- is: -1 (invalid mapping).
-*/
-
-/*!
- \property QVBoxPlotModelMapper::lastBoxSetColumn
- \brief Defines which column of the model is used as the data source for the last box-and-whiskers set.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int VBarModelMapper::lastBoxSetColumn
- Defines which column of the model is used as the data source for the last box-and-whiskers set. Default
- value is: -1 (invalid mapping).
-*/
-
-/*!
- \property QVBoxPlotModelMapper::firstRow
- \brief Defines which row of the model contains the first values of the QBoxSets in the series.
-
- Minimal and default value is: 0
-*/
-/*!
- \qmlproperty int VBoxPlotModelMapper::firstRow
- Defines which row of the model contains the first values of the QBoxSets in the series.
- The default value is 0.
-*/
-
-/*!
- \property QVBoxPlotModelMapper::rowCount
- \brief Defines the number of rows of the model that are mapped as the data for QBoxPlotSeries
-
- Minimal and default value is: -1 (count limited by the number of rows in the model)
-*/
-/*!
- \qmlproperty int VBoxModelMapper::rowCount
- Defines the number of rows of the model that are mapped as the data for QBoxPlotSeries. The default value is
- -1 (count limited by the number of rows in the model)
-*/
-
-/*!
- \fn void QVBoxPlotModelMapper::seriesReplaced()
-
- Emitted when the series to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QVBoxPlotModelMapper::modelReplaced()
-
- Emitted when the model to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QVBoxPlotModelMapper::firstBoxSetColumnChanged()
- Emitted when the firstBoxSetColumn has changed.
-*/
-
-/*!
- \fn void QVBoxPlotModelMapper::lastBoxSetColumnChanged()
- Emitted when the lastBoxSetColumn has changed.
-*/
-
-/*!
- \fn void QVBoxPlotModelMapper::firstRowChanged()
- Emitted when the firstRow has changed.
-*/
-
-/*!
- \fn void QVBoxPlotModelMapper::rowCountChanged()
- Emitted when the rowCount has changed.
-*/
-
-/*!
- Constructs a mapper object which is a child of \a parent.
-*/
-QVBoxPlotModelMapper::QVBoxPlotModelMapper(QObject *parent) :
- QBoxPlotModelMapper(parent)
-{
- QBoxPlotModelMapper::setOrientation(Qt::Vertical);
-}
-
-QAbstractItemModel *QVBoxPlotModelMapper::model() const
-{
- return QBoxPlotModelMapper::model();
-}
-
-void QVBoxPlotModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model != QBoxPlotModelMapper::model()) {
- QBoxPlotModelMapper::setModel(model);
- emit modelReplaced();
- }
-}
-
-QBoxPlotSeries *QVBoxPlotModelMapper::series() const
-{
- return QBoxPlotModelMapper::series();
-}
-
-void QVBoxPlotModelMapper::setSeries(QBoxPlotSeries *series)
-{
- if (series != QBoxPlotModelMapper::series()) {
- QBoxPlotModelMapper::setSeries(series);
- emit seriesReplaced();
- }
-}
-
-int QVBoxPlotModelMapper::firstBoxSetColumn() const
-{
- return QBoxPlotModelMapper::firstBoxSetSection();
-}
-
-void QVBoxPlotModelMapper::setFirstBoxSetColumn(int firstBoxSetColumn)
-{
- if (firstBoxSetColumn != firstBoxSetSection()) {
- QBoxPlotModelMapper::setFirstBoxSetSection(firstBoxSetColumn);
- emit firstBoxSetColumnChanged();
- }
-}
-
-int QVBoxPlotModelMapper::lastBoxSetColumn() const
-{
- return QBoxPlotModelMapper::lastBoxSetSection();
-}
-
-void QVBoxPlotModelMapper::setLastBoxSetColumn(int lastBoxSetColumn)
-{
- if (lastBoxSetColumn != lastBoxSetSection()) {
- QBoxPlotModelMapper::setLastBoxSetSection(lastBoxSetColumn);
- emit lastBoxSetColumnChanged();
- }
-}
-
-int QVBoxPlotModelMapper::firstRow() const
-{
- return QBoxPlotModelMapper::first();
-}
-
-void QVBoxPlotModelMapper::setFirstRow(int firstRow)
-{
- if (firstRow != first()) {
- QBoxPlotModelMapper::setFirst(firstRow);
- emit firstRowChanged();
- }
-}
-
-int QVBoxPlotModelMapper::rowCount() const
-{
- return QBoxPlotModelMapper::count();
-}
-
-void QVBoxPlotModelMapper::setRowCount(int rowCount)
-{
- if (rowCount != count()) {
- QBoxPlotModelMapper::setCount(rowCount);
- emit rowCountChanged();
- }
-}
-
-#include "moc_qvboxplotmodelmapper.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/boxplotchart/qvboxplotmodelmapper.h b/src/boxplotchart/qvboxplotmodelmapper.h
deleted file mode 100644
index 2bcb7f64..00000000
--- a/src/boxplotchart/qvboxplotmodelmapper.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVBOXPLOTMODELMAPPER_H
-#define QVBOXPLOTMODELMAPPER_H
-
-#include <QBoxPlotModelMapper>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_EXPORT QVBoxPlotModelMapper : public QBoxPlotModelMapper
-{
- Q_OBJECT
- Q_PROPERTY(QBoxPlotSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
- Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
- Q_PROPERTY(int firstBoxSetColumn READ firstBoxSetColumn WRITE setFirstBoxSetColumn NOTIFY firstBoxSetColumnChanged)
- Q_PROPERTY(int lastBoxSetColumn READ lastBoxSetColumn WRITE setLastBoxSetColumn NOTIFY lastBoxSetColumnChanged)
- Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
- Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
-
-public:
- explicit QVBoxPlotModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QBoxPlotSeries *series() const;
- void setSeries(QBoxPlotSeries *series);
-
- int firstBoxSetColumn() const;
- void setFirstBoxSetColumn(int firstBoxSetColumn);
-
- int lastBoxSetColumn() const;
- void setLastBoxSetColumn(int lastBoxSetColumn);
-
- int firstRow() const;
- void setFirstRow(int firstRow);
-
- int rowCount() const;
- void setRowCount(int rowCount);
-
-Q_SIGNALS:
- void seriesReplaced();
- void modelReplaced();
- void firstBoxSetColumnChanged();
- void lastBoxSetColumnChanged();
- void firstRowChanged();
- void rowCountChanged();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QVBOXPLOTMODELMAPPER_H
diff --git a/src/chartbackground.cpp b/src/chartbackground.cpp
deleted file mode 100644
index f199a970..00000000
--- a/src/chartbackground.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartbackground_p.h"
-#include "chartconfig_p.h"
-#include <QPen>
-#include <QBrush>
-#include <QPainter>
-#include <QGraphicsDropShadowEffect>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartBackground::ChartBackground(QGraphicsItem *parent)
- : QGraphicsRectItem(parent),
- m_diameter(5),
- m_dropShadow(0)
-{
-}
-
-ChartBackground::~ChartBackground()
-{
-
-}
-
-void ChartBackground::setDropShadowEnabled(bool enabled)
-{
-#ifdef QT_NO_GRAPHICSEFFECT
- Q_UNUSED(enabled)
-#else
- if (enabled) {
- if (!m_dropShadow) {
- m_dropShadow = new QGraphicsDropShadowEffect();
-#ifdef Q_OS_MAC
- m_dropShadow->setBlurRadius(15);
- m_dropShadow->setOffset(0, 0);
-#elif defined(Q_OS_WIN)
- m_dropShadow->setBlurRadius(10);
- m_dropShadow->setOffset(0, 0);
-#else
- m_dropShadow->setBlurRadius(10);
- m_dropShadow->setOffset(5, 5);
-#endif
- setGraphicsEffect(m_dropShadow);
- }
- } else {
- delete m_dropShadow;
- m_dropShadow = 0;
- }
-#endif
-}
-
-void ChartBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
- painter->save();
- painter->setPen(pen());
- painter->setBrush(brush());
- painter->drawRoundedRect(rect(), m_diameter, m_diameter);
-#ifndef QT_NO_DEBUG
- painter->setPen(Qt::gray);
- QFont font;
- QString build("build %1");
- font.setPointSize(6);
- painter->setFont(font);
- painter->drawText(rect().bottomLeft(), build.arg(ChartConfig::instance()->compilationTime()));
-#endif
- painter->restore();
-}
-
-qreal ChartBackground::diameter() const
-{
- return m_diameter;
-}
-
-void ChartBackground::setDiameter(qreal diameter)
-{
- m_diameter = diameter;
- update();
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/chartbackground_p.h b/src/chartbackground_p.h
deleted file mode 100644
index 455278ae..00000000
--- a/src/chartbackground_p.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTBACKGROUND_H
-#define CHARTBACKGROUND_H
-
-#include "qchartglobal.h"
-#include <QGraphicsRectItem>
-
-class QGraphicsDropShadowEffect;
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartBackground: public QGraphicsRectItem
-{
-public:
- ChartBackground(QGraphicsItem *parent = 0);
- ~ChartBackground();
-
- void setDiameter(qreal diameter);
- qreal diameter() const;
- void setDropShadowEnabled(bool enabled);
- bool isDropShadowEnabled() { return m_dropShadow != 0; }
-
-protected:
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
-
-private:
- qreal m_diameter;
- QGraphicsDropShadowEffect *m_dropShadow;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTBACKGROUND_H */
-
-
diff --git a/src/chartconfig_p.h b/src/chartconfig_p.h
deleted file mode 100644
index 6007333c..00000000
--- a/src/chartconfig_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTCONFIG_H
-#define CHARTCONFIG_H
-
-#include "qchartglobal.h"
-
-#ifdef Q_CC_MSVC
-// There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly.
-// This is the case at least with shadow builds.
-// http://qt-project.org/wiki/jom
-#undef DEVELOPMENT_BUILD
-#endif
-
-#ifndef DEVELOPMENT_BUILD
-#if defined (Q_OS_ANDROID) || defined (Q_OS_IOS)
-// Android builds do not have __DATE__
-const char *buildTime = __TIME__;
-#else
-const char *buildTime = __TIME__" "__DATE__;
-#endif
-const char *gitHead = "unknown";
-#else
-#include "qchartversion_p.h"
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartConfig
-{
-private:
- ChartConfig() {
-#if defined(DEVELOPMENT_BUILD) && !defined(QT_NO_DEBUG)
- qDebug() << "buildTime" << buildTime;
- qDebug() << "gitHead" << gitHead;
-#endif
- m_instance = this;
- }
-public:
- static ChartConfig *instance() {
- if (!m_instance) {
- m_instance = new ChartConfig();
- }
- return m_instance;
- }
-
- QString compilationTime() {
- return QString(buildTime);
- }
-
- QString compilationHead() {
- return QString(gitHead);
- }
-
-private:
- static ChartConfig *m_instance;
-};
-
-
-ChartConfig *ChartConfig::m_instance = 0;
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/chartdataset.cpp b/src/chartdataset.cpp
deleted file mode 100644
index 395b77fb..00000000
--- a/src/chartdataset.cpp
+++ /dev/null
@@ -1,639 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartdataset_p.h"
-#include "chartpresenter_p.h"
-#include "qchart.h"
-#include "qchart_p.h"
-#include "qvalueaxis.h"
-#include "qbarcategoryaxis.h"
-#include "qvalueaxis_p.h"
-#include "qcategoryaxis.h"
-#include "qabstractseries_p.h"
-#include "qabstractbarseries.h"
-#include "qstackedbarseries.h"
-#include "qpercentbarseries.h"
-#include "qpieseries.h"
-#include "chartitem_p.h"
-#include "xydomain_p.h"
-#include "xypolardomain_p.h"
-#include "xlogydomain_p.h"
-#include "logxydomain_p.h"
-#include "logxlogydomain_p.h"
-#include "xlogypolardomain_p.h"
-#include "logxypolardomain_p.h"
-#include "logxlogypolardomain_p.h"
-
-#ifndef QT_ON_ARM
-#include "qdatetimeaxis.h"
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartDataSet::ChartDataSet(QChart *chart)
- : QObject(chart),
- m_chart(chart)
-{
-
-}
-
-ChartDataSet::~ChartDataSet()
-{
- deleteAllSeries();
- deleteAllAxes();
-}
-
-/*
- * This method adds series to chartdataset, series ownership is taken from caller.
- */
-void ChartDataSet::addSeries(QAbstractSeries *series)
-{
- if (m_seriesList.contains(series)) {
- qWarning() << QObject::tr("Can not add series. Series already on the chart.");
- return;
- }
-
- // Ignore unsupported series added to polar chart
- if (m_chart && m_chart->chartType() == QChart::ChartTypePolar) {
- if (!(series->type() == QAbstractSeries::SeriesTypeArea
- || series->type() == QAbstractSeries::SeriesTypeLine
- || series->type() == QAbstractSeries::SeriesTypeScatter
- || series->type() == QAbstractSeries::SeriesTypeSpline)) {
- qWarning() << QObject::tr("Can not add series. Series type is not supported by a polar chart.");
- return;
- }
- series->d_ptr->setDomain(new XYPolarDomain());
- } else {
- series->d_ptr->setDomain(new XYDomain());
- }
-
- series->d_ptr->initializeDomain();
- m_seriesList.append(series);
-
- series->setParent(this); // take ownership
- series->d_ptr->m_chart = m_chart;
-
- emit seriesAdded(series);
-}
-
-/*
- * This method adds axis to chartdataset, axis ownership is taken from caller.
- */
-void ChartDataSet::addAxis(QAbstractAxis *axis, Qt::Alignment aligment)
-{
- if (m_axisList.contains(axis)) {
- qWarning() << QObject::tr("Can not add axis. Axis already on the chart.");
- return;
- }
-
- axis->d_ptr->setAlignment(aligment);
-
- if (!axis->alignment()) {
- qWarning() << QObject::tr("No alignment specified !");
- return;
- };
-
- AbstractDomain *newDomain;
- if (m_chart && m_chart->chartType() == QChart::ChartTypePolar)
- newDomain = new XYPolarDomain();
- else
- newDomain = new XYDomain();
-
- QSharedPointer<AbstractDomain> domain(newDomain);
- axis->d_ptr->initializeDomain(domain.data());
-
- axis->setParent(this);
- axis->d_ptr->m_chart = m_chart;
- m_axisList.append(axis);
-
- emit axisAdded(axis);
-}
-
-/*
- * This method removes series form chartdataset, series ownership is passed back to caller.
- */
-void ChartDataSet::removeSeries(QAbstractSeries *series)
-{
-
- if (! m_seriesList.contains(series)) {
- qWarning() << QObject::tr("Can not remove series. Series not found on the chart.");
- return;
- }
-
- QList<QAbstractAxis*> axes = series->d_ptr->m_axes;
-
- foreach(QAbstractAxis* axis, axes) {
- detachAxis(series,axis);
- }
-
- emit seriesRemoved(series);
- m_seriesList.removeAll(series);
-
- // Reset domain to default
- series->d_ptr->setDomain(new XYDomain());
- series->setParent(0);
- series->d_ptr->m_chart = 0;
-}
-
-/*
- * This method removes axis form chartdataset, series ownership is passed back to caller.
- */
-void ChartDataSet::removeAxis(QAbstractAxis *axis)
-{
- if (! m_axisList.contains(axis)) {
- qWarning() << QObject::tr("Can not remove axis. Axis not found on the chart.");
- return;
- }
-
- QList<QAbstractSeries*> series = axis->d_ptr->m_series;
-
- foreach(QAbstractSeries* s, series) {
- detachAxis(s,axis);
- }
-
- emit axisRemoved(axis);
- m_axisList.removeAll(axis);
-
- axis->setParent(0);
- axis->d_ptr->m_chart = 0;
-}
-
-/*
- * This method attaches axis to series, return true if success.
- */
-bool ChartDataSet::attachAxis(QAbstractSeries *series,QAbstractAxis *axis)
-{
- Q_ASSERT(axis);
-
- if (!series)
- return false;
-
- QList<QAbstractSeries *> attachedSeriesList = axis->d_ptr->m_series;
- QList<QAbstractAxis *> attachedAxisList = series->d_ptr->m_axes;
-
- if (!m_seriesList.contains(series)) {
- qWarning() << QObject::tr("Can not find series on the chart.");
- return false;
- }
-
- if (axis && !m_axisList.contains(axis)) {
- qWarning() << QObject::tr("Can not find axis on the chart.");
- return false;
- }
-
- if (attachedAxisList.contains(axis)) {
- qWarning() << QObject::tr("Axis already attached to series.");
- return false;
- }
-
- if (attachedSeriesList.contains(series)) {
- qWarning() << QObject::tr("Axis already attached to series.");
- return false;
- }
-
- AbstractDomain *domain = series->d_ptr->domain();
- AbstractDomain::DomainType type = selectDomain(attachedAxisList<<axis);
-
- if (type == AbstractDomain::UndefinedDomain) return false;
-
- if (domain->type() != type) {
- AbstractDomain *old = domain;
- domain = createDomain(type);
- domain->setRange(old->minX(), old->maxX(), old->minY(), old->maxY());
- // Initialize domain size to old domain size, as it won't get updated
- // unless geometry changes.
- domain->setSize(old->size());
- }
-
- if (!domain)
- return false;
-
- if (!domain->attachAxis(axis))
- return false;
-
- QList<AbstractDomain *> blockedDomains;
- domain->blockRangeSignals(true);
- blockedDomains << domain;
-
- if (domain != series->d_ptr->domain()) {
- foreach (QAbstractAxis *axis, series->d_ptr->m_axes) {
- series->d_ptr->domain()->detachAxis(axis);
- domain->attachAxis(axis);
- foreach (QAbstractSeries *otherSeries, axis->d_ptr->m_series) {
- if (otherSeries != series && otherSeries->d_ptr->domain()) {
- if (!otherSeries->d_ptr->domain()->rangeSignalsBlocked()) {
- otherSeries->d_ptr->domain()->blockRangeSignals(true);
- blockedDomains << otherSeries->d_ptr->domain();
- }
- }
- }
- }
- series->d_ptr->setDomain(domain);
- series->d_ptr->initializeDomain();
- }
-
- series->d_ptr->m_axes<<axis;
- axis->d_ptr->m_series<<series;
-
- series->d_ptr->initializeAxes();
- axis->d_ptr->initializeDomain(domain);
-
- foreach (AbstractDomain *blockedDomain, blockedDomains)
- blockedDomain->blockRangeSignals(false);
-
- return true;
-}
-
-/*
- * This method detaches axis to series, return true if success.
- */
-bool ChartDataSet::detachAxis(QAbstractSeries* series,QAbstractAxis *axis)
-{
- Q_ASSERT(series);
- Q_ASSERT(axis);
-
- QList<QAbstractSeries* > attachedSeriesList = axis->d_ptr->m_series;
- QList<QAbstractAxis* > attachedAxisList = series->d_ptr->m_axes;
- AbstractDomain* domain = series->d_ptr->domain();
-
- if (!m_seriesList.contains(series)) {
- qWarning() << QObject::tr("Can not find series on the chart.");
- return false;
- }
-
- if (axis && !m_axisList.contains(axis)) {
- qWarning() << QObject::tr("Can not find axis on the chart.");
- return false;
- }
-
- if (!attachedAxisList.contains(axis)) {
- qWarning() << QObject::tr("Axis not attached to series.");
- return false;
- }
-
- Q_ASSERT(axis->d_ptr->m_series.contains(series));
-
- domain->detachAxis(axis);
- series->d_ptr->m_axes.removeAll(axis);
- axis->d_ptr->m_series.removeAll(series);
-
- return true;
-}
-
-void ChartDataSet::createDefaultAxes()
-{
- if (m_seriesList.isEmpty())
- return;
-
- QAbstractAxis::AxisTypes typeX(0);
- QAbstractAxis::AxisTypes typeY(0);
-
- // Remove possibly existing axes
- deleteAllAxes();
-
- Q_ASSERT(m_axisList.isEmpty());
-
- // Select the required axis x and axis y types based on the types of the current series
- foreach(QAbstractSeries* s, m_seriesList) {
- typeX |= s->d_ptr->defaultAxisType(Qt::Horizontal);
- typeY |= s->d_ptr->defaultAxisType(Qt::Vertical);
- }
-
- // Create the axes of the types selected
- // As long as AxisType enum balues are sequential a check to see if there are series of
- // different types is needed. In such cases AxisTypeNoAxis is used to create separate axes
- // for the types.
- if (typeX != QAbstractAxis::AxisTypeNoAxis) {
- if (typeX != m_seriesList.first()->d_ptr->defaultAxisType(Qt::Horizontal))
- typeX = QAbstractAxis::AxisTypeNoAxis;
- createAxes(typeX, Qt::Horizontal);
- }
-
- if (typeY != QAbstractAxis::AxisTypeNoAxis) {
- if (typeY != m_seriesList.first()->d_ptr->defaultAxisType(Qt::Vertical))
- typeY = QAbstractAxis::AxisTypeNoAxis;
- createAxes(typeY, Qt::Vertical);
- }
-
-}
-
-void ChartDataSet::createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation orientation)
-{
- QAbstractAxis *axis = 0;
- //decide what axis should be created
-
- switch (type) {
- case QAbstractAxis::AxisTypeValue:
- axis = new QValueAxis(this);
- break;
- case QAbstractAxis::AxisTypeBarCategory:
- axis = new QBarCategoryAxis(this);
- break;
- case QAbstractAxis::AxisTypeCategory:
- axis = new QCategoryAxis(this);
- break;
-#ifndef Q_WS_QWS
- case QAbstractAxis::AxisTypeDateTime:
- axis = new QDateTimeAxis(this);
- break;
-#endif
- default:
- axis = 0;
- break;
- }
-
- if (axis) {
- //create one axis for all
-
- addAxis(axis,orientation==Qt::Horizontal?Qt::AlignBottom:Qt::AlignLeft);
- qreal min = 0;
- qreal max = 0;
- findMinMaxForSeries(m_seriesList,orientation,min,max);
- foreach(QAbstractSeries *s, m_seriesList) {
- attachAxis(s,axis);
- }
- axis->setRange(min,max);
- }
- else if (type.testFlag(QAbstractAxis::AxisTypeNoAxis)) {
- //create separate axis
- foreach(QAbstractSeries *s, m_seriesList) {
- QAbstractAxis *axis = s->d_ptr->createDefaultAxis(orientation);
- if(axis) {
- addAxis(axis,orientation==Qt::Horizontal?Qt::AlignBottom:Qt::AlignLeft);
- attachAxis(s,axis);
- }
- }
- }
-}
-
-void ChartDataSet::findMinMaxForSeries(QList<QAbstractSeries *> series,Qt::Orientations orientation, qreal &min, qreal &max)
-{
- Q_ASSERT(!series.isEmpty());
-
- AbstractDomain *domain = series.first()->d_ptr->domain();
- min = (orientation == Qt::Vertical) ? domain->minY() : domain->minX();
- max = (orientation == Qt::Vertical) ? domain->maxY() : domain->maxX();
-
- for (int i = 1; i< series.size(); i++) {
- AbstractDomain *domain = series[i]->d_ptr->domain();
- min = qMin((orientation == Qt::Vertical) ? domain->minY() : domain->minX(), min);
- max = qMax((orientation == Qt::Vertical) ? domain->maxY() : domain->maxX(), max);
- }
- if (min == max) {
- min -= 0.5;
- max += 0.5;
- }
-}
-
-void ChartDataSet::deleteAllSeries()
-{
- foreach (QAbstractSeries *s , m_seriesList){
- removeSeries(s);
- s->deleteLater();
- }
- Q_ASSERT(m_seriesList.count() == 0);
-}
-
-void ChartDataSet::deleteAllAxes()
-{
- foreach (QAbstractAxis *a , m_axisList){
- removeAxis(a);
- a->deleteLater();
- }
- Q_ASSERT(m_axisList.count() == 0);
-}
-
-void ChartDataSet::zoomInDomain(const QRectF &rect)
-{
- QList<AbstractDomain*> domains;
- foreach(QAbstractSeries *s, m_seriesList) {
- AbstractDomain* domain = s->d_ptr->domain();
- s->d_ptr->m_domain->blockRangeSignals(true);
- domains<<domain;
- }
-
- foreach(AbstractDomain *domain, domains)
- domain->zoomIn(rect);
-
- foreach(AbstractDomain *domain, domains)
- domain->blockRangeSignals(false);
-}
-
-void ChartDataSet::zoomOutDomain(const QRectF &rect)
-{
- QList<AbstractDomain*> domains;
- foreach(QAbstractSeries *s, m_seriesList) {
- AbstractDomain* domain = s->d_ptr->domain();
- s->d_ptr->m_domain->blockRangeSignals(true);
- domains<<domain;
- }
-
- foreach(AbstractDomain *domain, domains)
- domain->zoomOut(rect);
-
- foreach(AbstractDomain *domain, domains)
- domain->blockRangeSignals(false);
-}
-
-void ChartDataSet::zoomResetDomain()
-{
- QList<AbstractDomain*> domains;
- foreach (QAbstractSeries *s, m_seriesList) {
- AbstractDomain *domain = s->d_ptr->domain();
- s->d_ptr->m_domain->blockRangeSignals(true);
- domains << domain;
- }
-
- foreach (AbstractDomain *domain, domains)
- domain->zoomReset();
-
- foreach (AbstractDomain *domain, domains)
- domain->blockRangeSignals(false);
-}
-
-bool ChartDataSet::isZoomedDomain()
-{
- foreach (QAbstractSeries *s, m_seriesList) {
- if (s->d_ptr->domain()->isZoomed())
- return true;
- }
- return false;
-}
-
-void ChartDataSet::scrollDomain(qreal dx, qreal dy)
-{
- QList<AbstractDomain*> domains;
- foreach(QAbstractSeries *s, m_seriesList) {
- AbstractDomain* domain = s->d_ptr->domain();
- s->d_ptr->m_domain->blockRangeSignals(true);
- domains<<domain;
- }
-
- foreach(AbstractDomain *domain, domains)
- domain->move(dx, dy);
-
- foreach(AbstractDomain *domain, domains)
- domain->blockRangeSignals(false);
-}
-
-QPointF ChartDataSet::mapToValue(const QPointF &position, QAbstractSeries *series)
-{
- QPointF point;
- if (series == 0 && !m_seriesList.isEmpty())
- series = m_seriesList.first();
-
- if (series && series->type() == QAbstractSeries::SeriesTypePie)
- return point;
-
- if (series && m_seriesList.contains(series))
- point = series->d_ptr->m_domain->calculateDomainPoint(position - m_chart->plotArea().topLeft());
- return point;
-}
-
-QPointF ChartDataSet::mapToPosition(const QPointF &value, QAbstractSeries *series)
-{
- QPointF point = m_chart->plotArea().topLeft();
- if (series == 0 && !m_seriesList.isEmpty())
- series = m_seriesList.first();
-
- if (series && series->type() == QAbstractSeries::SeriesTypePie)
- return QPoint(0, 0);
-
- bool ok;
- if (series && m_seriesList.contains(series))
- point += series->d_ptr->m_domain->calculateGeometryPoint(value, ok);
- return point;
-}
-
-QList<QAbstractAxis *> ChartDataSet::axes() const
-{
- return m_axisList;
-}
-
-QList<QAbstractSeries *> ChartDataSet::series() const
-{
- return m_seriesList;
-}
-
-AbstractDomain::DomainType ChartDataSet::selectDomain(QList<QAbstractAxis *> axes)
-{
- enum Type {
- Undefined = 0,
- LogType = 0x1,
- ValueType = 0x2
- };
-
- int horizontal(Undefined);
- int vertical(Undefined);
-
- // Assume cartesian chart type, unless chart is set
- QChart::ChartType chartType(QChart::ChartTypeCartesian);
- if (m_chart)
- chartType = m_chart->chartType();
-
- foreach (QAbstractAxis *axis, axes)
- {
- switch (axis->type()) {
- case QAbstractAxis::AxisTypeLogValue:
- if (axis->orientation() == Qt::Horizontal)
- horizontal |= LogType;
- if (axis->orientation() == Qt::Vertical)
- vertical |= LogType;
- break;
- case QAbstractAxis::AxisTypeValue:
- case QAbstractAxis::AxisTypeBarCategory:
- case QAbstractAxis::AxisTypeCategory:
- case QAbstractAxis::AxisTypeDateTime:
- if (axis->orientation() == Qt::Horizontal)
- horizontal |= ValueType;
- if (axis->orientation() == Qt::Vertical)
- vertical |= ValueType;
- break;
- default:
- qWarning() << "Undefined type";
- break;
- }
- }
-
- if (vertical == Undefined)
- vertical = ValueType;
- if (horizontal == Undefined)
- horizontal = ValueType;
-
- if (vertical == ValueType && horizontal == ValueType) {
- if (chartType == QChart::ChartTypeCartesian)
- return AbstractDomain::XYDomain;
- else if (chartType == QChart::ChartTypePolar)
- return AbstractDomain::XYPolarDomain;
- }
-
- if (vertical == LogType && horizontal == ValueType) {
- if (chartType == QChart::ChartTypeCartesian)
- return AbstractDomain::XLogYDomain;
- if (chartType == QChart::ChartTypePolar)
- return AbstractDomain::XLogYPolarDomain;
- }
-
- if (vertical == ValueType && horizontal == LogType) {
- if (chartType == QChart::ChartTypeCartesian)
- return AbstractDomain::LogXYDomain;
- else if (chartType == QChart::ChartTypePolar)
- return AbstractDomain::LogXYPolarDomain;
- }
-
- if (vertical == LogType && horizontal == LogType) {
- if (chartType == QChart::ChartTypeCartesian)
- return AbstractDomain::LogXLogYDomain;
- else if (chartType == QChart::ChartTypePolar)
- return AbstractDomain::LogXLogYPolarDomain;
- }
-
- return AbstractDomain::UndefinedDomain;
-}
-
-//refactor create factory
-AbstractDomain* ChartDataSet::createDomain(AbstractDomain::DomainType type)
-{
- switch (type)
- {
- case AbstractDomain::LogXLogYDomain:
- return new LogXLogYDomain();
- case AbstractDomain::XYDomain:
- return new XYDomain();
- case AbstractDomain::XLogYDomain:
- return new XLogYDomain();
- case AbstractDomain::LogXYDomain:
- return new LogXYDomain();
- case AbstractDomain::XYPolarDomain:
- return new XYPolarDomain();
- case AbstractDomain::XLogYPolarDomain:
- return new XLogYPolarDomain();
- case AbstractDomain::LogXYPolarDomain:
- return new LogXYPolarDomain();
- case AbstractDomain::LogXLogYPolarDomain:
- return new LogXLogYPolarDomain();
- default:
- return 0;
- }
-}
-
-#include "moc_chartdataset_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/chartdataset_p.h b/src/chartdataset_p.h
deleted file mode 100644
index 349bdf6c..00000000
--- a/src/chartdataset_p.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTDATASET_P_H
-#define CHARTDATASET_P_H
-
-#include "qabstractseries.h"
-#include "abstractdomain_p.h"
-#include "qabstractaxis_p.h"
-#include <QVector>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractAxis;
-class ChartPresenter;
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT ChartDataSet : public QObject
-{
- Q_OBJECT
-public:
- ChartDataSet(QChart *chart);
- virtual ~ChartDataSet();
-
- void addSeries(QAbstractSeries *series);
- void removeSeries(QAbstractSeries *series);
- QList<QAbstractSeries *> series() const;
-
- void addAxis(QAbstractAxis *axis,Qt::Alignment aligment);
- void removeAxis(QAbstractAxis *axis);
- QList<QAbstractAxis*> axes() const;
-
- bool attachAxis(QAbstractSeries* series,QAbstractAxis *axis);
- bool detachAxis(QAbstractSeries* series,QAbstractAxis *axis);
-
- void createDefaultAxes();
-
- void zoomInDomain(const QRectF &rect);
- void zoomOutDomain(const QRectF &rect);
- void zoomResetDomain();
- bool isZoomedDomain();
- void scrollDomain(qreal dx, qreal dy);
-
- QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0);
- QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0);
-
-Q_SIGNALS:
- void axisAdded(QAbstractAxis* axis);
- void axisRemoved(QAbstractAxis* axis);
- void seriesAdded(QAbstractSeries* series);
- void seriesRemoved(QAbstractSeries* series);
-
-private:
- void createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation orientation);
- QAbstractAxis *createAxis(QAbstractAxis::AxisType type, Qt::Orientation orientation);
- AbstractDomain::DomainType selectDomain(QList<QAbstractAxis* > axes);
- AbstractDomain* createDomain(AbstractDomain::DomainType type);
- void deleteAllAxes();
- void deleteAllSeries();
- void findMinMaxForSeries(QList<QAbstractSeries *> series,Qt::Orientations orientation, qreal &min, qreal &max);
-private:
- QList<QAbstractSeries *> m_seriesList;
- QList<QAbstractAxis *> m_axisList;
- QChart* m_chart;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTENGINE_P_H */
diff --git a/src/chartelement.cpp b/src/chartelement.cpp
deleted file mode 100644
index 115cd553..00000000
--- a/src/chartelement.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartelement_p.h"
-#include "chartpresenter_p.h"
-#include "abstractdomain_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartElement::ChartElement(QGraphicsItem* item):
- QGraphicsObject(item),
- m_presenter(0),
- m_themeManager(0)
-{
-
-}
-
-void ChartElement::setPresenter(ChartPresenter *presenter)
-{
- m_presenter = presenter;
-}
-
-ChartPresenter *ChartElement::presenter() const
-{
- return m_presenter;
-}
-
-void ChartElement::setThemeManager(ChartThemeManager *manager)
-{
- m_themeManager = manager;
-}
-
-ChartThemeManager* ChartElement::themeManager() const
-{
- return m_themeManager;
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/chartelement_p.h b/src/chartelement_p.h
deleted file mode 100644
index 2fb1fe0b..00000000
--- a/src/chartelement_p.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTELEMENT_H
-#define CHARTELEMENT_H
-
-#include "qchartglobal.h"
-#include <QObject>
-#include <QRect>
-#include <QGraphicsObject>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartAnimator;
-class ChartPresenter;
-class ChartAnimation;
-class ChartThemeManager;
-class AbstractDomain;
-
-class ChartElement: public QGraphicsObject
-{
-
-public:
- explicit ChartElement(QGraphicsItem* item = 0);
-
- virtual ChartAnimation *animation() const { return 0; }
- virtual void setPresenter(ChartPresenter *presenter);
- ChartPresenter *presenter() const;
- virtual void setThemeManager(ChartThemeManager *manager);
- ChartThemeManager* themeManager() const;
-
-private:
- ChartPresenter *m_presenter;
- ChartThemeManager *m_themeManager;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/chartitem.cpp b/src/chartitem.cpp
deleted file mode 100644
index 5956ac65..00000000
--- a/src/chartitem.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartitem_p.h"
-#include "qabstractseries_p.h"
-#include "abstractdomain_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartItem::ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item):
- ChartElement(item),
- m_validData(true),
- m_series(series)
-{
-
-}
-
-AbstractDomain* ChartItem::domain() const
-{
- return m_series->domain();
-}
-
-void ChartItem::handleDomainUpdated()
-{
- qWarning() << __FUNCTION__<< "Slot not implemented";
-}
-
-#include "moc_chartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/chartitem_p.h b/src/chartitem_p.h
deleted file mode 100644
index e36e8051..00000000
--- a/src/chartitem_p.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTITEM_H
-#define CHARTITEM_H
-
-#include "chartelement_p.h"
-#include "chartpresenter_p.h"
-#include <QGraphicsItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartItem : public ChartElement
-{
- Q_OBJECT
- enum ChartItemTypes { AXIS_ITEM = UserType + 1, XYLINE_ITEM };
-public:
- ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item);
- AbstractDomain* domain() const;
-public Q_SLOTS:
- virtual void handleDomainUpdated();
-
-protected:
- bool m_validData;
-private:
- QAbstractSeriesPrivate* m_series;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTITEM_H */
diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp
deleted file mode 100644
index e83a7fbc..00000000
--- a/src/chartpresenter.cpp
+++ /dev/null
@@ -1,509 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-#include "chartpresenter_p.h"
-#include "qchart.h"
-#include "chartitem_p.h"
-#include "qchart_p.h"
-#include "qabstractaxis.h"
-#include "qabstractaxis_p.h"
-#include "chartdataset_p.h"
-#include "chartanimation_p.h"
-#include "qabstractseries_p.h"
-#include "qareaseries.h"
-#include "chartaxiselement_p.h"
-#include "chartbackground_p.h"
-#include "cartesianchartlayout_p.h"
-#include "polarchartlayout_p.h"
-#include "charttitle_p.h"
-#include <QTimer>
-#include <QTextDocument>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartPresenter::ChartPresenter(QChart *chart, QChart::ChartType type)
- : QObject(chart),
- m_chart(chart),
- m_options(QChart::NoAnimation),
- m_state(ShowState),
- m_background(0),
- m_plotAreaBackground(0),
- m_title(0),
- m_localizeNumbers(false)
-{
- if (type == QChart::ChartTypeCartesian)
- m_layout = new CartesianChartLayout(this);
- else if (type == QChart::ChartTypePolar)
- m_layout = new PolarChartLayout(this);
- Q_ASSERT(m_layout);
-}
-
-ChartPresenter::~ChartPresenter()
-{
-
-}
-
-void ChartPresenter::setGeometry(const QRectF rect)
-{
- if (m_rect != rect) {
- m_rect = rect;
- foreach (ChartItem *chart, m_chartItems) {
- chart->domain()->setSize(rect.size());
- chart->setPos(rect.topLeft());
- }
- }
-}
-
-QRectF ChartPresenter::geometry() const
-{
- return m_rect;
-}
-
-void ChartPresenter::handleAxisAdded(QAbstractAxis *axis)
-{
- axis->d_ptr->initializeGraphics(rootItem());
- axis->d_ptr->initializeAnimations(m_options);
- ChartAxisElement *item = axis->d_ptr->axisItem();
- item->setPresenter(this);
- item->setThemeManager(m_chart->d_ptr->m_themeManager);
- m_axisItems<<item;
- m_axes<<axis;
- m_layout->invalidate();
-}
-
-void ChartPresenter::handleAxisRemoved(QAbstractAxis *axis)
-{
- ChartAxisElement *item = axis->d_ptr->m_item.take();
- item->hide();
- item->disconnect();
- item->deleteLater();
- m_axisItems.removeAll(item);
- m_axes.removeAll(axis);
- m_layout->invalidate();
-}
-
-
-void ChartPresenter::handleSeriesAdded(QAbstractSeries *series)
-{
- series->d_ptr->initializeGraphics(rootItem());
- series->d_ptr->initializeAnimations(m_options);
- series->d_ptr->setPresenter(this);
- ChartItem *chart = series->d_ptr->chartItem();
- chart->setPresenter(this);
- chart->setThemeManager(m_chart->d_ptr->m_themeManager);
- chart->domain()->setSize(m_rect.size());
- chart->setPos(m_rect.topLeft());
- chart->handleDomainUpdated(); //this could be moved to intializeGraphics when animator is refactored
- m_chartItems<<chart;
- m_series<<series;
- m_layout->invalidate();
-}
-
-void ChartPresenter::handleSeriesRemoved(QAbstractSeries *series)
-{
- ChartItem *chart = series->d_ptr->m_item.take();
- chart->hide();
- chart->disconnect();
- chart->deleteLater();
- m_chartItems.removeAll(chart);
- m_series.removeAll(series);
- m_layout->invalidate();
-}
-
-void ChartPresenter::setAnimationOptions(QChart::AnimationOptions options)
-{
- if (m_options != options) {
- QChart::AnimationOptions oldOptions = m_options;
- m_options = options;
- if (options.testFlag(QChart::SeriesAnimations) != oldOptions.testFlag(QChart::SeriesAnimations)) {
- foreach (QAbstractSeries *series, m_series)
- series->d_ptr->initializeAnimations(m_options);
- }
- if (options.testFlag(QChart::GridAxisAnimations) != oldOptions.testFlag(QChart::GridAxisAnimations)) {
- foreach (QAbstractAxis *axis, m_axes)
- axis->d_ptr->initializeAnimations(m_options);
- }
- m_layout->invalidate(); // So that existing animations don't just stop halfway
- }
-}
-
-void ChartPresenter::setState(State state,QPointF point)
-{
- m_state=state;
- m_statePoint=point;
-}
-
-QChart::AnimationOptions ChartPresenter::animationOptions() const
-{
- return m_options;
-}
-
-void ChartPresenter::createBackgroundItem()
-{
- if (!m_background) {
- m_background = new ChartBackground(rootItem());
- m_background->setPen(Qt::NoPen); // Theme doesn't touch pen so don't use default
- m_background->setBrush(QChartPrivate::defaultBrush());
- m_background->setZValue(ChartPresenter::BackgroundZValue);
- }
-}
-
-void ChartPresenter::createPlotAreaBackgroundItem()
-{
- if (!m_plotAreaBackground) {
- if (m_chart->chartType() == QChart::ChartTypeCartesian)
- m_plotAreaBackground = new QGraphicsRectItem(rootItem());
- else
- m_plotAreaBackground = new QGraphicsEllipseItem(rootItem());
- // Use transparent pen instead of Qt::NoPen, as Qt::NoPen causes
- // antialising artifacts with axis lines for some reason.
- m_plotAreaBackground->setPen(QPen(Qt::transparent));
- m_plotAreaBackground->setBrush(Qt::NoBrush);
- m_plotAreaBackground->setZValue(ChartPresenter::PlotAreaZValue);
- m_plotAreaBackground->setVisible(false);
- }
-}
-
-void ChartPresenter::createTitleItem()
-{
- if (!m_title) {
- m_title = new ChartTitle(rootItem());
- m_title->setZValue(ChartPresenter::BackgroundZValue);
- }
-}
-
-void ChartPresenter::startAnimation(ChartAnimation *animation)
-{
- animation->stop();
- QTimer::singleShot(0, animation, SLOT(startChartAnimation()));
-}
-
-void ChartPresenter::setBackgroundBrush(const QBrush &brush)
-{
- createBackgroundItem();
- m_background->setBrush(brush);
- m_layout->invalidate();
-}
-
-QBrush ChartPresenter::backgroundBrush() const
-{
- if (!m_background)
- return QBrush();
- return m_background->brush();
-}
-
-void ChartPresenter::setBackgroundPen(const QPen &pen)
-{
- createBackgroundItem();
- m_background->setPen(pen);
- m_layout->invalidate();
-}
-
-QPen ChartPresenter::backgroundPen() const
-{
- if (!m_background)
- return QPen();
- return m_background->pen();
-}
-
-void ChartPresenter::setBackgroundRoundness(qreal diameter)
-{
- createBackgroundItem();
- m_background->setDiameter(diameter);
- m_layout->invalidate();
-}
-
-qreal ChartPresenter::backgroundRoundness() const
-{
- if (!m_background)
- return 0;
- return m_background->diameter();
-}
-
-void ChartPresenter::setPlotAreaBackgroundBrush(const QBrush &brush)
-{
- createPlotAreaBackgroundItem();
- m_plotAreaBackground->setBrush(brush);
- m_layout->invalidate();
-}
-
-QBrush ChartPresenter::plotAreaBackgroundBrush() const
-{
- if (!m_plotAreaBackground)
- return QBrush();
- return m_plotAreaBackground->brush();
-}
-
-void ChartPresenter::setPlotAreaBackgroundPen(const QPen &pen)
-{
- createPlotAreaBackgroundItem();
- m_plotAreaBackground->setPen(pen);
- m_layout->invalidate();
-}
-
-QPen ChartPresenter::plotAreaBackgroundPen() const
-{
- if (!m_plotAreaBackground)
- return QPen();
- return m_plotAreaBackground->pen();
-}
-
-void ChartPresenter::setTitle(const QString &title)
-{
- createTitleItem();
- m_title->setText(title);
- m_layout->invalidate();
-}
-
-QString ChartPresenter::title() const
-{
- if (!m_title)
- return QString();
- return m_title->text();
-}
-
-void ChartPresenter::setTitleFont(const QFont &font)
-{
- createTitleItem();
- m_title->setFont(font);
- m_layout->invalidate();
-}
-
-QFont ChartPresenter::titleFont() const
-{
- if (!m_title)
- return QFont();
- return m_title->font();
-}
-
-void ChartPresenter::setTitleBrush(const QBrush &brush)
-{
- createTitleItem();
- m_title->setDefaultTextColor(brush.color());
- m_layout->invalidate();
-}
-
-QBrush ChartPresenter::titleBrush() const
-{
- if (!m_title)
- return QBrush();
- return QBrush(m_title->defaultTextColor());
-}
-
-void ChartPresenter::setBackgroundVisible(bool visible)
-{
- createBackgroundItem();
- m_background->setVisible(visible);
-}
-
-
-bool ChartPresenter::isBackgroundVisible() const
-{
- if (!m_background)
- return false;
- return m_background->isVisible();
-}
-
-void ChartPresenter::setPlotAreaBackgroundVisible(bool visible)
-{
- createPlotAreaBackgroundItem();
- m_plotAreaBackground->setVisible(visible);
-}
-
-bool ChartPresenter::isPlotAreaBackgroundVisible() const
-{
- if (!m_plotAreaBackground)
- return false;
- return m_plotAreaBackground->isVisible();
-}
-
-void ChartPresenter::setBackgroundDropShadowEnabled(bool enabled)
-{
- createBackgroundItem();
- m_background->setDropShadowEnabled(enabled);
-}
-
-bool ChartPresenter::isBackgroundDropShadowEnabled() const
-{
- if (!m_background)
- return false;
- return m_background->isDropShadowEnabled();
-}
-
-void ChartPresenter::setLocalizeNumbers(bool localize)
-{
- m_localizeNumbers = localize;
- m_layout->invalidate();
-}
-
-void ChartPresenter::setLocale(const QLocale &locale)
-{
- m_locale = locale;
- m_layout->invalidate();
-}
-
-AbstractChartLayout *ChartPresenter::layout()
-{
- return m_layout;
-}
-
-QLegend *ChartPresenter::legend()
-{
- return m_chart->legend();
-}
-
-void ChartPresenter::setVisible(bool visible)
-{
- m_chart->setVisible(visible);
-}
-
-ChartBackground *ChartPresenter::backgroundElement()
-{
- return m_background;
-}
-
-QAbstractGraphicsShapeItem *ChartPresenter::plotAreaElement()
-{
- return m_plotAreaBackground;
-}
-
-QList<ChartAxisElement *> ChartPresenter::axisItems() const
-{
- return m_axisItems;
-}
-
-QList<ChartItem *> ChartPresenter::chartItems() const
-{
- return m_chartItems;
-}
-
-ChartTitle *ChartPresenter::titleElement()
-{
- return m_title;
-}
-
-QRectF ChartPresenter::textBoundingRect(const QFont &font, const QString &text, qreal angle)
-{
- static QGraphicsTextItem dummyTextItem;
- static bool initMargin = true;
- if (initMargin) {
- dummyTextItem.document()->setDocumentMargin(textMargin());
- initMargin = false;
- }
-
- dummyTextItem.setFont(font);
- dummyTextItem.setHtml(text);
- QRectF boundingRect = dummyTextItem.boundingRect();
-
- // Take rotation into account
- if (angle) {
- QTransform transform;
- transform.rotate(angle);
- boundingRect = transform.mapRect(boundingRect);
- }
-
- return boundingRect;
-}
-
-// boundingRect parameter returns the rotated bounding rect of the text
-QString ChartPresenter::truncatedText(const QFont &font, const QString &text, qreal angle,
- qreal maxWidth, qreal maxHeight, QRectF &boundingRect)
-{
- QString truncatedString(text);
- boundingRect = textBoundingRect(font, truncatedString, angle);
- if (boundingRect.width() > maxWidth || boundingRect.height() > maxHeight) {
- // It can be assumed that almost any amount of string manipulation is faster
- // than calculating one bounding rectangle, so first prepare a list of truncated strings
- // to try.
- static const char *truncateMatchString = "&#?[0-9a-zA-Z]*;$";
- static QRegExp truncateMatcher(truncateMatchString);
-
- QVector<QString> testStrings(text.length());
- int count(0);
- static QLatin1Char closeTag('>');
- static QLatin1Char openTag('<');
- static QLatin1Char semiColon(';');
- static QLatin1String ellipsis("...");
- while (truncatedString.length() > 1) {
- int chopIndex(-1);
- int chopCount(1);
- QChar lastChar(truncatedString.at(truncatedString.length() - 1));
-
- if (lastChar == closeTag)
- chopIndex = truncatedString.lastIndexOf(openTag);
- else if (lastChar == semiColon)
- chopIndex = truncateMatcher.indexIn(truncatedString, 0);
-
- if (chopIndex != -1)
- chopCount = truncatedString.length() - chopIndex;
- truncatedString.chop(chopCount);
- testStrings[count] = truncatedString + ellipsis;
- count++;
- }
-
- // Binary search for best fit
- int minIndex(0);
- int maxIndex(count - 1);
- int bestIndex(count);
- QRectF checkRect;
-
- while (maxIndex >= minIndex) {
- int mid = (maxIndex + minIndex) / 2;
- checkRect = textBoundingRect(font, testStrings.at(mid), angle);
- if (checkRect.width() > maxWidth || checkRect.height() > maxHeight) {
- // Checked index too large, all under this are also too large
- minIndex = mid + 1;
- } else {
- // Checked index fits, all over this also fit
- maxIndex = mid - 1;
- bestIndex = mid;
- boundingRect = checkRect;
- }
- }
- // Default to "..." if nothing fits
- if (bestIndex == count) {
- boundingRect = textBoundingRect(font, ellipsis, angle);
- truncatedString = ellipsis;
- } else {
- truncatedString = testStrings.at(bestIndex);
- }
- }
-
- return truncatedString;
-}
-
-QString ChartPresenter::numberToString(double value, char f, int prec)
-{
- if (m_localizeNumbers)
- return m_locale.toString(value, f, prec);
- else
- return QString::number(value, f, prec);
-}
-
-QString ChartPresenter::numberToString(int value)
-{
- if (m_localizeNumbers)
- return m_locale.toString(value);
- else
- return QString::number(value);
-}
-
-#include "moc_chartpresenter_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/chartpresenter_p.h b/src/chartpresenter_p.h
deleted file mode 100644
index c72a12d6..00000000
--- a/src/chartpresenter_p.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTPRESENTER_H
-#define CHARTPRESENTER_H
-
-#include "qchartglobal.h"
-#include "qchart.h" //because of QChart::ChartThemeId
-#include <QRectF>
-#include <QMargins>
-#include <QLocale>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartItem;
-class AxisItem;
-class QAbstractSeries;
-class ChartDataSet;
-class AbstractDomain;
-class ChartAxisElement;
-class ChartAnimator;
-class ChartBackground;
-class ChartTitle;
-class ChartAnimation;
-class AbstractChartLayout;
-
-class ChartPresenter: public QObject
-{
- Q_OBJECT
-public:
- enum ZValues {
- BackgroundZValue = -1,
- PlotAreaZValue,
- ShadesZValue,
- GridZValue,
- AxisZValue,
- SeriesZValue,
- LineChartZValue = SeriesZValue,
- SplineChartZValue = SeriesZValue,
- BarSeriesZValue = SeriesZValue,
- ScatterSeriesZValue = SeriesZValue,
- PieSeriesZValue = SeriesZValue,
- BoxPlotSeriesZValue = SeriesZValue,
- LegendZValue,
- TopMostZValue
- };
-
- enum State {
- ShowState,
- ScrollUpState,
- ScrollDownState,
- ScrollLeftState,
- ScrollRightState,
- ZoomInState,
- ZoomOutState
- };
-
- ChartPresenter(QChart *chart, QChart::ChartType type);
- virtual ~ChartPresenter();
-
-
- void setGeometry(QRectF rect);
- QRectF geometry() const;
-
- QGraphicsItem *rootItem(){ return m_chart; }
- ChartBackground *backgroundElement();
- QAbstractGraphicsShapeItem *plotAreaElement();
- ChartTitle *titleElement();
- QList<ChartAxisElement *> axisItems() const;
- QList<ChartItem *> chartItems() const;
-
- QLegend *legend();
-
- void setBackgroundBrush(const QBrush &brush);
- QBrush backgroundBrush() const;
-
- void setBackgroundPen(const QPen &pen);
- QPen backgroundPen() const;
-
- void setBackgroundRoundness(qreal diameter);
- qreal backgroundRoundness() const;
-
- void setPlotAreaBackgroundBrush(const QBrush &brush);
- QBrush plotAreaBackgroundBrush() const;
-
- void setPlotAreaBackgroundPen(const QPen &pen);
- QPen plotAreaBackgroundPen() const;
-
- void setTitle(const QString &title);
- QString title() const;
-
- void setTitleFont(const QFont &font);
- QFont titleFont() const;
-
- void setTitleBrush(const QBrush &brush);
- QBrush titleBrush() const;
-
- void setBackgroundVisible(bool visible);
- bool isBackgroundVisible() const;
-
- void setPlotAreaBackgroundVisible(bool visible);
- bool isPlotAreaBackgroundVisible() const;
-
- void setBackgroundDropShadowEnabled(bool enabled);
- bool isBackgroundDropShadowEnabled() const;
-
- void setLocalizeNumbers(bool localize);
- inline bool localizeNumbers() const { return m_localizeNumbers; }
- void setLocale(const QLocale &locale);
- inline const QLocale &locale() const { return m_locale; }
-
- void setVisible(bool visible);
-
- void setAnimationOptions(QChart::AnimationOptions options);
- QChart::AnimationOptions animationOptions() const;
-
- void startAnimation(ChartAnimation *animation);
-
- void setState(State state,QPointF point);
- State state() const { return m_state; }
- QPointF statePoint() const { return m_statePoint; }
- AbstractChartLayout *layout();
-
- QChart::ChartType chartType() const { return m_chart->chartType(); }
- QChart *chart() { return m_chart; }
-
- static QRectF textBoundingRect(const QFont &font, const QString &text, qreal angle = 0.0);
- static QString truncatedText(const QFont &font, const QString &text, qreal angle,
- qreal maxWidth, qreal maxHeight, QRectF &boundingRect);
- inline static qreal textMargin() { return qreal(0.5); }
-
- QString numberToString(double value, char f = 'g', int prec = 6);
- QString numberToString(int value);
-
-private:
- void createBackgroundItem();
- void createPlotAreaBackgroundItem();
- void createTitleItem();
-
-public Q_SLOTS:
- void handleSeriesAdded(QAbstractSeries *series);
- void handleSeriesRemoved(QAbstractSeries *series);
- void handleAxisAdded(QAbstractAxis *axis);
- void handleAxisRemoved(QAbstractAxis *axis);
-
-private:
- QChart *m_chart;
- QList<ChartItem *> m_chartItems;
- QList<ChartAxisElement *> m_axisItems;
- QList<QAbstractSeries *> m_series;
- QList<QAbstractAxis *> m_axes;
- QChart::AnimationOptions m_options;
- State m_state;
- QPointF m_statePoint;
- AbstractChartLayout *m_layout;
- ChartBackground *m_background;
- QAbstractGraphicsShapeItem *m_plotAreaBackground;
- ChartTitle *m_title;
- QRectF m_rect;
- bool m_localizeNumbers;
- QLocale m_locale;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTPRESENTER_H */
diff --git a/src/animations/animations.pri b/src/charts/animations/animations.pri
index 28b6db1e..28b6db1e 100644
--- a/src/animations/animations.pri
+++ b/src/charts/animations/animations.pri
diff --git a/src/charts/animations/axisanimation.cpp b/src/charts/animations/axisanimation.cpp
new file mode 100644
index 00000000..ef346287
--- /dev/null
+++ b/src/charts/animations/axisanimation.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "axisanimation_p.h"
+#include "chartaxiselement_p.h"
+#include "qabstractaxis_p.h"
+
+Q_DECLARE_METATYPE(QVector<qreal>)
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+
+AxisAnimation::AxisAnimation(ChartAxisElement *axis)
+ : ChartAnimation(axis),
+ m_axis(axis),
+ m_type(DefaultAnimation)
+{
+ setDuration(ChartAnimationDuration);
+ setEasingCurve(QEasingCurve::OutQuart);
+}
+
+AxisAnimation::~AxisAnimation()
+{
+}
+
+void AxisAnimation::setAnimationType(Animation type)
+{
+ if (state() != QAbstractAnimation::Stopped)
+ stop();
+ m_type = type;
+}
+
+void AxisAnimation::setAnimationPoint(const QPointF &point)
+{
+ if (state() != QAbstractAnimation::Stopped)
+ stop();
+ m_point = point;
+}
+
+void AxisAnimation::setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayout)
+{
+ if (state() != QAbstractAnimation::Stopped) stop();
+
+ switch (m_type) {
+ case ZoomOutAnimation: {
+ QRectF rect = m_axis->gridGeometry();
+ oldLayout.resize(newLayout.count());
+
+ for (int i = 0, j = oldLayout.count() - 1; i < (oldLayout.count() + 1) / 2; ++i, --j) {
+ oldLayout[i] = m_axis->axis()->orientation() == Qt::Horizontal ? rect.left() : rect.bottom();
+ oldLayout[j] = m_axis->axis()->orientation() == Qt::Horizontal ? rect.right() : rect.top();
+ }
+ }
+ break;
+ case ZoomInAnimation: {
+ int index = qMin(oldLayout.count() * (m_axis->axis()->orientation() == Qt::Horizontal ? m_point.x() : (1 - m_point.y())), newLayout.count() - (qreal)1.0);
+ oldLayout.resize(newLayout.count());
+
+ for (int i = 0; i < oldLayout.count(); i++)
+ oldLayout[i] = oldLayout[index];
+ }
+ break;
+ case MoveForwardAnimation: {
+ oldLayout.resize(newLayout.count());
+
+ for (int i = 0, j = i + 1; i < oldLayout.count() - 1; ++i, ++j)
+ oldLayout[i] = oldLayout[j];
+ }
+ break;
+ case MoveBackwordAnimation: {
+ oldLayout.resize(newLayout.count());
+
+ for (int i = oldLayout.count() - 1, j = i - 1; i > 0; --i, --j)
+ oldLayout[i] = oldLayout[j];
+ }
+ break;
+ default: {
+ oldLayout.resize(newLayout.count());
+ QRectF rect = m_axis->gridGeometry();
+ for (int i = 0, j = oldLayout.count() - 1; i < oldLayout.count(); ++i, --j)
+ oldLayout[i] = m_axis->axis()->orientation() == Qt::Horizontal ? rect.left() : rect.top();
+ }
+ break;
+ }
+
+ QVariantAnimation::KeyValues value;
+ setKeyValues(value); //workaround for wrong interpolation call
+ setKeyValueAt(0.0, qVariantFromValue(oldLayout));
+ setKeyValueAt(1.0, qVariantFromValue(newLayout));
+}
+
+QVariant AxisAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
+{
+ QVector<qreal> startVector = qvariant_cast<QVector<qreal> >(start);
+ QVector<qreal> endVecotr = qvariant_cast<QVector<qreal> >(end);
+ QVector<qreal> result;
+
+ Q_ASSERT(startVector.count() == endVecotr.count()) ;
+
+ for (int i = 0; i < startVector.count(); i++) {
+ qreal value = startVector[i] + ((endVecotr[i] - startVector[i]) * progress);
+ result << value;
+ }
+ return qVariantFromValue(result);
+}
+
+
+void AxisAnimation::updateCurrentValue(const QVariant &value)
+{
+ if (state() != QAbstractAnimation::Stopped) { //workaround
+ QVector<qreal> vector = qvariant_cast<QVector<qreal> >(value);
+ m_axis->setLayout(vector);
+ m_axis->updateGeometry();
+ }
+
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/animations/axisanimation_p.h b/src/charts/animations/axisanimation_p.h
new file mode 100644
index 00000000..9e886b2b
--- /dev/null
+++ b/src/charts/animations/axisanimation_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef AXISANIMATION_H
+#define AXISANIMATION_H
+
+#include "chartanimation_p.h"
+#include <QPointF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartAxisElement;
+
+class AxisAnimation: public ChartAnimation
+{
+public:
+ enum Animation { DefaultAnimation, ZoomOutAnimation, ZoomInAnimation, MoveForwardAnimation, MoveBackwordAnimation};
+ AxisAnimation(ChartAxisElement *axis);
+ ~AxisAnimation();
+ void setAnimationType(Animation type);
+ void setAnimationPoint(const QPointF &point);
+ void setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayout);
+protected:
+ QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
+ void updateCurrentValue(const QVariant &value);
+private:
+ ChartAxisElement *m_axis;
+ Animation m_type;
+ QPointF m_point;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+
+
+#endif /* AXISANIMATION_H */
diff --git a/src/charts/animations/baranimation.cpp b/src/charts/animations/baranimation.cpp
new file mode 100644
index 00000000..15b69288
--- /dev/null
+++ b/src/charts/animations/baranimation.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "baranimation_p.h"
+#include "abstractbarchartitem_p.h"
+
+Q_DECLARE_METATYPE(QVector<QRectF>)
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+BarAnimation::BarAnimation(AbstractBarChartItem *item)
+ : ChartAnimation(item),
+ m_item(item)
+{
+ setDuration(ChartAnimationDuration);
+ setEasingCurve(QEasingCurve::OutQuart);
+}
+
+BarAnimation::~BarAnimation()
+{
+}
+
+QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
+{
+ QVector<QRectF> startVector = qvariant_cast<QVector<QRectF> >(from);
+ QVector<QRectF> endVector = qvariant_cast<QVector<QRectF> >(to);
+ QVector<QRectF> result;
+
+ Q_ASSERT(startVector.count() == endVector.count());
+
+ for (int i = 0; i < startVector.count(); i++) {
+ QRectF start = startVector[i].normalized();
+ QRectF end = endVector[i].normalized();
+ qreal x1 = start.left() + progress * (end.left() - start.left());
+ qreal x2 = start.right() + progress * (end.right() - start.right());
+ qreal y1 = start.top() + progress * (end.top() - start.top());
+ qreal y2 = start.bottom() + progress * (end.bottom() - start.bottom());
+
+ QRectF value(QPointF(x1, y1), QPointF(x2, y2));
+ result << value.normalized();
+ }
+ return qVariantFromValue(result);
+}
+
+void BarAnimation::updateCurrentValue(const QVariant &value)
+{
+ if (state() != QAbstractAnimation::Stopped) { //workaround
+
+ QVector<QRectF> layout = qvariant_cast<QVector<QRectF> >(value);
+ m_item->setLayout(layout);
+ }
+}
+
+void BarAnimation::setup(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout)
+{
+ QVariantAnimation::KeyValues value;
+ setKeyValues(value); //workaround for wrong interpolation call
+ setKeyValueAt(0.0, qVariantFromValue(oldLayout));
+ setKeyValueAt(1.0, qVariantFromValue(newLayout));
+}
+
+#include "moc_baranimation_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/animations/baranimation_p.h b/src/charts/animations/baranimation_p.h
new file mode 100644
index 00000000..5b49f302
--- /dev/null
+++ b/src/charts/animations/baranimation_p.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef BARANIMATION_P_H
+#define BARANIMATION_P_H
+
+#include "chartanimation_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class AbstractBarChartItem;
+
+class BarAnimation : public ChartAnimation
+{
+ Q_OBJECT
+
+public:
+ BarAnimation(AbstractBarChartItem *item);
+ ~BarAnimation();
+
+public: // from QVariantAnimation
+ virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
+ virtual void updateCurrentValue(const QVariant &value);
+
+ void setup(const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout);
+
+protected:
+ AbstractBarChartItem *m_item;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // BARANIMATION_P_H
diff --git a/src/charts/animations/boxplotanimation.cpp b/src/charts/animations/boxplotanimation.cpp
new file mode 100644
index 00000000..cfd474bb
--- /dev/null
+++ b/src/charts/animations/boxplotanimation.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "boxplotanimation_p.h"
+#include "boxplotchartitem_p.h"
+#include "boxwhiskersdata_p.h"
+#include "boxwhiskersanimation_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+BoxPlotAnimation::BoxPlotAnimation(BoxPlotChartItem *item)
+ : QObject(item),
+ m_item(item)
+{
+}
+
+BoxPlotAnimation::~BoxPlotAnimation()
+{
+}
+
+void BoxPlotAnimation::addBox(BoxWhiskers *box)
+{
+ BoxWhiskersAnimation *animation = m_animations.value(box);
+ if (!animation) {
+ animation = new BoxWhiskersAnimation(box, this);
+ m_animations.insert(box, animation);
+ BoxWhiskersData start;
+ start.m_lowerExtreme = box->m_data.m_median;
+ start.m_lowerQuartile = box->m_data.m_median;
+ start.m_median = box->m_data.m_median;
+ start.m_upperQuartile = box->m_data.m_median;
+ start.m_upperExtreme = box->m_data.m_median;
+ animation->setup(start, box->m_data);
+ } else {
+ animation->stop();
+ animation->setEndData(box->m_data);
+ }
+}
+
+ChartAnimation *BoxPlotAnimation::boxAnimation(BoxWhiskers *box)
+{
+ BoxWhiskersAnimation *animation = m_animations.value(box);
+ if (animation)
+ animation->m_changeAnimation = false;
+
+ return animation;
+}
+
+ChartAnimation *BoxPlotAnimation::boxChangeAnimation(BoxWhiskers *box)
+{
+ BoxWhiskersAnimation *animation = m_animations.value(box);
+ animation->m_changeAnimation = true;
+ animation->setEndData(box->m_data);
+
+ return animation;
+}
+
+void BoxPlotAnimation::setAnimationStart(BoxWhiskers *box)
+{
+ BoxWhiskersAnimation *animation = m_animations.value(box);
+ animation->setStartData(box->m_data);
+}
+
+void BoxPlotAnimation::stopAll()
+{
+ foreach (BoxWhiskers *box, m_animations.keys()) {
+ BoxWhiskersAnimation *animation = m_animations.value(box);
+ animation->stopAndDestroyLater();
+ m_animations.remove(box);
+ }
+}
+
+void BoxPlotAnimation::removeBoxAnimation(BoxWhiskers *box)
+{
+ m_animations.remove(box);
+}
+
+#include "moc_boxplotanimation_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/animations/boxplotanimation_p.h b/src/charts/animations/boxplotanimation_p.h
new file mode 100644
index 00000000..3eba311b
--- /dev/null
+++ b/src/charts/animations/boxplotanimation_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef BOXPLOTANIMATION_P_H
+#define BOXPLOTANIMATION_P_H
+
+#include "chartanimation_p.h"
+#include "boxwhiskers_p.h"
+#include "boxwhiskersdata_p.h"
+#include "boxwhiskersanimation_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class BoxPlotChartItem;
+
+class BoxPlotAnimation : public QObject
+{
+ Q_OBJECT
+public:
+ BoxPlotAnimation(BoxPlotChartItem *item);
+ ~BoxPlotAnimation();
+
+ void addBox(BoxWhiskers *box);
+ ChartAnimation *boxAnimation(BoxWhiskers *box);
+ ChartAnimation *boxChangeAnimation(BoxWhiskers *box);
+
+ void setAnimationStart(BoxWhiskers *box);
+ void stopAll();
+ void removeBoxAnimation(BoxWhiskers *box);
+
+protected:
+ BoxPlotChartItem *m_item;
+ QHash<BoxWhiskers *, BoxWhiskersAnimation *> m_animations;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // BOXPLOTANIMATION_P_H
diff --git a/src/charts/animations/boxwhiskersanimation.cpp b/src/charts/animations/boxwhiskersanimation.cpp
new file mode 100644
index 00000000..6d5404fa
--- /dev/null
+++ b/src/charts/animations/boxwhiskersanimation.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "boxwhiskersanimation_p.h"
+#include "boxplotanimation_p.h"
+#include "boxplotchartitem_p.h"
+#include "boxwhiskersdata_p.h"
+
+Q_DECLARE_METATYPE(QVector<QRectF>)
+Q_DECLARE_METATYPE(QT_CHARTS_NAMESPACE::BoxWhiskersData)
+Q_DECLARE_METATYPE(qreal)
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation)
+ : ChartAnimation(box),
+ m_box(box),
+ m_boxPlotAnimation(boxPlotAnimation)
+{
+ setDuration(ChartAnimationDuration);
+ setEasingCurve(QEasingCurve::OutQuart);
+}
+
+BoxWhiskersAnimation::~BoxWhiskersAnimation()
+{
+ if (m_boxPlotAnimation)
+ m_boxPlotAnimation->removeBoxAnimation(m_box);
+}
+
+QVariant BoxWhiskersAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
+{
+ BoxWhiskersData startData = qvariant_cast<BoxWhiskersData>(from);
+ BoxWhiskersData endData = qvariant_cast<BoxWhiskersData>(to);
+ BoxWhiskersData result;
+
+ if (m_changeAnimation) {
+ result.m_lowerExtreme = startData.m_lowerExtreme + progress * (endData.m_lowerExtreme - startData.m_lowerExtreme);
+ result.m_lowerQuartile = startData.m_lowerQuartile + progress * (endData.m_lowerQuartile - startData.m_lowerQuartile);
+ result.m_median = startData.m_median + progress * (endData.m_median - startData.m_median);
+ result.m_upperQuartile = startData.m_upperQuartile + progress * (endData.m_upperQuartile - startData.m_upperQuartile);
+ result.m_upperExtreme = startData.m_upperExtreme + progress * (endData.m_upperExtreme - startData.m_upperExtreme);
+ } else {
+ result.m_lowerExtreme = endData.m_median + progress * (endData.m_lowerExtreme - endData.m_median);
+ result.m_lowerQuartile = endData.m_median + progress * (endData.m_lowerQuartile - endData.m_median);
+ result.m_median = endData.m_median;
+ result.m_upperQuartile = endData.m_median + progress * (endData.m_upperQuartile - endData.m_median);
+ result.m_upperExtreme = endData.m_median + progress * (endData.m_upperExtreme - endData.m_median);
+ }
+ result.m_index = endData.m_index;
+ result.m_boxItems = endData.m_boxItems;
+
+ result.m_maxX = endData.m_maxX;
+ result.m_minX = endData.m_minX;
+ result.m_maxY = endData.m_maxY;
+ result.m_minY = endData.m_minY;
+ result.m_seriesIndex = endData.m_seriesIndex;
+ result.m_seriesCount = endData.m_seriesCount;
+
+ return qVariantFromValue(result);
+}
+
+void BoxWhiskersAnimation::updateCurrentValue(const QVariant &value)
+{
+ BoxWhiskersData data = qvariant_cast<BoxWhiskersData>(value);
+ m_box->setLayout(data);
+}
+
+void BoxWhiskersAnimation::setup(const BoxWhiskersData &startData, const BoxWhiskersData &endData)
+{
+ setKeyValueAt(0.0, qVariantFromValue(startData));
+ setKeyValueAt(1.0, qVariantFromValue(endData));
+}
+
+void BoxWhiskersAnimation::setEndData(const BoxWhiskersData &endData)
+{
+ if (state() != QAbstractAnimation::Stopped)
+ stop();
+
+ setEndValue(qVariantFromValue(endData));
+}
+
+void BoxWhiskersAnimation::setStartData(const BoxWhiskersData &endData)
+{
+ if (state() != QAbstractAnimation::Stopped)
+ stop();
+
+ setStartValue(qVariantFromValue(endData));
+}
+
+#include "moc_boxwhiskersanimation_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/animations/boxwhiskersanimation_p.h b/src/charts/animations/boxwhiskersanimation_p.h
new file mode 100644
index 00000000..ff56222b
--- /dev/null
+++ b/src/charts/animations/boxwhiskersanimation_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef BOXWHISKERSANIMATION_P_H
+#define BOXWHISKERSANIMATION_P_H
+
+#include "chartanimation_p.h"
+#include "boxwhiskers_p.h"
+#include "boxwhiskersdata_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class BoxPlotChartItem;
+class BoxPlotAnimation;
+
+class BoxWhiskersAnimation : public ChartAnimation
+{
+ Q_OBJECT
+
+public:
+ BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation);
+ ~BoxWhiskersAnimation();
+
+public: // from QVariantAnimation
+ virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
+ virtual void updateCurrentValue(const QVariant &value);
+
+ void setup(const BoxWhiskersData &startData, const BoxWhiskersData &endData);
+ void setEndData(const BoxWhiskersData &endData);
+ void setStartData(const BoxWhiskersData &endData);
+
+ void moveMedianLine(bool move);
+
+protected:
+ friend class BoxPlotAnimation;
+ BoxWhiskers *m_box;
+ bool m_changeAnimation;
+ BoxPlotAnimation *m_boxPlotAnimation;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // BOXWHISKERSANIMATION_P_H
diff --git a/src/charts/animations/chartanimation.cpp b/src/charts/animations/chartanimation.cpp
new file mode 100644
index 00000000..0e512932
--- /dev/null
+++ b/src/charts/animations/chartanimation.cpp
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartanimation_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartAnimation::ChartAnimation(QObject *parent) :
+ QVariantAnimation(parent),
+ m_destructing(false)
+{
+}
+
+void ChartAnimation::stopAndDestroyLater()
+{
+ m_destructing = true;
+ stop();
+ deleteLater();
+}
+
+void ChartAnimation::startChartAnimation()
+{
+ if (!m_destructing)
+ start();
+}
+
+QT_CHARTS_END_NAMESPACE
+
+
diff --git a/src/charts/animations/chartanimation_p.h b/src/charts/animations/chartanimation_p.h
new file mode 100644
index 00000000..81ec72c4
--- /dev/null
+++ b/src/charts/animations/chartanimation_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTANIMATION_H
+#define CHARTANIMATION_H
+
+#include "qchartglobal.h"
+#include <QVariantAnimation>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+const static int ChartAnimationDuration = 1000;
+
+class ChartAnimation: public QVariantAnimation
+{
+ Q_OBJECT
+public:
+ ChartAnimation(QObject *parent = 0);
+
+ void stopAndDestroyLater();
+
+public Q_SLOTS:
+ void startChartAnimation();
+
+protected:
+ bool m_destructing;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTANIMATION_H */
diff --git a/src/charts/animations/pieanimation.cpp b/src/charts/animations/pieanimation.cpp
new file mode 100644
index 00000000..30d6865f
--- /dev/null
+++ b/src/charts/animations/pieanimation.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "pieanimation_p.h"
+#include "piesliceanimation_p.h"
+#include "piechartitem_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PieAnimation::PieAnimation(PieChartItem *item)
+ : ChartAnimation(item),
+ m_item(item)
+{
+}
+
+PieAnimation::~PieAnimation()
+{
+}
+
+ChartAnimation *PieAnimation::updateValue(PieSliceItem *sliceItem, const PieSliceData &sliceData)
+{
+ PieSliceAnimation *animation = m_animations.value(sliceItem);
+ if (!animation) {
+ animation = new PieSliceAnimation(sliceItem);
+ m_animations.insert(sliceItem, animation);
+ } else {
+ animation->stop();
+ }
+
+ animation->updateValue(sliceData);
+ animation->setDuration(ChartAnimationDuration);
+ animation->setEasingCurve(QEasingCurve::OutQuart);
+
+ return animation;
+}
+
+ChartAnimation *PieAnimation::addSlice(PieSliceItem *sliceItem, const PieSliceData &sliceData, bool startupAnimation)
+{
+ PieSliceAnimation *animation = new PieSliceAnimation(sliceItem);
+ m_animations.insert(sliceItem, animation);
+
+ PieSliceData startValue = sliceData;
+ startValue.m_radius = 0;
+ if (startupAnimation)
+ startValue.m_startAngle = 0;
+ else
+ startValue.m_startAngle = sliceData.m_startAngle + (sliceData.m_angleSpan / 2);
+ startValue.m_angleSpan = 0;
+
+ if (sliceData.m_holeRadius > 0)
+ startValue.m_radius = sliceData.m_holeRadius;
+
+ animation->setValue(startValue, sliceData);
+ animation->setDuration(ChartAnimationDuration);
+ animation->setEasingCurve(QEasingCurve::OutQuart);
+
+ return animation;
+}
+
+ChartAnimation *PieAnimation::removeSlice(PieSliceItem *sliceItem)
+{
+ PieSliceAnimation *animation = m_animations.value(sliceItem);
+ Q_ASSERT(animation);
+ animation->stop();
+
+ PieSliceData endValue = animation->currentSliceValue();
+ if (endValue.m_holeRadius > 0)
+ endValue.m_radius = endValue.m_holeRadius;
+ else
+ endValue.m_radius = 0;
+ endValue.m_startAngle = endValue.m_startAngle + endValue.m_angleSpan;
+ endValue.m_angleSpan = 0;
+ endValue.m_isLabelVisible = false;
+
+ animation->updateValue(endValue);
+ animation->setDuration(ChartAnimationDuration);
+ animation->setEasingCurve(QEasingCurve::OutQuart);
+
+ // PieSliceItem is the parent of PieSliceAnimation so the animation will be deleted as well..
+ connect(animation, SIGNAL(finished()), sliceItem, SLOT(deleteLater()));
+ m_animations.remove(sliceItem);
+
+ return animation;
+}
+
+void PieAnimation::updateCurrentValue(const QVariant &)
+{
+ // nothing to do...
+}
+
+#include "moc_pieanimation_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/animations/pieanimation_p.h b/src/charts/animations/pieanimation_p.h
new file mode 100644
index 00000000..33599694
--- /dev/null
+++ b/src/charts/animations/pieanimation_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef PIEANIMATION_P_H
+#define PIEANIMATION_P_H
+
+#include "chartanimation_p.h"
+#include "piechartitem_p.h"
+#include "piesliceanimation_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class PieChartItem;
+
+class PieAnimation : public ChartAnimation
+{
+ Q_OBJECT
+
+public:
+ PieAnimation(PieChartItem *item);
+ ~PieAnimation();
+ ChartAnimation *updateValue(PieSliceItem *sliceItem, const PieSliceData &newValue);
+ ChartAnimation *addSlice(PieSliceItem *sliceItem, const PieSliceData &endValue, bool startupAnimation);
+ ChartAnimation *removeSlice(PieSliceItem *sliceItem);
+
+public: // from QVariantAnimation
+ void updateCurrentValue(const QVariant &value);
+
+private:
+ PieChartItem *m_item;
+ QHash<PieSliceItem *, PieSliceAnimation *> m_animations;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/animations/piesliceanimation.cpp b/src/charts/animations/piesliceanimation.cpp
new file mode 100644
index 00000000..0a4503c9
--- /dev/null
+++ b/src/charts/animations/piesliceanimation.cpp
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "piesliceanimation_p.h"
+#include "piechartitem_p.h"
+
+Q_DECLARE_METATYPE(QT_CHARTS_NAMESPACE::PieSliceData)
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+qreal linearPos(qreal start, qreal end, qreal pos)
+{
+ return start + ((end - start) * pos);
+}
+
+QPointF linearPos(QPointF start, QPointF end, qreal pos)
+{
+ qreal x = linearPos(start.x(), end.x(), pos);
+ qreal y = linearPos(start.y(), end.y(), pos);
+ return QPointF(x, y);
+}
+
+QPen linearPos(QPen start, QPen end, qreal pos)
+{
+ QColor c;
+ c.setRedF(linearPos(start.color().redF(), end.color().redF(), pos));
+ c.setGreenF(linearPos(start.color().greenF(), end.color().greenF(), pos));
+ c.setBlueF(linearPos(start.color().blueF(), end.color().blueF(), pos));
+ end.setColor(c);
+ return end;
+}
+
+QBrush linearPos(QBrush start, QBrush end, qreal pos)
+{
+ QColor c;
+ c.setRedF(linearPos(start.color().redF(), end.color().redF(), pos));
+ c.setGreenF(linearPos(start.color().greenF(), end.color().greenF(), pos));
+ c.setBlueF(linearPos(start.color().blueF(), end.color().blueF(), pos));
+ end.setColor(c);
+ return end;
+}
+
+PieSliceAnimation::PieSliceAnimation(PieSliceItem *sliceItem)
+ : ChartAnimation(sliceItem),
+ m_sliceItem(sliceItem),
+ m_currentValue(m_sliceItem->m_data)
+{
+
+}
+
+PieSliceAnimation::~PieSliceAnimation()
+{
+}
+
+void PieSliceAnimation::setValue(const PieSliceData &startValue, const PieSliceData &endValue)
+{
+ if (state() != QAbstractAnimation::Stopped)
+ stop();
+
+ m_currentValue = startValue;
+
+ setKeyValueAt(0.0, qVariantFromValue(startValue));
+ setKeyValueAt(1.0, qVariantFromValue(endValue));
+}
+
+void PieSliceAnimation::updateValue(const PieSliceData &endValue)
+{
+ if (state() != QAbstractAnimation::Stopped)
+ stop();
+
+ setKeyValueAt(0.0, qVariantFromValue(m_currentValue));
+ setKeyValueAt(1.0, qVariantFromValue(endValue));
+}
+
+PieSliceData PieSliceAnimation::currentSliceValue()
+{
+ // NOTE:
+ // We must use an internal current value because QVariantAnimation::currentValue() is updated
+ // before the animation is actually started. So if we get 2 updateValue() calls in a row the currentValue()
+ // will have the end value set from the first call and the second call will interpolate that instead of
+ // the original current value as it was before the first call.
+ return m_currentValue;
+}
+
+QVariant PieSliceAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
+{
+ PieSliceData startValue = qvariant_cast<PieSliceData>(start);
+ PieSliceData endValue = qvariant_cast<PieSliceData>(end);
+
+ PieSliceData result;
+ result = endValue;
+ result.m_center = linearPos(startValue.m_center, endValue.m_center, progress);
+ result.m_radius = linearPos(startValue.m_radius, endValue.m_radius, progress);
+ result.m_startAngle = linearPos(startValue.m_startAngle, endValue.m_startAngle, progress);
+ result.m_angleSpan = linearPos(startValue.m_angleSpan, endValue.m_angleSpan, progress);
+ result.m_slicePen = linearPos(startValue.m_slicePen, endValue.m_slicePen, progress);
+ result.m_sliceBrush = linearPos(startValue.m_sliceBrush, endValue.m_sliceBrush, progress);
+ result.m_holeRadius = linearPos(startValue.m_holeRadius, endValue.m_holeRadius, progress);
+
+ return qVariantFromValue(result);
+}
+
+void PieSliceAnimation::updateCurrentValue(const QVariant &value)
+{
+ if (state() != QAbstractAnimation::Stopped) { //workaround
+ m_currentValue = qvariant_cast<PieSliceData>(value);
+ m_sliceItem->setLayout(m_currentValue);
+ }
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/animations/piesliceanimation_p.h b/src/charts/animations/piesliceanimation_p.h
new file mode 100644
index 00000000..88155054
--- /dev/null
+++ b/src/charts/animations/piesliceanimation_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef PIESLICEANIMATION_P_H
+#define PIESLICEANIMATION_P_H
+
+#include "chartanimation_p.h"
+#include "piesliceitem_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class PieChartItem;
+
+class PieSliceAnimation : public ChartAnimation
+{
+public:
+ PieSliceAnimation(PieSliceItem *sliceItem);
+ ~PieSliceAnimation();
+ void setValue(const PieSliceData &startValue, const PieSliceData &endValue);
+ void updateValue(const PieSliceData &endValue);
+ PieSliceData currentSliceValue();
+
+protected:
+ QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
+ void updateCurrentValue(const QVariant &value);
+
+private:
+ PieSliceItem *m_sliceItem;
+ PieSliceData m_currentValue;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/animations/scatteranimation.cpp b/src/charts/animations/scatteranimation.cpp
new file mode 100644
index 00000000..faf66d11
--- /dev/null
+++ b/src/charts/animations/scatteranimation.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "scatteranimation_p.h"
+#include "scatterchartitem_p.h"
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ScatterAnimation::ScatterAnimation(ScatterChartItem *item)
+ : XYAnimation(item)
+{
+}
+
+ScatterAnimation::~ScatterAnimation()
+{
+}
+
+void ScatterAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
+{
+ XYAnimation::updateState(newState, oldState);
+
+ if (oldState == QAbstractAnimation::Running && newState == QAbstractAnimation::Stopped
+ && animationType() == RemovePointAnimation) {
+ // Removing a point from scatter chart will keep extra marker item after animation stops.
+ // Also, if the removed point was not the last one in series, points after the removed one
+ // will report wrong coordinates when clicked. To fix these issues, update geometry after
+ // point removal animation has finished.
+ chartItem()->updateGeometry();
+ }
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/animations/scatteranimation_p.h b/src/charts/animations/scatteranimation_p.h
new file mode 100644
index 00000000..7a4f8bfb
--- /dev/null
+++ b/src/charts/animations/scatteranimation_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef SCATTERANIMATION_P_H
+#define SCATTERANIMATION_P_H
+#include "xyanimation_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ScatterChartItem;
+
+class ScatterAnimation : public XYAnimation
+{
+public:
+ ScatterAnimation(ScatterChartItem *item);
+ ~ScatterAnimation();
+
+protected:
+ void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/animations/splineanimation.cpp b/src/charts/animations/splineanimation.cpp
new file mode 100644
index 00000000..4056d825
--- /dev/null
+++ b/src/charts/animations/splineanimation.cpp
@@ -0,0 +1,210 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "splineanimation_p.h"
+#include "splinechartitem_p.h"
+#include <QDebug>
+
+Q_DECLARE_METATYPE(QVector<QPointF>)
+Q_DECLARE_METATYPE(SplineVector)
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+SplineAnimation::SplineAnimation(SplineChartItem *item)
+ : XYAnimation(item),
+ m_item(item),
+ m_valid(false)
+{
+}
+
+SplineAnimation::~SplineAnimation()
+{
+}
+
+void SplineAnimation::setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldControlPoints, QVector<QPointF> &newControlPoints, int index)
+{
+ if (newPoints.count() * 2 - 2 != newControlPoints.count() || newControlPoints.count() < 2) {
+ m_valid = false;
+ m_dirty = false;
+ m_item->setGeometryPoints(newPoints);
+ m_item->setControlGeometryPoints(newControlPoints);
+ m_item->setDirty(false);
+ m_item->updateGeometry();
+ return;
+ }
+
+ m_type = NewAnimation;
+
+ if (state() != QAbstractAnimation::Stopped) {
+ stop();
+ m_dirty = false;
+ }
+
+ if (!m_dirty) {
+ m_dirty = true;
+ m_oldSpline.first = oldPoints;
+ m_oldSpline.second = oldControlPoints;
+ }
+
+ m_newSpline.first = newPoints;
+ m_newSpline.second = newControlPoints;
+
+
+ int x = m_oldSpline.first.count();
+ int y = m_newSpline.first.count();
+
+ if (x - y == 1 && index >= 0 && y > 0) {
+ //remove point
+ if (index > 0) {
+ m_newSpline.first.insert(index, newPoints[index - 1]);
+ m_newSpline.second.insert((index - 1) * 2, newPoints[index - 1]);
+ m_newSpline.second.insert((index - 1) * 2 + 1, newPoints[index - 1]);
+ } else {
+ m_newSpline.first.insert(0, newPoints[index]);
+ m_newSpline.second.insert(0, newPoints[index]);
+ m_newSpline.second.insert(1, newPoints[index]);
+ }
+ m_index = index;
+ m_type = RemovePointAnimation;
+ }
+
+ if (x - y == -1 && index >= 0) {
+ //add point
+ if (index > 0) {
+ m_oldSpline.first.insert(index, newPoints[index - 1]);
+ m_oldSpline.second.insert((index - 1) * 2, newPoints[index - 1]);
+ m_oldSpline.second.insert((index - 1) * 2 + 1, newPoints[index - 1]);
+ } else {
+ m_oldSpline.first.insert(0, newPoints[index]);
+ m_oldSpline.second.insert(0, newPoints[index]);
+ m_oldSpline.second.insert(1, newPoints[index]);
+ }
+ m_index = index;
+ m_type = AddPointAnimation;
+ }
+
+ x = m_oldSpline.first.count();
+ y = m_newSpline.first.count();
+
+ if (x != y) {
+ m_type = NewAnimation;
+ } else if (m_type == NewAnimation) {
+ m_type = ReplacePointAnimation;
+ }
+
+
+ setKeyValueAt(0.0, qVariantFromValue(m_oldSpline));
+ setKeyValueAt(1.0, qVariantFromValue(m_newSpline));
+
+ m_valid = true;
+
+}
+
+QVariant SplineAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
+{
+
+ SplineVector startPair = qvariant_cast< SplineVector >(start);
+ SplineVector endPair = qvariant_cast< SplineVector >(end);
+ SplineVector result;
+
+ switch (animationType()) {
+ case RemovePointAnimation:
+ case AddPointAnimation:
+ case ReplacePointAnimation: {
+ if (startPair.first.count() != endPair.first.count())
+ break;
+ Q_ASSERT(startPair.first.count() * 2 - 2 == startPair.second.count());
+ Q_ASSERT(endPair.first.count() * 2 - 2 == endPair.second.count());
+ for (int i = 0; i < endPair.first.count(); i++) {
+ qreal x = startPair.first[i].x() + ((endPair.first[i].x() - startPair.first[i].x()) * progress);
+ qreal y = startPair.first[i].y() + ((endPair.first[i].y() - startPair.first[i].y()) * progress);
+ result.first << QPointF(x, y);
+ if (i + 1 >= endPair.first.count())
+ continue;
+ x = startPair.second[i * 2].x() + ((endPair.second[i * 2].x() - startPair.second[i * 2].x()) * progress);
+ y = startPair.second[i * 2].y() + ((endPair.second[i * 2].y() - startPair.second[i * 2].y()) * progress);
+ result.second << QPointF(x, y);
+ x = startPair.second[i * 2 + 1].x() + ((endPair.second[i * 2 + 1].x() - startPair.second[i * 2 + 1].x()) * progress);
+ y = startPair.second[i * 2 + 1].y() + ((endPair.second[i * 2 + 1].y() - startPair.second[i * 2 + 1].y()) * progress);
+ result.second << QPointF(x, y);
+ }
+ }
+ break;
+ case NewAnimation: {
+ Q_ASSERT(endPair.first.count() * 2 - 2 == endPair.second.count());
+ int count = endPair.first.count() * qBound(qreal(0), progress, qreal(1));
+ for (int i = 0; i < count; i++) {
+ result.first << endPair.first[i];
+ if (i + 1 == count)
+ break;
+ result.second << endPair.second[2 * i];
+ result.second << endPair.second[2 * i + 1];
+ }
+ }
+ break;
+ default:
+ qWarning() << "Unknown type of animation";
+ break;
+ }
+
+ return qVariantFromValue(result);
+}
+
+void SplineAnimation::updateCurrentValue(const QVariant &value)
+{
+ if (state() != QAbstractAnimation::Stopped && m_valid) { //workaround
+ QPair<QVector<QPointF >, QVector<QPointF > > pair = qvariant_cast< QPair< QVector<QPointF>, QVector<QPointF> > >(value);
+ m_item->setGeometryPoints(pair.first);
+ m_item->setControlGeometryPoints(pair.second);
+ m_item->updateGeometry();
+ m_item->setDirty(true);
+ m_dirty = false;
+ }
+}
+
+void SplineAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
+{
+ XYAnimation::updateState(newState, oldState);
+
+ if (oldState == QAbstractAnimation::Running && newState == QAbstractAnimation::Stopped) {
+ if (m_item->isDirty() && m_type == RemovePointAnimation) {
+ if (!m_newSpline.first.isEmpty()) {
+ if (m_index) {
+ m_newSpline.first.remove(m_index);
+ m_newSpline.second.remove((m_index - 1) * 2);
+ m_newSpline.second.remove((m_index - 1) * 2);
+ } else {
+ m_newSpline.first.remove(0);
+ m_newSpline.second.remove(0);
+ m_newSpline.second.remove(0);
+ }
+ }
+ m_item->setGeometryPoints(m_newSpline.first);
+ m_item->setControlGeometryPoints(m_newSpline.second);
+ }
+ }
+
+ if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
+ if (!m_valid)
+ stop();
+ }
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/animations/splineanimation_p.h b/src/charts/animations/splineanimation_p.h
new file mode 100644
index 00000000..ad9120ed
--- /dev/null
+++ b/src/charts/animations/splineanimation_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef SPLINEANIMATION_P_H
+#define SPLINEANIMATION_P_H
+#include "xyanimation_p.h"
+#include <QPointF>
+
+typedef QPair<QVector<QPointF >, QVector<QPointF > > SplineVector;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class SplineChartItem;
+
+class SplineAnimation : public XYAnimation
+{
+public:
+ SplineAnimation(SplineChartItem *item);
+ ~SplineAnimation();
+ void setup(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, QVector<QPointF> &oldContorlPoints, QVector<QPointF> &newControlPoints, int index = -1);
+
+protected:
+ QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
+ void updateCurrentValue(const QVariant &value);
+ void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
+
+private:
+ SplineVector m_oldSpline;
+ SplineVector m_newSpline;
+ SplineChartItem *m_item;
+ bool m_valid;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/animations/xyanimation.cpp b/src/charts/animations/xyanimation.cpp
new file mode 100644
index 00000000..3e395c1a
--- /dev/null
+++ b/src/charts/animations/xyanimation.cpp
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "xyanimation_p.h"
+#include "xychart_p.h"
+#include <QDebug>
+
+Q_DECLARE_METATYPE(QVector<QPointF>)
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+XYAnimation::XYAnimation(XYChart *item)
+ : ChartAnimation(item),
+ m_type(NewAnimation),
+ m_dirty(false),
+ m_index(-1),
+ m_item(item)
+{
+ setDuration(ChartAnimationDuration);
+ setEasingCurve(QEasingCurve::OutQuart);
+}
+
+XYAnimation::~XYAnimation()
+{
+}
+
+void XYAnimation::setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints, int index)
+{
+ m_type = NewAnimation;
+
+ if (state() != QAbstractAnimation::Stopped) {
+ stop();
+ m_dirty = false;
+ }
+
+ if (!m_dirty) {
+ m_dirty = true;
+ m_oldPoints = oldPoints;
+ }
+
+ m_newPoints = newPoints;
+
+ int x = m_oldPoints.count();
+ int y = m_newPoints.count();
+ int diff = x - y;
+ int requestedDiff = oldPoints.count() - y;
+
+ // m_oldPoints can be whatever between 0 and actual points count if new animation setup
+ // interrupts a previous animation, so only do remove and add animations if both
+ // stored diff and requested diff indicate add or remove. Also ensure that index is not
+ // invalid.
+ if (diff == 1 && requestedDiff == 1 && index >= 0 && y > 0 && index <= y) {
+ //remove point
+ m_newPoints.insert(index, index > 0 ? newPoints[index - 1] : newPoints[index]);
+ m_index = index;
+ m_type = RemovePointAnimation;
+ }
+
+ if (diff == -1 && requestedDiff == -1 && index >= 0 && index <= x) {
+ //add point
+ m_oldPoints.insert(index, index > 0 ? newPoints[index - 1] : newPoints[index]);
+ m_index = index;
+ m_type = AddPointAnimation;
+ }
+
+ x = m_oldPoints.count();
+ y = m_newPoints.count();
+
+ if (x != y)
+ m_type = NewAnimation;
+ else if (m_type == NewAnimation)
+ m_type = ReplacePointAnimation;
+
+ setKeyValueAt(0.0, qVariantFromValue(m_oldPoints));
+ setKeyValueAt(1.0, qVariantFromValue(m_newPoints));
+}
+
+QVariant XYAnimation::interpolated(const QVariant &start, const QVariant &end, qreal progress) const
+{
+ QVector<QPointF> startVector = qvariant_cast<QVector<QPointF> >(start);
+ QVector<QPointF> endVector = qvariant_cast<QVector<QPointF> >(end);
+ QVector<QPointF> result;
+
+ switch (m_type) {
+
+ case ReplacePointAnimation:
+ case AddPointAnimation:
+ case RemovePointAnimation: {
+ if (startVector.count() != endVector.count())
+ break;
+
+ for (int i = 0; i < startVector.count(); i++) {
+ qreal x = startVector[i].x() + ((endVector[i].x() - startVector[i].x()) * progress);
+ qreal y = startVector[i].y() + ((endVector[i].y() - startVector[i].y()) * progress);
+ result << QPointF(x, y);
+ }
+
+ }
+ break;
+ case NewAnimation: {
+ for (int i = 0; i < endVector.count() * qBound(qreal(0), progress, qreal(1)); i++)
+ result << endVector[i];
+ }
+ break;
+ default:
+ qWarning() << "Unknown type of animation";
+ break;
+ }
+
+ return qVariantFromValue(result);
+}
+
+void XYAnimation::updateCurrentValue(const QVariant &value)
+{
+ if (state() != QAbstractAnimation::Stopped) { //workaround
+
+ QVector<QPointF> vector = qvariant_cast<QVector<QPointF> >(value);
+ m_item->setGeometryPoints(vector);
+ m_item->updateGeometry();
+ m_item->setDirty(true);
+ m_dirty = false;
+
+ }
+}
+
+void XYAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
+{
+ if (oldState == QAbstractAnimation::Running && newState == QAbstractAnimation::Stopped) {
+ if (m_item->isDirty() && m_type == RemovePointAnimation) {
+ if (!m_newPoints.isEmpty())
+ m_newPoints.remove(m_index);
+ m_item->setGeometryPoints(m_newPoints);
+ }
+ }
+}
+
+#include "moc_chartanimation_p.cpp"
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/animations/xyanimation_p.h b/src/charts/animations/xyanimation_p.h
new file mode 100644
index 00000000..ef54c530
--- /dev/null
+++ b/src/charts/animations/xyanimation_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef XYANIMATION_P_H
+#define XYANIMATION_P_H
+
+#include "chartanimation_p.h"
+#include <QPointF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class XYChart;
+
+class XYAnimation : public ChartAnimation
+{
+protected:
+ enum Animation { AddPointAnimation, RemovePointAnimation, ReplacePointAnimation, NewAnimation };
+public:
+ XYAnimation(XYChart *item);
+ ~XYAnimation();
+ void setup(const QVector<QPointF> &oldPoints, const QVector<QPointF> &newPoints, int index = -1);
+ Animation animationType() const { return m_type; };
+
+protected:
+ QVariant interpolated(const QVariant &start, const QVariant &end, qreal progress) const;
+ void updateCurrentValue(const QVariant &value);
+ void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
+ XYChart *chartItem() { return m_item; }
+protected:
+ Animation m_type;
+ bool m_dirty;
+ int m_index;
+private:
+ XYChart *m_item;
+ QVector<QPointF> m_oldPoints;
+ QVector<QPointF> m_newPoints;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/areachart/areachart.pri b/src/charts/areachart/areachart.pri
index af5fa608..af5fa608 100644
--- a/src/areachart/areachart.pri
+++ b/src/charts/areachart/areachart.pri
diff --git a/src/charts/areachart/areachartitem.cpp b/src/charts/areachart/areachartitem.cpp
new file mode 100644
index 00000000..cf2d0e8f
--- /dev/null
+++ b/src/charts/areachart/areachartitem.cpp
@@ -0,0 +1,262 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "areachartitem_p.h"
+#include "qareaseries.h"
+#include "qareaseries_p.h"
+#include "qlineseries.h"
+#include "chartpresenter_p.h"
+#include "abstractdomain_p.h"
+#include <QPainter>
+#include <QGraphicsSceneMouseEvent>
+#include <QDebug>
+
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item)
+ : ChartItem(areaSeries->d_func(),item),
+ m_series(areaSeries),
+ m_upper(0),
+ m_lower(0),
+ m_pointsVisible(false),
+ m_pointLabelsVisible(false),
+ m_pointLabelsFormat(areaSeries->pointLabelsFormat()),
+ m_pointLabelsFont(areaSeries->pointLabelsFont()),
+ m_pointLabelsColor(areaSeries->pointLabelsColor())
+{
+ setAcceptHoverEvents(true);
+ setZValue(ChartPresenter::LineChartZValue);
+ if (m_series->upperSeries())
+ m_upper = new AreaBoundItem(this, m_series->upperSeries());
+ if (m_series->lowerSeries())
+ m_lower = new AreaBoundItem(this, m_series->lowerSeries());
+
+ QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
+ QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
+ QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
+ QObject::connect(this, SIGNAL(clicked(QPointF)), areaSeries, SIGNAL(clicked(QPointF)));
+ QObject::connect(this, SIGNAL(hovered(QPointF,bool)), areaSeries, SIGNAL(hovered(QPointF,bool)));
+ QObject::connect(areaSeries, SIGNAL(pointLabelsFormatChanged(QString)),
+ this, SLOT(handleUpdated()));
+ QObject::connect(areaSeries, SIGNAL(pointLabelsVisibilityChanged(bool)),
+ this, SLOT(handleUpdated()));
+ QObject::connect(areaSeries, SIGNAL(pointLabelsFontChanged(QFont)),
+ this, SLOT(handleUpdated()));
+ QObject::connect(areaSeries, SIGNAL(pointLabelsColorChanged(QColor)),
+ this, SLOT(handleUpdated()));
+
+ handleUpdated();
+}
+
+AreaChartItem::~AreaChartItem()
+{
+ delete m_upper;
+ delete m_lower;
+}
+
+void AreaChartItem::setPresenter(ChartPresenter *presenter)
+{
+ if (m_upper)
+ m_upper->setPresenter(presenter);
+ if (m_lower) {
+ m_lower->setPresenter(presenter);
+ }
+ ChartItem::setPresenter(presenter);
+}
+
+QRectF AreaChartItem::boundingRect() const
+{
+ return m_rect;
+}
+
+QPainterPath AreaChartItem::shape() const
+{
+ return m_path;
+}
+
+void AreaChartItem::updatePath()
+{
+ QPainterPath path;
+ QRectF rect(QPointF(0,0),domain()->size());
+
+ path = m_upper->path();
+
+ if (m_lower) {
+ // Note: Polarcharts always draw area correctly only when both series have equal width or are
+ // fully displayed. If one series is partally off-chart, the connecting line between
+ // the series does not attach to the end of the partially hidden series but to the point
+ // where it intersects the axis line. The problem is especially noticeable when one of the series
+ // is entirely off-chart, in which case the connecting line connects two ends of the
+ // visible series.
+ // This happens because we get the paths from linechart, which omits off-chart segments.
+ // To properly fix, linechart would need to provide true full path, in right, left, and the rest
+ // portions to enable proper clipping. However, combining those to single visually unified area
+ // would be a nightmare, since they would have to be painted separately.
+ path.connectPath(m_lower->path().toReversed());
+ } else {
+ QPointF first = path.pointAtPercent(0);
+ QPointF last = path.pointAtPercent(1);
+ if (presenter()->chartType() == QChart::ChartTypeCartesian) {
+ path.lineTo(last.x(), rect.bottom());
+ path.lineTo(first.x(), rect.bottom());
+ } else { // polar
+ path.lineTo(rect.center());
+ }
+ }
+ path.closeSubpath();
+
+ // Only zoom in if the bounding rect of the path fits inside int limits. QWidget::update() uses
+ // a region that has to be compatible with QRect.
+ if (path.boundingRect().height() <= INT_MAX
+ && path.boundingRect().width() <= INT_MAX) {
+ prepareGeometryChange();
+ m_path = path;
+ m_rect = path.boundingRect();
+ update();
+ }
+}
+
+void AreaChartItem::handleUpdated()
+{
+ setVisible(m_series->isVisible());
+ m_pointsVisible = m_series->pointsVisible();
+ m_linePen = m_series->pen();
+ m_brush = m_series->brush();
+ m_pointPen = m_series->pen();
+ m_pointPen.setWidthF(2 * m_pointPen.width());
+ setOpacity(m_series->opacity());
+ m_pointLabelsFormat = m_series->pointLabelsFormat();
+ m_pointLabelsVisible = m_series->pointLabelsVisible();
+ m_pointLabelsFont = m_series->pointLabelsFont();
+ m_pointLabelsColor = m_series->pointLabelsColor();
+ update();
+}
+
+void AreaChartItem::handleDomainUpdated()
+{
+ if (m_upper) {
+ AbstractDomain* d = m_upper->domain();
+ d->setSize(domain()->size());
+ d->setRange(domain()->minX(),domain()->maxX(),domain()->minY(),domain()->maxY());
+ m_upper->handleDomainUpdated();
+ }
+
+ if (m_lower) {
+ AbstractDomain* d = m_lower->domain();
+ d->setSize(domain()->size());
+ d->setRange(domain()->minX(),domain()->maxX(),domain()->minY(),domain()->maxY());
+ m_lower->handleDomainUpdated();
+ }
+}
+
+void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(widget)
+ Q_UNUSED(option)
+ painter->save();
+ painter->setPen(m_linePen);
+ painter->setBrush(m_brush);
+ QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
+ if (presenter()->chartType() == QChart::ChartTypePolar)
+ painter->setClipRegion(QRegion(clipRect.toRect(), QRegion::Ellipse));
+ else
+ painter->setClipRect(clipRect);
+ painter->drawPath(m_path);
+ if (m_pointsVisible) {
+ painter->setPen(m_pointPen);
+ painter->drawPoints(m_upper->geometryPoints());
+ if (m_lower)
+ painter->drawPoints(m_lower->geometryPoints());
+ }
+
+ // Draw series point label
+ if (m_pointLabelsVisible) {
+ static const QString xPointTag(QLatin1String("@xPoint"));
+ static const QString yPointTag(QLatin1String("@yPoint"));
+ const int labelOffset = 2;
+
+ painter->setFont(m_pointLabelsFont);
+ painter->setPen(QPen(m_pointLabelsColor));
+ QFontMetrics fm(painter->font());
+
+ QString pointLabel = m_pointLabelsFormat;
+
+ if (m_series->upperSeries()) {
+ for (int i(0); i < m_series->upperSeries()->count(); i++) {
+ pointLabel.replace(xPointTag,
+ presenter()->numberToString(m_series->upperSeries()->at(i).x()));
+ pointLabel.replace(yPointTag,
+ presenter()->numberToString(m_series->upperSeries()->at(i).y()));
+
+ // Position text in relation to the point
+ int pointLabelWidth = fm.width(pointLabel);
+ QPointF position(m_upper->geometryPoints().at(i));
+ position.setX(position.x() - pointLabelWidth / 2);
+ position.setY(position.y() - m_series->upperSeries()->pen().width() / 2 - labelOffset);
+
+ painter->drawText(position, pointLabel);
+ }
+ }
+
+ if (m_series->lowerSeries()) {
+ for (int i(0); i < m_series->lowerSeries()->count(); i++) {
+ pointLabel.replace(xPointTag,
+ presenter()->numberToString(m_series->lowerSeries()->at(i).x()));
+ pointLabel.replace(yPointTag,
+ presenter()->numberToString(m_series->lowerSeries()->at(i).y()));
+
+ // Position text in relation to the point
+ int pointLabelWidth = fm.width(pointLabel);
+ QPointF position(m_lower->geometryPoints().at(i));
+ position.setX(position.x() - pointLabelWidth / 2);
+ position.setY(position.y() - m_series->lowerSeries()->pen().width() / 2 - labelOffset);
+
+ painter->drawText(position, pointLabel);
+ }
+ }
+ }
+
+ painter->restore();
+}
+
+void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ emit clicked(m_upper->domain()->calculateDomainPoint(event->pos()));
+ ChartItem::mousePressEvent(event);
+}
+
+void AreaChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ emit hovered(domain()->calculateDomainPoint(event->pos()), true);
+ event->accept();
+// QGraphicsItem::hoverEnterEvent(event);
+}
+
+void AreaChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ emit hovered(domain()->calculateDomainPoint(event->pos()), false);
+ event->accept();
+// QGraphicsItem::hoverEnterEvent(event);
+}
+
+#include "moc_areachartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/areachart/areachartitem_p.h b/src/charts/areachart/areachartitem_p.h
new file mode 100644
index 00000000..5f806af6
--- /dev/null
+++ b/src/charts/areachart/areachartitem_p.h
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef AREACHARTITEM_H
+#define AREACHARTITEM_H
+
+#include "qchartglobal.h"
+#include "linechartitem_p.h"
+#include "qareaseries.h"
+#include <QPen>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class AreaChartItem;
+
+class AreaChartItem : public ChartItem
+{
+ Q_OBJECT
+public:
+ AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item = 0);
+ ~AreaChartItem();
+
+ //from QGraphicsItem
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ QPainterPath shape() const;
+
+ LineChartItem *upperLineItem() const { return m_upper; }
+ LineChartItem *lowerLineItem() const { return m_lower; }
+
+ void updatePath();
+
+ void setPresenter(ChartPresenter *presenter);
+ QAreaSeries *series() const { return m_series; }
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+
+Q_SIGNALS:
+ void clicked(const QPointF &point);
+ void hovered(const QPointF &point, bool state);
+
+public Q_SLOTS:
+ void handleUpdated();
+ void handleDomainUpdated();
+
+private:
+ QAreaSeries *m_series;
+ LineChartItem *m_upper;
+ LineChartItem *m_lower;
+ QPainterPath m_path;
+ QRectF m_rect;
+ QPen m_linePen;
+ QPen m_pointPen;
+ QBrush m_brush;
+ bool m_pointsVisible;
+
+ bool m_pointLabelsVisible;
+ QString m_pointLabelsFormat;
+ QFont m_pointLabelsFont;
+ QColor m_pointLabelsColor;
+
+};
+
+class AreaBoundItem : public LineChartItem
+{
+public:
+ AreaBoundItem(AreaChartItem *area, QLineSeries *lineSeries,QGraphicsItem* item = 0)
+ : LineChartItem(lineSeries, item), m_item(area)
+ {
+ // We do not actually want to draw anything from LineChartItem.
+ // Drawing is done in AreaChartItem only.
+ setVisible(false);
+ }
+ ~AreaBoundItem() {}
+
+ void updateGeometry()
+ {
+ // Turn off points drawing from component line chart item, as that
+ // messes up the fill for area series.
+ suppressPoints();
+ // Component lineseries are not necessarily themselves on the chart,
+ // so get the chart type for them from area chart.
+ forceChartType(m_item->series()->chart()->chartType());
+ LineChartItem::updateGeometry();
+ m_item->updatePath();
+ }
+
+private:
+ AreaChartItem *m_item;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/areachart/qareaseries.cpp b/src/charts/areachart/qareaseries.cpp
new file mode 100644
index 00000000..e2a2ea2f
--- /dev/null
+++ b/src/charts/areachart/qareaseries.cpp
@@ -0,0 +1,657 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qareaseries.h"
+#include "qareaseries_p.h"
+#include "qlineseries.h"
+#include "areachartitem_p.h"
+#include "abstractdomain_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "qvalueaxis.h"
+#include "qarealegendmarker.h"
+#include "qchart_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QAreaSeries
+ \inmodule Qt Charts
+ \brief The QAreaSeries class is used for making area charts.
+
+ \mainclass
+
+ An area chart is used to show quantitative data. It is based on line chart, in the way that area between axis and the line
+ is emphasized with color. Since the area chart is based on line chart, QAreaSeries constructor needs QLineSeries instance,
+ which defines "upper" boundary of the area. "Lower" boundary is defined by default by axis X. Instead of axis X "lower" boundary can be specified by other line.
+ In that case QAreaSeries should be initiated with two QLineSeries instances. Please note terms "upper" and "lower" boundary can be misleading in cases
+ where "lower" boundary had bigger values than the "upper" one, however the main point that area between these two boundary lines will be filled.
+
+ See the \l {AreaChart Example} {area chart example} to learn how to create a simple area chart.
+ \image examples_areachart.png
+*/
+
+/*!
+ \qmltype AreaSeries
+ \instantiates QAreaSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractSeries
+
+ \brief The AreaSeries type is used for making area charts.
+
+ The following QML shows how to create a simple area chart:
+ \snippet qmlchart/qml/qmlchart/View4.qml 1
+ \beginfloatleft
+ \image examples_qmlchart4.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ \property QAreaSeries::upperSeries
+ \brief The upper one of the two line series used to define area series boundaries.
+*/
+/*!
+ \qmlproperty LineSeries AreaSeries::upperSeries
+ The upper one of the two line series used to define area series boundaries.
+*/
+
+/*!
+ \property QAreaSeries::lowerSeries
+ The lower one of the two line series used to define are series boundaries. Note if
+ QAreaSeries was constructed without a\ lowerSeries this is null.
+*/
+/*!
+ \qmlproperty LineSeries AreaSeries::lowerSeries
+ The lower one of the two line series used to define are series boundaries. Note if
+ AreaSeries was constructed without a\ lowerSeries this is null.
+*/
+
+/*!
+ \property QAreaSeries::color
+ Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
+ \sa QAreaSeries::brush()
+*/
+/*!
+ \qmlproperty color AreaSeries::color
+ Fill (brush) color of the series.
+*/
+
+/*!
+ \property QAreaSeries::borderColor
+ Line (pen) color of the series. This is a convenience property for modifying the color of pen.
+ \sa QAreaSeries::pen()
+*/
+/*!
+ \qmlproperty color AreaSeries::borderColor
+ Line (pen) color of the series.
+*/
+
+/*!
+ \qmlproperty real AreaSeries::borderWidth
+ The width of the border line. By default the width is 2.0.
+*/
+
+/*!
+ \fn QPen QAreaSeries::pen() const
+ \brief Returns the pen used to draw line for this series.
+ \sa setPen()
+*/
+
+/*!
+ \fn QPen QAreaSeries::brush() const
+ \brief Returns the brush used to draw line for this series.
+ \sa setBrush()
+*/
+
+/*!
+ \qmlproperty QString AreaSeries::brushFilename
+ The name of the file used as a brush image for the series.
+*/
+
+/*!
+ \fn void QAreaSeries::colorChanged(QColor color)
+ \brief Signal is emitted when the fill (brush) color has changed to \a color.
+*/
+/*!
+ \qmlsignal AreaSeries::onColorChanged(color color)
+ Signal is emitted when the fill (brush) color has changed to \a color.
+*/
+
+/*!
+ \fn void QAreaSeries::borderColorChanged(QColor color)
+ \brief Signal is emitted when the line (pen) color has changed to \a color.
+*/
+/*!
+ \qmlsignal AreaSeries::onBorderColorChanged(color color)
+ Signal is emitted when the line (pen) color has changed to \a color.
+*/
+
+/*!
+ \fn void QAreaSeries::clicked(const QPointF& point)
+ \brief Signal is emitted when user clicks the \a point on area chart.
+*/
+/*!
+ \qmlsignal AreaSeries::onClicked(QPointF point)
+ Signal is emitted when user clicks the \a point on area chart.
+*/
+
+/*!
+ \fn void QAreaSeries::hovered(const QPointF &point, bool state)
+ This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
+ of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
+ the series.
+*/
+/*!
+ \qmlsignal AreaSeries::onHovered(point point, bool state)
+ This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
+ of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
+ the series.
+*/
+
+/*!
+ \fn void QAreaSeries::selected()
+ The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
+ implemented by the user of QAreaSeries API.
+*/
+/*!
+ \qmlsignal AreaSeries::onSelected()
+ The signal is emitted if the user selects/deselects the XY series. The logic for maintaining selections should be
+ implemented by the user of AreaSeries API.
+*/
+
+/*!
+ \fn void QAreaSeriesPrivate::updated()
+ \brief \internal
+*/
+
+/*!
+ \property QAreaSeries::pointLabelsFormat
+ The \a format used for showing labels with series points.
+
+ QAreaSeries supports the following format tags:
+ \table
+ \row
+ \li @xPoint \li The x value of the data point
+ \row
+ \li @yPoint \li The y value of the data point
+ \endtable
+
+ For example, the following usage of the format tags would produce labels that have the data
+ point (x, y) shown inside brackets separated by a comma:
+ \code
+ series->setPointLabelsFormat("(@xPoint, @yPoint)");
+ \endcode
+
+ By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot
+ area, labels on the edge of the plot area are cut. If the points are close to each other the
+ labels may overlap.
+
+ \sa QAreaSeries::pointLabelsVisible, QAreaSeries::pointLabelsFont, QAreaSeries::pointLabelsColor
+*/
+/*!
+ \qmlproperty string AreaSeries::pointLabelsFormat
+ The \a format used for showing labels with series points.
+
+ \sa QAreaSeries::pointLabelsFormat, pointLabelsVisible, pointLabelsFont, pointLabelsColor
+*/
+/*!
+ \fn void QAreaSeries::pointLabelsFormatChanged(const QString &format)
+ Signal is emitted when the \a format of data point labels is changed.
+*/
+/*!
+ \qmlsignal AreaSeries::onPointLabelsFormatChanged(string format)
+ Signal is emitted when the \a format of data point labels is changed.
+*/
+
+/*!
+ \property QAreaSeries::pointLabelsVisible
+ Defines the visibility for data point labels. False by default.
+
+ \sa QAreaSeries::pointLabelsFormat
+*/
+/*!
+ \qmlproperty bool AreaSeries::pointLabelsVisible
+ Defines the visibility for data point labels.
+
+ \sa pointLabelsFormat
+*/
+/*!
+ \fn void QAreaSeries::pointLabelsVisibilityChanged(bool visible)
+ The visibility of the data point labels is changed to \a visible.
+*/
+/*!
+ \qmlsignal AreaSeries::onPointLabelsVisibilityChanged(bool visible)
+ The visibility of the data point labels is changed to \a visible.
+*/
+
+/*!
+ \property QAreaSeries::pointLabelsFont
+ Defines the font used for data point labels.
+
+ \sa QAreaSeries::pointLabelsFormat
+*/
+/*!
+ \qmlproperty font AreaSeries::pointLabelsFont
+ Defines the font used for data point labels.
+
+ \sa pointLabelsFormat
+*/
+/*!
+ \fn void QAreaSeries::pointLabelsFontChanged(const QFont &font);
+ The font used for data point labels is changed to \a font.
+*/
+/*!
+ \qmlsignal AreaSeries::onPointLabelsFontChanged(Font font)
+ The font used for data point labels is changed to \a font.
+*/
+
+/*!
+ \property QAreaSeries::pointLabelsColor
+ Defines the color used for data point labels. By default, the color is the color of the brush
+ defined in theme for labels.
+
+ \sa QAreaSeries::pointLabelsFormat
+*/
+/*!
+ \qmlproperty font AreaSeries::pointLabelsColor
+ Defines the color used for data point labels. By default, the color is the color of the brush
+ defined in theme for labels.
+
+ \sa pointLabelsFormat
+*/
+/*!
+ \fn void QAreaSeries::pointLabelsColorChanged(const QColor &color);
+ The color used for data point labels is changed to \a color.
+*/
+/*!
+ \qmlsignal AreaSeries::onPointLabelsColorChanged(Color color)
+ The color used for data point labels is changed to \a color.
+*/
+
+/*!
+ Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a
+ upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead.
+ When series object is added to QChartView or QChart instance ownerships is transferred.
+*/
+QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries)
+ : QAbstractSeries(*new QAreaSeriesPrivate(upperSeries, lowerSeries, this), upperSeries)
+{
+}
+
+/*!
+ Constructs area series object without upper or lower series with \a parent object.
+*/
+QAreaSeries::QAreaSeries(QObject *parent)
+ : QAbstractSeries(*new QAreaSeriesPrivate(0, 0, this), parent)
+{
+}
+
+/*!
+ Destroys the object.
+*/
+QAreaSeries::~QAreaSeries()
+{
+ Q_D(QAreaSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+
+/*!
+ Returns QAbstractSeries::SeriesTypeArea.
+*/
+QAbstractSeries::SeriesType QAreaSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeArea;
+}
+
+/*!
+ Sets the \a series that is to be used as the area chart upper series.
+*/
+void QAreaSeries::setUpperSeries(QLineSeries *series)
+{
+ Q_D(QAreaSeries);
+ if (d->m_upperSeries != series)
+ d->m_upperSeries = series;
+}
+
+QLineSeries *QAreaSeries::upperSeries() const
+{
+ Q_D(const QAreaSeries);
+ return d->m_upperSeries;
+}
+
+/*!
+ Sets the \a series that is to be used as the area chart lower series.
+*/
+void QAreaSeries::setLowerSeries(QLineSeries *series)
+{
+ Q_D(QAreaSeries);
+ d->m_lowerSeries = series;
+}
+
+QLineSeries *QAreaSeries::lowerSeries() const
+{
+ Q_D(const QAreaSeries);
+ return d->m_lowerSeries;
+}
+
+/*!
+ Sets \a pen used for drawing area outline.
+*/
+void QAreaSeries::setPen(const QPen &pen)
+{
+ Q_D(QAreaSeries);
+ if (d->m_pen != pen) {
+ d->m_pen = pen;
+ emit d->updated();
+ }
+}
+
+QPen QAreaSeries::pen() const
+{
+ Q_D(const QAreaSeries);
+ if (d->m_pen == QChartPrivate::defaultPen())
+ return QPen();
+ else
+ return d->m_pen;
+}
+
+/*!
+ Sets \a brush used for filling the area.
+*/
+void QAreaSeries::setBrush(const QBrush &brush)
+{
+ Q_D(QAreaSeries);
+ if (d->m_brush != brush) {
+ bool emitColorChanged = brush.color() != d->m_brush.color();
+ d->m_brush = brush;
+ emit d->updated();
+ if (emitColorChanged)
+ emit colorChanged(brush.color());
+ }
+}
+
+QBrush QAreaSeries::brush() const
+{
+ Q_D(const QAreaSeries);
+ if (d->m_brush == QChartPrivate::defaultBrush())
+ return QBrush();
+ else
+ return d->m_brush;
+}
+
+void QAreaSeries::setColor(const QColor &color)
+{
+ QBrush b = brush();
+ if (b == QBrush())
+ b.setStyle(Qt::SolidPattern);
+ b.setColor(color);
+ setBrush(b);
+}
+
+QColor QAreaSeries::color() const
+{
+ return brush().color();
+}
+
+void QAreaSeries::setBorderColor(const QColor &color)
+{
+ QPen p = pen();
+ if (p.color() != color) {
+ p.setColor(color);
+ setPen(p);
+ emit borderColorChanged(color);
+ }
+}
+
+QColor QAreaSeries::borderColor() const
+{
+ return pen().color();
+}
+
+/*!
+ Sets if data points are \a visible and should be drawn on line.
+*/
+void QAreaSeries::setPointsVisible(bool visible)
+{
+ Q_D(QAreaSeries);
+ if (d->m_pointsVisible != visible) {
+ d->m_pointsVisible = visible;
+ emit d->updated();
+ }
+}
+
+/*!
+ Returns if the points are drawn for this series.
+ \sa setPointsVisible()
+*/
+bool QAreaSeries::pointsVisible() const
+{
+ Q_D(const QAreaSeries);
+ return d->m_pointsVisible;
+}
+
+void QAreaSeries::setPointLabelsFormat(const QString &format)
+{
+ Q_D(QAreaSeries);
+ if (d->m_pointLabelsFormat != format) {
+ d->m_pointLabelsFormat = format;
+ emit pointLabelsFormatChanged(format);
+ }
+}
+
+QString QAreaSeries::pointLabelsFormat() const
+{
+ Q_D(const QAreaSeries);
+ return d->m_pointLabelsFormat;
+}
+
+void QAreaSeries::setPointLabelsVisible(bool visible)
+{
+ Q_D(QAreaSeries);
+ if (d->m_pointLabelsVisible != visible) {
+ d->m_pointLabelsVisible = visible;
+ emit pointLabelsVisibilityChanged(visible);
+ }
+}
+
+bool QAreaSeries::pointLabelsVisible() const
+{
+ Q_D(const QAreaSeries);
+ return d->m_pointLabelsVisible;
+}
+
+void QAreaSeries::setPointLabelsFont(const QFont &font)
+{
+ Q_D(QAreaSeries);
+ if (d->m_pointLabelsFont != font) {
+ d->m_pointLabelsFont = font;
+ emit pointLabelsFontChanged(font);
+ }
+}
+
+QFont QAreaSeries::pointLabelsFont() const
+{
+ Q_D(const QAreaSeries);
+ return d->m_pointLabelsFont;
+}
+
+void QAreaSeries::setPointLabelsColor(const QColor &color)
+{
+ Q_D(QAreaSeries);
+ if (d->m_pointLabelsColor != color) {
+ d->m_pointLabelsColor = color;
+ emit pointLabelsColorChanged(color);
+ }
+}
+
+QColor QAreaSeries::pointLabelsColor() const
+{
+ Q_D(const QAreaSeries);
+ if (d->m_pointLabelsColor == QChartPrivate::defaultPen().color())
+ return QPen().color();
+ else
+ return d->m_pointLabelsColor;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q)
+ : QAbstractSeriesPrivate(q),
+ m_brush(QChartPrivate::defaultBrush()),
+ m_pen(QChartPrivate::defaultPen()),
+ m_upperSeries(upperSeries),
+ m_lowerSeries(lowerSeries),
+ m_pointsVisible(false),
+ m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")),
+ m_pointLabelsVisible(false),
+ m_pointLabelsFont(QChartPrivate::defaultFont()),
+ m_pointLabelsColor(QChartPrivate::defaultPen().color())
+{
+}
+
+void QAreaSeriesPrivate::initializeDomain()
+{
+ Q_Q(QAreaSeries);
+
+ qreal minX(domain()->minX());
+ qreal minY(domain()->minY());
+ qreal maxX(domain()->maxX());
+ qreal maxY(domain()->maxY());
+
+ QLineSeries *upperSeries = q->upperSeries();
+ QLineSeries *lowerSeries = q->lowerSeries();
+
+ if (upperSeries) {
+ const QList<QPointF>& points = upperSeries->points();
+
+ for (int i = 0; i < points.count(); i++) {
+ qreal x = points[i].x();
+ qreal y = points[i].y();
+ minX = qMin(minX, x);
+ minY = qMin(minY, y);
+ maxX = qMax(maxX, x);
+ maxY = qMax(maxY, y);
+ }
+ }
+ if (lowerSeries) {
+
+ const QList<QPointF>& points = lowerSeries->points();
+
+ for (int i = 0; i < points.count(); i++) {
+ qreal x = points[i].x();
+ qreal y = points[i].y();
+ minX = qMin(minX, x);
+ minY = qMin(minY, y);
+ maxX = qMax(maxX, x);
+ maxY = qMax(maxY, y);
+ }
+ }
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+void QAreaSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QAreaSeries);
+ AreaChartItem *area = new AreaChartItem(q,parent);
+ m_item.reset(area);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
+{
+ Q_Q(QAreaSeries);
+ AreaChartItem *area = static_cast<AreaChartItem *>(m_item.data());
+
+ if (q->upperSeries() && area->upperLineItem()->animation())
+ area->upperLineItem()->animation()->stopAndDestroyLater();
+ if (q->lowerSeries() && area->lowerLineItem()->animation())
+ area->lowerLineItem()->animation()->stopAndDestroyLater();
+
+ if (options.testFlag(QChart::SeriesAnimations)) {
+ area->upperLineItem()->setAnimation(new XYAnimation(area->upperLineItem()));
+ if (q->lowerSeries())
+ area->lowerLineItem()->setAnimation(new XYAnimation(area->lowerLineItem()));
+ } else {
+ if (q->upperSeries())
+ area->upperLineItem()->setAnimation(0);
+ if (q->lowerSeries())
+ area->lowerLineItem()->setAnimation(0);
+ }
+ QAbstractSeriesPrivate::initializeAnimations(options);
+}
+
+QList<QLegendMarker*> QAreaSeriesPrivate::createLegendMarkers(QLegend* legend)
+{
+ Q_Q(QAreaSeries);
+ QList<QLegendMarker*> list;
+ return list << new QAreaLegendMarker(q,legend);
+}
+
+
+void QAreaSeriesPrivate::initializeAxes()
+{
+
+}
+
+QAbstractAxis::AxisType QAreaSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
+{
+ Q_UNUSED(orientation);
+ return QAbstractAxis::AxisTypeValue;
+}
+
+QAbstractAxis* QAreaSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
+{
+ Q_UNUSED(orientation);
+ return new QValueAxis;
+}
+
+void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
+{
+ Q_Q(QAreaSeries);
+
+ const QList<QGradient> gradients = theme->seriesGradients();
+ const QList<QColor> colors = theme->seriesColors();
+
+ if (forced || QChartPrivate::defaultPen() == m_pen) {
+ QPen pen;
+ pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
+ pen.setWidthF(2);
+ q->setPen(pen);
+ }
+
+ if (forced || QChartPrivate::defaultBrush() == m_brush) {
+ QBrush brush(colors.at(index % colors.size()));
+ q->setBrush(brush);
+ }
+
+ if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
+ QColor color = theme->labelBrush().color();
+ q->setPointLabelsColor(color);
+ }
+}
+
+
+#include "moc_qareaseries.cpp"
+#include "moc_qareaseries_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/areachart/qareaseries.h b/src/charts/areachart/qareaseries.h
new file mode 100644
index 00000000..cad15c77
--- /dev/null
+++ b/src/charts/areachart/qareaseries.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QAREASERIES_H
+#define QAREASERIES_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/qabstractseries.h>
+#include <QPen>
+#include <QBrush>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QLineSeries;
+class QAreaSeriesPrivate;
+
+class QT_CHARTS_EXPORT QAreaSeries : public QAbstractSeries
+{
+ Q_OBJECT
+ Q_PROPERTY(QLineSeries *upperSeries READ upperSeries)
+ Q_PROPERTY(QLineSeries *lowerSeries READ lowerSeries)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
+ Q_PROPERTY(QString pointLabelsFormat READ pointLabelsFormat WRITE setPointLabelsFormat NOTIFY pointLabelsFormatChanged)
+ Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged)
+ Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged)
+ Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged)
+
+public:
+ explicit QAreaSeries(QObject *parent = 0);
+ explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0);
+ ~QAreaSeries();
+
+public:
+ QAbstractSeries::SeriesType type() const;
+
+ void setUpperSeries(QLineSeries *series);
+ QLineSeries *upperSeries() const;
+ void setLowerSeries(QLineSeries *series);
+ QLineSeries *lowerSeries() const;
+
+ void setPen(const QPen &pen);
+ QPen pen() const;
+
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+
+ void setColor(const QColor &color);
+ QColor color() const;
+
+ void setBorderColor(const QColor &color);
+ QColor borderColor() const;
+
+ void setPointsVisible(bool visible = true);
+ bool pointsVisible() const;
+
+ void setPointLabelsFormat(const QString &format);
+ QString pointLabelsFormat() const;
+
+ void setPointLabelsVisible(bool visible = true);
+ bool pointLabelsVisible() const;
+
+ void setPointLabelsFont(const QFont &font);
+ QFont pointLabelsFont() const;
+
+ void setPointLabelsColor(const QColor &color);
+ QColor pointLabelsColor() const;
+
+Q_SIGNALS:
+ void clicked(const QPointF &point);
+ void hovered(const QPointF &point, bool state);
+ void selected();
+ void colorChanged(QColor color);
+ void borderColorChanged(QColor color);
+ void pointLabelsFormatChanged(const QString &format);
+ void pointLabelsVisibilityChanged(bool visible);
+ void pointLabelsFontChanged(const QFont &font);
+ void pointLabelsColorChanged(const QColor &color);
+
+private:
+ Q_DECLARE_PRIVATE(QAreaSeries)
+ Q_DISABLE_COPY(QAreaSeries)
+ friend class AreaLegendMarker;
+ friend class AreaChartItem;
+ friend class QAreaLegendMarkerPrivate;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QAREASERIES_H
diff --git a/src/charts/areachart/qareaseries_p.h b/src/charts/areachart/qareaseries_p.h
new file mode 100644
index 00000000..3f6293d3
--- /dev/null
+++ b/src/charts/areachart/qareaseries_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QAREASERIES_P_H
+#define QAREASERIES_P_H
+
+#include "qabstractseries_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAreaSeries;
+
+class QAreaSeriesPrivate: public QAbstractSeriesPrivate
+{
+ Q_OBJECT
+
+public:
+ QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q);
+
+ void initializeDomain();
+ void initializeAxes();
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeTheme(int index, ChartTheme* theme, bool forced = false);
+ void initializeAnimations(QChart::AnimationOptions options);
+
+ QList<QLegendMarker *> createLegendMarkers(QLegend *legend);
+
+ QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
+ QAbstractAxis* createDefaultAxis(Qt::Orientation) const;
+
+Q_SIGNALS:
+ void updated();
+
+protected:
+ QBrush m_brush;
+ QPen m_pen;
+ QLineSeries *m_upperSeries;
+ QLineSeries *m_lowerSeries;
+ bool m_pointsVisible;
+ QString m_pointLabelsFormat;
+ bool m_pointLabelsVisible;
+ QFont m_pointLabelsFont;
+ QColor m_pointLabelsColor;
+private:
+ Q_DECLARE_PUBLIC(QAreaSeries);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/axis/axis.pri b/src/charts/axis/axis.pri
index 6f706aac..6f706aac 100644
--- a/src/axis/axis.pri
+++ b/src/charts/axis/axis.pri
diff --git a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp
new file mode 100644
index 00000000..259cdaa9
--- /dev/null
+++ b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "chartbarcategoryaxisx_p.h"
+#include "chartpresenter_p.h"
+#include "qbarcategoryaxis_p.h"
+#include "abstractchartlayout_p.h"
+#include <QDebug>
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartBarCategoryAxisX::ChartBarCategoryAxisX(QBarCategoryAxis *axis, QGraphicsItem* item)
+ : HorizontalAxis(axis, item, true),
+ m_categoriesAxis(axis)
+{
+ QObject::connect(m_categoriesAxis,SIGNAL(categoriesChanged()),this, SLOT(handleCategoriesChanged()));
+ handleCategoriesChanged();
+}
+
+ChartBarCategoryAxisX::~ChartBarCategoryAxisX()
+{
+}
+
+QVector<qreal> ChartBarCategoryAxisX::calculateLayout() const
+{
+ QVector<qreal> points;
+ const QRectF& gridRect = gridGeometry();
+ qreal range = max() - min();
+ const qreal delta = gridRect.width() / range;
+
+ if (delta < 2)
+ return points;
+
+ qreal adjustedMin = min() + 0.5;
+ qreal offset = (ceil(adjustedMin) - adjustedMin) * delta;
+
+ int count = qFloor(range);
+ if (count < 1)
+ return points;
+
+ points.resize(count + 2);
+
+ for (int i = 0; i < count + 2; ++i)
+ points[i] = offset + (qreal(i) * delta) + gridRect.left();
+
+ return points;
+}
+
+QStringList ChartBarCategoryAxisX::createCategoryLabels(const QVector<qreal>& layout) const
+{
+ QStringList result ;
+ const QRectF &gridRect = gridGeometry();
+ qreal d = (max() - min()) / gridRect.width();
+
+ for (int i = 0; i < layout.count() - 1; ++i) {
+ qreal x = qFloor((((layout[i] + layout[i + 1]) / 2 - gridRect.left()) * d + min() + 0.5));
+ if ((x < m_categoriesAxis->categories().count()) && (x >= 0)) {
+ result << m_categoriesAxis->categories().at(x);
+ } else {
+ // No label for x coordinate
+ result << QString();
+ }
+ }
+ result << QString();
+ return result;
+}
+
+
+void ChartBarCategoryAxisX::updateGeometry()
+{
+ const QVector<qreal>& layout = ChartAxisElement::layout();
+ if (layout.isEmpty())
+ return;
+ setLabels(createCategoryLabels(layout));
+ HorizontalAxis::updateGeometry();
+}
+
+void ChartBarCategoryAxisX::handleCategoriesChanged()
+{
+ QGraphicsLayoutItem::updateGeometry();
+ if(presenter()) presenter()->layout()->invalidate();
+}
+
+QSizeF ChartBarCategoryAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+ QSizeF base = HorizontalAxis::sizeHint(which, constraint);
+ QStringList ticksList = m_categoriesAxis->categories();
+
+ qreal width = 0; // Width is irrelevant for X axes with interval labels
+ qreal height = 0;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ height = boundingRect.height() + labelPadding() + base.height() + 1.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize:{
+ qreal labelHeight = 0.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelHeight = qMax(rect.height(), labelHeight);
+ }
+ height = labelHeight + labelPadding() + base.height() + 1.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+ return sh;
+}
+
+#include "moc_chartbarcategoryaxisx_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx_p.h b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx_p.h
new file mode 100644
index 00000000..177540e2
--- /dev/null
+++ b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisx_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTBARCATEGORYAXISX_H
+#define CHARTBARCATEGORYAXISX_H
+
+#include "horizontalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartPresenter;
+class QBarCategoryAxis;
+
+class ChartBarCategoryAxisX : public HorizontalAxis
+{
+ Q_OBJECT
+public:
+ ChartBarCategoryAxisX(QBarCategoryAxis *axis, QGraphicsItem* item = 0);
+ ~ChartBarCategoryAxisX();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+private:
+ QStringList createCategoryLabels(const QVector<qreal>& layout) const;
+public Q_SLOTS:
+ void handleCategoriesChanged();
+
+private:
+ QBarCategoryAxis *m_categoriesAxis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTBARCATEGORYAXISX_H */
diff --git a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy.cpp b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy.cpp
new file mode 100644
index 00000000..126c7da3
--- /dev/null
+++ b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "chartbarcategoryaxisy_p.h"
+#include "chartpresenter_p.h"
+#include "qbarcategoryaxis_p.h"
+#include "abstractchartlayout_p.h"
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartBarCategoryAxisY::ChartBarCategoryAxisY(QBarCategoryAxis *axis, QGraphicsItem* item)
+ : VerticalAxis(axis, item, true),
+ m_categoriesAxis(axis)
+{
+ QObject::connect( m_categoriesAxis,SIGNAL(categoriesChanged()),this, SLOT(handleCategoriesChanged()));
+ handleCategoriesChanged();
+}
+
+ChartBarCategoryAxisY::~ChartBarCategoryAxisY()
+{
+}
+
+QVector<qreal> ChartBarCategoryAxisY::calculateLayout() const
+{
+ QVector<qreal> points;
+ const QRectF& gridRect = gridGeometry();
+ qreal range = max() - min();
+ const qreal delta = gridRect.height() / range;
+
+ if (delta < 2)
+ return points;
+
+ qreal adjustedMin = min() + 0.5;
+ qreal offset = (ceil(adjustedMin) - adjustedMin) * delta;
+
+ int count = qFloor(range);
+ if (count < 1)
+ return points;
+
+ points.resize(count + 2);
+
+ for (int i = 0; i < count + 2; ++i)
+ points[i] = gridRect.bottom() - (qreal(i) * delta) - offset;
+
+ return points;
+}
+
+QStringList ChartBarCategoryAxisY::createCategoryLabels(const QVector<qreal>& layout) const
+{
+ QStringList result;
+ const QRectF &gridRect = gridGeometry();
+ qreal d = (max() - min()) / gridRect.height();
+
+ for (int i = 0; i < layout.count() - 1; ++i) {
+ qreal x = qFloor(((gridRect.height() - (layout[i + 1] + layout[i]) / 2 + gridRect.top()) * d + min() + 0.5));
+ if ((x < m_categoriesAxis->categories().count()) && (x >= 0)) {
+ result << m_categoriesAxis->categories().at(x);
+ } else {
+ // No label for x coordinate
+ result << QString();
+ }
+ }
+ result << QString();
+ return result;
+}
+
+void ChartBarCategoryAxisY::updateGeometry()
+{
+ const QVector<qreal>& layout = ChartAxisElement::layout();
+ if (layout.isEmpty())
+ return;
+ setLabels(createCategoryLabels(layout));
+ VerticalAxis::updateGeometry();
+}
+
+void ChartBarCategoryAxisY::handleCategoriesChanged()
+{
+ QGraphicsLayoutItem::updateGeometry();
+ if(presenter()) presenter()->layout()->invalidate();
+}
+
+QSizeF ChartBarCategoryAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+ QSizeF base = VerticalAxis::sizeHint(which, constraint);
+ QStringList ticksList = m_categoriesAxis->categories();
+ qreal width = 0;
+ qreal height = 0; // Height is irrelevant for Y axes with interval labels
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ width = boundingRect.width() + labelPadding() + base.width() + 1.0;
+ if (base.width() > 0.0)
+ width += labelPadding();
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize:{
+ qreal labelWidth = 0.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelWidth = qMax(rect.width(), labelWidth);
+ }
+ width = labelWidth + labelPadding() + base.width() + 1.0;
+ if (base.width() > 0.0)
+ width += labelPadding();
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+ return sh;
+}
+
+#include "moc_chartbarcategoryaxisy_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy_p.h b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy_p.h
new file mode 100644
index 00000000..82f2c505
--- /dev/null
+++ b/src/charts/axis/barcategoryaxis/chartbarcategoryaxisy_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTBARCATEGORYAXISY_H
+#define CHARTBARCATEGORYAXISY_H
+
+#include "verticalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarCategoryAxis;
+class ChartPresenter;
+
+class ChartBarCategoryAxisY : public VerticalAxis
+{
+ Q_OBJECT
+public:
+ ChartBarCategoryAxisY(QBarCategoryAxis *axis, QGraphicsItem* item = 0);
+ ~ChartBarCategoryAxisY();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+private:
+ QStringList createCategoryLabels(const QVector<qreal>& layout) const;
+public Q_SLOTS:
+ void handleCategoriesChanged();
+private:
+ QBarCategoryAxis *m_categoriesAxis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTBARCATEGORYAXISY_H */
diff --git a/src/charts/axis/barcategoryaxis/qbarcategoryaxis.cpp b/src/charts/axis/barcategoryaxis/qbarcategoryaxis.cpp
new file mode 100644
index 00000000..7818d6f6
--- /dev/null
+++ b/src/charts/axis/barcategoryaxis/qbarcategoryaxis.cpp
@@ -0,0 +1,620 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbarcategoryaxis.h"
+#include "qbarcategoryaxis_p.h"
+#include "chartbarcategoryaxisx_p.h"
+#include "chartbarcategoryaxisy_p.h"
+#include "abstractdomain_p.h"
+#include "qchart.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/*!
+ \class QBarCategoryAxis
+ \inmodule Qt Charts
+ \brief The QBarCategoryAxis class is used for manipulating chart's axis.
+ \mainclass
+
+ QBarCategoryAxis can be setup to show axis line with tick marks, grid lines and shades.
+ Categories are drawn between ticks. Note that you can use this also with lineseries too.
+ See the \l {Line and BarChart Example} {Line and BarChart Example} to learn how to do that.
+
+ Example code on how to use QBarCategoryAxis.
+ \code
+ QChartView *chartView = new QChartView;
+ QBarSeries *series = new QBarSeries;
+ // ...
+ chartView->chart()->addSeries(series);
+ chartView->chart()->createDefaultAxes();
+
+ QBarCategoryAxis *axisX = new QBarCategoryAxis;
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
+ axisX->append(categories);
+ axisX->setRange("Feb", "May");
+ chartView->chart()->setAxisX(axisX, series);
+ \endcode
+*/
+
+/*!
+ \qmltype BarCategoryAxis
+ \instantiates QBarCategoryAxis
+ \inqmlmodule QtCharts
+
+ \inherits AbstractAxis
+
+ \brief The Axis element is used for manipulating chart's axes.
+
+ Axis can be setup to show axis line with tick marks, grid lines and shades.
+ Categories are drawn between ticks. Note that you can use this also with lineseries too.
+
+ To access BarCategoryAxis you can use ChartView API. For example:
+ \code
+ ChartView {
+ BarCategoryAxis {
+ id: categoryAxis
+ categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ]
+ }
+ // Add a few series...
+ }
+ \endcode
+*/
+
+/*!
+ \property QBarCategoryAxis::categories
+ Defines the categories of axis
+*/
+/*!
+ \qmlproperty QStringList BarCategoryAxis::categories
+ Defines the categories of axis
+*/
+
+/*!
+ \property QBarCategoryAxis::min
+ Defines the minimum value on the axis.
+*/
+/*!
+ \qmlproperty string BarCategoryAxis::min
+ Defines the minimum value on the axis.
+*/
+
+/*!
+ \property QBarCategoryAxis::max
+ Defines the maximum value on the axis.
+*/
+/*!
+ \qmlproperty string BarCategoryAxis::max
+ Defines the maximum value on the axis.
+*/
+
+/*!
+ \property QBarCategoryAxis::count
+ The count of categories.
+*/
+/*!
+ \qmlproperty int BarCategoryAxis::count
+ The count of categories.
+*/
+
+/*!
+ \fn void QBarCategoryAxis::categoriesChanged()
+ Axis emits signal when the categories of the axis have changed.
+*/
+
+/*!
+ \fn void QBarCategoryAxis::minChanged(const QString &min)
+ Axis emits signal when \a min of axis has changed.
+*/
+/*!
+ \qmlsignal BarCategoryAxis::onMinChanged(const QString &min)
+ Axis emits signal when \a min of axis has changed.
+*/
+
+/*!
+ \fn void QBarCategoryAxis::maxChanged(const QString &max)
+ Axis emits signal when \a max of axis has changed.
+*/
+/*!
+ \qmlsignal BarCategoryAxis::onMaxChanged(const QString &max)
+ Axis emits signal when \a max of axis has changed.
+*/
+
+/*!
+ \fn void QBarCategoryAxis::countChanged()
+ Axis emits signal when the count of categories has changed.
+*/
+/*!
+ \qmlsignal BarCategoryAxis::onCountChanged()
+ Axis emits signal when the count of categories has changed.
+*/
+
+/*!
+ \fn void QBarCategoryAxis::rangeChanged(const QString &min, const QString &max)
+ Axis emits signal when \a min or \a max of axis has changed.
+*/
+
+/*!
+ \qmlmethod void BarCategoryAxis::clear()
+ Removes all categories. Sets the maximum and minimum of the axis's range to QString::null.
+*/
+
+/*!
+ Constructs an axis object which is a child of \a parent.
+*/
+QBarCategoryAxis::QBarCategoryAxis(QObject *parent):
+ QAbstractAxis(*new QBarCategoryAxisPrivate(this), parent)
+{
+}
+
+/*!
+ Destroys the object
+*/
+QBarCategoryAxis::~QBarCategoryAxis()
+{
+ Q_D(QBarCategoryAxis);
+ if (d->m_chart)
+ d->m_chart->removeAxis(this);
+}
+
+/*!
+ \internal
+*/
+QBarCategoryAxis::QBarCategoryAxis(QBarCategoryAxisPrivate &d, QObject *parent)
+ : QAbstractAxis(d, parent)
+{
+
+}
+
+/*!
+ Appends \a categories to axis. A maximum of the axis will be changed to last category in \a categories.
+ If there were no categories previously defined, minimum of axis will be also changed to first category in \a categories.
+ A category has to be valid QStrings and can not be duplicated. Duplicated categories will not be appended.
+*/
+void QBarCategoryAxis::append(const QStringList &categories)
+{
+ if (categories.isEmpty())
+ return;
+
+ Q_D(QBarCategoryAxis);
+
+ int count = d->m_categories.count();
+
+ foreach(QString category, categories) {
+ if (!d->m_categories.contains(category) && !category.isNull()) {
+ d->m_categories.append(category);
+ }
+ }
+
+ if (d->m_categories.count() == count)
+ return;
+
+ if (count == 0)
+ setRange(d->m_categories.first(), d->m_categories.last());
+ else
+ setRange(d->m_minCategory, d->m_categories.last());
+
+ emit categoriesChanged();
+ emit countChanged();
+}
+
+/*!
+ Appends \a category to axis. A maximum of the axis will be changed to last \a category.
+ If there were no categories previously defined, minimum of axis will be also changed to \a category.
+ A \a category has to be valid QStrings and can not be duplicated. Duplicated categories will not be appended.
+*/
+void QBarCategoryAxis::append(const QString &category)
+{
+ Q_D(QBarCategoryAxis);
+
+ int count = d->m_categories.count();
+
+ if (!d->m_categories.contains(category) && !category.isNull())
+ d->m_categories.append(category);
+
+ if (d->m_categories.count() == count)
+ return;
+
+ if (count == 0)
+ setRange(d->m_categories.last(), d->m_categories.last());
+ else
+ setRange(d->m_minCategory, d->m_categories.last());
+
+ emit categoriesChanged();
+ emit countChanged();
+}
+
+/*!
+ Removes \a category from axis. Removing category which is currently maximum or minimum
+ will affect the axis range.
+*/
+void QBarCategoryAxis::remove(const QString &category)
+{
+ Q_D(QBarCategoryAxis);
+
+ if (d->m_categories.contains(category)) {
+ d->m_categories.removeAt(d->m_categories.indexOf(category));
+ if (!d->m_categories.isEmpty()) {
+ if (d->m_minCategory == category) {
+ setRange(d->m_categories.first(), d->m_maxCategory);
+ } else if (d->m_maxCategory == category) {
+ setRange(d->m_minCategory, d->m_categories.last());
+ } else {
+ d->updateCategoryDomain();
+ }
+ } else {
+ setRange(QString::null, QString::null);
+ }
+ emit categoriesChanged();
+ emit countChanged();
+ }
+}
+
+/*!
+ Inserts \a category to axis at \a index. A \a category has to be valid QStrings and can not be duplicated.
+ If \a category is prepended or appended to categories, minimum and maximum of axis is updated accordingly.
+*/
+void QBarCategoryAxis::insert(int index, const QString &category)
+{
+ Q_D(QBarCategoryAxis);
+
+ int count = d->m_categories.count();
+
+ if (!d->m_categories.contains(category) && !category.isNull())
+ d->m_categories.insert(index, category);
+
+ if (d->m_categories.count() == count)
+ return;
+
+ if (count == 0) {
+ setRange(d->m_categories.first(), d->m_categories.first());
+ } else if (index == 0) {
+ setRange(d->m_categories.first(), d->m_maxCategory);
+ } else if (index == count) {
+ setRange(d->m_minCategory, d->m_categories.last());
+ } else {
+ d->updateCategoryDomain();
+ }
+
+ emit categoriesChanged();
+ emit countChanged();
+}
+
+/*!
+ Replaces \a oldCategory with \a newCategory. If \a oldCategory does not exist on the axis nothing is done.
+ A \a newCategory has to be valid QStrings and can not be duplicated. In case of replacing minimum or maximum category,
+ minimum and maximum of axis is updated accordingly.
+*/
+void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCategory)
+{
+ Q_D(QBarCategoryAxis);
+
+ int pos = d->m_categories.indexOf(oldCategory);
+
+ if (pos != -1 && !d->m_categories.contains(newCategory) && !newCategory.isNull()) {
+ d->m_categories.replace(pos, newCategory);
+ if (d->m_minCategory == oldCategory)
+ setRange(newCategory, d->m_maxCategory);
+ else if (d->m_maxCategory == oldCategory)
+ setRange(d->m_minCategory, newCategory);
+
+ emit categoriesChanged();
+ emit countChanged();
+ }
+}
+
+/*!
+ Removes all categories. Sets the maximum and minimum of the axis's range to QString::null.
+ */
+void QBarCategoryAxis::clear()
+{
+ Q_D(QBarCategoryAxis);
+ d->m_categories.clear();
+ setRange(QString::null, QString::null);
+ emit categoriesChanged();
+ emit countChanged();
+}
+
+/*!
+ Set \a categories and discards the old ones, range of axis is adjusted to match first and last category in \a categories.
+ A category has to be valid QStrings and can not be duplicated.
+*/
+void QBarCategoryAxis::setCategories(const QStringList &categories)
+{
+ Q_D(QBarCategoryAxis);
+ d->m_categories.clear();
+ d->m_minCategory = QString::null;
+ d->m_maxCategory = QString::null;
+ d->m_min = 0;
+ d->m_max = 0;
+ d->m_count = 0;
+ append(categories);
+}
+
+/*!
+ Returns categories
+*/
+QStringList QBarCategoryAxis::categories()
+{
+ Q_D(QBarCategoryAxis);
+ return d->m_categories;
+}
+
+/*!
+ Returns number of categories.
+ */
+int QBarCategoryAxis::count() const
+{
+ Q_D(const QBarCategoryAxis);
+ return d->m_categories.count();
+}
+
+/*!
+ Returns category at \a index. Index must be valid.
+*/
+QString QBarCategoryAxis::at(int index) const
+{
+ Q_D(const QBarCategoryAxis);
+ return d->m_categories.at(index);
+}
+
+/*!
+ Sets minimum category to \a min.
+*/
+void QBarCategoryAxis::setMin(const QString &min)
+{
+ Q_D(QBarCategoryAxis);
+ d->setRange(min, d->m_maxCategory);
+}
+
+/*!
+ Returns minimum category.
+*/
+QString QBarCategoryAxis::min() const
+{
+ Q_D(const QBarCategoryAxis);
+ return d->m_minCategory;
+}
+
+/*!
+ Sets maximum category to \a max.
+*/
+void QBarCategoryAxis::setMax(const QString &max)
+{
+ Q_D(QBarCategoryAxis);
+ d->setRange(d->m_minCategory, max);
+}
+
+/*!
+ Returns maximum category
+*/
+QString QBarCategoryAxis::max() const
+{
+ Q_D(const QBarCategoryAxis);
+ return d->m_maxCategory;
+}
+
+/*!
+ Sets range from \a minCategory to \a maxCategory
+*/
+void QBarCategoryAxis::setRange(const QString &minCategory, const QString &maxCategory)
+{
+ Q_D(QBarCategoryAxis);
+ d->setRange(minCategory,maxCategory);
+}
+
+/*!
+ Returns the type of the axis
+*/
+QAbstractAxis::AxisType QBarCategoryAxis::type() const
+{
+ return AxisTypeBarCategory;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QBarCategoryAxisPrivate::QBarCategoryAxisPrivate(QBarCategoryAxis *q)
+ : QAbstractAxisPrivate(q),
+ m_min(0.0),
+ m_max(0.0),
+ m_count(0)
+{
+
+}
+
+QBarCategoryAxisPrivate::~QBarCategoryAxisPrivate()
+{
+
+}
+
+void QBarCategoryAxisPrivate::setMin(const QVariant &min)
+{
+ setRange(min, m_maxCategory);
+}
+
+void QBarCategoryAxisPrivate::setMax(const QVariant &max)
+{
+ setRange(m_minCategory, max);
+}
+
+void QBarCategoryAxisPrivate::setRange(const QVariant &min, const QVariant &max)
+{
+ QString value1 = min.toString();
+ QString value2 = max.toString();
+ setRange(value1, value2);
+}
+
+void QBarCategoryAxisPrivate::setRange(qreal min, qreal max)
+{
+ Q_Q(QBarCategoryAxis);
+
+ bool categoryChanged = false;
+ bool changed = false;
+
+ if (min > max)
+ return;
+
+ if (!qFuzzyIsNull(m_min - min)) {
+ m_min = min;
+ changed = true;
+
+ int imin = m_min + 0.5;
+ if (imin >= 0 && imin < m_categories.count()) {
+ QString minCategory = m_categories.at(imin);
+ if (m_minCategory != minCategory && !minCategory.isEmpty()) {
+ m_minCategory = minCategory;
+ categoryChanged = true;
+ emit q->minChanged(minCategory);
+ }
+ }
+
+ }
+
+ if (!qFuzzyIsNull(m_max - max)) {
+ m_max = max;
+ changed = true;
+
+ int imax = m_max - 0.5;
+ if (imax >= 0 && imax < m_categories.count()) {
+ QString maxCategory = m_categories.at(imax);
+ if (m_maxCategory != maxCategory && !maxCategory.isEmpty()) {
+ m_maxCategory = maxCategory;
+ categoryChanged = true;
+ emit q->maxChanged(maxCategory);
+ }
+ }
+ }
+
+ if (categoryChanged){
+ emit q->rangeChanged(m_minCategory, m_maxCategory);
+ }
+
+ if (changed) {
+ emit rangeChanged(m_min,m_max);
+ }
+}
+
+void QBarCategoryAxisPrivate::setRange(const QString &minCategory, const QString &maxCategory)
+{
+ Q_Q(QBarCategoryAxis);
+ bool changed = false;
+
+ //special case in case or clearing all categories
+ if (minCategory.isNull() && maxCategory.isNull()) {
+ m_minCategory = minCategory;
+ m_maxCategory = maxCategory;
+ m_min = 0;
+ m_max = 0;
+ m_count = 0;
+ emit q->minChanged(minCategory);
+ emit q->maxChanged(maxCategory);
+ emit q->rangeChanged(m_minCategory, m_maxCategory);
+ emit rangeChanged(m_min,m_max);
+ return;
+ }
+
+ if (m_categories.indexOf(maxCategory) < m_categories.indexOf(minCategory))
+ return;
+
+ if (!minCategory.isNull() && (m_minCategory != minCategory || m_minCategory.isNull())
+ && m_categories.contains(minCategory)) {
+ m_minCategory = minCategory;
+ m_min = m_categories.indexOf(m_minCategory) - 0.5;
+ changed = true;
+ emit q->minChanged(minCategory);
+ }
+
+ if (!maxCategory.isNull() && (m_maxCategory != maxCategory || m_maxCategory.isNull())
+ && m_categories.contains(maxCategory)) {
+ m_maxCategory = maxCategory;
+ m_max = m_categories.indexOf(m_maxCategory) + 0.5;
+ changed = true;
+ emit q->maxChanged(maxCategory);
+ }
+
+ if (changed) {
+ m_count = m_max - m_min;
+ emit q->rangeChanged(m_minCategory, m_maxCategory);
+ emit rangeChanged(m_min,m_max);
+ }
+}
+
+void QBarCategoryAxisPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QBarCategoryAxis);
+ ChartAxisElement* axis(0);
+ if (orientation() == Qt::Vertical)
+ axis = new ChartBarCategoryAxisY(q,parent);
+ if (orientation() == Qt::Horizontal)
+ axis = new ChartBarCategoryAxisX(q,parent);
+
+ m_item.reset(axis);
+ QAbstractAxisPrivate::initializeGraphics(parent);
+}
+
+void QBarCategoryAxisPrivate::updateCategoryDomain()
+{
+ bool changed = false;
+
+ qreal tmpMin = m_categories.indexOf(m_minCategory) - 0.5;
+ if (!qFuzzyIsNull(m_min - tmpMin)) {
+ m_min = tmpMin;
+ changed = true;
+ }
+ qreal tmpMax = m_categories.indexOf(m_maxCategory) + 0.5;
+ if (!qFuzzyIsNull(m_max - tmpMax)) {
+ m_max = tmpMax;
+ changed = true;
+ }
+ m_count = m_max - m_min;
+
+ if (changed)
+ emit rangeChanged(m_min,m_max);
+}
+
+
+void QBarCategoryAxisPrivate::initializeDomain(AbstractDomain *domain)
+{
+ Q_Q(QBarCategoryAxis);
+ if (m_max == m_min) {
+ int min;
+ int max;
+ if (orientation() == Qt::Vertical) {
+ min = domain->minY() + 0.5;
+ max = domain->maxY() - 0.5;
+ } else {
+ min = domain->minX() + 0.5;
+ max = domain->maxX() - 0.5;
+ }
+
+ if (min > 0 && min < m_categories.count() && max > 0 && max < m_categories.count())
+ q->setRange(m_categories.at(min), m_categories.at(max));
+ } else {
+ if (orientation() == Qt::Vertical)
+ domain->setRangeY(m_min, m_max);
+ else
+ domain->setRangeX(m_min, m_max);
+ }
+}
+
+#include "moc_qbarcategoryaxis.cpp"
+#include "moc_qbarcategoryaxis_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/barcategoryaxis/qbarcategoryaxis.h b/src/charts/axis/barcategoryaxis/qbarcategoryaxis.h
new file mode 100644
index 00000000..55a2430f
--- /dev/null
+++ b/src/charts/axis/barcategoryaxis/qbarcategoryaxis.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBARCATEGORYAXIS_H
+#define QBARCATEGORYAXIS_H
+
+#include <QtCharts/qabstractaxis.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarCategoryAxisPrivate;
+
+class QT_CHARTS_EXPORT QBarCategoryAxis : public QAbstractAxis
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList categories READ categories WRITE setCategories NOTIFY categoriesChanged)
+ Q_PROPERTY(QString min READ min WRITE setMin NOTIFY minChanged)
+ Q_PROPERTY(QString max READ max WRITE setMax NOTIFY maxChanged)
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+
+public:
+ explicit QBarCategoryAxis(QObject *parent = 0);
+ ~QBarCategoryAxis();
+
+protected:
+ QBarCategoryAxis(QBarCategoryAxisPrivate &d, QObject *parent = 0);
+
+public:
+ AxisType type() const;
+ void append(const QStringList &categories);
+ void append(const QString &category);
+ void remove(const QString &category);
+ void insert(int index, const QString &category);
+ void replace(const QString &oldCategory, const QString &newCategory);
+ Q_INVOKABLE void clear();
+ void setCategories(const QStringList &categories);
+ QStringList categories();
+ int count() const;
+ QString at(int index) const;
+
+ //range handling
+ void setMin(const QString &minCategory);
+ QString min() const;
+ void setMax(const QString &maxCategory);
+ QString max() const;
+ void setRange(const QString &minCategory, const QString &maxCategory);
+
+Q_SIGNALS:
+ void categoriesChanged();
+ void minChanged(const QString &min);
+ void maxChanged(const QString &max);
+ void rangeChanged(const QString &min, const QString &max);
+ void countChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QBarCategoryAxis)
+ Q_DISABLE_COPY(QBarCategoryAxis)
+ friend class ChartBarCategoryAxisX;
+ friend class ChartBarCategoryAxisY;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARCATEGORYAXIS_H
diff --git a/src/charts/axis/barcategoryaxis/qbarcategoryaxis_p.h b/src/charts/axis/barcategoryaxis/qbarcategoryaxis_p.h
new file mode 100644
index 00000000..8ebc5a4c
--- /dev/null
+++ b/src/charts/axis/barcategoryaxis/qbarcategoryaxis_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBARCATEGORYAXIS_P_H
+#define QBARCATEGORYAXIS_P_H
+
+#include <qbarcategoryaxis.h>
+#include "qabstractaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class AbstractDomain;
+
+class QBarCategoryAxisPrivate : public QAbstractAxisPrivate
+{
+ Q_OBJECT
+
+public:
+ QBarCategoryAxisPrivate(QBarCategoryAxis *q);
+ ~QBarCategoryAxisPrivate();
+
+public:
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeDomain(AbstractDomain *domain);
+ void updateCategoryDomain();
+
+ //interface for manipulating range form base class
+ void setRange(const QVariant &min, const QVariant &max);
+ void setMin(const QVariant &min);
+ void setMax(const QVariant &max);
+
+ //interface manipulating range form domain
+ qreal min() { return m_min; }
+ qreal max() { return m_max; }
+ void setRange(qreal min,qreal max);
+
+private:
+ //range handling
+ void setRange(const QString &minCategory, const QString &maxCategory);
+
+private:
+ QStringList m_categories;
+ QString m_minCategory;
+ QString m_maxCategory;
+ qreal m_min;
+ qreal m_max;
+ int m_count;
+
+private:
+ Q_DECLARE_PUBLIC(QBarCategoryAxis);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARCATEGORYAXIS_P_H
diff --git a/src/charts/axis/cartesianchartaxis.cpp b/src/charts/axis/cartesianchartaxis.cpp
new file mode 100644
index 00000000..d067921d
--- /dev/null
+++ b/src/charts/axis/cartesianchartaxis.cpp
@@ -0,0 +1,198 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cartesianchartaxis_p.h"
+#include "qabstractaxis.h"
+#include "qabstractaxis_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include "abstractdomain_p.h"
+#include "linearrowitem_p.h"
+#include <QValueAxis>
+#include <QLogValueAxis>
+#include <QGraphicsLayout>
+#include <QTextDocument>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+CartesianChartAxis::CartesianChartAxis(QAbstractAxis *axis, QGraphicsItem *item , bool intervalAxis)
+ : ChartAxisElement(axis, item, intervalAxis)
+{
+ Q_ASSERT(item);
+}
+
+
+CartesianChartAxis::~CartesianChartAxis()
+{
+}
+
+void CartesianChartAxis::createItems(int count)
+{
+ if (arrowItems().size() == 0) {
+ QGraphicsLineItem *arrow = new LineArrowItem(this, this);
+ arrow->setPen(axis()->linePen());
+ arrowGroup()->addToGroup(arrow);
+ }
+
+ if (intervalAxis() && gridItems().size() == 0) {
+ for (int i = 0 ; i < 2 ; i ++){
+ QGraphicsLineItem *item = new QGraphicsLineItem(this);
+ item->setPen(axis()->gridLinePen());
+ gridGroup()->addToGroup(item);
+ }
+ }
+
+ QGraphicsTextItem *title = titleItem();
+ title->setFont(axis()->titleFont());
+ title->setDefaultTextColor(axis()->titleBrush().color());
+ title->setHtml(axis()->titleText());
+
+ for (int i = 0; i < count; ++i) {
+ QGraphicsLineItem *arrow = new QGraphicsLineItem(this);
+ QGraphicsLineItem *grid = new QGraphicsLineItem(this);
+ QGraphicsTextItem *label = new QGraphicsTextItem(this);
+ label->document()->setDocumentMargin(ChartPresenter::textMargin());
+ arrow->setPen(axis()->linePen());
+ grid->setPen(axis()->gridLinePen());
+ label->setFont(axis()->labelsFont());
+ label->setDefaultTextColor(axis()->labelsBrush().color());
+ label->setRotation(axis()->labelsAngle());
+ arrowGroup()->addToGroup(arrow);
+ gridGroup()->addToGroup(grid);
+ labelGroup()->addToGroup(label);
+
+ if ((gridItems().size()) % 2 && gridItems().size() > 2) {
+ QGraphicsRectItem* shades = new QGraphicsRectItem(this);
+ shades->setPen(axis()->shadesPen());
+ shades->setBrush(axis()->shadesBrush());
+ shadeGroup()->addToGroup(shades);
+ }
+ }
+
+}
+
+void CartesianChartAxis::deleteItems(int count)
+{
+ QList<QGraphicsItem *> lines = gridItems();
+ QList<QGraphicsItem *> labels = labelItems();
+ QList<QGraphicsItem *> shades = shadeItems();
+ QList<QGraphicsItem *> axis = arrowItems();
+
+ for (int i = 0; i < count; ++i) {
+ if (lines.size() % 2 && lines.size() > 1)
+ delete(shades.takeLast());
+ delete(lines.takeLast());
+ delete(labels.takeLast());
+ delete(axis.takeLast());
+ }
+}
+
+void CartesianChartAxis::updateLayout(QVector<qreal> &layout)
+{
+ int diff = ChartAxisElement::layout().size() - layout.size();
+
+ if (diff > 0)
+ deleteItems(diff);
+ else if (diff < 0)
+ createItems(-diff);
+
+ if (animation()) {
+ switch (presenter()->state()) {
+ case ChartPresenter::ZoomInState:
+ animation()->setAnimationType(AxisAnimation::ZoomInAnimation);
+ animation()->setAnimationPoint(presenter()->statePoint());
+ break;
+ case ChartPresenter::ZoomOutState:
+ animation()->setAnimationType(AxisAnimation::ZoomOutAnimation);
+ animation()->setAnimationPoint(presenter()->statePoint());
+ break;
+ case ChartPresenter::ScrollUpState:
+ case ChartPresenter::ScrollLeftState:
+ animation()->setAnimationType(AxisAnimation::MoveBackwordAnimation);
+ break;
+ case ChartPresenter::ScrollDownState:
+ case ChartPresenter::ScrollRightState:
+ animation()->setAnimationType(AxisAnimation::MoveForwardAnimation);
+ break;
+ case ChartPresenter::ShowState:
+ animation()->setAnimationType(AxisAnimation::DefaultAnimation);
+ break;
+ }
+ animation()->setValues(ChartAxisElement::layout(), layout);
+ presenter()->startAnimation(animation());
+ } else {
+ setLayout(layout);
+ updateGeometry();
+ }
+}
+
+bool CartesianChartAxis::isEmpty()
+{
+ return axisGeometry().isEmpty()
+ || gridGeometry().isEmpty()
+ || qFuzzyCompare(min(), max());
+}
+
+void CartesianChartAxis::setGeometry(const QRectF &axis, const QRectF &grid)
+{
+ m_gridRect = grid;
+ setAxisGeometry(axis);
+
+ if (isEmpty())
+ return;
+
+ QVector<qreal> layout = calculateLayout();
+ updateLayout(layout);
+}
+
+QSizeF CartesianChartAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(which);
+ Q_UNUSED(constraint);
+ return QSizeF();
+}
+
+void CartesianChartAxis::handleArrowPenChanged(const QPen &pen)
+{
+ foreach (QGraphicsItem *item, arrowItems())
+ static_cast<QGraphicsLineItem *>(item)->setPen(pen);
+}
+
+void CartesianChartAxis::handleGridPenChanged(const QPen &pen)
+{
+ foreach (QGraphicsItem *item, gridItems())
+ static_cast<QGraphicsLineItem *>(item)->setPen(pen);
+}
+
+void CartesianChartAxis::handleShadesBrushChanged(const QBrush &brush)
+{
+ foreach (QGraphicsItem *item, shadeItems())
+ static_cast<QGraphicsRectItem *>(item)->setBrush(brush);
+}
+
+void CartesianChartAxis::handleShadesPenChanged(const QPen &pen)
+{
+ foreach (QGraphicsItem *item, shadeItems())
+ static_cast<QGraphicsRectItem *>(item)->setPen(pen);
+}
+
+#include "moc_cartesianchartaxis_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/cartesianchartaxis_p.h b/src/charts/axis/cartesianchartaxis_p.h
new file mode 100644
index 00000000..c0c2252b
--- /dev/null
+++ b/src/charts/axis/cartesianchartaxis_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CARTESIANCHARTAXIS_H
+#define CARTESIANCHARTAXIS_H
+
+#include "qchartglobal.h"
+#include "chartaxiselement_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractAxis;
+
+class CartesianChartAxis : public ChartAxisElement
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsLayoutItem)
+public:
+
+ CartesianChartAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
+ ~CartesianChartAxis();
+
+ void setGeometry(const QRectF &axis, const QRectF &grid);
+ QRectF gridGeometry() const { return m_gridRect; }
+ bool isEmpty();
+
+ virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+
+protected:
+ void setGeometry(const QRectF &size) { Q_UNUSED(size);}
+ virtual void updateGeometry() = 0;
+ void updateLayout(QVector<qreal> &layout);
+
+public Q_SLOTS:
+ virtual void handleArrowPenChanged(const QPen &pen);
+ virtual void handleGridPenChanged(const QPen &pen);
+ virtual void handleShadesBrushChanged(const QBrush &brush);
+ virtual void handleShadesPenChanged(const QPen &pen);
+
+private:
+ void createItems(int count);
+ void deleteItems(int count);
+
+private:
+ QRectF m_gridRect;
+
+ friend class AxisAnimation;
+ friend class LineArrowItem;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CARTESIANCHARTAXIS_H */
diff --git a/src/charts/axis/categoryaxis/chartcategoryaxisx.cpp b/src/charts/axis/categoryaxis/chartcategoryaxisx.cpp
new file mode 100644
index 00000000..2141f353
--- /dev/null
+++ b/src/charts/axis/categoryaxis/chartcategoryaxisx.cpp
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartcategoryaxisx_p.h"
+#include "qcategoryaxis.h"
+#include "qabstractaxis.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include <QGraphicsLayout>
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartCategoryAxisX::ChartCategoryAxisX(QCategoryAxis *axis, QGraphicsItem* item)
+ : HorizontalAxis(axis, item, true),
+ m_axis(axis)
+{
+ QObject::connect(axis, SIGNAL(categoriesChanged()), this, SLOT(handleCategoriesChanged()));
+}
+
+ChartCategoryAxisX::~ChartCategoryAxisX()
+{
+}
+
+QVector<qreal> ChartCategoryAxisX::calculateLayout() const
+{
+ int tickCount = m_axis->categoriesLabels().count() + 1;
+ QVector<qreal> points;
+
+ if (tickCount < 2)
+ return points;
+
+ const QRectF &gridRect = gridGeometry();
+ qreal range = max() - min();
+ if (range > 0) {
+ points.resize(tickCount);
+ qreal scale = gridRect.width() / range;
+ for (int i = 0; i < tickCount; ++i) {
+ if (i < tickCount - 1) {
+ qreal x = (m_axis->startValue(m_axis->categoriesLabels().at(i)) - min()) * scale + gridRect.left();
+ points[i] = x;
+ } else {
+ qreal x = (m_axis->endValue(m_axis->categoriesLabels().at(i - 1)) - min()) * scale + gridRect.left();
+ points[i] = x;
+ }
+ }
+ }
+
+ return points;
+}
+
+void ChartCategoryAxisX::updateGeometry()
+{
+ setLabels(m_axis->categoriesLabels() << QString());
+ HorizontalAxis::updateGeometry();
+}
+
+QSizeF ChartCategoryAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+ QSizeF base = HorizontalAxis::sizeHint(which, constraint);
+ QStringList ticksList = m_axis->categoriesLabels();
+ qreal width = 0; // Width is irrelevant for X axes with interval labels
+ qreal height = 0;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ height = boundingRect.height() + labelPadding() + base.height() + 1.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize: {
+ qreal labelHeight = 0.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelHeight = qMax(rect.height(), labelHeight);
+ }
+ height = labelHeight + labelPadding() + base.height() + 1.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+
+ return sh;
+}
+
+void ChartCategoryAxisX::handleCategoriesChanged()
+{
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+}
+
+#include "moc_chartcategoryaxisx_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/categoryaxis/chartcategoryaxisx_p.h b/src/charts/axis/categoryaxis/chartcategoryaxisx_p.h
new file mode 100644
index 00000000..e526b01a
--- /dev/null
+++ b/src/charts/axis/categoryaxis/chartcategoryaxisx_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTCATEGORYAXISX_H
+#define CHARTCATEGORYAXISX_H
+
+#include "horizontalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QCategoryAxis;
+
+class ChartCategoryAxisX : public HorizontalAxis
+{
+ Q_OBJECT
+public:
+ ChartCategoryAxisX(QCategoryAxis *axis, QGraphicsItem* item = 0);
+ ~ChartCategoryAxisX();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+
+public Q_SLOTS:
+ void handleCategoriesChanged();
+
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+
+private:
+ QCategoryAxis *m_axis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTCATEGORYAXISX_H */
diff --git a/src/charts/axis/categoryaxis/chartcategoryaxisy.cpp b/src/charts/axis/categoryaxis/chartcategoryaxisy.cpp
new file mode 100644
index 00000000..7d5ba103
--- /dev/null
+++ b/src/charts/axis/categoryaxis/chartcategoryaxisy.cpp
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartcategoryaxisy_p.h"
+#include "qcategoryaxis.h"
+#include "qabstractaxis.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include <QGraphicsLayout>
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartCategoryAxisY::ChartCategoryAxisY(QCategoryAxis *axis, QGraphicsItem* item)
+ : VerticalAxis(axis, item, true),
+ m_axis(axis)
+{
+ QObject::connect(axis, SIGNAL(categoriesChanged()), this, SLOT(handleCategoriesChanged()));
+}
+
+ChartCategoryAxisY::~ChartCategoryAxisY()
+{
+}
+
+QVector<qreal> ChartCategoryAxisY::calculateLayout() const
+{
+ int tickCount = m_axis->categoriesLabels().count() + 1;
+ QVector<qreal> points;
+
+ if (tickCount < 2)
+ return points;
+
+ const QRectF &gridRect = gridGeometry();
+ qreal range = max() - min();
+ if (range > 0) {
+ points.resize(tickCount);
+ qreal scale = gridRect.height() / range;
+ for (int i = 0; i < tickCount; ++i) {
+ if (i < tickCount - 1) {
+ qreal y = -(m_axis->startValue(m_axis->categoriesLabels().at(i)) - min()) * scale + gridRect.bottom();
+ points[i] = y;
+ } else {
+ qreal y = -(m_axis->endValue(m_axis->categoriesLabels().at(i - 1)) - min()) * scale + gridRect.bottom();
+ points[i] = y;
+ }
+ }
+ }
+
+ return points;
+}
+
+void ChartCategoryAxisY::updateGeometry()
+{
+ setLabels(m_axis->categoriesLabels() << QString());
+ VerticalAxis::updateGeometry();
+}
+
+QSizeF ChartCategoryAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+ QSizeF base = VerticalAxis::sizeHint(which, constraint);
+ QStringList ticksList = m_axis->categoriesLabels();
+ qreal width = 0;
+ qreal height = 0; // Height is irrelevant for Y axes with interval labels
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ width = boundingRect.width() + labelPadding() + base.width() + 1.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize: {
+ qreal labelWidth = 0.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelWidth = qMax(rect.width(), labelWidth);
+ }
+ width = labelWidth + labelPadding() + base.width() + 1.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+ return sh;
+}
+
+void ChartCategoryAxisY::handleCategoriesChanged()
+{
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+}
+
+#include "moc_chartcategoryaxisy_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/categoryaxis/chartcategoryaxisy_p.h b/src/charts/axis/categoryaxis/chartcategoryaxisy_p.h
new file mode 100644
index 00000000..e416e4c0
--- /dev/null
+++ b/src/charts/axis/categoryaxis/chartcategoryaxisy_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTCATEGORYAXISY_H
+#define CHARTCATEGORYAXISY_H
+
+#include "verticalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QCategoryAxis;
+
+class ChartCategoryAxisY : public VerticalAxis
+{
+ Q_OBJECT
+public:
+ ChartCategoryAxisY(QCategoryAxis *axis, QGraphicsItem* item = 0);
+ ~ChartCategoryAxisY();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+
+public Q_SLOTS:
+ void handleCategoriesChanged();
+
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+
+private:
+ QCategoryAxis *m_axis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTCATEGORYAXISY_H */
diff --git a/src/charts/axis/categoryaxis/polarchartcategoryaxisangular.cpp b/src/charts/axis/categoryaxis/polarchartcategoryaxisangular.cpp
new file mode 100644
index 00000000..8c43dd32
--- /dev/null
+++ b/src/charts/axis/categoryaxis/polarchartcategoryaxisangular.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartcategoryaxisangular_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include "qcategoryaxis.h"
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartCategoryAxisAngular::PolarChartCategoryAxisAngular(QCategoryAxis *axis, QGraphicsItem *item)
+ : PolarChartAxisAngular(axis, item, true)
+{
+ QObject::connect(axis, SIGNAL(categoriesChanged()), this, SLOT(handleCategoriesChanged()));
+}
+
+PolarChartCategoryAxisAngular::~PolarChartCategoryAxisAngular()
+{
+}
+
+QVector<qreal> PolarChartCategoryAxisAngular::calculateLayout() const
+{
+ QCategoryAxis *catAxis = static_cast<QCategoryAxis *>(axis());
+ int tickCount = catAxis->categoriesLabels().count() + 1;
+ QVector<qreal> points;
+
+ if (tickCount < 2)
+ return points;
+
+ qreal range = max() - min();
+ if (range > 0) {
+ points.resize(tickCount);
+ qreal scale = 360.0 / range;
+ qreal angle;
+ for (int i = 0; i < tickCount; ++i) {
+ if (i < tickCount - 1)
+ angle = (catAxis->startValue(catAxis->categoriesLabels().at(i)) - min()) * scale;
+ else
+ angle = (catAxis->endValue(catAxis->categoriesLabels().at(i - 1)) - min()) * scale;
+ points[i] = angle;
+ }
+ }
+
+ return points;
+}
+
+void PolarChartCategoryAxisAngular::createAxisLabels(const QVector<qreal> &layout)
+{
+ Q_UNUSED(layout);
+ setLabels(static_cast<QCategoryAxis *>(axis())->categoriesLabels() << QString());
+}
+
+void PolarChartCategoryAxisAngular::handleCategoriesChanged()
+{
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+}
+
+
+#include "moc_polarchartcategoryaxisangular_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/categoryaxis/polarchartcategoryaxisangular_p.h b/src/charts/axis/categoryaxis/polarchartcategoryaxisangular_p.h
new file mode 100644
index 00000000..0432fc11
--- /dev/null
+++ b/src/charts/axis/categoryaxis/polarchartcategoryaxisangular_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTCATEGORYAXISANGULAR_P_H
+#define POLARCHARTCATEGORYAXISANGULAR_P_H
+
+#include "polarchartaxisangular_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QCategoryAxis;
+
+class PolarChartCategoryAxisAngular : public PolarChartAxisAngular
+{
+ Q_OBJECT
+
+public:
+ PolarChartCategoryAxisAngular(QCategoryAxis *axis, QGraphicsItem *item);
+ ~PolarChartCategoryAxisAngular();
+
+ virtual QVector<qreal> calculateLayout() const;
+ virtual void createAxisLabels(const QVector<qreal> &layout);
+
+public Q_SLOTS:
+ void handleCategoriesChanged();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTCATEGORYAXISANGULAR_P_H
diff --git a/src/charts/axis/categoryaxis/polarchartcategoryaxisradial.cpp b/src/charts/axis/categoryaxis/polarchartcategoryaxisradial.cpp
new file mode 100644
index 00000000..60b77f0c
--- /dev/null
+++ b/src/charts/axis/categoryaxis/polarchartcategoryaxisradial.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartcategoryaxisradial_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include "qcategoryaxis.h"
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartCategoryAxisRadial::PolarChartCategoryAxisRadial(QCategoryAxis *axis, QGraphicsItem *item)
+ : PolarChartAxisRadial(axis, item, true)
+{
+ QObject::connect(axis, SIGNAL(categoriesChanged()), this, SLOT(handleCategoriesChanged()));
+}
+
+PolarChartCategoryAxisRadial::~PolarChartCategoryAxisRadial()
+{
+}
+
+QVector<qreal> PolarChartCategoryAxisRadial::calculateLayout() const
+{
+ QCategoryAxis *catAxis = static_cast<QCategoryAxis *>(axis());
+ int tickCount = catAxis->categoriesLabels().count() + 1;
+ QVector<qreal> points;
+
+ if (tickCount < 2)
+ return points;
+
+ qreal range = max() - min();
+ if (range > 0) {
+ points.resize(tickCount);
+ qreal scale = (axisGeometry().width() / 2) / range;
+ qreal angle;
+ for (int i = 0; i < tickCount; ++i) {
+ if (i < tickCount - 1)
+ angle = (catAxis->startValue(catAxis->categoriesLabels().at(i)) - min()) * scale;
+ else
+ angle = (catAxis->endValue(catAxis->categoriesLabels().at(i - 1)) - min()) * scale;
+ points[i] = angle;
+ }
+ }
+
+ return points;
+}
+
+void PolarChartCategoryAxisRadial::createAxisLabels(const QVector<qreal> &layout)
+{
+ Q_UNUSED(layout);
+ setLabels(static_cast<QCategoryAxis *>(axis())->categoriesLabels() << QString());
+}
+
+void PolarChartCategoryAxisRadial::handleCategoriesChanged()
+{
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+}
+
+#include "moc_polarchartcategoryaxisradial_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/categoryaxis/polarchartcategoryaxisradial_p.h b/src/charts/axis/categoryaxis/polarchartcategoryaxisradial_p.h
new file mode 100644
index 00000000..3186f5ec
--- /dev/null
+++ b/src/charts/axis/categoryaxis/polarchartcategoryaxisradial_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTCATEGORYAXISRADIAL_P_H
+#define POLARCHARTCATEGORYAXISRADIAL_P_H
+
+#include "polarchartaxisradial_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QCategoryAxis;
+
+class PolarChartCategoryAxisRadial : public PolarChartAxisRadial
+{
+ Q_OBJECT
+
+public:
+ PolarChartCategoryAxisRadial(QCategoryAxis *axis, QGraphicsItem *item);
+ ~PolarChartCategoryAxisRadial();
+
+ virtual QVector<qreal> calculateLayout() const;
+ virtual void createAxisLabels(const QVector<qreal> &layout);
+
+public Q_SLOTS:
+ void handleCategoriesChanged();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTCATEGORYAXISRADIAL_P_H
diff --git a/src/charts/axis/categoryaxis/qcategoryaxis.cpp b/src/charts/axis/categoryaxis/qcategoryaxis.cpp
new file mode 100644
index 00000000..d5b3d472
--- /dev/null
+++ b/src/charts/axis/categoryaxis/qcategoryaxis.cpp
@@ -0,0 +1,345 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcategoryaxis.h"
+#include "qcategoryaxis_p.h"
+#include "chartcategoryaxisx_p.h"
+#include "chartcategoryaxisy_p.h"
+#include "polarchartcategoryaxisangular_p.h"
+#include "polarchartcategoryaxisradial_p.h"
+#include "qchart.h"
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/*!
+ \class QCategoryAxis
+ \inmodule Qt Charts
+ \brief The QCategoryAxis class allows putting a named ranges on the axis.
+ \mainclass
+
+ This class can be used when the underlying data needs to be given extra meaning.
+ Unlike with the QBarCategoryAxis the QCategoryAxis allows the categories ranges widths to be specified freely.
+
+ Example code on how to use QCategoryAxis:
+ \table
+ \row
+ \li \br
+ \br
+ \code
+ QChartView *chartView = new QChartView;
+ QLineSeries *series = new QLineSeries;
+ // ...
+ chartView->chart()->addSeries(series);
+
+ QCategoryAxis *axisY = new QCategoryAxis;
+ axisY->setMin(0);
+ axisY->setMax(52);
+ axisY->setStartValue(15);
+ axisY->append("First", 20);
+ axisY->append("Second", 37);
+ axisY->append("Third", 52);
+ chartView->chart()->setAxisY(axisY, series);
+ \endcode
+ \li \br
+ \inlineimage api_category_axis.png
+ \endtable
+*/
+/*!
+ \qmltype CategoryAxis
+ \instantiates QCategoryAxis
+ \inqmlmodule QtCharts
+
+ \inherits AbstractAxis
+ \brief CategoryAxis allows putting a named ranges on the axis.
+
+ For example:
+ \table
+ \row
+ \li \br
+ \br
+ \br
+ \snippet qmlaxes/qml/qmlaxes/View3.qml 1
+ \li \inlineimage examples_qmlaxes3.png
+ \endtable
+*/
+
+/*!
+ \property QCategoryAxis::startValue
+ Defines the low end of the first category on the axis.
+*/
+/*!
+ \qmlproperty int CategoryAxis::startValue
+ Defines the low end of the first category on the axis.
+*/
+
+/*!
+ \property QCategoryAxis::count
+ The count of categories.
+*/
+/*!
+ \qmlproperty int CategoryAxis::count
+ The count of categories.
+*/
+
+/*!
+ \property QCategoryAxis::categoriesLabels
+ The category labels as a string list.
+*/
+/*!
+ \qmlproperty StringList CategoryAxis::categoriesLabels
+ The category labels as a list of strings.
+*/
+
+/*!
+ \fn void QCategoryAxis::categoriesChanged()
+ Axis emits signal when the categories of the axis have changed.
+*/
+
+
+/*!
+ Constructs an axis object which is a child of \a parent.
+*/
+QCategoryAxis::QCategoryAxis(QObject *parent):
+ QValueAxis(*new QCategoryAxisPrivate(this), parent)
+{
+}
+
+/*!
+ Destroys the object
+*/
+QCategoryAxis::~QCategoryAxis()
+{
+ Q_D(QCategoryAxis);
+ if (d->m_chart)
+ d->m_chart->removeAxis(this);
+}
+
+/*!
+ \internal
+*/
+QCategoryAxis::QCategoryAxis(QCategoryAxisPrivate &d, QObject *parent): QValueAxis(d, parent)
+{
+
+}
+
+/*!
+ \qmlmethod CategoryAxis::append(string label, real endValue)
+ Appends new category to the axis with an \a label. Category label has to be unique.
+ Parameter \a endValue specifies the high end limit of the category.
+ It has to be greater than the high end limit of the previous category.
+ Otherwise the method returns without adding a new category.
+*/
+/*!
+ Appends new category to the axis with an \a categoryLabel.
+ Category label has to be unique.
+ Parameter \a categoryEndValue specifies the high end limit of the category.
+ It has to be greater than the high end limit of the previous category.
+ Otherwise the method returns without adding a new category.
+*/
+void QCategoryAxis::append(const QString &categoryLabel, qreal categoryEndValue)
+{
+ Q_D(QCategoryAxis);
+
+ if (!d->m_categories.contains(categoryLabel)) {
+ if (d->m_categories.isEmpty()) {
+ Range range(d->m_categoryMinimum, categoryEndValue);
+ d->m_categoriesMap.insert(categoryLabel, range);
+ d->m_categories.append(categoryLabel);
+ emit categoriesChanged();
+ } else if (categoryEndValue > endValue(d->m_categories.last())) {
+ Range previousRange = d->m_categoriesMap.value(d->m_categories.last());
+ d->m_categoriesMap.insert(categoryLabel, Range(previousRange.second, categoryEndValue));
+ d->m_categories.append(categoryLabel);
+ emit categoriesChanged();
+ }
+ }
+}
+
+/*!
+ Sets \a min to be the low end limit of the first category on the axis.
+ If there is already some categories added to the axis then passed value must be lower than the high end value of the already defined first category range.
+ Otherwise nothing is done.
+*/
+void QCategoryAxis::setStartValue(qreal min)
+{
+ Q_D(QCategoryAxis);
+ if (d->m_categories.isEmpty()) {
+ d->m_categoryMinimum = min;
+ emit categoriesChanged();
+ } else {
+ Range range = d->m_categoriesMap.value(d->m_categories.first());
+ if (min < range.second) {
+ d->m_categoriesMap.insert(d->m_categories.first(), Range(min, range.second));
+ emit categoriesChanged();
+ }
+ }
+}
+
+/*!
+ Returns the low end limit of the category specified by an \a categoryLabel
+*/
+qreal QCategoryAxis::startValue(const QString &categoryLabel) const
+{
+ Q_D(const QCategoryAxis);
+ if (categoryLabel.isEmpty())
+ return d->m_categoryMinimum;
+ return d->m_categoriesMap.value(categoryLabel).first;
+}
+
+/*!
+ Returns the high end limit of the interval specified by an \a categoryLabel
+*/
+qreal QCategoryAxis::endValue(const QString &categoryLabel) const
+{
+ Q_D(const QCategoryAxis);
+ return d->m_categoriesMap.value(categoryLabel).second;
+}
+
+/*!
+ \qmlmethod CategoryAxis::remove(string label)
+ Removes a category specified by the \a label from the axis
+*/
+/*!
+ Removes an interval specified by the \a categoryLabel from the axis
+*/
+void QCategoryAxis::remove(const QString &categoryLabel)
+{
+ Q_D(QCategoryAxis);
+ int labelIndex = d->m_categories.indexOf(categoryLabel);
+
+ // check if such label exists
+ if (labelIndex != -1) {
+ d->m_categories.removeAt(labelIndex);
+ d->m_categoriesMap.remove(categoryLabel);
+
+ // the range of the interval that follows (if exists) needs to be updated
+ if (labelIndex < d->m_categories.count()) {
+ QString label = d->m_categories.at(labelIndex);
+ Range range = d->m_categoriesMap.value(label);
+
+ // set the range
+ if (labelIndex == 0) {
+ range.first = d->m_categoryMinimum;
+ d->m_categoriesMap.insert(label, range);
+ } else {
+ range.first = d->m_categoriesMap.value(d->m_categories.at(labelIndex - 1)).second;
+ d->m_categoriesMap.insert(label, range);
+ }
+ }
+ emit categoriesChanged();
+ }
+}
+
+/*!
+ \qmlmethod CategoryAxis::replace(string oldLabel, string newLabel)
+ Replaces \a oldLabel of an existing category with a \a newLabel.
+ If the old label does not exist the method returns without making any changes.
+*/
+/*!
+ Replaces \a oldLabel of an existing category with a \a newLabel
+ If the old label does not exist the method returns without making any changes.
+ */
+void QCategoryAxis::replaceLabel(const QString &oldLabel, const QString &newLabel)
+{
+ Q_D(QCategoryAxis);
+ int labelIndex = d->m_categories.indexOf(oldLabel);
+
+ // check if such label exists
+ if (labelIndex != -1) {
+ d->m_categories.replace(labelIndex, newLabel);
+ Range range = d->m_categoriesMap.value(oldLabel);
+ d->m_categoriesMap.remove(oldLabel);
+ d->m_categoriesMap.insert(newLabel, range);
+ emit categoriesChanged();
+ }
+}
+
+/*!
+ Returns the list of the intervals labels
+ */
+QStringList QCategoryAxis::categoriesLabels()
+{
+ Q_D(QCategoryAxis);
+ return d->m_categories;
+}
+
+/*!
+ Returns number of intervals.
+ */
+int QCategoryAxis::count() const
+{
+ Q_D(const QCategoryAxis);
+ return d->m_categories.count();
+}
+
+/*!
+ Returns the type of the axis
+*/
+QAbstractAxis::AxisType QCategoryAxis::type() const
+{
+ return QAbstractAxis::AxisTypeCategory;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QCategoryAxisPrivate::QCategoryAxisPrivate(QCategoryAxis *q)
+ : QValueAxisPrivate(q),
+ m_categoryMinimum(0)
+{
+
+}
+
+QCategoryAxisPrivate::~QCategoryAxisPrivate()
+{
+
+}
+
+int QCategoryAxisPrivate::ticksCount() const
+{
+ return m_categories.count() + 1;
+}
+
+void QCategoryAxisPrivate::initializeGraphics(QGraphicsItem *parent)
+{
+ Q_Q(QCategoryAxis);
+ ChartAxisElement *axis(0);
+ if (m_chart->chartType() == QChart::ChartTypeCartesian) {
+ if (orientation() == Qt::Vertical)
+ axis = new ChartCategoryAxisY(q,parent);
+ else if (orientation() == Qt::Horizontal)
+ axis = new ChartCategoryAxisX(q,parent);
+ }
+
+ if (m_chart->chartType() == QChart::ChartTypePolar) {
+ if (orientation() == Qt::Vertical)
+ axis = new PolarChartCategoryAxisRadial(q, parent);
+ if (orientation() == Qt::Horizontal)
+ axis = new PolarChartCategoryAxisAngular(q, parent);
+ }
+
+ m_item.reset(axis);
+ QAbstractAxisPrivate::initializeGraphics(parent);
+}
+
+#include "moc_qcategoryaxis.cpp"
+#include "moc_qcategoryaxis_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/categoryaxis/qcategoryaxis.h b/src/charts/axis/categoryaxis/qcategoryaxis.h
new file mode 100644
index 00000000..bd4b3d82
--- /dev/null
+++ b/src/charts/axis/categoryaxis/qcategoryaxis.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCATEGORYAXIS_H
+#define QCATEGORYAXIS_H
+
+#include <QtCharts/qabstractaxis.h>
+#include <QtCharts/qvalueaxis.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QCategoryAxisPrivate;
+
+class QT_CHARTS_EXPORT QCategoryAxis : public QValueAxis
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal startValue READ startValue WRITE setStartValue)
+ Q_PROPERTY(int count READ count)
+ Q_PROPERTY(QStringList categoriesLabels READ categoriesLabels)
+
+public:
+ explicit QCategoryAxis(QObject *parent = 0);
+ ~QCategoryAxis();
+
+protected:
+ QCategoryAxis(QCategoryAxisPrivate &d, QObject *parent = 0);
+
+public:
+ AxisType type() const;
+
+ void append(const QString &label, qreal categoryEndValue);
+ void remove(const QString &label);
+ void replaceLabel(const QString &oldLabel, const QString &newLabel);
+
+ qreal startValue(const QString &categoryLabel = QString()) const;
+ void setStartValue(qreal min);
+
+ qreal endValue(const QString &categoryLabel) const;
+
+ QStringList categoriesLabels();
+ int count() const;
+
+Q_SIGNALS:
+ void categoriesChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QCategoryAxis)
+ Q_DISABLE_COPY(QCategoryAxis)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QCATEGORYAXIS_H
diff --git a/src/charts/axis/categoryaxis/qcategoryaxis_p.h b/src/charts/axis/categoryaxis/qcategoryaxis_p.h
new file mode 100644
index 00000000..bc657521
--- /dev/null
+++ b/src/charts/axis/categoryaxis/qcategoryaxis_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QCATEGORYAXIS_P_H
+#define QCATEGORYAXIS_P_H
+
+#include <qcategoryaxis.h>
+#include "qvalueaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+typedef QPair<qreal, qreal> Range;
+
+class QCategoryAxisPrivate : public QValueAxisPrivate
+{
+ Q_OBJECT
+
+public:
+ QCategoryAxisPrivate(QCategoryAxis *q);
+ ~QCategoryAxisPrivate();
+
+ void initializeGraphics(QGraphicsItem* parent);
+ int ticksCount() const;
+
+private:
+ QMap<QString , Range> m_categoriesMap;
+ QStringList m_categories;
+ qreal m_categoryMinimum;
+
+private:
+ Q_DECLARE_PUBLIC(QCategoryAxis)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QCATEGORYAXIS_P_H
diff --git a/src/charts/axis/chartaxiselement.cpp b/src/charts/axis/chartaxiselement.cpp
new file mode 100644
index 00000000..b7a60d27
--- /dev/null
+++ b/src/charts/axis/chartaxiselement.cpp
@@ -0,0 +1,404 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartaxiselement_p.h"
+#include "qabstractaxis_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include <qmath.h>
+#include <QDateTime>
+#include <QTextDocument>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+static const char *labelFormatMatchString = "%[\\-\\+#\\s\\d\\.lhjztL]*([dicuoxfegXFEG])";
+static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.(\\d+)([defgiEG])(.*)$";
+static QRegExp *labelFormatMatcher = 0;
+static QRegExp *labelFormatMatcherLocalized = 0;
+class StaticLabelFormatMatcherDeleter
+{
+public:
+ StaticLabelFormatMatcherDeleter() {}
+ ~StaticLabelFormatMatcherDeleter() {
+ delete labelFormatMatcher;
+ delete labelFormatMatcherLocalized;
+ }
+};
+static StaticLabelFormatMatcherDeleter staticLabelFormatMatcherDeleter;
+
+ChartAxisElement::ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
+ : ChartElement(item),
+ m_axis(axis),
+ m_animation(0),
+ m_grid(new QGraphicsItemGroup(item)),
+ m_arrow(new QGraphicsItemGroup(item)),
+ m_shades(new QGraphicsItemGroup(item)),
+ m_labels(new QGraphicsItemGroup(item)),
+ m_title(new QGraphicsTextItem(item)),
+ m_intervalAxis(intervalAxis)
+
+{
+ //initial initialization
+ m_arrow->setHandlesChildEvents(false);
+ m_arrow->setZValue(ChartPresenter::AxisZValue);
+ m_labels->setZValue(ChartPresenter::AxisZValue);
+ m_shades->setZValue(ChartPresenter::ShadesZValue);
+ m_grid->setZValue(ChartPresenter::GridZValue);
+ m_title->setZValue(ChartPresenter::GridZValue);
+ m_title->document()->setDocumentMargin(ChartPresenter::textMargin());
+ handleVisibleChanged(axis->isVisible());
+ connectSlots();
+
+ setFlag(QGraphicsItem::ItemHasNoContents, true);
+}
+
+ChartAxisElement::~ChartAxisElement()
+{
+}
+
+void ChartAxisElement::connectSlots()
+{
+ QObject::connect(axis(), SIGNAL(visibleChanged(bool)), this, SLOT(handleVisibleChanged(bool)));
+ QObject::connect(axis(), SIGNAL(lineVisibleChanged(bool)), this, SLOT(handleArrowVisibleChanged(bool)));
+ QObject::connect(axis(), SIGNAL(gridVisibleChanged(bool)), this, SLOT(handleGridVisibleChanged(bool)));
+ QObject::connect(axis(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool)));
+ QObject::connect(axis(), SIGNAL(shadesVisibleChanged(bool)), this, SLOT(handleShadesVisibleChanged(bool)));
+ QObject::connect(axis(), SIGNAL(labelsAngleChanged(int)), this, SLOT(handleLabelsAngleChanged(int)));
+ QObject::connect(axis(), SIGNAL(linePenChanged(const QPen&)), this, SLOT(handleArrowPenChanged(const QPen&)));
+ QObject::connect(axis(), SIGNAL(labelsPenChanged(const QPen&)), this, SLOT(handleLabelsPenChanged(const QPen&)));
+ QObject::connect(axis(), SIGNAL(labelsBrushChanged(const QBrush&)), this, SLOT(handleLabelsBrushChanged(const QBrush&)));
+ QObject::connect(axis(), SIGNAL(labelsFontChanged(const QFont&)), this, SLOT(handleLabelsFontChanged(const QFont&)));
+ QObject::connect(axis(), SIGNAL(gridLinePenChanged(const QPen&)), this, SLOT(handleGridPenChanged(const QPen&)));
+ QObject::connect(axis(), SIGNAL(shadesPenChanged(const QPen&)), this, SLOT(handleShadesPenChanged(const QPen&)));
+ QObject::connect(axis(), SIGNAL(shadesBrushChanged(const QBrush&)), this, SLOT(handleShadesBrushChanged(const QBrush&)));
+ QObject::connect(axis(), SIGNAL(titleTextChanged(const QString&)), this, SLOT(handleTitleTextChanged(const QString&)));
+ QObject::connect(axis(), SIGNAL(titleFontChanged(const QFont&)), this, SLOT(handleTitleFontChanged(const QFont&)));
+ QObject::connect(axis(), SIGNAL(titlePenChanged(const QPen&)), this, SLOT(handleTitlePenChanged(const QPen&)));
+ QObject::connect(axis(), SIGNAL(titleBrushChanged(const QBrush&)), this, SLOT(handleTitleBrushChanged(const QBrush&)));
+ QObject::connect(axis(), SIGNAL(titleVisibleChanged(bool)), this, SLOT(handleTitleVisibleChanged(bool)));
+ QObject::connect(axis()->d_ptr.data(), SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(handleRangeChanged(qreal, qreal)));
+}
+
+void ChartAxisElement::handleArrowVisibleChanged(bool visible)
+{
+ m_arrow->setVisible(visible);
+}
+
+void ChartAxisElement::handleGridVisibleChanged(bool visible)
+{
+ m_grid->setVisible(visible);
+}
+
+void ChartAxisElement::handleLabelsVisibleChanged(bool visible)
+{
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+ m_labels->setVisible(visible);
+}
+
+void ChartAxisElement::handleShadesVisibleChanged(bool visible)
+{
+ m_shades->setVisible(visible);
+}
+
+void ChartAxisElement::handleTitleVisibleChanged(bool visible)
+{
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+ m_title->setVisible(visible);
+}
+
+void ChartAxisElement::handleLabelsAngleChanged(int angle)
+{
+ foreach (QGraphicsItem *item, m_labels->childItems())
+ item->setRotation(angle);
+
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+}
+
+void ChartAxisElement::handleLabelsPenChanged(const QPen &pen)
+{
+ Q_UNUSED(pen)
+}
+
+void ChartAxisElement::handleLabelsBrushChanged(const QBrush &brush)
+{
+ foreach (QGraphicsItem *item, m_labels->childItems())
+ static_cast<QGraphicsTextItem *>(item)->setDefaultTextColor(brush.color());
+}
+
+void ChartAxisElement::handleLabelsFontChanged(const QFont &font)
+{
+ foreach (QGraphicsItem *item, m_labels->childItems())
+ static_cast<QGraphicsTextItem *>(item)->setFont(font);
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+}
+
+void ChartAxisElement::handleTitleTextChanged(const QString &title)
+{
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+ if (title.isEmpty() || !m_title->isVisible())
+ m_title->setHtml(title);
+}
+
+void ChartAxisElement::handleTitlePenChanged(const QPen &pen)
+{
+ Q_UNUSED(pen)
+}
+
+void ChartAxisElement::handleTitleBrushChanged(const QBrush &brush)
+{
+ m_title->setDefaultTextColor(brush.color());
+}
+
+void ChartAxisElement::handleTitleFontChanged(const QFont &font)
+{
+ if (m_title->font() != font) {
+ m_title->setFont(font);
+ QGraphicsLayoutItem::updateGeometry();
+ presenter()->layout()->invalidate();
+ }
+}
+
+void ChartAxisElement::handleVisibleChanged(bool visible)
+{
+ setVisible(visible);
+ if (!visible) {
+ m_grid->setVisible(visible);
+ m_arrow->setVisible(visible);
+ m_shades->setVisible(visible);
+ m_labels->setVisible(visible);
+ m_title->setVisible(visible);
+ } else {
+ m_grid->setVisible(axis()->isGridLineVisible());
+ m_arrow->setVisible(axis()->isLineVisible());
+ m_shades->setVisible(axis()->shadesVisible());
+ m_labels->setVisible(axis()->labelsVisible());
+ m_title->setVisible(axis()->isTitleVisible());
+ }
+
+ if (presenter()) presenter()->layout()->invalidate();
+}
+
+void ChartAxisElement::handleRangeChanged(qreal min, qreal max)
+{
+ Q_UNUSED(min);
+ Q_UNUSED(max);
+
+ if (!isEmpty()) {
+ QVector<qreal> layout = calculateLayout();
+ updateLayout(layout);
+ QSizeF before = effectiveSizeHint(Qt::PreferredSize);
+ QSizeF after = sizeHint(Qt::PreferredSize);
+
+ if (before != after) {
+ QGraphicsLayoutItem::updateGeometry();
+ // We don't want to call invalidate on layout, since it will change minimum size of
+ // component, which we would like to avoid since it causes nasty flips when scrolling
+ // or zooming, instead recalculate layout and use plotArea for extra space.
+ presenter()->layout()->setGeometry(presenter()->layout()->geometry());
+ }
+ }
+}
+
+bool ChartAxisElement::isEmpty()
+{
+ return axisGeometry().isEmpty()
+ || gridGeometry().isEmpty()
+ || qFuzzyCompare(min(), max());
+}
+
+qreal ChartAxisElement::min() const
+{
+ return m_axis->d_ptr->min();
+}
+
+qreal ChartAxisElement::max() const
+{
+ return m_axis->d_ptr->max();
+}
+
+QString ChartAxisElement::formatLabel(const QString &formatSpec, const QByteArray &array,
+ qreal value, int precision, const QString &preStr,
+ const QString &postStr) const
+{
+ QString retVal;
+ if (!formatSpec.isEmpty()) {
+ if (formatSpec.at(0) == QLatin1Char('d')
+ || formatSpec.at(0) == QLatin1Char('i')
+ || formatSpec.at(0) == QLatin1Char('c')) {
+ if (presenter()->localizeNumbers())
+ retVal = preStr + presenter()->locale().toString(qint64(value)) + postStr;
+ else
+ retVal = QString().sprintf(array, qint64(value));
+ } else if (formatSpec.at(0) == QLatin1Char('u')
+ || formatSpec.at(0) == QLatin1Char('o')
+ || formatSpec.at(0) == QLatin1Char('x')
+ || formatSpec.at(0) == QLatin1Char('X')) {
+ // These formats are not supported by localized numbers
+ retVal = QString().sprintf(array, quint64(value));
+ } else if (formatSpec.at(0) == QLatin1Char('f')
+ || formatSpec.at(0) == QLatin1Char('F')
+ || formatSpec.at(0) == QLatin1Char('e')
+ || formatSpec.at(0) == QLatin1Char('E')
+ || formatSpec.at(0) == QLatin1Char('g')
+ || formatSpec.at(0) == QLatin1Char('G')) {
+ if (presenter()->localizeNumbers()) {
+ retVal = preStr
+ + presenter()->locale().toString(value, formatSpec.at(0).toLatin1(),
+ precision)
+ + postStr;
+ } else {
+ retVal = QString().sprintf(array, value);
+ }
+ }
+ }
+ return retVal;
+}
+
+QStringList ChartAxisElement::createValueLabels(qreal min, qreal max, int ticks,
+ const QString &format) const
+{
+ QStringList labels;
+
+ if (max <= min || ticks < 1)
+ return labels;
+
+ if (format.isNull()) {
+ int n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0) + 1;
+ for (int i = 0; i < ticks; i++) {
+ qreal value = min + (i * (max - min) / (ticks - 1));
+ labels << presenter()->numberToString(value, 'f', n);
+ }
+ } else {
+ QByteArray array = format.toLatin1();
+ QString formatSpec;
+ QString preStr;
+ QString postStr;
+ int precision = 6; // Six is the default precision in Qt API
+ if (presenter()->localizeNumbers()) {
+ if (!labelFormatMatcherLocalized)
+ labelFormatMatcherLocalized
+ = new QRegExp(QString::fromLatin1(labelFormatMatchLocalizedString));
+ if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
+ preStr = labelFormatMatcherLocalized->cap(1);
+ if (!labelFormatMatcherLocalized->cap(2).isEmpty())
+ precision = labelFormatMatcherLocalized->cap(2).toInt();
+ formatSpec = labelFormatMatcherLocalized->cap(3);
+ postStr = labelFormatMatcherLocalized->cap(4);
+ }
+ } else {
+ if (!labelFormatMatcher)
+ labelFormatMatcher = new QRegExp(QString::fromLatin1(labelFormatMatchString));
+ if (labelFormatMatcher->indexIn(format, 0) != -1)
+ formatSpec = labelFormatMatcher->cap(1);
+ }
+ for (int i = 0; i < ticks; i++) {
+ qreal value = min + (i * (max - min) / (ticks - 1));
+ labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
+ }
+ }
+
+ return labels;
+}
+
+QStringList ChartAxisElement::createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
+ const QString &format) const
+{
+ QStringList labels;
+
+ if (max <= min || ticks < 1)
+ return labels;
+
+ int firstTick;
+ if (base > 1)
+ firstTick = ceil(log10(min) / log10(base));
+ else
+ firstTick = ceil(log10(max) / log10(base));
+
+ if (format.isNull()) {
+ int n = 0;
+ if (ticks > 1)
+ n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0);
+ n++;
+ for (int i = firstTick; i < ticks + firstTick; i++) {
+ qreal value = qPow(base, i);
+ labels << presenter()->numberToString(value, 'f', n);
+ }
+ } else {
+ QByteArray array = format.toLatin1();
+ QString formatSpec;
+ QString preStr;
+ QString postStr;
+ int precision = 6; // Six is the default precision in Qt API
+ if (presenter()->localizeNumbers()) {
+ if (!labelFormatMatcherLocalized)
+ labelFormatMatcherLocalized =
+ new QRegExp(QString::fromLatin1(labelFormatMatchLocalizedString));
+ if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
+ preStr = labelFormatMatcherLocalized->cap(1);
+ if (!labelFormatMatcherLocalized->cap(2).isEmpty())
+ precision = labelFormatMatcherLocalized->cap(2).toInt();
+ formatSpec = labelFormatMatcherLocalized->cap(3);
+ postStr = labelFormatMatcherLocalized->cap(4);
+ }
+ } else {
+ if (!labelFormatMatcher)
+ labelFormatMatcher = new QRegExp(QString::fromLatin1(labelFormatMatchString));
+ if (labelFormatMatcher->indexIn(format, 0) != -1)
+ formatSpec = labelFormatMatcher->cap(1);
+ }
+ for (int i = firstTick; i < ticks + firstTick; i++) {
+ qreal value = qPow(base, i);
+ labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
+ }
+ }
+
+ return labels;
+}
+
+QStringList ChartAxisElement::createDateTimeLabels(qreal min, qreal max,int ticks,
+ const QString &format) const
+{
+ QStringList labels;
+
+ if (max <= min || ticks < 1)
+ return labels;
+
+ int n = qMax(int(-floor(log10((max - min) / (ticks - 1)))), 0);
+ n++;
+ for (int i = 0; i < ticks; i++) {
+ qreal value = min + (i * (max - min) / (ticks - 1));
+ labels << presenter()->locale().toString(QDateTime::fromMSecsSinceEpoch(value), format);
+ }
+ return labels;
+}
+
+void ChartAxisElement::axisSelected()
+{
+ emit clicked();
+}
+
+#include "moc_chartaxiselement_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/chartaxiselement_p.h b/src/charts/axis/chartaxiselement_p.h
new file mode 100644
index 00000000..1cfac64d
--- /dev/null
+++ b/src/charts/axis/chartaxiselement_p.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTAXISELEMENT_H
+#define CHARTAXISELEMENT_H
+
+#include "qchartglobal.h"
+#include "chartelement_p.h"
+#include "axisanimation_p.h"
+#include <QGraphicsItem>
+#include <QGraphicsLayoutItem>
+#include <QFont>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartPresenter;
+class QAbstractAxis;
+
+class ChartAxisElement : public ChartElement, public QGraphicsLayoutItem
+{
+ Q_OBJECT
+
+ using QGraphicsLayoutItem::setGeometry;
+public:
+ ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
+ ~ChartAxisElement();
+
+ virtual QRectF gridGeometry() const = 0;
+ virtual void setGeometry(const QRectF &axis, const QRectF &grid) = 0;
+ virtual bool isEmpty() = 0;
+
+ void setAnimation(AxisAnimation *animation) { m_animation = animation; }
+ AxisAnimation *animation() const { return m_animation; }
+
+ QAbstractAxis *axis() const { return m_axis; }
+ void setLayout(QVector<qreal> &layout) { m_layout = layout; }
+ QVector<qreal> &layout() { return m_layout; } // Modifiable reference
+ inline qreal labelPadding() const { return qreal(4.0); }
+ inline qreal titlePadding() const { return qreal(2.0); }
+ void setLabels(const QStringList &labels) { m_labelsList = labels; }
+ QStringList labels() const { return m_labelsList; }
+
+ qreal min() const;
+ qreal max() const;
+
+ QRectF axisGeometry() const { return m_axisRect; }
+ void setAxisGeometry(const QRectF &axisGeometry) { m_axisRect = axisGeometry; }
+
+ void axisSelected();
+
+ //this flag indicates that axis is used to show intervals it means labels are in between ticks
+ bool intervalAxis() const { return m_intervalAxis; }
+
+ QStringList createValueLabels(qreal max, qreal min, int ticks, const QString &format) const;
+ QStringList createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
+ const QString &format) const;
+ QStringList createDateTimeLabels(qreal max, qreal min, int ticks, const QString &format) const;
+
+ // from QGraphicsLayoutItem
+ QRectF boundingRect() const
+ {
+ return QRectF();
+ }
+
+ // from QGraphicsLayoutItem
+ void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)
+ {
+ }
+
+protected:
+ virtual QVector<qreal> calculateLayout() const = 0;
+ virtual void updateLayout(QVector<qreal> &layout) = 0;
+
+ QList<QGraphicsItem *> gridItems() { return m_grid->childItems(); }
+ QList<QGraphicsItem *> labelItems() { return m_labels->childItems(); }
+ QList<QGraphicsItem *> shadeItems() { return m_shades->childItems(); }
+ QList<QGraphicsItem *> arrowItems() { return m_arrow->childItems(); }
+ QGraphicsTextItem *titleItem() const { return m_title.data(); }
+ QGraphicsItemGroup *gridGroup() { return m_grid.data(); }
+ QGraphicsItemGroup *labelGroup() { return m_labels.data(); }
+ QGraphicsItemGroup *shadeGroup() { return m_shades.data(); }
+ QGraphicsItemGroup *arrowGroup() { return m_arrow.data(); }
+
+public Q_SLOTS:
+ void handleVisibleChanged(bool visible);
+ void handleArrowVisibleChanged(bool visible);
+ void handleGridVisibleChanged(bool visible);
+ void handleLabelsVisibleChanged(bool visible);
+ void handleShadesVisibleChanged(bool visible);
+ void handleLabelsAngleChanged(int angle);
+ virtual void handleShadesBrushChanged(const QBrush &brush) = 0;
+ virtual void handleShadesPenChanged(const QPen &pen) = 0;
+ virtual void handleArrowPenChanged(const QPen &pen) = 0;
+ virtual void handleGridPenChanged(const QPen &pen) = 0;
+ void handleLabelsPenChanged(const QPen &pen);
+ void handleLabelsBrushChanged(const QBrush &brush);
+ void handleLabelsFontChanged(const QFont &font);
+ void handleTitlePenChanged(const QPen &pen);
+ void handleTitleBrushChanged(const QBrush &brush);
+ void handleTitleFontChanged(const QFont &font);
+ void handleTitleTextChanged(const QString &title);
+ void handleTitleVisibleChanged(bool visible);
+ void handleRangeChanged(qreal min, qreal max);
+
+Q_SIGNALS:
+ void clicked();
+
+private:
+ void connectSlots();
+ QString formatLabel(const QString &formatSpec, const QByteArray &array,
+ qreal value, int precision, const QString &preStr,
+ const QString &postStr) const;
+
+ QAbstractAxis *m_axis;
+ AxisAnimation *m_animation;
+ QVector<qreal> m_layout;
+ QStringList m_labelsList;
+ QRectF m_axisRect;
+ QScopedPointer<QGraphicsItemGroup> m_grid;
+ QScopedPointer<QGraphicsItemGroup> m_arrow;
+ QScopedPointer<QGraphicsItemGroup> m_shades;
+ QScopedPointer<QGraphicsItemGroup> m_labels;
+ QScopedPointer<QGraphicsTextItem> m_title;
+ bool m_intervalAxis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTAXISELEMENT_H */
diff --git a/src/charts/axis/datetimeaxis/chartdatetimeaxisx.cpp b/src/charts/axis/datetimeaxis/chartdatetimeaxisx.cpp
new file mode 100644
index 00000000..bdd010a0
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/chartdatetimeaxisx.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartdatetimeaxisx_p.h"
+#include "chartpresenter_p.h"
+#include "qdatetimeaxis.h"
+#include "abstractchartlayout_p.h"
+#include <QGraphicsLayout>
+#include <QDateTime>
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartDateTimeAxisX::ChartDateTimeAxisX(QDateTimeAxis *axis, QGraphicsItem *item)
+ : HorizontalAxis(axis, item),
+ m_axis(axis)
+{
+ QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
+ QObject::connect(m_axis, SIGNAL(formatChanged(QString)), this, SLOT(handleFormatChanged(QString)));
+}
+
+ChartDateTimeAxisX::~ChartDateTimeAxisX()
+{
+}
+
+QVector<qreal> ChartDateTimeAxisX::calculateLayout() const
+{
+ int tickCount = m_axis->tickCount();
+
+ Q_ASSERT(tickCount >= 2);
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+ const QRectF &gridRect = gridGeometry();
+ const qreal deltaX = gridRect.width() / (qreal(tickCount) - 1.0);
+ for (int i = 0; i < tickCount; ++i)
+ points[i] = qreal(i) * deltaX + gridRect.left();
+ return points;
+}
+
+void ChartDateTimeAxisX::updateGeometry()
+{
+ const QVector<qreal>& layout = ChartAxisElement::layout();
+ if (layout.isEmpty())
+ return;
+ setLabels(createDateTimeLabels(min(), max(), layout.size(), m_axis->format()));
+ HorizontalAxis::updateGeometry();
+}
+
+void ChartDateTimeAxisX::handleTickCountChanged(int tick)
+{
+ Q_UNUSED(tick)
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+void ChartDateTimeAxisX::handleFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+QSizeF ChartDateTimeAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+
+ QSizeF base = HorizontalAxis::sizeHint(which, constraint);
+ QStringList ticksList = createDateTimeLabels(min(), max(), m_axis->tickCount(), m_axis->format());
+ // Width of horizontal axis sizeHint indicates the maximum distance labels can extend past
+ // first and last ticks. Base width is irrelevant.
+ qreal width = 0;
+ qreal height = 0;
+
+ if (ticksList.empty())
+ return sh;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ width = boundingRect.width() / 2.0;
+ height = boundingRect.height() + labelPadding() + base.height() + 1.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize: {
+ qreal labelHeight = 0.0;
+ qreal firstWidth = -1.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelHeight = qMax(rect.height(), labelHeight);
+ width = rect.width();
+ if (firstWidth < 0.0)
+ firstWidth = width;
+ }
+ height = labelHeight + labelPadding() + base.height() + 1.0;
+ width = qMax(width, firstWidth) / 2.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+
+ return sh;
+}
+
+#include "moc_chartdatetimeaxisx_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/datetimeaxis/chartdatetimeaxisx_p.h b/src/charts/axis/datetimeaxis/chartdatetimeaxisx_p.h
new file mode 100644
index 00000000..3ca2ef45
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/chartdatetimeaxisx_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTDATETIMEAXISX_H
+#define CHARTDATETIMEAXISX_H
+
+#include "horizontalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QDateTimeAxis;
+
+class ChartDateTimeAxisX : public HorizontalAxis
+{
+ Q_OBJECT
+public:
+ ChartDateTimeAxisX(QDateTimeAxis *axis, QGraphicsItem* item = 0);
+ ~ChartDateTimeAxisX();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+private Q_SLOTS:
+ void handleTickCountChanged(int tick);
+ void handleFormatChanged(const QString &format);
+
+private:
+ QDateTimeAxis *m_axis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTDATETIMEAXISX_H */
diff --git a/src/charts/axis/datetimeaxis/chartdatetimeaxisy.cpp b/src/charts/axis/datetimeaxis/chartdatetimeaxisy.cpp
new file mode 100644
index 00000000..5e67936b
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/chartdatetimeaxisy.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartdatetimeaxisy_p.h"
+#include "chartpresenter_p.h"
+#include "qdatetimeaxis.h"
+#include "abstractchartlayout_p.h"
+#include <QGraphicsLayout>
+#include <QDateTime>
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartDateTimeAxisY::ChartDateTimeAxisY(QDateTimeAxis *axis, QGraphicsItem *item)
+ : VerticalAxis(axis, item),
+ m_axis(axis)
+{
+ QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
+ QObject::connect(m_axis, SIGNAL(formatChanged(QString)), this, SLOT(handleFormatChanged(QString)));
+}
+
+ChartDateTimeAxisY::~ChartDateTimeAxisY()
+{
+}
+
+QVector<qreal> ChartDateTimeAxisY::calculateLayout() const
+{
+ int tickCount = m_axis->tickCount();
+
+ Q_ASSERT(tickCount >= 2);
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+ const QRectF &gridRect = gridGeometry();
+ const qreal deltaY = gridRect.height() / (qreal(tickCount) - 1.0);
+ for (int i = 0; i < tickCount; ++i)
+ points[i] = qreal(i) * -deltaY + gridRect.bottom();
+
+ return points;
+}
+
+void ChartDateTimeAxisY::updateGeometry()
+{
+ const QVector<qreal> &layout = ChartAxisElement::layout();
+ if (layout.isEmpty())
+ return;
+ setLabels(createDateTimeLabels(min(), max(), layout.size(), m_axis->format()));
+ VerticalAxis::updateGeometry();
+}
+
+void ChartDateTimeAxisY::handleTickCountChanged(int tick)
+{
+ Q_UNUSED(tick)
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+void ChartDateTimeAxisY::handleFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+QSizeF ChartDateTimeAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+
+ QSizeF base = VerticalAxis::sizeHint(which, constraint);
+ QStringList ticksList = createDateTimeLabels(min(), max(), m_axis->tickCount(), m_axis->format());
+ qreal width = 0;
+ // Height of vertical axis sizeHint indicates the maximum distance labels can extend past
+ // first and last ticks. Base height is irrelevant.
+ qreal height = 0;
+
+ if (ticksList.empty())
+ return sh;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ width = boundingRect.width() + labelPadding() + base.width() + 1.0;
+ height = boundingRect.height() / 2.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize: {
+ qreal labelWidth = 0.0;
+ qreal firstHeight = -1.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelWidth = qMax(rect.width(), labelWidth);
+ height = rect.height();
+ if (firstHeight < 0.0)
+ firstHeight = height;
+ }
+ width = labelWidth + labelPadding() + base.width() + 2.0; //two pixels of tolerance
+ height = qMax(height, firstHeight) / 2.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+
+ return sh;
+}
+
+#include "moc_chartdatetimeaxisy_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/datetimeaxis/chartdatetimeaxisy_p.h b/src/charts/axis/datetimeaxis/chartdatetimeaxisy_p.h
new file mode 100644
index 00000000..0631e157
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/chartdatetimeaxisy_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTDATETIMEAXISY_H
+#define CHARTDATETIMEAXISY_H
+
+#include "verticalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QDateTimeAxis;
+
+class ChartDateTimeAxisY : public VerticalAxis
+{
+ Q_OBJECT
+public:
+ ChartDateTimeAxisY(QDateTimeAxis *axis, QGraphicsItem* item = 0);
+ ~ChartDateTimeAxisY();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+private Q_SLOTS:
+ void handleTickCountChanged(int tick);
+ void handleFormatChanged(const QString &format);
+
+private:
+ QDateTimeAxis *m_axis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTDATETIMEAXISY_H */
diff --git a/src/charts/axis/datetimeaxis/polarchartdatetimeaxisangular.cpp b/src/charts/axis/datetimeaxis/polarchartdatetimeaxisangular.cpp
new file mode 100644
index 00000000..4ace5de6
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/polarchartdatetimeaxisangular.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartdatetimeaxisangular_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include "qdatetimeaxis.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartDateTimeAxisAngular::PolarChartDateTimeAxisAngular(QDateTimeAxis *axis, QGraphicsItem *item)
+ : PolarChartAxisAngular(axis, item)
+{
+ QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
+ QObject::connect(axis, SIGNAL(formatChanged(QString)), this, SLOT(handleFormatChanged(QString)));
+}
+
+PolarChartDateTimeAxisAngular::~PolarChartDateTimeAxisAngular()
+{
+}
+
+QVector<qreal> PolarChartDateTimeAxisAngular::calculateLayout() const
+{
+ int tickCount = static_cast<QDateTimeAxis *>(axis())->tickCount();
+ Q_ASSERT(tickCount >= 2);
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+
+ const qreal d = 360.0 / qreal(tickCount - 1);
+
+ for (int i = 0; i < tickCount; ++i) {
+ qreal angularCoordinate = qreal(i) * d;
+ points[i] = angularCoordinate;
+ }
+
+ return points;
+}
+void PolarChartDateTimeAxisAngular::createAxisLabels(const QVector<qreal> &layout)
+{
+ QStringList labelList = createDateTimeLabels(min(), max(), layout.size(), static_cast<QDateTimeAxis *>(axis())->format());
+ setLabels(labelList);
+}
+
+void PolarChartDateTimeAxisAngular::handleTickCountChanged(int tick)
+{
+ Q_UNUSED(tick);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+void PolarChartDateTimeAxisAngular::handleFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+#include "moc_polarchartdatetimeaxisangular_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/datetimeaxis/polarchartdatetimeaxisangular_p.h b/src/charts/axis/datetimeaxis/polarchartdatetimeaxisangular_p.h
new file mode 100644
index 00000000..bbfd8260
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/polarchartdatetimeaxisangular_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTDATETIMEAXISANGULAR_P_H
+#define POLARCHARTDATETIMEAXISANGULAR_P_H
+
+#include "polarchartaxisangular_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QDateTimeAxis;
+
+class PolarChartDateTimeAxisAngular : public PolarChartAxisAngular
+{
+ Q_OBJECT
+public:
+ PolarChartDateTimeAxisAngular(QDateTimeAxis *axis, QGraphicsItem *item);
+ ~PolarChartDateTimeAxisAngular();
+
+ virtual QVector<qreal> calculateLayout() const;
+ virtual void createAxisLabels(const QVector<qreal> &layout);
+
+private Q_SLOTS:
+ void handleTickCountChanged(int tick);
+ void handleFormatChanged(const QString &format);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTDATETIMEAXISANGULAR_P_H
diff --git a/src/charts/axis/datetimeaxis/polarchartdatetimeaxisradial.cpp b/src/charts/axis/datetimeaxis/polarchartdatetimeaxisradial.cpp
new file mode 100644
index 00000000..fdcfcc36
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/polarchartdatetimeaxisradial.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartdatetimeaxisradial_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include "qdatetimeaxis.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartDateTimeAxisRadial::PolarChartDateTimeAxisRadial(QDateTimeAxis *axis, QGraphicsItem *item)
+ : PolarChartAxisRadial(axis, item)
+{
+ QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
+ QObject::connect(axis, SIGNAL(formatChanged(QString)), this, SLOT(handleFormatChanged(QString)));
+}
+
+PolarChartDateTimeAxisRadial::~PolarChartDateTimeAxisRadial()
+{
+}
+
+QVector<qreal> PolarChartDateTimeAxisRadial::calculateLayout() const
+{
+ int tickCount = static_cast<QDateTimeAxis *>(axis())->tickCount();
+ Q_ASSERT(tickCount >= 2);
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+
+ const qreal d = (axisGeometry().width() / 2) / qreal(tickCount - 1);
+
+ for (int i = 0; i < tickCount; ++i) {
+ qreal radialCoordinate = qreal(i) * d;
+ points[i] = radialCoordinate;
+ }
+
+ return points;
+}
+void PolarChartDateTimeAxisRadial::createAxisLabels(const QVector<qreal> &layout)
+{
+ setLabels(createDateTimeLabels(min(), max(), layout.size(), static_cast<QDateTimeAxis *>(axis())->format()));
+}
+
+void PolarChartDateTimeAxisRadial::handleTickCountChanged(int tick)
+{
+ Q_UNUSED(tick);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+void PolarChartDateTimeAxisRadial::handleFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+#include "moc_polarchartdatetimeaxisradial_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/datetimeaxis/polarchartdatetimeaxisradial_p.h b/src/charts/axis/datetimeaxis/polarchartdatetimeaxisradial_p.h
new file mode 100644
index 00000000..207d5a3a
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/polarchartdatetimeaxisradial_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTDATETIMEAXISRADIAL_P_H
+#define POLARCHARTDATETIMEAXISRADIAL_P_H
+
+#include "polarchartaxisradial_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QDateTimeAxis;
+
+class PolarChartDateTimeAxisRadial : public PolarChartAxisRadial
+{
+ Q_OBJECT
+public:
+ PolarChartDateTimeAxisRadial(QDateTimeAxis *axis, QGraphicsItem *item);
+ ~PolarChartDateTimeAxisRadial();
+
+ virtual QVector<qreal> calculateLayout() const;
+ virtual void createAxisLabels(const QVector<qreal> &layout);
+
+private Q_SLOTS:
+ void handleTickCountChanged(int tick);
+ void handleFormatChanged(const QString &format);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTDATETIMEAXISRADIAL_P_H
diff --git a/src/charts/axis/datetimeaxis/qdatetimeaxis.cpp b/src/charts/axis/datetimeaxis/qdatetimeaxis.cpp
new file mode 100644
index 00000000..fffd80c2
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/qdatetimeaxis.cpp
@@ -0,0 +1,390 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdatetimeaxis.h"
+#include "qdatetimeaxis_p.h"
+#include "chartdatetimeaxisx_p.h"
+#include "chartdatetimeaxisy_p.h"
+#include "polarchartdatetimeaxisangular_p.h"
+#include "polarchartdatetimeaxisradial_p.h"
+#include "abstractdomain_p.h"
+#include "qchart.h"
+#include <float.h>
+#include <cmath>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/*!
+ \class QDateTimeAxis
+ \inmodule Qt Charts
+ \brief The QDateTimeAxis class is used for manipulating chart's axis.
+ \mainclass
+
+ The labels can be configured by setting an appropriate DateTime format.
+ QDateTimeAxis works correctly with dates from 4714 BCE to 287396 CE.
+ There are also other limitiation related to QDateTime. Please refer to QDateTime documentation.
+ QDateTimeAxis can be setup to show axis line with tick marks, grid lines and shades.
+
+ Note: QDateTimeAxis is disabled on ARM architecture.
+
+ \image api_datatime_axis.png
+
+ QDateTimeAxis can be used with any QXYSeries.
+ To add a data point to the series QDateTime::toMSecsSinceEpoch() is used.
+ \code
+ QLineSeries *series = new QLineSeries;
+
+ QDateTime xValue;
+ xValue.setDate(QDate(2012, 1 , 18));
+ xValue.setTime(QTime(9, 34));
+ qreal yValue = 12;
+ series->append(xValue.toMSecsSinceEpoch(), yValue);
+
+ xValue.setDate(QDate(2013, 5 , 11));
+ xValue.setTime(QTime(11, 14));
+ qreal yValue = 22;
+ series->append(xValue.toMSecsSinceEpoch(), yValue);
+ \endcode
+
+ Adding the series to the chart and setting up the QDateTimeAxis.
+ \code
+ QChartView *chartView = new QChartView;
+ chartView->chart()->addSeries(series);
+
+ // ...
+ QDateTimeAxis *axisX = new QDateTimeAxis;
+ axisX->setFormat("dd-MM-yyyy h:mm");
+ chartView->chart()->setAxisX(axisX, series);
+ \endcode
+*/
+
+/*!
+ \qmltype DateTimeAxis
+ \instantiates QDateTimeAxis
+ \inqmlmodule QtCharts
+
+ \brief The DateTimeAxis element is used for manipulating chart's axes.
+ \inherits AbstractAxis
+
+ The labels can be configured by setting an appropriate DateTime format.
+ Note that any date before 4714 BCE or after about 1.4 million CE may not be accurately stored.
+ DateTimeAxis can be setup to show axis line with tick marks, grid lines and shades.
+*/
+
+/*!
+ \property QDateTimeAxis::min
+ Defines the minimum value on the axis.
+ When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
+*/
+/*!
+ \qmlproperty datetime DateTimeAxis::min
+ Defines the minimum value on the axis.
+ When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
+*/
+
+/*!
+ \property QDateTimeAxis::max
+ Defines the maximum value on the axis.
+ When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
+*/
+/*!
+ \qmlproperty datetime DateTimeAxis::max
+ Defines the maximum value on the axis.
+ When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
+*/
+
+/*!
+ \fn void QDateTimeAxis::minChanged(QDateTime min)
+ Axis emits signal when \a min of axis has changed.
+*/
+/*!
+ \qmlsignal DateTimeAxis::onMinChanged(datetime min)
+ Axis emits signal when \a min of axis has changed.
+*/
+
+/*!
+ \fn void QDateTimeAxis::maxChanged(QDateTime max)
+ Axis emits signal when \a max of axis has changed.
+*/
+/*!
+ \qmlsignal DateTimeAxis::onMaxChanged(datetime max)
+ Axis emits signal when \a max of axis has changed.
+*/
+
+/*!
+ \fn void QDateTimeAxis::rangeChanged(QDateTime min, QDateTime max)
+ Axis emits signal when \a min or \a max of axis has changed.
+*/
+
+/*!
+ \property QDateTimeAxis::tickCount
+ The number of tick marks for the axis.
+*/
+
+/*!
+ \qmlproperty int DateTimeAxis::tickCount
+ The number of tick marks for the axis.
+*/
+
+/*!
+ \property QDateTimeAxis::format
+ The format string that is used when creating label for the axis out of a QDateTime object.
+ Check QDateTime documentation for information on how the string should be defined.
+
+ \sa QChart::locale
+*/
+/*!
+ \qmlproperty string DateTimeAxis::format
+ The format string that is used when creating label for the axis out of a QDateTime object.
+ Check QDateTime documentation for information on how the string should be defined.
+*/
+
+/*!
+ \fn void QDateTimeAxis::tickCountChanged(int tickCount)
+ Axis emits signal when \a tickCount number on axis have changed.
+*/
+/*!
+ \qmlsignal DateTimeAxis::tickCountChanged(int tickCount)
+ Axis emits signal when \a tickCount number on axis have changed.
+*/
+
+/*!
+ \fn void QDateTimeAxis::formatChanged(QString format)
+ Axis emits signal when \a format of the axis has changed.
+*/
+/*!
+ \qmlsignal DateTimeAxis::onFormatChanged(string format)
+ Axis emits signal when \a format of the axis has changed.
+*/
+
+/*!
+ Constructs an axis object which is a child of \a parent.
+*/
+QDateTimeAxis::QDateTimeAxis(QObject *parent) :
+ QAbstractAxis(*new QDateTimeAxisPrivate(this), parent)
+{
+
+}
+
+/*!
+ \internal
+*/
+QDateTimeAxis::QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
+{
+
+}
+
+/*!
+ Destroys the object.
+*/
+QDateTimeAxis::~QDateTimeAxis()
+{
+ Q_D(QDateTimeAxis);
+ if (d->m_chart)
+ d->m_chart->removeAxis(this);
+}
+
+void QDateTimeAxis::setMin(QDateTime min)
+{
+ Q_D(QDateTimeAxis);
+ if (min.isValid())
+ d->setRange(min.toMSecsSinceEpoch(), qMax(d->m_max, qreal(min.toMSecsSinceEpoch())));
+}
+
+QDateTime QDateTimeAxis::min() const
+{
+ Q_D(const QDateTimeAxis);
+ return QDateTime::fromMSecsSinceEpoch(d->m_min);
+}
+
+void QDateTimeAxis::setMax(QDateTime max)
+{
+ Q_D(QDateTimeAxis);
+ if (max.isValid())
+ d->setRange(qMin(d->m_min, qreal(max.toMSecsSinceEpoch())), max.toMSecsSinceEpoch());
+}
+
+QDateTime QDateTimeAxis::max() const
+{
+ Q_D(const QDateTimeAxis);
+ return QDateTime::fromMSecsSinceEpoch(d->m_max);
+}
+
+/*!
+ Sets range from \a min to \a max on the axis.
+ If min is greater than max then this function returns without making any changes.
+*/
+void QDateTimeAxis::setRange(QDateTime min, QDateTime max)
+{
+ Q_D(QDateTimeAxis);
+ if (!min.isValid() || !max.isValid() || min > max)
+ return;
+
+ d->setRange(min.toMSecsSinceEpoch(),max.toMSecsSinceEpoch());
+}
+
+void QDateTimeAxis::setFormat(QString format)
+{
+ Q_D(QDateTimeAxis);
+ if (d->m_format != format) {
+ d->m_format = format;
+ emit formatChanged(format);
+ }
+}
+
+QString QDateTimeAxis::format() const
+{
+ Q_D(const QDateTimeAxis);
+ return d->m_format;
+}
+
+/*!
+ Sets \a count for ticks on the axis.
+*/
+void QDateTimeAxis::setTickCount(int count)
+{
+ Q_D(QDateTimeAxis);
+ if (d->m_tickCount != count && count >= 2) {
+ d->m_tickCount = count;
+ emit tickCountChanged(count);
+ }
+}
+
+/*!
+ \fn int QDateTimeAxis::tickCount() const
+ Return number of ticks on the axis.
+*/
+int QDateTimeAxis::tickCount() const
+{
+ Q_D(const QDateTimeAxis);
+ return d->m_tickCount;
+}
+
+/*!
+ Returns the type of the axis.
+*/
+QAbstractAxis::AxisType QDateTimeAxis::type() const
+{
+ return AxisTypeDateTime;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QDateTimeAxisPrivate::QDateTimeAxisPrivate(QDateTimeAxis *q)
+ : QAbstractAxisPrivate(q),
+ m_min(0),
+ m_max(0),
+ m_tickCount(5)
+{
+ m_format = QStringLiteral("dd-MM-yyyy\nh:mm");
+}
+
+QDateTimeAxisPrivate::~QDateTimeAxisPrivate()
+{
+
+}
+
+void QDateTimeAxisPrivate::setRange(qreal min,qreal max)
+{
+ Q_Q(QDateTimeAxis);
+
+ bool changed = false;
+
+ if (m_min != min) {
+ m_min = min;
+ changed = true;
+ emit q->minChanged(QDateTime::fromMSecsSinceEpoch(min));
+ }
+
+ if (m_max != max) {
+ m_max = max;
+ changed = true;
+ emit q->maxChanged(QDateTime::fromMSecsSinceEpoch(max));
+ }
+
+ if (changed) {
+ emit q->rangeChanged(QDateTime::fromMSecsSinceEpoch(min), QDateTime::fromMSecsSinceEpoch(max));
+ emit rangeChanged(m_min,m_max);
+ }
+}
+
+
+void QDateTimeAxisPrivate::setMin(const QVariant &min)
+{
+ Q_Q(QDateTimeAxis);
+ if (min.canConvert(QVariant::DateTime))
+ q->setMin(min.toDateTime());
+}
+
+void QDateTimeAxisPrivate::setMax(const QVariant &max)
+{
+
+ Q_Q(QDateTimeAxis);
+ if (max.canConvert(QVariant::DateTime))
+ q->setMax(max.toDateTime());
+}
+
+void QDateTimeAxisPrivate::setRange(const QVariant &min, const QVariant &max)
+{
+ Q_Q(QDateTimeAxis);
+ if (min.canConvert(QVariant::DateTime) && max.canConvert(QVariant::DateTime))
+ q->setRange(min.toDateTime(), max.toDateTime());
+}
+
+void QDateTimeAxisPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QDateTimeAxis);
+ ChartAxisElement *axis(0);
+ if (m_chart->chartType() == QChart::ChartTypeCartesian) {
+ if (orientation() == Qt::Vertical)
+ axis = new ChartDateTimeAxisY(q,parent);
+ if (orientation() == Qt::Horizontal)
+ axis = new ChartDateTimeAxisX(q,parent);
+ }
+
+ if (m_chart->chartType() == QChart::ChartTypePolar) {
+ if (orientation() == Qt::Vertical)
+ axis = new PolarChartDateTimeAxisRadial(q, parent);
+ if (orientation() == Qt::Horizontal)
+ axis = new PolarChartDateTimeAxisAngular(q, parent);
+ }
+
+ m_item.reset(axis);
+ QAbstractAxisPrivate::initializeGraphics(parent);
+}
+
+void QDateTimeAxisPrivate::initializeDomain(AbstractDomain *domain)
+{
+ if (m_max == m_min) {
+ if (orientation() == Qt::Vertical)
+ setRange(domain->minY(), domain->maxY());
+ else
+ setRange(domain->minX(), domain->maxX());
+ } else {
+ if (orientation() == Qt::Vertical)
+ domain->setRangeY(m_min, m_max);
+ else
+ domain->setRangeX(m_min, m_max);
+ }
+}
+
+#include "moc_qdatetimeaxis.cpp"
+#include "moc_qdatetimeaxis_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/datetimeaxis/qdatetimeaxis.h b/src/charts/axis/datetimeaxis/qdatetimeaxis.h
new file mode 100644
index 00000000..72d46b5e
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/qdatetimeaxis.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDATETIMEAXIS_H
+#define QDATETIMEAXIS_H
+
+#include <QtCharts/qabstractaxis.h>
+
+class QDateTime;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QDateTimeAxisPrivate;
+
+class QT_CHARTS_EXPORT QDateTimeAxis : public QAbstractAxis
+{
+ Q_OBJECT
+ Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount NOTIFY tickCountChanged)
+ Q_PROPERTY(QDateTime min READ min WRITE setMin NOTIFY minChanged)
+ Q_PROPERTY(QDateTime max READ max WRITE setMax NOTIFY maxChanged)
+ Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
+
+public:
+ explicit QDateTimeAxis(QObject *parent = 0);
+ ~QDateTimeAxis();
+
+protected:
+ QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent = 0);
+
+public:
+ AxisType type() const;
+
+ //range handling
+ void setMin(QDateTime min);
+ QDateTime min() const;
+ void setMax(QDateTime max);
+ QDateTime max() const;
+ void setRange(QDateTime min, QDateTime max);
+
+ void setFormat(QString format);
+ QString format() const;
+
+ //ticks handling
+ void setTickCount(int count);
+ int tickCount() const;
+
+Q_SIGNALS:
+ void minChanged(QDateTime min);
+ void maxChanged(QDateTime max);
+ void rangeChanged(QDateTime min, QDateTime max);
+ void formatChanged(QString format);
+ void tickCountChanged(int tick);
+
+private:
+ Q_DECLARE_PRIVATE(QDateTimeAxis)
+ Q_DISABLE_COPY(QDateTimeAxis)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QDATETIMEAXIS_H
diff --git a/src/charts/axis/datetimeaxis/qdatetimeaxis_p.h b/src/charts/axis/datetimeaxis/qdatetimeaxis_p.h
new file mode 100644
index 00000000..30551d55
--- /dev/null
+++ b/src/charts/axis/datetimeaxis/qdatetimeaxis_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QDATETIMEAXIS_P_H
+#define QDATETIMEAXIS_P_H
+
+#include "qdatetimeaxis.h"
+#include "qabstractaxis_p.h"
+#include <QDateTime>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QDateTimeAxisPrivate : public QAbstractAxisPrivate
+{
+ Q_OBJECT
+public:
+ QDateTimeAxisPrivate(QDateTimeAxis *q);
+ ~QDateTimeAxisPrivate();
+
+public:
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeDomain(AbstractDomain *domain);
+
+ //interface for manipulating range form base class
+ void setMin(const QVariant &min);
+ void setMax(const QVariant &max);
+ void setRange(const QVariant &min, const QVariant &max);
+
+ //interface manipulating range form domain
+ qreal min() { return m_min; }
+ qreal max() { return m_max; }
+ void setRange(qreal min,qreal max);
+
+protected:
+ int tickCount() const;
+
+protected:
+ qreal m_min;
+ qreal m_max;
+ int m_tickCount;
+ QString m_format;
+ Q_DECLARE_PUBLIC(QDateTimeAxis)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QDATETIMEAXIS_P_H
diff --git a/src/charts/axis/horizontalaxis.cpp b/src/charts/axis/horizontalaxis.cpp
new file mode 100644
index 00000000..941afc05
--- /dev/null
+++ b/src/charts/axis/horizontalaxis.cpp
@@ -0,0 +1,227 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "horizontalaxis_p.h"
+#include "qabstractaxis_p.h"
+#include "chartpresenter_p.h"
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+HorizontalAxis::HorizontalAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
+ : CartesianChartAxis(axis, item, intervalAxis)
+{
+}
+
+HorizontalAxis::~HorizontalAxis()
+{
+}
+
+void HorizontalAxis::updateGeometry()
+{
+ const QVector<qreal> &layout = ChartAxisElement::layout();
+
+ if (layout.isEmpty())
+ return;
+
+ QStringList labelList = labels();
+
+ QList<QGraphicsItem *> lines = gridItems();
+ QList<QGraphicsItem *> labels = labelItems();
+ QList<QGraphicsItem *> shades = shadeItems();
+ QList<QGraphicsItem *> arrow = arrowItems();
+ QGraphicsTextItem *title = titleItem();
+
+ Q_ASSERT(labels.size() == labelList.size());
+ Q_ASSERT(layout.size() == labelList.size());
+
+ const QRectF &axisRect = axisGeometry();
+ const QRectF &gridRect = gridGeometry();
+
+ //arrow
+ QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem *>(arrow.at(0));
+
+ if (axis()->alignment() == Qt::AlignTop)
+ arrowItem->setLine(gridRect.left(), axisRect.bottom(), gridRect.right(), axisRect.bottom());
+ else if (axis()->alignment() == Qt::AlignBottom)
+ arrowItem->setLine(gridRect.left(), axisRect.top(), gridRect.right(), axisRect.top());
+
+ qreal width = 0;
+ const QLatin1String ellipsis("...");
+
+ //title
+ QRectF titleBoundingRect;
+ QString titleText = axis()->titleText();
+ qreal availableSpace = axisRect.height() - labelPadding();
+ if (!titleText.isEmpty() && titleItem()->isVisible()) {
+ availableSpace -= titlePadding() * 2.0;
+ qreal minimumLabelHeight = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("...")).height();
+ qreal titleSpace = availableSpace - minimumLabelHeight;
+ title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
+ gridRect.width(), titleSpace,
+ titleBoundingRect));
+ title->setTextWidth(titleBoundingRect.width());
+
+ titleBoundingRect = title->boundingRect();
+
+ QPointF center = gridRect.center() - titleBoundingRect.center();
+ if (axis()->alignment() == Qt::AlignTop)
+ title->setPos(center.x(), axisRect.top() + titlePadding());
+ else if (axis()->alignment() == Qt::AlignBottom)
+ title->setPos(center.x(), axisRect.bottom() - titleBoundingRect.height() - titlePadding());
+
+ availableSpace -= titleBoundingRect.height();
+ }
+
+ for (int i = 0; i < layout.size(); ++i) {
+ //items
+ QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem*>(lines.at(i));
+ QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem*>(arrow.at(i + 1));
+ QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labels.at(i));
+
+ //grid line
+ gridItem->setLine(layout[i], gridRect.top(), layout[i], gridRect.bottom());
+
+ //label text wrapping
+ QString text = labelList.at(i);
+ QRectF boundingRect;
+ // don't truncate empty labels
+ if (text.isEmpty()) {
+ labelItem->setHtml(text);
+ } else {
+ qreal labelWidth = axisRect.width() / layout.count() - (2 * labelPadding());
+ QString truncatedText = ChartPresenter::truncatedText(axis()->labelsFont(), text,
+ axis()->labelsAngle(),
+ labelWidth,
+ availableSpace, boundingRect);
+ labelItem->setTextWidth(ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ truncatedText).width());
+ labelItem->setHtml(truncatedText);
+ }
+
+ //label transformation origin point
+ const QRectF& rect = labelItem->boundingRect();
+ QPointF center = rect.center();
+ labelItem->setTransformOriginPoint(center.x(), center.y());
+ qreal heightDiff = rect.height() - boundingRect.height();
+ qreal widthDiff = rect.width() - boundingRect.width();
+
+ //ticks and label position
+ if (axis()->alignment() == Qt::AlignTop) {
+ labelItem->setPos(layout[i] - center.x(), axisRect.bottom() - rect.height() + (heightDiff / 2.0) - labelPadding());
+ tickItem->setLine(layout[i], axisRect.bottom(), layout[i], axisRect.bottom() - labelPadding());
+ } else if (axis()->alignment() == Qt::AlignBottom) {
+ labelItem->setPos(layout[i] - center.x(), axisRect.top() - (heightDiff / 2.0) + labelPadding());
+ tickItem->setLine(layout[i], axisRect.top(), layout[i], axisRect.top() + labelPadding());
+ }
+
+ //label in between
+ bool forceHide = false;
+ if (intervalAxis() && (i + 1) != layout.size()) {
+ qreal leftBound = qMax(layout[i], gridRect.left());
+ qreal rightBound = qMin(layout[i + 1], gridRect.right());
+ const qreal delta = rightBound - leftBound;
+ // Hide label in case visible part of the category at the grid edge is too narrow
+ if (delta < boundingRect.width()
+ && (leftBound == gridRect.left() || rightBound == gridRect.right())
+ && !intervalAxis()) {
+ forceHide = true;
+ } else {
+ labelItem->setPos(leftBound + (delta / 2.0) - center.x(), labelItem->pos().y());
+ }
+ }
+
+ //label overlap detection - compensate one pixel for rounding errors
+ if ((labelItem->pos().x() < width && labelItem->toPlainText() == ellipsis) || forceHide ||
+ (labelItem->pos().x() + (widthDiff / 2.0)) < (axisRect.left() - 1.0) ||
+ (labelItem->pos().x() + (widthDiff / 2.0) - 1.0) > axisRect.right()) {
+ labelItem->setVisible(false);
+ } else {
+ labelItem->setVisible(true);
+ width = boundingRect.width() + labelItem->pos().x();
+ }
+
+ //shades
+ if ((i + 1) % 2 && i > 1) {
+ QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem *>(shades.at(i / 2 - 1));
+ qreal leftBound = qMax(layout[i - 1], gridRect.left());
+ qreal rightBound = qMin(layout[i], gridRect.right());
+ rectItem->setRect(leftBound, gridRect.top(), rightBound - leftBound, gridRect.height());
+ if (rectItem->rect().width() <= 0.0)
+ rectItem->setVisible(false);
+ else
+ rectItem->setVisible(true);
+ }
+
+ // check if the grid line and the axis tick should be shown
+ qreal x = gridItem->line().p1().x();
+ if (x < gridRect.left() || x > gridRect.right()) {
+ gridItem->setVisible(false);
+ tickItem->setVisible(false);
+ } else {
+ gridItem->setVisible(true);
+ tickItem->setVisible(true);
+ }
+
+ }
+
+ //begin/end grid line in case labels between
+ if (intervalAxis()) {
+ QGraphicsLineItem *gridLine;
+ gridLine = static_cast<QGraphicsLineItem *>(lines.at(layout.size()));
+ gridLine->setLine(gridRect.right(), gridRect.top(), gridRect.right(), gridRect.bottom());
+ gridLine->setVisible(true);
+ gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size()+1));
+ gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.left(), gridRect.bottom());
+ gridLine->setVisible(true);
+ }
+}
+
+QSizeF HorizontalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint);
+ QSizeF sh(0,0);
+
+ if (axis()->titleText().isEmpty() || !titleItem()->isVisible())
+ return sh;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(),
+ QStringLiteral("..."));
+ sh = QSizeF(titleRect.width(), titleRect.height() + (titlePadding() * 2.0));
+ break;
+ }
+ case Qt::MaximumSize:
+ case Qt::PreferredSize: {
+ QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
+ sh = QSizeF(titleRect.width(), titleRect.height() + (titlePadding() * 2.0));
+ break;
+ }
+ default:
+ break;
+ }
+
+ return sh;
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/horizontalaxis_p.h b/src/charts/axis/horizontalaxis_p.h
new file mode 100644
index 00000000..9f1ad596
--- /dev/null
+++ b/src/charts/axis/horizontalaxis_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef HORIZONTALAXIS_P_H_
+#define HORIZONTALAXIS_P_H_
+
+#include "cartesianchartaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class HorizontalAxis : public CartesianChartAxis
+{
+public:
+ HorizontalAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
+ ~HorizontalAxis();
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+protected:
+ void updateGeometry();
+
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/axis/linearrowitem_p.h b/src/charts/axis/linearrowitem_p.h
new file mode 100644
index 00000000..f1f94acd
--- /dev/null
+++ b/src/charts/axis/linearrowitem_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef LINEARROWITEM_P_H
+#define LINEARROWITEM_P_H
+
+#include "chartaxiselement_p.h"
+#include "qabstractaxis_p.h"
+#include <QGraphicsLineItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class LineArrowItem: public QGraphicsLineItem
+{
+public:
+ explicit LineArrowItem(ChartAxisElement *axis, QGraphicsItem *parent = 0)
+ : QGraphicsLineItem(parent),
+ m_axis(axis),
+ m_axisOrientation(axis->axis()->orientation())
+ {
+ }
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event)
+ {
+ Q_UNUSED(event)
+ m_axis->axisSelected();
+ }
+
+ QRectF boundingRect() const
+ {
+ return shape().boundingRect();
+ }
+
+ QPainterPath shape() const
+ {
+ QPainterPath path = QGraphicsLineItem::shape();
+ QRectF rect = path.boundingRect();
+ path.addRect(rect.adjusted(0, 0, m_axisOrientation != Qt::Horizontal ? 8 : 0, m_axisOrientation != Qt::Vertical ? 8 : 0));
+ return path;
+ }
+
+private:
+ ChartAxisElement *m_axis;
+ Qt::Orientation m_axisOrientation;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* LINEARROWITEM_P_H */
diff --git a/src/charts/axis/logvalueaxis/chartlogvalueaxisx.cpp b/src/charts/axis/logvalueaxis/chartlogvalueaxisx.cpp
new file mode 100644
index 00000000..6057fbb1
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/chartlogvalueaxisx.cpp
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartlogvalueaxisx_p.h"
+#include "chartpresenter_p.h"
+#include "qlogvalueaxis.h"
+#include "abstractchartlayout_p.h"
+#include <QGraphicsLayout>
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartLogValueAxisX::ChartLogValueAxisX(QLogValueAxis *axis, QGraphicsItem *item)
+ : HorizontalAxis(axis, item),
+ m_axis(axis)
+{
+ QObject::connect(m_axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
+ QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
+}
+
+ChartLogValueAxisX::~ChartLogValueAxisX()
+{
+}
+
+QVector<qreal> ChartLogValueAxisX::calculateLayout() const
+{
+ QVector<qreal> points;
+
+ qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
+ qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
+ qreal leftEdge = logMin < logMax ? logMin : logMax;
+ qreal ceilEdge = ceil(leftEdge);
+ int tickCount = qAbs(ceil(logMax) - ceil(logMin));
+
+ points.resize(tickCount);
+ const QRectF &gridRect = gridGeometry();
+ const qreal deltaX = gridRect.width() / qAbs(logMax - logMin);
+ for (int i = 0; i < tickCount; ++i)
+ points[i] = (ceilEdge + qreal(i)) * deltaX - leftEdge * deltaX + gridRect.left();
+
+ return points;
+}
+
+void ChartLogValueAxisX::updateGeometry()
+{
+ const QVector<qreal>& layout = ChartAxisElement::layout();
+ if (layout.isEmpty())
+ return;
+ setLabels(createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), layout.size(), m_axis->labelFormat()));
+ HorizontalAxis::updateGeometry();
+}
+
+void ChartLogValueAxisX::handleBaseChanged(qreal base)
+{
+ Q_UNUSED(base);
+ QGraphicsLayoutItem::updateGeometry();
+ if(presenter()) presenter()->layout()->invalidate();
+}
+
+void ChartLogValueAxisX::handleLabelFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if(presenter()) presenter()->layout()->invalidate();
+}
+
+QSizeF ChartLogValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+
+ QSizeF base = HorizontalAxis::sizeHint(which, constraint);
+ QStringList ticksList;
+ qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
+ qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
+ int tickCount = qAbs(ceil(logMax) - ceil(logMin));
+ if (m_axis->max() > m_axis->min() && tickCount > 0)
+ ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
+ else
+ ticksList.append(QStringLiteral(" "));
+ // Width of horizontal axis sizeHint indicates the maximum distance labels can extend past
+ // first and last ticks. Base width is irrelevant.
+ qreal width = 0;
+ qreal height = 0;
+
+ switch (which) {
+ case Qt::MinimumSize:{
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ width = boundingRect.width() / 2.0;
+ height = boundingRect.height() + labelPadding() + base.height() + 1.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize: {
+ qreal labelHeight = 0.0;
+ qreal firstWidth = -1.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelHeight = qMax(rect.height(), labelHeight);
+ width = rect.width();
+ if (firstWidth < 0.0)
+ firstWidth = width;
+ }
+ height = labelHeight + labelPadding() + base.height() + 1.0;
+ width = qMax(width, firstWidth) / 2.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+
+ return sh;
+}
+
+#include "moc_chartlogvalueaxisx_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/logvalueaxis/chartlogvalueaxisx_p.h b/src/charts/axis/logvalueaxis/chartlogvalueaxisx_p.h
new file mode 100644
index 00000000..490832b5
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/chartlogvalueaxisx_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTLOGVALUEAXISX_H
+#define CHARTLOGVALUEAXISX_H
+
+#include "horizontalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLogValueAxis;
+
+class ChartLogValueAxisX : public HorizontalAxis
+{
+ Q_OBJECT
+
+public:
+ ChartLogValueAxisX(QLogValueAxis *axis, QGraphicsItem *item);
+ ~ChartLogValueAxisX();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+
+private Q_SLOTS:
+ void handleBaseChanged(qreal base);
+ void handleLabelFormatChanged(const QString &format);
+
+private:
+ QLogValueAxis *m_axis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTLOGVALUEAXISX_H */
diff --git a/src/charts/axis/logvalueaxis/chartlogvalueaxisy.cpp b/src/charts/axis/logvalueaxis/chartlogvalueaxisy.cpp
new file mode 100644
index 00000000..d0492f97
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/chartlogvalueaxisy.cpp
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartlogvalueaxisy_p.h"
+#include "chartpresenter_p.h"
+#include "qlogvalueaxis.h"
+#include "abstractchartlayout_p.h"
+#include <QGraphicsLayout>
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartLogValueAxisY::ChartLogValueAxisY(QLogValueAxis *axis, QGraphicsItem *item)
+ : VerticalAxis(axis, item),
+ m_axis(axis)
+{
+ QObject::connect(m_axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
+ QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
+}
+
+ChartLogValueAxisY::~ChartLogValueAxisY()
+{
+}
+
+QVector<qreal> ChartLogValueAxisY::calculateLayout() const
+{
+ QVector<qreal> points;
+ qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
+ qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
+ qreal leftEdge = logMin < logMax ? logMin : logMax;
+ qreal ceilEdge = ceil(leftEdge);
+ int tickCount = qAbs(ceil(logMax) - ceil(logMin));
+
+ points.resize(tickCount);
+ const QRectF &gridRect = gridGeometry();
+ const qreal deltaY = gridRect.height() / qAbs(logMax - logMin);
+ for (int i = 0; i < tickCount; ++i)
+ points[i] = (ceilEdge + qreal(i)) * -deltaY - leftEdge * -deltaY + gridRect.bottom();
+
+ return points;
+}
+
+
+void ChartLogValueAxisY::updateGeometry()
+{
+ const QVector<qreal> &layout = ChartAxisElement::layout();
+ if (layout.isEmpty())
+ return;
+ setLabels(createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), layout.size(), m_axis->labelFormat()));
+ VerticalAxis::updateGeometry();
+}
+
+void ChartLogValueAxisY::handleBaseChanged(qreal base)
+{
+ Q_UNUSED(base);
+ QGraphicsLayoutItem::updateGeometry();
+ if(presenter()) presenter()->layout()->invalidate();
+}
+
+void ChartLogValueAxisY::handleLabelFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if(presenter()) presenter()->layout()->invalidate();
+}
+
+QSizeF ChartLogValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+
+ QSizeF base = VerticalAxis::sizeHint(which, constraint);
+ QStringList ticksList;
+ qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
+ qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
+ int tickCount = qAbs(ceil(logMax) - ceil(logMin));
+ if (m_axis->max() > m_axis->min() && tickCount > 0)
+ ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
+ else
+ ticksList.append(QStringLiteral(" "));
+ qreal width = 0;
+ // Height of vertical axis sizeHint indicates the maximum distance labels can extend past
+ // first and last ticks. Base height is irrelevant.
+ qreal height = 0;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ width = boundingRect.width() + labelPadding() + base.width() + 1.0;
+ height = boundingRect.height() / 2.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize: {
+ qreal labelWidth = 0.0;
+ qreal firstHeight = -1.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelWidth = qMax(rect.width(), labelWidth);
+ height = rect.height();
+ if (firstHeight < 0.0)
+ firstHeight = height;
+ }
+ width = labelWidth + labelPadding() + base.width() + 2.0; //two pixels of tolerance
+ height = qMax(height, firstHeight) / 2.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+
+ return sh;
+}
+
+#include "moc_chartlogvalueaxisy_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/logvalueaxis/chartlogvalueaxisy_p.h b/src/charts/axis/logvalueaxis/chartlogvalueaxisy_p.h
new file mode 100644
index 00000000..d65275c3
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/chartlogvalueaxisy_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTLOGVALUEAXISY_H
+#define CHARTLOGVALUEAXISY_H
+
+#include "verticalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLogValueAxis;
+
+class ChartLogValueAxisY : public VerticalAxis
+{
+ Q_OBJECT
+
+public:
+ ChartLogValueAxisY(QLogValueAxis *axis, QGraphicsItem *item);
+ ~ChartLogValueAxisY();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+
+private Q_SLOTS:
+ void handleBaseChanged(qreal base);
+ void handleLabelFormatChanged(const QString &format);
+
+private:
+ QLogValueAxis *m_axis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTLOGVALUEAXISY_H */
diff --git a/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp
new file mode 100644
index 00000000..f9fe664d
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartlogvalueaxisangular_p.h"
+#include "abstractchartlayout_p.h"
+#include "chartpresenter_p.h"
+#include "qlogvalueaxis.h"
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartLogValueAxisAngular::PolarChartLogValueAxisAngular(QLogValueAxis *axis, QGraphicsItem *item)
+ : PolarChartAxisAngular(axis, item)
+{
+ QObject::connect(axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
+ QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
+}
+
+PolarChartLogValueAxisAngular::~PolarChartLogValueAxisAngular()
+{
+}
+
+QVector<qreal> PolarChartLogValueAxisAngular::calculateLayout() const
+{
+ QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
+ const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base());
+ const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base());
+ const qreal startEdge = logMin < logMax ? logMin : logMax;
+ const qreal delta = 360.0 / qAbs(logMax - logMin);
+ const qreal initialSpan = (ceil(startEdge) - startEdge) * delta;
+ int tickCount = qAbs(ceil(logMax) - ceil(logMin));
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+
+ for (int i = 0; i < tickCount; ++i) {
+ qreal angularCoordinate = initialSpan + (delta * qreal(i));
+ points[i] = angularCoordinate;
+ }
+
+ return points;
+}
+
+void PolarChartLogValueAxisAngular::createAxisLabels(const QVector<qreal> &layout)
+{
+ QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
+ setLabels(createLogValueLabels(logValueAxis->min(),
+ logValueAxis->max(),
+ logValueAxis->base(),
+ layout.size(),
+ logValueAxis->labelFormat()));
+}
+
+void PolarChartLogValueAxisAngular::handleBaseChanged(qreal base)
+{
+ Q_UNUSED(base);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+void PolarChartLogValueAxisAngular::handleLabelFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+#include "moc_polarchartlogvalueaxisangular_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h
new file mode 100644
index 00000000..d56f7fdc
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTLOGVALUEAXISANGULAR_P_H
+#define POLARCHARTLOGVALUEAXISANGULAR_P_H
+
+#include "polarchartaxisangular_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLogValueAxis;
+
+class PolarChartLogValueAxisAngular : public PolarChartAxisAngular
+{
+ Q_OBJECT
+public:
+ PolarChartLogValueAxisAngular(QLogValueAxis *axis, QGraphicsItem *item);
+ ~PolarChartLogValueAxisAngular();
+
+protected:
+ virtual QVector<qreal> calculateLayout() const;
+ virtual void createAxisLabels(const QVector<qreal> &layout);
+
+private Q_SLOTS:
+ void handleBaseChanged(qreal base);
+ void handleLabelFormatChanged(const QString &format);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTLOGVALUEAXISANGULAR_P_H
diff --git a/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp
new file mode 100644
index 00000000..3c0d01b3
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartlogvalueaxisradial_p.h"
+#include "abstractchartlayout_p.h"
+#include "chartpresenter_p.h"
+#include "qlogvalueaxis.h"
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartLogValueAxisRadial::PolarChartLogValueAxisRadial(QLogValueAxis *axis, QGraphicsItem *item)
+ : PolarChartAxisRadial(axis, item)
+{
+ QObject::connect(axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
+ QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
+}
+
+PolarChartLogValueAxisRadial::~PolarChartLogValueAxisRadial()
+{
+}
+
+QVector<qreal> PolarChartLogValueAxisRadial::calculateLayout() const
+{
+ QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
+ const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base());
+ const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base());
+ const qreal innerEdge = logMin < logMax ? logMin : logMax;
+ const qreal outerEdge = logMin > logMax ? logMin : logMax;
+ const qreal delta = (axisGeometry().width() / 2.0) / qAbs(logMax - logMin);
+ const qreal initialSpan = (ceil(innerEdge) - innerEdge) * delta;
+ int tickCount = qAbs(ceil(logMax) - ceil(logMin));
+
+ // Extra tick if outer edge is exactly at the tick
+ if (outerEdge == ceil(outerEdge))
+ tickCount++;
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+
+ for (int i = 0; i < tickCount; ++i) {
+ qreal radialCoordinate = initialSpan + (delta * qreal(i));
+ points[i] = radialCoordinate;
+ }
+
+ return points;
+}
+
+void PolarChartLogValueAxisRadial::createAxisLabels(const QVector<qreal> &layout)
+{
+ QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
+ setLabels(createLogValueLabels(logValueAxis->min(),
+ logValueAxis->max(),
+ logValueAxis->base(),
+ layout.size(),
+ logValueAxis->labelFormat()));
+}
+
+void PolarChartLogValueAxisRadial::handleBaseChanged(qreal base)
+{
+ Q_UNUSED(base);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+void PolarChartLogValueAxisRadial::handleLabelFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+#include "moc_polarchartlogvalueaxisradial_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h
new file mode 100644
index 00000000..4bc59061
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTLOGVALUEAXISRADIAL_P_H
+#define POLARCHARTLOGVALUEAXISRADIAL_P_H
+
+#include "polarchartaxisradial_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLogValueAxis;
+
+class PolarChartLogValueAxisRadial : public PolarChartAxisRadial
+{
+ Q_OBJECT
+public:
+ PolarChartLogValueAxisRadial(QLogValueAxis *axis, QGraphicsItem *item);
+ ~PolarChartLogValueAxisRadial();
+
+protected:
+ virtual QVector<qreal> calculateLayout() const;
+ virtual void createAxisLabels(const QVector<qreal> &layout);
+
+private Q_SLOTS:
+ void handleBaseChanged(qreal base);
+ void handleLabelFormatChanged(const QString &format);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTLOGVALUEAXISRADIAL_P_H
diff --git a/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp b/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp
new file mode 100644
index 00000000..ad58905d
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp
@@ -0,0 +1,400 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qlogvalueaxis.h"
+#include "qlogvalueaxis_p.h"
+#include "chartlogvalueaxisx_p.h"
+#include "chartlogvalueaxisy_p.h"
+#include "polarchartlogvalueaxisangular_p.h"
+#include "polarchartlogvalueaxisradial_p.h"
+#include "abstractdomain_p.h"
+#include <float.h>
+#include <cmath>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/*!
+ \class QLogValueAxis
+ \inmodule Qt Charts
+ \brief The QLogValueAxis class is used for manipulating chart's axis.
+ \mainclass
+
+ \note If a QLogValueAxis is attached to a series with one or more points with
+ negative or zero values on the associated dimension, the series will not be
+ plotted at all. This is particularly relevant when XYModelMappers are used,
+ since empty cells in models typically contain zero values.
+*/
+
+/*!
+ \qmltype LogValueAxis
+ \instantiates QLogValueAxis
+ \inqmlmodule QtCharts
+
+ \brief The LogValueAxis element is used for manipulating chart's axes.
+ \inherits AbstractAxis
+
+ \note If a LogValueAxis is attached to a series with one or more points with
+ negative or zero values on the associated dimension, the series will not be
+ plotted at all. This is particularly relevant when XYModelMappers are used,
+ since empty cells in models typically contain zero values.
+*/
+
+/*!
+ \property QLogValueAxis::min
+ Defines the minimum value on the axis.
+ When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
+ Value has to be greater than 0.
+*/
+/*!
+ \qmlproperty real LogValueAxis::min
+ Defines the minimum value on the axis.
+ When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
+ Value has to be greater than 0.
+*/
+
+/*!
+ \property QLogValueAxis::max
+ Defines the maximum value on the axis.
+ When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
+ Value has to be greater than 0.
+*/
+/*!
+ \qmlproperty real LogValueAxis::max
+ Defines the maximum value on the axis.
+ When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
+ Value has to be greater than 0.
+*/
+
+/*!
+ \property QLogValueAxis::base
+ Defines the base of the logarithm.
+ Value has to be greater than 0 and not equal 1
+*/
+/*!
+ \qmlproperty real LogValueAxis::base
+ Defines the maximum value on the axis.
+ Defines the base of the logarithm.
+ Value has to be greater than 0 and not equal 1
+*/
+
+/*!
+ \property QLogValueAxis::labelFormat
+ Defines the label format of the axis.
+ Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
+ See QString::sprintf() for additional details.
+*/
+/*!
+ \qmlproperty real LogValueAxis::labelFormat
+ Defines the label format of the axis.
+ Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
+ See QString::sprintf() for additional details.
+*/
+
+/*!
+ \fn void QLogValueAxis::minChanged(qreal min)
+ Axis emits signal when \a min of axis has changed.
+*/
+/*!
+ \qmlsignal LogValueAxis::onMinChanged(qreal min)
+ Axis emits signal when \a min of axis has changed.
+*/
+
+/*!
+ \fn void QLogValueAxis::maxChanged(qreal max)
+ Axis emits signal when \a max of axis has changed.
+*/
+/*!
+ \qmlsignal LogValueAxis::onMaxChanged(qreal max)
+ Axis emits signal when \a max of axis has changed.
+*/
+
+/*!
+ \fn void QLogValueAxis::rangeChanged(qreal min, qreal max)
+ Axis emits signal when \a min or \a max of axis has changed.
+*/
+
+/*!
+ \fn void QLogValueAxis::labelFormatChanged(const QString &format)
+ Axis emits signal when \a format of axis labels has changed.
+*/
+/*!
+ \qmlsignal LogValueAxis::labelFormatChanged(const QString &format)
+ Axis emits signal when \a format of axis labels has changed.
+*/
+
+/*!
+ \fn void QLogValueAxis::baseChanged(qreal base)
+ Axis emits signal when \a base of logarithm of the axis has changed.
+*/
+/*!
+ \qmlsignal LogValueAxis::baseChanged(qreal base)
+ Axis emits signal when \a base of logarithm of the axis has changed.
+*/
+
+/*!
+ Constructs an axis object which is a child of \a parent.
+*/
+QLogValueAxis::QLogValueAxis(QObject *parent) :
+ QAbstractAxis(*new QLogValueAxisPrivate(this), parent)
+{
+
+}
+
+/*!
+ \internal
+*/
+QLogValueAxis::QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
+{
+
+}
+
+/*!
+ Destroys the object
+*/
+QLogValueAxis::~QLogValueAxis()
+{
+ Q_D(QLogValueAxis);
+ if (d->m_chart)
+ d->m_chart->removeAxis(this);
+}
+
+void QLogValueAxis::setMin(qreal min)
+{
+ Q_D(QLogValueAxis);
+ setRange(min, qMax(d->m_max, min));
+}
+
+qreal QLogValueAxis::min() const
+{
+ Q_D(const QLogValueAxis);
+ return d->m_min;
+}
+
+void QLogValueAxis::setMax(qreal max)
+{
+ Q_D(QLogValueAxis);
+ setRange(qMin(d->m_min, max), max);
+}
+
+qreal QLogValueAxis::max() const
+{
+ Q_D(const QLogValueAxis);
+ return d->m_max;
+}
+
+/*!
+ Sets range from \a min to \a max on the axis.
+ If min is greater than max then this function returns without making any changes.
+*/
+void QLogValueAxis::setRange(qreal min, qreal max)
+{
+ Q_D(QLogValueAxis);
+ bool changed = false;
+
+ if (min > max)
+ return;
+
+ if (min > 0) {
+ if (!qFuzzyCompare(d->m_min, min)) {
+ d->m_min = min;
+ changed = true;
+ emit minChanged(min);
+ }
+
+ if (!qFuzzyCompare(d->m_max, max)) {
+ d->m_max = max;
+ changed = true;
+ emit maxChanged(max);
+ }
+
+ if (changed) {
+ emit rangeChanged(min, max);
+ emit d->rangeChanged(min,max);
+ }
+ }
+}
+
+void QLogValueAxis::setLabelFormat(const QString &format)
+{
+ Q_D(QLogValueAxis);
+ d->m_format = format;
+ emit labelFormatChanged(format);
+}
+
+QString QLogValueAxis::labelFormat() const
+{
+ Q_D(const QLogValueAxis);
+ return d->m_format;
+}
+
+void QLogValueAxis::setBase(qreal base)
+{
+ // check if base is correct
+ if (qFuzzyCompare(base, 1))
+ return;
+
+ if (base > 0) {
+ Q_D(QLogValueAxis);
+ d->m_base = base;
+ emit baseChanged(base);
+ }
+}
+
+qreal QLogValueAxis::base() const
+{
+ Q_D(const QLogValueAxis);
+ return d->m_base;
+}
+
+/*!
+ Returns the type of the axis
+*/
+QAbstractAxis::AxisType QLogValueAxis::type() const
+{
+ return AxisTypeLogValue;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QLogValueAxisPrivate::QLogValueAxisPrivate(QLogValueAxis *q)
+ : QAbstractAxisPrivate(q),
+ m_min(1),
+ m_max(1),
+ m_base(10),
+ m_format(QString::null)
+{
+}
+
+QLogValueAxisPrivate::~QLogValueAxisPrivate()
+{
+
+}
+
+void QLogValueAxisPrivate::setMin(const QVariant &min)
+{
+ Q_Q(QLogValueAxis);
+ bool ok;
+ qreal value = min.toReal(&ok);
+ if (ok)
+ q->setMin(value);
+}
+
+void QLogValueAxisPrivate::setMax(const QVariant &max)
+{
+
+ Q_Q(QLogValueAxis);
+ bool ok;
+ qreal value = max.toReal(&ok);
+ if (ok)
+ q->setMax(value);
+}
+
+void QLogValueAxisPrivate::setRange(const QVariant &min, const QVariant &max)
+{
+ Q_Q(QLogValueAxis);
+ bool ok1;
+ bool ok2;
+ qreal value1 = min.toReal(&ok1);
+ qreal value2 = max.toReal(&ok2);
+ if (ok1 && ok2)
+ q->setRange(value1, value2);
+}
+
+void QLogValueAxisPrivate::setRange(qreal min, qreal max)
+{
+ Q_Q(QLogValueAxis);
+ bool changed = false;
+
+ if (min > max)
+ return;
+
+ if (min > 0) {
+ if (!qFuzzyCompare(m_min, min)) {
+ m_min = min;
+ changed = true;
+ emit q->minChanged(min);
+ }
+
+ if (!qFuzzyCompare(m_max, max)) {
+ m_max = max;
+ changed = true;
+ emit q->maxChanged(max);
+ }
+
+ if (changed) {
+ emit rangeChanged(min,max);
+ emit q->rangeChanged(min, max);
+ }
+ }
+}
+
+void QLogValueAxisPrivate::initializeGraphics(QGraphicsItem *parent)
+{
+ Q_Q(QLogValueAxis);
+ ChartAxisElement *axis(0);
+
+ if (m_chart->chartType() == QChart::ChartTypeCartesian) {
+ if (orientation() == Qt::Vertical)
+ axis = new ChartLogValueAxisY(q,parent);
+ if (orientation() == Qt::Horizontal)
+ axis = new ChartLogValueAxisX(q,parent);
+ }
+
+ if (m_chart->chartType() == QChart::ChartTypePolar) {
+ if (orientation() == Qt::Vertical)
+ axis = new PolarChartLogValueAxisRadial(q, parent);
+ if (orientation() == Qt::Horizontal)
+ axis = new PolarChartLogValueAxisAngular(q, parent);
+ }
+
+ m_item.reset(axis);
+ QAbstractAxisPrivate::initializeGraphics(parent);
+}
+
+
+void QLogValueAxisPrivate::initializeDomain(AbstractDomain *domain)
+{
+ if (orientation() == Qt::Vertical) {
+ if (!qFuzzyCompare(m_max, m_min)) {
+ domain->setRangeY(m_min, m_max);
+ } else if ( domain->minY() > 0) {
+ setRange(domain->minY(), domain->maxY());
+ } else if (domain->maxY() > 0) {
+ domain->setRangeY(m_min, domain->maxY());
+ } else {
+ domain->setRangeY(1, 10);
+ }
+ }
+ if (orientation() == Qt::Horizontal) {
+ if (!qFuzzyCompare(m_max, m_min)) {
+ domain->setRangeX(m_min, m_max);
+ } else if (domain->minX() > 0){
+ setRange(domain->minX(), domain->maxX());
+ } else if (domain->maxX() > 0) {
+ domain->setRangeX(m_min, domain->maxX());
+ } else {
+ domain->setRangeX(1, 10);
+ }
+ }
+}
+
+#include "moc_qlogvalueaxis.cpp"
+#include "moc_qlogvalueaxis_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/logvalueaxis/qlogvalueaxis.h b/src/charts/axis/logvalueaxis/qlogvalueaxis.h
new file mode 100644
index 00000000..2ad1f6ab
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/qlogvalueaxis.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLOGVALUEAXIS_H
+#define QLOGVALUEAXIS_H
+
+#include <QtCharts/qabstractaxis.h>
+
+class QDateTime;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLogValueAxisPrivate;
+
+class QT_CHARTS_EXPORT QLogValueAxis : public QAbstractAxis
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
+ Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
+ Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
+ Q_PROPERTY(qreal base READ base WRITE setBase NOTIFY baseChanged)
+
+public:
+ explicit QLogValueAxis(QObject *parent = 0);
+ ~QLogValueAxis();
+
+protected:
+ QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent = 0);
+
+public:
+ AxisType type() const;
+
+ //range handling
+ void setMin(qreal min);
+ qreal min() const;
+ void setMax(qreal max);
+ qreal max() const;
+ void setRange(qreal min, qreal max);
+
+ void setLabelFormat(const QString &format);
+ QString labelFormat() const;
+
+ void setBase(qreal base);
+ qreal base() const;
+
+Q_SIGNALS:
+ void minChanged(qreal min);
+ void maxChanged(qreal max);
+ void rangeChanged(qreal min, qreal max);
+ void labelFormatChanged(const QString &format);
+ void baseChanged(qreal base);
+
+private:
+ Q_DECLARE_PRIVATE(QLogValueAxis)
+ Q_DISABLE_COPY(QLogValueAxis)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QLOGVALUEAXIS_H
diff --git a/src/charts/axis/logvalueaxis/qlogvalueaxis_p.h b/src/charts/axis/logvalueaxis/qlogvalueaxis_p.h
new file mode 100644
index 00000000..741626f3
--- /dev/null
+++ b/src/charts/axis/logvalueaxis/qlogvalueaxis_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QLOGVALUEAXIS_P_H
+#define QLOGVALUEAXIS_P_H
+
+#include <qlogvalueaxis.h>
+#include "qabstractaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLogValueAxisPrivate : public QAbstractAxisPrivate
+{
+ Q_OBJECT
+ public:
+ QLogValueAxisPrivate(QLogValueAxis *q);
+ ~QLogValueAxisPrivate();
+
+ public:
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeDomain(AbstractDomain *domain);
+
+ qreal min() { return m_min; }
+ qreal max() { return m_max; }
+ void setRange(qreal min,qreal max);
+
+ protected:
+ void setMin(const QVariant &min);
+ void setMax(const QVariant &max);
+ void setRange(const QVariant &min, const QVariant &max);
+ int tickCount() const;
+
+ protected:
+ qreal m_min;
+ qreal m_max;
+ qreal m_base;
+ QString m_format;
+ Q_DECLARE_PUBLIC(QLogValueAxis)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QLOGVALUEAXIS_P_H
diff --git a/src/charts/axis/polarchartaxis.cpp b/src/charts/axis/polarchartaxis.cpp
new file mode 100644
index 00000000..bf9caaeb
--- /dev/null
+++ b/src/charts/axis/polarchartaxis.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartaxis_p.h"
+#include "qabstractaxis_p.h"
+#include "chartpresenter_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartAxis::PolarChartAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
+ : ChartAxisElement(axis, item, intervalAxis)
+{
+}
+
+PolarChartAxis::~PolarChartAxis()
+{
+
+}
+
+void PolarChartAxis::setGeometry(const QRectF &axis, const QRectF &grid)
+{
+ Q_UNUSED(grid);
+ setAxisGeometry(axis);
+
+ if (isEmpty())
+ return;
+
+ QVector<qreal> layout = calculateLayout();
+ updateLayout(layout);
+}
+
+QRectF PolarChartAxis::gridGeometry() const
+{
+ return QRectF();
+}
+
+void PolarChartAxis::updateLayout(QVector<qreal> &layout)
+{
+ int diff = ChartAxisElement::layout().size() - layout.size();
+
+ if (animation()) {
+ switch (presenter()->state()) {
+ case ChartPresenter::ZoomInState:
+ case ChartPresenter::ZoomOutState:
+ case ChartPresenter::ScrollUpState:
+ case ChartPresenter::ScrollLeftState:
+ case ChartPresenter::ScrollDownState:
+ case ChartPresenter::ScrollRightState:
+ case ChartPresenter::ShowState:
+ animation()->setAnimationType(AxisAnimation::DefaultAnimation);
+ break;
+ }
+ // Update to "old" geometry before starting animation to avoid incorrectly sized
+ // axes lingering in wrong position compared to series plot before animation can kick in.
+ // Note that the position mismatch still exists even with this update, but it will be
+ // far less ugly.
+ updateGeometry();
+ }
+
+ if (diff > 0)
+ deleteItems(diff);
+ else if (diff < 0)
+ createItems(-diff);
+
+ if (animation()) {
+ animation()->setValues(ChartAxisElement::layout(), layout);
+ presenter()->startAnimation(animation());
+ } else {
+ setLayout(layout);
+ updateGeometry();
+ }
+}
+
+bool PolarChartAxis::isEmpty()
+{
+ return !axisGeometry().isValid() || qFuzzyIsNull(min() - max());
+}
+
+void PolarChartAxis::deleteItems(int count)
+{
+ QList<QGraphicsItem *> gridLines = gridItems();
+ QList<QGraphicsItem *> labels = labelItems();
+ QList<QGraphicsItem *> shades = shadeItems();
+ QList<QGraphicsItem *> axis = arrowItems();
+
+ for (int i = 0; i < count; ++i) {
+ if (gridItems().size() == 1 || (((gridLines.size() + 1) % 2) && gridLines.size() > 0))
+ delete(shades.takeLast());
+ delete(gridLines.takeLast());
+ delete(labels.takeLast());
+ delete(axis.takeLast());
+ }
+}
+
+void PolarChartAxis::handleShadesBrushChanged(const QBrush &brush)
+{
+ foreach (QGraphicsItem *item, shadeItems())
+ static_cast<QGraphicsPathItem *>(item)->setBrush(brush);
+}
+
+void PolarChartAxis::handleShadesPenChanged(const QPen &pen)
+{
+ foreach (QGraphicsItem *item, shadeItems())
+ static_cast<QGraphicsPathItem *>(item)->setPen(pen);
+}
+
+#include "moc_polarchartaxis_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/polarchartaxis_p.h b/src/charts/axis/polarchartaxis_p.h
new file mode 100644
index 00000000..8924b812
--- /dev/null
+++ b/src/charts/axis/polarchartaxis_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTAXIS_P_H
+#define POLARCHARTAXIS_P_H
+
+#include "chartaxiselement_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class PolarChartAxis : public ChartAxisElement
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsLayoutItem)
+public:
+ PolarChartAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
+ ~PolarChartAxis();
+
+ void setGeometry(const QRectF &axis, const QRectF &grid);
+ virtual qreal preferredAxisRadius(const QSizeF &maxSize) = 0;
+ int tickWidth() { return 3; }
+
+public: // from ChartAxisElement
+ QRectF gridGeometry() const;
+ bool isEmpty();
+
+protected:
+ void updateLayout(QVector<qreal> &layout);
+
+protected: // virtual functions
+ virtual void createItems(int count) = 0;
+ virtual void createAxisLabels(const QVector<qreal> &layout) = 0;
+
+public Q_SLOTS:
+ virtual void handleShadesBrushChanged(const QBrush &brush);
+ virtual void handleShadesPenChanged(const QPen &pen);
+
+private:
+ void deleteItems(int count);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTAXIS_P_H
diff --git a/src/charts/axis/polarchartaxisangular.cpp b/src/charts/axis/polarchartaxisangular.cpp
new file mode 100644
index 00000000..83f1535c
--- /dev/null
+++ b/src/charts/axis/polarchartaxisangular.cpp
@@ -0,0 +1,433 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartaxisangular_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include "qabstractaxis.h"
+#include "qabstractaxis_p.h"
+#include <QDebug>
+#include <qmath.h>
+#include <QTextDocument>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartAxisAngular::PolarChartAxisAngular(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
+ : PolarChartAxis(axis, item, intervalAxis)
+{
+}
+
+PolarChartAxisAngular::~PolarChartAxisAngular()
+{
+}
+
+void PolarChartAxisAngular::updateGeometry()
+{
+ QGraphicsLayoutItem::updateGeometry();
+
+ const QVector<qreal> &layout = this->layout();
+ if (layout.isEmpty())
+ return;
+
+ createAxisLabels(layout);
+ QStringList labelList = labels();
+ QPointF center = axisGeometry().center();
+ QList<QGraphicsItem *> arrowItemList = arrowItems();
+ QList<QGraphicsItem *> gridItemList = gridItems();
+ QList<QGraphicsItem *> labelItemList = labelItems();
+ QList<QGraphicsItem *> shadeItemList = shadeItems();
+ QGraphicsTextItem *title = titleItem();
+
+ QGraphicsEllipseItem *axisLine = static_cast<QGraphicsEllipseItem *>(arrowItemList.at(0));
+ axisLine->setRect(axisGeometry());
+
+ qreal radius = axisGeometry().height() / 2.0;
+
+ QRectF previousLabelRect;
+ QRectF firstLabelRect;
+
+ qreal labelHeight = 0;
+
+ bool firstShade = true;
+ bool nextTickVisible = false;
+ if (layout.size())
+ nextTickVisible = !(layout.at(0) < 0.0 || layout.at(0) > 360.0);
+
+ for (int i = 0; i < layout.size(); ++i) {
+ qreal angularCoordinate = layout.at(i);
+
+ QGraphicsLineItem *gridLineItem = static_cast<QGraphicsLineItem *>(gridItemList.at(i));
+ QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrowItemList.at(i + 1));
+ QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labelItemList.at(i));
+ QGraphicsPathItem *shadeItem = 0;
+ if (i == 0)
+ shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
+ else if (i % 2)
+ shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at((i / 2) + 1));
+
+ // Ignore ticks outside valid range
+ bool currentTickVisible = nextTickVisible;
+ if ((i == layout.size() - 1)
+ || layout.at(i + 1) < 0.0
+ || layout.at(i + 1) > 360.0) {
+ nextTickVisible = false;
+ } else {
+ nextTickVisible = true;
+ }
+
+ qreal labelCoordinate = angularCoordinate;
+ qreal labelVisible = currentTickVisible;
+ if (intervalAxis()) {
+ qreal farEdge;
+ if (i == (layout.size() - 1))
+ farEdge = 360.0;
+ else
+ farEdge = qMin(qreal(360.0), layout.at(i + 1));
+
+ // Adjust the labelCoordinate to show it if next tick is visible
+ if (nextTickVisible)
+ labelCoordinate = qMax(qreal(0.0), labelCoordinate);
+
+ labelCoordinate = (labelCoordinate + farEdge) / 2.0;
+ // Don't display label once the category gets too small near the axis
+ if (labelCoordinate < 5.0 || labelCoordinate > 355.0)
+ labelVisible = false;
+ else
+ labelVisible = true;
+ }
+
+ // Need this also in label calculations, so determine it first
+ QLineF tickLine(QLineF::fromPolar(radius - tickWidth(), 90.0 - angularCoordinate).p2(),
+ QLineF::fromPolar(radius + tickWidth(), 90.0 - angularCoordinate).p2());
+ tickLine.translate(center);
+
+ // Angular axis label
+ if (axis()->labelsVisible() && labelVisible) {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ labelList.at(i),
+ axis()->labelsAngle());
+ labelItem->setTextWidth(boundingRect.width());
+ labelItem->setHtml(labelList.at(i));
+ const QRectF &rect = labelItem->boundingRect();
+ QPointF labelCenter = rect.center();
+ labelItem->setTransformOriginPoint(labelCenter.x(), labelCenter.y());
+ boundingRect.moveCenter(labelCenter);
+ QPointF positionDiff(rect.topLeft() - boundingRect.topLeft());
+
+ QPointF labelPoint;
+ if (intervalAxis()) {
+ QLineF labelLine = QLineF::fromPolar(radius + tickWidth(), 90.0 - labelCoordinate);
+ labelLine.translate(center);
+ labelPoint = labelLine.p2();
+ } else {
+ labelPoint = tickLine.p2();
+ }
+
+ QRectF labelRect = moveLabelToPosition(labelCoordinate, labelPoint, boundingRect);
+ labelItem->setPos(labelRect.topLeft() + positionDiff);
+
+ // Store height for title calculations
+ qreal labelClearance = axisGeometry().top() - labelRect.top();
+ labelHeight = qMax(labelHeight, labelClearance);
+
+ // Label overlap detection
+ if (i && (previousLabelRect.intersects(labelRect) || firstLabelRect.intersects(labelRect))) {
+ labelVisible = false;
+ } else {
+ // Store labelRect for future comparison. Some area is deducted to make things look
+ // little nicer, as usually intersection happens at label corner with angular labels.
+ labelRect.adjust(-2.0, -4.0, -2.0, -4.0);
+ if (firstLabelRect.isEmpty())
+ firstLabelRect = labelRect;
+
+ previousLabelRect = labelRect;
+ labelVisible = true;
+ }
+ }
+
+ labelItem->setVisible(labelVisible);
+ if (!currentTickVisible) {
+ gridLineItem->setVisible(false);
+ tickItem->setVisible(false);
+ if (shadeItem)
+ shadeItem->setVisible(false);
+ continue;
+ }
+
+ // Angular grid line
+ QLineF gridLine = QLineF::fromPolar(radius, 90.0 - angularCoordinate);
+ gridLine.translate(center);
+ gridLineItem->setLine(gridLine);
+ gridLineItem->setVisible(true);
+
+ // Tick
+ tickItem->setLine(tickLine);
+ tickItem->setVisible(true);
+
+ // Shades
+ if (i % 2 || (i == 0 && !nextTickVisible)) {
+ QPainterPath path;
+ path.moveTo(center);
+ if (i == 0) {
+ // If first tick is also the last, we need to custom fill the first partial arc
+ // or it won't get filled.
+ path.arcTo(axisGeometry(), 90.0 - layout.at(0), layout.at(0));
+ path.closeSubpath();
+ } else {
+ qreal nextCoordinate;
+ if (!nextTickVisible) // Last visible tick
+ nextCoordinate = 360.0;
+ else
+ nextCoordinate = layout.at(i + 1);
+ qreal arcSpan = angularCoordinate - nextCoordinate;
+ path.arcTo(axisGeometry(), 90.0 - angularCoordinate, arcSpan);
+ path.closeSubpath();
+
+ // Add additional arc for first shade item if there is a partial arc to be filled
+ if (firstShade) {
+ QGraphicsPathItem *specialShadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
+ if (layout.at(i - 1) > 0.0) {
+ QPainterPath specialPath;
+ specialPath.moveTo(center);
+ specialPath.arcTo(axisGeometry(), 90.0 - layout.at(i - 1), layout.at(i - 1));
+ specialPath.closeSubpath();
+ specialShadeItem->setPath(specialPath);
+ specialShadeItem->setVisible(true);
+ } else {
+ specialShadeItem->setVisible(false);
+ }
+ }
+ }
+ shadeItem->setPath(path);
+ shadeItem->setVisible(true);
+ firstShade = false;
+ }
+ }
+
+ // Title, centered above the chart
+ QString titleText = axis()->titleText();
+ if (!titleText.isEmpty() && axis()->isTitleVisible()) {
+ QRectF truncatedRect;
+ qreal availableTitleHeight = axisGeometry().height() - labelPadding() - titlePadding() * 2.0;
+ qreal minimumLabelHeight = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("...")).height();
+ availableTitleHeight -= minimumLabelHeight;
+ title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
+ axisGeometry().width(), availableTitleHeight,
+ truncatedRect));
+ title->setTextWidth(truncatedRect.width());
+
+ QRectF titleBoundingRect = title->boundingRect();
+ QPointF titleCenter = center - titleBoundingRect.center();
+ title->setPos(titleCenter.x(), axisGeometry().top() - titlePadding() * 2.0 - titleBoundingRect.height() - labelHeight);
+ }
+}
+
+Qt::Orientation PolarChartAxisAngular::orientation() const
+{
+ return Qt::Horizontal;
+}
+
+void PolarChartAxisAngular::createItems(int count)
+{
+ if (arrowItems().count() == 0) {
+ // angular axis line
+ QGraphicsEllipseItem *arrow = new QGraphicsEllipseItem(presenter()->rootItem());
+ arrow->setPen(axis()->linePen());
+ arrowGroup()->addToGroup(arrow);
+ }
+
+ QGraphicsTextItem *title = titleItem();
+ title->setFont(axis()->titleFont());
+ title->setDefaultTextColor(axis()->titleBrush().color());
+ title->setHtml(axis()->titleText());
+
+ for (int i = 0; i < count; ++i) {
+ QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
+ QGraphicsLineItem *grid = new QGraphicsLineItem(presenter()->rootItem());
+ QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
+ label->document()->setDocumentMargin(ChartPresenter::textMargin());
+ arrow->setPen(axis()->linePen());
+ grid->setPen(axis()->gridLinePen());
+ label->setFont(axis()->labelsFont());
+ label->setDefaultTextColor(axis()->labelsBrush().color());
+ label->setRotation(axis()->labelsAngle());
+ arrowGroup()->addToGroup(arrow);
+ gridGroup()->addToGroup(grid);
+ labelGroup()->addToGroup(label);
+ if (gridItems().size() == 1 || (((gridItems().size() + 1) % 2) && gridItems().size() > 0)) {
+ QGraphicsPathItem *shade = new QGraphicsPathItem(presenter()->rootItem());
+ shade->setPen(axis()->shadesPen());
+ shade->setBrush(axis()->shadesBrush());
+ shadeGroup()->addToGroup(shade);
+ }
+ }
+}
+
+void PolarChartAxisAngular::handleArrowPenChanged(const QPen &pen)
+{
+ bool first = true;
+ foreach (QGraphicsItem *item, arrowItems()) {
+ if (first) {
+ first = false;
+ // First arrow item is the outer circle of axis
+ static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
+ } else {
+ static_cast<QGraphicsLineItem *>(item)->setPen(pen);
+ }
+ }
+}
+
+void PolarChartAxisAngular::handleGridPenChanged(const QPen &pen)
+{
+ foreach (QGraphicsItem *item, gridItems())
+ static_cast<QGraphicsLineItem *>(item)->setPen(pen);
+}
+
+QSizeF PolarChartAxisAngular::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(which);
+ Q_UNUSED(constraint);
+ return QSizeF(-1, -1);
+}
+
+qreal PolarChartAxisAngular::preferredAxisRadius(const QSizeF &maxSize)
+{
+ qreal radius = maxSize.height() / 2.0;
+ if (maxSize.width() < maxSize.height())
+ radius = maxSize.width() / 2.0;
+
+ if (axis()->labelsVisible()) {
+ QVector<qreal> layout = calculateLayout();
+ if (layout.isEmpty())
+ return radius;
+
+ createAxisLabels(layout);
+ QStringList labelList = labels();
+ QFont font = axis()->labelsFont();
+
+ QRectF maxRect;
+ maxRect.setSize(maxSize);
+ maxRect.moveCenter(QPointF(0.0, 0.0));
+
+ // This is a horrible way to find out the maximum radius for angular axis and its labels.
+ // It just increments the radius down until everyhing fits the constraint size.
+ // Proper way would be to actually calculate it but this seems to work reasonably fast as it is.
+ bool nextTickVisible = false;
+ for (int i = 0; i < layout.size(); ) {
+ if ((i == layout.size() - 1)
+ || layout.at(i + 1) < 0.0
+ || layout.at(i + 1) > 360.0) {
+ nextTickVisible = false;
+ } else {
+ nextTickVisible = true;
+ }
+
+ qreal labelCoordinate = layout.at(i);
+ qreal labelVisible;
+
+ if (intervalAxis()) {
+ qreal farEdge;
+ if (i == (layout.size() - 1))
+ farEdge = 360.0;
+ else
+ farEdge = qMin(qreal(360.0), layout.at(i + 1));
+
+ // Adjust the labelCoordinate to show it if next tick is visible
+ if (nextTickVisible)
+ labelCoordinate = qMax(qreal(0.0), labelCoordinate);
+
+ labelCoordinate = (labelCoordinate + farEdge) / 2.0;
+ }
+
+ if (labelCoordinate < 0.0 || labelCoordinate > 360.0)
+ labelVisible = false;
+ else
+ labelVisible = true;
+
+ if (!labelVisible) {
+ i++;
+ continue;
+ }
+
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), labelList.at(i), axis()->labelsAngle());
+ QPointF labelPoint = QLineF::fromPolar(radius + tickWidth(), 90.0 - labelCoordinate).p2();
+
+ boundingRect = moveLabelToPosition(labelCoordinate, labelPoint, boundingRect);
+ QRectF intersectRect = maxRect.intersected(boundingRect);
+ if (boundingRect.isEmpty() || intersectRect == boundingRect) {
+ i++;
+ } else {
+ qreal reduction(0.0);
+ // If there is no intersection, reduce by smallest dimension of label rect to be on the safe side
+ if (intersectRect.isEmpty()) {
+ reduction = qMin(boundingRect.height(), boundingRect.width());
+ } else {
+ // Approximate needed radius reduction is the amount label rect exceeds max rect in either dimension.
+ // Could be further optimized by figuring out the proper math how to calculate exact needed reduction.
+ reduction = qMax(boundingRect.height() - intersectRect.height(),
+ boundingRect.width() - intersectRect.width());
+ }
+ // Typically the approximated reduction is little low, so add one
+ radius -= (reduction + 1.0);
+
+ if (radius < 1.0) // safeguard
+ return 1.0;
+ }
+ }
+ }
+
+ if (!axis()->titleText().isEmpty() && axis()->isTitleVisible()) {
+ QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
+
+ radius -= titlePadding() + (titleRect.height() / 2.0);
+ if (radius < 1.0) // safeguard
+ return 1.0;
+ }
+
+ return radius;
+}
+
+QRectF PolarChartAxisAngular::moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const
+{
+ if (angularCoordinate == 0.0)
+ labelRect.moveCenter(labelPoint + QPointF(0, -labelRect.height() / 2.0));
+ else if (angularCoordinate < 90.0)
+ labelRect.moveBottomLeft(labelPoint);
+ else if (angularCoordinate == 90.0)
+ labelRect.moveCenter(labelPoint + QPointF(labelRect.width() / 2.0 + 2.0, 0)); // +2 so that it does not hit the radial axis
+ else if (angularCoordinate < 180.0)
+ labelRect.moveTopLeft(labelPoint);
+ else if (angularCoordinate == 180.0)
+ labelRect.moveCenter(labelPoint + QPointF(0, labelRect.height() / 2.0));
+ else if (angularCoordinate < 270.0)
+ labelRect.moveTopRight(labelPoint);
+ else if (angularCoordinate == 270.0)
+ labelRect.moveCenter(labelPoint + QPointF(-labelRect.width() / 2.0 - 2.0, 0)); // -2 so that it does not hit the radial axis
+ else if (angularCoordinate < 360.0)
+ labelRect.moveBottomRight(labelPoint);
+ else
+ labelRect.moveCenter(labelPoint + QPointF(0, -labelRect.height() / 2.0));
+ return labelRect;
+}
+
+#include "moc_polarchartaxisangular_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/polarchartaxisangular_p.h b/src/charts/axis/polarchartaxisangular_p.h
new file mode 100644
index 00000000..dd83cba7
--- /dev/null
+++ b/src/charts/axis/polarchartaxisangular_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTAXISANGULAR_P_H
+#define POLARCHARTAXISANGULAR_P_H
+
+#include "polarchartaxis_p.h"
+#include "qvalueaxis.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class PolarChartAxisAngular : public PolarChartAxis
+{
+ Q_OBJECT
+public:
+ PolarChartAxisAngular(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
+ ~PolarChartAxisAngular();
+
+ Qt::Orientation orientation() const;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+
+ virtual void updateGeometry();
+ virtual void createItems(int count);
+
+ qreal preferredAxisRadius(const QSizeF &maxSize);
+
+public Q_SLOTS:
+ virtual void handleArrowPenChanged(const QPen &pen);
+ virtual void handleGridPenChanged(const QPen &pen);
+
+private:
+ QRectF moveLabelToPosition(qreal angularCoordinate, QPointF labelPoint, QRectF labelRect) const;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTAXISANGULAR_P_H
diff --git a/src/charts/axis/polarchartaxisradial.cpp b/src/charts/axis/polarchartaxisradial.cpp
new file mode 100644
index 00000000..93bf1bd9
--- /dev/null
+++ b/src/charts/axis/polarchartaxisradial.cpp
@@ -0,0 +1,297 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartaxisradial_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include "qabstractaxis_p.h"
+#include "linearrowitem_p.h"
+#include <QTextDocument>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartAxisRadial::PolarChartAxisRadial(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
+ : PolarChartAxis(axis, item, intervalAxis)
+{
+}
+
+PolarChartAxisRadial::~PolarChartAxisRadial()
+{
+}
+
+void PolarChartAxisRadial::updateGeometry()
+{
+ const QVector<qreal> &layout = this->layout();
+ if (layout.isEmpty())
+ return;
+
+ createAxisLabels(layout);
+ QStringList labelList = labels();
+ QPointF center = axisGeometry().center();
+ QList<QGraphicsItem *> arrowItemList = arrowItems();
+ QList<QGraphicsItem *> gridItemList = gridItems();
+ QList<QGraphicsItem *> labelItemList = labelItems();
+ QList<QGraphicsItem *> shadeItemList = shadeItems();
+ QGraphicsTextItem* title = titleItem();
+ qreal radius = axisGeometry().height() / 2.0;
+
+ QLineF line(center, center + QPointF(0, -radius));
+ QGraphicsLineItem *axisLine = static_cast<QGraphicsLineItem *>(arrowItemList.at(0));
+ axisLine->setLine(line);
+
+ QRectF previousLabelRect;
+ bool firstShade = true;
+ bool nextTickVisible = false;
+ if (layout.size())
+ nextTickVisible = !(layout.at(0) < 0.0 || layout.at(0) > radius);
+
+ for (int i = 0; i < layout.size(); ++i) {
+ qreal radialCoordinate = layout.at(i);
+
+ QGraphicsEllipseItem *gridItem = static_cast<QGraphicsEllipseItem *>(gridItemList.at(i));
+ QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrowItemList.at(i + 1));
+ QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labelItemList.at(i));
+ QGraphicsPathItem *shadeItem = 0;
+ if (i == 0)
+ shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
+ else if (i % 2)
+ shadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at((i / 2) + 1));
+
+ // Ignore ticks outside valid range
+ bool currentTickVisible = nextTickVisible;
+ if ((i == layout.size() - 1)
+ || layout.at(i + 1) < 0.0
+ || layout.at(i + 1) > radius) {
+ nextTickVisible = false;
+ } else {
+ nextTickVisible = true;
+ }
+
+ qreal labelCoordinate = radialCoordinate;
+ qreal labelVisible = currentTickVisible;
+ qreal labelPad = labelPadding() / 2.0;
+ if (intervalAxis()) {
+ qreal farEdge;
+ if (i == (layout.size() - 1))
+ farEdge = radius;
+ else
+ farEdge = qMin(radius, layout.at(i + 1));
+
+ // Adjust the labelCoordinate to show it if next tick is visible
+ if (nextTickVisible)
+ labelCoordinate = qMax(qreal(0.0), labelCoordinate);
+
+ labelCoordinate = (labelCoordinate + farEdge) / 2.0;
+ if (labelCoordinate > 0.0 && labelCoordinate < radius)
+ labelVisible = true;
+ else
+ labelVisible = false;
+ }
+
+ // Radial axis label
+ if (axis()->labelsVisible() && labelVisible) {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ labelList.at(i),
+ axis()->labelsAngle());
+ labelItem->setTextWidth(boundingRect.width());
+ labelItem->setHtml(labelList.at(i));
+ QRectF labelRect = labelItem->boundingRect();
+ QPointF labelCenter = labelRect.center();
+ labelItem->setTransformOriginPoint(labelCenter.x(), labelCenter.y());
+ boundingRect.moveCenter(labelCenter);
+ QPointF positionDiff(labelRect.topLeft() - boundingRect.topLeft());
+ QPointF labelPoint = center;
+ if (intervalAxis())
+ labelPoint += QPointF(labelPad, -labelCoordinate - (boundingRect.height() / 2.0));
+ else
+ labelPoint += QPointF(labelPad, labelPad - labelCoordinate);
+ labelRect.moveTopLeft(labelPoint);
+ labelItem->setPos(labelRect.topLeft() + positionDiff);
+
+ // Label overlap detection
+ labelRect.setSize(boundingRect.size());
+ if ((i && previousLabelRect.intersects(labelRect))
+ || !axisGeometry().contains(labelRect)) {
+ labelVisible = false;
+ } else {
+ previousLabelRect = labelRect;
+ labelVisible = true;
+ }
+ }
+
+ labelItem->setVisible(labelVisible);
+ if (!currentTickVisible) {
+ gridItem->setVisible(false);
+ tickItem->setVisible(false);
+ if (shadeItem)
+ shadeItem->setVisible(false);
+ continue;
+ }
+
+ // Radial grid line
+ QRectF gridRect;
+ gridRect.setWidth(radialCoordinate * 2.0);
+ gridRect.setHeight(radialCoordinate * 2.0);
+ gridRect.moveCenter(center);
+
+ gridItem->setRect(gridRect);
+ gridItem->setVisible(true);
+
+ // Tick
+ QLineF tickLine(-tickWidth(), 0.0, tickWidth(), 0.0);
+ tickLine.translate(center.rx(), gridRect.top());
+ tickItem->setLine(tickLine);
+ tickItem->setVisible(true);
+
+ // Shades
+ if (i % 2 || (i == 0 && !nextTickVisible)) {
+ QPainterPath path;
+ if (i == 0) {
+ // If first tick is also the last, we need to custom fill the inner circle
+ // or it won't get filled.
+ QRectF innerCircle(0.0, 0.0, layout.at(0) * 2.0, layout.at(0) * 2.0);
+ innerCircle.moveCenter(center);
+ path.addEllipse(innerCircle);
+ } else {
+ QRectF otherGridRect;
+ if (!nextTickVisible) { // Last visible tick
+ otherGridRect = axisGeometry();
+ } else {
+ qreal otherGridRectDimension = layout.at(i + 1) * 2.0;
+ otherGridRect.setWidth(otherGridRectDimension);
+ otherGridRect.setHeight(otherGridRectDimension);
+ otherGridRect.moveCenter(center);
+ }
+ path.addEllipse(gridRect);
+ path.addEllipse(otherGridRect);
+
+ // Add additional shading in first visible shade item if there is a partial tick
+ // to be filled at the center (log & category axes)
+ if (firstShade) {
+ QGraphicsPathItem *specialShadeItem = static_cast<QGraphicsPathItem *>(shadeItemList.at(0));
+ if (layout.at(i - 1) > 0.0) {
+ QRectF innerCircle(0.0, 0.0, layout.at(i - 1) * 2.0, layout.at(i - 1) * 2.0);
+ innerCircle.moveCenter(center);
+ QPainterPath specialPath;
+ specialPath.addEllipse(innerCircle);
+ specialShadeItem->setPath(specialPath);
+ specialShadeItem->setVisible(true);
+ } else {
+ specialShadeItem->setVisible(false);
+ }
+ }
+ }
+ shadeItem->setPath(path);
+ shadeItem->setVisible(true);
+ firstShade = false;
+ }
+ }
+
+ // Title, along the 0 axis
+ QString titleText = axis()->titleText();
+ if (!titleText.isEmpty() && axis()->isTitleVisible()) {
+ QRectF truncatedRect;
+ title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
+ radius, radius, truncatedRect));
+ title->setTextWidth(truncatedRect.width());
+
+ QRectF titleBoundingRect = title->boundingRect();
+ QPointF titleCenter = titleBoundingRect.center();
+ QPointF arrowCenter = axisLine->boundingRect().center();
+ QPointF titleCenterDiff = arrowCenter - titleCenter;
+ title->setPos(titleCenterDiff.x() - titlePadding() - (titleBoundingRect.height() / 2.0), titleCenterDiff.y());
+ title->setTransformOriginPoint(titleCenter);
+ title->setRotation(270.0);
+ }
+
+ QGraphicsLayoutItem::updateGeometry();
+}
+
+Qt::Orientation PolarChartAxisRadial::orientation() const
+{
+ return Qt::Vertical;
+}
+
+void PolarChartAxisRadial::createItems(int count)
+{
+ if (arrowItems().count() == 0) {
+ // radial axis center line
+ QGraphicsLineItem *arrow = new LineArrowItem(this, presenter()->rootItem());
+ arrow->setPen(axis()->linePen());
+ arrowGroup()->addToGroup(arrow);
+ }
+
+ QGraphicsTextItem *title = titleItem();
+ title->setFont(axis()->titleFont());
+ title->setDefaultTextColor(axis()->titleBrush().color());
+ title->setHtml(axis()->titleText());
+
+ for (int i = 0; i < count; ++i) {
+ QGraphicsLineItem *arrow = new QGraphicsLineItem(presenter()->rootItem());
+ QGraphicsEllipseItem *grid = new QGraphicsEllipseItem(presenter()->rootItem());
+ QGraphicsTextItem *label = new QGraphicsTextItem(presenter()->rootItem());
+ label->document()->setDocumentMargin(ChartPresenter::textMargin());
+ arrow->setPen(axis()->linePen());
+ grid->setPen(axis()->gridLinePen());
+ label->setFont(axis()->labelsFont());
+ label->setDefaultTextColor(axis()->labelsBrush().color());
+ label->setRotation(axis()->labelsAngle());
+ arrowGroup()->addToGroup(arrow);
+ gridGroup()->addToGroup(grid);
+ labelGroup()->addToGroup(label);
+ if (gridItems().size() == 1 || (((gridItems().size() + 1) % 2) && gridItems().size() > 0)) {
+ QGraphicsPathItem *shade = new QGraphicsPathItem(presenter()->rootItem());
+ shade->setPen(axis()->shadesPen());
+ shade->setBrush(axis()->shadesBrush());
+ shadeGroup()->addToGroup(shade);
+ }
+ }
+}
+
+void PolarChartAxisRadial::handleArrowPenChanged(const QPen &pen)
+{
+ foreach (QGraphicsItem *item, arrowItems())
+ static_cast<QGraphicsLineItem *>(item)->setPen(pen);
+}
+
+void PolarChartAxisRadial::handleGridPenChanged(const QPen &pen)
+{
+ foreach (QGraphicsItem *item, gridItems())
+ static_cast<QGraphicsEllipseItem *>(item)->setPen(pen);
+}
+
+QSizeF PolarChartAxisRadial::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(which);
+ Q_UNUSED(constraint);
+ return QSizeF(-1.0, -1.0);
+}
+
+qreal PolarChartAxisRadial::preferredAxisRadius(const QSizeF &maxSize)
+{
+ qreal radius = maxSize.height() / 2.0;
+ if (maxSize.width() < maxSize.height())
+ radius = maxSize.width() / 2.0;
+ return radius;
+}
+
+#include "moc_polarchartaxisradial_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/polarchartaxisradial_p.h b/src/charts/axis/polarchartaxisradial_p.h
new file mode 100644
index 00000000..6ce21513
--- /dev/null
+++ b/src/charts/axis/polarchartaxisradial_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTAXISRADIAL_P_H
+#define POLARCHARTAXISRADIAL_P_H
+
+#include "polarchartaxis_p.h"
+#include "qvalueaxis.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class PolarChartAxisRadial : public PolarChartAxis
+{
+ Q_OBJECT
+public:
+ PolarChartAxisRadial(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
+ ~PolarChartAxisRadial();
+
+ Qt::Orientation orientation() const;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+
+ virtual void updateGeometry();
+ virtual void createItems(int count);
+
+ qreal preferredAxisRadius(const QSizeF &maxSize);
+
+public Q_SLOTS:
+ virtual void handleArrowPenChanged(const QPen &pen);
+ virtual void handleGridPenChanged(const QPen &pen);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTAXISRADIAL_P_H
diff --git a/src/charts/axis/qabstractaxis.cpp b/src/charts/axis/qabstractaxis.cpp
new file mode 100644
index 00000000..ff7c27b6
--- /dev/null
+++ b/src/charts/axis/qabstractaxis.cpp
@@ -0,0 +1,1012 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractaxis.h"
+#include "qabstractaxis_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "qchart_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QAbstractAxis
+ \inmodule Qt Charts
+ \brief The QAbstractAxis class is used for manipulating chart's axis.
+ \mainclass
+
+ Each series can be bound to one or more horizontal and vertical axes, but mixing axis types
+ that would result in different domains is not supported, such as specifying
+ QValueAxis and QLogValueAxis on the same orientation.
+
+ Properties and visibility of various axis elements such as axis line, title, labels, grid lines,
+ and shades can be individually controlled.
+*/
+/*!
+ \qmltype AbstractAxis
+ \instantiates QAbstractAxis
+ \inqmlmodule QtCharts
+
+ \brief The AbstractAxis is a base element used for specialized axis elements.
+
+ Each series can be bound to only one horizontal and vertical axis.
+
+ Properties and visibility of various axis elements such as axis line, title, labels, grid lines,
+ and shades can be individually controlled.
+*/
+
+/*!
+ \enum QAbstractAxis::AxisType
+
+ The type of the series object.
+
+ \value AxisTypeNoAxis
+ \value AxisTypeValue
+ \value AxisTypeBarCategory
+ \value AxisTypeCategory
+ \value AxisTypeDateTime
+ \value AxisTypeLogValue
+*/
+
+/*!
+ *\fn void QAbstractAxis::type() const
+ Returns the type of the axis
+*/
+
+/*!
+ \property QAbstractAxis::lineVisible
+ The visibility of the axis line
+*/
+/*!
+ \qmlproperty bool AbstractAxis::lineVisible
+ The visibility of the axis line
+*/
+
+/*!
+ \property QAbstractAxis::linePen
+ The pen of the line.
+*/
+
+/*!
+ \property QAbstractAxis::labelsVisible
+ Defines if axis labels are visible.
+*/
+/*!
+ \qmlproperty bool AbstractAxis::labelsVisible
+ Defines if axis labels are visible.
+*/
+
+/*!
+ \property QAbstractAxis::labelsPen
+ \deprecated
+ The pen of the labels.
+*/
+
+/*!
+ \property QAbstractAxis::labelsBrush
+ The brush of the labels. Only the color of the brush is relevant.
+*/
+
+/*!
+ \property QAbstractAxis::visible
+ The visibility of the axis.
+*/
+/*!
+ \qmlproperty bool AbstractAxis::visible
+ The visibility of the axis.
+*/
+
+/*!
+ \property QAbstractAxis::gridVisible
+ The visibility of the grid lines.
+*/
+/*!
+ \qmlproperty bool AbstractAxis::gridVisible
+ The visibility of the grid lines.
+*/
+
+/*!
+ \property QAbstractAxis::color
+ The color of the axis and ticks.
+*/
+/*!
+ \qmlproperty color AbstractAxis::color
+ The color of the axis and ticks.
+*/
+
+/*!
+ \property QAbstractAxis::gridLinePen
+ The pen of the grid line.
+*/
+
+/*!
+ \property QAbstractAxis::labelsFont
+ The font of the axis labels.
+*/
+
+/*!
+ \qmlproperty Font AbstractAxis::labelsFont
+ The font of the axis labels.
+
+ See the Qt documentation for more details of Font.
+*/
+
+/*!
+ \property QAbstractAxis::labelsColor
+ The color of the axis labels.
+*/
+/*!
+ \qmlproperty color AbstractAxis::labelsColor
+ The color of the axis labels.
+*/
+
+/*!
+ \property QAbstractAxis::labelsAngle
+ The angle of the axis labels in degrees.
+*/
+/*!
+ \qmlproperty int AbstractAxis::labelsAngle
+ The angle of the axis labels in degrees.
+*/
+
+/*!
+ \property QAbstractAxis::shadesVisible
+ The visibility of the axis shades.
+*/
+/*!
+ \qmlproperty bool AbstractAxis::shadesVisible
+ The visibility of the axis shades.
+*/
+
+/*!
+ \property QAbstractAxis::shadesColor
+ The fill (brush) color of the axis shades.
+*/
+/*!
+ \qmlproperty color AbstractAxis::shadesColor
+ The fill (brush) color of the axis shades.
+*/
+
+/*!
+ \property QAbstractAxis::shadesBorderColor
+ The border (pen) color of the axis shades.
+*/
+/*!
+ \qmlproperty color AbstractAxis::shadesBorderColor
+ The border (pen) color of the axis shades.
+*/
+
+/*!
+ \property QAbstractAxis::shadesPen
+ The pen of the axis shades (area between grid lines).
+*/
+
+/*!
+ \property QAbstractAxis::shadesBrush
+ The brush of the axis shades (area between grid lines).
+*/
+
+/*!
+ \property QAbstractAxis::titleVisible
+ The visibility of the axis title. By default the value is true.
+*/
+/*!
+ \qmlproperty bool AbstractAxis::titleVisible
+ The visibility of the axis title. By default the value is true.
+*/
+
+/*!
+ \property QAbstractAxis::titleText
+ The title of the axis. Empty by default. Axis titles support html formatting.
+*/
+/*!
+ \qmlproperty String AbstractAxis::titleText
+ The title of the axis. Empty by default. Axis titles support html formatting.
+*/
+
+/*!
+ \property QAbstractAxis::titlePen
+ \deprecated
+ The pen of the title text.
+*/
+
+/*!
+ \property QAbstractAxis::titleBrush
+ The brush of the title text. Only the color of the brush is relevant.
+*/
+
+/*!
+ \property QAbstractAxis::titleFont
+ The font of the title of the axis.
+*/
+/*!
+ \qmlproperty Font AbstractAxis::titleFont
+ The font of the title of the axis.
+*/
+
+/*!
+ \property QAbstractAxis::orientation
+ The orientation of the axis. Fixed to either Qt::Horizontal or Qt::Vertical when you add the axis to a chart.
+*/
+/*!
+ \qmlproperty Qt.Orientation AbstractAxis::orientation
+ The orientation of the axis. Fixed to either Qt.Horizontal or Qt.Vertical when the axis is set to a series.
+*/
+
+/*!
+ \property QAbstractAxis::alignment
+ The alignment of the axis. Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop.
+*/
+/*!
+ \qmlproperty alignment AbstractAxis::alignment
+ The alignment of the axis. Can be Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom, or Qt.AlignTop.
+*/
+
+/*!
+ \fn void QAbstractAxis::visibleChanged(bool visible)
+ Visibility of the axis has changed to \a visible.
+*/
+/*!
+ \qmlsignal AbstractAxis::onVisibleChanged(bool visible)
+ Visibility of the axis has changed to \a visible.
+*/
+
+/*!
+ \fn void QAbstractAxis::linePenChanged(const QPen& pen)
+ The pen of the line of the axis has changed to \a pen.
+*/
+
+/*!
+ \fn void QAbstractAxis::lineVisibleChanged(bool visible)
+ Visibility of the axis line has changed to \a visible.
+*/
+/*!
+ \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible)
+ Visibility of the axis line has changed to \a visible.
+*/
+
+/*!
+ \fn void QAbstractAxis::labelsVisibleChanged(bool visible)
+ Visibility of the labels of the axis has changed to \a visible.
+*/
+/*!
+ \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible)
+ Visibility of the labels of the axis has changed to \a visible.
+*/
+
+/*!
+ \fn void QAbstractAxis::labelsFontChanged(const QFont& font)
+ The font of the axis labels has changed to \a font.
+*/
+/*!
+ \qmlsignal AbstractAxis::onLabelsFontChanged(Font font)
+ The font of the axis labels has changed to \a font.
+*/
+
+/*!
+ \fn void QAbstractAxis::labelsPenChanged(const QPen& pen)
+ \deprecated
+ The pen of the axis labels has changed to \a pen.
+*/
+
+/*!
+ \fn void QAbstractAxis::labelsBrushChanged(const QBrush& brush)
+ The brush of the axis labels has changed to \a brush.
+*/
+
+/*!
+ \fn void QAbstractAxis::labelsAngleChanged(int angle)
+ The angle of the axis labels has changed to \a angle.
+*/
+/*!
+ \qmlsignal AbstractAxis::onLabelsAngleChanged(int angle)
+ The angle of the axis labels has changed to \a angle.
+*/
+
+/*!
+ \fn void QAbstractAxis::gridVisibleChanged(bool visible)
+ Visibility of the grid lines of the axis has changed to \a visible.
+*/
+/*!
+ \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible)
+ Visibility of the grid lines of the axis has changed to \a visible.
+*/
+
+/*!
+ \fn void QAbstractAxis::gridLinePenChanged(const QPen& pen)
+ The pen of the grid line has changed to \a pen.
+*/
+
+/*!
+ \fn void QAbstractAxis::colorChanged(QColor color)
+ Emitted if the \a color of the axis is changed.
+*/
+/*!
+ \qmlsignal AbstractAxis::onColorChanged(QColor color)
+ Emitted if the \a color of the axis is changed.
+*/
+
+/*!
+ \fn void QAbstractAxis::labelsColorChanged(QColor color)
+ Emitted if the \a color of the axis labels is changed.
+*/
+/*!
+ \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color)
+ Emitted if the \a color of the axis labels is changed.
+*/
+
+/*!
+ \fn void QAbstractAxis::titleVisibleChanged(bool visible)
+ Visibility of the title text of the axis has changed to \a visible.
+*/
+/*!
+ \qmlsignal AbstractAxis::onTitleVisibleChanged(bool visible)
+ Visibility of the title text of the axis has changed to \a visible.
+*/
+
+/*!
+ \fn void QAbstractAxis::titleTextChanged(const QString& text)
+ The text of the axis title has changed to \a text.
+*/
+/*!
+ \qmlsignal AbstractAxis::onTitleTextChanged(String text)
+ The text of the axis title has changed to \a text.
+*/
+
+/*!
+ \fn void QAbstractAxis::titlePenChanged(const QPen& pen)
+ \deprecated
+ The pen of the axis shades has changed to \a pen.
+*/
+
+/*!
+ \fn void QAbstractAxis::titleBrushChanged(const QBrush& brush)
+ The brush of the axis title has changed to \a brush.
+*/
+
+/*!
+ \fn void QAbstractAxis::titleFontChanged(const QFont& font)
+ The font of the axis title has changed to \a font.
+*/
+/*!
+ \qmlsignal AbstractAxis::onTitleFontChanged(Font font)
+ The font of the axis title has changed to \a font.
+*/
+
+/*!
+ \fn void QAbstractAxis::shadesVisibleChanged(bool)
+ Emitted if the visibility of the axis shades is changed to \a visible.
+*/
+/*!
+ \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible)
+ Emitted if the visibility of the axis shades is changed to \a visible.
+*/
+
+/*!
+ \fn void QAbstractAxis::shadesColorChanged(QColor color)
+ Emitted if the \a color of the axis shades is changed.
+*/
+/*!
+ \qmlsignal AbstractAxis::onShadesColorChanged(QColor color)
+ Emitted if the \a color of the axis shades is changed.
+*/
+
+/*!
+ \fn void QAbstractAxis::shadesBorderColorChanged(QColor)
+ Emitted if the border \a color of the axis shades is changed.
+*/
+/*!
+ \qmlsignal AbstractAxis::onBorderColorChanged(QColor color)
+ Emitted if the border \a color of the axis shades is changed.
+*/
+
+/*!
+ \fn void QAbstractAxis::shadesBrushChanged(const QBrush& brush)
+ The brush of the axis shades has changed to \a brush.
+*/
+
+/*!
+ \fn void QAbstractAxis::shadesPenChanged(const QPen& pen)
+ The pen of the axis shades has changed to \a pen.
+*/
+
+/*!
+ \internal
+ Constructs new axis object which is a child of \a parent. Ownership is taken by
+ QChart when axis added.
+*/
+
+QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent)
+ : QObject(parent),
+ d_ptr(&d)
+{
+}
+
+/*!
+ Destructor of the axis object. When axis is added to chart, chart object takes ownership.
+*/
+
+QAbstractAxis::~QAbstractAxis()
+{
+ if (d_ptr->m_chart)
+ qFatal("Still binded axis detected !");
+}
+
+/*!
+ Sets \a pen used to draw axis line and ticks.
+ */
+void QAbstractAxis::setLinePen(const QPen &pen)
+{
+ if (d_ptr->m_axisPen != pen) {
+ d_ptr->m_axisPen = pen;
+ emit linePenChanged(pen);
+ }
+}
+
+/*!
+ Returns pen used to draw axis and ticks.
+*/
+QPen QAbstractAxis::linePen() const
+{
+ if (d_ptr->m_axisPen == QChartPrivate::defaultPen())
+ return QPen();
+ else
+ return d_ptr->m_axisPen;
+}
+
+void QAbstractAxis::setLinePenColor(QColor color)
+{
+ QPen p = d_ptr->m_axisPen;
+ if (p.color() != color) {
+ p.setColor(color);
+ setLinePen(p);
+ emit colorChanged(color);
+ }
+}
+
+QColor QAbstractAxis::linePenColor() const
+{
+ return linePen().color();
+}
+
+/*!
+ Sets if axis and ticks are \a visible.
+ */
+void QAbstractAxis::setLineVisible(bool visible)
+{
+ if (d_ptr->m_arrowVisible != visible) {
+ d_ptr->m_arrowVisible = visible;
+ emit lineVisibleChanged(visible);
+ }
+}
+
+bool QAbstractAxis::isLineVisible() const
+{
+ return d_ptr->m_arrowVisible;
+}
+
+void QAbstractAxis::setGridLineVisible(bool visible)
+{
+ if (d_ptr->m_gridLineVisible != visible) {
+ d_ptr->m_gridLineVisible = visible;
+ emit gridVisibleChanged(visible);
+ }
+}
+
+bool QAbstractAxis::isGridLineVisible() const
+{
+ return d_ptr->m_gridLineVisible;
+}
+
+/*!
+ Sets \a pen used to draw grid line.
+*/
+void QAbstractAxis::setGridLinePen(const QPen &pen)
+{
+ if (d_ptr->m_gridLinePen != pen) {
+ d_ptr->m_gridLinePen = pen;
+ emit gridLinePenChanged(pen);
+ }
+}
+
+/*!
+ Returns pen used to draw grid.
+*/
+QPen QAbstractAxis::gridLinePen() const
+{
+ if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen())
+ return QPen();
+ else
+ return d_ptr->m_gridLinePen;
+}
+
+void QAbstractAxis::setLabelsVisible(bool visible)
+{
+ if (d_ptr->m_labelsVisible != visible) {
+ d_ptr->m_labelsVisible = visible;
+ emit labelsVisibleChanged(visible);
+ }
+}
+
+bool QAbstractAxis::labelsVisible() const
+{
+ return d_ptr->m_labelsVisible;
+}
+
+void QAbstractAxis::setLabelsPen(const QPen &pen)
+{
+ if (d_ptr->m_labelsPen != pen) {
+ d_ptr->m_labelsPen = pen;
+ emit labelsPenChanged(pen);
+ }
+}
+
+QPen QAbstractAxis::labelsPen() const
+{
+ if (d_ptr->m_labelsPen == QChartPrivate::defaultPen())
+ return QPen();
+ else
+ return d_ptr->m_labelsPen;
+}
+
+/*!
+ Sets \a brush used to draw labels.
+ */
+void QAbstractAxis::setLabelsBrush(const QBrush &brush)
+{
+ if (d_ptr->m_labelsBrush != brush) {
+ d_ptr->m_labelsBrush = brush;
+ emit labelsBrushChanged(brush);
+ }
+}
+
+/*!
+ Returns brush used to draw labels.
+*/
+QBrush QAbstractAxis::labelsBrush() const
+{
+ if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush())
+ return QBrush();
+ else
+ return d_ptr->m_labelsBrush;
+}
+
+/*!
+ Sets \a font used to draw labels.
+*/
+void QAbstractAxis::setLabelsFont(const QFont &font)
+{
+ if (d_ptr->m_labelsFont != font) {
+ d_ptr->m_labelsFont = font;
+ emit labelsFontChanged(font);
+ }
+}
+
+/*!
+ Returns font used to draw labels.
+*/
+QFont QAbstractAxis::labelsFont() const
+{
+ if (d_ptr->m_labelsFont == QChartPrivate::defaultFont())
+ return QFont();
+ else
+ return d_ptr->m_labelsFont;
+}
+
+void QAbstractAxis::setLabelsAngle(int angle)
+{
+ if (d_ptr->m_labelsAngle != angle) {
+ d_ptr->m_labelsAngle = angle;
+ emit labelsAngleChanged(angle);
+ }
+}
+
+int QAbstractAxis::labelsAngle() const
+{
+ return d_ptr->m_labelsAngle;
+}
+void QAbstractAxis::setLabelsColor(QColor color)
+{
+ QBrush b = d_ptr->m_labelsBrush;
+ if (b.color() != color) {
+ b.setColor(color);
+ setLabelsBrush(b);
+ emit labelsColorChanged(color);
+ }
+}
+
+QColor QAbstractAxis::labelsColor() const
+{
+ return labelsBrush().color();
+}
+
+void QAbstractAxis::setTitleVisible(bool visible)
+{
+ if (d_ptr->m_titleVisible != visible) {
+ d_ptr->m_titleVisible = visible;
+ emit titleVisibleChanged(visible);
+ }
+}
+
+bool QAbstractAxis::isTitleVisible() const
+{
+ return d_ptr->m_titleVisible;
+}
+
+void QAbstractAxis::setTitlePen(const QPen &pen)
+{
+ if (d_ptr->m_titlePen != pen) {
+ d_ptr->m_titlePen = pen;
+ emit titlePenChanged(pen);
+ }
+}
+
+QPen QAbstractAxis::titlePen() const
+{
+ if (d_ptr->m_titlePen == QChartPrivate::defaultPen())
+ return QPen();
+ else
+ return d_ptr->m_titlePen;
+}
+
+/*!
+ Sets \a brush used to draw title.
+ */
+void QAbstractAxis::setTitleBrush(const QBrush &brush)
+{
+ if (d_ptr->m_titleBrush != brush) {
+ d_ptr->m_titleBrush = brush;
+ emit titleBrushChanged(brush);
+ }
+}
+
+/*!
+ Returns brush used to draw title.
+*/
+QBrush QAbstractAxis::titleBrush() const
+{
+ if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush())
+ return QBrush();
+ else
+ return d_ptr->m_titleBrush;
+}
+
+/*!
+ Sets \a font used to draw title.
+*/
+void QAbstractAxis::setTitleFont(const QFont &font)
+{
+ if (d_ptr->m_titleFont != font) {
+ d_ptr->m_titleFont = font;
+ emit titleFontChanged(font);
+ }
+}
+
+/*!
+ Returns font used to draw title.
+*/
+QFont QAbstractAxis::titleFont() const
+{
+ if (d_ptr->m_titleFont == QChartPrivate::defaultFont())
+ return QFont();
+ else
+ return d_ptr->m_titleFont;
+}
+
+void QAbstractAxis::setTitleText(const QString &title)
+{
+ if (d_ptr->m_title != title) {
+ d_ptr->m_title = title;
+ emit titleTextChanged(title);
+ }
+}
+
+QString QAbstractAxis::titleText() const
+{
+ return d_ptr->m_title;
+}
+
+
+void QAbstractAxis::setShadesVisible(bool visible)
+{
+ if (d_ptr->m_shadesVisible != visible) {
+ d_ptr->m_shadesVisible = visible;
+ emit shadesVisibleChanged(visible);
+ }
+}
+
+bool QAbstractAxis::shadesVisible() const
+{
+ return d_ptr->m_shadesVisible;
+}
+
+/*!
+ Sets \a pen used to draw shades.
+*/
+void QAbstractAxis::setShadesPen(const QPen &pen)
+{
+ if (d_ptr->m_shadesPen != pen) {
+ d_ptr->m_shadesPen = pen;
+ emit shadesPenChanged(pen);
+ }
+}
+
+/*!
+ Returns pen used to draw shades.
+*/
+QPen QAbstractAxis::shadesPen() const
+{
+ if (d_ptr->m_shadesPen == QChartPrivate::defaultPen())
+ return QPen();
+ else
+ return d_ptr->m_shadesPen;
+}
+
+/*!
+ Sets \a brush used to draw shades.
+*/
+void QAbstractAxis::setShadesBrush(const QBrush &brush)
+{
+ if (d_ptr->m_shadesBrush != brush) {
+ d_ptr->m_shadesBrush = brush;
+ emit shadesBrushChanged(brush);
+ }
+}
+
+/*!
+ Returns brush used to draw shades.
+*/
+QBrush QAbstractAxis::shadesBrush() const
+{
+ if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush())
+ return QBrush(Qt::SolidPattern);
+ else
+ return d_ptr->m_shadesBrush;
+}
+
+void QAbstractAxis::setShadesColor(QColor color)
+{
+ QBrush b = d_ptr->m_shadesBrush;
+ if (b.color() != color) {
+ b.setColor(color);
+ setShadesBrush(b);
+ emit shadesColorChanged(color);
+ }
+}
+
+QColor QAbstractAxis::shadesColor() const
+{
+ return shadesBrush().color();
+}
+
+void QAbstractAxis::setShadesBorderColor(QColor color)
+{
+ QPen p = d_ptr->m_shadesPen;
+ if (p.color() != color) {
+ p.setColor(color);
+ setShadesPen(p);
+ emit shadesColorChanged(color);
+ }
+}
+
+QColor QAbstractAxis::shadesBorderColor() const
+{
+ return shadesPen().color();
+}
+
+
+bool QAbstractAxis::isVisible() const
+{
+ return d_ptr->m_visible;
+}
+
+/*!
+ Sets axis, shades, labels and grid lines to be visible.
+*/
+void QAbstractAxis::setVisible(bool visible)
+{
+ if (d_ptr->m_visible != visible) {
+ d_ptr->m_visible = visible;
+ emit visibleChanged(visible);
+ }
+}
+
+
+/*!
+ Sets axis, shades, labels and grid lines to be visible.
+*/
+void QAbstractAxis::show()
+{
+ setVisible(true);
+}
+
+/*!
+ Sets axis, shades, labels and grid lines to not be visible.
+*/
+void QAbstractAxis::hide()
+{
+ setVisible(false);
+}
+
+/*!
+ Sets the minimum value shown on the axis.
+ Depending on the actual axis type the \a min parameter is converted to appropriate type.
+ If the conversion is impossible then the function call does nothing
+*/
+void QAbstractAxis::setMin(const QVariant &min)
+{
+ d_ptr->setMin(min);
+}
+
+/*!
+ Sets the maximum value shown on the axis.
+ Depending on the actual axis type the \a max parameter is converted to appropriate type.
+ If the conversion is impossible then the function call does nothing
+*/
+void QAbstractAxis::setMax(const QVariant &max)
+{
+ d_ptr->setMax(max);
+}
+
+/*!
+ Sets the range shown on the axis.
+ Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types.
+ If the conversion is impossible then the function call does nothing.
+*/
+void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
+{
+ d_ptr->setRange(min, max);
+}
+
+
+/*!
+ Returns the orientation in which the axis is being used (Vertical or Horizontal)
+*/
+Qt::Orientation QAbstractAxis::orientation()
+{
+ return d_ptr->orientation();
+}
+
+Qt::Alignment QAbstractAxis::alignment() const
+{
+ return d_ptr->alignment();
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q)
+ : q_ptr(q),
+ m_chart(0),
+ m_alignment(0),
+ m_orientation(Qt::Orientation(0)),
+ m_visible(true),
+ m_arrowVisible(true),
+ m_axisPen(QChartPrivate::defaultPen()),
+ m_axisBrush(QChartPrivate::defaultBrush()),
+ m_gridLineVisible(true),
+ m_gridLinePen(QChartPrivate::defaultPen()),
+ m_labelsVisible(true),
+ m_labelsPen(QChartPrivate::defaultPen()),
+ m_labelsBrush(QChartPrivate::defaultBrush()),
+ m_labelsFont(QChartPrivate::defaultFont()),
+ m_labelsAngle(0),
+ m_titleVisible(true),
+ m_titlePen(QChartPrivate::defaultPen()),
+ m_titleBrush(QChartPrivate::defaultBrush()),
+ m_titleFont(QChartPrivate::defaultFont()),
+ m_shadesVisible(false),
+ m_shadesPen(QChartPrivate::defaultPen()),
+ m_shadesBrush(QChartPrivate::defaultBrush()),
+ m_shadesOpacity(1.0),
+ m_dirty(false)
+{
+}
+
+QAbstractAxisPrivate::~QAbstractAxisPrivate()
+{
+}
+
+void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment)
+{
+ switch(alignment) {
+ case Qt::AlignTop:
+ case Qt::AlignBottom:
+ m_orientation = Qt::Horizontal;
+ break;
+ case Qt::AlignLeft:
+ case Qt::AlignRight:
+ m_orientation = Qt::Vertical;
+ break;
+ default:
+ qWarning()<<"No alignment specified !";
+ break;
+ };
+ m_alignment=alignment;
+}
+
+void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced)
+{
+ if (forced || QChartPrivate::defaultPen() == m_axisPen)
+ q_ptr->setLinePen(theme->axisLinePen());
+
+ if (forced || QChartPrivate::defaultPen() == m_gridLinePen)
+ q_ptr->setGridLinePen(theme->girdLinePen());
+
+ if (forced || QChartPrivate::defaultBrush() == m_labelsBrush)
+ q_ptr->setLabelsBrush(theme->labelBrush());
+ if (forced || QChartPrivate::defaultPen() == m_labelsPen)
+ q_ptr->setLabelsPen(Qt::NoPen); // NoPen for performance reasons
+ if (forced || QChartPrivate::defaultFont() == m_labelsFont)
+ q_ptr->setLabelsFont(theme->labelFont());
+
+ if (forced || QChartPrivate::defaultBrush() == m_titleBrush)
+ q_ptr->setTitleBrush(theme->labelBrush());
+ if (forced || QChartPrivate::defaultPen() == m_titlePen)
+ q_ptr->setTitlePen(Qt::NoPen); // NoPen for performance reasons
+ if (forced || QChartPrivate::defaultFont() == m_titleFont) {
+ QFont font(m_labelsFont);
+ font.setBold(true);
+ q_ptr->setTitleFont(font);
+ }
+
+ if (forced || QChartPrivate::defaultBrush() == m_shadesBrush)
+ q_ptr->setShadesBrush(theme->backgroundShadesBrush());
+ if (forced || QChartPrivate::defaultPen() == m_shadesPen)
+ q_ptr->setShadesPen(theme->backgroundShadesPen());
+
+ bool axisX = m_orientation == Qt::Horizontal;
+ if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth
+ || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX)
+ || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) {
+ q_ptr->setShadesVisible(true);
+ } else if (forced) {
+ q_ptr->setShadesVisible(false);
+ }
+}
+
+void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max)
+{
+ setRange(min,max);
+}
+
+void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_UNUSED(parent);
+}
+
+void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options)
+{
+ ChartAxisElement *axis = m_item.data();
+ Q_ASSERT(axis);
+ if (axis->animation())
+ axis->animation()->stopAndDestroyLater();
+
+ if (options.testFlag(QChart::GridAxisAnimations))
+ axis->setAnimation(new AxisAnimation(axis));
+ else
+ axis->setAnimation(0);
+}
+
+
+
+#include "moc_qabstractaxis.cpp"
+#include "moc_qabstractaxis_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/qabstractaxis.h b/src/charts/axis/qabstractaxis.h
new file mode 100644
index 00000000..cbad09e8
--- /dev/null
+++ b/src/charts/axis/qabstractaxis.h
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QABSTRACTAXIS_H
+#define QABSTRACTAXIS_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QPen>
+#include <QFont>
+#include <QVariant>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractAxisPrivate;
+
+class QT_CHARTS_EXPORT QAbstractAxis : public QObject
+{
+ Q_OBJECT
+ //visibility
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
+ //arrow
+ Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged)
+ Q_PROPERTY(QPen linePen READ linePen WRITE setLinePen NOTIFY linePenChanged)
+ Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged)
+ //labels
+ Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
+ Q_PROPERTY(QPen labelsPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged)
+ Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged)
+ Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged)
+ Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged)
+ Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged)
+ //grid
+ Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged)
+ Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged)
+ //shades
+ Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
+ Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
+ Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged)
+ Q_PROPERTY(QPen shadesPen READ shadesPen WRITE setShadesPen NOTIFY shadesPenChanged)
+ Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged)
+ //title
+ Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged)
+ Q_PROPERTY(QPen titlePen READ titlePen WRITE setTitlePen NOTIFY titlePenChanged)
+ Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged)
+ Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibleChanged)
+ Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont NOTIFY titleFontChanged)
+ //orientation
+ Q_PROPERTY(Qt::Orientation orientation READ orientation)
+ //aligment
+ Q_PROPERTY(Qt::Alignment alignment READ alignment)
+
+public:
+
+ enum AxisType {
+ AxisTypeNoAxis = 0x0,
+ AxisTypeValue = 0x1,
+ AxisTypeBarCategory = 0x2,
+ AxisTypeCategory = 0x3,
+ AxisTypeDateTime = 0x4,
+ AxisTypeLogValue = 0x5
+ };
+
+ Q_DECLARE_FLAGS(AxisTypes, AxisType)
+
+protected:
+ explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = 0);
+
+public:
+ ~QAbstractAxis();
+
+ virtual AxisType type() const = 0;
+
+ //visibility handling
+ bool isVisible() const;
+ void setVisible(bool visible = true);
+ void show();
+ void hide();
+
+ //arrow handling
+ bool isLineVisible() const;
+ void setLineVisible(bool visible = true);
+ void setLinePen(const QPen &pen);
+ QPen linePen() const;
+ void setLinePenColor(QColor color);
+ QColor linePenColor() const;
+
+ //grid handling
+ bool isGridLineVisible() const;
+ void setGridLineVisible(bool visible = true);
+ void setGridLinePen(const QPen &pen);
+ QPen gridLinePen() const;
+
+ //labels handling
+ bool labelsVisible() const;
+ void setLabelsVisible(bool visible = true);
+ void setLabelsPen(const QPen &pen);
+ QPen labelsPen() const;
+ void setLabelsBrush(const QBrush &brush);
+ QBrush labelsBrush() const;
+ void setLabelsFont(const QFont &font);
+ QFont labelsFont() const;
+ void setLabelsAngle(int angle);
+ int labelsAngle() const;
+ void setLabelsColor(QColor color);
+ QColor labelsColor() const;
+
+ //title handling
+ bool isTitleVisible() const;
+ void setTitleVisible(bool visible = true);
+ void setTitlePen(const QPen &pen);
+ QPen titlePen() const;
+ void setTitleBrush(const QBrush &brush);
+ QBrush titleBrush() const;
+ void setTitleFont(const QFont &font);
+ QFont titleFont() const;
+ void setTitleText(const QString &title);
+ QString titleText() const;
+
+ //shades handling
+ bool shadesVisible() const;
+ void setShadesVisible(bool visible = true);
+ void setShadesPen(const QPen &pen);
+ QPen shadesPen() const;
+ void setShadesBrush(const QBrush &brush);
+ QBrush shadesBrush() const;
+ void setShadesColor(QColor color);
+ QColor shadesColor() const;
+ void setShadesBorderColor(QColor color);
+ QColor shadesBorderColor() const;
+
+ Qt::Orientation orientation();
+ Qt::Alignment alignment() const;
+
+ //range handling
+ void setMin(const QVariant &min);
+ void setMax(const QVariant &max);
+ void setRange(const QVariant &min, const QVariant &max);
+
+Q_SIGNALS:
+ void visibleChanged(bool visible);
+ void linePenChanged(const QPen &pen);
+ void lineVisibleChanged(bool visible);
+ void labelsVisibleChanged(bool visible);
+ void labelsPenChanged(const QPen &pen);
+ void labelsBrushChanged(const QBrush &brush);
+ void labelsFontChanged(const QFont &pen);
+ void labelsAngleChanged(int angle);
+ void gridLinePenChanged(const QPen &pen);
+ void gridVisibleChanged(bool visible);
+ void colorChanged(QColor color);
+ void labelsColorChanged(QColor color);
+ void titleTextChanged(const QString &title);
+ void titlePenChanged(const QPen &pen);
+ void titleBrushChanged(const QBrush &brush);
+ void titleVisibleChanged(bool visible);
+ void titleFontChanged(const QFont &font);
+ void shadesVisibleChanged(bool visible);
+ void shadesColorChanged(QColor color);
+ void shadesBorderColorChanged(QColor color);
+ void shadesPenChanged(const QPen &pen);
+ void shadesBrushChanged(const QBrush &brush);
+
+protected:
+ QScopedPointer<QAbstractAxisPrivate> d_ptr;
+ Q_DISABLE_COPY(QAbstractAxis)
+ friend class ChartDataSet;
+ friend class ChartPresenter;
+ friend class ChartThemeManager;
+ friend class AbstractDomain;
+ friend class ChartAxisElement;
+ friend class XYChart;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QABSTRACTAXIS_H
diff --git a/src/charts/axis/qabstractaxis_p.h b/src/charts/axis/qabstractaxis_p.h
new file mode 100644
index 00000000..f2f60038
--- /dev/null
+++ b/src/charts/axis/qabstractaxis_p.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QABSTRACTAXIS_P_H
+#define QABSTRACTAXIS_P_H
+
+#include "qabstractaxis.h"
+#include "chartaxiselement_p.h"
+#include "qchart.h"
+#include <QDebug>
+
+class QGraphicsItem;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartPresenter;
+class AbstractDomain;
+class QChart;
+class QAbstractSeries;
+class ChartTheme;
+class ChartElement;
+
+class QT_CHARTS_AUTOTEST_EXPORT QAbstractAxisPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QAbstractAxisPrivate(QAbstractAxis *q);
+ ~QAbstractAxisPrivate();
+
+public:
+ Qt::Alignment alignment() const { return m_alignment; }
+ Qt::Orientation orientation() const { return m_orientation; }
+ void setAlignment( Qt::Alignment alignment);
+
+ virtual void initializeDomain(AbstractDomain *domain) = 0;
+ virtual void initializeGraphics(QGraphicsItem *parent) = 0;
+ virtual void initializeTheme(ChartTheme* theme, bool forced = false);
+ virtual void initializeAnimations(QChart::AnimationOptions options);
+
+ //interface for manipulating range form base class
+ virtual void setMin(const QVariant &min) = 0;
+ virtual void setMax(const QVariant &max) = 0;
+ virtual void setRange(const QVariant &min, const QVariant &max) = 0;
+
+ //interface manipulating range form domain
+ virtual void setRange(qreal min, qreal max) = 0;
+ virtual qreal min() = 0;
+ virtual qreal max() = 0;
+
+ ChartAxisElement *axisItem() { return m_item.data(); }
+
+public Q_SLOTS:
+ void handleRangeChanged(qreal min, qreal max);
+
+Q_SIGNALS:
+ void rangeChanged(qreal min, qreal max);
+
+protected:
+ QAbstractAxis *q_ptr;
+ QChart *m_chart;
+ QScopedPointer<ChartAxisElement> m_item;
+
+private:
+ QList<QAbstractSeries*> m_series;
+
+ Qt::Alignment m_alignment;
+ Qt::Orientation m_orientation;
+
+ bool m_visible;
+
+ bool m_arrowVisible;
+ QPen m_axisPen;
+ QBrush m_axisBrush;
+
+ bool m_gridLineVisible;
+ QPen m_gridLinePen;
+
+ bool m_labelsVisible;
+ QPen m_labelsPen;
+ QBrush m_labelsBrush;
+ QFont m_labelsFont;
+ int m_labelsAngle;
+
+ bool m_titleVisible;
+ QPen m_titlePen;
+ QBrush m_titleBrush;
+ QFont m_titleFont;
+ QString m_title;
+
+ bool m_shadesVisible;
+ QPen m_shadesPen;
+ QBrush m_shadesBrush;
+ qreal m_shadesOpacity;
+
+ bool m_dirty;
+
+ friend class QAbstractAxis;
+ friend class ChartDataSet;
+ friend class ChartPresenter;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/axis/valueaxis/chartvalueaxisx.cpp b/src/charts/axis/valueaxis/chartvalueaxisx.cpp
new file mode 100644
index 00000000..abf9c434
--- /dev/null
+++ b/src/charts/axis/valueaxis/chartvalueaxisx.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartvalueaxisx_p.h"
+#include "qabstractaxis.h"
+#include "chartpresenter_p.h"
+#include "qvalueaxis.h"
+#include "abstractchartlayout_p.h"
+#include <QGraphicsLayout>
+#include <qmath.h>
+#include <QDebug>
+
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartValueAxisX::ChartValueAxisX(QValueAxis *axis, QGraphicsItem *item )
+ : HorizontalAxis(axis, item),
+ m_axis(axis)
+{
+ QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
+ QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
+}
+
+ChartValueAxisX::~ChartValueAxisX()
+{
+}
+
+QVector<qreal> ChartValueAxisX::calculateLayout() const
+{
+ int tickCount = m_axis->tickCount();
+
+ Q_ASSERT(tickCount >= 2);
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+
+ const QRectF &gridRect = gridGeometry();
+ const qreal deltaX = gridRect.width() / (qreal(tickCount) - 1.0);
+ for (int i = 0; i < tickCount; ++i)
+ points[i] = qreal(i) * deltaX + gridRect.left();
+ return points;
+}
+
+void ChartValueAxisX::updateGeometry()
+{
+ const QVector<qreal>& layout = ChartAxisElement::layout();
+ if (layout.isEmpty())
+ return;
+ setLabels(createValueLabels(min(), max(), layout.size(), m_axis->labelFormat()));
+ HorizontalAxis::updateGeometry();
+}
+
+void ChartValueAxisX::handleTickCountChanged(int tick)
+{
+ Q_UNUSED(tick);
+ QGraphicsLayoutItem::updateGeometry();
+ if(presenter()) presenter()->layout()->invalidate();
+}
+
+void ChartValueAxisX::handleLabelFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if(presenter()) presenter()->layout()->invalidate();
+}
+
+QSizeF ChartValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+
+ QSizeF base = HorizontalAxis::sizeHint(which, constraint);
+ QStringList ticksList = createValueLabels(min(),max(),m_axis->tickCount(),m_axis->labelFormat());
+ // Width of horizontal axis sizeHint indicates the maximum distance labels can extend past
+ // first and last ticks. Base width is irrelevant.
+ qreal width = 0;
+ qreal height = 0;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ width = boundingRect.width() / 2.0;
+ height = boundingRect.height() + labelPadding() + base.height() + 1.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize: {
+ qreal labelHeight = 0.0;
+ qreal firstWidth = -1.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelHeight = qMax(rect.height(), labelHeight);
+ width = rect.width();
+ if (firstWidth < 0.0)
+ firstWidth = width;
+ }
+ height = labelHeight + labelPadding() + base.height() + 1.0;
+ width = qMax(width, firstWidth) / 2.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+ return sh;
+}
+
+#include "moc_chartvalueaxisx_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/valueaxis/chartvalueaxisx_p.h b/src/charts/axis/valueaxis/chartvalueaxisx_p.h
new file mode 100644
index 00000000..7f83e5a3
--- /dev/null
+++ b/src/charts/axis/valueaxis/chartvalueaxisx_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTVALUEAXISX_H
+#define CHARTVALUEAXISX_H
+
+#include "horizontalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QValueAxis;
+
+class ChartValueAxisX : public HorizontalAxis
+{
+ Q_OBJECT
+public:
+ ChartValueAxisX(QValueAxis *axis, QGraphicsItem *item = 0);
+ ~ChartValueAxisX();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+private Q_SLOTS:
+ void handleTickCountChanged(int tick);
+ void handleLabelFormatChanged(const QString &format);
+
+private:
+ QValueAxis *m_axis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTVALUEAXISX_H */
diff --git a/src/charts/axis/valueaxis/chartvalueaxisy.cpp b/src/charts/axis/valueaxis/chartvalueaxisy.cpp
new file mode 100644
index 00000000..d6b7c651
--- /dev/null
+++ b/src/charts/axis/valueaxis/chartvalueaxisy.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartvalueaxisy_p.h"
+#include "qabstractaxis.h"
+#include "chartpresenter_p.h"
+#include "qvalueaxis.h"
+#include "abstractchartlayout_p.h"
+#include <QGraphicsLayout>
+#include <qmath.h>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartValueAxisY::ChartValueAxisY(QValueAxis *axis, QGraphicsItem *item)
+ : VerticalAxis(axis, item),
+ m_axis(axis)
+{
+ QObject::connect(m_axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
+ QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
+}
+
+ChartValueAxisY::~ChartValueAxisY()
+{
+}
+
+QVector<qreal> ChartValueAxisY::calculateLayout() const
+{
+ int tickCount = m_axis->tickCount();
+
+ Q_ASSERT(tickCount >= 2);
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+
+ const QRectF &gridRect = gridGeometry();
+
+ const qreal deltaY = gridRect.height() / (qreal(tickCount) - 1.0);
+ for (int i = 0; i < tickCount; ++i)
+ points[i] = qreal(i) * -deltaY + gridRect.bottom();
+
+ return points;
+}
+
+void ChartValueAxisY::updateGeometry()
+{
+ const QVector<qreal> &layout = ChartAxisElement::layout();
+ if (layout.isEmpty())
+ return;
+ setLabels(createValueLabels(min(),max(),layout.size(),m_axis->labelFormat()));
+ VerticalAxis::updateGeometry();
+}
+
+void ChartValueAxisY::handleTickCountChanged(int tick)
+{
+ Q_UNUSED(tick);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter()) presenter()->layout()->invalidate();
+}
+
+void ChartValueAxisY::handleLabelFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if(presenter()) presenter()->layout()->invalidate();
+}
+
+QSizeF ChartValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+ QSizeF base = VerticalAxis::sizeHint(which, constraint);
+ QStringList ticksList = createValueLabels(min(),max(),m_axis->tickCount(),m_axis->labelFormat());
+ qreal width = 0;
+ // Height of vertical axis sizeHint indicates the maximum distance labels can extend past
+ // first and last ticks. Base height is irrelevant.
+ qreal height = 0;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("..."),
+ axis()->labelsAngle());
+ width = boundingRect.width() + labelPadding() + base.width() + 1.0;
+ height = boundingRect.height() / 2.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ case Qt::PreferredSize: {
+ qreal labelWidth = 0.0;
+ qreal firstHeight = -1.0;
+ foreach (const QString& s, ticksList) {
+ QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
+ labelWidth = qMax(rect.width(), labelWidth);
+ height = rect.height();
+ if (firstHeight < 0.0)
+ firstHeight = height;
+ }
+ width = labelWidth + labelPadding() + base.width() + 2.0; //two pixels of tolerance
+ height = qMax(height, firstHeight) / 2.0;
+ sh = QSizeF(width, height);
+ break;
+ }
+ default:
+ break;
+ }
+ return sh;
+}
+
+#include "moc_chartvalueaxisy_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/valueaxis/chartvalueaxisy_p.h b/src/charts/axis/valueaxis/chartvalueaxisy_p.h
new file mode 100644
index 00000000..3ec30faa
--- /dev/null
+++ b/src/charts/axis/valueaxis/chartvalueaxisy_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTVALUEAXISY_H
+#define CHARTVALUEAXISY_H
+
+#include "verticalaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QValueAxis;
+
+class ChartValueAxisY : public VerticalAxis
+{
+ Q_OBJECT
+public:
+ ChartValueAxisY(QValueAxis *axis, QGraphicsItem *item = 0);
+ ~ChartValueAxisY();
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+protected:
+ QVector<qreal> calculateLayout() const;
+ void updateGeometry();
+private Q_SLOTS:
+ void handleTickCountChanged(int tick);
+ void handleLabelFormatChanged(const QString &format);
+
+private:
+ QValueAxis *m_axis;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTVALUEAXISY_H */
diff --git a/src/charts/axis/valueaxis/polarchartvalueaxisangular.cpp b/src/charts/axis/valueaxis/polarchartvalueaxisangular.cpp
new file mode 100644
index 00000000..945449a8
--- /dev/null
+++ b/src/charts/axis/valueaxis/polarchartvalueaxisangular.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartvalueaxisangular_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartValueAxisAngular::PolarChartValueAxisAngular(QValueAxis *axis, QGraphicsItem *item)
+ : PolarChartAxisAngular(axis, item)
+{
+ QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
+ QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
+}
+
+PolarChartValueAxisAngular::~PolarChartValueAxisAngular()
+{
+}
+
+QVector<qreal> PolarChartValueAxisAngular::calculateLayout() const
+{
+ int tickCount = static_cast<QValueAxis *>(axis())->tickCount();
+ Q_ASSERT(tickCount >= 2);
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+
+ const qreal d = 360.0 / qreal(tickCount - 1);
+
+ for (int i = 0; i < tickCount; ++i) {
+ qreal angularCoordinate = qreal(i) * d;
+ points[i] = angularCoordinate;
+ }
+
+ return points;
+}
+
+void PolarChartValueAxisAngular::createAxisLabels(const QVector<qreal> &layout)
+{
+ QStringList labelList = createValueLabels(min(), max(), layout.size(), static_cast<QValueAxis *>(axis())->labelFormat());
+ setLabels(labelList);
+}
+
+void PolarChartValueAxisAngular::handleTickCountChanged(int tick)
+{
+ Q_UNUSED(tick);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+void PolarChartValueAxisAngular::handleLabelFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+#include "moc_polarchartvalueaxisangular_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/valueaxis/polarchartvalueaxisangular_p.h b/src/charts/axis/valueaxis/polarchartvalueaxisangular_p.h
new file mode 100644
index 00000000..d4a2f653
--- /dev/null
+++ b/src/charts/axis/valueaxis/polarchartvalueaxisangular_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTVALUEAXISANGULAR_P_H
+#define POLARCHARTVALUEAXISANGULAR_P_H
+
+#include "polarchartaxisangular_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QValueAxis;
+
+class PolarChartValueAxisAngular : public PolarChartAxisAngular
+{
+ Q_OBJECT
+public:
+ PolarChartValueAxisAngular(QValueAxis *axis, QGraphicsItem *item);
+ ~PolarChartValueAxisAngular();
+
+ virtual QVector<qreal> calculateLayout() const;
+ virtual void createAxisLabels(const QVector<qreal> &layout);
+
+private Q_SLOTS:
+ void handleTickCountChanged(int tick);
+ void handleLabelFormatChanged(const QString &format);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTVALUEAXISANGULAR_P_H
diff --git a/src/charts/axis/valueaxis/polarchartvalueaxisradial.cpp b/src/charts/axis/valueaxis/polarchartvalueaxisradial.cpp
new file mode 100644
index 00000000..006477e8
--- /dev/null
+++ b/src/charts/axis/valueaxis/polarchartvalueaxisradial.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartvalueaxisradial_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarChartValueAxisRadial::PolarChartValueAxisRadial(QValueAxis *axis, QGraphicsItem *item)
+ : PolarChartAxisRadial(axis, item)
+{
+ QObject::connect(axis, SIGNAL(tickCountChanged(int)), this, SLOT(handleTickCountChanged(int)));
+ QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
+}
+
+PolarChartValueAxisRadial::~PolarChartValueAxisRadial()
+{
+}
+
+QVector<qreal> PolarChartValueAxisRadial::calculateLayout() const
+{
+ int tickCount = static_cast<QValueAxis *>(axis())->tickCount();
+ Q_ASSERT(tickCount >= 2);
+
+ QVector<qreal> points;
+ points.resize(tickCount);
+
+ const qreal d = (axisGeometry().width() / 2) / qreal(tickCount - 1);
+
+ for (int i = 0; i < tickCount; ++i) {
+ qreal radialCoordinate = qreal(i) * d;
+ points[i] = radialCoordinate;
+ }
+
+ return points;
+}
+
+void PolarChartValueAxisRadial::createAxisLabels(const QVector<qreal> &layout)
+{
+ setLabels(createValueLabels(min(), max(), layout.size(), static_cast<QValueAxis *>(axis())->labelFormat()));
+}
+
+void PolarChartValueAxisRadial::handleTickCountChanged(int tick)
+{
+ Q_UNUSED(tick);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+void PolarChartValueAxisRadial::handleLabelFormatChanged(const QString &format)
+{
+ Q_UNUSED(format);
+ QGraphicsLayoutItem::updateGeometry();
+ if (presenter())
+ presenter()->layout()->invalidate();
+}
+
+#include "moc_polarchartvalueaxisradial_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/valueaxis/polarchartvalueaxisradial_p.h b/src/charts/axis/valueaxis/polarchartvalueaxisradial_p.h
new file mode 100644
index 00000000..4e13b57a
--- /dev/null
+++ b/src/charts/axis/valueaxis/polarchartvalueaxisradial_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTVALUEAXISRADIAL_P_H
+#define POLARCHARTVALUEAXISRADIAL_P_H
+
+#include "polarchartaxisradial_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QValueAxis;
+
+class PolarChartValueAxisRadial : public PolarChartAxisRadial
+{
+ Q_OBJECT
+public:
+ PolarChartValueAxisRadial(QValueAxis *axis, QGraphicsItem *item);
+ ~PolarChartValueAxisRadial();
+
+ virtual QVector<qreal> calculateLayout() const;
+ virtual void createAxisLabels(const QVector<qreal> &layout);
+
+private Q_SLOTS:
+ void handleTickCountChanged(int tick);
+ void handleLabelFormatChanged(const QString &format);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTVALUEAXISRADIAL_P_H
diff --git a/src/charts/axis/valueaxis/qvalueaxis.cpp b/src/charts/axis/valueaxis/qvalueaxis.cpp
new file mode 100644
index 00000000..a055dc22
--- /dev/null
+++ b/src/charts/axis/valueaxis/qvalueaxis.cpp
@@ -0,0 +1,459 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvalueaxis.h"
+#include "qvalueaxis_p.h"
+#include "chartvalueaxisx_p.h"
+#include "chartvalueaxisy_p.h"
+#include "abstractdomain_p.h"
+#include "polarchartvalueaxisangular_p.h"
+#include "polarchartvalueaxisradial_p.h"
+#include "chartdataset_p.h"
+#include "chartpresenter_p.h"
+#include "charttheme_p.h"
+
+
+QT_CHARTS_BEGIN_NAMESPACE
+/*!
+ \class QValueAxis
+ \inmodule Qt Charts
+ \brief The QValueAxis class is used for manipulating chart's axis.
+ \mainclass
+
+ ValueAxis can be setup to show axis line with tick marks, grid lines and shades.
+ Values of axis are drawn to position of ticks.
+
+ Example code on how to use QValueAxis.
+ \code
+ QChartView *chartView = new QChartView;
+ QLineSeries *series = new QLineSeries;
+ // ...
+ chartView->chart()->addSeries(series);
+
+ QValueAxis *axisX = new QValueAxis;
+ axisX->setRange(10, 20.5);
+ axisX->setTickCount(10);
+ axisX->setLabelFormat("%.2f");
+ chartView->chart()->setAxisX(axisX, series);
+ \endcode
+*/
+/*!
+ \qmltype ValueAxis
+ \instantiates QValueAxis
+ \inqmlmodule QtCharts
+
+ \inherits AbstractAxis
+ \brief The ValueAxis element is used for manipulating chart's axes
+
+ ValueAxis can be setup to show axis line with tick marks, grid lines and shades.
+ Values of axis are drawn to position of ticks
+
+ Example about using ValueAxis:
+ \code
+ ChartView {
+ ValueAxis {
+ id: xAxis
+ min: 0
+ max: 10
+ }
+ // Add a few series...
+ }
+ \endcode
+*/
+
+/*!
+ \property QValueAxis::min
+ Defines the minimum value on the axis.
+ When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
+*/
+/*!
+ \qmlproperty real ValueAxis::min
+ Defines the minimum value on the axis.
+ When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
+*/
+
+/*!
+ \property QValueAxis::max
+ Defines the maximum value on the axis.
+ When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
+*/
+/*!
+ \qmlproperty real ValueAxis::max
+ Defines the maximum value on the axis.
+ When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
+*/
+
+/*!
+ \property QValueAxis::tickCount
+ Defines the number of ticks on the axis. This indicates how many grid lines are draw on the chart.
+ The default value is 5, and it can not be below 2.
+*/
+/*!
+ \qmlproperty real ValueAxis::tickCount
+ Defines the number of ticks on the axis. This indicates how many grid lines are draw on the chart.
+ The default value is 5, and it can not be below 2.
+*/
+
+/*!
+ \property QValueAxis::labelFormat
+ Defines the label format of the axis.
+ Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, and c.
+ See QString::sprintf() for additional details.
+
+ If the QChart::localizeNumbers is \c{true}, the supported specifiers are limited to: d, e, E, f,
+ g, G, and i. Also, only the precision modifier is supported. The rest of the formatting comes from
+ the default QLocale of the application.
+*/
+/*!
+ \qmlproperty real ValueAxis::labelFormat
+ Defines the label format of the axis.
+ Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, and c.
+ See QString::sprintf() for additional details.
+
+ If the ChartView::localizeNumbers is \c{true}, the supported specifiers are limited to: d, e, E, f,
+ g, G, and i. Also, only the precision modifier is supported. The rest of the formatting comes from
+ the default QLocale of the application.
+*/
+
+/*!
+ \fn void QValueAxis::minChanged(qreal min)
+ Axis emits signal when \a min of axis has changed.
+*/
+/*!
+ \qmlsignal ValueAxis::onMinChanged(real min)
+ Axis emits signal when \a min of axis has changed.
+*/
+
+/*!
+ \fn void QValueAxis::maxChanged(qreal max)
+ Axis emits signal when \a max of axis has changed.
+*/
+/*!
+ \qmlsignal ValueAxis::onMaxChanged(real max)
+ Axis emits signal when \a max of axis has changed.
+*/
+
+/*!
+ \fn void QValueAxis::tickCountChanged(int tickCount)
+ Axis emits signal when \a tickCount of axis has changed.
+*/
+/*!
+ \qmlsignal ValueAxis::tickCountChanged(int tickCount)
+ Axis emits signal when \a tickCount of axis has changed.
+*/
+
+/*!
+ \fn void QValueAxis::rangeChanged(qreal min, qreal max)
+ Axis emits signal when \a min or \a max of axis has changed.
+*/
+
+/*!
+ \fn void QValueAxis::labelFormatChanged(const QString &format)
+ Axis emits signal when \a format of axis labels has changed.
+*/
+/*!
+ \qmlsignal ValueAxis::labelFormatChanged(const QString &format)
+ Axis emits signal when \a format of axis labels has changed.
+*/
+
+/*!
+ \property QValueAxis::niceNumbersEnabled
+ \obsolete
+ Using this function can lead to unexpected behavior. Use applyNiceNumbers() instead.
+*/
+
+/*!
+ \qmlproperty bool ValueAxis::niceNumbersEnabled
+ Deprecated; Using this function can lead to unexpected behavior. Use applyNiceNumbers() instead.
+*/
+
+/*!
+ Constructs an axis object which is a child of \a parent.
+*/
+QValueAxis::QValueAxis(QObject *parent) :
+ QAbstractAxis(*new QValueAxisPrivate(this), parent)
+{
+
+}
+
+/*!
+ \internal
+*/
+QValueAxis::QValueAxis(QValueAxisPrivate &d, QObject *parent)
+ : QAbstractAxis(d, parent)
+{
+
+}
+
+/*!
+ Destroys the object
+*/
+QValueAxis::~QValueAxis()
+{
+ Q_D(QValueAxis);
+ if (d->m_chart)
+ d->m_chart->removeAxis(this);
+}
+
+void QValueAxis::setMin(qreal min)
+{
+ Q_D(QValueAxis);
+ setRange(min, qMax(d->m_max, min));
+}
+
+qreal QValueAxis::min() const
+{
+ Q_D(const QValueAxis);
+ return d->m_min;
+}
+
+void QValueAxis::setMax(qreal max)
+{
+ Q_D(QValueAxis);
+ setRange(qMin(d->m_min, max), max);
+}
+
+qreal QValueAxis::max() const
+{
+ Q_D(const QValueAxis);
+ return d->m_max;
+}
+
+/*!
+ Sets range from \a min to \a max on the axis.
+ If min is greater than max then this function returns without making any changes.
+*/
+void QValueAxis::setRange(qreal min, qreal max)
+{
+ Q_D(QValueAxis);
+ d->setRange(min,max);
+}
+
+void QValueAxis::setTickCount(int count)
+{
+ Q_D(QValueAxis);
+ if (d->m_tickCount != count && count >= 2) {
+ d->m_tickCount = count;
+ emit tickCountChanged(count);
+ }
+}
+
+int QValueAxis::tickCount() const
+{
+ Q_D(const QValueAxis);
+ return d->m_tickCount;
+}
+
+void QValueAxis::setNiceNumbersEnabled(bool enable)
+{
+ Q_D(QValueAxis);
+ qWarning() << "Deprecated; Using this function can lead to unexpected behavior. " \
+ "Use applyNiceNumbers() instead.";
+ if(enable) {
+ QObject::connect(this,SIGNAL(rangeChanged(qreal,qreal)),this,SLOT(applyNiceNumbers()));
+ QObject::connect(this,SIGNAL(tickCountChanged(int)),this,SLOT(applyNiceNumbers()));
+ applyNiceNumbers();
+ }
+ else {
+ QObject::disconnect(this,SIGNAL(rangeChanged(qreal,qreal)),this,SLOT(applyNiceNumbers()));
+ QObject::disconnect(this,SIGNAL(tickCountChanged(int)),this,SLOT(applyNiceNumbers()));
+ }
+ d->m_niceNumbersEnabled=enable;
+}
+
+bool QValueAxis::niceNumbersEnabled() const
+{
+ Q_D(const QValueAxis);
+ qWarning() << "Deprecated; Using this function can lead to unexpected behavior. " \
+ "Use applyNiceNumbers() instead.";
+ return d->m_niceNumbersEnabled;
+}
+
+void QValueAxis::setLabelFormat(const QString &format)
+{
+ Q_D(QValueAxis);
+ d->m_format = format;
+ emit labelFormatChanged(format);
+}
+
+QString QValueAxis::labelFormat() const
+{
+ Q_D(const QValueAxis);
+ return d->m_format;
+}
+
+/*!
+ Returns the type of the axis
+*/
+QAbstractAxis::AxisType QValueAxis::type() const
+{
+ return AxisTypeValue;
+}
+
+/*!
+ This method modifies range and number of ticks on the axis to look "nice". Algorithm considers numbers that
+ can be expressed as form of 1*10^n, 2* 10^n or 5*10^n as a nice numbers. These numbers are used for spacing the ticks.
+ This method will modify the current range and number of ticks.
+ \sa setRange(), setTickCount()
+*/
+void QValueAxis::applyNiceNumbers()
+{
+ Q_D(QValueAxis);
+ if(d->m_applying) return;
+ qreal min = d->m_min;
+ qreal max = d->m_max;
+ int ticks = d->m_tickCount;
+ AbstractDomain::looseNiceNumbers(min,max,ticks);
+ d->m_applying=true;
+ d->setRange(min,max);
+ setTickCount(ticks);
+ d->m_applying=false;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QValueAxisPrivate::QValueAxisPrivate(QValueAxis *q)
+ : QAbstractAxisPrivate(q),
+ m_min(0),
+ m_max(0),
+ m_tickCount(5),
+ m_format(QString::null),
+ m_applying(false),
+ m_niceNumbersEnabled(false)
+{
+
+}
+
+QValueAxisPrivate::~QValueAxisPrivate()
+{
+
+}
+
+void QValueAxisPrivate::setMin(const QVariant &min)
+{
+ Q_Q(QValueAxis);
+ bool ok;
+ qreal value = min.toReal(&ok);
+ if (ok)
+ q->setMin(value);
+}
+
+void QValueAxisPrivate::setMax(const QVariant &max)
+{
+ Q_Q(QValueAxis);
+ bool ok;
+ qreal value = max.toReal(&ok);
+ if (ok)
+ q->setMax(value);
+}
+
+void QValueAxisPrivate::setRange(const QVariant &min, const QVariant &max)
+{
+ Q_Q(QValueAxis);
+ bool ok1;
+ bool ok2;
+ qreal value1 = min.toReal(&ok1);
+ qreal value2 = max.toReal(&ok2);
+ if (ok1 && ok2)
+ q->setRange(value1, value2);
+}
+
+void QValueAxisPrivate::setRange(qreal min, qreal max)
+{
+ Q_Q(QValueAxis);
+ bool changed = false;
+
+ if (min > max)
+ return;
+
+ bool changeMin = false;
+ if (m_min == 0 || min == 0)
+ changeMin = !qFuzzyCompare(1 + m_min, 1 + min);
+ else
+ changeMin = !qFuzzyCompare(m_min, min);
+
+ bool changeMax = false;
+ if (m_max == 0 || max == 0)
+ changeMax = !qFuzzyCompare(1 + m_max, 1 + max);
+ else
+ changeMax = !qFuzzyCompare(m_max, max);
+
+ if (changeMin) {
+ m_min = min;
+ changed = true;
+ emit q->minChanged(min);
+ }
+
+ if (changeMax) {
+ m_max = max;
+ changed = true;
+ emit q->maxChanged(max);
+ }
+
+ if (changed) {
+ emit rangeChanged(min,max);
+ emit q->rangeChanged(min, max);
+ }
+}
+
+void QValueAxisPrivate::initializeGraphics(QGraphicsItem *parent)
+{
+ Q_Q(QValueAxis);
+ ChartAxisElement *axis(0);
+
+ if (m_chart->chartType() == QChart::ChartTypeCartesian) {
+ if (orientation() == Qt::Vertical)
+ axis = new ChartValueAxisY(q,parent);
+ if (orientation() == Qt::Horizontal)
+ axis = new ChartValueAxisX(q,parent);
+ }
+
+ if (m_chart->chartType() == QChart::ChartTypePolar) {
+ if (orientation() == Qt::Vertical)
+ axis = new PolarChartValueAxisRadial(q, parent);
+ if (orientation() == Qt::Horizontal)
+ axis = new PolarChartValueAxisAngular(q, parent);
+ }
+
+ m_item.reset(axis);
+ QAbstractAxisPrivate::initializeGraphics(parent);
+}
+
+
+void QValueAxisPrivate::initializeDomain(AbstractDomain *domain)
+{
+ if (orientation() == Qt::Vertical) {
+ if (!qFuzzyIsNull(m_max - m_min))
+ domain->setRangeY(m_min, m_max);
+ else
+ setRange(domain->minY(), domain->maxY());
+ }
+ if (orientation() == Qt::Horizontal) {
+ if (!qFuzzyIsNull(m_max - m_min))
+ domain->setRangeX(m_min, m_max);
+ else
+ setRange(domain->minX(), domain->maxX());
+ }
+}
+
+#include "moc_qvalueaxis.cpp"
+#include "moc_qvalueaxis_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/valueaxis/qvalueaxis.h b/src/charts/axis/valueaxis/qvalueaxis.h
new file mode 100644
index 00000000..a51203a4
--- /dev/null
+++ b/src/charts/axis/valueaxis/qvalueaxis.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVALUEAXIS_H
+#define QVALUEAXIS_H
+
+#include <QtCharts/qabstractaxis.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QValueAxisPrivate;
+
+class QT_CHARTS_EXPORT QValueAxis : public QAbstractAxis
+{
+ Q_OBJECT
+ Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount NOTIFY tickCountChanged)
+ Q_PROPERTY(bool niceNumbersEnabled READ niceNumbersEnabled WRITE setNiceNumbersEnabled)
+ Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
+ Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
+ Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
+
+public:
+ explicit QValueAxis(QObject *parent = 0);
+ ~QValueAxis();
+
+protected:
+ QValueAxis(QValueAxisPrivate &d, QObject *parent = 0);
+
+public:
+ AxisType type() const;
+
+ //range handling
+ void setMin(qreal min);
+ qreal min() const;
+ void setMax(qreal max);
+ qreal max() const;
+ void setRange(qreal min, qreal max);
+
+ //ticks handling
+ void setTickCount(int count);
+ int tickCount() const;
+
+ void setLabelFormat(const QString &format);
+ QString labelFormat() const;
+
+ void setNiceNumbersEnabled(bool enable = true);
+ bool niceNumbersEnabled() const;
+
+public Q_SLOTS:
+ void applyNiceNumbers();
+
+Q_SIGNALS:
+ void minChanged(qreal min);
+ void maxChanged(qreal max);
+ void rangeChanged(qreal min, qreal max);
+ void tickCountChanged(int tickCount);
+ void labelFormatChanged(const QString &format);
+
+private:
+ Q_DECLARE_PRIVATE(QValueAxis)
+ Q_DISABLE_COPY(QValueAxis)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QVALUEAXIS_H
diff --git a/src/charts/axis/valueaxis/qvalueaxis_p.h b/src/charts/axis/valueaxis/qvalueaxis_p.h
new file mode 100644
index 00000000..a1d9de5b
--- /dev/null
+++ b/src/charts/axis/valueaxis/qvalueaxis_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QVALUEAXIS_P_H
+#define QVALUEAXIS_P_H
+
+#include <qvalueaxis.h>
+#include "qabstractaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QValueAxisPrivate : public QAbstractAxisPrivate
+{
+ Q_OBJECT
+public:
+ QValueAxisPrivate(QValueAxis *q);
+ ~QValueAxisPrivate();
+
+public:
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeDomain(AbstractDomain *domain);
+
+ qreal min() { return m_min; };
+ qreal max() { return m_max; };
+ void setRange(qreal min,qreal max);
+
+protected:
+ void setMin(const QVariant &min);
+ void setMax(const QVariant &max);
+ void setRange(const QVariant &min, const QVariant &max);
+
+private:
+ qreal m_min;
+ qreal m_max;
+ int m_tickCount;
+ QString m_format;
+ bool m_applying;
+ bool m_niceNumbersEnabled;
+ Q_DECLARE_PUBLIC(QValueAxis)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QVALUEAXIS_P_H
diff --git a/src/charts/axis/verticalaxis.cpp b/src/charts/axis/verticalaxis.cpp
new file mode 100644
index 00000000..64c940f1
--- /dev/null
+++ b/src/charts/axis/verticalaxis.cpp
@@ -0,0 +1,231 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "verticalaxis_p.h"
+#include "qabstractaxis.h"
+#include "chartpresenter_p.h"
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+VerticalAxis::VerticalAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
+ : CartesianChartAxis(axis, item, intervalAxis)
+{
+}
+
+VerticalAxis::~VerticalAxis()
+{
+}
+
+void VerticalAxis::updateGeometry()
+{
+ const QVector<qreal> &layout = ChartAxisElement::layout();
+
+ if (layout.isEmpty())
+ return;
+
+ QStringList labelList = labels();
+
+ QList<QGraphicsItem *> lines = gridItems();
+ QList<QGraphicsItem *> labels = labelItems();
+ QList<QGraphicsItem *> shades = shadeItems();
+ QList<QGraphicsItem *> arrow = arrowItems();
+ QGraphicsTextItem *title = titleItem();
+
+ Q_ASSERT(labels.size() == labelList.size());
+ Q_ASSERT(layout.size() == labelList.size());
+
+ const QRectF &axisRect = axisGeometry();
+ const QRectF &gridRect = gridGeometry();
+
+ qreal height = axisRect.bottom();
+
+
+ //arrow
+ QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem*>(arrow.at(0));
+
+ //arrow position
+ if (axis()->alignment() == Qt::AlignLeft)
+ arrowItem->setLine(axisRect.right(), gridRect.top(), axisRect.right(), gridRect.bottom());
+ else if (axis()->alignment() == Qt::AlignRight)
+ arrowItem->setLine(axisRect.left(), gridRect.top(), axisRect.left(), gridRect.bottom());
+
+ //title
+ QRectF titleBoundingRect;
+ QString titleText = axis()->titleText();
+ qreal availableSpace = axisRect.width() - labelPadding();
+ if (!titleText.isEmpty() && titleItem()->isVisible()) {
+ availableSpace -= titlePadding() * 2.0;
+ qreal minimumLabelWidth = ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ QStringLiteral("...")).width();
+ qreal titleSpace = availableSpace - minimumLabelWidth;
+ title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(90.0),
+ titleSpace, gridRect.height(),
+ titleBoundingRect));
+ title->setTextWidth(titleBoundingRect.height());
+
+ titleBoundingRect = title->boundingRect();
+
+ QPointF center = gridRect.center() - titleBoundingRect.center();
+ if (axis()->alignment() == Qt::AlignLeft)
+ title->setPos(axisRect.left() - titleBoundingRect.width() / 2.0 + titleBoundingRect.height() / 2.0 + titlePadding(), center.y());
+ else if (axis()->alignment() == Qt::AlignRight)
+ title->setPos(axisRect.right() - titleBoundingRect.width() / 2.0 - titleBoundingRect.height() / 2.0 - titlePadding(), center.y());
+
+ title->setTransformOriginPoint(titleBoundingRect.center());
+ title->setRotation(270);
+
+ availableSpace -= titleBoundingRect.height();
+ }
+
+ for (int i = 0; i < layout.size(); ++i) {
+ //items
+ QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem *>(lines.at(i));
+ QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrow.at(i + 1));
+ QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labels.at(i));
+
+ //grid line
+ gridItem->setLine(gridRect.left(), layout[i], gridRect.right(), layout[i]);
+
+ //label text wrapping
+ QString text = labelList.at(i);
+ QRectF boundingRect;
+ // don't truncate empty labels
+ if (text.isEmpty()) {
+ labelItem->setHtml(text);
+ } else {
+ qreal labelHeight = (axisRect.height() / layout.count()) - (2 * labelPadding());
+ QString truncatedText = ChartPresenter::truncatedText(axis()->labelsFont(), text,
+ axis()->labelsAngle(),
+ availableSpace,
+ labelHeight, boundingRect);
+ labelItem->setTextWidth(ChartPresenter::textBoundingRect(axis()->labelsFont(),
+ truncatedText).width());
+ labelItem->setHtml(truncatedText);
+ }
+
+ //label transformation origin point
+ const QRectF &rect = labelItem->boundingRect();
+ QPointF center = rect.center();
+ labelItem->setTransformOriginPoint(center.x(), center.y());
+ qreal widthDiff = rect.width() - boundingRect.width();
+ qreal heightDiff = rect.height() - boundingRect.height();
+
+ //ticks and label position
+ if (axis()->alignment() == Qt::AlignLeft) {
+ labelItem->setPos(axisRect.right() - rect.width() + (widthDiff / 2.0) - labelPadding(), layout[i] - center.y());
+ tickItem->setLine(axisRect.right() - labelPadding(), layout[i], axisRect.right(), layout[i]);
+ } else if (axis()->alignment() == Qt::AlignRight) {
+ labelItem->setPos(axisRect.left() + labelPadding() - (widthDiff / 2.0), layout[i] - center.y());
+ tickItem->setLine(axisRect.left(), layout[i], axisRect.left() + labelPadding(), layout[i]);
+ }
+
+ //label in between
+ bool forceHide = false;
+ if (intervalAxis() && (i + 1) != layout.size()) {
+ qreal lowerBound = qMin(layout[i], gridRect.bottom());
+ qreal upperBound = qMax(layout[i + 1], gridRect.top());
+ const qreal delta = lowerBound - upperBound;
+ // Hide label in case visible part of the category at the grid edge is too narrow
+ if (delta < boundingRect.height()
+ && (lowerBound == gridRect.bottom() || upperBound == gridRect.top())
+ && !intervalAxis()) {
+ forceHide = true;
+ } else {
+ labelItem->setPos(labelItem->pos().x() , lowerBound - (delta / 2.0) - center.y());
+ }
+ }
+
+ //label overlap detection - compensate one pixel for rounding errors
+ if (labelItem->pos().y() + boundingRect.height() > height || forceHide ||
+ (labelItem->pos().y() + (heightDiff / 2.0) - 1.0) > axisRect.bottom() ||
+ labelItem->pos().y() + (heightDiff / 2.0) < (axisRect.top() - 1.0)) {
+ labelItem->setVisible(false);
+ }
+ else {
+ labelItem->setVisible(true);
+ height=labelItem->pos().y();
+ }
+
+ //shades
+ if ((i + 1) % 2 && i > 1) {
+ QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem *>(shades.at(i / 2 - 1));
+ qreal lowerBound = qMin(layout[i - 1], gridRect.bottom());
+ qreal upperBound = qMax(layout[i], gridRect.top());
+ rectItem->setRect(gridRect.left(), upperBound, gridRect.width(), lowerBound - upperBound);
+ if (rectItem->rect().height() <= 0.0)
+ rectItem->setVisible(false);
+ else
+ rectItem->setVisible(true);
+ }
+
+ // check if the grid line and the axis tick should be shown
+ qreal y = gridItem->line().p1().y();
+ if ((y < gridRect.top() || y > gridRect.bottom()))
+ {
+ gridItem->setVisible(false);
+ tickItem->setVisible(false);
+ }else{
+ gridItem->setVisible(true);
+ tickItem->setVisible(true);
+ }
+
+ }
+ //begin/end grid line in case labels between
+ if (intervalAxis()) {
+ QGraphicsLineItem *gridLine;
+ gridLine = static_cast<QGraphicsLineItem *>(lines.at(layout.size()));
+ gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.right(), gridRect.top());
+ gridLine->setVisible(true);
+ gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size() + 1));
+ gridLine->setLine(gridRect.left(), gridRect.bottom(), gridRect.right(), gridRect.bottom());
+ gridLine->setVisible(true);
+ }
+}
+
+QSizeF VerticalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint);
+ QSizeF sh(0, 0);
+
+ if (axis()->titleText().isEmpty() || !titleItem()->isVisible())
+ return sh;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(),
+ QStringLiteral("..."));
+ sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
+ break;
+ }
+ case Qt::MaximumSize:
+ case Qt::PreferredSize: {
+ QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
+ sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
+ break;
+ }
+ default:
+ break;
+ }
+
+ return sh;
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/axis/verticalaxis_p.h b/src/charts/axis/verticalaxis_p.h
new file mode 100644
index 00000000..8349ff51
--- /dev/null
+++ b/src/charts/axis/verticalaxis_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef VERTICALAXIS_P_H_
+#define VERTICALAXIS_P_H_
+
+#include "cartesianchartaxis_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class VerticalAxis : public CartesianChartAxis
+{
+public:
+ VerticalAxis(QAbstractAxis *axis, QGraphicsItem *item = 0, bool intervalAxis = false);
+ ~VerticalAxis();
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+protected:
+ void updateGeometry();
+
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* VERTICALAXIS_P_H_ */
diff --git a/src/charts/barchart/abstractbarchartitem.cpp b/src/charts/barchart/abstractbarchartitem.cpp
new file mode 100644
index 00000000..4cf8b366
--- /dev/null
+++ b/src/charts/barchart/abstractbarchartitem.cpp
@@ -0,0 +1,268 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "abstractbarchartitem_p.h"
+#include "bar_p.h"
+#include "qbarset.h"
+#include "qbarset_p.h"
+#include "qabstractbarseries.h"
+#include "qabstractbarseries_p.h"
+#include "qchart.h"
+#include "chartpresenter_p.h"
+#include "charttheme_p.h"
+#include "baranimation_p.h"
+#include "chartdataset_p.h"
+#include <QPainter>
+#include <QTextDocument>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+AbstractBarChartItem::AbstractBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) :
+ ChartItem(series->d_func(),item),
+ m_animation(0),
+ m_series(series)
+{
+
+ setFlag(ItemClipsChildrenToShape);
+ connect(series->d_func(), SIGNAL(updatedLayout()), this, SLOT(handleLayoutChanged()));
+ connect(series->d_func(), SIGNAL(updatedBars()), this, SLOT(handleUpdatedBars()));
+ connect(series->d_func(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool)));
+ connect(series->d_func(), SIGNAL(restructuredBars()), this, SLOT(handleDataStructureChanged()));
+ connect(series, SIGNAL(visibleChanged()), this, SLOT(handleVisibleChanged()));
+ connect(series, SIGNAL(opacityChanged()), this, SLOT(handleOpacityChanged()));
+ connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(handleUpdatedBars()));
+ connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(positionLabels()));
+ connect(series, SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)),
+ this, SLOT(handleLabelsPositionChanged()));
+ setZValue(ChartPresenter::BarSeriesZValue);
+ handleDataStructureChanged();
+ handleVisibleChanged();
+ handleUpdatedBars();
+}
+
+AbstractBarChartItem::~AbstractBarChartItem()
+{
+}
+
+void AbstractBarChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(painter);
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+}
+
+QRectF AbstractBarChartItem::boundingRect() const
+{
+ return m_rect;
+}
+
+void AbstractBarChartItem::applyLayout(const QVector<QRectF> &layout)
+{
+ QSizeF size = geometry().size();
+ if (geometry().size().isValid()) {
+ if (m_animation) {
+ if (m_layout.count() == 0 || m_oldSize != size) {
+ initializeLayout();
+ m_oldSize = size;
+ }
+ m_animation->setup(m_layout, layout);
+ presenter()->startAnimation(m_animation);
+ } else {
+ setLayout(layout);
+ update();
+ }
+ }
+}
+
+void AbstractBarChartItem::setAnimation(BarAnimation *animation)
+{
+ m_animation = animation;
+}
+
+void AbstractBarChartItem::setLayout(const QVector<QRectF> &layout)
+{
+ if (layout.count() != m_bars.count())
+ return;
+
+ m_layout = layout;
+
+ for (int i = 0; i < m_bars.count(); i++)
+ m_bars.at(i)->setRect(layout.at(i));
+
+ positionLabels();
+}
+//handlers
+
+void AbstractBarChartItem::handleDomainUpdated()
+{
+ m_domainMinX = domain()->minX();
+ m_domainMaxX = domain()->maxX();
+ m_domainMinY = domain()->minY();
+ m_domainMaxY = domain()->maxY();
+
+ QRectF rect(QPointF(0,0),domain()->size());
+
+ if(m_rect != rect){
+ prepareGeometryChange();
+ m_rect = rect;
+ }
+
+ handleLayoutChanged();
+}
+
+void AbstractBarChartItem::handleLayoutChanged()
+{
+ if ((m_rect.width() <= 0) || (m_rect.height() <= 0))
+ return; // rect size zero.
+ QVector<QRectF> layout = calculateLayout();
+ applyLayout(layout);
+ handleUpdatedBars();
+}
+
+void AbstractBarChartItem::handleLabelsVisibleChanged(bool visible)
+{
+ foreach (QGraphicsTextItem *label, m_labels)
+ label->setVisible(visible);
+ update();
+}
+
+void AbstractBarChartItem::handleDataStructureChanged()
+{
+ foreach (QGraphicsItem *item, childItems())
+ delete item;
+
+ m_bars.clear();
+ m_labels.clear();
+ m_layout.clear();
+
+ // Create new graphic items for bars
+ for (int c = 0; c < m_series->d_func()->categoryCount(); c++) {
+ for (int s = 0; s < m_series->count(); s++) {
+ QBarSet *set = m_series->d_func()->barsetAt(s);
+
+ // Bars
+ Bar *bar = new Bar(set, c, this);
+ m_bars.append(bar);
+ connect(bar, SIGNAL(clicked(int,QBarSet*)), m_series, SIGNAL(clicked(int,QBarSet*)));
+ connect(bar, SIGNAL(hovered(bool,QBarSet*)), m_series, SIGNAL(hovered(bool,QBarSet*)));
+ connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), m_series, SIGNAL(hovered(bool, int, QBarSet*)));
+ connect(bar, SIGNAL(clicked(int,QBarSet*)), set, SIGNAL(clicked(int)));
+ connect(bar, SIGNAL(hovered(bool,QBarSet*)), set, SIGNAL(hovered(bool)));
+ connect(bar, SIGNAL(hovered(bool, int, QBarSet*)), set, SIGNAL(hovered(bool, int)));
+ // m_layout.append(QRectF(0, 0, 1, 1));
+
+ // Labels
+ QGraphicsTextItem *newLabel = new QGraphicsTextItem(this);
+ newLabel->document()->setDocumentMargin(ChartPresenter::textMargin());
+ m_labels.append(newLabel);
+ }
+ }
+
+ if(themeManager()) themeManager()->updateSeries(m_series);
+ handleLayoutChanged();
+ handleVisibleChanged();
+}
+
+void AbstractBarChartItem::handleVisibleChanged()
+{
+ bool visible = m_series->isVisible();
+ if (visible)
+ handleLabelsVisibleChanged(m_series->isLabelsVisible());
+ else
+ handleLabelsVisibleChanged(visible);
+
+ foreach (QGraphicsItem *bar, m_bars)
+ bar->setVisible(visible);
+}
+
+void AbstractBarChartItem::handleOpacityChanged()
+{
+ foreach (QGraphicsItem *item, childItems())
+ item->setOpacity(m_series->opacity());
+}
+
+void AbstractBarChartItem::handleUpdatedBars()
+{
+ if (!m_series->d_func()->blockBarUpdate()) {
+ // Handle changes in pen, brush, labels etc.
+ int categoryCount = m_series->d_func()->categoryCount();
+ int setCount = m_series->count();
+ int itemIndex(0);
+ static const QString valueTag(QLatin1String("@value"));
+
+ for (int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ QBarSetPrivate *barSet = m_series->d_func()->barsetAt(set)->d_ptr.data();
+ Bar *bar = m_bars.at(itemIndex);
+ bar->setPen(barSet->m_pen);
+ bar->setBrush(barSet->m_brush);
+ bar->update();
+
+ QGraphicsTextItem *label = m_labels.at(itemIndex);
+ QString valueLabel;
+ if (presenter()) { // At startup presenter is not yet set, yet somehow update comes
+ if (m_series->labelsFormat().isEmpty()) {
+ valueLabel = presenter()->numberToString(barSet->value(category));
+ } else {
+ valueLabel = m_series->labelsFormat();
+ valueLabel.replace(valueTag,
+ presenter()->numberToString(barSet->value(category)));
+ }
+ }
+ label->setHtml(valueLabel);
+ label->setFont(barSet->m_labelFont);
+ label->setDefaultTextColor(barSet->m_labelBrush.color());
+ label->update();
+ itemIndex++;
+ }
+ }
+ }
+}
+
+void AbstractBarChartItem::handleLabelsPositionChanged()
+{
+ positionLabels();
+}
+
+void AbstractBarChartItem::positionLabels()
+{
+ for (int i = 0; i < m_layout.count(); i++) {
+ QGraphicsTextItem *label = m_labels.at(i);
+ qreal xPos = 0;
+ qreal yPos = m_layout.at(i).center().y() - label->boundingRect().center().y();
+
+ int offset = m_bars.at(i)->pen().width() / 2 + 2;
+ if (m_series->labelsPosition() == QAbstractBarSeries::LabelsCenter)
+ xPos = m_layout.at(i).center().x() - label->boundingRect().center().x();
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideEnd)
+ xPos = m_layout.at(i).right() - label->boundingRect().width() - offset;
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideBase)
+ xPos = m_layout.at(i).left() + offset;
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsOutsideEnd)
+ xPos = m_layout.at(i).right() + offset;
+
+ label->setPos(xPos, yPos);
+ label->setZValue(zValue() + 1);
+ }
+}
+
+#include "moc_abstractbarchartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/abstractbarchartitem_p.h b/src/charts/barchart/abstractbarchartitem_p.h
new file mode 100644
index 00000000..66551a62
--- /dev/null
+++ b/src/charts/barchart/abstractbarchartitem_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+
+#ifndef ABSTRACTBARCHARTITEM_H
+#define ABSTRACTBARCHARTITEM_H
+
+#include "chartitem_p.h"
+#include "qabstractbarseries.h"
+#include <QPen>
+#include <QBrush>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class Bar;
+class QAxisCategories;
+class QChart;
+class BarAnimation;
+
+class AbstractBarChartItem : public ChartItem
+{
+ Q_OBJECT
+public:
+ AbstractBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
+ virtual ~AbstractBarChartItem();
+
+public:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ QRectF boundingRect() const;
+
+ virtual QVector<QRectF> calculateLayout() = 0;
+ virtual void initializeLayout() = 0;
+ virtual void applyLayout(const QVector<QRectF> &layout);
+ virtual void setAnimation(BarAnimation *animation);
+ void setLayout(const QVector<QRectF> &layout);
+ void updateLayout(const QVector<QRectF> &layout);
+ QRectF geometry() const { return m_rect;}
+
+public Q_SLOTS:
+ void handleDomainUpdated();
+ void handleLayoutChanged();
+ void handleLabelsVisibleChanged(bool visible);
+ void handleDataStructureChanged(); // structure of of series has changed, recreate graphic items
+ void handleVisibleChanged();
+ void handleOpacityChanged();
+ virtual void handleUpdatedBars();
+ void handleLabelsPositionChanged();
+ virtual void positionLabels();
+
+protected:
+
+ qreal m_domainMinX;
+ qreal m_domainMaxX;
+ qreal m_domainMinY;
+ qreal m_domainMaxY;
+
+ QRectF m_rect;
+ QVector<QRectF> m_layout;
+
+ BarAnimation *m_animation;
+
+ QAbstractBarSeries *m_series; // Not owned.
+ QList<Bar *> m_bars;
+ QList<QGraphicsTextItem *> m_labels;
+ QSizeF m_oldSize;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // ABSTRACTBARCHARTITEM_H
diff --git a/src/charts/barchart/bar.cpp b/src/charts/barchart/bar.cpp
new file mode 100644
index 00000000..de6c442f
--- /dev/null
+++ b/src/charts/barchart/bar.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bar_p.h"
+#include <QPainter>
+#include <QGraphicsSceneEvent>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+Bar::Bar(QBarSet *barset, int index, QGraphicsItem *parent) : QGraphicsRectItem(parent),
+ m_index(index),
+ m_barset(barset),
+ m_hovering(false)
+{
+ setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
+ setAcceptHoverEvents(true);
+}
+
+Bar::~Bar()
+{
+ // End hover event, if bar is deleted during it
+ if (m_hovering) {
+ emit hovered(false, m_barset);
+ emit hovered(false, m_index, m_barset);
+ }
+}
+
+void Bar::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event)
+ emit clicked(m_index, m_barset);
+ QGraphicsItem::mousePressEvent(event);
+}
+
+void Bar::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event)
+ m_hovering = true;
+ emit hovered(true, m_barset);
+ emit hovered(true, m_index, m_barset);
+
+}
+
+void Bar::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event)
+ m_hovering = false;
+ emit hovered(false, m_barset);
+ emit hovered(false, m_index, m_barset);
+}
+
+#include "moc_bar_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/bar_p.h b/src/charts/barchart/bar_p.h
new file mode 100644
index 00000000..0d46e2b6
--- /dev/null
+++ b/src/charts/barchart/bar_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef BAR_H
+#define BAR_H
+
+#include "qchartglobal.h"
+#include <QGraphicsRectItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarSet;
+
+// Single visual bar item of chart
+class Bar : public QObject, public QGraphicsRectItem
+{
+ Q_OBJECT
+public:
+ Bar(QBarSet *barset, int index, QGraphicsItem *parent = 0);
+ ~Bar();
+
+public:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+
+Q_SIGNALS:
+ void clicked(int index, QBarSet *barset);
+ void hovered(bool status, QBarSet *barset);
+ void hovered(bool status, int index, QBarSet *barset);
+
+private:
+ int m_index;
+ QBarSet *m_barset;
+ bool m_hovering;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // BAR_H
diff --git a/src/barchart/barchart.pri b/src/charts/barchart/barchart.pri
index 0e78d232..0e78d232 100644
--- a/src/barchart/barchart.pri
+++ b/src/charts/barchart/barchart.pri
diff --git a/src/charts/barchart/horizontal/bar/horizontalbarchartitem.cpp b/src/charts/barchart/horizontal/bar/horizontalbarchartitem.cpp
new file mode 100644
index 00000000..d5370a2f
--- /dev/null
+++ b/src/charts/barchart/horizontal/bar/horizontalbarchartitem.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "horizontalbarchartitem_p.h"
+#include "qabstractbarseries_p.h"
+#include "qbarset_p.h"
+#include "bar_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+HorizontalBarChartItem::HorizontalBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item)
+ : AbstractBarChartItem(series, item)
+{
+}
+
+void HorizontalBarChartItem::initializeLayout()
+{
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ m_layout.clear();
+ for(int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ QRectF rect;
+ QPointF topLeft;
+ QPointF bottomRight;
+ if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
+ topLeft = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2 + set/setCount * barWidth), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2 + (set + 1)/setCount * barWidth), m_validData);
+ } else {
+ topLeft = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2 + set/setCount * barWidth), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2 + (set + 1)/setCount * barWidth), m_validData);
+ }
+
+ if (!m_validData)
+ return;
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ m_layout.append(rect.normalized());
+ }
+ }
+}
+
+QVector<QRectF> HorizontalBarChartItem::calculateLayout()
+{
+ QVector<QRectF> layout;
+
+ // Use temporary qreals for accuracy
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ for(int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ qreal value = m_series->barSets().at(set)->at(category);
+ QRectF rect;
+ QPointF topLeft;
+ if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
+ topLeft = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2 + set/setCount * barWidth), m_validData);
+ else
+ topLeft = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2 + set/setCount * barWidth), m_validData);
+
+ QPointF bottomRight = domain()->calculateGeometryPoint(QPointF(value, category - barWidth / 2 + (set + 1)/setCount * barWidth), m_validData);
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ layout.append(rect.normalized());
+ }
+ }
+ return layout;
+}
+
+#include "moc_horizontalbarchartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/horizontal/bar/horizontalbarchartitem_p.h b/src/charts/barchart/horizontal/bar/horizontalbarchartitem_p.h
new file mode 100644
index 00000000..df7e793e
--- /dev/null
+++ b/src/charts/barchart/horizontal/bar/horizontalbarchartitem_p.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef HORIZONTALBARCHARTITEM_H
+#define HORIZONTALBARCHARTITEM_H
+
+#include "abstractbarchartitem_p.h"
+#include <QGraphicsItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class HorizontalBarChartItem : public AbstractBarChartItem
+{
+ Q_OBJECT
+public:
+ HorizontalBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
+
+private:
+ virtual QVector<QRectF> calculateLayout();
+ void initializeLayout();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // HORIZONTALBARCHARTITEM_H
diff --git a/src/charts/barchart/horizontal/bar/qhorizontalbarseries.cpp b/src/charts/barchart/horizontal/bar/qhorizontalbarseries.cpp
new file mode 100644
index 00000000..d381aadf
--- /dev/null
+++ b/src/charts/barchart/horizontal/bar/qhorizontalbarseries.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qhorizontalbarseries.h"
+#include "qhorizontalbarseries_p.h"
+#include "horizontalbarchartitem_p.h"
+#include "qbarcategoryaxis.h"
+
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QHorizontalBarSeries
+ \inmodule Qt Charts
+ \brief Series for creating horizontal bar chart.
+ \mainclass
+
+ QHorizontalBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
+ as groups, where bars in same category are grouped next to each other. QHorizontalBarSeries groups the data
+ from sets to categories, which are defined by a QStringList.
+
+ See the \l {HorizontalBarChart Example} {horizontal bar chart example} to learn how to create a horizontal bar chart.
+ \image examples_horizontalbarchart.png
+
+ \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries
+*/
+/*!
+ \qmltype HorizontalBarSeries
+ \instantiates QHorizontalBarSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractBarSeries
+
+ \brief Series type for creating horizontal bar chart.
+
+ The following QML shows how to create a simple horizontal bar chart:
+ \snippet qmlchart/qml/qmlchart/View9.qml 1
+ \beginfloatleft
+ \image examples_qmlchart9.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ Constructs empty QHorizontalBarSeries.
+ QHorizontalBarSeries is QObject which is a child of a \a parent.
+*/
+QHorizontalBarSeries::QHorizontalBarSeries(QObject *parent)
+ : QAbstractBarSeries(*new QHorizontalBarSeriesPrivate(this), parent)
+{
+}
+
+/*!
+ Destructor.
+ Removes series from chart.
+*/
+QHorizontalBarSeries::~QHorizontalBarSeries()
+{
+ Q_D(QHorizontalBarSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+
+/*!
+ Returns QChartSeries::SeriesTypeHorizontalBar.
+*/
+QAbstractSeries::SeriesType QHorizontalBarSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeHorizontalBar;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q)
+ : QAbstractBarSeriesPrivate(q)
+{
+
+}
+
+void QHorizontalBarSeriesPrivate::initializeDomain()
+{
+ qreal minX(domain()->minX());
+ qreal minY(domain()->minY());
+ qreal maxX(domain()->maxX());
+ qreal maxY(domain()->maxY());
+
+ qreal y = categoryCount();
+ minX = qMin(minX, min());
+ minY = qMin(minY, - (qreal)0.5);
+ maxX = qMax(maxX, max());
+ maxY = qMax(maxY, y - (qreal)0.5);
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+void QHorizontalBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QHorizontalBarSeries);
+ HorizontalBarChartItem *bar = new HorizontalBarChartItem(q,parent);
+ m_item.reset(bar);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+#include "moc_qhorizontalbarseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/horizontal/bar/qhorizontalbarseries.h b/src/charts/barchart/horizontal/bar/qhorizontalbarseries.h
new file mode 100644
index 00000000..b5cf137b
--- /dev/null
+++ b/src/charts/barchart/horizontal/bar/qhorizontalbarseries.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHORIZONTALBARSERIES_H
+#define QHORIZONTALBARSERIES_H
+
+#include <QtCharts/qabstractbarseries.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QHorizontalBarSeriesPrivate;
+
+class QT_CHARTS_EXPORT QHorizontalBarSeries : public QAbstractBarSeries
+{
+ Q_OBJECT
+public:
+ explicit QHorizontalBarSeries(QObject *parent = 0);
+ ~QHorizontalBarSeries();
+ QAbstractSeries::SeriesType type() const;
+
+private:
+ Q_DECLARE_PRIVATE(QHorizontalBarSeries)
+ Q_DISABLE_COPY(QHorizontalBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QHORIZONTALBARSERIES_H
diff --git a/src/charts/barchart/horizontal/bar/qhorizontalbarseries_p.h b/src/charts/barchart/horizontal/bar/qhorizontalbarseries_p.h
new file mode 100644
index 00000000..d32ed320
--- /dev/null
+++ b/src/charts/barchart/horizontal/bar/qhorizontalbarseries_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QHORIZONTALBARSERIES_P_H
+#define QHORIZONTALBARSERIES_P_H
+
+#include "qabstractbarseries_p.h"
+#include "abstractdomain_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QHorizontalBarSeriesPrivate: public QAbstractBarSeriesPrivate
+{
+public:
+ QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q);
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeDomain();
+private:
+ Q_DECLARE_PUBLIC(QHorizontalBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QHORIZONTALBARSERIES_P_H
diff --git a/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp b/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp
new file mode 100644
index 00000000..0bf9afbe
--- /dev/null
+++ b/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "horizontalpercentbarchartitem_p.h"
+#include "qabstractbarseries_p.h"
+#include "qbarset_p.h"
+#include "bar_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+HorizontalPercentBarChartItem::HorizontalPercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item)
+ : AbstractBarChartItem(series, item)
+{
+}
+
+void HorizontalPercentBarChartItem::initializeLayout()
+{
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ m_layout.clear();
+ for(int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ QRectF rect;
+ QPointF topLeft;
+ QPointF bottomRight;
+ if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
+ topLeft = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category + barWidth / 2), m_validData);
+ } else {
+ topLeft = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(0, category + barWidth / 2), m_validData);
+ }
+
+ if (!m_validData)
+ return;
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ m_layout.append(rect.normalized());
+ }
+ }
+}
+
+QVector<QRectF> HorizontalPercentBarChartItem::calculateLayout()
+{
+ QVector<QRectF> layout;
+
+ // Use temporary qreals for accuracy
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ for(int category = 0; category < categoryCount; category++) {
+ qreal sum = 0;
+ qreal categorySum = m_series->d_func()->categorySum(category);
+ for (int set = 0; set < setCount; set++) {
+ qreal value = m_series->barSets().at(set)->at(category);
+ QRectF rect;
+ qreal topX = 0;
+ if (sum > 0)
+ topX = 100 * sum / categorySum;
+ qreal bottomX = 0;
+ qreal newSum = value + sum;
+ if (newSum > 0)
+ bottomX = 100 * newSum / categorySum;
+ QPointF topLeft;
+ if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
+ topLeft = domain()->calculateGeometryPoint(QPointF(set ? topX : domain()->minX(), category - barWidth/2), m_validData);
+ else
+ topLeft = domain()->calculateGeometryPoint(QPointF(set ? topX : 0, category - barWidth/2), m_validData);
+ QPointF bottomRight = domain()->calculateGeometryPoint(QPointF(bottomX, category + barWidth/2), m_validData);
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ layout.append(rect.normalized());
+ sum = newSum;
+ }
+ }
+ return layout;
+}
+
+void HorizontalPercentBarChartItem::handleUpdatedBars()
+{
+ // Handle changes in pen, brush, labels etc.
+ int categoryCount = m_series->d_func()->categoryCount();
+ int setCount = m_series->count();
+ int itemIndex(0);
+ static const QString valueTag(QLatin1String("@value"));
+
+ for (int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ QBarSetPrivate *barSet = m_series->d_func()->barsetAt(set)->d_ptr.data();
+ Bar *bar = m_bars.at(itemIndex);
+ bar->setPen(barSet->m_pen);
+ bar->setBrush(barSet->m_brush);
+ bar->update();
+
+ QGraphicsTextItem *label = m_labels.at(itemIndex);
+ qreal p = m_series->d_func()->percentageAt(set, category) * 100.0;
+ QString vString(presenter()->numberToString(p, 'f', 0));
+ QString valueLabel;
+ if (m_series->labelsFormat().isEmpty()) {
+ vString.append(QStringLiteral("%"));
+ valueLabel = vString;
+ } else {
+ valueLabel = m_series->labelsFormat();
+ valueLabel.replace(valueTag, vString);
+ }
+ label->setHtml(valueLabel);
+ label->setFont(barSet->m_labelFont);
+ label->setDefaultTextColor(barSet->m_labelBrush.color());
+ label->update();
+ itemIndex++;
+ }
+ }
+}
+
+#include "moc_horizontalpercentbarchartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h b/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h
new file mode 100644
index 00000000..e24cdcf0
--- /dev/null
+++ b/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem_p.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef HORIZONTALPERCENTBARCHARTITEM_P_H
+#define HORIZONTALPERCENTBARCHARTITEM_P_H
+
+#include "abstractbarchartitem_p.h"
+#include <QGraphicsItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class HorizontalPercentBarChartItem : public AbstractBarChartItem
+{
+ Q_OBJECT
+public:
+ HorizontalPercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
+ void handleUpdatedBars();
+
+private:
+ virtual QVector<QRectF> calculateLayout();
+ void initializeLayout();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // HORIZONTALPERCENTBARCHARTITEM_P_H
diff --git a/src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp b/src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp
new file mode 100644
index 00000000..bf915c85
--- /dev/null
+++ b/src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qhorizontalpercentbarseries.h"
+#include "qhorizontalpercentbarseries_p.h"
+#include "horizontalpercentbarchartitem_p.h"
+
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QHorizontalPercentBarSeries
+ \inmodule Qt Charts
+ \brief Series for creating horizontal percent bar chart.
+ \mainclass
+
+ QHorizontalPercentBarSeries represents a series of data shown as bars. The purpose of this
+ class is to draw bars as groups, where bars in same category are grouped next to each other.
+ QHorizontalPercentBarSeries groups the data from sets to categories, which are defined by a
+ QStringList. Bars with zero value are not drawn.
+
+ See the \l {HorizontalPercentBarChart Example} {horizontal percent bar chart example} to learn
+ how to create a horizontal percent bar chart.
+ \image examples_horizontalpercentbarchart.png
+
+ \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries,
+ QHorizontalStackedBarSeries, QHorizontalBarSeries
+*/
+/*!
+ \qmltype HorizontalPercentBarSeries
+ \instantiates QHorizontalPercentBarSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractBarSeries
+
+ \brief Series type for creating horizontal precent bar chart.
+
+ The following QML shows how to create a simple horizontal percent bar chart:
+ \snippet qmlchart/qml/qmlchart/View11.qml 1
+ \beginfloatleft
+ \image examples_qmlchart11.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ Constructs empty QHorizontalPercentBarSeries.
+ QHorizontalPercentBarSeries is QObject which is a child of a \a parent.
+*/
+QHorizontalPercentBarSeries::QHorizontalPercentBarSeries(QObject *parent) :
+ QAbstractBarSeries(*new QHorizontalPercentBarSeriesPrivate(this), parent)
+{
+}
+
+/*!
+ Returns QAbstractSeries::SeriesTypeHorizontalPercentBar.
+*/
+QAbstractSeries::SeriesType QHorizontalPercentBarSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeHorizontalPercentBar;
+}
+
+/*!
+ Destructor.
+ Removes series from chart.
+*/
+QHorizontalPercentBarSeries::~QHorizontalPercentBarSeries()
+{
+ Q_D(QHorizontalPercentBarSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QHorizontalPercentBarSeriesPrivate::QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q) : QAbstractBarSeriesPrivate(q)
+{
+
+}
+
+void QHorizontalPercentBarSeriesPrivate::initializeDomain()
+{
+ qreal minX(domain()->minX());
+ qreal minY(domain()->minY());
+ qreal maxX(domain()->maxX());
+ qreal maxY(domain()->maxY());
+
+ qreal y = categoryCount();
+ minX = 0;
+ maxX = 100;
+ minY = qMin(minY, - (qreal)0.5);
+ maxY = qMax(maxY, y - (qreal)0.5);
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+void QHorizontalPercentBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QHorizontalPercentBarSeries);
+ HorizontalPercentBarChartItem *bar = new HorizontalPercentBarChartItem(q,parent);
+ m_item.reset(bar);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+#include "moc_qhorizontalpercentbarseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries.h b/src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries.h
new file mode 100644
index 00000000..0595532b
--- /dev/null
+++ b/src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHORIZONTALPERCENTBARSERIES_H
+#define QHORIZONTALPERCENTBARSERIES_H
+
+#include <QtCharts/qabstractbarseries.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QHorizontalPercentBarSeriesPrivate;
+
+class QT_CHARTS_EXPORT QHorizontalPercentBarSeries : public QAbstractBarSeries
+{
+ Q_OBJECT
+public:
+ explicit QHorizontalPercentBarSeries(QObject *parent = 0);
+ ~QHorizontalPercentBarSeries();
+ QAbstractSeries::SeriesType type() const;
+
+private:
+ Q_DECLARE_PRIVATE(QHorizontalPercentBarSeries)
+ Q_DISABLE_COPY(QHorizontalPercentBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QHORIZONTALPERCENTBARSERIES_H
diff --git a/src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h b/src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h
new file mode 100644
index 00000000..079f97bb
--- /dev/null
+++ b/src/charts/barchart/horizontal/percent/qhorizontalpercentbarseries_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QHORIZONTALPERCENTBARSERIES_P_H
+#define QHORIZONTALPERCENTBARSERIES_P_H
+
+#include "qabstractbarseries_p.h"
+#include "abstractdomain_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QHorizontalPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
+{
+public:
+ QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q);
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeDomain();
+private:
+ Q_DECLARE_PUBLIC(QHorizontalPercentBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QHORIZONTALPERCENTBARSERIES_P_H
diff --git a/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp b/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp
new file mode 100644
index 00000000..fe6f162d
--- /dev/null
+++ b/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "horizontalstackedbarchartitem_p.h"
+#include "qabstractbarseries_p.h"
+#include "qbarset_p.h"
+#include "bar_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+HorizontalStackedBarChartItem::HorizontalStackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item)
+ : AbstractBarChartItem(series, item)
+{
+}
+
+void HorizontalStackedBarChartItem::initializeLayout()
+{
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ m_layout.clear();
+ for(int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ QRectF rect;
+ QPointF topLeft;
+ QPointF bottomRight;
+ if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
+ topLeft = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category - barWidth / 2), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(domain()->minX(), category + barWidth / 2), m_validData);
+ } else {
+ topLeft = domain()->calculateGeometryPoint(QPointF(0, category - barWidth / 2), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(0, category + barWidth / 2), m_validData);
+ }
+
+ if (!m_validData)
+ return;
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ m_layout.append(rect.normalized());
+ }
+ }
+}
+
+QVector<QRectF> HorizontalStackedBarChartItem::calculateLayout()
+{
+ QVector<QRectF> layout;
+
+ // Use temporary qreals for accuracy
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ for(int category = 0; category < categoryCount; category++) {
+ qreal positiveSum = 0;
+ qreal negativeSum = 0;
+ for (int set = 0; set < setCount; set++) {
+ qreal value = m_series->barSets().at(set)->at(category);
+ QRectF rect;
+ QPointF topLeft;
+ QPointF bottomRight;
+ if (value < 0) {
+ bottomRight = domain()->calculateGeometryPoint(QPointF(value + negativeSum, category - barWidth / 2), m_validData);
+ if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
+ topLeft = domain()->calculateGeometryPoint(QPointF(set ? negativeSum : domain()->minX(), category + barWidth / 2), m_validData);
+ else
+ topLeft = domain()->calculateGeometryPoint(QPointF(set ? negativeSum : 0, category + barWidth / 2), m_validData);
+ negativeSum += value;
+ } else {
+ bottomRight = domain()->calculateGeometryPoint(QPointF(value + positiveSum, category - barWidth / 2), m_validData);
+ if (domain()->type() == AbstractDomain::LogXYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
+ topLeft = domain()->calculateGeometryPoint(QPointF(set ? positiveSum : domain()->minX(), category + barWidth / 2), m_validData);
+ else
+ topLeft = domain()->calculateGeometryPoint(QPointF(set ? positiveSum : 0, category + barWidth / 2), m_validData);
+ positiveSum += value;
+ }
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ layout.append(rect.normalized());
+ }
+ }
+ return layout;
+}
+
+#include "moc_horizontalstackedbarchartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h b/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h
new file mode 100644
index 00000000..930a53a5
--- /dev/null
+++ b/src/charts/barchart/horizontal/stacked/horizontalstackedbarchartitem_p.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef HORIZONTALSTACKEDBARCHARTITEM_P_H
+#define HORIZONTALSTACKEDBARCHARTITEM_P_H
+
+#include "abstractbarchartitem_p.h"
+#include <QGraphicsItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class HorizontalStackedBarChartItem : public AbstractBarChartItem
+{
+ Q_OBJECT
+public:
+ HorizontalStackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
+
+private:
+ virtual QVector<QRectF> calculateLayout();
+ void initializeLayout();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // HORIZONTALSTACKEDBARCHARTITEM_P_H
diff --git a/src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp b/src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp
new file mode 100644
index 00000000..32c553bf
--- /dev/null
+++ b/src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qhorizontalstackedbarseries.h"
+#include "qhorizontalstackedbarseries_p.h"
+#include "horizontalstackedbarchartitem_p.h"
+
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+/*!
+ \class QHorizontalStackedBarSeries
+ \inmodule Qt Charts
+ \brief Series for creating horizontal stacked bar chart.
+ \mainclass
+
+ QHorizontalStackedBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
+ as groups, where bars in same category are grouped next to each other. QHorizontalStackedBarSeries groups the data
+ from sets to categories, which are defined by a QStringList.
+
+ See the \l {HorizontalStackedBarChart Example} {horizontal stacked bar chart example} to learn how to create a horizontal stacked bar chart.
+ \image examples_horizontalstackedbarchart.png
+
+ \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalPercentBarSeries, QHorizontalBarSeries
+*/
+/*!
+ \qmltype HorizontalStackedBarSeries
+ \instantiates QHorizontalStackedBarSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractBarSeries
+
+ \brief Series type for creating horizontal stacked bar chart.
+
+ The following QML shows how to create a simple horizontal stacked bar chart:
+ \snippet qmlchart/qml/qmlchart/View10.qml 1
+ \beginfloatleft
+ \image examples_qmlchart10.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ Constructs empty QHorizontalStackedBarSeries.
+ QHorizontalStackedBarSeries is QObject which is a child of a \a parent.
+*/
+QHorizontalStackedBarSeries::QHorizontalStackedBarSeries(QObject *parent)
+ : QAbstractBarSeries(*new QHorizontalStackedBarSeriesPrivate(this), parent)
+{
+}
+
+/*!
+ Destructor.
+ Removes series from chart.
+*/
+QHorizontalStackedBarSeries::~QHorizontalStackedBarSeries()
+{
+ Q_D(QHorizontalStackedBarSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+
+/*!
+ Returns QAbstractSeries::SeriesTypeHorizontalStackedBar.
+*/
+QAbstractSeries::SeriesType QHorizontalStackedBarSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeHorizontalStackedBar;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QHorizontalStackedBarSeriesPrivate::QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q) : QAbstractBarSeriesPrivate(q)
+{
+
+}
+
+void QHorizontalStackedBarSeriesPrivate::initializeDomain()
+{
+ qreal minX(domain()->minX());
+ qreal minY(domain()->minY());
+ qreal maxX(domain()->maxX());
+ qreal maxY(domain()->maxY());
+
+ qreal y = categoryCount();
+ minX = qMin(minX, bottom());
+ minY = qMin(minY, - (qreal)0.5);
+ maxX = qMax(maxX, top());
+ maxY = qMax(maxY, y - (qreal)0.5);
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+void QHorizontalStackedBarSeriesPrivate::initializeGraphics(QGraphicsItem *parent)
+{
+ Q_Q(QHorizontalStackedBarSeries);
+ HorizontalStackedBarChartItem *bar = new HorizontalStackedBarChartItem(q,parent);
+ m_item.reset(bar);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+#include "moc_qhorizontalstackedbarseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries.h b/src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries.h
new file mode 100644
index 00000000..fbcf4011
--- /dev/null
+++ b/src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHORIZONTALSTACKEDBARSERIES_H
+#define QHORIZONTALSTACKEDBARSERIES_H
+
+#include <QtCharts/qabstractbarseries.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QHorizontalStackedBarSeriesPrivate;
+
+class QT_CHARTS_EXPORT QHorizontalStackedBarSeries : public QAbstractBarSeries
+{
+ Q_OBJECT
+public:
+ explicit QHorizontalStackedBarSeries(QObject *parent = 0);
+ ~QHorizontalStackedBarSeries();
+ QAbstractSeries::SeriesType type() const;
+
+private:
+ Q_DECLARE_PRIVATE(QHorizontalStackedBarSeries)
+ Q_DISABLE_COPY(QHorizontalStackedBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QHORIZONTALSTACKEDBARSERIES_H
diff --git a/src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h b/src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h
new file mode 100644
index 00000000..ab643ebd
--- /dev/null
+++ b/src/charts/barchart/horizontal/stacked/qhorizontalstackedbarseries_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QHORIZONTALSTACKEDBARSERIES_P_H
+#define QHORIZONTALSTACKEDBARSERIES_P_H
+
+#include "qabstractbarseries_p.h"
+#include "abstractdomain_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QHorizontalStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate
+{
+public:
+ QHorizontalStackedBarSeriesPrivate(QHorizontalStackedBarSeries *q);
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeDomain();
+private:
+ Q_DECLARE_PUBLIC(QHorizontalStackedBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QHORIZONTALSTACKEDBARSERIES_P_H
diff --git a/src/charts/barchart/qabstractbarseries.cpp b/src/charts/barchart/qabstractbarseries.cpp
new file mode 100644
index 00000000..08345112
--- /dev/null
+++ b/src/charts/barchart/qabstractbarseries.cpp
@@ -0,0 +1,1030 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractbarseries.h"
+#include "qabstractbarseries_p.h"
+#include "qbarset.h"
+#include "qbarset_p.h"
+#include "abstractdomain_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "qvalueaxis.h"
+#include "qbarcategoryaxis.h"
+#include "qbarlegendmarker.h"
+#include "baranimation_p.h"
+#include "abstractbarchartitem_p.h"
+#include "qchart_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QAbstractBarSeries
+ \inmodule Qt Charts
+ \brief Series for creating a bar chart.
+ \mainclass
+
+ QAbstractBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars to
+ the position defined by data. Single bar is defined by QPointF, where x value is the x-coordinate of the bar
+ and y-value is the height of the bar. The category names are ignored with this series and x-axis
+ shows the x-values.
+
+ See the \l {BarChart Example} {bar chart example} to learn how to create a simple bar chart.
+ \image examples_barchart.png
+
+ \sa QBarSet, QStackedBarSeries, QPercentBarSeries
+*/
+/*!
+ \qmltype AbstractBarSeries
+ \instantiates QAbstractBarSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractSeries
+
+ \brief Series type for creating a bar chart.
+
+ The following QML shows how to create a simple bar chart:
+ \snippet qmlchart/qml/qmlchart/View6.qml 1
+
+ \beginfloatleft
+ \image examples_qmlchart6.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ \qmlproperty AbstractAxis AbstractBarSeries::axisX
+ The x axis used for the series. If you leave both axisX and axisXTop undefined, a BarCategoriesAxis is created for
+ the series.
+ \sa axisXTop
+*/
+
+/*!
+ \qmlproperty AbstractAxis AbstractBarSeries::axisY
+ The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
+ the series.
+ \sa axisYRight
+*/
+
+/*!
+ \qmlproperty AbstractAxis AbstractBarSeries::axisXTop
+ The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
+ axisXTop, but not both.
+ \sa axisX
+*/
+
+/*!
+ \qmlproperty AbstractAxis AbstractBarSeries::axisYRight
+ The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
+ or axisYRight, but not both.
+ \sa axisY
+*/
+
+/*!
+ \property QAbstractBarSeries::barWidth
+ The width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars
+ is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen
+ is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
+ Note that with QBarSeries this value means the width of one group of bars instead of just one bar.
+ \sa QBarSeries
+*/
+/*!
+ \qmlproperty real AbstractBarSeries::barWidth
+ The width of the bars of the series. The unit of width is the unit of x-axis. The minimum width for bars
+ is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen
+ is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
+ Note that with QBarSeries this value means the width of one group of bars instead of just one bar.
+*/
+
+/*!
+ \property QAbstractBarSeries::count
+ Holds the number of sets in series.
+*/
+/*!
+ \qmlproperty int AbstractBarSeries::count
+ Holds the number of sets in series.
+*/
+
+/*!
+ \property QAbstractBarSeries::labelsVisible
+ Defines the visibility of the labels in series
+*/
+/*!
+ \qmlproperty bool AbstractBarSeries::labelsVisible
+ Defines the visibility of the labels in series
+*/
+
+/*!
+ \property QAbstractBarSeries::labelsFormat
+ The \a format used for showing labels in series.
+
+ QAbstractBarSeries supports the following format tag:
+ \table
+ \row
+ \li @value \li The value of the bar
+ \endtable
+
+ For example, the following usage of the format tags would produce labels that show the value
+ followed by unit ('u'):
+ \code
+ series->setLabelsFormat("@value u");
+ \endcode
+
+ By default, the labels shows the value of the bar. For percent bar series '%' is added after
+ the value. The labels are shown on the plot area, labels on the edge of the plot area are cut.
+ If the bars are close to each other the labels may overlap.
+
+ \sa QAbstractBarSeries::labelsVisible, QAbstractBarSeries::labelsPosition
+*/
+/*!
+ \qmlproperty string AbstractBarSeries::labelsFormat
+ The format used for showing labels in series.
+
+ \sa QAbstractBarSeries::labelsFormat, labelsVisible, labelsPosition
+*/
+/*!
+ \fn void QAbstractBarSeries::labelsFormatChanged(const QString &format)
+ Signal is emitted when the \a format of data value labels is changed.
+*/
+/*!
+ \qmlsignal XYSeries::onLabelsFormatChanged(string format)
+ Signal is emitted when the \a format of data value labels is changed.
+*/
+
+/*!
+ \enum QAbstractBarSeries::LabelsPosition
+
+ This enum describes the position of the data value labels.
+
+ \value LabelsCenter Label is in the center of the bar.
+ \value LabelsInsideEnd Label is inside the bar at the high end of it.
+ \value LabelsInsideBase Label is inside the bar at the low end of it.
+ \value LabelsOutsideEnd Label is outside the bar at the high end of it.
+ */
+
+/*!
+ \property QAbstractBarSeries::labelsPosition
+ Defines the \a position of value labels.
+
+ \sa QAbstractBarSeries::labelsVisible, QAbstractBarSeries::labelsFormat
+*/
+/*!
+ \qmlproperty string AbstractBarSeries::labelsPosition
+ Defines the \a position of value labels.
+
+ \sa labelsVisible, labelsFormat
+*/
+/*!
+ \fn void QAbstractBarSeries::labelsPositionChanged(QAbstractBarSeries::LabelsPosition position)
+ Signal is emitted when the \a position of value labels is changed.
+*/
+/*!
+ \qmlsignal AbstractBarSeries::onLabelsPositionChanged(LabelsPosition position)
+ Signal is emitted when the \a position of value labels is changed.
+*/
+
+/*!
+ \fn void QAbstractBarSeries::clicked(int index, QBarSet *barset)
+ The signal is emitted if the user clicks with a mouse on top of QBarSet \a barset.
+ Clicked bar inside set is indexed by \a index
+*/
+/*!
+ \qmlsignal AbstractBarSeries::onClicked(int index, BarSet barset)
+ The signal is emitted if the user clicks with a mouse on top of BarSet.
+ Clicked bar inside set is indexed by \a index
+*/
+
+/*!
+ \fn void QAbstractBarSeries::hovered(bool status, QBarSet* barset)
+
+ The signal is emitted if mouse is hovered on top of series.
+ Parameter \a barset is the pointer of barset, where hover happened.
+ Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
+*/
+
+/*!
+ \fn void QAbstractBarSeries::hovered(bool status, int index, QBarSet* barset)
+
+ The signal is emitted if mouse is hovered on top of series.
+ Parameter \a barset is the pointer of barset, where hover happened.
+ Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
+ Hovered bar inside the set is indexed by \a index.
+*/
+/*!
+ \qmlsignal AbstractBarSeries::onHovered(bool status, int index, BarSet barset)
+
+ The signal is emitted if mouse is hovered on top of series.
+ Parameter \a barset is the pointer of barset, where hover happened.
+ Parameter \a status is true, if mouse entered on top of series, false if mouse left from top of series.
+ Hovered bar inside the set is indexed by \a index.
+*/
+
+/*!
+ \fn void QAbstractBarSeries::countChanged()
+ This signal is emitted when barset count has been changed, for example by append or remove.
+*/
+/*!
+ \qmlsignal AbstractBarSeries::onCountChanged()
+ This signal is emitted when barset count has been changed, for example by append or remove.
+*/
+
+/*!
+ \fn void QAbstractBarSeries::labelsVisibleChanged()
+ This signal is emitted when labels visibility have changed.
+ \sa isLabelsVisible(), setLabelsVisible()
+*/
+
+/*!
+ \fn void QAbstractBarSeries::barsetsAdded(QList<QBarSet*> sets)
+ This signal is emitted when \a sets have been added to the series.
+ \sa append(), insert()
+*/
+/*!
+ \qmlsignal AbstractBarSeries::onBarsetsAdded(BarSet barset)
+ Emitted when \a barset has been added to the series.
+*/
+
+/*!
+ \fn void QAbstractBarSeries::barsetsRemoved(QList<QBarSet*> sets)
+ This signal is emitted when \a sets have been removed from the series.
+ \sa remove()
+*/
+/*!
+ \qmlsignal AbstractBarSeries::onBarsetsRemoved(BarSet barset)
+ Emitted when \a barset has been removed from the series.
+*/
+
+/*!
+ \qmlmethod BarSet AbstractBarSeries::at(int index)
+ Returns bar set at \a index. Returns null if the index is not valid.
+*/
+
+/*!
+ \qmlmethod BarSet AbstractBarSeries::append(string label, VariantList values)
+ Adds a new bar set with \a label and \a values to \a index. Values is a list of reals.
+ For example:
+ \code
+ myBarSeries.append("set 1", [0, 0.2, 0.2, 0.5, 0.4, 1.5, 0.9]);
+ \endcode
+*/
+
+/*!
+ \qmlmethod BarSet AbstractBarSeries::insert(int index, string label, VariantList values)
+ Inserts a new bar set with \a label and \a values to \a index. Values can be a list of reals or a list of XYPoints.
+ If index is zero or smaller, the new barset is prepended. If the index is count or bigger, the new barset is
+ appended.
+ \sa AbstractBarSeries::append()
+*/
+
+/*!
+ \qmlmethod bool AbstractBarSeries::remove(BarSet barset)
+ Removes the barset from the series. Returns true if successful, false otherwise.
+*/
+
+/*!
+ \qmlmethod AbstractBarSeries::clear()
+ Removes all barsets from the series.
+*/
+
+/*!
+ Destructs abstractbarseries and owned barsets.
+*/
+QAbstractBarSeries::~QAbstractBarSeries()
+{
+
+}
+
+/*!
+ \internal
+*/
+QAbstractBarSeries::QAbstractBarSeries(QAbstractBarSeriesPrivate &o, QObject *parent)
+ : QAbstractSeries(o, parent)
+{
+ Q_D(QAbstractSeries);
+ QObject::connect(this, SIGNAL(countChanged()), d, SIGNAL(countChanged()));
+}
+
+/*!
+ Sets the width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars
+ is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen
+ is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis.
+ Note that with \link QBarSeries \endlink this value means the width of one group of bars instead of just one bar.
+*/
+void QAbstractBarSeries::setBarWidth(qreal width)
+{
+ Q_D(QAbstractBarSeries);
+ d->setBarWidth(width);
+}
+
+/*!
+ Returns the width of the bars of the series.
+ \sa setBarWidth()
+*/
+qreal QAbstractBarSeries::barWidth() const
+{
+ Q_D(const QAbstractBarSeries);
+ return d->barWidth();
+}
+
+/*!
+ Adds a set of bars to series. Takes ownership of \a set. If the set is null or is already in series, it won't be appended.
+ Returns true, if appending succeeded.
+*/
+bool QAbstractBarSeries::append(QBarSet *set)
+{
+ Q_D(QAbstractBarSeries);
+ bool success = d->append(set);
+ if (success) {
+ QList<QBarSet *> sets;
+ sets.append(set);
+ set->setParent(this);
+ emit barsetsAdded(sets);
+ emit countChanged();
+ }
+ return success;
+}
+
+/*!
+ Removes barset from series. Releases ownership of \a set. Deletes the set, if remove
+ was successful.
+ Returns true, if set was removed.
+*/
+bool QAbstractBarSeries::remove(QBarSet *set)
+{
+ Q_D(QAbstractBarSeries);
+ bool success = d->remove(set);
+ if (success) {
+ QList<QBarSet *> sets;
+ sets.append(set);
+ set->setParent(0);
+ emit barsetsRemoved(sets);
+ emit countChanged();
+ delete set;
+ set = 0;
+ }
+ return success;
+}
+
+/*!
+ Takes a single \a set from the series. Does not delete the barset object.
+
+ NOTE: The series remains as the barset's parent object. You must set the
+ parent object to take full ownership.
+
+ Returns true if take was successful.
+*/
+bool QAbstractBarSeries::take(QBarSet *set)
+{
+ Q_D(QAbstractBarSeries);
+ bool success = d->remove(set);
+ if (success) {
+ QList<QBarSet *> sets;
+ sets.append(set);
+ emit barsetsRemoved(sets);
+ emit countChanged();
+ }
+ return success;
+}
+
+/*!
+ Adds a list of barsets to series. Takes ownership of \a sets.
+ Returns true, if all sets were appended successfully. If any of the sets is null or is already appended to series,
+ nothing is appended and function returns false. If any of the sets is in list more than once, nothing is appended
+ and function returns false.
+*/
+bool QAbstractBarSeries::append(QList<QBarSet *> sets)
+{
+ Q_D(QAbstractBarSeries);
+ bool success = d->append(sets);
+ if (success) {
+ emit barsetsAdded(sets);
+ emit countChanged();
+ }
+ return success;
+}
+
+/*!
+ Insert a set of bars to series at \a index postion. Takes ownership of \a set. If the set is null or is already in series, it won't be appended.
+ Returns true, if inserting succeeded.
+
+*/
+bool QAbstractBarSeries::insert(int index, QBarSet *set)
+{
+ Q_D(QAbstractBarSeries);
+ bool success = d->insert(index, set);
+ if (success) {
+ QList<QBarSet *> sets;
+ sets.append(set);
+ emit barsetsAdded(sets);
+ emit countChanged();
+ }
+ return success;
+}
+
+/*!
+ Removes all barsets from the series. Deletes removed sets.
+*/
+void QAbstractBarSeries::clear()
+{
+ Q_D(QAbstractBarSeries);
+ QList<QBarSet *> sets = barSets();
+ bool success = d->remove(sets);
+ if (success) {
+ emit barsetsRemoved(sets);
+ emit countChanged();
+ foreach (QBarSet *set, sets)
+ delete set;
+ }
+}
+
+/*!
+ Returns number of sets in series.
+*/
+int QAbstractBarSeries::count() const
+{
+ Q_D(const QAbstractBarSeries);
+ return d->m_barSets.count();
+}
+
+/*!
+ Returns a list of sets in series. Keeps ownership of sets.
+ */
+QList<QBarSet *> QAbstractBarSeries::barSets() const
+{
+ Q_D(const QAbstractBarSeries);
+ return d->m_barSets;
+}
+
+/*!
+ Sets the visibility of labels in series to \a visible
+*/
+void QAbstractBarSeries::setLabelsVisible(bool visible)
+{
+ Q_D(QAbstractBarSeries);
+ if (d->m_labelsVisible != visible) {
+ d->setLabelsVisible(visible);
+ emit labelsVisibleChanged();
+ }
+}
+
+/*!
+ Returns the visibility of labels
+*/
+bool QAbstractBarSeries::isLabelsVisible() const
+{
+ Q_D(const QAbstractBarSeries);
+ return d->m_labelsVisible;
+}
+
+void QAbstractBarSeries::setLabelsFormat(const QString &format)
+{
+ Q_D(QAbstractBarSeries);
+ if (d->m_labelsFormat != format) {
+ d->m_labelsFormat = format;
+ emit labelsFormatChanged(format);
+ }
+}
+
+QString QAbstractBarSeries::labelsFormat() const
+{
+ Q_D(const QAbstractBarSeries);
+ return d->m_labelsFormat;
+}
+
+void QAbstractBarSeries::setLabelsPosition(QAbstractBarSeries::LabelsPosition position)
+{
+ Q_D(QAbstractBarSeries);
+ if (d->m_labelsPosition != position) {
+ d->m_labelsPosition = position;
+ emit labelsPositionChanged(position);
+ }
+}
+
+QAbstractBarSeries::LabelsPosition QAbstractBarSeries::labelsPosition() const
+{
+ Q_D(const QAbstractBarSeries);
+ return d->m_labelsPosition;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QAbstractBarSeriesPrivate::QAbstractBarSeriesPrivate(QAbstractBarSeries *q) :
+ QAbstractSeriesPrivate(q),
+ m_barWidth(0.5), // Default value is 50% of category width
+ m_labelsVisible(false),
+ m_visible(true),
+ m_blockBarUpdate(false),
+ m_labelsFormat(),
+ m_labelsPosition(QAbstractBarSeries::LabelsCenter)
+{
+}
+
+int QAbstractBarSeriesPrivate::categoryCount() const
+{
+ // No categories defined. return count of longest set.
+ int count = 0;
+ for (int i = 0; i < m_barSets.count(); i++) {
+ if (m_barSets.at(i)->count() > count)
+ count = m_barSets.at(i)->count();
+ }
+
+ return count;
+}
+
+void QAbstractBarSeriesPrivate::setBarWidth(qreal width)
+{
+ if (width < 0.0)
+ width = 0.0;
+ m_barWidth = width;
+ emit updatedLayout();
+}
+
+qreal QAbstractBarSeriesPrivate::barWidth() const
+{
+ return m_barWidth;
+}
+
+QBarSet *QAbstractBarSeriesPrivate::barsetAt(int index)
+{
+ return m_barSets.at(index);
+}
+
+void QAbstractBarSeriesPrivate::setVisible(bool visible)
+{
+ m_visible = visible;
+ emit visibleChanged();
+}
+
+void QAbstractBarSeriesPrivate::setLabelsVisible(bool visible)
+{
+ m_labelsVisible = visible;
+ emit labelsVisibleChanged(visible);
+}
+
+qreal QAbstractBarSeriesPrivate::min()
+{
+ if (m_barSets.count() <= 0)
+ return 0;
+
+ qreal min = INT_MAX;
+
+ for (int i = 0; i < m_barSets.count(); i++) {
+ int categoryCount = m_barSets.at(i)->count();
+ for (int j = 0; j < categoryCount; j++) {
+ qreal temp = m_barSets.at(i)->at(j);
+ if (temp < min)
+ min = temp;
+ }
+ }
+ return min;
+}
+
+qreal QAbstractBarSeriesPrivate::max()
+{
+ if (m_barSets.count() <= 0)
+ return 0;
+
+ qreal max = INT_MIN;
+
+ for (int i = 0; i < m_barSets.count(); i++) {
+ int categoryCount = m_barSets.at(i)->count();
+ for (int j = 0; j < categoryCount; j++) {
+ qreal temp = m_barSets.at(i)->at(j);
+ if (temp > max)
+ max = temp;
+ }
+ }
+
+ return max;
+}
+
+qreal QAbstractBarSeriesPrivate::valueAt(int set, int category)
+{
+ if ((set < 0) || (set >= m_barSets.count()))
+ return 0; // No set, no value.
+ else if ((category < 0) || (category >= m_barSets.at(set)->count()))
+ return 0; // No category, no value.
+
+ return m_barSets.at(set)->at(category);
+}
+
+qreal QAbstractBarSeriesPrivate::percentageAt(int set, int category)
+{
+ if ((set < 0) || (set >= m_barSets.count()))
+ return 0; // No set, no value.
+ else if ((category < 0) || (category >= m_barSets.at(set)->count()))
+ return 0; // No category, no value.
+
+ qreal value = m_barSets.at(set)->at(category);
+ qreal sum = categorySum(category);
+ if (qFuzzyCompare(sum, 0))
+ return 0;
+
+ return value / sum;
+}
+
+qreal QAbstractBarSeriesPrivate::categorySum(int category)
+{
+ qreal sum(0);
+ int count = m_barSets.count(); // Count sets
+ for (int set = 0; set < count; set++) {
+ if (category < m_barSets.at(set)->count())
+ sum += m_barSets.at(set)->at(category);
+ }
+ return sum;
+}
+
+qreal QAbstractBarSeriesPrivate::absoluteCategorySum(int category)
+{
+ qreal sum(0);
+ int count = m_barSets.count(); // Count sets
+ for (int set = 0; set < count; set++) {
+ if (category < m_barSets.at(set)->count())
+ sum += qAbs(m_barSets.at(set)->at(category));
+ }
+ return sum;
+}
+
+qreal QAbstractBarSeriesPrivate::maxCategorySum()
+{
+ qreal max = INT_MIN;
+ int count = categoryCount();
+ for (int i = 0; i < count; i++) {
+ qreal sum = categorySum(i);
+ if (sum > max)
+ max = sum;
+ }
+ return max;
+}
+
+qreal QAbstractBarSeriesPrivate::minX()
+{
+ if (m_barSets.count() <= 0)
+ return 0;
+
+ qreal min = INT_MAX;
+
+ for (int i = 0; i < m_barSets.count(); i++) {
+ int categoryCount = m_barSets.at(i)->count();
+ for (int j = 0; j < categoryCount; j++) {
+ qreal temp = m_barSets.at(i)->d_ptr.data()->m_values.at(j).x();
+ if (temp < min)
+ min = temp;
+ }
+ }
+ return min;
+}
+
+qreal QAbstractBarSeriesPrivate::maxX()
+{
+ if (m_barSets.count() <= 0)
+ return 0;
+
+ qreal max = INT_MIN;
+
+ for (int i = 0; i < m_barSets.count(); i++) {
+ int categoryCount = m_barSets.at(i)->count();
+ for (int j = 0; j < categoryCount; j++) {
+ qreal temp = m_barSets.at(i)->d_ptr.data()->m_values.at(j).x();
+ if (temp > max)
+ max = temp;
+ }
+ }
+
+ return max;
+}
+
+qreal QAbstractBarSeriesPrivate::categoryTop(int category)
+{
+ // Returns top (sum of all positive values) of category.
+ // Returns 0, if all values are negative
+ qreal top(0);
+ int count = m_barSets.count();
+ for (int set = 0; set < count; set++) {
+ if (category < m_barSets.at(set)->count()) {
+ qreal temp = m_barSets.at(set)->at(category);
+ if (temp > 0) {
+ top += temp;
+ }
+ }
+ }
+ return top;
+}
+
+qreal QAbstractBarSeriesPrivate::categoryBottom(int category)
+{
+ // Returns bottom (sum of all negative values) of category
+ // Returns 0, if all values are positive
+ qreal bottom(0);
+ int count = m_barSets.count();
+ for (int set = 0; set < count; set++) {
+ if (category < m_barSets.at(set)->count()) {
+ qreal temp = m_barSets.at(set)->at(category);
+ if (temp < 0) {
+ bottom += temp;
+ }
+ }
+ }
+ return bottom;
+}
+
+qreal QAbstractBarSeriesPrivate::top()
+{
+ // Returns top of all categories
+ qreal top(0);
+ int count = categoryCount();
+ for (int i = 0; i < count; i++) {
+ qreal temp = categoryTop(i);
+ if (temp > top)
+ top = temp;
+ }
+ return top;
+}
+
+qreal QAbstractBarSeriesPrivate::bottom()
+{
+ // Returns bottom of all categories
+ qreal bottom(0);
+ int count = categoryCount();
+ for (int i = 0; i < count; i++) {
+ qreal temp = categoryBottom(i);
+ if (temp < bottom)
+ bottom = temp;
+ }
+ return bottom;
+}
+
+bool QAbstractBarSeriesPrivate::blockBarUpdate()
+{
+ return m_blockBarUpdate;
+}
+
+void QAbstractBarSeriesPrivate::initializeDomain()
+{
+ qreal minX(domain()->minX());
+ qreal minY(domain()->minY());
+ qreal maxX(domain()->maxX());
+ qreal maxY(domain()->maxY());
+
+ qreal seriesMinX = this->minX();
+ qreal seriesMaxX = this->maxX();
+ qreal y = max();
+ minX = qMin(minX, seriesMinX - (qreal)0.5);
+ minY = qMin(minY, y);
+ maxX = qMax(maxX, seriesMaxX + (qreal)0.5);
+ maxY = qMax(maxY, y);
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+QList<QLegendMarker*> QAbstractBarSeriesPrivate::createLegendMarkers(QLegend* legend)
+{
+ Q_Q(QAbstractBarSeries);
+ QList<QLegendMarker*> markers;
+
+ foreach(QBarSet* set, q->barSets()) {
+ QBarLegendMarker* marker = new QBarLegendMarker(q,set,legend);
+ markers << marker;
+ }
+ return markers;
+}
+
+
+bool QAbstractBarSeriesPrivate::append(QBarSet *set)
+{
+ if ((m_barSets.contains(set)) || (set == 0))
+ return false; // Fail if set is already in list or set is null.
+
+ m_barSets.append(set);
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
+
+ emit restructuredBars(); // this notifies barchartitem
+ return true;
+}
+
+bool QAbstractBarSeriesPrivate::remove(QBarSet *set)
+{
+ if (!m_barSets.contains(set))
+ return false; // Fail if set is not in list
+
+ m_barSets.removeOne(set);
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
+
+ emit restructuredBars(); // this notifies barchartitem
+ return true;
+}
+
+bool QAbstractBarSeriesPrivate::append(QList<QBarSet * > sets)
+{
+ foreach (QBarSet *set, sets) {
+ if ((set == 0) || (m_barSets.contains(set)))
+ return false; // Fail if any of the sets is null or is already appended.
+ if (sets.count(set) != 1)
+ return false; // Also fail if same set is more than once in given list.
+ }
+
+ foreach (QBarSet *set, sets) {
+ m_barSets.append(set);
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
+ }
+
+ emit restructuredBars(); // this notifies barchartitem
+ return true;
+}
+
+bool QAbstractBarSeriesPrivate::remove(QList<QBarSet * > sets)
+{
+ if (sets.count() == 0)
+ return false;
+
+ foreach (QBarSet *set, sets) {
+ if ((set == 0) || (!m_barSets.contains(set)))
+ return false; // Fail if any of the sets is null or is not in series
+ if (sets.count(set) != 1)
+ return false; // Also fail if same set is more than once in given list.
+ }
+
+ foreach (QBarSet *set, sets) {
+ m_barSets.removeOne(set);
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
+ }
+
+ emit restructuredBars(); // this notifies barchartitem
+
+ return true;
+}
+
+bool QAbstractBarSeriesPrivate::insert(int index, QBarSet *set)
+{
+ if ((m_barSets.contains(set)) || (set == 0))
+ return false; // Fail if set is already in list or set is null.
+
+ m_barSets.insert(index, set);
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedBars()), this, SIGNAL(updatedBars()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBars()), this, SIGNAL(restructuredBars()));
+
+ emit restructuredBars(); // this notifies barchartitem
+ return true;
+}
+
+void QAbstractBarSeriesPrivate::initializeAxes()
+{
+ Q_Q(QAbstractBarSeries);
+
+ foreach(QAbstractAxis* axis, m_axes) {
+
+ if (axis->type() == QAbstractAxis::AxisTypeBarCategory) {
+ switch (q->type()) {
+ case QAbstractSeries::SeriesTypeHorizontalBar:
+ case QAbstractSeries::SeriesTypeHorizontalPercentBar:
+ case QAbstractSeries::SeriesTypeHorizontalStackedBar:
+ if (axis->orientation() == Qt::Vertical)
+ populateCategories(qobject_cast<QBarCategoryAxis *>(axis));
+ break;
+ case QAbstractSeries::SeriesTypeBar:
+ case QAbstractSeries::SeriesTypePercentBar:
+ case QAbstractSeries::SeriesTypeStackedBar:
+ case QAbstractSeries::SeriesTypeBoxPlot:
+ if (axis->orientation() == Qt::Horizontal)
+ populateCategories(qobject_cast<QBarCategoryAxis *>(axis));
+ break;
+ default:
+ qWarning() << "Unexpected series type";
+ break;
+ }
+ }
+ }
+}
+
+QAbstractAxis::AxisType QAbstractBarSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
+{
+ Q_Q(const QAbstractBarSeries);
+
+ switch (q->type()) {
+ case QAbstractSeries::SeriesTypeHorizontalBar:
+ case QAbstractSeries::SeriesTypeHorizontalPercentBar:
+ case QAbstractSeries::SeriesTypeHorizontalStackedBar:
+ if (orientation == Qt::Vertical)
+ return QAbstractAxis::AxisTypeBarCategory;
+ break;
+ case QAbstractSeries::SeriesTypeBar:
+ case QAbstractSeries::SeriesTypePercentBar:
+ case QAbstractSeries::SeriesTypeStackedBar:
+ case QAbstractSeries::SeriesTypeBoxPlot:
+ if (orientation == Qt::Horizontal)
+ return QAbstractAxis::AxisTypeBarCategory;
+ break;
+ default:
+ qWarning() << "Unexpected series type";
+ break;
+ }
+ return QAbstractAxis::AxisTypeValue;
+
+}
+
+void QAbstractBarSeriesPrivate::populateCategories(QBarCategoryAxis *axis)
+{
+ QStringList categories;
+ if (axis->categories().isEmpty()) {
+ for (int i(1); i < categoryCount() + 1; i++)
+ categories << presenter()->numberToString(i);
+ axis->append(categories);
+ }
+}
+
+QAbstractAxis* QAbstractBarSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
+{
+ if (defaultAxisType(orientation) == QAbstractAxis::AxisTypeBarCategory)
+ return new QBarCategoryAxis;
+ else
+ return new QValueAxis;
+}
+
+void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
+{
+ m_blockBarUpdate = true; // Ensures that the bars are not updated before the theme is ready
+
+ const QList<QGradient> gradients = theme->seriesGradients();
+
+ qreal takeAtPos = 0.5;
+ qreal step = 0.2;
+ if (m_barSets.count() > 1) {
+ step = 1.0 / (qreal) m_barSets.count();
+ if (m_barSets.count() % gradients.count())
+ step *= gradients.count();
+ else
+ step *= (gradients.count() - 1);
+ }
+
+ for (int i(0); i < m_barSets.count(); i++) {
+ int colorIndex = (index + i) % gradients.count();
+ if (i > 0 && i %gradients.count() == 0) {
+ // There is no dedicated base color for each sets, generate more colors
+ takeAtPos += step;
+ if (takeAtPos == 1.0)
+ takeAtPos += step;
+ takeAtPos -= (int) takeAtPos;
+ }
+ if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->d_ptr->m_brush)
+ m_barSets.at(i)->setBrush(ChartThemeManager::colorAt(gradients.at(colorIndex), takeAtPos));
+
+ // Pick label color from the opposite end of the gradient.
+ // 0.3 as a boundary seems to work well.
+ if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->d_ptr->m_labelBrush) {
+ if (takeAtPos < 0.3)
+ m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 1));
+ else
+ m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0));
+ }
+ if (forced || QChartPrivate::defaultPen() == m_barSets.at(i)->d_ptr->m_pen) {
+ QColor c = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0);
+ m_barSets.at(i)->setPen(c);
+ }
+ }
+ m_blockBarUpdate = false;
+ emit updatedBars();
+}
+
+void QAbstractBarSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
+{
+ AbstractBarChartItem *bar = static_cast<AbstractBarChartItem *>(m_item.data());
+ Q_ASSERT(bar);
+ if (bar->animation())
+ bar->animation()->stopAndDestroyLater();
+
+ if (options.testFlag(QChart::SeriesAnimations))
+ bar->setAnimation(new BarAnimation(bar));
+ else
+ bar->setAnimation(0);
+ QAbstractSeriesPrivate::initializeAnimations(options);
+}
+
+#include "moc_qabstractbarseries.cpp"
+#include "moc_qabstractbarseries_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/qabstractbarseries.h b/src/charts/barchart/qabstractbarseries.h
new file mode 100644
index 00000000..85f32ff7
--- /dev/null
+++ b/src/charts/barchart/qabstractbarseries.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QABSTRACTBARSERIES_H
+#define QABSTRACTBARSERIES_H
+
+#include <QtCharts/qabstractseries.h>
+#include <QStringList>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarSet;
+class QAbstractBarSeriesPrivate;
+
+// Container for series
+class QT_CHARTS_EXPORT QAbstractBarSeries : public QAbstractSeries
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal barWidth READ barWidth WRITE setBarWidth)
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
+ Q_PROPERTY(QString labelsFormat READ labelsFormat WRITE setLabelsFormat NOTIFY labelsFormatChanged)
+ Q_PROPERTY(LabelsPosition labelsPosition READ labelsPosition WRITE setLabelsPosition NOTIFY labelsPositionChanged)
+ Q_ENUMS(LabelsPosition)
+
+public:
+ enum LabelsPosition {
+ LabelsCenter = 0,
+ LabelsInsideEnd,
+ LabelsInsideBase,
+ LabelsOutsideEnd
+ };
+
+public:
+ virtual ~QAbstractBarSeries();
+
+ void setBarWidth(qreal width);
+ qreal barWidth() const;
+
+ bool append(QBarSet *set);
+ bool remove(QBarSet *set);
+ bool take(QBarSet *set);
+ bool append(QList<QBarSet *> sets);
+ bool insert(int index, QBarSet *set);
+ int count() const;
+ QList<QBarSet *> barSets() const;
+ void clear();
+
+ void setLabelsVisible(bool visible = true);
+ bool isLabelsVisible() const;
+
+ void setLabelsFormat(const QString &format);
+ QString labelsFormat() const;
+
+ void setLabelsPosition(QAbstractBarSeries::LabelsPosition position);
+ QAbstractBarSeries::LabelsPosition labelsPosition() const;
+
+protected:
+ explicit QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *parent = 0);
+
+Q_SIGNALS:
+ void clicked(int index, QBarSet *barset);
+ void hovered(bool status, QBarSet *barset);
+ void hovered(bool status, int index, QBarSet *barset);
+ void countChanged();
+ void labelsVisibleChanged();
+ void labelsFormatChanged(const QString &format);
+ void labelsPositionChanged(QAbstractBarSeries::LabelsPosition position);
+
+ void barsetsAdded(QList<QBarSet *> sets);
+ void barsetsRemoved(QList<QBarSet *> sets);
+
+protected:
+ Q_DECLARE_PRIVATE(QAbstractBarSeries)
+ friend class AbstractBarChartItem;
+ friend class PercentBarChartItem;
+ friend class StackedBarChartItem;
+ friend class BoxPlotChartItem;
+ friend class BarChartItem;
+ friend class HorizontalBarChartItem;
+ friend class HorizontalStackedBarChartItem;
+ friend class HorizontalPercentBarChartItem;
+ friend class BarSet;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QABSTRACTBARSERIES_H
diff --git a/src/charts/barchart/qabstractbarseries_p.h b/src/charts/barchart/qabstractbarseries_p.h
new file mode 100644
index 00000000..c7b0b827
--- /dev/null
+++ b/src/charts/barchart/qabstractbarseries_p.h
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QABSTRACTBARSERIES_P_H
+#define QABSTRACTBARSERIES_P_H
+
+#include <QtCharts/qabstractbarseries.h>
+#include "qabstractseries_p.h"
+#include <QStringList>
+#include <QAbstractSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarModelMapper;
+class QBarCategoryAxis;
+class QLegendMarker;
+
+class QAbstractBarSeriesPrivate : public QAbstractSeriesPrivate
+{
+ Q_OBJECT
+public:
+ QAbstractBarSeriesPrivate(QAbstractBarSeries *parent);
+ int categoryCount() const;
+
+ void setBarWidth(qreal width);
+ qreal barWidth() const;
+
+ void setVisible(bool visible);
+ void setLabelsVisible(bool visible);
+
+ void initializeDomain();
+ void initializeAxes();
+ void initializeAnimations(QChart::AnimationOptions options);
+ void initializeTheme(int index, ChartTheme* theme, bool forced = false);
+
+ QList<QLegendMarker*> createLegendMarkers(QLegend *legend);
+
+ virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
+ QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
+
+ bool append(QBarSet *set);
+ bool remove(QBarSet *set);
+ bool append(QList<QBarSet *> sets);
+ bool remove(QList<QBarSet *> sets);
+ bool insert(int index, QBarSet *set);
+
+ QBarSet *barsetAt(int index);
+ qreal min();
+ qreal max();
+ qreal valueAt(int set, int category);
+ qreal percentageAt(int set, int category);
+ qreal categorySum(int category);
+ qreal absoluteCategorySum(int category);
+ qreal maxCategorySum();
+ qreal minX();
+ qreal maxX();
+ qreal categoryTop(int category);
+ qreal categoryBottom(int category);
+ qreal top();
+ qreal bottom();
+
+ bool blockBarUpdate();
+
+Q_SIGNALS:
+ void clicked(int index, QBarSet *barset);
+ void updatedBars();
+ void updatedLayout();
+ void restructuredBars();
+ void labelsVisibleChanged(bool visible);
+ void visibleChanged();
+
+private:
+ void populateCategories(QBarCategoryAxis *axis);
+
+protected:
+ QList<QBarSet *> m_barSets;
+ qreal m_barWidth;
+ bool m_labelsVisible;
+ bool m_visible;
+ bool m_blockBarUpdate;
+ QString m_labelsFormat;
+ QAbstractBarSeries::LabelsPosition m_labelsPosition;
+
+private:
+ Q_DECLARE_PUBLIC(QAbstractBarSeries)
+ friend class HorizontalBarChartItem;
+ friend class BarChartItem;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QABSTRACTBARSERIES_P_H
diff --git a/src/charts/barchart/qbarmodelmapper.cpp b/src/charts/barchart/qbarmodelmapper.cpp
new file mode 100644
index 00000000..459a72ca
--- /dev/null
+++ b/src/charts/barchart/qbarmodelmapper.cpp
@@ -0,0 +1,561 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbarmodelmapper.h"
+#include "qbarmodelmapper_p.h"
+#include "qabstractbarseries.h"
+#include "qbarset.h"
+#include "qchart.h"
+#include <QAbstractItemModel>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+QBarModelMapper::QBarModelMapper(QObject *parent) :
+ QObject(parent),
+ d_ptr(new QBarModelMapperPrivate(this))
+{
+}
+
+QAbstractItemModel *QBarModelMapper::model() const
+{
+ Q_D(const QBarModelMapper);
+ return d->m_model;
+}
+
+void QBarModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model == 0)
+ return;
+
+ Q_D(QBarModelMapper);
+ if (d->m_model)
+ disconnect(d->m_model, 0, d, 0);
+
+ d->m_model = model;
+ d->initializeBarFromModel();
+ // connect signals from the model
+ connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
+ connect(d->m_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), d, SLOT(modelHeaderDataUpdated(Qt::Orientation,int,int)));
+ connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
+}
+
+QAbstractBarSeries *QBarModelMapper::series() const
+{
+ Q_D(const QBarModelMapper);
+ return d->m_series;
+}
+
+void QBarModelMapper::setSeries(QAbstractBarSeries *series)
+{
+ Q_D(QBarModelMapper);
+ if (d->m_series)
+ disconnect(d->m_series, 0, d, 0);
+
+ if (series == 0)
+ return;
+
+ d->m_series = series;
+ d->initializeBarFromModel();
+ // connect the signals from the series
+ connect(d->m_series, SIGNAL(barsetsAdded(QList<QBarSet*>)), d, SLOT(barSetsAdded(QList<QBarSet*>)));
+ connect(d->m_series, SIGNAL(barsetsRemoved(QList<QBarSet*>)), d, SLOT(barSetsRemoved(QList<QBarSet*>)));
+ connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
+}
+
+/*!
+ Returns which row/column of the model contains the first values of the QBarSets in the series.
+ The default value is 0.
+*/
+int QBarModelMapper::first() const
+{
+ Q_D(const QBarModelMapper);
+ return d->m_first;
+}
+
+/*!
+ Sets which row of the model contains the \a first values of the QBarSets in the series.
+ The default value is 0.
+*/
+void QBarModelMapper::setFirst(int first)
+{
+ Q_D(QBarModelMapper);
+ d->m_first = qMax(first, 0);
+ d->initializeBarFromModel();
+}
+
+/*!
+ Returns the number of rows/columns of the model that are mapped as the data for QAbstractBarSeries
+ Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
+*/
+int QBarModelMapper::count() const
+{
+ Q_D(const QBarModelMapper);
+ return d->m_count;
+}
+
+/*!
+ Sets the \a count of rows/columns of the model that are mapped as the data for QAbstractBarSeries
+ Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
+*/
+void QBarModelMapper::setCount(int count)
+{
+ Q_D(QBarModelMapper);
+ d->m_count = qMax(count, -1);
+ d->initializeBarFromModel();
+}
+
+/*!
+ Returns the orientation that is used when QBarModelMapper accesses the model.
+ This mean whether the consecutive values of the bar set are read from row (Qt::Horizontal)
+ or from columns (Qt::Vertical)
+*/
+Qt::Orientation QBarModelMapper::orientation() const
+{
+ Q_D(const QBarModelMapper);
+ return d->m_orientation;
+}
+
+/*!
+ Returns the \a orientation that is used when QBarModelMapper accesses the model.
+ This mean whether the consecutive values of the pie are read from row (Qt::Horizontal)
+ or from columns (Qt::Vertical)
+*/
+void QBarModelMapper::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QBarModelMapper);
+ d->m_orientation = orientation;
+ d->initializeBarFromModel();
+}
+
+/*!
+ Returns which section of the model is used as the data source for the first bar set
+*/
+int QBarModelMapper::firstBarSetSection() const
+{
+ Q_D(const QBarModelMapper);
+ return d->m_firstBarSetSection;
+}
+
+/*!
+ Sets the model section that is used as the data source for the first bar set
+ Parameter \a firstBarSetSection specifies the section of the model.
+*/
+void QBarModelMapper::setFirstBarSetSection(int firstBarSetSection)
+{
+ Q_D(QBarModelMapper);
+ d->m_firstBarSetSection = qMax(-1, firstBarSetSection);
+ d->initializeBarFromModel();
+}
+
+/*!
+ Returns which section of the model is used as the data source for the last bar set
+*/
+int QBarModelMapper::lastBarSetSection() const
+{
+ Q_D(const QBarModelMapper);
+ return d->m_lastBarSetSection;
+}
+
+/*!
+ Sets the model section that is used as the data source for the last bar set
+ Parameter \a lastBarSetSection specifies the section of the model.
+*/
+void QBarModelMapper::setLastBarSetSection(int lastBarSetSection)
+{
+ Q_D(QBarModelMapper);
+ d->m_lastBarSetSection = qMax(-1, lastBarSetSection);
+ d->initializeBarFromModel();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QBarModelMapperPrivate::QBarModelMapperPrivate(QBarModelMapper *q) :
+ QObject(q),
+ m_series(0),
+ m_model(0),
+ m_first(0),
+ m_count(-1),
+ m_orientation(Qt::Vertical),
+ m_firstBarSetSection(-1),
+ m_lastBarSetSection(-1),
+ m_seriesSignalsBlock(false),
+ m_modelSignalsBlock(false),
+ q_ptr(q)
+{
+}
+
+void QBarModelMapperPrivate::blockModelSignals(bool block)
+{
+ m_modelSignalsBlock = block;
+}
+
+void QBarModelMapperPrivate::blockSeriesSignals(bool block)
+{
+ m_seriesSignalsBlock = block;
+}
+
+QBarSet *QBarModelMapperPrivate::barSet(QModelIndex index)
+{
+ if (!index.isValid())
+ return 0;
+
+ if (m_orientation == Qt::Vertical && index.column() >= m_firstBarSetSection && index.column() <= m_lastBarSetSection) {
+ if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) {
+ return m_series->barSets().at(index.column() - m_firstBarSetSection);
+ }
+ } else if (m_orientation == Qt::Horizontal && index.row() >= m_firstBarSetSection && index.row() <= m_lastBarSetSection) {
+ if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count))
+ return m_series->barSets().at(index.row() - m_firstBarSetSection);
+ }
+ return 0; // This part of model has not been mapped to any slice
+}
+
+QModelIndex QBarModelMapperPrivate::barModelIndex(int barSection, int posInBar)
+{
+ if (m_count != -1 && posInBar >= m_count)
+ return QModelIndex(); // invalid
+
+ if (barSection < m_firstBarSetSection || barSection > m_lastBarSetSection)
+ return QModelIndex(); // invalid
+
+ if (m_orientation == Qt::Vertical)
+ return m_model->index(posInBar + m_first, barSection);
+ else
+ return m_model->index(barSection, posInBar + m_first);
+}
+
+void QBarModelMapperPrivate::handleSeriesDestroyed()
+{
+ m_series = 0;
+}
+
+void QBarModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
+{
+ Q_UNUSED(topLeft)
+ Q_UNUSED(bottomRight)
+
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ QModelIndex index;
+ for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
+ for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
+ index = topLeft.sibling(row, column);
+ QBarSet *bar = barSet(index);
+ if (bar) {
+ if (m_orientation == Qt::Vertical)
+ bar->replace(row - m_first, m_model->data(index).toReal());
+ else
+ bar->replace(column - m_first, m_model->data(index).toReal());
+ }
+ }
+ }
+ blockSeriesSignals(false);
+}
+
+void QBarModelMapperPrivate::modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last)
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (orientation != m_orientation) {
+ for (int section = first; section <= last; section++) {
+ if (section >= m_firstBarSetSection && section <= m_lastBarSetSection) {
+ QBarSet *bar = m_series->barSets().at(section - m_firstBarSetSection);
+ if (bar)
+ bar->setLabel(m_model->headerData(section, orientation).toString());
+ }
+ }
+ }
+ blockSeriesSignals(false);
+}
+
+void QBarModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Vertical)
+ insertData(start, end);
+ else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize
+ initializeBarFromModel();
+ blockSeriesSignals(false);
+}
+
+void QBarModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Vertical)
+ removeData(start, end);
+ else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize
+ initializeBarFromModel();
+ blockSeriesSignals(false);
+}
+
+void QBarModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Horizontal)
+ insertData(start, end);
+ else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize
+ initializeBarFromModel();
+ blockSeriesSignals(false);
+}
+
+void QBarModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Horizontal)
+ removeData(start, end);
+ else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection) // if the changes affect the map - reinitialize
+ initializeBarFromModel();
+ blockSeriesSignals(false);
+}
+
+void QBarModelMapperPrivate::handleModelDestroyed()
+{
+ m_model = 0;
+}
+
+void QBarModelMapperPrivate::insertData(int start, int end)
+{
+ Q_UNUSED(end)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+ // Currently barchart needs to be fully recalculated when change is made.
+ // Re-initialize
+ initializeBarFromModel();
+}
+
+void QBarModelMapperPrivate::removeData(int start, int end)
+{
+ Q_UNUSED(end)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+ // Currently barchart needs to be fully recalculated when change is made.
+ // Re-initialize
+ initializeBarFromModel();
+}
+
+void QBarModelMapperPrivate::barSetsAdded(QList<QBarSet *> sets)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (sets.count() == 0)
+ return;
+
+ int firstIndex = m_series->barSets().indexOf(sets.at(0));
+ if (firstIndex == -1)
+ return;
+
+ int maxCount = 0;
+ for (int i = 0; i < sets.count(); i++) {
+ if (sets.at(i)->count() > m_count)
+ maxCount = sets.at(i)->count();
+ }
+
+ if (m_count != -1 && m_count < maxCount)
+ m_count = maxCount;
+
+ m_lastBarSetSection += sets.count();
+
+ blockModelSignals();
+ int modelCapacity = m_orientation == Qt::Vertical ? m_model->rowCount() - m_first : m_model->columnCount() - m_first;
+ if (maxCount > modelCapacity) {
+ if (m_orientation == Qt::Vertical)
+ m_model->insertRows(m_model->rowCount(), maxCount - modelCapacity);
+ else
+ m_model->insertColumns(m_model->columnCount(), maxCount - modelCapacity);
+ }
+
+ if (m_orientation == Qt::Vertical)
+ m_model->insertColumns(firstIndex + m_firstBarSetSection, sets.count());
+ else
+ m_model->insertRows(firstIndex + m_firstBarSetSection, sets.count());
+
+
+ for (int i = firstIndex + m_firstBarSetSection; i < firstIndex + m_firstBarSetSection + sets.count(); i++) {
+ m_model->setHeaderData(i, m_orientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical, sets.at(i - firstIndex - m_firstBarSetSection)->label());
+ for (int j = 0; j < sets.at(i - firstIndex - m_firstBarSetSection)->count(); j++)
+ m_model->setData(barModelIndex(i, j), sets.at(i - firstIndex - m_firstBarSetSection)->at(j));
+ }
+ blockModelSignals(false);
+ initializeBarFromModel();
+}
+
+void QBarModelMapperPrivate::barSetsRemoved(QList<QBarSet *> sets)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (sets.count() == 0)
+ return;
+
+ int firstIndex = m_barSets.indexOf(sets.at(0));
+ if (firstIndex == -1)
+ return;
+
+ m_lastBarSetSection -= sets.count();
+
+ for (int i = firstIndex + sets.count() - 1; i >= firstIndex; i--)
+ m_barSets.removeAt(i);
+
+ blockModelSignals();
+ if (m_orientation == Qt::Vertical)
+ m_model->removeColumns(firstIndex + m_firstBarSetSection, sets.count());
+ else
+ m_model->removeRows(firstIndex + m_firstBarSetSection, sets.count());
+ blockModelSignals(false);
+ initializeBarFromModel();
+}
+
+void QBarModelMapperPrivate::valuesAdded(int index, int count)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (m_count != -1)
+ m_count += count;
+
+ int barSetIndex = m_barSets.indexOf(qobject_cast<QBarSet *>(QObject::sender()));
+
+ blockModelSignals();
+ if (m_orientation == Qt::Vertical)
+ m_model->insertRows(index + m_first, count);
+ else
+ m_model->insertColumns(index + m_first, count);
+
+ for (int j = index; j < index + count; j++)
+ m_model->setData(barModelIndex(barSetIndex + m_firstBarSetSection, j), m_barSets.at(barSetIndex)->at(j));
+
+ blockModelSignals(false);
+ initializeBarFromModel();
+}
+
+void QBarModelMapperPrivate::valuesRemoved(int index, int count)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (m_count != -1)
+ m_count -= count;
+
+ blockModelSignals();
+ if (m_orientation == Qt::Vertical)
+ m_model->removeRows(index + m_first, count);
+ else
+ m_model->removeColumns(index + m_first, count);
+
+ blockModelSignals(false);
+ initializeBarFromModel();
+}
+
+void QBarModelMapperPrivate::barLabelChanged()
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ int barSetIndex = m_barSets.indexOf(qobject_cast<QBarSet *>(QObject::sender()));
+
+ blockModelSignals();
+ m_model->setHeaderData(barSetIndex + m_firstBarSetSection, m_orientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical, m_barSets.at(barSetIndex)->label());
+ blockModelSignals(false);
+ initializeBarFromModel();
+}
+
+void QBarModelMapperPrivate::barValueChanged(int index)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ int barSetIndex = m_barSets.indexOf(qobject_cast<QBarSet *>(QObject::sender()));
+
+ blockModelSignals();
+ m_model->setData(barModelIndex(barSetIndex + m_firstBarSetSection, index), m_barSets.at(barSetIndex)->at(index));
+ blockModelSignals(false);
+ initializeBarFromModel();
+}
+
+void QBarModelMapperPrivate::initializeBarFromModel()
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ blockSeriesSignals();
+ // clear current content
+ m_series->clear();
+ m_barSets.clear();
+
+ // create the initial bar sets
+ for (int i = m_firstBarSetSection; i <= m_lastBarSetSection; i++) {
+ int posInBar = 0;
+ QModelIndex barIndex = barModelIndex(i, posInBar);
+ // check if there is such model index
+ if (barIndex.isValid()) {
+ QBarSet *barSet = new QBarSet(m_model->headerData(i, m_orientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical).toString());
+ while (barIndex.isValid()) {
+ barSet->append(m_model->data(barIndex, Qt::DisplayRole).toDouble());
+ posInBar++;
+ barIndex = barModelIndex(i, posInBar);
+ }
+ connect(barSet, SIGNAL(valuesAdded(int,int)), this, SLOT(valuesAdded(int,int)));
+ connect(barSet, SIGNAL(valuesRemoved(int,int)), this, SLOT(valuesRemoved(int,int)));
+ connect(barSet, SIGNAL(valueChanged(int)), this, SLOT(barValueChanged(int)));
+ connect(barSet, SIGNAL(labelChanged()), this, SLOT(barLabelChanged()));
+ m_series->append(barSet);
+ m_barSets.append(barSet);
+ } else {
+ break;
+ }
+ }
+ blockSeriesSignals(false);
+}
+
+#include "moc_qbarmodelmapper.cpp"
+#include "moc_qbarmodelmapper_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/qbarmodelmapper.h b/src/charts/barchart/qbarmodelmapper.h
new file mode 100644
index 00000000..a527165a
--- /dev/null
+++ b/src/charts/barchart/qbarmodelmapper.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBARMODELMAPPER_H
+#define QBARMODELMAPPER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QObject>
+
+class QAbstractItemModel;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarModelMapperPrivate;
+class QAbstractBarSeries;
+
+class QT_CHARTS_EXPORT QBarModelMapper : public QObject
+{
+ Q_OBJECT
+
+protected:
+ explicit QBarModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QAbstractBarSeries *series() const;
+ void setSeries(QAbstractBarSeries *series);
+
+ int first() const;
+ void setFirst(int first);
+
+ int count() const;
+ void setCount(int count);
+
+ int firstBarSetSection() const;
+ void setFirstBarSetSection(int firstBarSetSection);
+
+ int lastBarSetSection() const;
+ void setLastBarSetSection(int lastBarSetSection);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+protected:
+ QBarModelMapperPrivate * const d_ptr;
+ Q_DECLARE_PRIVATE(QBarModelMapper)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARMODELMAPPER_H
diff --git a/src/charts/barchart/qbarmodelmapper_p.h b/src/charts/barchart/qbarmodelmapper_p.h
new file mode 100644
index 00000000..754ebec1
--- /dev/null
+++ b/src/charts/barchart/qbarmodelmapper_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBARMODELMAPPER_P_H
+#define QBARMODELMAPPER_P_H
+
+#include <QObject>
+#include "qbarmodelmapper.h"
+
+class QModelIndex;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarSet;
+
+class QBarModelMapperPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QBarModelMapperPrivate(QBarModelMapper *q);
+
+public Q_SLOTS:
+ // for the model
+ void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
+ void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
+ void modelRowsAdded(QModelIndex parent, int start, int end);
+ void modelRowsRemoved(QModelIndex parent, int start, int end);
+ void modelColumnsAdded(QModelIndex parent, int start, int end);
+ void modelColumnsRemoved(QModelIndex parent, int start, int end);
+ void handleModelDestroyed();
+
+ // for the series
+ void barSetsAdded(QList<QBarSet *> sets);
+ void barSetsRemoved(QList<QBarSet *> sets);
+ void valuesAdded(int index, int count);
+ void valuesRemoved(int index, int count);
+ void barLabelChanged();
+ void barValueChanged(int index);
+ void handleSeriesDestroyed();
+
+ void initializeBarFromModel();
+
+private:
+ QBarSet *barSet(QModelIndex index);
+ QModelIndex barModelIndex(int barSection, int posInBar);
+ void insertData(int start, int end);
+ void removeData(int start, int end);
+ void blockModelSignals(bool block = true);
+ void blockSeriesSignals(bool block = true);
+
+private:
+ QAbstractBarSeries *m_series;
+ QList<QBarSet *> m_barSets;
+ QAbstractItemModel *m_model;
+ int m_first;
+ int m_count;
+ Qt::Orientation m_orientation;
+ int m_firstBarSetSection;
+ int m_lastBarSetSection;
+ bool m_seriesSignalsBlock;
+ bool m_modelSignalsBlock;
+
+private:
+ QBarModelMapper *q_ptr;
+ Q_DECLARE_PUBLIC(QBarModelMapper)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARMODELMAPPER_P_H
diff --git a/src/charts/barchart/qbarset.cpp b/src/charts/barchart/qbarset.cpp
new file mode 100644
index 00000000..e378b327
--- /dev/null
+++ b/src/charts/barchart/qbarset.cpp
@@ -0,0 +1,676 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbarset.h"
+#include "qbarset_p.h"
+#include "charthelpers_p.h"
+#include "qchart_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QBarSet
+ \inmodule Qt Charts
+ \brief Building block for different bar charts.
+
+ QBarSet represents one set of bars. Set of bars contains one data value for each category.
+ First value of set is assumed to belong to first category, second to second category and so on.
+ If set has fewer values than there are categories, then the missing values are assumed to be
+ at the end of set. For missing values in middle of a set, numerical value of zero is used.
+
+ \mainclass
+
+ \sa QAbstractBarSeries, QBarSeries, QStackedBarSeries, QPercentBarSeries
+*/
+/*!
+ \qmltype BarSet
+ \instantiates QBarSet
+ \inqmlmodule QtCharts
+
+ \brief Building block for different bar charts.
+
+ BarSet represents one set of bars. Set of bars contains one data value for each category.
+ First value of set is assumed to belong to first category, second to second category and so on.
+ If set has fewer values than there are categories, then the missing values are assumed to be
+ at the end of set. For missing values in middle of a set, numerical value of zero is used.
+ \sa AbstractBarSeries, BarSeries, StackedBarSeries, PercentBarSeries
+*/
+
+/*!
+ \property QBarSet::label
+ Defines the label of the bar set.
+*/
+/*!
+ \qmlproperty string BarSet::label
+ Defines the label of the bar set.
+*/
+
+/*!
+ \property QBarSet::pen
+ \brief Defines the pen used by the bar set.
+*/
+
+/*!
+ \property QBarSet::brush
+ \brief Defines the brush used by the bar set.
+*/
+
+/*!
+ \qmlproperty QString BarSet::brushFilename
+ The name of the file used as a brush for the set.
+*/
+
+/*!
+ \property QBarSet::labelBrush
+ \brief Defines the brush used by the bar set's label.
+*/
+
+/*!
+ \property QBarSet::labelFont
+ \brief Defines the font used by the bar set's label.
+*/
+
+/*!
+ \qmlproperty Font BarSet::labelFont
+ Defines the font used by the bar set's label.
+
+ See the Qt documentation for more details of Font.
+*/
+
+/*!
+ \property QBarSet::color
+ The fill (brush) color of the bar set.
+*/
+/*!
+ \qmlproperty color BarSet::color
+ The fill (brush) color of the bar set.
+*/
+
+/*!
+ \property QBarSet::borderColor
+ The line (pen) color of the bar set.
+*/
+/*!
+ \qmlproperty color BarSet::borderColor
+ The line (pen) color of the bar set.
+*/
+
+/*!
+ \qmlproperty real BarSet::borderWidth
+ The width of the border line. By default the width is 2.0.
+*/
+
+/*!
+ \property QBarSet::labelColor
+ The text (label) color of the bar set.
+*/
+/*!
+ \qmlproperty color BarSet::labelColor
+ The text (label) color of the bar set.
+*/
+
+/*!
+ \fn void QBarSet::clicked(int index)
+
+ The signal is emitted if the user clicks with a mouse on top of bar set.
+ Clicked bar inside set is indexed by \a index
+*/
+
+/*!
+ \fn void QBarSet::hovered(bool status)
+
+ The signal is emitted if mouse is hovered on top of bar set.
+ Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set.
+*/
+
+/*!
+ \fn void QBarSet::hovered(bool status, int index)
+
+ The signal is emitted if mouse is hovered on top of bar set.
+ Parameter \a status is true, if mouse entered on top of bar set, false if mouse left from top of bar set.
+ Hovered bar inside the set is indexed by \a index.
+*/
+
+
+/*!
+ \fn void QBarSet::labelChanged()
+ This signal is emitted when the label of the bar set has changed.
+ \sa label
+*/
+/*!
+ \qmlsignal BarSet::onLabelChanged()
+ This signal is emitted when the label of the bar set has changed.
+*/
+
+/*!
+ \fn void QBarSet::penChanged()
+ This signal is emitted when the pen of the bar set has changed.
+ \sa pen
+*/
+
+/*!
+ \fn void QBarSet::brushChanged()
+ This signal is emitted when the brush of the bar set has changed.
+ \sa brush
+*/
+
+/*!
+ \fn void QBarSet::labelBrushChanged()
+ This signal is emitted when the brush of the bar set's label has changed.
+ \sa labelBrush
+*/
+
+/*!
+ \fn void QBarSet::labelFontChanged()
+ This signal is emitted when the font of the bar set's label has changed.
+ \sa labelBrush
+*/
+
+/*!
+ \fn void QBarSet::colorChanged(QColor)
+ This signal is emitted when the fill (brush) color of the set has changed to \a color.
+*/
+/*!
+ \qmlsignal BarSet::onColorChanged(color color)
+ This signal is emitted when the fill (brush) color of the set has changed to \a color.
+*/
+
+/*!
+ \fn void QBarSet::borderColorChanged(QColor)
+ This signal is emitted when the line (pen) color of the set has changed to \a color.
+*/
+/*!
+ \qmlsignal BarSet::onBorderColorChanged(color color)
+ This signal is emitted when the line (pen) color of the set has changed to \a color.
+*/
+
+/*!
+ \fn void QBarSet::labelColorChanged(QColor)
+ This signal is emitted when the text (label) color of the set has changed to \a color.
+*/
+/*!
+ \qmlsignal BarSet::onLabelColorChanged(color color)
+ This signal is emitted when the text (label) color of the set has changed to \a color.
+*/
+
+/*!
+ \fn void QBarSet::valuesAdded(int index, int count)
+ This signal is emitted when new values have been added to the set.
+ Parameter \a index indicates the position of the first inserted value.
+ Parameter \a count is the number of inserted values.
+ \sa append(), insert()
+*/
+/*!
+ \qmlsignal BarSet::onValuesAdded(int index, int count)
+ This signal is emitted when new values have been added to the set.
+ Parameter \a index indicates the position of the first inserted value.
+ Parameter \a count is the number of inserted values.
+*/
+
+/*!
+ \fn void QBarSet::valuesRemoved(int index, int count)
+ This signal is emitted values have been removed from the set.
+ Parameter \a index indicates the position of the first removed value.
+ Parameter \a count is the number of removed values.
+ \sa remove()
+*/
+/*!
+ \qmlsignal BarSet::onValuesRemoved(int index, int count)
+ This signal is emitted values have been removed from the set.
+ Parameter \a index indicates the position of the first removed value.
+ Parameter \a count is the number of removed values.
+*/
+
+/*!
+ \fn void QBarSet::valueChanged(int index)
+ This signal is emitted values the value in the set has been modified.
+ Parameter \a index indicates the position of the modified value.
+ \sa at()
+*/
+/*!
+ \qmlsignal BarSet::onValueChanged(int index)
+ This signal is emitted values the value in the set has been modified.
+ Parameter \a index indicates the position of the modified value.
+*/
+
+/*!
+ \qmlproperty int BarSet::count
+ The count of values on the bar set
+*/
+
+/*!
+ \qmlproperty QVariantList BarSet::values
+ The values of the bar set. You can set either a list of reals or a list of points as values. If you set a list of
+ reals as values, the values are automatically completed to points by using the index of a value as it's
+ x-coordinate. For example the following sets have equal values:
+ \code
+ myBarSet1.values = [0, 5, 1, 5];
+ myBarSet2.values = [Qt.point(0, 0), Qt.point(1, 5), Qt.point(2, 1), Qt.point(3, 5)];
+ \endcode
+*/
+
+/*!
+ Constructs QBarSet with a label of \a label and with parent of \a parent.
+*/
+QBarSet::QBarSet(const QString label, QObject *parent)
+ : QObject(parent),
+ d_ptr(new QBarSetPrivate(label, this))
+{
+}
+
+/*!
+ Destroys the bar set.
+*/
+QBarSet::~QBarSet()
+{
+ // NOTE: d_ptr destroyed by QObject
+}
+
+/*!
+ Sets new \a label for set.
+*/
+void QBarSet::setLabel(const QString label)
+{
+ d_ptr->m_label = label;
+ emit labelChanged();
+}
+
+/*!
+ Returns label of the set.
+*/
+QString QBarSet::label() const
+{
+ return d_ptr->m_label;
+}
+
+/*!
+ Appends new value \a value to the end of set.
+*/
+void QBarSet::append(const qreal value)
+{
+ // Convert to QPointF
+ int index = d_ptr->m_values.count();
+ d_ptr->append(QPointF(d_ptr->m_values.count(), value));
+ emit valuesAdded(index, 1);
+}
+
+/*!
+ Appends a list of reals to set. Works like append with single real value. The \a values in list
+ are appended to end of bar set.
+ \sa append()
+*/
+void QBarSet::append(const QList<qreal> &values)
+{
+ int index = d_ptr->m_values.count();
+ d_ptr->append(values);
+ emit valuesAdded(index, values.count());
+}
+
+/*!
+ Convenience operator. Same as append, with real \a value.
+ \sa append()
+*/
+QBarSet &QBarSet::operator << (const qreal &value)
+{
+ append(value);
+ return *this;
+}
+
+/*!
+ Inserts new \a value on the \a index position.
+ The value that is currently at this postion is moved to position index + 1
+ \sa remove()
+*/
+void QBarSet::insert(const int index, const qreal value)
+{
+ d_ptr->insert(index, value);
+ emit valuesAdded(index, 1);
+}
+
+/*!
+ Removes \a count number of values from the set starting at \a index.
+ \sa insert()
+*/
+void QBarSet::remove(const int index, const int count)
+{
+ int removedCount = d_ptr->remove(index, count);
+ if (removedCount > 0)
+ emit valuesRemoved(index, removedCount);
+ return;
+}
+
+/*!
+ Sets a new value \a value to set, indexed by \a index.
+*/
+void QBarSet::replace(const int index, const qreal value)
+{
+ if (index >= 0 && index < d_ptr->m_values.count()) {
+ d_ptr->replace(index, value);
+ emit valueChanged(index);
+ }
+}
+
+
+/*!
+ Returns value of set indexed by \a index.
+ If the index is out of bounds 0.0 is returned.
+*/
+qreal QBarSet::at(const int index) const
+{
+ if (index < 0 || index >= d_ptr->m_values.count())
+ return 0;
+ return d_ptr->m_values.at(index).y();
+}
+
+/*!
+ Returns value of set indexed by \a index.
+ If the index is out of bounds 0.0 is returned.
+*/
+qreal QBarSet::operator [](const int index) const
+{
+ return at(index);
+}
+
+/*!
+ Returns count of values in set.
+*/
+int QBarSet::count() const
+{
+ return d_ptr->m_values.count();
+}
+
+/*!
+ Returns sum of all values in the bar set.
+*/
+qreal QBarSet::sum() const
+{
+ qreal total(0);
+ for (int i = 0; i < d_ptr->m_values.count(); i++)
+ total += d_ptr->m_values.at(i).y();
+ return total;
+}
+
+/*!
+ Sets pen for set. Bars of this set are drawn using \a pen
+*/
+void QBarSet::setPen(const QPen &pen)
+{
+ if (d_ptr->m_pen != pen) {
+ d_ptr->m_pen = pen;
+ emit d_ptr->updatedBars();
+ emit penChanged();
+ }
+}
+
+/*!
+ Returns pen of the set.
+*/
+QPen QBarSet::pen() const
+{
+ if (d_ptr->m_pen == QChartPrivate::defaultPen())
+ return QPen();
+ else
+ return d_ptr->m_pen;
+}
+
+/*!
+ Sets brush for the set. Bars of this set are drawn using \a brush.
+*/
+void QBarSet::setBrush(const QBrush &brush)
+{
+ if (d_ptr->m_brush != brush) {
+ d_ptr->m_brush = brush;
+ emit d_ptr->updatedBars();
+ emit brushChanged();
+ }
+}
+
+/*!
+ Returns brush of the set.
+*/
+QBrush QBarSet::brush() const
+{
+ if (d_ptr->m_brush == QChartPrivate::defaultBrush())
+ return QBrush();
+ else
+ return d_ptr->m_brush;
+}
+
+/*!
+ Sets \a brush of the values that are drawn on top of this bar set.
+*/
+void QBarSet::setLabelBrush(const QBrush &brush)
+{
+ if (d_ptr->m_labelBrush != brush) {
+ d_ptr->m_labelBrush = brush;
+ emit d_ptr->updatedBars();
+ emit labelBrushChanged();
+ }
+}
+
+/*!
+ Returns brush of the values that are drawn on top of this bar set.
+*/
+QBrush QBarSet::labelBrush() const
+{
+ if (d_ptr->m_labelBrush == QChartPrivate::defaultBrush())
+ return QBrush();
+ else
+ return d_ptr->m_labelBrush;
+}
+
+/*!
+ Sets the \a font for values that are drawn on top of this bar set.
+*/
+void QBarSet::setLabelFont(const QFont &font)
+{
+ if (d_ptr->m_labelFont != font) {
+ d_ptr->m_labelFont = font;
+ emit d_ptr->updatedBars();
+ emit labelFontChanged();
+ }
+
+}
+
+/*!
+ Returns the pen for values that are drawn on top of this bar set.
+*/
+QFont QBarSet::labelFont() const
+{
+ return d_ptr->m_labelFont;
+}
+
+/*!
+ Returns the color of the brush of bar set.
+*/
+QColor QBarSet::color()
+{
+ return brush().color();
+}
+
+/*!
+ Sets the \a color of brush for this bar set.
+*/
+void QBarSet::setColor(QColor color)
+{
+ QBrush b = brush();
+ if ((b.color() != color) || (b.style() == Qt::NoBrush)) {
+ b.setColor(color);
+ if (b.style() == Qt::NoBrush) {
+ // Set tyle to Qt::SolidPattern. (Default is Qt::NoBrush)
+ // This prevents theme to override color defined in QML side:
+ // BarSet { label: "Bob"; color:"red"; values: [1,2,3] }
+ // The color must be obeyed, since user wanted it.
+ b.setStyle(Qt::SolidPattern);
+ }
+ setBrush(b);
+ emit colorChanged(color);
+ }
+}
+
+/*!
+ Returns the color of pen of this bar set.
+*/
+QColor QBarSet::borderColor()
+{
+ return pen().color();
+}
+
+/*!
+ Sets the color of pen for this bar set.
+*/
+void QBarSet::setBorderColor(QColor color)
+{
+ QPen p = pen();
+ if (p.color() != color) {
+ p.setColor(color);
+ setPen(p);
+ emit borderColorChanged(color);
+ }
+}
+
+/*!
+ Returns the color of labels of this bar set.
+*/
+QColor QBarSet::labelColor()
+{
+ return labelBrush().color();
+}
+
+/*!
+ Sets the color of labels for this bar set.
+*/
+void QBarSet::setLabelColor(QColor color)
+{
+ QBrush b = labelBrush();
+ if (b == QBrush())
+ b.setStyle(Qt::SolidPattern);
+
+ if (b.color() != color) {
+ b.setColor(color);
+ setLabelBrush(b);
+ emit labelColorChanged(color);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QBarSetPrivate::QBarSetPrivate(const QString label, QBarSet *parent) : QObject(parent),
+ q_ptr(parent),
+ m_label(label),
+ m_pen(QChartPrivate::defaultPen()),
+ m_brush(QChartPrivate::defaultBrush()),
+ m_labelBrush(QChartPrivate::defaultBrush())
+{
+}
+
+QBarSetPrivate::~QBarSetPrivate()
+{
+}
+
+void QBarSetPrivate::append(QPointF value)
+{
+ if (isValidValue(value)) {
+ m_values.append(value);
+ emit restructuredBars();
+ }
+}
+
+void QBarSetPrivate::append(QList<QPointF> values)
+{
+ for (int i = 0; i < values.count(); i++) {
+ if (isValidValue(values.at(i)))
+ m_values.append(values.at(i));
+ }
+ emit restructuredBars();
+}
+
+void QBarSetPrivate::append(QList<qreal> values)
+{
+ int index = m_values.count();
+ for (int i = 0; i < values.count(); i++) {
+ if (isValidValue(values.at(i))) {
+ m_values.append(QPointF(index, values.at(i)));
+ index++;
+ }
+ }
+ emit restructuredBars();
+}
+
+void QBarSetPrivate::insert(const int index, const qreal value)
+{
+ m_values.insert(index, QPointF(index, value));
+ emit restructuredBars();
+}
+
+void QBarSetPrivate::insert(const int index, const QPointF value)
+{
+ m_values.insert(index, value);
+ emit restructuredBars();
+}
+
+int QBarSetPrivate::remove(const int index, const int count)
+{
+ int removeCount = count;
+
+ if ((index < 0) || (m_values.count() == 0))
+ return 0; // Invalid index or not values in list, remove nothing.
+ else if ((index + count) > m_values.count())
+ removeCount = m_values.count() - index; // Trying to remove more items than list has. Limit amount to be removed.
+
+ int c = 0;
+ while (c < removeCount) {
+ m_values.removeAt(index);
+ c++;
+ }
+ emit restructuredBars();
+ return removeCount;
+}
+
+void QBarSetPrivate::replace(const int index, const qreal value)
+{
+ m_values.replace(index, QPointF(index, value));
+ emit updatedLayout();
+}
+
+void QBarSetPrivate::replace(const int index, const QPointF value)
+{
+ m_values.replace(index, value);
+ emit updatedLayout();
+}
+
+qreal QBarSetPrivate::pos(const int index)
+{
+ if (index < 0 || index >= m_values.count())
+ return 0;
+ return m_values.at(index).x();
+}
+
+qreal QBarSetPrivate::value(const int index)
+{
+ if (index < 0 || index >= m_values.count())
+ return 0;
+ return m_values.at(index).y();
+}
+
+#include "moc_qbarset.cpp"
+#include "moc_qbarset_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/qbarset.h b/src/charts/barchart/qbarset.h
new file mode 100644
index 00000000..7d96dec4
--- /dev/null
+++ b/src/charts/barchart/qbarset.h
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBARSET_H
+#define QBARSET_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QPen>
+#include <QBrush>
+#include <QFont>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QBarSetPrivate;
+
+class QT_CHARTS_EXPORT QBarSet : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
+ Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
+ Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged)
+ Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
+ Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
+
+public:
+ explicit QBarSet(const QString label, QObject *parent = 0);
+ virtual ~QBarSet();
+
+ void setLabel(const QString label);
+ QString label() const;
+
+ void append(const qreal value);
+ void append(const QList<qreal> &values);
+
+ QBarSet &operator << (const qreal &value);
+
+ void insert(const int index, const qreal value);
+ void remove(const int index, const int count = 1);
+ void replace(const int index, const qreal value);
+ qreal at(const int index) const;
+ qreal operator [](const int index) const;
+ int count() const;
+ qreal sum() const;
+
+ void setPen(const QPen &pen);
+ QPen pen() const;
+
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+
+ void setLabelBrush(const QBrush &brush);
+ QBrush labelBrush() const;
+
+ void setLabelFont(const QFont &font);
+ QFont labelFont() const;
+
+ QColor color();
+ void setColor(QColor color);
+
+ QColor borderColor();
+ void setBorderColor(QColor color);
+
+ QColor labelColor();
+ void setLabelColor(QColor color);
+
+Q_SIGNALS:
+ void clicked(int index);
+ void hovered(bool status);
+ void hovered(bool status, int index);
+ void penChanged();
+ void brushChanged();
+ void labelChanged();
+ void labelBrushChanged();
+ void labelFontChanged();
+ void colorChanged(QColor color);
+ void borderColorChanged(QColor color);
+ void labelColorChanged(QColor color);
+
+ void valuesAdded(int index, int count);
+ void valuesRemoved(int index, int count);
+ void valueChanged(int index);
+
+private:
+ QScopedPointer<QBarSetPrivate> d_ptr;
+ Q_DISABLE_COPY(QBarSet)
+ friend class QAbstractBarSeries;
+ friend class BarLegendMarker;
+ friend class AbstractBarChartItem;
+ friend class QAbstractBarSeriesPrivate;
+ friend class StackedBarChartItem;
+ friend class PercentBarChartItem;
+ friend class BarChartItem;
+ friend class HorizontalBarChartItem;
+ friend class HorizontalStackedBarChartItem;
+ friend class HorizontalPercentBarChartItem;
+ friend class BoxPlotChartItem;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARSET_H
diff --git a/src/charts/barchart/qbarset_p.h b/src/charts/barchart/qbarset_p.h
new file mode 100644
index 00000000..d0b03efa
--- /dev/null
+++ b/src/charts/barchart/qbarset_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBARSET_P_H
+#define QBARSET_P_H
+
+#include <qbarset.h>
+#include <QMap>
+#include <QPen>
+#include <QBrush>
+#include <QFont>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarSetPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ QBarSetPrivate(const QString label, QBarSet *parent);
+ ~QBarSetPrivate();
+
+ void append(QPointF value);
+ void append(QList<QPointF> values);
+ void append(QList<qreal> values);
+
+ void insert(const int index, const qreal value);
+ void insert(const int index, const QPointF value);
+ int remove(const int index, const int count);
+
+ void replace(const int index, const qreal value);
+ void replace(const int index, const QPointF value);
+
+ qreal pos(const int index);
+ qreal value(const int index);
+
+Q_SIGNALS:
+ void restructuredBars();
+ void updatedBars();
+ void updatedLayout();
+
+public:
+ QBarSet * const q_ptr;
+ QString m_label;
+ QList<QPointF> m_values;
+ QPen m_pen;
+ QBrush m_brush;
+ QBrush m_labelBrush;
+ QFont m_labelFont;
+
+ friend class QBarSet;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARSETPRIVATE_P_H
diff --git a/src/charts/barchart/qhbarmodelmapper.cpp b/src/charts/barchart/qhbarmodelmapper.cpp
new file mode 100644
index 00000000..0312df40
--- /dev/null
+++ b/src/charts/barchart/qhbarmodelmapper.cpp
@@ -0,0 +1,258 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qhbarmodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QHBarModelMapper
+ \inmodule Qt Charts
+ \brief Horizontal model mapper for bar series.
+ \mainclass
+
+ Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
+ Horizontal model mapper is used to create a connection between QAbstractBarSeries and QAbstractItemModel derived model object.
+ Model mapper maintains equal size of all the BarSets.
+ Adding/removing value from the BarSet causes the the same change in the rest of the BarSets added to the same series.
+ \note Used model has to support adding/removing rows/columns and modifying the data of the cells.
+*/
+/*!
+ \qmltype HBarModelMapper
+ \instantiates QHBarModelMapper
+ \inqmlmodule QtCharts
+
+ \brief Horizontal model mapper for bar series.
+
+ HBarModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as
+ a data source for any bar series. It is possible to use both QAbstractItemModel and bar series
+ data API to manipulate data. HBarModelMapper keeps the series and the model in sync.
+
+ The following QML example would create a bar series with three bar sets (assuming the model has
+ at least four rows). Each bar set would contain data starting from column 1. The name of a set
+ would be defined by the vertical header (of the row).
+ \code
+ BarSeries {
+ HBarModelMapper {
+ model: myCustomModel // QAbstractItemModel derived implementation
+ firstBarSetRow: 1
+ lastBarSetRow: 3
+ firstColumn: 1
+ }
+ }
+ \endcode
+*/
+
+/*!
+ \property QHBarModelMapper::series
+ \brief Defines the QPieSeries object that is used by the mapper.
+
+ All the data in the series is discarded when it is set to the mapper.
+ When new series is specified the old series is disconnected (it preserves its data)
+*/
+/*!
+ \qmlproperty AbstractBarSeries HBarModelMapper::series
+ Defines the AbstractBarSeries based object that is used by the mapper. All the data in the series is discarded when it is
+ set to the mapper. When new series is specified the old series is disconnected (it preserves its data).
+*/
+
+/*!
+ \property QHBarModelMapper::model
+ \brief Defines the model that is used by the mapper.
+*/
+/*!
+ \qmlproperty SomeModel HBarModelMapper::model
+ The QAbstractItemModel based model that is used by the mapper. You need to implement the model
+ and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
+ the data of the cells.
+*/
+
+/*!
+ \property QHBarModelMapper::firstBarSetRow
+ \brief Defines which column of the model is used as the data source for the first bar set.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int HBarModelMapper::firstBarSetRow
+ Defines which column of the model is used as the data source for the first bar set. The default value is -1
+ (invalid mapping).
+*/
+
+/*!
+ \property QHBarModelMapper::lastBarSetRow
+ \brief Defines which column of the model is used as the data source for the last bar set.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int HBarModelMapper::lastBarSetRow
+ Defines which column of the model is used as the data source for the last bar set. The default value is -1
+ (invalid mapping).
+*/
+
+/*!
+ \property QHBarModelMapper::firstColumn
+ \brief Defines which column of the model contains the first values of the QBarSets in the series.
+
+ Minimal and default value is: 0
+*/
+/*!
+ \qmlproperty int HBarModelMapper::firstColumn
+ Defines which column of the model contains the first values of the QBarSets in the series.
+ The default value is 0.
+*/
+
+/*!
+ \property QHBarModelMapper::columnCount
+ \brief Defines the number of columns of the model that are mapped as the data for QAbstractBarSeries.
+
+ Minimal and default value is: -1 (count limited by the number of columns in the model)
+*/
+/*!
+ \qmlproperty int HBarModelMapper::columnCount
+ Defines the number of columns of the model that are mapped as the data for QAbstractBarSeries. The default value is
+ -1 (count limited by the number of columns in the model)
+*/
+
+/*!
+ \fn void QHBarModelMapper::seriesReplaced()
+
+ Emitted when the series to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QHBarModelMapper::modelReplaced()
+
+ Emitted when the model to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QHBarModelMapper::firstBarSetRowChanged()
+
+ Emitted when the firstBarSetRow has changed.
+*/
+
+/*!
+ \fn void QHBarModelMapper::lastBarSetRowChanged()
+
+ Emitted when the lastBarSetRow has changed.
+*/
+
+/*!
+ \fn void QHBarModelMapper::firstColumnChanged()
+ Emitted when the firstColumn has changed.
+*/
+
+/*!
+ \fn void QHBarModelMapper::columnCountChanged()
+ Emitted when the columnCount has changed.
+*/
+
+/*!
+ Constructs a mapper object which is a child of \a parent.
+*/
+QHBarModelMapper::QHBarModelMapper(QObject *parent) :
+ QBarModelMapper(parent)
+{
+ QBarModelMapper::setOrientation(Qt::Horizontal);
+}
+
+QAbstractItemModel *QHBarModelMapper::model() const
+{
+ return QBarModelMapper::model();
+}
+
+void QHBarModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model != QBarModelMapper::model()) {
+ QBarModelMapper::setModel(model);
+ emit modelReplaced();
+ }
+}
+
+QAbstractBarSeries *QHBarModelMapper::series() const
+{
+ return QBarModelMapper::series();
+}
+
+void QHBarModelMapper::setSeries(QAbstractBarSeries *series)
+{
+ if (series != QBarModelMapper::series()) {
+ QBarModelMapper::setSeries(series);
+ emit seriesReplaced();
+ }
+}
+
+int QHBarModelMapper::firstBarSetRow() const
+{
+ return QBarModelMapper::firstBarSetSection();
+}
+
+void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow)
+{
+ if (firstBarSetRow != firstBarSetSection()) {
+ QBarModelMapper::setFirstBarSetSection(firstBarSetRow);
+ emit firstBarSetRowChanged();
+ }
+}
+
+int QHBarModelMapper::lastBarSetRow() const
+{
+ return QBarModelMapper::lastBarSetSection();
+}
+
+void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow)
+{
+ if (lastBarSetRow != lastBarSetSection()) {
+ QBarModelMapper::setLastBarSetSection(lastBarSetRow);
+ emit lastBarSetRowChanged();
+ }
+}
+
+int QHBarModelMapper::firstColumn() const
+{
+ return QBarModelMapper::first();
+}
+
+void QHBarModelMapper::setFirstColumn(int firstColumn)
+{
+ if (firstColumn != first()) {
+ QBarModelMapper::setFirst(firstColumn);
+ emit firstColumnChanged();
+ }
+}
+
+int QHBarModelMapper::columnCount() const
+{
+ return QBarModelMapper::count();
+}
+
+void QHBarModelMapper::setColumnCount(int columnCount)
+{
+ if (columnCount != count()) {
+ QBarModelMapper::setCount(columnCount);
+ emit columnCountChanged();
+ }
+}
+
+#include "moc_qhbarmodelmapper.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/qhbarmodelmapper.h b/src/charts/barchart/qhbarmodelmapper.h
new file mode 100644
index 00000000..ee281aef
--- /dev/null
+++ b/src/charts/barchart/qhbarmodelmapper.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHBARMODELMAPPER_H
+#define QHBARMODELMAPPER_H
+
+#include <QtCharts/QBarModelMapper>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/* Comment line for syncqt to generate the fwd-include correctly, due to QTBUG-22432 */
+class QT_CHARTS_EXPORT QHBarModelMapper : public QBarModelMapper
+{
+ Q_OBJECT
+ Q_PROPERTY(QAbstractBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
+ Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
+ Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow NOTIFY firstBarSetRowChanged)
+ Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow NOTIFY lastBarSetRowChanged)
+ Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged)
+ Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
+
+public:
+ explicit QHBarModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QAbstractBarSeries *series() const;
+ void setSeries(QAbstractBarSeries *series);
+
+ int firstBarSetRow() const;
+ void setFirstBarSetRow(int firstBarSetRow);
+
+ int lastBarSetRow() const;
+ void setLastBarSetRow(int lastBarSetRow);
+
+ int firstColumn() const;
+ void setFirstColumn(int firstColumn);
+
+ int columnCount() const;
+ void setColumnCount(int columnCount);
+
+Q_SIGNALS:
+ void seriesReplaced();
+ void modelReplaced();
+ void firstBarSetRowChanged();
+ void lastBarSetRowChanged();
+ void firstColumnChanged();
+ void columnCountChanged();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QHBARMODELMAPPER_H
diff --git a/src/charts/barchart/qvbarmodelmapper.cpp b/src/charts/barchart/qvbarmodelmapper.cpp
new file mode 100644
index 00000000..a239e696
--- /dev/null
+++ b/src/charts/barchart/qvbarmodelmapper.cpp
@@ -0,0 +1,258 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvbarmodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QVBarModelMapper
+ \inmodule Qt Charts
+ \brief Vertical model mapper for bar series.
+ \mainclass
+
+ Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
+ Vertical model mapper is used to create a connection between QAbstractBarSeries and QAbstractItemModel derived model object.
+ Model mapper maintains equal size of all the BarSets.
+ Adding/removing value from the BarSet causes the the same change in the rest of the BarSets added to the same series.
+ \note Used model has to support adding/removing rows/columns and modifying the data of the cells.
+*/
+/*!
+ \qmltype VBarModelMapper
+ \instantiates QVBarModelMapper
+ \inqmlmodule QtCharts
+
+ \inherits BarModelMapper
+
+ \brief Vertical model mapper for bar series.
+
+ VBarModelMapper allows you to use your own QAbstractItemModel derived model with data in columns
+ as a data source for any bar series. It is possible to use both QAbstractItemModel and bar
+ series data API to manipulate data. VBarModelMapper keeps the series and the model in sync.
+
+ The following QML example would create a bar series with three bar sets (assuming the model has
+ at least four columns). Each bar set would contain data starting from row 1. The name of a set
+ would be defined by the horizontal header (of the column).
+ \code
+ BarSeries {
+ VBarModelMapper {
+ model: myCustomModel // QAbstractItemModel derived implementation
+ firstBarSetColumn: 1
+ lastBarSetColumn: 3
+ firstRow: 1
+ }
+ }
+ \endcode
+*/
+
+/*!
+ \property QVBarModelMapper::series
+ \brief Defines the QBarSeries object that is used by the mapper.
+
+ All the data in the series is discarded when it is set to the mapper.
+ When new series is specified the old series is disconnected (it preserves its data)
+*/
+/*!
+ \qmlproperty AbstractBarSeries VBarModelMapper::series
+ Defines the AbstractBarSeries based object that is used by the mapper. All the data in the series is discarded when it is
+ set to the mapper. When new series is specified the old series is disconnected (it preserves its data).
+*/
+
+/*!
+ \property QVBarModelMapper::model
+ \brief Defines the model that is used by the mapper.
+*/
+/*!
+ \qmlproperty SomeModel VBarModelMapper::model
+ The QAbstractItemModel based model that is used by the mapper. You need to implement the model
+ and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
+ the data of the cells.
+*/
+
+/*!
+ \property QVBarModelMapper::firstBarSetColumn
+ \brief Defines which column of the model is used as the data source for the first bar set.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int VBarModelMapper::firstBarSetColumn
+ Defines which column of the model is used as the data source for the first bar set. Default value
+ is: -1 (invalid mapping).
+*/
+
+/*!
+ \property QVBarModelMapper::lastBarSetColumn
+ \brief Defines which column of the model is used as the data source for the last bar set.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int VBarModelMapper::lastBarSetColumn
+ Defines which column of the model is used as the data source for the last bar set. Default
+ value is: -1 (invalid mapping).
+*/
+
+/*!
+ \property QVBarModelMapper::firstRow
+ \brief Defines which row of the model contains the first values of the QBarSets in the series.
+
+ Minimal and default value is: 0
+*/
+/*!
+ \qmlproperty int VBarModelMapper::firstRow
+ Defines which row of the model contains the first values of the QBarSets in the series.
+ The default value is 0.
+*/
+
+/*!
+ \property QVBarModelMapper::rowCount
+ \brief Defines the number of rows of the model that are mapped as the data for QAbstractBarSeries.
+
+ Minimal and default value is: -1 (count limited by the number of rows in the model)
+*/
+/*!
+ \qmlproperty int VBarModelMapper::rowCount
+ Defines the number of rows of the model that are mapped as the data for QAbstractBarSeries. The default value is
+ -1 (count limited by the number of rows in the model)
+*/
+
+/*!
+ \fn void QVBarModelMapper::seriesReplaced()
+
+ Emitted when the series to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QVBarModelMapper::modelReplaced()
+
+ Emitted when the model to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QVBarModelMapper::firstBarSetColumnChanged()
+ Emitted when the firstBarSetColumn has changed.
+*/
+
+/*!
+ \fn void QVBarModelMapper::lastBarSetColumnChanged()
+ Emitted when the lastBarSetColumn has changed.
+*/
+
+/*!
+ \fn void QVBarModelMapper::firstRowChanged()
+ Emitted when the firstRow has changed.
+*/
+
+/*!
+ \fn void QVBarModelMapper::rowCountChanged()
+ Emitted when the rowCount has changed.
+*/
+
+/*!
+ Constructs a mapper object which is a child of \a parent.
+*/
+QVBarModelMapper::QVBarModelMapper(QObject *parent) :
+ QBarModelMapper(parent)
+{
+ QBarModelMapper::setOrientation(Qt::Vertical);
+}
+
+QAbstractItemModel *QVBarModelMapper::model() const
+{
+ return QBarModelMapper::model();
+}
+
+void QVBarModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model != QBarModelMapper::model()) {
+ QBarModelMapper::setModel(model);
+ emit modelReplaced();
+ }
+}
+
+QAbstractBarSeries *QVBarModelMapper::series() const
+{
+ return QBarModelMapper::series();
+}
+
+void QVBarModelMapper::setSeries(QAbstractBarSeries *series)
+{
+ if (series != QBarModelMapper::series()) {
+ QBarModelMapper::setSeries(series);
+ emit seriesReplaced();
+ }
+}
+
+int QVBarModelMapper::firstBarSetColumn() const
+{
+ return QBarModelMapper::firstBarSetSection();
+}
+
+void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn)
+{
+ if (firstBarSetColumn != firstBarSetSection()) {
+ QBarModelMapper::setFirstBarSetSection(firstBarSetColumn);
+ emit firstBarSetColumnChanged();
+ }
+}
+
+int QVBarModelMapper::lastBarSetColumn() const
+{
+ return QBarModelMapper::lastBarSetSection();
+}
+
+void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn)
+{
+ if (lastBarSetColumn != lastBarSetSection()) {
+ QBarModelMapper::setLastBarSetSection(lastBarSetColumn);
+ emit lastBarSetColumnChanged();
+ }
+}
+
+int QVBarModelMapper::firstRow() const
+{
+ return QBarModelMapper::first();
+}
+
+void QVBarModelMapper::setFirstRow(int firstRow)
+{
+ if (firstRow != first()) {
+ QBarModelMapper::setFirst(firstRow);
+ emit firstRowChanged();
+ }
+}
+
+int QVBarModelMapper::rowCount() const
+{
+ return QBarModelMapper::count();
+}
+
+void QVBarModelMapper::setRowCount(int rowCount)
+{
+ if (rowCount != count()) {
+ QBarModelMapper::setCount(rowCount);
+ emit rowCountChanged();
+ }
+}
+
+#include "moc_qvbarmodelmapper.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/qvbarmodelmapper.h b/src/charts/barchart/qvbarmodelmapper.h
new file mode 100644
index 00000000..5f16ac72
--- /dev/null
+++ b/src/charts/barchart/qvbarmodelmapper.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVBARMODELMAPPER_H
+#define QVBARMODELMAPPER_H
+
+#include <QtCharts/QBarModelMapper>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/* Comment line for syncqt to generate the fwd-include correctly, due to QTBUG-22432 */
+class QT_CHARTS_EXPORT QVBarModelMapper : public QBarModelMapper
+{
+ Q_OBJECT
+ Q_PROPERTY(QAbstractBarSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
+ Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
+ Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn NOTIFY firstBarSetColumnChanged)
+ Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn NOTIFY lastBarSetColumnChanged)
+ Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
+ Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
+
+public:
+ explicit QVBarModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QAbstractBarSeries *series() const;
+ void setSeries(QAbstractBarSeries *series);
+
+ int firstBarSetColumn() const;
+ void setFirstBarSetColumn(int firstBarSetColumn);
+
+ int lastBarSetColumn() const;
+ void setLastBarSetColumn(int lastBarSetColumn);
+
+ int firstRow() const;
+ void setFirstRow(int firstRow);
+
+ int rowCount() const;
+ void setRowCount(int rowCount);
+
+Q_SIGNALS:
+ void seriesReplaced();
+ void modelReplaced();
+ void firstBarSetColumnChanged();
+ void lastBarSetColumnChanged();
+ void firstRowChanged();
+ void rowCountChanged();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QVBARMODELMAPPER_H
diff --git a/src/charts/barchart/vertical/bar/barchartitem.cpp b/src/charts/barchart/vertical/bar/barchartitem.cpp
new file mode 100644
index 00000000..86b63045
--- /dev/null
+++ b/src/charts/barchart/vertical/bar/barchartitem.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "barchartitem_p.h"
+#include "bar_p.h"
+#include "qabstractbarseries_p.h"
+#include "qbarset.h"
+#include "qbarset_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+BarChartItem::BarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) :
+ AbstractBarChartItem(series, item)
+{
+ connect(series, SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)),
+ this, SLOT(handleLabelsPositionChanged()));
+ connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(positionLabels()));
+}
+
+void BarChartItem::initializeLayout()
+{
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ m_layout.clear();
+ for(int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ QRectF rect;
+ QPointF topLeft;
+ QPointF bottomRight;
+
+ if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
+ topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + set/setCount * barWidth, domain()->minY()), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/setCount * barWidth, domain()->minY()), m_validData);
+ } else {
+ topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + set/setCount * barWidth, 0), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/setCount * barWidth, 0), m_validData);
+ }
+
+ if (!m_validData)
+ return;
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ m_layout.append(rect.normalized());
+ }
+ }
+}
+
+QVector<QRectF> BarChartItem::calculateLayout()
+{
+ QVector<QRectF> layout;
+
+ // Use temporary qreals for accuracy
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ for(int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ qreal value = m_series->barSets().at(set)->at(category);
+ QRectF rect;
+ QPointF topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set)/(setCount) * barWidth, value), m_validData);
+ QPointF bottomRight;
+ if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/(setCount) * barWidth, domain()->minY()), m_validData);
+ else
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/(setCount) * barWidth, 0), m_validData);
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ layout.append(rect.normalized());
+ }
+ }
+
+ return layout;
+}
+
+void BarChartItem::handleLabelsPositionChanged()
+{
+ positionLabels();
+}
+
+void BarChartItem::positionLabels()
+{
+ for (int i = 0; i < m_layout.count(); i++) {
+ QGraphicsTextItem *label = m_labels.at(i);
+ qreal xPos = m_layout.at(i).center().x() - label->boundingRect().center().x();
+ qreal yPos = 0;
+
+ int offset = m_bars.at(i)->pen().width() / 2 + 2;
+ if (m_series->labelsPosition() == QAbstractBarSeries::LabelsCenter)
+ yPos = m_layout.at(i).center().y() - label->boundingRect().center().y();
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideEnd)
+ yPos = m_layout.at(i).top() - offset;
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideBase)
+ yPos = m_layout.at(i).bottom() - label->boundingRect().height() + offset;
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsOutsideEnd)
+ yPos = m_layout.at(i).top() - label->boundingRect().height() + offset;
+
+ label->setPos(xPos, yPos);
+ label->setZValue(zValue() + 1);
+ }
+}
+
+#include "moc_barchartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/vertical/bar/barchartitem_p.h b/src/charts/barchart/vertical/bar/barchartitem_p.h
new file mode 100644
index 00000000..09df0dbf
--- /dev/null
+++ b/src/charts/barchart/vertical/bar/barchartitem_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+
+#ifndef BARCHARTITEM_H
+#define BARCHARTITEM_H
+
+#include "abstractbarchartitem_p.h"
+#include <qstackedbarseries.h>
+#include <QGraphicsItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class BarChartItem : public AbstractBarChartItem
+{
+ Q_OBJECT
+public:
+ BarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
+
+private slots:
+ void handleLabelsPositionChanged();
+ void positionLabels();
+
+private:
+ virtual QVector<QRectF> calculateLayout();
+ void initializeLayout();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // BARCHARTITEM_H
diff --git a/src/charts/barchart/vertical/bar/qbarseries.cpp b/src/charts/barchart/vertical/bar/qbarseries.cpp
new file mode 100644
index 00000000..3ab2a1ee
--- /dev/null
+++ b/src/charts/barchart/vertical/bar/qbarseries.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbarseries.h"
+#include "qbarseries_p.h"
+#include "barchartitem_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "qvalueaxis.h"
+#include "qbarcategoryaxis.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QBarSeries
+ \inmodule Qt Charts
+ \brief Series for creating bar chart.
+ \mainclass
+
+ QBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
+ as groups, where bars in same category are grouped next to each other. QBarSeries groups the data
+ from sets to categories, which are defined by a QStringList.
+
+ See the \l {BarChart Example} {bar chart example} to learn how to create a grouped bar chart.
+ \image examples_barchart.png
+
+ \sa QBarSet, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries
+*/
+/*!
+ \qmltype BarSeries
+ \instantiates QBarSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractBarSeries
+
+ \brief Series for creating bar chart.
+
+ The following QML shows how to create a simple grouped bar chart:
+ \snippet qmlchart/qml/qmlchart/View6.qml 1
+ \beginfloatleft
+ \image examples_qmlchart6.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ Constructs empty QBarSeries.
+ QBarSeries is QObject which is a child of a \a parent.
+*/
+QBarSeries::QBarSeries(QObject *parent)
+ : QAbstractBarSeries(*new QBarSeriesPrivate(this), parent)
+{
+
+}
+
+/*!
+ Returns QAbstractSeries::SeriesTypeBar.
+*/
+QAbstractSeries::SeriesType QBarSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeBar;
+}
+
+/*!
+ Destructor. Removes series from chart.
+*/
+QBarSeries::~QBarSeries()
+{
+ Q_D(QBarSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) : QAbstractBarSeriesPrivate(q)
+{
+
+}
+
+void QBarSeriesPrivate::initializeDomain()
+{
+ qreal minX(domain()->minX());
+ qreal minY(domain()->minY());
+ qreal maxX(domain()->maxX());
+ qreal maxY(domain()->maxY());
+
+ qreal x = categoryCount();
+ minX = qMin(minX, - (qreal)0.5);
+ minY = qMin(minY, min());
+ maxX = qMax(maxX, x - (qreal)0.5);
+ maxY = qMax(maxY, max());
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+
+void QBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QBarSeries);
+ BarChartItem *bar = new BarChartItem(q,parent);
+ m_item.reset(bar);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+#include "moc_qbarseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/barchart/vertical/bar/qbarseries.h b/src/charts/barchart/vertical/bar/qbarseries.h
new file mode 100644
index 00000000..d3fefd8a
--- /dev/null
+++ b/src/charts/barchart/vertical/bar/qbarseries.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBARSERIES_H
+#define QBARSERIES_H
+
+#include <QtCharts/qabstractbarseries.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarSeriesPrivate;
+
+class QT_CHARTS_EXPORT QBarSeries : public QAbstractBarSeries
+{
+ Q_OBJECT
+public:
+ explicit QBarSeries(QObject *parent = 0);
+ ~QBarSeries();
+ QAbstractSeries::SeriesType type() const;
+
+private:
+ Q_DECLARE_PRIVATE(QBarSeries)
+ Q_DISABLE_COPY(QBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARSERIES_H
diff --git a/src/charts/barchart/vertical/bar/qbarseries_p.h b/src/charts/barchart/vertical/bar/qbarseries_p.h
new file mode 100644
index 00000000..c74194d3
--- /dev/null
+++ b/src/charts/barchart/vertical/bar/qbarseries_p.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBARSERIES_P_H
+#define QBARSERIES_P_H
+
+#include "qabstractbarseries_p.h"
+#include "abstractdomain_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+
+class QBarSeriesPrivate: public QAbstractBarSeriesPrivate
+{
+public:
+ QBarSeriesPrivate(QBarSeries *q);
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeDomain();
+
+private:
+ Q_DECLARE_PUBLIC(QBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARSERIES_P_H
diff --git a/src/charts/barchart/vertical/percent/percentbarchartitem.cpp b/src/charts/barchart/vertical/percent/percentbarchartitem.cpp
new file mode 100644
index 00000000..1e0bbbae
--- /dev/null
+++ b/src/charts/barchart/vertical/percent/percentbarchartitem.cpp
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "percentbarchartitem_p.h"
+#include "bar_p.h"
+#include "qabstractbarseries_p.h"
+#include "qbarset.h"
+#include "qbarset_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PercentBarChartItem::PercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) :
+ AbstractBarChartItem(series, item)
+{
+ connect(series, SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)),
+ this, SLOT(handleLabelsPositionChanged()));
+ connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(positionLabels()));
+}
+
+void PercentBarChartItem::initializeLayout()
+{
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ m_layout.clear();
+ for(int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ QRectF rect;
+ QPointF topLeft;
+ QPointF bottomRight;
+
+ if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
+ topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, domain()->minY()), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, domain()->minY()), m_validData);
+ } else {
+ topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, 0), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, 0), m_validData);
+ }
+
+ if (!m_validData)
+ return;
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ m_layout.append(rect.normalized());
+ }
+ }
+}
+
+QVector<QRectF> PercentBarChartItem::calculateLayout()
+{
+ QVector<QRectF> layout;
+
+ // Use temporary qreals for accuracy
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ for(int category = 0; category < categoryCount; category++) {
+ qreal sum = 0;
+ qreal categorySum = m_series->d_func()->categorySum(category);
+ for (int set = 0; set < setCount; set++) {
+ qreal value = m_series->barSets().at(set)->at(category);
+ QRectF rect;
+ qreal topY = 0;
+ qreal newSum = value + sum;
+ if (newSum > 0)
+ topY = 100 * newSum / categorySum;
+ qreal bottomY = 0;
+ if (sum > 0)
+ bottomY = 100 * sum / categorySum;
+ QPointF topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth/2, topY), m_validData);
+ QPointF bottomRight;
+ if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth/2, set ? bottomY : domain()->minY()), m_validData);
+ else
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth/2, set ? bottomY : 0), m_validData);
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ layout.append(rect.normalized());
+ sum = newSum;
+ }
+ }
+ return layout;
+}
+
+void PercentBarChartItem::handleUpdatedBars()
+{
+ // Handle changes in pen, brush, labels etc.
+ int categoryCount = m_series->d_func()->categoryCount();
+ int setCount = m_series->count();
+ int itemIndex(0);
+ static const QString valueTag(QLatin1String("@value"));
+
+ for (int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ QBarSetPrivate *barSet = m_series->d_func()->barsetAt(set)->d_ptr.data();
+ Bar *bar = m_bars.at(itemIndex);
+ bar->setPen(barSet->m_pen);
+ bar->setBrush(barSet->m_brush);
+ bar->update();
+
+ QGraphicsTextItem *label = m_labels.at(itemIndex);
+ qreal p = m_series->d_func()->percentageAt(set, category) * 100.0;
+ QString vString(presenter()->numberToString(p, 'f', 0));
+ QString valueLabel;
+ if (m_series->labelsFormat().isEmpty()) {
+ vString.append(QStringLiteral("%"));
+ valueLabel = vString;
+ } else {
+ valueLabel = m_series->labelsFormat();
+ valueLabel.replace(valueTag, vString);
+ }
+ label->setHtml(valueLabel);
+ label->setFont(barSet->m_labelFont);
+ label->setDefaultTextColor(barSet->m_labelBrush.color());
+ label->update();
+ itemIndex++;
+ }
+ }
+}
+
+void PercentBarChartItem::handleLabelsPositionChanged()
+{
+ positionLabels();
+}
+
+void PercentBarChartItem::positionLabels()
+{
+ for (int i = 0; i < m_layout.count(); i++) {
+ QGraphicsTextItem *label = m_labels.at(i);
+ qreal xPos = m_layout.at(i).center().x() - label->boundingRect().center().x();
+ qreal yPos = 0;
+
+ int offset = m_bars.at(i)->pen().width() / 2 + 2;
+ if (m_series->labelsPosition() == QAbstractBarSeries::LabelsCenter)
+ yPos = m_layout.at(i).center().y() - label->boundingRect().center().y();
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideEnd)
+ yPos = m_layout.at(i).top() - offset;
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideBase)
+ yPos = m_layout.at(i).bottom() - label->boundingRect().height() + offset;
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsOutsideEnd)
+ yPos = m_layout.at(i).top() - label->boundingRect().height() + offset;
+
+ label->setPos(xPos, yPos);
+ label->setZValue(zValue() + 1);
+ }
+}
+
+#include "moc_percentbarchartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/vertical/percent/percentbarchartitem_p.h b/src/charts/barchart/vertical/percent/percentbarchartitem_p.h
new file mode 100644
index 00000000..4293d875
--- /dev/null
+++ b/src/charts/barchart/vertical/percent/percentbarchartitem_p.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+
+#ifndef PERCENTBARCHARTITEM_H
+#define PERCENTBARCHARTITEM_H
+
+#include "abstractbarchartitem_p.h"
+#include <QGraphicsItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractBarSeries;
+
+class PercentBarChartItem : public AbstractBarChartItem
+{
+ Q_OBJECT
+public:
+ PercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0);
+ void handleUpdatedBars();
+
+private slots:
+ void handleLabelsPositionChanged();
+ void positionLabels();
+
+private:
+ virtual QVector<QRectF> calculateLayout();
+ void initializeLayout();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // PERCENTBARCHARTITEM_H
diff --git a/src/charts/barchart/vertical/percent/qpercentbarseries.cpp b/src/charts/barchart/vertical/percent/qpercentbarseries.cpp
new file mode 100644
index 00000000..7899899b
--- /dev/null
+++ b/src/charts/barchart/vertical/percent/qpercentbarseries.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpercentbarseries.h"
+#include "qpercentbarseries_p.h"
+#include "percentbarchartitem_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "qvalueaxis.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QPercentBarSeries
+ \inmodule Qt Charts
+ \brief Series for creating percent bar chart.
+ \mainclass
+
+ QPercentBarSeries represents a series of data shown as bars. The purpose of this class is to
+ draw bars as stacks, where each bar is shown as percentage of all bars in that category.
+ QPercentBarSeries groups the data from sets to categories, which are defined by a QStringList.
+ Bars with zero value are not drawn.
+
+ See the \l {PercentbarChart Example} {percent bar chart example} to learn how to create a
+ percent bar chart.
+ \image examples_percentbarchart.png
+
+ \sa QBarSet, QStackedBarSeries, QAbstractBarSeries
+*/
+/*!
+ \qmltype PercentBarSeries
+ \instantiates QPercentBarSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractBarSeries
+
+ \brief Series for creating persent bar chart.
+
+ The following QML shows how to create a simple percent bar chart:
+ \snippet qmlchart/qml/qmlchart/View8.qml 1
+ \beginfloatleft
+ \image examples_qmlchart8.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ Constructs empty QPercentBarSeries.
+ QPercentBarSeries is QObject which is a child of a \a parent.
+*/
+QPercentBarSeries::QPercentBarSeries(QObject *parent)
+ : QAbstractBarSeries(*new QPercentBarSeriesPrivate(this), parent)
+{
+}
+
+/*!
+ Destructor. Removes series from chart.
+*/
+QPercentBarSeries::~QPercentBarSeries()
+{
+ Q_D(QPercentBarSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+
+/*!
+ Returns QAbstractSeries::SeriesTypePercentBar.
+*/
+QAbstractSeries::SeriesType QPercentBarSeries::type() const
+{
+ return QAbstractSeries::SeriesTypePercentBar;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QPercentBarSeriesPrivate::QPercentBarSeriesPrivate(QPercentBarSeries *q) : QAbstractBarSeriesPrivate(q)
+{
+
+}
+
+void QPercentBarSeriesPrivate::initializeDomain()
+{
+ qreal minX(domain()->minX());
+ qreal minY(domain()->minY());
+ qreal maxX(domain()->maxX());
+ qreal maxY(domain()->maxY());
+
+ qreal x = categoryCount();
+ minX = qMin(minX, - (qreal)0.5);
+ maxX = qMax(maxX, x - (qreal)0.5);
+ minY = 0;
+ maxY = 100;
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+
+void QPercentBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QPercentBarSeries);
+ PercentBarChartItem *bar = new PercentBarChartItem(q,parent);
+ m_item.reset(bar);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+#include "moc_qpercentbarseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/barchart/vertical/percent/qpercentbarseries.h b/src/charts/barchart/vertical/percent/qpercentbarseries.h
new file mode 100644
index 00000000..5f9ce140
--- /dev/null
+++ b/src/charts/barchart/vertical/percent/qpercentbarseries.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPERCENTBARSERIES_H
+#define QPERCENTBARSERIES_H
+
+#include <QStringList>
+#include <QtCharts/qabstractbarseries.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QPercentBarSeriesPrivate;
+
+class QT_CHARTS_EXPORT QPercentBarSeries : public QAbstractBarSeries
+{
+ Q_OBJECT
+public:
+ explicit QPercentBarSeries(QObject *parent = 0);
+ ~QPercentBarSeries();
+ QAbstractSeries::SeriesType type() const;
+
+private:
+ Q_DECLARE_PRIVATE(QPercentBarSeries)
+ Q_DISABLE_COPY(QPercentBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QPERCENTBARSERIES_H
diff --git a/src/charts/barchart/vertical/percent/qpercentbarseries_p.h b/src/charts/barchart/vertical/percent/qpercentbarseries_p.h
new file mode 100644
index 00000000..f31c9638
--- /dev/null
+++ b/src/charts/barchart/vertical/percent/qpercentbarseries_p.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QPERCENTBARSERIES_P_H
+#define QPERCENTBARSERIES_P_H
+
+#include "qabstractbarseries_p.h"
+#include "abstractdomain_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+
+class QPercentBarSeriesPrivate: public QAbstractBarSeriesPrivate
+{
+public:
+ QPercentBarSeriesPrivate(QPercentBarSeries *q);
+ void initializeDomain();
+ void initializeGraphics(QGraphicsItem* parent);
+private:
+ Q_DECLARE_PUBLIC(QPercentBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/barchart/vertical/stacked/qstackedbarseries.cpp b/src/charts/barchart/vertical/stacked/qstackedbarseries.cpp
new file mode 100644
index 00000000..7a1946f7
--- /dev/null
+++ b/src/charts/barchart/vertical/stacked/qstackedbarseries.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstackedbarseries.h"
+#include "qstackedbarseries_p.h"
+#include "stackedbarchartitem_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "qvalueaxis.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QStackedBarSeries
+ \inmodule Qt Charts
+ \brief Series for creating stacked bar chart.
+ \mainclass
+
+ QStackedBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
+ as stacks, where bars in same category are stacked on top of each other.
+ QStackedBarSeries groups the data from sets to categories, which are defined by QStringList.
+
+ See the \l {StackedbarChart Example} {stacked bar chart example} to learn how to create a stacked bar chart.
+ \image examples_stackedbarchart.png
+
+ \sa QBarSet, QPercentBarSeries, QAbstractBarSeries
+*/
+
+/*!
+ \qmltype StackedBarSeries
+ \instantiates QStackedBarSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractBarSeries
+
+ \brief Series for creating stacked bar chart.
+
+ The following QML shows how to create a simple stacked bar chart:
+ \snippet qmlchart/qml/qmlchart/View7.qml 1
+ \beginfloatleft
+ \image examples_qmlchart7.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ Constructs empty QStackedBarSeries.
+ QStackedBarSeries is QObject which is a child of a \a parent.
+*/
+QStackedBarSeries::QStackedBarSeries(QObject *parent)
+ : QAbstractBarSeries(*new QStackedBarSeriesPrivate(this), parent)
+{
+}
+
+/*!
+ Destructor. Removes series from chart.
+*/
+QStackedBarSeries::~QStackedBarSeries()
+{
+ Q_D(QStackedBarSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+/*!
+ Returns QAbstractSeries::SeriesTypeStackedBar.
+*/
+QAbstractSeries::SeriesType QStackedBarSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeStackedBar;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QStackedBarSeriesPrivate::QStackedBarSeriesPrivate(QStackedBarSeries *q) : QAbstractBarSeriesPrivate(q)
+{
+
+}
+
+void QStackedBarSeriesPrivate::initializeDomain()
+{
+ qreal minX(domain()->minX());
+ qreal minY(domain()->minY());
+ qreal maxX(domain()->maxX());
+ qreal maxY(domain()->maxY());
+
+ qreal x = categoryCount();
+ minX = qMin(minX, - (qreal)0.5);
+ minY = qMin(minY, bottom());
+ maxX = qMax(maxX, x - (qreal)0.5);
+ maxY = qMax(maxY, top());
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+void QStackedBarSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QStackedBarSeries);
+ StackedBarChartItem *bar = new StackedBarChartItem(q,parent);
+ m_item.reset(bar);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+#include "moc_qstackedbarseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/barchart/vertical/stacked/qstackedbarseries.h b/src/charts/barchart/vertical/stacked/qstackedbarseries.h
new file mode 100644
index 00000000..bab6e174
--- /dev/null
+++ b/src/charts/barchart/vertical/stacked/qstackedbarseries.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSTACKEDBARSERIES_H
+#define QSTACKEDBARSERIES_H
+
+#include <QStringList>
+#include <QtCharts/qabstractbarseries.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QStackedBarSeriesPrivate;
+
+class QT_CHARTS_EXPORT QStackedBarSeries : public QAbstractBarSeries
+{
+ Q_OBJECT
+public:
+ explicit QStackedBarSeries(QObject *parent = 0);
+ ~QStackedBarSeries();
+ QAbstractSeries::SeriesType type() const;
+
+private:
+ Q_DECLARE_PRIVATE(QStackedBarSeries)
+ Q_DISABLE_COPY(QStackedBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QSTACKEDBARSERIES_H
diff --git a/src/charts/barchart/vertical/stacked/qstackedbarseries_p.h b/src/charts/barchart/vertical/stacked/qstackedbarseries_p.h
new file mode 100644
index 00000000..d5cf3c2d
--- /dev/null
+++ b/src/charts/barchart/vertical/stacked/qstackedbarseries_p.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QSTACKEDBARSERIES_P_H
+#define QSTACKEDBARSERIES_P_H
+
+#include "qabstractbarseries_p.h"
+#include "abstractdomain_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+
+class QStackedBarSeriesPrivate: public QAbstractBarSeriesPrivate
+{
+public:
+ QStackedBarSeriesPrivate(QStackedBarSeries *q);
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeDomain();
+private:
+ Q_DECLARE_PUBLIC(QStackedBarSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/barchart/vertical/stacked/stackedbarchartitem.cpp b/src/charts/barchart/vertical/stacked/stackedbarchartitem.cpp
new file mode 100644
index 00000000..953bb455
--- /dev/null
+++ b/src/charts/barchart/vertical/stacked/stackedbarchartitem.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "stackedbarchartitem_p.h"
+#include "bar_p.h"
+#include "qbarset_p.h"
+#include "qabstractbarseries_p.h"
+#include "qbarset.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+StackedBarChartItem::StackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item) :
+ AbstractBarChartItem(series, item)
+{
+ connect(series, SIGNAL(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)),
+ this, SLOT(handleLabelsPositionChanged()));
+ connect(series, SIGNAL(labelsFormatChanged(QString)), this, SLOT(positionLabels()));
+}
+
+void StackedBarChartItem::initializeLayout()
+{
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ m_layout.clear();
+ for(int category = 0; category < categoryCount; category++) {
+ for (int set = 0; set < setCount; set++) {
+ QRectF rect;
+ QPointF topLeft;
+ QPointF bottomRight;
+
+ if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain) {
+ topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, domain()->minY()), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, domain()->minY()), m_validData);
+ } else {
+ topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, 0), m_validData);
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, 0), m_validData);
+ }
+
+ if (!m_validData)
+ return;
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ m_layout.append(rect.normalized());
+ }
+ }
+}
+
+QVector<QRectF> StackedBarChartItem::calculateLayout()
+{
+ QVector<QRectF> layout;
+ // Use temporary qreals for accuracy
+ qreal categoryCount = m_series->d_func()->categoryCount();
+ qreal setCount = m_series->count();
+ qreal barWidth = m_series->d_func()->barWidth();
+
+ for(int category = 0; category < categoryCount; category++) {
+ qreal positiveSum = 0;
+ qreal negativeSum = 0;
+ for (int set = 0; set < setCount; set++) {
+ qreal value = m_series->barSets().at(set)->at(category);
+ QRectF rect;
+ QPointF topLeft;
+ QPointF bottomRight;
+ if (value < 0) {
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, value + negativeSum), m_validData);
+ if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
+ topLeft = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, set ? negativeSum : domain()->minY()), m_validData);
+ else
+ topLeft = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, set ? negativeSum : 0), m_validData);
+ negativeSum += value;
+ } else {
+ topLeft = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2, value + positiveSum), m_validData);
+ if (domain()->type() == AbstractDomain::XLogYDomain || domain()->type() == AbstractDomain::LogXLogYDomain)
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, set ? positiveSum : domain()->minY()), m_validData);
+ else
+ bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, set ? positiveSum : 0), m_validData);
+ positiveSum += value;
+ }
+
+ rect.setTopLeft(topLeft);
+ rect.setBottomRight(bottomRight);
+ layout.append(rect.normalized());
+ }
+ }
+ return layout;
+}
+
+void StackedBarChartItem::handleLabelsPositionChanged()
+{
+ positionLabels();
+}
+
+void StackedBarChartItem::positionLabels()
+{
+ for (int i = 0; i < m_layout.count(); i++) {
+ QGraphicsTextItem *label = m_labels.at(i);
+ qreal xPos = m_layout.at(i).center().x() - label->boundingRect().center().x();
+ qreal yPos = 0;
+
+ int offset = m_bars.at(i)->pen().width() / 2 + 2;
+ if (m_series->labelsPosition() == QAbstractBarSeries::LabelsCenter)
+ yPos = m_layout.at(i).center().y() - label->boundingRect().center().y();
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideEnd)
+ yPos = m_layout.at(i).top() - offset;
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsInsideBase)
+ yPos = m_layout.at(i).bottom() - label->boundingRect().height() + offset;
+ else if (m_series->labelsPosition() == QAbstractBarSeries::LabelsOutsideEnd)
+ yPos = m_layout.at(i).top() - label->boundingRect().height() + offset;
+
+ label->setPos(xPos, yPos);
+ label->setZValue(zValue() + 1);
+ }
+}
+
+#include "moc_stackedbarchartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/barchart/vertical/stacked/stackedbarchartitem_p.h b/src/charts/barchart/vertical/stacked/stackedbarchartitem_p.h
new file mode 100644
index 00000000..f2fa6b73
--- /dev/null
+++ b/src/charts/barchart/vertical/stacked/stackedbarchartitem_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+
+#ifndef STACKEDBARCHARTITEM_H
+#define STACKEDBARCHARTITEM_H
+
+#include "abstractbarchartitem_p.h"
+#include <qstackedbarseries.h>
+#include <QGraphicsItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class StackedBarChartItem : public AbstractBarChartItem
+{
+ Q_OBJECT
+public:
+ StackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item =0);
+
+private slots:
+ void handleLabelsPositionChanged();
+ void positionLabels();
+
+private:
+ virtual QVector<QRectF> calculateLayout();
+ void initializeLayout();
+
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // STACKEDBARCHARTITEM_H
diff --git a/src/boxplotchart/boxplotchart.pri b/src/charts/boxplotchart/boxplotchart.pri
index db6e034b..db6e034b 100644
--- a/src/boxplotchart/boxplotchart.pri
+++ b/src/charts/boxplotchart/boxplotchart.pri
diff --git a/src/charts/boxplotchart/boxplotchartitem.cpp b/src/charts/boxplotchart/boxplotchartitem.cpp
new file mode 100644
index 00000000..ac1734d5
--- /dev/null
+++ b/src/charts/boxplotchart/boxplotchartitem.cpp
@@ -0,0 +1,215 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "boxplotchartitem_p.h"
+#include "qboxplotseries_p.h"
+#include "bar_p.h"
+#include "qboxset_p.h"
+#include "qabstractbarseries_p.h"
+#include "qboxset.h"
+#include "boxwhiskers_p.h"
+#include <QPainter>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+BoxPlotChartItem::BoxPlotChartItem(QBoxPlotSeries *series, QGraphicsItem *item) :
+ ChartItem(series->d_func(), item),
+ m_series(series),
+ m_animation(0)
+{
+ connect(series, SIGNAL(boxsetsRemoved(QList<QBoxSet *>)), this, SLOT(handleBoxsetRemove(QList<QBoxSet *>)));
+ connect(series->d_func(), SIGNAL(restructuredBoxes()), this, SLOT(handleDataStructureChanged()));
+ connect(series->d_func(), SIGNAL(updatedLayout()), this, SLOT(handleLayoutChanged()));
+ connect(series->d_func(), SIGNAL(updatedBoxes()), this, SLOT(handleUpdatedBars()));
+ connect(series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdatedBars()));
+ // QBoxPlotSeriesPrivate calls handleDataStructureChanged(), don't do it here
+ setZValue(ChartPresenter::BoxPlotSeriesZValue);
+}
+
+BoxPlotChartItem::~BoxPlotChartItem()
+{
+}
+
+void BoxPlotChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(painter);
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+}
+
+void BoxPlotChartItem::setAnimation(BoxPlotAnimation *animation)
+{
+ m_animation = animation;
+ if (m_animation) {
+ foreach (BoxWhiskers *item, m_boxTable.values())
+ m_animation->addBox(item);
+ handleDomainUpdated();
+ }
+}
+
+void BoxPlotChartItem::handleDataStructureChanged()
+{
+ int setCount = m_series->count();
+
+ for (int s = 0; s < setCount; s++) {
+ QBoxSet *set = m_series->d_func()->boxSetAt(s);
+
+ BoxWhiskers *box = m_boxTable.value(set);
+ if (!box) {
+ // Item is not yet created, make a box and add it to hash table
+ box = new BoxWhiskers(set, domain(), this);
+ m_boxTable.insert(set, box);
+ connect(box, SIGNAL(clicked(QBoxSet *)), m_series, SIGNAL(clicked(QBoxSet *)));
+ connect(box, SIGNAL(hovered(bool, QBoxSet *)), m_series, SIGNAL(hovered(bool, QBoxSet *)));
+ connect(box, SIGNAL(clicked(QBoxSet *)), set, SIGNAL(clicked()));
+ connect(box, SIGNAL(hovered(bool, QBoxSet *)), set, SIGNAL(hovered(bool)));
+
+ // Set the decorative issues for the newly created box
+ // so that the brush and pen already defined for the set are kept.
+ if (set->brush() == Qt::NoBrush)
+ box->setBrush(m_series->brush());
+ else
+ box->setBrush(set->brush());
+ if (set->pen() == Qt::NoPen)
+ box->setPen(m_series->pen());
+ else
+ box->setPen(set->pen());
+ box->setBoxOutlined(m_series->boxOutlineVisible());
+ box->setBoxWidth(m_series->boxWidth());
+ }
+ updateBoxGeometry(box, s);
+
+ box->updateGeometry(domain());
+
+ if (m_animation)
+ m_animation->addBox(box);
+ }
+
+ handleDomainUpdated();
+}
+
+void BoxPlotChartItem::handleUpdatedBars()
+{
+ foreach (BoxWhiskers *item, m_boxTable.values()) {
+ item->setBrush(m_series->brush());
+ item->setPen(m_series->pen());
+ item->setBoxOutlined(m_series->boxOutlineVisible());
+ item->setBoxWidth(m_series->boxWidth());
+ }
+ // Override with QBoxSet specific settings
+ foreach (QBoxSet *set, m_boxTable.keys()) {
+ if (set->brush().style() != Qt::NoBrush)
+ m_boxTable.value(set)->setBrush(set->brush());
+ if (set->pen().style() != Qt::NoPen)
+ m_boxTable.value(set)->setPen(set->pen());
+ }
+}
+
+void BoxPlotChartItem::handleBoxsetRemove(QList<QBoxSet*> barSets)
+{
+ foreach (QBoxSet *set, barSets) {
+ BoxWhiskers *boxItem = m_boxTable.value(set);
+ m_boxTable.remove(set);
+ delete boxItem;
+ }
+}
+
+void BoxPlotChartItem::handleDomainUpdated()
+{
+ if ((domain()->size().width() <= 0) || (domain()->size().height() <= 0))
+ return;
+
+ // Set my bounding rect to same as domain size. Add one pixel at the top (-1.0) and the bottom as 0.0 would
+ // snip a bit off from the whisker at the grid line
+ m_boundingRect.setRect(0.0, -1.0, domain()->size().width(), domain()->size().height() + 1.0);
+
+ foreach (BoxWhiskers *item, m_boxTable.values()) {
+ item->updateGeometry(domain());
+
+ // If the animation is set, start the animation for each BoxWhisker item
+ if (m_animation)
+ presenter()->startAnimation(m_animation->boxAnimation(item));
+ }
+}
+
+void BoxPlotChartItem::handleLayoutChanged()
+{
+ foreach (BoxWhiskers *item, m_boxTable.values()) {
+ if (m_animation)
+ m_animation->setAnimationStart(item);
+
+ item->setBoxWidth(m_series->boxWidth());
+
+ bool dirty = updateBoxGeometry(item, item->m_data.m_index);
+ if (dirty && m_animation)
+ presenter()->startAnimation(m_animation->boxChangeAnimation(item));
+ else
+ item->updateGeometry(domain());
+ }
+}
+
+QRectF BoxPlotChartItem::boundingRect() const
+{
+ return m_boundingRect;
+}
+
+void BoxPlotChartItem::initializeLayout()
+{
+}
+
+QVector<QRectF> BoxPlotChartItem::calculateLayout()
+{
+ return QVector<QRectF>();
+}
+
+bool BoxPlotChartItem::updateBoxGeometry(BoxWhiskers *box, int index)
+{
+ bool changed = false;
+
+ QBoxSet *set = m_series->d_func()->boxSetAt(index);
+ BoxWhiskersData &data = box->m_data;
+
+ if ((data.m_lowerExtreme != set->at(0)) || (data.m_lowerQuartile != set->at(1)) ||
+ (data.m_median != set->at(2)) || (data.m_upperQuartile != set->at(3)) || (data.m_upperExtreme != set->at(4))) {
+ changed = true;
+ }
+
+ data.m_lowerExtreme = set->at(0);
+ data.m_lowerQuartile = set->at(1);
+ data.m_median = set->at(2);
+ data.m_upperQuartile = set->at(3);
+ data.m_upperExtreme = set->at(4);
+ data.m_index = index;
+ data.m_boxItems = m_series->count();
+
+ data.m_maxX = domain()->maxX();
+ data.m_minX = domain()->minX();
+ data.m_maxY = domain()->maxY();
+ data.m_minY = domain()->minY();
+
+ data.m_seriesIndex = m_seriesIndex;
+ data.m_seriesCount = m_seriesCount;
+
+ return changed;
+}
+
+#include "moc_boxplotchartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/boxplotchart/boxplotchartitem_p.h b/src/charts/boxplotchart/boxplotchartitem_p.h
new file mode 100644
index 00000000..0bba5394
--- /dev/null
+++ b/src/charts/boxplotchart/boxplotchartitem_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+
+#ifndef BOXPLOTCHARTITEM_H
+#define BOXPLOTCHARTITEM_H
+
+#include "boxwhiskers_p.h"
+#include "qboxplotseries.h"
+#include "chartitem_p.h"
+#include "boxplotanimation_p.h"
+#include "qboxset.h"
+#include <QGraphicsItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class BoxPlotSeriesPrivate;
+
+class BoxPlotChartItem : public ChartItem
+{
+ Q_OBJECT
+public:
+ BoxPlotChartItem(QBoxPlotSeries *series, QGraphicsItem *item = 0);
+ ~BoxPlotChartItem();
+
+ void setAnimation(BoxPlotAnimation *animation);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ QRectF boundingRect() const;
+
+public Q_SLOTS:
+ void handleDataStructureChanged();
+ void handleDomainUpdated();
+ void handleLayoutChanged();
+ void handleUpdatedBars();
+ void handleBoxsetRemove(QList<QBoxSet *> barSets);
+
+private:
+ virtual QVector<QRectF> calculateLayout();
+ void initializeLayout();
+ bool updateBoxGeometry(BoxWhiskers *box, int index);
+
+protected:
+ friend class QBoxPlotSeriesPrivate;
+ QBoxPlotSeries *m_series; // Not owned.
+ QList<BoxWhiskers *> m_boxes;
+ QHash<QBoxSet *, BoxWhiskers *> m_boxTable;
+ int m_seriesIndex;
+ int m_seriesCount;
+
+ BoxPlotAnimation *m_animation;
+
+ QRectF m_boundingRect;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // BOXPLOTCHARTITEM_H
diff --git a/src/charts/boxplotchart/boxwhiskers.cpp b/src/charts/boxplotchart/boxwhiskers.cpp
new file mode 100644
index 00000000..1e78d127
--- /dev/null
+++ b/src/charts/boxplotchart/boxwhiskers.cpp
@@ -0,0 +1,194 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "boxwhiskers_p.h"
+#include <QPainter>
+#include <QWidget>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+BoxWhiskers::BoxWhiskers(QBoxSet *set, AbstractDomain *domain, QGraphicsObject *parent) :
+ QGraphicsObject(parent),
+ m_boxSet(set),
+ m_domain(domain)
+{
+ setAcceptHoverEvents(true);
+ setAcceptedMouseButtons(Qt::MouseButtonMask);
+}
+
+BoxWhiskers::~BoxWhiskers()
+{
+}
+
+void BoxWhiskers::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event)
+ emit clicked(m_boxSet);
+}
+
+void BoxWhiskers::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event)
+ emit hovered(true, m_boxSet);
+}
+
+void BoxWhiskers::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event)
+ emit hovered(false, m_boxSet);
+}
+
+void BoxWhiskers::setBrush(const QBrush &brush)
+{
+ m_brush = brush;
+ m_outlinePen.setColor(m_brush.color());
+ update();
+}
+
+void BoxWhiskers::setPen(const QPen &pen)
+{
+ qreal widthDiff = pen.widthF() - m_pen.widthF();
+ m_boundingRect.adjust(-widthDiff, -widthDiff, widthDiff, widthDiff);
+
+ m_pen = pen;
+ m_medianPen = pen;
+ m_medianPen.setCapStyle(Qt::FlatCap);
+ m_outlinePen = pen;
+ m_outlinePen.setStyle(Qt::SolidLine);
+ m_outlinePen.setColor(m_brush.color());
+
+ update();
+}
+
+void BoxWhiskers::setBoxWidth(const qreal width)
+{
+ m_boxWidth = width;
+}
+
+void BoxWhiskers::setLayout(const BoxWhiskersData &data)
+{
+ m_data = data;
+
+ updateGeometry(m_domain);
+ update();
+}
+
+QSizeF BoxWhiskers::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(which)
+ Q_UNUSED(constraint)
+
+ return QSizeF();
+}
+
+void BoxWhiskers::setGeometry(const QRectF &rect)
+{
+ Q_UNUSED(rect)
+}
+
+QRectF BoxWhiskers::boundingRect() const
+{
+ return m_boundingRect;
+}
+
+void BoxWhiskers::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
+
+ painter->save();
+ painter->setBrush(m_brush);
+ painter->setClipRect(parentItem()->boundingRect());
+ painter->setPen(m_pen);
+ painter->drawPath(m_boxPath);
+ if (!m_boxOutlined)
+ painter->setPen(m_outlinePen);
+ painter->drawRect(m_middleBox);
+ painter->setPen(m_medianPen);
+ qreal halfLine = m_pen.widthF() / 2.0;
+ painter->drawLine(QLineF(m_geometryLeft - halfLine, m_geometryMedian,
+ m_geometryRight + halfLine, m_geometryMedian));
+ painter->restore();
+}
+
+void BoxWhiskers::updateGeometry(AbstractDomain *domain)
+{
+ m_domain = domain;
+
+ prepareGeometryChange();
+
+ QPainterPath path;
+ m_boxPath = path;
+ m_boundingRect = m_boxPath.boundingRect();
+
+ qreal columnWidth = 1.0 / m_data.m_seriesCount;
+ qreal left = ((1.0 - m_boxWidth) / 2.0) * columnWidth + columnWidth * m_data.m_seriesIndex + m_data.m_index - 0.5;
+ qreal barWidth = m_boxWidth * columnWidth;
+
+ QPointF geometryPoint = m_domain->calculateGeometryPoint(QPointF(left, m_data.m_upperExtreme), m_validData);
+ if (!m_validData)
+ return;
+ m_geometryLeft = geometryPoint.x();
+ qreal geometryUpperExtreme = geometryPoint.y();
+ geometryPoint = m_domain->calculateGeometryPoint(QPointF(left + barWidth, m_data.m_upperQuartile), m_validData);
+ if (!m_validData)
+ return;
+ m_geometryRight = geometryPoint.x();
+ qreal geometryUpperQuartile = geometryPoint.y();
+ geometryPoint = m_domain->calculateGeometryPoint(QPointF(left, m_data.m_lowerQuartile), m_validData);
+ if (!m_validData)
+ return;
+ qreal geometryLowerQuartile = geometryPoint.y();
+ geometryPoint = m_domain->calculateGeometryPoint(QPointF(left, m_data.m_lowerExtreme), m_validData);
+ if (!m_validData)
+ return;
+ qreal geometryLowerExtreme = geometryPoint.y();
+ geometryPoint = m_domain->calculateGeometryPoint(QPointF(left, m_data.m_median), m_validData);
+ if (!m_validData)
+ return;
+ m_geometryMedian = geometryPoint.y();
+
+ // Upper whisker
+ path.moveTo(m_geometryLeft, geometryUpperExtreme);
+ path.lineTo(m_geometryRight, geometryUpperExtreme);
+ path.moveTo((m_geometryLeft + m_geometryRight) / 2.0, geometryUpperExtreme);
+ path.lineTo((m_geometryLeft + m_geometryRight) / 2.0, geometryUpperQuartile);
+
+ // Middle Box
+ m_middleBox.setCoords(m_geometryLeft, geometryUpperQuartile, m_geometryRight, geometryLowerQuartile);
+
+ // Lower whisker
+ path.moveTo(m_geometryLeft, geometryLowerExtreme);
+ path.lineTo(m_geometryRight, geometryLowerExtreme);
+ path.moveTo((m_geometryLeft + m_geometryRight) / 2.0, geometryLowerQuartile);
+ path.lineTo((m_geometryLeft + m_geometryRight) / 2.0, geometryLowerExtreme);
+
+ path.closeSubpath();
+
+ m_boxPath = path;
+ m_boundingRect = m_boxPath.boundingRect();
+
+ qreal extra = m_pen.widthF();
+ m_boundingRect.adjust(-extra, -extra, extra, extra);
+}
+
+#include "moc_boxwhiskers_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/boxplotchart/boxwhiskers_p.h b/src/charts/boxplotchart/boxwhiskers_p.h
new file mode 100644
index 00000000..3dee8335
--- /dev/null
+++ b/src/charts/boxplotchart/boxwhiskers_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef BOXWHISKERS_H
+#define BOXWHISKERS_H
+
+#include "boxwhiskersdata_p.h"
+#include "qchartglobal.h"
+#include "abstractdomain_p.h"
+#include <QBoxSet>
+#include <QGraphicsRectItem>
+#include <QGraphicsLineItem>
+#include <QGraphicsLayoutItem>
+#include <QPainterPath>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarSet;
+
+class BoxWhiskers : public QGraphicsObject
+{
+ Q_OBJECT
+
+public:
+ BoxWhiskers(QBoxSet *set, AbstractDomain *domain, QGraphicsObject *parent);
+ ~BoxWhiskers();
+
+ void setBrush(const QBrush &brush);
+ void setPen(const QPen &pen);
+ void setLayout(const BoxWhiskersData &data);
+ void setBoxOutlined(const bool outlined) { m_boxOutlined = outlined; }
+ void setBoxWidth(const qreal width);
+
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+
+ void updateGeometry(AbstractDomain *domain);
+protected:
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+ void setGeometry(const QRectF &rect);
+
+Q_SIGNALS:
+ void clicked(QBoxSet *boxset);
+ void hovered(bool status, QBoxSet *boxset);
+
+private:
+ friend class BoxPlotChartItem;
+ friend class BoxPlotAnimation;
+
+ QBoxSet *m_boxSet;
+ AbstractDomain *m_domain;
+ QPainterPath m_boxPath;
+ QRectF m_boundingRect;
+ bool m_hovering;
+ bool m_validData;
+ QBrush m_brush;
+ QPen m_pen;
+ QPen m_medianPen;
+ QPen m_outlinePen;
+ bool m_boxOutlined;
+ qreal m_boxWidth;
+ BoxWhiskersData m_data;
+ QSizeF m_domainSize;
+ QRectF m_middleBox;
+ qreal m_geometryMedian;
+ qreal m_geometryLeft;
+ qreal m_geometryRight;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // BOXWHISKERS_H
diff --git a/src/charts/boxplotchart/boxwhiskersdata_p.h b/src/charts/boxplotchart/boxwhiskersdata_p.h
new file mode 100644
index 00000000..041c9039
--- /dev/null
+++ b/src/charts/boxplotchart/boxwhiskersdata_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef BOXWHISKERSDATA_P_H
+#define BOXWHISKERSDATA_P_H
+
+#include "qchartglobal.h"
+#include <QSizeF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class BoxWhiskersData
+{
+public:
+ BoxWhiskersData() :
+ m_lowerExtreme(0.0),
+ m_lowerQuartile(0.0),
+ m_median(0.0),
+ m_upperQuartile(0.0),
+ m_upperExtreme(0.0),
+ m_index(0),
+ m_boxItems(0),
+ m_maxX(0.0),
+ m_minX(0.0),
+ m_maxY(0.0),
+ m_minY(0.0),
+ m_seriesIndex(0),
+ m_seriesCount(0)
+ {
+ }
+
+ // Box related statistics
+ qreal m_lowerExtreme;
+ qreal m_lowerQuartile;
+ qreal m_median;
+ qreal m_upperQuartile;
+ qreal m_upperExtreme;
+ int m_index;
+ int m_boxItems;
+
+ // Domain boundaries, axis
+ qreal m_maxX;
+ qreal m_minX;
+ qreal m_maxY;
+ qreal m_minY;
+
+ // Serieses related data
+ int m_seriesIndex;
+ int m_seriesCount;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // BOXWHISKERSDATA_P_H
diff --git a/src/charts/boxplotchart/qboxplotmodelmapper.cpp b/src/charts/boxplotchart/qboxplotmodelmapper.cpp
new file mode 100644
index 00000000..7f1487c8
--- /dev/null
+++ b/src/charts/boxplotchart/qboxplotmodelmapper.cpp
@@ -0,0 +1,489 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qboxplotmodelmapper.h"
+#include "qboxplotmodelmapper_p.h"
+#include "qboxplotseries.h"
+#include "qboxset.h"
+#include "qchart.h"
+#include <QAbstractItemModel>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+QBoxPlotModelMapper::QBoxPlotModelMapper(QObject *parent) :
+ QObject(parent),
+ d_ptr(new QBoxPlotModelMapperPrivate(this))
+{
+}
+
+QAbstractItemModel *QBoxPlotModelMapper::model() const
+{
+ Q_D(const QBoxPlotModelMapper);
+ return d->m_model;
+}
+
+void QBoxPlotModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model == 0)
+ return;
+
+ Q_D(QBoxPlotModelMapper);
+ if (d->m_model)
+ disconnect(d->m_model, 0, d, 0);
+
+ d->m_model = model;
+ d->initializeBoxFromModel();
+ // connect signals from the model
+ connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
+ connect(d->m_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), d, SLOT(modelHeaderDataUpdated(Qt::Orientation,int,int)));
+ connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
+}
+
+QBoxPlotSeries *QBoxPlotModelMapper::series() const
+{
+ Q_D(const QBoxPlotModelMapper);
+ return d->m_series;
+}
+
+void QBoxPlotModelMapper::setSeries(QBoxPlotSeries *series)
+{
+ Q_D(QBoxPlotModelMapper);
+ if (d->m_series)
+ disconnect(d->m_series, 0, d, 0);
+
+ if (series == 0)
+ return;
+
+ d->m_series = series;
+ d->initializeBoxFromModel();
+ // connect the signals from the series
+ connect(d->m_series, SIGNAL(boxsetsAdded(QList<QBoxSet *>)), d, SLOT(boxSetsAdded(QList<QBoxSet *>)));
+ connect(d->m_series, SIGNAL(boxsetsRemoved(QList<QBoxSet *>)), d, SLOT(boxSetsRemoved(QList<QBoxSet *>)));
+ connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
+}
+
+/*!
+ Returns which row/column of the model contains the first values of the QBoxSets in the series.
+ The default value is 0.
+*/
+int QBoxPlotModelMapper::first() const
+{
+ Q_D(const QBoxPlotModelMapper);
+ return d->m_first;
+}
+
+/*!
+ Sets which row/column of the model contains the \a first values of the QBoxSets in the series.
+ The default value is 0.
+*/
+void QBoxPlotModelMapper::setFirst(int first)
+{
+ Q_D(QBoxPlotModelMapper);
+ d->m_first = qMax(first, 0);
+ d->initializeBoxFromModel();
+}
+
+/*!
+ Returns the number of rows/columns of the model that are mapped as the data for QBoxPlotSeries
+ Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
+*/
+int QBoxPlotModelMapper::count() const
+{
+ Q_D(const QBoxPlotModelMapper);
+ return d->m_count;
+}
+
+/*!
+ Sets the \a count of rows/columns of the model that are mapped as the data for QBoxPlotSeries
+ Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
+*/
+void QBoxPlotModelMapper::setCount(int count)
+{
+ Q_D(QBoxPlotModelMapper);
+ d->m_count = qMax(count, -1);
+ d->initializeBoxFromModel();
+}
+
+/*!
+ Returns the orientation that is used when QBoxPlotModelMapper accesses the model.
+ This means whether the consecutive values of the box-and-whiskers set are read from row (Qt::Horizontal)
+ or from columns (Qt::Vertical)
+*/
+Qt::Orientation QBoxPlotModelMapper::orientation() const
+{
+ Q_D(const QBoxPlotModelMapper);
+ return d->m_orientation;
+}
+
+/*!
+ Returns the \a orientation that is used when QBoxPlotModelMapper accesses the model.
+ This mean whether the consecutive values of the box-and-whiskers set are read from row (Qt::Horizontal)
+ or from columns (Qt::Vertical)
+*/
+void QBoxPlotModelMapper::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QBoxPlotModelMapper);
+ d->m_orientation = orientation;
+ d->initializeBoxFromModel();
+}
+
+/*!
+ Returns which section of the model is used as the data source for the first box set
+*/
+int QBoxPlotModelMapper::firstBoxSetSection() const
+{
+ Q_D(const QBoxPlotModelMapper);
+ return d->m_firstBoxSetSection;
+}
+
+/*!
+ Sets the model section that is used as the data source for the first box set
+ Parameter \a firstBoxSetSection specifies the section of the model.
+*/
+void QBoxPlotModelMapper::setFirstBoxSetSection(int firstBoxSetSection)
+{
+ Q_D(QBoxPlotModelMapper);
+ d->m_firstBoxSetSection = qMax(-1, firstBoxSetSection);
+ d->initializeBoxFromModel();
+}
+
+/*!
+ Returns which section of the model is used as the data source for the last box set
+*/
+int QBoxPlotModelMapper::lastBoxSetSection() const
+{
+ Q_D(const QBoxPlotModelMapper);
+ return d->m_lastBoxSetSection;
+}
+
+/*!
+ Sets the model section that is used as the data source for the last box set
+ Parameter \a lastBoxSetSection specifies the section of the model.
+*/
+void QBoxPlotModelMapper::setLastBoxSetSection(int lastBoxSetSection)
+{
+ Q_D(QBoxPlotModelMapper);
+ d->m_lastBoxSetSection = qMax(-1, lastBoxSetSection);
+ d->initializeBoxFromModel();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QBoxPlotModelMapperPrivate::QBoxPlotModelMapperPrivate(QBoxPlotModelMapper *q) :
+ QObject(q),
+ m_series(0),
+ m_model(0),
+ m_first(0),
+ m_count(-1),
+ m_orientation(Qt::Vertical),
+ m_firstBoxSetSection(-1),
+ m_lastBoxSetSection(-1),
+ m_seriesSignalsBlock(false),
+ m_modelSignalsBlock(false),
+ q_ptr(q)
+{
+}
+
+void QBoxPlotModelMapperPrivate::blockModelSignals(bool block)
+{
+ m_modelSignalsBlock = block;
+}
+
+void QBoxPlotModelMapperPrivate::blockSeriesSignals(bool block)
+{
+ m_seriesSignalsBlock = block;
+}
+
+QBoxSet *QBoxPlotModelMapperPrivate::boxSet(QModelIndex index)
+{
+ if (!index.isValid())
+ return 0;
+
+ if (m_orientation == Qt::Vertical && index.column() >= m_firstBoxSetSection && index.column() <= m_lastBoxSetSection) {
+ if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count))
+ return m_series->boxSets().at(index.column() - m_firstBoxSetSection);
+ } else if (m_orientation == Qt::Horizontal && index.row() >= m_firstBoxSetSection && index.row() <= m_lastBoxSetSection) {
+ if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count))
+ return m_series->boxSets().at(index.row() - m_firstBoxSetSection);
+ }
+ return 0; // This part of model has not been mapped to any boxset
+}
+
+QModelIndex QBoxPlotModelMapperPrivate::boxModelIndex(int boxSection, int posInBar)
+{
+ if (m_count != -1 && posInBar >= m_count)
+ return QModelIndex(); // invalid
+
+ if (boxSection < m_firstBoxSetSection || boxSection > m_lastBoxSetSection)
+ return QModelIndex(); // invalid
+
+ if (m_orientation == Qt::Vertical)
+ return m_model->index(posInBar + m_first, boxSection);
+ else
+ return m_model->index(boxSection, posInBar + m_first);
+}
+
+void QBoxPlotModelMapperPrivate::handleSeriesDestroyed()
+{
+ m_series = 0;
+}
+
+void QBoxPlotModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
+{
+ Q_UNUSED(topLeft)
+ Q_UNUSED(bottomRight)
+
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ QModelIndex index;
+ for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
+ for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
+ index = topLeft.sibling(row, column);
+ QBoxSet *box = boxSet(index);
+ if (box) {
+ if (m_orientation == Qt::Vertical)
+ box->setValue(row - m_first, m_model->data(index).toReal());
+ else
+ box->setValue(column - m_first, m_model->data(index).toReal());
+ }
+ }
+ }
+ blockSeriesSignals(false);
+}
+
+void QBoxPlotModelMapperPrivate::modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last)
+{
+ Q_UNUSED(orientation);
+ Q_UNUSED(first);
+ Q_UNUSED(last);
+}
+
+void QBoxPlotModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Vertical)
+ insertData(start, end);
+ else if (start <= m_firstBoxSetSection || start <= m_lastBoxSetSection) // if the changes affect the map - reinitialize
+ initializeBoxFromModel();
+ blockSeriesSignals(false);
+}
+
+void QBoxPlotModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Vertical)
+ removeData(start, end);
+ else if (start <= m_firstBoxSetSection || start <= m_lastBoxSetSection) // if the changes affect the map - reinitialize
+ initializeBoxFromModel();
+ blockSeriesSignals(false);
+}
+
+void QBoxPlotModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Horizontal)
+ insertData(start, end);
+ else if (start <= m_firstBoxSetSection || start <= m_lastBoxSetSection) // if the changes affect the map - reinitialize
+ initializeBoxFromModel();
+ blockSeriesSignals(false);
+}
+
+void QBoxPlotModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent)
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Horizontal)
+ removeData(start, end);
+ else if (start <= m_firstBoxSetSection || start <= m_lastBoxSetSection) // if the changes affect the map - reinitialize
+ initializeBoxFromModel();
+ blockSeriesSignals(false);
+}
+
+void QBoxPlotModelMapperPrivate::handleModelDestroyed()
+{
+ m_model = 0;
+}
+
+void QBoxPlotModelMapperPrivate::insertData(int start, int end)
+{
+ Q_UNUSED(end)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+ // Currently boxplotchart needs to be fully recalculated when change is made.
+ // Re-initialize
+ initializeBoxFromModel();
+}
+
+void QBoxPlotModelMapperPrivate::removeData(int start, int end)
+{
+ Q_UNUSED(end)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+ // Currently boxplotchart needs to be fully recalculated when change is made.
+ // Re-initialize
+ initializeBoxFromModel();
+}
+
+void QBoxPlotModelMapperPrivate::boxSetsAdded(QList<QBoxSet *> sets)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (sets.count() == 0)
+ return;
+
+ int firstIndex = m_series->boxSets().indexOf(sets.at(0));
+ if (firstIndex == -1)
+ return;
+
+ int maxCount = 0;
+ for (int i = 0; i < sets.count(); i++) {
+ if (sets.at(i)->count() > m_count)
+ maxCount = sets.at(i)->count();
+ }
+
+ if (m_count != -1 && m_count < maxCount)
+ m_count = maxCount;
+
+ m_lastBoxSetSection += sets.count();
+
+ blockModelSignals();
+ int modelCapacity = m_orientation == Qt::Vertical ? m_model->rowCount() - m_first : m_model->columnCount() - m_first;
+ if (maxCount > modelCapacity) {
+ if (m_orientation == Qt::Vertical)
+ m_model->insertRows(m_model->rowCount(), maxCount - modelCapacity);
+ else
+ m_model->insertColumns(m_model->columnCount(), maxCount - modelCapacity);
+ }
+
+ if (m_orientation == Qt::Vertical)
+ m_model->insertColumns(firstIndex + m_firstBoxSetSection, sets.count());
+ else
+ m_model->insertRows(firstIndex + m_firstBoxSetSection, sets.count());
+
+
+ for (int i = firstIndex + m_firstBoxSetSection; i < firstIndex + m_firstBoxSetSection + sets.count(); i++) {
+ for (int j = 0; j < sets.at(i - firstIndex - m_firstBoxSetSection)->count(); j++)
+ m_model->setData(boxModelIndex(i, j), sets.at(i - firstIndex - m_firstBoxSetSection)->at(j));
+ }
+ blockModelSignals(false);
+ initializeBoxFromModel();
+}
+
+void QBoxPlotModelMapperPrivate::boxSetsRemoved(QList<QBoxSet *> sets)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (sets.count() == 0)
+ return;
+
+ int firstIndex = m_boxSets.indexOf(sets.at(0));
+ if (firstIndex == -1)
+ return;
+
+ m_lastBoxSetSection -= sets.count();
+
+ for (int i = firstIndex + sets.count() - 1; i >= firstIndex; i--)
+ m_boxSets.removeAt(i);
+
+ blockModelSignals();
+ if (m_orientation == Qt::Vertical)
+ m_model->removeColumns(firstIndex + m_firstBoxSetSection, sets.count());
+ else
+ m_model->removeRows(firstIndex + m_firstBoxSetSection, sets.count());
+ blockModelSignals(false);
+ initializeBoxFromModel();
+}
+
+void QBoxPlotModelMapperPrivate::boxValueChanged(int index)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ int boxSetIndex = m_boxSets.indexOf(qobject_cast<QBoxSet *>(QObject::sender()));
+
+ blockModelSignals();
+ m_model->setData(boxModelIndex(boxSetIndex + m_firstBoxSetSection, index), m_boxSets.at(boxSetIndex)->at(index));
+ blockModelSignals(false);
+ initializeBoxFromModel();
+}
+
+void QBoxPlotModelMapperPrivate::initializeBoxFromModel()
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ blockSeriesSignals();
+ // clear current content
+ m_series->clear();
+ m_boxSets.clear();
+
+ // create the initial box-and-whiskers sets
+ for (int i = m_firstBoxSetSection; i <= m_lastBoxSetSection; i++) {
+ int posInBar = 0;
+ QModelIndex boxIndex = boxModelIndex(i, posInBar);
+ // check if there is such model index
+ if (boxIndex.isValid()) {
+ QBoxSet *boxSet = new QBoxSet();
+ while (boxIndex.isValid()) {
+ boxSet->append(m_model->data(boxIndex, Qt::DisplayRole).toDouble());
+ posInBar++;
+ boxIndex = boxModelIndex(i, posInBar);
+ }
+ connect(boxSet, SIGNAL(valueChanged(int)), this, SLOT(boxValueChanged(int)));
+ m_series->append(boxSet);
+ m_boxSets.append(boxSet);
+ } else {
+ break;
+ }
+ }
+ blockSeriesSignals(false);
+}
+
+#include "moc_qboxplotmodelmapper.cpp"
+#include "moc_qboxplotmodelmapper_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/boxplotchart/qboxplotmodelmapper.h b/src/charts/boxplotchart/qboxplotmodelmapper.h
new file mode 100644
index 00000000..a114be99
--- /dev/null
+++ b/src/charts/boxplotchart/qboxplotmodelmapper.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBOXPLOTMODELMAPPER_H
+#define QBOXPLOTMODELMAPPER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QObject>
+
+class QAbstractItemModel;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBoxPlotModelMapperPrivate;
+class QBoxPlotSeries;
+
+class QT_CHARTS_EXPORT QBoxPlotModelMapper : public QObject
+{
+ Q_OBJECT
+
+protected:
+ explicit QBoxPlotModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QBoxPlotSeries *series() const;
+ void setSeries(QBoxPlotSeries *series);
+
+ int first() const;
+ void setFirst(int first);
+
+ int count() const;
+ void setCount(int count);
+
+ int firstBoxSetSection() const;
+ void setFirstBoxSetSection(int firstBoxSetSection);
+
+ int lastBoxSetSection() const;
+ void setLastBoxSetSection(int lastBoxSetSection);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+protected:
+ QBoxPlotModelMapperPrivate * const d_ptr;
+ Q_DECLARE_PRIVATE(QBoxPlotModelMapper)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBOXPLOTMODELMAPPER_H
diff --git a/src/charts/boxplotchart/qboxplotmodelmapper_p.h b/src/charts/boxplotchart/qboxplotmodelmapper_p.h
new file mode 100644
index 00000000..9e474d9e
--- /dev/null
+++ b/src/charts/boxplotchart/qboxplotmodelmapper_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBOXPLOTMODELMAPPER_P_H
+#define QBOXPLOTMODELMAPPER_P_H
+
+#include <QObject>
+#include <qboxplotmodelmapper.h>
+
+class QModelIndex;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBoxSet;
+
+class QBoxPlotModelMapperPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QBoxPlotModelMapperPrivate(QBoxPlotModelMapper *q);
+
+public Q_SLOTS:
+ // for the model
+ void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
+ void modelHeaderDataUpdated(Qt::Orientation orientation, int first, int last);
+ void modelRowsAdded(QModelIndex parent, int start, int end);
+ void modelRowsRemoved(QModelIndex parent, int start, int end);
+ void modelColumnsAdded(QModelIndex parent, int start, int end);
+ void modelColumnsRemoved(QModelIndex parent, int start, int end);
+ void handleModelDestroyed();
+
+ // for the series
+ void boxSetsAdded(QList<QBoxSet *> sets);
+ void boxSetsRemoved(QList<QBoxSet *> sets);
+ void boxValueChanged(int index);
+ void handleSeriesDestroyed();
+
+ void initializeBoxFromModel();
+
+private:
+ QBoxSet *boxSet(QModelIndex index);
+ QModelIndex boxModelIndex(int boxSection, int posInBox);
+ void insertData(int start, int end);
+ void removeData(int start, int end);
+ void blockModelSignals(bool block = true);
+ void blockSeriesSignals(bool block = true);
+
+private:
+ QBoxPlotSeries *m_series;
+ QList<QBoxSet *> m_boxSets;
+ QAbstractItemModel *m_model;
+ int m_first;
+ int m_count;
+ Qt::Orientation m_orientation;
+ int m_firstBoxSetSection;
+ int m_lastBoxSetSection;
+ bool m_seriesSignalsBlock;
+ bool m_modelSignalsBlock;
+
+private:
+ QBoxPlotModelMapper *q_ptr;
+ Q_DECLARE_PUBLIC(QBoxPlotModelMapper)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBOXPLOTMODELMAPPER_P_H
diff --git a/src/charts/boxplotchart/qboxplotseries.cpp b/src/charts/boxplotchart/qboxplotseries.cpp
new file mode 100644
index 00000000..2f444b40
--- /dev/null
+++ b/src/charts/boxplotchart/qboxplotseries.cpp
@@ -0,0 +1,690 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qboxplotseries.h"
+#include "qboxplotseries_p.h"
+#include "qboxplotlegendmarker.h"
+#include "qbarcategoryaxis.h"
+#include "boxplotchartitem_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "qvalueaxis.h"
+#include "charttheme_p.h"
+#include "boxplotanimation_p.h"
+#include "qchart_p.h"
+#include "qboxset.h"
+#include "qboxset_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QBoxPlotSeries
+ \inmodule Qt Charts
+ \brief Series for creating box-and-whiskers chart.
+ \mainclass
+
+ QBoxPlotSeries represents a series of data shown as box-and-whisker bars. The purpose of this class is to act as
+ a container for single box-and-whisker items. Each item is drawn to own slot. If chart includes multiple instances of
+ QBoxPlotSeries then box-and-whiskers items with the same index are drawn to same slot.
+
+ See the \l {Box and Whiskers Example} {box-and-whiskers chart example} to learn how to create a box-and-whiskers chart.
+ \image examples_boxplotchart.png
+
+ \sa QBoxSet
+*/
+/*!
+ \fn QBoxPlotSeries::boxsetsAdded(QList<QBoxSet *> sets)
+ \brief Signal is emitted when a new \a sets of box-and-whiskers data is added to the series.
+*/
+/*!
+ \fn QBoxPlotSeries::boxsetsRemoved(QList<QBoxSet *> sets)
+ \brief Signal is emitted when \a sets of box-and-whiskers data is removed from the series.
+*/
+/*!
+ \fn QBoxPlotSeries::clicked(QBoxSet *boxset)
+ \brief Signal is emitted when the user clicks the \a boxset on the chart.
+*/
+/*!
+ \fn QBoxPlotSeries::hovered(bool status, QBoxSet *boxset)
+ \brief Signal is emitted when there is change in hover \a status over \a boxset.
+*/
+/*!
+ \fn QBoxPlotSeries::countChanged()
+ \brief Signal is emitted when there is change in count of box-and-whiskers items in the series.
+*/
+/*!
+ \property QBoxPlotSeries::boxOutlineVisible
+ \brief This property configures the visibility of the middle box outline.
+*/
+/*!
+ \property QBoxPlotSeries::boxWidth
+ \brief This property configures the width of the box-and-whiskers item. The value signifies the relative
+ width of the box-and-whiskers item inside its own slot. The value can between 0.0 and 1.0. Negative values
+ are clamped to 0.0 and values over 1.0 are clamped to 1.0.
+*/
+/*!
+ \property QBoxPlotSeries::pen
+ \brief This property configures the pen of the box-and-whiskers items.
+*/
+/*!
+ \property QBoxPlotSeries::brush
+ \brief This property configures the brush of the box-and-whiskers items.
+*/
+/*!
+ \property QBoxPlotSeries::count
+ \brief The count of sets in series.
+*/
+
+/*!
+ \qmlproperty QString BoxPlotSeries::brushFilename
+ The name of the file used as a brush for the series.
+*/
+
+/*!
+ \fn void QBoxPlotSeries::boxOutlineVisibilityChanged()
+ Signal is emitted when the middle box outline visibility is changed.
+*/
+/*!
+ \fn void QBoxPlotSeries::boxWidthChanged()
+ Signal is emitted when the width of the box-and-whiskers item is changed.
+*/
+/*!
+ \fn void QBoxPlotSeries::penChanged()
+ This signal is emitted when the pen of the box-and-whiskers has changed.
+ \sa brush
+*/
+/*!
+ \fn void QBoxPlotSeries::brushChanged()
+ This signal is emitted when the brush of the box-and-whiskers has changed.
+ \sa brush
+*/
+/*!
+ \fn virtual SeriesType QBoxPlotSeries::type() const
+ \brief Returns type of series.
+ \sa QAbstractSeries, SeriesType
+*/
+
+/*!
+ Constructs empty QBoxPlotSeries.
+ QBoxPlotSeries is QObject which is a child of a \a parent.
+*/
+QBoxPlotSeries::QBoxPlotSeries(QObject *parent)
+ : QAbstractSeries(*new QBoxPlotSeriesPrivate(this), parent)
+{
+}
+
+/*!
+ Destructor. Removes series from chart.
+*/
+QBoxPlotSeries::~QBoxPlotSeries()
+{
+ Q_D(QBoxPlotSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+
+/*!
+ Adds a single box and whiskers set to series. Takes ownership of the \a set. If the set is null or is already in series, it won't be appended.
+ Returns true, if appending succeeded.
+*/
+bool QBoxPlotSeries::append(QBoxSet *set)
+{
+ Q_D(QBoxPlotSeries);
+
+ bool success = d->append(set);
+ if (success) {
+ QList<QBoxSet *> sets;
+ sets.append(set);
+ set->setParent(this);
+ emit boxsetsAdded(sets);
+ emit countChanged();
+ }
+ return success;
+}
+
+/*!
+ Removes boxset from the series. Deletes the \a set and returns true if successful.
+*/
+bool QBoxPlotSeries::remove(QBoxSet *set)
+{
+ Q_D(QBoxPlotSeries);
+ bool success = d->remove(set);
+ if (success) {
+ QList<QBoxSet *> sets;
+ sets.append(set);
+ set->setParent(0);
+ emit boxsetsRemoved(sets);
+ emit countChanged();
+ delete set;
+ set = 0;
+ }
+ return success;
+}
+
+/*!
+ Takes a single \a set from the series. Does not delete the boxset object.
+
+ NOTE: The series remains as the boxset's parent object. You must set the
+ parent object to take full ownership.
+
+ Returns true if take was successful.
+*/
+bool QBoxPlotSeries::take(QBoxSet *set)
+{
+ Q_D(QBoxPlotSeries);
+
+ bool success = d->remove(set);
+ if (success) {
+ QList<QBoxSet *> sets;
+ sets.append(set);
+ emit boxsetsRemoved(sets);
+ emit countChanged();
+ }
+ return success;
+}
+
+/*!
+ Adds a list of boxsets to series. Takes ownership of the \a sets.
+ Returns true, if all sets were appended successfully. If any of the sets is null or is already appended to series,
+ nothing is appended and function returns false. If any of the sets is in list more than once, nothing is appended
+ and function returns false.
+*/
+bool QBoxPlotSeries::append(QList<QBoxSet *> sets)
+{
+ Q_D(QBoxPlotSeries);
+ bool success = d->append(sets);
+ if (success) {
+ emit boxsetsAdded(sets);
+ emit countChanged();
+ }
+ return success;
+}
+
+/*!
+ Insert a box-and-whiskers set to the series at \a index postion. Takes ownership of the \a set. If the set is null or
+ is already in series, it won't be appended. Returns true, if inserting succeeded.
+
+*/
+bool QBoxPlotSeries::insert(int index, QBoxSet *set)
+{
+ Q_D(QBoxPlotSeries);
+ bool success = d->insert(index, set);
+ if (success) {
+ QList<QBoxSet *> sets;
+ sets.append(set);
+ emit boxsetsAdded(sets);
+ emit countChanged();
+ }
+ return success;
+}
+
+/*!
+ Removes all boxsets from the series. Deletes removed sets.
+*/
+void QBoxPlotSeries::clear()
+{
+ Q_D(QBoxPlotSeries);
+ QList<QBoxSet *> sets = boxSets();
+ bool success = d->remove(sets);
+ if (success) {
+ emit boxsetsRemoved(sets);
+ emit countChanged();
+ foreach (QBoxSet *set, sets)
+ delete set;
+ }
+}
+
+/*!
+ Returns number of sets in series.
+*/
+int QBoxPlotSeries::count() const
+{
+ Q_D(const QBoxPlotSeries);
+ return d->m_boxSets.count();
+}
+
+/*!
+ Returns a list of sets in series. Keeps ownership of sets.
+ */
+QList<QBoxSet *> QBoxPlotSeries::boxSets() const
+{
+ Q_D(const QBoxPlotSeries);
+ return d->m_boxSets;
+}
+
+/*
+ Returns QAbstractSeries::SeriesTypeBoxPlot.
+*/
+QAbstractSeries::SeriesType QBoxPlotSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeBoxPlot;
+}
+
+void QBoxPlotSeries::setBoxOutlineVisible(bool visible)
+{
+ Q_D(QBoxPlotSeries);
+
+ if (d->m_boxOutlineVisible != visible) {
+ d->m_boxOutlineVisible = visible;
+ emit d->updated();
+ emit boxOutlineVisibilityChanged();
+ }
+}
+
+bool QBoxPlotSeries::boxOutlineVisible()
+{
+ Q_D(QBoxPlotSeries);
+
+ return d->m_boxOutlineVisible;
+}
+
+void QBoxPlotSeries::setBoxWidth(qreal width)
+{
+ Q_D(QBoxPlotSeries);
+
+ if (width != d->m_boxWidth) {
+ if (width < 0.0)
+ width = 0.0;
+ if (width > 1.0)
+ width = 1.0;
+ d->m_boxWidth = width;
+ emit d->updatedLayout();
+ emit boxWidthChanged();
+ }
+}
+
+qreal QBoxPlotSeries::boxWidth()
+{
+ Q_D(QBoxPlotSeries);
+
+ return d->m_boxWidth;
+}
+
+void QBoxPlotSeries::setBrush(const QBrush &brush)
+{
+ Q_D(QBoxPlotSeries);
+
+ if (d->m_brush != brush) {
+ d->m_brush = brush;
+ emit d->updated();
+ emit brushChanged();
+ }
+}
+
+QBrush QBoxPlotSeries::brush() const
+{
+ Q_D(const QBoxPlotSeries);
+
+ return d->m_brush;
+}
+
+void QBoxPlotSeries::setPen(const QPen &pen)
+{
+ Q_D(QBoxPlotSeries);
+
+ if (d->m_pen != pen) {
+ d->m_pen = pen;
+ emit d->updated();
+ emit penChanged();
+ }
+}
+
+QPen QBoxPlotSeries::pen() const
+{
+ Q_D(const QBoxPlotSeries);
+
+ return d->m_pen;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QBoxPlotSeriesPrivate::QBoxPlotSeriesPrivate(QBoxPlotSeries *q)
+ : QAbstractSeriesPrivate(q),
+ m_pen(QChartPrivate::defaultPen()),
+ m_brush(QChartPrivate::defaultBrush()),
+ m_boxOutlineVisible(true),
+ m_boxWidth(0.5)
+{
+}
+
+QBoxPlotSeriesPrivate::~QBoxPlotSeriesPrivate()
+{
+ disconnect(this, 0, 0, 0);
+}
+
+void QBoxPlotSeriesPrivate::initializeDomain()
+{
+ qreal minX(domain()->minX());
+ qreal minY(domain()->minY());
+ qreal maxX(domain()->maxX());
+ qreal maxY(domain()->maxY());
+
+ qreal x = m_boxSets.count();
+ minX = qMin(minX, qreal(-0.5));
+ minY = qMin(minY, min());
+ maxX = qMax(maxX, x - qreal(0.5));
+ maxY = qMax(maxY, max());
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+void QBoxPlotSeriesPrivate::initializeAxes()
+{
+ foreach (QAbstractAxis* axis, m_axes) {
+ if (axis->type() == QAbstractAxis::AxisTypeBarCategory) {
+ if (axis->orientation() == Qt::Horizontal)
+ populateCategories(qobject_cast<QBarCategoryAxis *>(axis));
+ }
+ }
+}
+
+QAbstractAxis::AxisType QBoxPlotSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
+{
+ if (orientation == Qt::Horizontal)
+ return QAbstractAxis::AxisTypeBarCategory;
+
+ return QAbstractAxis::AxisTypeValue;
+}
+
+QAbstractAxis* QBoxPlotSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
+{
+ if (defaultAxisType(orientation) == QAbstractAxis::AxisTypeBarCategory)
+ return new QBarCategoryAxis;
+ else
+ return new QValueAxis;
+}
+
+void QBoxPlotSeriesPrivate::populateCategories(QBarCategoryAxis *axis)
+{
+ QStringList categories;
+ if (axis->categories().isEmpty()) {
+ for (int i(1); i < m_boxSets.count() + 1; i++) {
+ QBoxSet *set = m_boxSets.at(i - 1);
+ if (set->label().isEmpty())
+ categories << presenter()->numberToString(i);
+ else
+ categories << set->label();
+ }
+ axis->append(categories);
+ }
+}
+
+void QBoxPlotSeriesPrivate::initializeGraphics(QGraphicsItem *parent)
+{
+ Q_Q(QBoxPlotSeries);
+
+ BoxPlotChartItem *boxPlot = new BoxPlotChartItem(q, parent);
+ m_item.reset(boxPlot);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+
+ if (m_chart) {
+ connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesChange(QAbstractSeries*)) );
+ connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SLOT(handleSeriesRemove(QAbstractSeries*)) );
+
+ QList<QAbstractSeries *> serieses = m_chart->series();
+
+ // Tries to find this series from the Chart's list of series and deduce the index
+ int index = 0;
+ foreach (QAbstractSeries *s, serieses) {
+ if (s->type() == QAbstractSeries::SeriesTypeBoxPlot) {
+ if (q == static_cast<QBoxPlotSeries *>(s)) {
+ boxPlot->m_seriesIndex = index;
+ m_index = index;
+ }
+ index++;
+ }
+ }
+ boxPlot->m_seriesCount = index;
+ }
+
+ // Make BoxPlotChartItem to instantiate box & whisker items
+ boxPlot->handleDataStructureChanged();
+}
+
+void QBoxPlotSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
+{
+ Q_Q(QBoxPlotSeries);
+
+ const QList<QGradient> gradients = theme->seriesGradients();
+
+ if (forced || QChartPrivate::defaultBrush() == m_brush) {
+ QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.5);
+ q->setBrush(brushColor);
+ }
+
+ if (forced || QChartPrivate::defaultPen() == m_pen) {
+ QPen pen = theme->outlinePen();
+ pen.setCosmetic(true);
+ q->setPen(pen);
+ }
+}
+
+void QBoxPlotSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
+{
+ BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data());
+ Q_ASSERT(item);
+ if (item->animation())
+ item->animation()->stopAndDestroyLater();
+
+ if (options.testFlag(QChart::SeriesAnimations))
+ m_animation = new BoxPlotAnimation(item);
+ else
+ m_animation = 0;
+ item->setAnimation(m_animation);
+
+ QAbstractSeriesPrivate::initializeAnimations(options);
+}
+
+QList<QLegendMarker*> QBoxPlotSeriesPrivate::createLegendMarkers(QLegend *legend)
+{
+ Q_Q(QBoxPlotSeries);
+ QList<QLegendMarker *> list;
+ return list << new QBoxPlotLegendMarker(q, legend);
+}
+
+void QBoxPlotSeriesPrivate::handleSeriesRemove(QAbstractSeries *series)
+{
+ Q_Q(QBoxPlotSeries);
+
+ QBoxPlotSeries *removedSeries = static_cast<QBoxPlotSeries *>(series);
+
+ if (q == removedSeries && m_animation) {
+ m_animation->stopAll();
+ QObject::disconnect(m_chart->d_ptr->m_dataset, 0, removedSeries->d_func(), 0);
+ }
+
+ // Test if series removed is me, then don't do anything
+ if (q != removedSeries) {
+ BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data());
+ if (item) {
+ item->m_seriesCount = item->m_seriesCount - 1;
+ if (removedSeries->d_func()->m_index < m_index) {
+ m_index--;
+ item->m_seriesIndex = m_index;
+ }
+
+ item->handleDataStructureChanged();
+ }
+ }
+}
+
+void QBoxPlotSeriesPrivate::handleSeriesChange(QAbstractSeries *series)
+{
+ Q_UNUSED(series);
+
+ Q_Q(QBoxPlotSeries);
+
+ BoxPlotChartItem *boxPlot = static_cast<BoxPlotChartItem *>(m_item.data());
+
+ if (m_chart) {
+ QList<QAbstractSeries *> serieses = m_chart->series();
+
+ // Tries to find this series from the Chart's list of series and deduce the index
+ int index = 0;
+ foreach (QAbstractSeries *s, serieses) {
+ if (s->type() == QAbstractSeries::SeriesTypeBoxPlot) {
+ if (q == static_cast<QBoxPlotSeries *>(s)) {
+ boxPlot->m_seriesIndex = index;
+ m_index = index;
+ }
+ index++;
+ }
+ }
+ boxPlot->m_seriesCount = index;
+ }
+
+ boxPlot->handleDataStructureChanged();
+}
+
+bool QBoxPlotSeriesPrivate::append(QBoxSet *set)
+{
+ if (m_boxSets.contains(set) || (set == 0) || set->d_ptr->m_series)
+ return false; // Fail if set is already in list or set is null.
+
+ m_boxSets.append(set);
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
+ set->d_ptr->m_series = this;
+
+ emit restructuredBoxes(); // this notifies boxplotchartitem
+ return true;
+}
+
+bool QBoxPlotSeriesPrivate::remove(QBoxSet *set)
+{
+ if (!m_boxSets.contains(set))
+ return false; // Fail if set is not in list
+
+ set->d_ptr->m_series = 0;
+ m_boxSets.removeOne(set);
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
+
+ emit restructuredBoxes(); // this notifies boxplotchartitem
+ return true;
+}
+
+bool QBoxPlotSeriesPrivate::append(QList<QBoxSet *> sets)
+{
+ foreach (QBoxSet *set, sets) {
+ if ((set == 0) || m_boxSets.contains(set) || set->d_ptr->m_series)
+ return false; // Fail if any of the sets is null or is already appended.
+ if (sets.count(set) != 1)
+ return false; // Also fail if same set is more than once in given list.
+ }
+
+ foreach (QBoxSet *set, sets) {
+ m_boxSets.append(set);
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
+ set->d_ptr->m_series = this;
+ }
+
+ emit restructuredBoxes(); // this notifies boxplotchartitem
+ return true;
+}
+
+bool QBoxPlotSeriesPrivate::remove(QList<QBoxSet *> sets)
+{
+ if (sets.count() == 0)
+ return false;
+
+ foreach (QBoxSet *set, sets) {
+ if ((set == 0) || (!m_boxSets.contains(set)))
+ return false; // Fail if any of the sets is null or is not in series
+ if (sets.count(set) != 1)
+ return false; // Also fail if same set is more than once in given list.
+ }
+
+ foreach (QBoxSet *set, sets) {
+ set->d_ptr->m_series = 0;
+ m_boxSets.removeOne(set);
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
+ QObject::disconnect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
+ }
+
+ emit restructuredBoxes(); // this notifies boxplotchartitem
+
+ return true;
+}
+
+bool QBoxPlotSeriesPrivate::insert(int index, QBoxSet *set)
+{
+ if ((m_boxSets.contains(set)) || (set == 0) || set->d_ptr->m_series)
+ return false; // Fail if set is already in list or set is null.
+
+ m_boxSets.insert(index, set);
+ set->d_ptr->m_series = this;
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(updatedBox()), this, SIGNAL(updatedBoxes()));
+ QObject::connect(set->d_ptr.data(), SIGNAL(restructuredBox()), this, SIGNAL(restructuredBoxes()));
+
+ emit restructuredBoxes(); // this notifies boxplotchartitem
+ return true;
+}
+
+QBoxSet *QBoxPlotSeriesPrivate::boxSetAt(int index)
+{
+ return m_boxSets.at(index);
+}
+
+qreal QBoxPlotSeriesPrivate::min()
+{
+ if (m_boxSets.count() <= 0)
+ return 0;
+
+ qreal min = m_boxSets.at(0)->at(0);
+
+ foreach (QBoxSet *set, m_boxSets) {
+ for (int i = 0; i < 5; i++) {
+ if (set->at(i) < min)
+ min = set->at(i);
+ }
+ }
+
+ return min;
+}
+
+qreal QBoxPlotSeriesPrivate::max()
+{
+ if (m_boxSets.count() <= 0)
+ return 0;
+
+ qreal max = m_boxSets.at(0)->at(0);
+
+ foreach (QBoxSet *set, m_boxSets) {
+ for (int i = 0; i < 5; i++) {
+ if (set->at(i) > max)
+ max = set->at(i);
+ }
+ }
+
+ return max;
+}
+
+#include "moc_qboxplotseries.cpp"
+#include "moc_qboxplotseries_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/boxplotchart/qboxplotseries.h b/src/charts/boxplotchart/qboxplotseries.h
new file mode 100644
index 00000000..f0684cfa
--- /dev/null
+++ b/src/charts/boxplotchart/qboxplotseries.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBOXPLOTSERIES_H
+#define QBOXPLOTSERIES_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/qboxset.h>
+#include <QtCharts/qabstractseries.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBoxPlotSeriesPrivate;
+
+class QT_CHARTS_EXPORT QBoxPlotSeries : public QAbstractSeries
+{
+ Q_OBJECT
+ Q_PROPERTY(bool boxOutlineVisible READ boxOutlineVisible WRITE setBoxOutlineVisible NOTIFY boxOutlineVisibilityChanged)
+ Q_PROPERTY(qreal boxWidth READ boxWidth WRITE setBoxWidth NOTIFY boxWidthChanged)
+ Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
+ Q_PROPERTY(int count READ count NOTIFY countChanged REVISION 1)
+public:
+ explicit QBoxPlotSeries(QObject *parent = 0);
+ ~QBoxPlotSeries();
+
+ bool append(QBoxSet *box);
+ bool remove(QBoxSet *box);
+ bool take(QBoxSet *box);
+ bool append(QList<QBoxSet *> boxes);
+ bool insert(int index, QBoxSet *box);
+ int count() const;
+ QList<QBoxSet *> boxSets() const;
+ void clear();
+
+ QAbstractSeries::SeriesType type() const;
+
+ void setBoxOutlineVisible(bool visible);
+ bool boxOutlineVisible();
+ void setBoxWidth(qreal width);
+ qreal boxWidth();
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+ void setPen(const QPen &pen);
+ QPen pen() const;
+
+Q_SIGNALS:
+ void clicked(QBoxSet *boxset);
+ void hovered(bool status, QBoxSet *boxset);
+ void countChanged();
+ void penChanged();
+ void brushChanged();
+ void boxOutlineVisibilityChanged();
+ void boxWidthChanged();
+
+ void boxsetsAdded(QList<QBoxSet *> sets);
+ void boxsetsRemoved(QList<QBoxSet *> sets);
+
+private:
+ Q_DECLARE_PRIVATE(QBoxPlotSeries)
+ Q_DISABLE_COPY(QBoxPlotSeries)
+ friend class BoxPlotChartItem;
+ friend class QBoxPlotLegendMarkerPrivate;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBOXPLOTSERIES_H
diff --git a/src/charts/boxplotchart/qboxplotseries_p.h b/src/charts/boxplotchart/qboxplotseries_p.h
new file mode 100644
index 00000000..b635064b
--- /dev/null
+++ b/src/charts/boxplotchart/qboxplotseries_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBOXPLOTSERIES_P_H
+#define QBOXPLOTSERIES_P_H
+
+#include "qboxplotseries.h"
+#include "qabstractbarseries_p.h"
+#include "abstractdomain_p.h"
+#include "qbarset.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class BoxPlotAnimation;
+
+class QBoxPlotSeriesPrivate : public QAbstractSeriesPrivate
+{
+ Q_OBJECT
+
+public:
+ QBoxPlotSeriesPrivate(QBoxPlotSeries *q);
+ ~QBoxPlotSeriesPrivate();
+
+ void initializeGraphics(QGraphicsItem *parent);
+ void initializeDomain();
+ void initializeAxes();
+ void initializeAnimations(QChart::AnimationOptions options);
+ void initializeTheme(int index, ChartTheme *theme, bool forced = false);
+
+ QList<QLegendMarker*> createLegendMarkers(QLegend *legend);
+
+ virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
+ QAbstractAxis *createDefaultAxis(Qt::Orientation orientation) const;
+
+ bool append(QBoxSet *set);
+ bool remove(QBoxSet *set);
+ bool append(QList<QBoxSet *> sets);
+ bool remove(QList<QBoxSet *> sets);
+ bool insert(int index, QBoxSet *set);
+ QBoxSet *boxSetAt(int index);
+
+ qreal max();
+ qreal min();
+
+private:
+ void populateCategories(QBarCategoryAxis *axis);
+
+Q_SIGNALS:
+ void updated();
+ void clicked(int index, QBoxSet *barset);
+ void updatedBoxes();
+ void updatedLayout();
+ void restructuredBoxes();
+
+private slots:
+ void handleSeriesChange(QAbstractSeries *series);
+ void handleSeriesRemove(QAbstractSeries *series);
+
+protected:
+ QList<QBoxSet *> m_boxSets;
+ QPen m_pen;
+ QBrush m_brush;
+ bool m_boxOutlineVisible;
+ int m_index;
+ BoxPlotAnimation *m_animation;
+ qreal m_boxWidth;
+
+private:
+ Q_DECLARE_PUBLIC(QBoxPlotSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/boxplotchart/qboxset.cpp b/src/charts/boxplotchart/qboxset.cpp
new file mode 100644
index 00000000..065746f3
--- /dev/null
+++ b/src/charts/boxplotchart/qboxset.cpp
@@ -0,0 +1,336 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qboxset.h"
+#include "qboxset_p.h"
+#include "charthelpers_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QBoxSet
+ \inmodule Qt Charts
+ \brief Building block for box-and-whiskers chart.
+
+ QBoxSet represents one box-and-whiskers item. It takes five values to create a graphical representation
+ of range and three medians. There are two ways to give the values. The first one is with constructor
+ or stream operator (<<). The values have to be given in the following order: lower extreme,
+ lower quartile, median, upper quartile and upper extreme. The Second method is to create an empty QBoxSet instance and
+ give the values using setValue method.
+
+ \mainclass
+
+ \sa QBoxPlotSeries
+*/
+/*!
+ \enum QBoxSet::ValuePositions
+
+ \value LowerExtreme
+ \value LowerQuartile
+ \value Median
+ \value UpperQuartile
+ \value UpperExtreme
+*/
+/*!
+ \property QBoxSet::pen
+ \brief Defines the pen used by the box-and-whiskers set.
+*/
+/*!
+ \property QBoxSet::brush
+ \brief Defines the brush used by the box-and-whiskers set.
+*/
+
+/*!
+ \qmlproperty QString BoxSet::brushFilename
+ The name of the file used as a brush for the box-and-whiskers set.
+*/
+
+/*!
+ \fn void QBoxSet::clicked()
+ The signal is emitted if the user clicks with a mouse on top of box-and-whisker item.
+*/
+/*!
+ \fn void QBoxSet::hovered(bool status)
+
+ The signal is emitted if mouse is hovered on top of box-and-whisker item.
+ Parameter \a status is true, if mouse entered on top of item, false if mouse left from top of item.
+*/
+/*!
+ \fn void QBoxSet::penChanged()
+ This signal is emitted when the pen of the box-and-whisker item has changed.
+ \sa pen
+*/
+/*!
+ \fn void QBoxSet::brushChanged()
+ This signal is emitted when the brush of the box-and-whisker item has changed.
+ \sa brush
+*/
+/*!
+ \fn void QBoxSet::valuesChanged()
+ This signal is emitted when multiple values have been changed on the box-and-whisker item.
+ \sa append()
+*/
+/*!
+ \fn void QBoxSet::valueChanged(int index)
+ This signal is emitted values the value in the box-and-whisker item has been modified.
+ Parameter \a index indicates the position of the modified value.
+ \sa at()
+*/
+/*!
+ \fn void QBoxSet::cleared()
+ This signal is emitted when all the values on the set are cleared to 0.
+*/
+
+/*!
+ Constructs QBoxSet with optional \a label and parent of \a parent
+*/
+QBoxSet::QBoxSet(const QString label, QObject *parent)
+ : QObject(parent),
+ d_ptr(new QBoxSetPrivate(label, this))
+{
+}
+
+/*!
+ Constructs QBoxSet with given ordered values. \a le for lower extreme, \a lq for lower quartile, \a m for median,
+ \a uq for upper quartile and \a ue for upper quartile. \a label and \a parent are optional.
+ */
+QBoxSet::QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label, QObject *parent)
+ : QObject(parent),
+ d_ptr(new QBoxSetPrivate(label, this))
+{
+ d_ptr->append(le);
+ d_ptr->append(lq);
+ d_ptr->append(m);
+ d_ptr->append(uq);
+ d_ptr->append(ue);
+}
+
+/*!
+ Destroys the boxset
+*/
+QBoxSet::~QBoxSet()
+{
+}
+
+/*!
+ Appends new value \a value to the end of set.
+*/
+void QBoxSet::append(const qreal value)
+{
+ if (d_ptr->append(value))
+ emit valueChanged(d_ptr->m_appendCount - 1);
+}
+
+/*!
+ Appends a list of reals to set. Works like append with single real value. The \a values in list
+ are appended to end of boxset.
+ \sa append()
+*/
+void QBoxSet::append(const QList<qreal> &values)
+{
+ if (d_ptr->append(values))
+ emit valuesChanged();
+}
+
+/*!
+ Sets new \a label for set.
+*/
+void QBoxSet::setLabel(const QString label)
+{
+ d_ptr->m_label = label;
+}
+
+/*!
+ Returns label of the set.
+*/
+QString QBoxSet::label() const
+{
+ return d_ptr->m_label;
+}
+
+/*!
+ Convenience operator. Same as append, with real \a value.
+ \sa append()
+*/
+QBoxSet &QBoxSet::operator << (const qreal &value)
+{
+ append(value);
+ return *this;
+}
+
+/*!
+ Sets a new \a value on the \a index position. For \a index ValuePositions can be used.
+*/
+void QBoxSet::setValue(const int index, const qreal value)
+{
+ d_ptr->setValue(index, value);
+ emit valueChanged(index);
+}
+
+/*!
+ Sets all values on the set to 0.
+ */
+void QBoxSet::clear()
+{
+ d_ptr->clear();
+ emit cleared();
+}
+
+/*!
+ Returns value of set indexed by \a index. For \a index ValuePositions can be used.
+ If the index is out of bounds 0.0 is returned.
+*/
+qreal QBoxSet::at(const int index) const
+{
+ if (index < 0 || index >= 5)
+ return 0;
+ return d_ptr->m_values[index];
+}
+
+/*!
+ Returns value of set indexed by \a index. For \a index ValuePositions can be used.
+ If the index is out of bounds 0.0 is returned.
+*/
+qreal QBoxSet::operator [](const int index) const
+{
+ return at(index);
+}
+
+/*!
+ Returns count of values appended to the set.
+*/
+int QBoxSet::count() const
+{
+ return d_ptr->m_appendCount;
+}
+
+/*!
+ Sets pen for set. Boxes of this set are drawn using \a pen
+*/
+void QBoxSet::setPen(const QPen &pen)
+{
+ if (d_ptr->m_pen != pen) {
+ d_ptr->m_pen = pen;
+ emit d_ptr->updatedBox();
+ emit penChanged();
+ }
+}
+
+/*!
+ Returns pen of the set.
+*/
+QPen QBoxSet::pen() const
+{
+ return d_ptr->m_pen;
+}
+
+/*!
+ Sets brush for the set. Boxes of this set are drawn using \a brush
+*/
+void QBoxSet::setBrush(const QBrush &brush)
+{
+ if (d_ptr->m_brush != brush) {
+ d_ptr->m_brush = brush;
+ emit d_ptr->updatedBox();
+ emit brushChanged();
+ }
+}
+
+/*!
+ Returns brush of the set.
+*/
+QBrush QBoxSet::brush() const
+{
+ return d_ptr->m_brush;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QBoxSetPrivate::QBoxSetPrivate(const QString label, QBoxSet *parent) : QObject(parent),
+ q_ptr(parent),
+ m_label(label),
+ m_valuesCount(5),
+ m_appendCount(0),
+ m_pen(QPen(Qt::NoPen)),
+ m_brush(QBrush(Qt::NoBrush)),
+ m_series(0)
+{
+ m_values = new qreal[m_valuesCount];
+}
+
+QBoxSetPrivate::~QBoxSetPrivate()
+{
+}
+
+bool QBoxSetPrivate::append(qreal value)
+{
+ if (isValidValue(value) && m_appendCount < m_valuesCount) {
+ m_values[m_appendCount++] = value;
+ emit restructuredBox();
+
+ return true;
+ }
+ return false;
+}
+
+bool QBoxSetPrivate::append(QList<qreal> values)
+{
+ bool success = false;
+
+ for (int i = 0; i < values.count(); i++) {
+ if (isValidValue(values.at(i)) && m_appendCount < m_valuesCount) {
+ success = true;
+ m_values[m_appendCount++] = values.at(i);
+ }
+ }
+
+ if (success)
+ emit restructuredBox();
+
+ return success;
+}
+
+void QBoxSetPrivate::clear()
+{
+ m_appendCount = 0;
+ for (int i = 0; i < m_valuesCount; i++)
+ m_values[i] = 0.0;
+ emit restructuredBox();
+}
+
+void QBoxSetPrivate::setValue(const int index, const qreal value)
+{
+ if (index < m_valuesCount) {
+ m_values[index] = value;
+ emit updatedLayout();
+ }
+}
+
+qreal QBoxSetPrivate::value(const int index)
+{
+ if (index < 0 || index >= m_valuesCount)
+ return 0;
+ return m_values[index];
+}
+
+#include "moc_qboxset.cpp"
+#include "moc_qboxset_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/boxplotchart/qboxset.h b/src/charts/boxplotchart/qboxset.h
new file mode 100644
index 00000000..498b570d
--- /dev/null
+++ b/src/charts/boxplotchart/qboxset.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBOXSET_H
+#define QBOXSET_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QPen>
+#include <QBrush>
+#include <QFont>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QBoxSetPrivate;
+
+class QT_CHARTS_EXPORT QBoxSet : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
+
+public:
+ enum ValuePositions {
+ LowerExtreme,
+ LowerQuartile,
+ Median,
+ UpperQuartile,
+ UpperExtreme
+ };
+
+public:
+ explicit QBoxSet(const QString label = QString(), QObject *parent = 0);
+ explicit QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label = QString(), QObject *parent = 0);
+ virtual ~QBoxSet();
+
+ void append(const qreal value);
+ void append(const QList<qreal> &values);
+
+ void clear();
+
+ void setLabel(const QString label);
+ QString label() const;
+
+ QBoxSet &operator << (const qreal &value);
+
+ void setValue(const int index, const qreal value);
+ qreal at(const int index) const;
+ qreal operator [](const int index) const;
+ int count() const;
+
+ void setPen(const QPen &pen);
+ QPen pen() const;
+
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+
+Q_SIGNALS:
+ void clicked();
+ void hovered(bool status);
+ void penChanged();
+ void brushChanged();
+
+ void valuesChanged();
+ void valueChanged(int index);
+ void cleared();
+
+private:
+ QScopedPointer<QBoxSetPrivate> d_ptr;
+ Q_DISABLE_COPY(QBoxSet)
+ friend class BarLegendMarker;
+ friend class BarChartItem;
+ friend class BoxPlotChartItem;
+ friend class QBoxPlotSeriesPrivate;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBOXSET_H
diff --git a/src/charts/boxplotchart/qboxset_p.h b/src/charts/boxplotchart/qboxset_p.h
new file mode 100644
index 00000000..3fd13080
--- /dev/null
+++ b/src/charts/boxplotchart/qboxset_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBOXSET_P_H
+#define QBOXSET_P_H
+
+#include <qboxset.h>
+#include <QMap>
+#include <QPen>
+#include <QBrush>
+#include <QFont>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBoxPlotSeriesPrivate;
+
+class QBoxSetPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ QBoxSetPrivate(const QString label, QBoxSet *parent);
+ ~QBoxSetPrivate();
+
+ bool append(qreal value);
+ bool append(QList<qreal> values);
+
+ int remove(const int index, const int count);
+ void clear();
+
+ void setValue(const int index, const qreal value);
+
+ qreal value(const int index);
+
+Q_SIGNALS:
+ void restructuredBox();
+ void updatedBox();
+ void updatedLayout();
+
+private:
+ const QBoxSet *q_ptr;
+ QString m_label;
+ const int m_valuesCount;
+ qreal *m_values;
+ int m_appendCount;
+ QPen m_pen;
+ QBrush m_brush;
+ QBrush m_labelBrush;
+ QFont m_labelFont;
+ QBoxPlotSeriesPrivate *m_series;
+
+ friend class QBoxSet;
+ friend class QBoxPlotSeriesPrivate;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBOXSET_P_H
diff --git a/src/charts/boxplotchart/qvboxplotmodelmapper.cpp b/src/charts/boxplotchart/qvboxplotmodelmapper.cpp
new file mode 100644
index 00000000..fd35e938
--- /dev/null
+++ b/src/charts/boxplotchart/qvboxplotmodelmapper.cpp
@@ -0,0 +1,257 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvboxplotmodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QVBoxPlotModelMapper
+ \inmodule Qt Charts
+ \brief Vertical model mapper for box plot series.
+ \mainclass
+
+ Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
+ Vertical model mapper is used to create a connection between QBoxPlotSeries and QAbstractItemModel derived model object.
+ Model mapper maintains equal size of all the QBoxSets.
+ \note used model has to support adding/removing rows/columns and modifying the data of the cells.
+*/
+/*!
+ \qmltype VBoxPlotModelMapper
+ \instantiates QVBoxPlotModelMapper
+ \inqmlmodule QtCharts
+
+ \brief Vertical model mapper for box plot series.
+
+ VBoxPlotModelMapper allows you to use your own QAbstractItemModel derived model with data in
+ columns as a data source for any box-and-whiskers series. It is possible to use both
+ QAbstractItemModel and box-and-whiskers series data API to manipulate data. VBoxPlotModelMapper
+ keeps the series and the model in sync.
+
+ The following QML example would create a box-and-whiskers series with three box sets (assuming
+ the model has at least four columns). Each box set would contain data starting from row 1. The
+ name of a set would be defined by the horizontal header (of the column).
+ \code
+ BoxPlotSeries {
+ VBoxPlotModelMapper {
+ model: myCustomModel // QAbstractItemModel derived implementation
+ firstBoxSetColumn: 1
+ lastBoxSetColumn: 3
+ firstRow: 1
+ }
+ }
+ \endcode
+*/
+
+/*!
+ \property QVBoxPlotModelMapper::series
+ \brief Defines the QBoxPlotSeries object that is used by the mapper.
+
+ All the data in the series is discarded when it is set to the mapper.
+ When new series is specified the old series is disconnected (it preserves its data)
+*/
+/*!
+ \qmlproperty AbstractBarSeries VBoxPlotModelMapper::series
+ Defines the AbstractBarSeries based object that is used by the mapper. All the data in the series is discarded when it is
+ set to the mapper. When new series is specified the old series is disconnected (it preserves its data).
+*/
+
+/*!
+ \property QVBoxPlotModelMapper::model
+ \brief Defines the model that is used by the mapper.
+*/
+/*!
+ \qmlproperty SomeModel VBoxPlotModelMapper::model
+ The QAbstractItemModel based model that is used by the mapper. You need to implement the model
+ and expose it to QML. \note the model has to support adding/removing rows/columns and modifying
+ the data of the cells.
+*/
+
+/*!
+ \property QVBoxPlotModelMapper::firstBoxSetColumn
+ \brief Defines which column of the model is used as the data source for the first box-and-whiskers set.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int VBarModelMapper::firstBoxSetColumn
+ Defines which column of the model is used as the data source for the first box-and-whiskers set. Default value
+ is: -1 (invalid mapping).
+*/
+
+/*!
+ \property QVBoxPlotModelMapper::lastBoxSetColumn
+ \brief Defines which column of the model is used as the data source for the last box-and-whiskers set.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int VBarModelMapper::lastBoxSetColumn
+ Defines which column of the model is used as the data source for the last box-and-whiskers set. Default
+ value is: -1 (invalid mapping).
+*/
+
+/*!
+ \property QVBoxPlotModelMapper::firstRow
+ \brief Defines which row of the model contains the first values of the QBoxSets in the series.
+
+ Minimal and default value is: 0
+*/
+/*!
+ \qmlproperty int VBoxPlotModelMapper::firstRow
+ Defines which row of the model contains the first values of the QBoxSets in the series.
+ The default value is 0.
+*/
+
+/*!
+ \property QVBoxPlotModelMapper::rowCount
+ \brief Defines the number of rows of the model that are mapped as the data for QBoxPlotSeries
+
+ Minimal and default value is: -1 (count limited by the number of rows in the model)
+*/
+/*!
+ \qmlproperty int VBoxModelMapper::rowCount
+ Defines the number of rows of the model that are mapped as the data for QBoxPlotSeries. The default value is
+ -1 (count limited by the number of rows in the model)
+*/
+
+/*!
+ \fn void QVBoxPlotModelMapper::seriesReplaced()
+
+ Emitted when the series to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QVBoxPlotModelMapper::modelReplaced()
+
+ Emitted when the model to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QVBoxPlotModelMapper::firstBoxSetColumnChanged()
+ Emitted when the firstBoxSetColumn has changed.
+*/
+
+/*!
+ \fn void QVBoxPlotModelMapper::lastBoxSetColumnChanged()
+ Emitted when the lastBoxSetColumn has changed.
+*/
+
+/*!
+ \fn void QVBoxPlotModelMapper::firstRowChanged()
+ Emitted when the firstRow has changed.
+*/
+
+/*!
+ \fn void QVBoxPlotModelMapper::rowCountChanged()
+ Emitted when the rowCount has changed.
+*/
+
+/*!
+ Constructs a mapper object which is a child of \a parent.
+*/
+QVBoxPlotModelMapper::QVBoxPlotModelMapper(QObject *parent) :
+ QBoxPlotModelMapper(parent)
+{
+ QBoxPlotModelMapper::setOrientation(Qt::Vertical);
+}
+
+QAbstractItemModel *QVBoxPlotModelMapper::model() const
+{
+ return QBoxPlotModelMapper::model();
+}
+
+void QVBoxPlotModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model != QBoxPlotModelMapper::model()) {
+ QBoxPlotModelMapper::setModel(model);
+ emit modelReplaced();
+ }
+}
+
+QBoxPlotSeries *QVBoxPlotModelMapper::series() const
+{
+ return QBoxPlotModelMapper::series();
+}
+
+void QVBoxPlotModelMapper::setSeries(QBoxPlotSeries *series)
+{
+ if (series != QBoxPlotModelMapper::series()) {
+ QBoxPlotModelMapper::setSeries(series);
+ emit seriesReplaced();
+ }
+}
+
+int QVBoxPlotModelMapper::firstBoxSetColumn() const
+{
+ return QBoxPlotModelMapper::firstBoxSetSection();
+}
+
+void QVBoxPlotModelMapper::setFirstBoxSetColumn(int firstBoxSetColumn)
+{
+ if (firstBoxSetColumn != firstBoxSetSection()) {
+ QBoxPlotModelMapper::setFirstBoxSetSection(firstBoxSetColumn);
+ emit firstBoxSetColumnChanged();
+ }
+}
+
+int QVBoxPlotModelMapper::lastBoxSetColumn() const
+{
+ return QBoxPlotModelMapper::lastBoxSetSection();
+}
+
+void QVBoxPlotModelMapper::setLastBoxSetColumn(int lastBoxSetColumn)
+{
+ if (lastBoxSetColumn != lastBoxSetSection()) {
+ QBoxPlotModelMapper::setLastBoxSetSection(lastBoxSetColumn);
+ emit lastBoxSetColumnChanged();
+ }
+}
+
+int QVBoxPlotModelMapper::firstRow() const
+{
+ return QBoxPlotModelMapper::first();
+}
+
+void QVBoxPlotModelMapper::setFirstRow(int firstRow)
+{
+ if (firstRow != first()) {
+ QBoxPlotModelMapper::setFirst(firstRow);
+ emit firstRowChanged();
+ }
+}
+
+int QVBoxPlotModelMapper::rowCount() const
+{
+ return QBoxPlotModelMapper::count();
+}
+
+void QVBoxPlotModelMapper::setRowCount(int rowCount)
+{
+ if (rowCount != count()) {
+ QBoxPlotModelMapper::setCount(rowCount);
+ emit rowCountChanged();
+ }
+}
+
+#include "moc_qvboxplotmodelmapper.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/boxplotchart/qvboxplotmodelmapper.h b/src/charts/boxplotchart/qvboxplotmodelmapper.h
new file mode 100644
index 00000000..130e4a89
--- /dev/null
+++ b/src/charts/boxplotchart/qvboxplotmodelmapper.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVBOXPLOTMODELMAPPER_H
+#define QVBOXPLOTMODELMAPPER_H
+
+#include <QtCharts/QBoxPlotModelMapper>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/* Comment line for syncqt to generate the fwd-include correctly, due to QTBUG-22432 */
+class QT_CHARTS_EXPORT QVBoxPlotModelMapper : public QBoxPlotModelMapper
+{
+ Q_OBJECT
+ Q_PROPERTY(QBoxPlotSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
+ Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
+ Q_PROPERTY(int firstBoxSetColumn READ firstBoxSetColumn WRITE setFirstBoxSetColumn NOTIFY firstBoxSetColumnChanged)
+ Q_PROPERTY(int lastBoxSetColumn READ lastBoxSetColumn WRITE setLastBoxSetColumn NOTIFY lastBoxSetColumnChanged)
+ Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
+ Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
+
+public:
+ explicit QVBoxPlotModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QBoxPlotSeries *series() const;
+ void setSeries(QBoxPlotSeries *series);
+
+ int firstBoxSetColumn() const;
+ void setFirstBoxSetColumn(int firstBoxSetColumn);
+
+ int lastBoxSetColumn() const;
+ void setLastBoxSetColumn(int lastBoxSetColumn);
+
+ int firstRow() const;
+ void setFirstRow(int firstRow);
+
+ int rowCount() const;
+ void setRowCount(int rowCount);
+
+Q_SIGNALS:
+ void seriesReplaced();
+ void modelReplaced();
+ void firstBoxSetColumnChanged();
+ void lastBoxSetColumnChanged();
+ void firstRowChanged();
+ void rowCountChanged();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QVBOXPLOTMODELMAPPER_H
diff --git a/src/charts/chartbackground.cpp b/src/charts/chartbackground.cpp
new file mode 100644
index 00000000..ceec3772
--- /dev/null
+++ b/src/charts/chartbackground.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartbackground_p.h"
+#include "chartconfig_p.h"
+#include <QPen>
+#include <QBrush>
+#include <QPainter>
+#include <QGraphicsDropShadowEffect>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartBackground::ChartBackground(QGraphicsItem *parent)
+ : QGraphicsRectItem(parent),
+ m_diameter(5),
+ m_dropShadow(0)
+{
+}
+
+ChartBackground::~ChartBackground()
+{
+
+}
+
+void ChartBackground::setDropShadowEnabled(bool enabled)
+{
+#ifdef QT_NO_GRAPHICSEFFECT
+ Q_UNUSED(enabled)
+#else
+ if (enabled) {
+ if (!m_dropShadow) {
+ m_dropShadow = new QGraphicsDropShadowEffect();
+#ifdef Q_OS_MAC
+ m_dropShadow->setBlurRadius(15);
+ m_dropShadow->setOffset(0, 0);
+#elif defined(Q_OS_WIN)
+ m_dropShadow->setBlurRadius(10);
+ m_dropShadow->setOffset(0, 0);
+#else
+ m_dropShadow->setBlurRadius(10);
+ m_dropShadow->setOffset(5, 5);
+#endif
+ setGraphicsEffect(m_dropShadow);
+ }
+ } else {
+ delete m_dropShadow;
+ m_dropShadow = 0;
+ }
+#endif
+}
+
+void ChartBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ painter->save();
+ painter->setPen(pen());
+ painter->setBrush(brush());
+ painter->drawRoundedRect(rect(), m_diameter, m_diameter);
+ painter->restore();
+}
+
+qreal ChartBackground::diameter() const
+{
+ return m_diameter;
+}
+
+void ChartBackground::setDiameter(qreal diameter)
+{
+ m_diameter = diameter;
+ update();
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/chartbackground_p.h b/src/charts/chartbackground_p.h
new file mode 100644
index 00000000..cf27b5bc
--- /dev/null
+++ b/src/charts/chartbackground_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTBACKGROUND_H
+#define CHARTBACKGROUND_H
+
+#include "qchartglobal.h"
+#include <QGraphicsRectItem>
+
+class QGraphicsDropShadowEffect;
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartBackground: public QGraphicsRectItem
+{
+public:
+ ChartBackground(QGraphicsItem *parent = 0);
+ ~ChartBackground();
+
+ void setDiameter(qreal diameter);
+ qreal diameter() const;
+ void setDropShadowEnabled(bool enabled);
+ bool isDropShadowEnabled() { return m_dropShadow != 0; }
+
+protected:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+private:
+ qreal m_diameter;
+ QGraphicsDropShadowEffect *m_dropShadow;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTBACKGROUND_H */
+
+
diff --git a/src/charts/chartconfig_p.h b/src/charts/chartconfig_p.h
new file mode 100644
index 00000000..e14b1f21
--- /dev/null
+++ b/src/charts/chartconfig_p.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTCONFIG_H
+#define CHARTCONFIG_H
+
+#include "qchartglobal.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartConfig
+{
+private:
+ ChartConfig() {
+ m_instance = this;
+ }
+public:
+ static ChartConfig *instance() {
+ if (!m_instance) {
+ m_instance = new ChartConfig();
+ }
+ return m_instance;
+ }
+
+private:
+ static ChartConfig *m_instance;
+};
+
+
+ChartConfig *ChartConfig::m_instance = 0;
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/chartdataset.cpp b/src/charts/chartdataset.cpp
new file mode 100644
index 00000000..b28e6be0
--- /dev/null
+++ b/src/charts/chartdataset.cpp
@@ -0,0 +1,639 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartdataset_p.h"
+#include "chartpresenter_p.h"
+#include "qchart.h"
+#include "qchart_p.h"
+#include "qvalueaxis.h"
+#include "qbarcategoryaxis.h"
+#include "qvalueaxis_p.h"
+#include "qcategoryaxis.h"
+#include "qabstractseries_p.h"
+#include "qabstractbarseries.h"
+#include "qstackedbarseries.h"
+#include "qpercentbarseries.h"
+#include "qpieseries.h"
+#include "chartitem_p.h"
+#include "xydomain_p.h"
+#include "xypolardomain_p.h"
+#include "xlogydomain_p.h"
+#include "logxydomain_p.h"
+#include "logxlogydomain_p.h"
+#include "xlogypolardomain_p.h"
+#include "logxypolardomain_p.h"
+#include "logxlogypolardomain_p.h"
+
+#ifndef QT_ON_ARM
+#include "qdatetimeaxis.h"
+#endif
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartDataSet::ChartDataSet(QChart *chart)
+ : QObject(chart),
+ m_chart(chart)
+{
+
+}
+
+ChartDataSet::~ChartDataSet()
+{
+ deleteAllSeries();
+ deleteAllAxes();
+}
+
+/*
+ * This method adds series to chartdataset, series ownership is taken from caller.
+ */
+void ChartDataSet::addSeries(QAbstractSeries *series)
+{
+ if (m_seriesList.contains(series)) {
+ qWarning() << QObject::tr("Can not add series. Series already on the chart.");
+ return;
+ }
+
+ // Ignore unsupported series added to polar chart
+ if (m_chart && m_chart->chartType() == QChart::ChartTypePolar) {
+ if (!(series->type() == QAbstractSeries::SeriesTypeArea
+ || series->type() == QAbstractSeries::SeriesTypeLine
+ || series->type() == QAbstractSeries::SeriesTypeScatter
+ || series->type() == QAbstractSeries::SeriesTypeSpline)) {
+ qWarning() << QObject::tr("Can not add series. Series type is not supported by a polar chart.");
+ return;
+ }
+ series->d_ptr->setDomain(new XYPolarDomain());
+ } else {
+ series->d_ptr->setDomain(new XYDomain());
+ }
+
+ series->d_ptr->initializeDomain();
+ m_seriesList.append(series);
+
+ series->setParent(this); // take ownership
+ series->d_ptr->m_chart = m_chart;
+
+ emit seriesAdded(series);
+}
+
+/*
+ * This method adds axis to chartdataset, axis ownership is taken from caller.
+ */
+void ChartDataSet::addAxis(QAbstractAxis *axis, Qt::Alignment aligment)
+{
+ if (m_axisList.contains(axis)) {
+ qWarning() << QObject::tr("Can not add axis. Axis already on the chart.");
+ return;
+ }
+
+ axis->d_ptr->setAlignment(aligment);
+
+ if (!axis->alignment()) {
+ qWarning() << QObject::tr("No alignment specified !");
+ return;
+ };
+
+ AbstractDomain *newDomain;
+ if (m_chart && m_chart->chartType() == QChart::ChartTypePolar)
+ newDomain = new XYPolarDomain();
+ else
+ newDomain = new XYDomain();
+
+ QSharedPointer<AbstractDomain> domain(newDomain);
+ axis->d_ptr->initializeDomain(domain.data());
+
+ axis->setParent(this);
+ axis->d_ptr->m_chart = m_chart;
+ m_axisList.append(axis);
+
+ emit axisAdded(axis);
+}
+
+/*
+ * This method removes series form chartdataset, series ownership is passed back to caller.
+ */
+void ChartDataSet::removeSeries(QAbstractSeries *series)
+{
+
+ if (! m_seriesList.contains(series)) {
+ qWarning() << QObject::tr("Can not remove series. Series not found on the chart.");
+ return;
+ }
+
+ QList<QAbstractAxis*> axes = series->d_ptr->m_axes;
+
+ foreach(QAbstractAxis* axis, axes) {
+ detachAxis(series,axis);
+ }
+
+ emit seriesRemoved(series);
+ m_seriesList.removeAll(series);
+
+ // Reset domain to default
+ series->d_ptr->setDomain(new XYDomain());
+ series->setParent(0);
+ series->d_ptr->m_chart = 0;
+}
+
+/*
+ * This method removes axis form chartdataset, series ownership is passed back to caller.
+ */
+void ChartDataSet::removeAxis(QAbstractAxis *axis)
+{
+ if (! m_axisList.contains(axis)) {
+ qWarning() << QObject::tr("Can not remove axis. Axis not found on the chart.");
+ return;
+ }
+
+ QList<QAbstractSeries*> series = axis->d_ptr->m_series;
+
+ foreach(QAbstractSeries* s, series) {
+ detachAxis(s,axis);
+ }
+
+ emit axisRemoved(axis);
+ m_axisList.removeAll(axis);
+
+ axis->setParent(0);
+ axis->d_ptr->m_chart = 0;
+}
+
+/*
+ * This method attaches axis to series, return true if success.
+ */
+bool ChartDataSet::attachAxis(QAbstractSeries *series,QAbstractAxis *axis)
+{
+ Q_ASSERT(axis);
+
+ if (!series)
+ return false;
+
+ QList<QAbstractSeries *> attachedSeriesList = axis->d_ptr->m_series;
+ QList<QAbstractAxis *> attachedAxisList = series->d_ptr->m_axes;
+
+ if (!m_seriesList.contains(series)) {
+ qWarning() << QObject::tr("Can not find series on the chart.");
+ return false;
+ }
+
+ if (axis && !m_axisList.contains(axis)) {
+ qWarning() << QObject::tr("Can not find axis on the chart.");
+ return false;
+ }
+
+ if (attachedAxisList.contains(axis)) {
+ qWarning() << QObject::tr("Axis already attached to series.");
+ return false;
+ }
+
+ if (attachedSeriesList.contains(series)) {
+ qWarning() << QObject::tr("Axis already attached to series.");
+ return false;
+ }
+
+ AbstractDomain *domain = series->d_ptr->domain();
+ AbstractDomain::DomainType type = selectDomain(attachedAxisList<<axis);
+
+ if (type == AbstractDomain::UndefinedDomain) return false;
+
+ if (domain->type() != type) {
+ AbstractDomain *old = domain;
+ domain = createDomain(type);
+ domain->setRange(old->minX(), old->maxX(), old->minY(), old->maxY());
+ // Initialize domain size to old domain size, as it won't get updated
+ // unless geometry changes.
+ domain->setSize(old->size());
+ }
+
+ if (!domain)
+ return false;
+
+ if (!domain->attachAxis(axis))
+ return false;
+
+ QList<AbstractDomain *> blockedDomains;
+ domain->blockRangeSignals(true);
+ blockedDomains << domain;
+
+ if (domain != series->d_ptr->domain()) {
+ foreach (QAbstractAxis *axis, series->d_ptr->m_axes) {
+ series->d_ptr->domain()->detachAxis(axis);
+ domain->attachAxis(axis);
+ foreach (QAbstractSeries *otherSeries, axis->d_ptr->m_series) {
+ if (otherSeries != series && otherSeries->d_ptr->domain()) {
+ if (!otherSeries->d_ptr->domain()->rangeSignalsBlocked()) {
+ otherSeries->d_ptr->domain()->blockRangeSignals(true);
+ blockedDomains << otherSeries->d_ptr->domain();
+ }
+ }
+ }
+ }
+ series->d_ptr->setDomain(domain);
+ series->d_ptr->initializeDomain();
+ }
+
+ series->d_ptr->m_axes<<axis;
+ axis->d_ptr->m_series<<series;
+
+ series->d_ptr->initializeAxes();
+ axis->d_ptr->initializeDomain(domain);
+
+ foreach (AbstractDomain *blockedDomain, blockedDomains)
+ blockedDomain->blockRangeSignals(false);
+
+ return true;
+}
+
+/*
+ * This method detaches axis to series, return true if success.
+ */
+bool ChartDataSet::detachAxis(QAbstractSeries* series,QAbstractAxis *axis)
+{
+ Q_ASSERT(series);
+ Q_ASSERT(axis);
+
+ QList<QAbstractSeries* > attachedSeriesList = axis->d_ptr->m_series;
+ QList<QAbstractAxis* > attachedAxisList = series->d_ptr->m_axes;
+ AbstractDomain* domain = series->d_ptr->domain();
+
+ if (!m_seriesList.contains(series)) {
+ qWarning() << QObject::tr("Can not find series on the chart.");
+ return false;
+ }
+
+ if (axis && !m_axisList.contains(axis)) {
+ qWarning() << QObject::tr("Can not find axis on the chart.");
+ return false;
+ }
+
+ if (!attachedAxisList.contains(axis)) {
+ qWarning() << QObject::tr("Axis not attached to series.");
+ return false;
+ }
+
+ Q_ASSERT(axis->d_ptr->m_series.contains(series));
+
+ domain->detachAxis(axis);
+ series->d_ptr->m_axes.removeAll(axis);
+ axis->d_ptr->m_series.removeAll(series);
+
+ return true;
+}
+
+void ChartDataSet::createDefaultAxes()
+{
+ if (m_seriesList.isEmpty())
+ return;
+
+ QAbstractAxis::AxisTypes typeX(0);
+ QAbstractAxis::AxisTypes typeY(0);
+
+ // Remove possibly existing axes
+ deleteAllAxes();
+
+ Q_ASSERT(m_axisList.isEmpty());
+
+ // Select the required axis x and axis y types based on the types of the current series
+ foreach(QAbstractSeries* s, m_seriesList) {
+ typeX |= s->d_ptr->defaultAxisType(Qt::Horizontal);
+ typeY |= s->d_ptr->defaultAxisType(Qt::Vertical);
+ }
+
+ // Create the axes of the types selected
+ // As long as AxisType enum balues are sequential a check to see if there are series of
+ // different types is needed. In such cases AxisTypeNoAxis is used to create separate axes
+ // for the types.
+ if (typeX != QAbstractAxis::AxisTypeNoAxis) {
+ if (typeX != m_seriesList.first()->d_ptr->defaultAxisType(Qt::Horizontal))
+ typeX = QAbstractAxis::AxisTypeNoAxis;
+ createAxes(typeX, Qt::Horizontal);
+ }
+
+ if (typeY != QAbstractAxis::AxisTypeNoAxis) {
+ if (typeY != m_seriesList.first()->d_ptr->defaultAxisType(Qt::Vertical))
+ typeY = QAbstractAxis::AxisTypeNoAxis;
+ createAxes(typeY, Qt::Vertical);
+ }
+
+}
+
+void ChartDataSet::createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation orientation)
+{
+ QAbstractAxis *axis = 0;
+ //decide what axis should be created
+
+ switch (type) {
+ case QAbstractAxis::AxisTypeValue:
+ axis = new QValueAxis(this);
+ break;
+ case QAbstractAxis::AxisTypeBarCategory:
+ axis = new QBarCategoryAxis(this);
+ break;
+ case QAbstractAxis::AxisTypeCategory:
+ axis = new QCategoryAxis(this);
+ break;
+#ifndef Q_WS_QWS
+ case QAbstractAxis::AxisTypeDateTime:
+ axis = new QDateTimeAxis(this);
+ break;
+#endif
+ default:
+ axis = 0;
+ break;
+ }
+
+ if (axis) {
+ //create one axis for all
+
+ addAxis(axis,orientation==Qt::Horizontal?Qt::AlignBottom:Qt::AlignLeft);
+ qreal min = 0;
+ qreal max = 0;
+ findMinMaxForSeries(m_seriesList,orientation,min,max);
+ foreach(QAbstractSeries *s, m_seriesList) {
+ attachAxis(s,axis);
+ }
+ axis->setRange(min,max);
+ }
+ else if (type.testFlag(QAbstractAxis::AxisTypeNoAxis)) {
+ //create separate axis
+ foreach(QAbstractSeries *s, m_seriesList) {
+ QAbstractAxis *axis = s->d_ptr->createDefaultAxis(orientation);
+ if(axis) {
+ addAxis(axis,orientation==Qt::Horizontal?Qt::AlignBottom:Qt::AlignLeft);
+ attachAxis(s,axis);
+ }
+ }
+ }
+}
+
+void ChartDataSet::findMinMaxForSeries(QList<QAbstractSeries *> series,Qt::Orientations orientation, qreal &min, qreal &max)
+{
+ Q_ASSERT(!series.isEmpty());
+
+ AbstractDomain *domain = series.first()->d_ptr->domain();
+ min = (orientation == Qt::Vertical) ? domain->minY() : domain->minX();
+ max = (orientation == Qt::Vertical) ? domain->maxY() : domain->maxX();
+
+ for (int i = 1; i< series.size(); i++) {
+ AbstractDomain *domain = series[i]->d_ptr->domain();
+ min = qMin((orientation == Qt::Vertical) ? domain->minY() : domain->minX(), min);
+ max = qMax((orientation == Qt::Vertical) ? domain->maxY() : domain->maxX(), max);
+ }
+ if (min == max) {
+ min -= 0.5;
+ max += 0.5;
+ }
+}
+
+void ChartDataSet::deleteAllSeries()
+{
+ foreach (QAbstractSeries *s , m_seriesList){
+ removeSeries(s);
+ s->deleteLater();
+ }
+ Q_ASSERT(m_seriesList.count() == 0);
+}
+
+void ChartDataSet::deleteAllAxes()
+{
+ foreach (QAbstractAxis *a , m_axisList){
+ removeAxis(a);
+ a->deleteLater();
+ }
+ Q_ASSERT(m_axisList.count() == 0);
+}
+
+void ChartDataSet::zoomInDomain(const QRectF &rect)
+{
+ QList<AbstractDomain*> domains;
+ foreach(QAbstractSeries *s, m_seriesList) {
+ AbstractDomain* domain = s->d_ptr->domain();
+ s->d_ptr->m_domain->blockRangeSignals(true);
+ domains<<domain;
+ }
+
+ foreach(AbstractDomain *domain, domains)
+ domain->zoomIn(rect);
+
+ foreach(AbstractDomain *domain, domains)
+ domain->blockRangeSignals(false);
+}
+
+void ChartDataSet::zoomOutDomain(const QRectF &rect)
+{
+ QList<AbstractDomain*> domains;
+ foreach(QAbstractSeries *s, m_seriesList) {
+ AbstractDomain* domain = s->d_ptr->domain();
+ s->d_ptr->m_domain->blockRangeSignals(true);
+ domains<<domain;
+ }
+
+ foreach(AbstractDomain *domain, domains)
+ domain->zoomOut(rect);
+
+ foreach(AbstractDomain *domain, domains)
+ domain->blockRangeSignals(false);
+}
+
+void ChartDataSet::zoomResetDomain()
+{
+ QList<AbstractDomain*> domains;
+ foreach (QAbstractSeries *s, m_seriesList) {
+ AbstractDomain *domain = s->d_ptr->domain();
+ s->d_ptr->m_domain->blockRangeSignals(true);
+ domains << domain;
+ }
+
+ foreach (AbstractDomain *domain, domains)
+ domain->zoomReset();
+
+ foreach (AbstractDomain *domain, domains)
+ domain->blockRangeSignals(false);
+}
+
+bool ChartDataSet::isZoomedDomain()
+{
+ foreach (QAbstractSeries *s, m_seriesList) {
+ if (s->d_ptr->domain()->isZoomed())
+ return true;
+ }
+ return false;
+}
+
+void ChartDataSet::scrollDomain(qreal dx, qreal dy)
+{
+ QList<AbstractDomain*> domains;
+ foreach(QAbstractSeries *s, m_seriesList) {
+ AbstractDomain* domain = s->d_ptr->domain();
+ s->d_ptr->m_domain->blockRangeSignals(true);
+ domains<<domain;
+ }
+
+ foreach(AbstractDomain *domain, domains)
+ domain->move(dx, dy);
+
+ foreach(AbstractDomain *domain, domains)
+ domain->blockRangeSignals(false);
+}
+
+QPointF ChartDataSet::mapToValue(const QPointF &position, QAbstractSeries *series)
+{
+ QPointF point;
+ if (series == 0 && !m_seriesList.isEmpty())
+ series = m_seriesList.first();
+
+ if (series && series->type() == QAbstractSeries::SeriesTypePie)
+ return point;
+
+ if (series && m_seriesList.contains(series))
+ point = series->d_ptr->m_domain->calculateDomainPoint(position - m_chart->plotArea().topLeft());
+ return point;
+}
+
+QPointF ChartDataSet::mapToPosition(const QPointF &value, QAbstractSeries *series)
+{
+ QPointF point = m_chart->plotArea().topLeft();
+ if (series == 0 && !m_seriesList.isEmpty())
+ series = m_seriesList.first();
+
+ if (series && series->type() == QAbstractSeries::SeriesTypePie)
+ return QPoint(0, 0);
+
+ bool ok;
+ if (series && m_seriesList.contains(series))
+ point += series->d_ptr->m_domain->calculateGeometryPoint(value, ok);
+ return point;
+}
+
+QList<QAbstractAxis *> ChartDataSet::axes() const
+{
+ return m_axisList;
+}
+
+QList<QAbstractSeries *> ChartDataSet::series() const
+{
+ return m_seriesList;
+}
+
+AbstractDomain::DomainType ChartDataSet::selectDomain(QList<QAbstractAxis *> axes)
+{
+ enum Type {
+ Undefined = 0,
+ LogType = 0x1,
+ ValueType = 0x2
+ };
+
+ int horizontal(Undefined);
+ int vertical(Undefined);
+
+ // Assume cartesian chart type, unless chart is set
+ QChart::ChartType chartType(QChart::ChartTypeCartesian);
+ if (m_chart)
+ chartType = m_chart->chartType();
+
+ foreach (QAbstractAxis *axis, axes)
+ {
+ switch (axis->type()) {
+ case QAbstractAxis::AxisTypeLogValue:
+ if (axis->orientation() == Qt::Horizontal)
+ horizontal |= LogType;
+ if (axis->orientation() == Qt::Vertical)
+ vertical |= LogType;
+ break;
+ case QAbstractAxis::AxisTypeValue:
+ case QAbstractAxis::AxisTypeBarCategory:
+ case QAbstractAxis::AxisTypeCategory:
+ case QAbstractAxis::AxisTypeDateTime:
+ if (axis->orientation() == Qt::Horizontal)
+ horizontal |= ValueType;
+ if (axis->orientation() == Qt::Vertical)
+ vertical |= ValueType;
+ break;
+ default:
+ qWarning() << "Undefined type";
+ break;
+ }
+ }
+
+ if (vertical == Undefined)
+ vertical = ValueType;
+ if (horizontal == Undefined)
+ horizontal = ValueType;
+
+ if (vertical == ValueType && horizontal == ValueType) {
+ if (chartType == QChart::ChartTypeCartesian)
+ return AbstractDomain::XYDomain;
+ else if (chartType == QChart::ChartTypePolar)
+ return AbstractDomain::XYPolarDomain;
+ }
+
+ if (vertical == LogType && horizontal == ValueType) {
+ if (chartType == QChart::ChartTypeCartesian)
+ return AbstractDomain::XLogYDomain;
+ if (chartType == QChart::ChartTypePolar)
+ return AbstractDomain::XLogYPolarDomain;
+ }
+
+ if (vertical == ValueType && horizontal == LogType) {
+ if (chartType == QChart::ChartTypeCartesian)
+ return AbstractDomain::LogXYDomain;
+ else if (chartType == QChart::ChartTypePolar)
+ return AbstractDomain::LogXYPolarDomain;
+ }
+
+ if (vertical == LogType && horizontal == LogType) {
+ if (chartType == QChart::ChartTypeCartesian)
+ return AbstractDomain::LogXLogYDomain;
+ else if (chartType == QChart::ChartTypePolar)
+ return AbstractDomain::LogXLogYPolarDomain;
+ }
+
+ return AbstractDomain::UndefinedDomain;
+}
+
+//refactor create factory
+AbstractDomain* ChartDataSet::createDomain(AbstractDomain::DomainType type)
+{
+ switch (type)
+ {
+ case AbstractDomain::LogXLogYDomain:
+ return new LogXLogYDomain();
+ case AbstractDomain::XYDomain:
+ return new XYDomain();
+ case AbstractDomain::XLogYDomain:
+ return new XLogYDomain();
+ case AbstractDomain::LogXYDomain:
+ return new LogXYDomain();
+ case AbstractDomain::XYPolarDomain:
+ return new XYPolarDomain();
+ case AbstractDomain::XLogYPolarDomain:
+ return new XLogYPolarDomain();
+ case AbstractDomain::LogXYPolarDomain:
+ return new LogXYPolarDomain();
+ case AbstractDomain::LogXLogYPolarDomain:
+ return new LogXLogYPolarDomain();
+ default:
+ return 0;
+ }
+}
+
+#include "moc_chartdataset_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/chartdataset_p.h b/src/charts/chartdataset_p.h
new file mode 100644
index 00000000..fea47368
--- /dev/null
+++ b/src/charts/chartdataset_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTDATASET_P_H
+#define CHARTDATASET_P_H
+
+#include "qabstractseries.h"
+#include "abstractdomain_p.h"
+#include "qabstractaxis_p.h"
+#include <QVector>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractAxis;
+class ChartPresenter;
+
+class QT_CHARTS_AUTOTEST_EXPORT ChartDataSet : public QObject
+{
+ Q_OBJECT
+public:
+ ChartDataSet(QChart *chart);
+ virtual ~ChartDataSet();
+
+ void addSeries(QAbstractSeries *series);
+ void removeSeries(QAbstractSeries *series);
+ QList<QAbstractSeries *> series() const;
+
+ void addAxis(QAbstractAxis *axis,Qt::Alignment aligment);
+ void removeAxis(QAbstractAxis *axis);
+ QList<QAbstractAxis*> axes() const;
+
+ bool attachAxis(QAbstractSeries* series,QAbstractAxis *axis);
+ bool detachAxis(QAbstractSeries* series,QAbstractAxis *axis);
+
+ void createDefaultAxes();
+
+ void zoomInDomain(const QRectF &rect);
+ void zoomOutDomain(const QRectF &rect);
+ void zoomResetDomain();
+ bool isZoomedDomain();
+ void scrollDomain(qreal dx, qreal dy);
+
+ QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0);
+ QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0);
+
+Q_SIGNALS:
+ void axisAdded(QAbstractAxis* axis);
+ void axisRemoved(QAbstractAxis* axis);
+ void seriesAdded(QAbstractSeries* series);
+ void seriesRemoved(QAbstractSeries* series);
+
+private:
+ void createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation orientation);
+ QAbstractAxis *createAxis(QAbstractAxis::AxisType type, Qt::Orientation orientation);
+ AbstractDomain::DomainType selectDomain(QList<QAbstractAxis* > axes);
+ AbstractDomain* createDomain(AbstractDomain::DomainType type);
+ void deleteAllAxes();
+ void deleteAllSeries();
+ void findMinMaxForSeries(QList<QAbstractSeries *> series,Qt::Orientations orientation, qreal &min, qreal &max);
+private:
+ QList<QAbstractSeries *> m_seriesList;
+ QList<QAbstractAxis *> m_axisList;
+ QChart* m_chart;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTENGINE_P_H */
diff --git a/src/charts/chartelement.cpp b/src/charts/chartelement.cpp
new file mode 100644
index 00000000..6c40c439
--- /dev/null
+++ b/src/charts/chartelement.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartelement_p.h"
+#include "chartpresenter_p.h"
+#include "abstractdomain_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartElement::ChartElement(QGraphicsItem* item):
+ QGraphicsObject(item),
+ m_presenter(0),
+ m_themeManager(0)
+{
+
+}
+
+void ChartElement::setPresenter(ChartPresenter *presenter)
+{
+ m_presenter = presenter;
+}
+
+ChartPresenter *ChartElement::presenter() const
+{
+ return m_presenter;
+}
+
+void ChartElement::setThemeManager(ChartThemeManager *manager)
+{
+ m_themeManager = manager;
+}
+
+ChartThemeManager* ChartElement::themeManager() const
+{
+ return m_themeManager;
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/chartelement_p.h b/src/charts/chartelement_p.h
new file mode 100644
index 00000000..26ff5ca7
--- /dev/null
+++ b/src/charts/chartelement_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTELEMENT_H
+#define CHARTELEMENT_H
+
+#include "qchartglobal.h"
+#include <QObject>
+#include <QRect>
+#include <QGraphicsObject>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartAnimator;
+class ChartPresenter;
+class ChartAnimation;
+class ChartThemeManager;
+class AbstractDomain;
+
+class ChartElement: public QGraphicsObject
+{
+
+public:
+ explicit ChartElement(QGraphicsItem* item = 0);
+
+ virtual ChartAnimation *animation() const { return 0; }
+ virtual void setPresenter(ChartPresenter *presenter);
+ ChartPresenter *presenter() const;
+ virtual void setThemeManager(ChartThemeManager *manager);
+ ChartThemeManager* themeManager() const;
+
+private:
+ ChartPresenter *m_presenter;
+ ChartThemeManager *m_themeManager;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charthelpers_p.h b/src/charts/charthelpers_p.h
index 8e96e842..8e96e842 100644
--- a/src/charthelpers_p.h
+++ b/src/charts/charthelpers_p.h
diff --git a/src/charts/chartitem.cpp b/src/charts/chartitem.cpp
new file mode 100644
index 00000000..dd8612ab
--- /dev/null
+++ b/src/charts/chartitem.cpp
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chartitem_p.h"
+#include "qabstractseries_p.h"
+#include "abstractdomain_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartItem::ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item):
+ ChartElement(item),
+ m_validData(true),
+ m_series(series)
+{
+
+}
+
+AbstractDomain* ChartItem::domain() const
+{
+ return m_series->domain();
+}
+
+void ChartItem::handleDomainUpdated()
+{
+ qWarning() << __FUNCTION__<< "Slot not implemented";
+}
+
+#include "moc_chartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/chartitem_p.h b/src/charts/chartitem_p.h
new file mode 100644
index 00000000..2e100d67
--- /dev/null
+++ b/src/charts/chartitem_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTITEM_H
+#define CHARTITEM_H
+
+#include "chartelement_p.h"
+#include "chartpresenter_p.h"
+#include <QGraphicsItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartItem : public ChartElement
+{
+ Q_OBJECT
+ enum ChartItemTypes { AXIS_ITEM = UserType + 1, XYLINE_ITEM };
+public:
+ ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item);
+ AbstractDomain* domain() const;
+public Q_SLOTS:
+ virtual void handleDomainUpdated();
+
+protected:
+ bool m_validData;
+private:
+ QAbstractSeriesPrivate* m_series;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTITEM_H */
diff --git a/src/charts/chartpresenter.cpp b/src/charts/chartpresenter.cpp
new file mode 100644
index 00000000..7d3f41a7
--- /dev/null
+++ b/src/charts/chartpresenter.cpp
@@ -0,0 +1,508 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+#include "chartpresenter_p.h"
+#include "qchart.h"
+#include "chartitem_p.h"
+#include "qchart_p.h"
+#include "qabstractaxis.h"
+#include "qabstractaxis_p.h"
+#include "chartdataset_p.h"
+#include "chartanimation_p.h"
+#include "qabstractseries_p.h"
+#include "qareaseries.h"
+#include "chartaxiselement_p.h"
+#include "chartbackground_p.h"
+#include "cartesianchartlayout_p.h"
+#include "polarchartlayout_p.h"
+#include "charttitle_p.h"
+#include <QTimer>
+#include <QTextDocument>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartPresenter::ChartPresenter(QChart *chart, QChart::ChartType type)
+ : QObject(chart),
+ m_chart(chart),
+ m_options(QChart::NoAnimation),
+ m_state(ShowState),
+ m_background(0),
+ m_plotAreaBackground(0),
+ m_title(0),
+ m_localizeNumbers(false)
+{
+ if (type == QChart::ChartTypeCartesian)
+ m_layout = new CartesianChartLayout(this);
+ else if (type == QChart::ChartTypePolar)
+ m_layout = new PolarChartLayout(this);
+ Q_ASSERT(m_layout);
+}
+
+ChartPresenter::~ChartPresenter()
+{
+
+}
+
+void ChartPresenter::setGeometry(const QRectF rect)
+{
+ if (m_rect != rect) {
+ m_rect = rect;
+ foreach (ChartItem *chart, m_chartItems) {
+ chart->domain()->setSize(rect.size());
+ chart->setPos(rect.topLeft());
+ }
+ }
+}
+
+QRectF ChartPresenter::geometry() const
+{
+ return m_rect;
+}
+
+void ChartPresenter::handleAxisAdded(QAbstractAxis *axis)
+{
+ axis->d_ptr->initializeGraphics(rootItem());
+ axis->d_ptr->initializeAnimations(m_options);
+ ChartAxisElement *item = axis->d_ptr->axisItem();
+ item->setPresenter(this);
+ item->setThemeManager(m_chart->d_ptr->m_themeManager);
+ m_axisItems<<item;
+ m_axes<<axis;
+ m_layout->invalidate();
+}
+
+void ChartPresenter::handleAxisRemoved(QAbstractAxis *axis)
+{
+ ChartAxisElement *item = axis->d_ptr->m_item.take();
+ item->hide();
+ item->disconnect();
+ item->deleteLater();
+ m_axisItems.removeAll(item);
+ m_axes.removeAll(axis);
+ m_layout->invalidate();
+}
+
+
+void ChartPresenter::handleSeriesAdded(QAbstractSeries *series)
+{
+ series->d_ptr->initializeGraphics(rootItem());
+ series->d_ptr->initializeAnimations(m_options);
+ series->d_ptr->setPresenter(this);
+ ChartItem *chart = series->d_ptr->chartItem();
+ chart->setPresenter(this);
+ chart->setThemeManager(m_chart->d_ptr->m_themeManager);
+ chart->domain()->setSize(m_rect.size());
+ chart->setPos(m_rect.topLeft());
+ chart->handleDomainUpdated(); //this could be moved to intializeGraphics when animator is refactored
+ m_chartItems<<chart;
+ m_series<<series;
+ m_layout->invalidate();
+}
+
+void ChartPresenter::handleSeriesRemoved(QAbstractSeries *series)
+{
+ ChartItem *chart = series->d_ptr->m_item.take();
+ chart->hide();
+ chart->disconnect();
+ chart->deleteLater();
+ m_chartItems.removeAll(chart);
+ m_series.removeAll(series);
+ m_layout->invalidate();
+}
+
+void ChartPresenter::setAnimationOptions(QChart::AnimationOptions options)
+{
+ if (m_options != options) {
+ QChart::AnimationOptions oldOptions = m_options;
+ m_options = options;
+ if (options.testFlag(QChart::SeriesAnimations) != oldOptions.testFlag(QChart::SeriesAnimations)) {
+ foreach (QAbstractSeries *series, m_series)
+ series->d_ptr->initializeAnimations(m_options);
+ }
+ if (options.testFlag(QChart::GridAxisAnimations) != oldOptions.testFlag(QChart::GridAxisAnimations)) {
+ foreach (QAbstractAxis *axis, m_axes)
+ axis->d_ptr->initializeAnimations(m_options);
+ }
+ m_layout->invalidate(); // So that existing animations don't just stop halfway
+ }
+}
+
+void ChartPresenter::setState(State state,QPointF point)
+{
+ m_state=state;
+ m_statePoint=point;
+}
+
+QChart::AnimationOptions ChartPresenter::animationOptions() const
+{
+ return m_options;
+}
+
+void ChartPresenter::createBackgroundItem()
+{
+ if (!m_background) {
+ m_background = new ChartBackground(rootItem());
+ m_background->setPen(Qt::NoPen); // Theme doesn't touch pen so don't use default
+ m_background->setBrush(QChartPrivate::defaultBrush());
+ m_background->setZValue(ChartPresenter::BackgroundZValue);
+ }
+}
+
+void ChartPresenter::createPlotAreaBackgroundItem()
+{
+ if (!m_plotAreaBackground) {
+ if (m_chart->chartType() == QChart::ChartTypeCartesian)
+ m_plotAreaBackground = new QGraphicsRectItem(rootItem());
+ else
+ m_plotAreaBackground = new QGraphicsEllipseItem(rootItem());
+ // Use transparent pen instead of Qt::NoPen, as Qt::NoPen causes
+ // antialising artifacts with axis lines for some reason.
+ m_plotAreaBackground->setPen(QPen(Qt::transparent));
+ m_plotAreaBackground->setBrush(Qt::NoBrush);
+ m_plotAreaBackground->setZValue(ChartPresenter::PlotAreaZValue);
+ m_plotAreaBackground->setVisible(false);
+ }
+}
+
+void ChartPresenter::createTitleItem()
+{
+ if (!m_title) {
+ m_title = new ChartTitle(rootItem());
+ m_title->setZValue(ChartPresenter::BackgroundZValue);
+ }
+}
+
+void ChartPresenter::startAnimation(ChartAnimation *animation)
+{
+ animation->stop();
+ QTimer::singleShot(0, animation, SLOT(startChartAnimation()));
+}
+
+void ChartPresenter::setBackgroundBrush(const QBrush &brush)
+{
+ createBackgroundItem();
+ m_background->setBrush(brush);
+ m_layout->invalidate();
+}
+
+QBrush ChartPresenter::backgroundBrush() const
+{
+ if (!m_background)
+ return QBrush();
+ return m_background->brush();
+}
+
+void ChartPresenter::setBackgroundPen(const QPen &pen)
+{
+ createBackgroundItem();
+ m_background->setPen(pen);
+ m_layout->invalidate();
+}
+
+QPen ChartPresenter::backgroundPen() const
+{
+ if (!m_background)
+ return QPen();
+ return m_background->pen();
+}
+
+void ChartPresenter::setBackgroundRoundness(qreal diameter)
+{
+ createBackgroundItem();
+ m_background->setDiameter(diameter);
+ m_layout->invalidate();
+}
+
+qreal ChartPresenter::backgroundRoundness() const
+{
+ if (!m_background)
+ return 0;
+ return m_background->diameter();
+}
+
+void ChartPresenter::setPlotAreaBackgroundBrush(const QBrush &brush)
+{
+ createPlotAreaBackgroundItem();
+ m_plotAreaBackground->setBrush(brush);
+ m_layout->invalidate();
+}
+
+QBrush ChartPresenter::plotAreaBackgroundBrush() const
+{
+ if (!m_plotAreaBackground)
+ return QBrush();
+ return m_plotAreaBackground->brush();
+}
+
+void ChartPresenter::setPlotAreaBackgroundPen(const QPen &pen)
+{
+ createPlotAreaBackgroundItem();
+ m_plotAreaBackground->setPen(pen);
+ m_layout->invalidate();
+}
+
+QPen ChartPresenter::plotAreaBackgroundPen() const
+{
+ if (!m_plotAreaBackground)
+ return QPen();
+ return m_plotAreaBackground->pen();
+}
+
+void ChartPresenter::setTitle(const QString &title)
+{
+ createTitleItem();
+ m_title->setText(title);
+ m_layout->invalidate();
+}
+
+QString ChartPresenter::title() const
+{
+ if (!m_title)
+ return QString();
+ return m_title->text();
+}
+
+void ChartPresenter::setTitleFont(const QFont &font)
+{
+ createTitleItem();
+ m_title->setFont(font);
+ m_layout->invalidate();
+}
+
+QFont ChartPresenter::titleFont() const
+{
+ if (!m_title)
+ return QFont();
+ return m_title->font();
+}
+
+void ChartPresenter::setTitleBrush(const QBrush &brush)
+{
+ createTitleItem();
+ m_title->setDefaultTextColor(brush.color());
+ m_layout->invalidate();
+}
+
+QBrush ChartPresenter::titleBrush() const
+{
+ if (!m_title)
+ return QBrush();
+ return QBrush(m_title->defaultTextColor());
+}
+
+void ChartPresenter::setBackgroundVisible(bool visible)
+{
+ createBackgroundItem();
+ m_background->setVisible(visible);
+}
+
+
+bool ChartPresenter::isBackgroundVisible() const
+{
+ if (!m_background)
+ return false;
+ return m_background->isVisible();
+}
+
+void ChartPresenter::setPlotAreaBackgroundVisible(bool visible)
+{
+ createPlotAreaBackgroundItem();
+ m_plotAreaBackground->setVisible(visible);
+}
+
+bool ChartPresenter::isPlotAreaBackgroundVisible() const
+{
+ if (!m_plotAreaBackground)
+ return false;
+ return m_plotAreaBackground->isVisible();
+}
+
+void ChartPresenter::setBackgroundDropShadowEnabled(bool enabled)
+{
+ createBackgroundItem();
+ m_background->setDropShadowEnabled(enabled);
+}
+
+bool ChartPresenter::isBackgroundDropShadowEnabled() const
+{
+ if (!m_background)
+ return false;
+ return m_background->isDropShadowEnabled();
+}
+
+void ChartPresenter::setLocalizeNumbers(bool localize)
+{
+ m_localizeNumbers = localize;
+ m_layout->invalidate();
+}
+
+void ChartPresenter::setLocale(const QLocale &locale)
+{
+ m_locale = locale;
+ m_layout->invalidate();
+}
+
+AbstractChartLayout *ChartPresenter::layout()
+{
+ return m_layout;
+}
+
+QLegend *ChartPresenter::legend()
+{
+ return m_chart->legend();
+}
+
+void ChartPresenter::setVisible(bool visible)
+{
+ m_chart->setVisible(visible);
+}
+
+ChartBackground *ChartPresenter::backgroundElement()
+{
+ return m_background;
+}
+
+QAbstractGraphicsShapeItem *ChartPresenter::plotAreaElement()
+{
+ return m_plotAreaBackground;
+}
+
+QList<ChartAxisElement *> ChartPresenter::axisItems() const
+{
+ return m_axisItems;
+}
+
+QList<ChartItem *> ChartPresenter::chartItems() const
+{
+ return m_chartItems;
+}
+
+ChartTitle *ChartPresenter::titleElement()
+{
+ return m_title;
+}
+
+QRectF ChartPresenter::textBoundingRect(const QFont &font, const QString &text, qreal angle)
+{
+ static QGraphicsTextItem dummyTextItem;
+ static bool initMargin = true;
+ if (initMargin) {
+ dummyTextItem.document()->setDocumentMargin(textMargin());
+ initMargin = false;
+ }
+
+ dummyTextItem.setFont(font);
+ dummyTextItem.setHtml(text);
+ QRectF boundingRect = dummyTextItem.boundingRect();
+
+ // Take rotation into account
+ if (angle) {
+ QTransform transform;
+ transform.rotate(angle);
+ boundingRect = transform.mapRect(boundingRect);
+ }
+
+ return boundingRect;
+}
+
+// boundingRect parameter returns the rotated bounding rect of the text
+QString ChartPresenter::truncatedText(const QFont &font, const QString &text, qreal angle,
+ qreal maxWidth, qreal maxHeight, QRectF &boundingRect)
+{
+ QString truncatedString(text);
+ boundingRect = textBoundingRect(font, truncatedString, angle);
+ if (boundingRect.width() > maxWidth || boundingRect.height() > maxHeight) {
+ // It can be assumed that almost any amount of string manipulation is faster
+ // than calculating one bounding rectangle, so first prepare a list of truncated strings
+ // to try.
+ static QRegExp truncateMatcher(QStringLiteral("&#?[0-9a-zA-Z]*;$"));
+
+ QVector<QString> testStrings(text.length());
+ int count(0);
+ static QLatin1Char closeTag('>');
+ static QLatin1Char openTag('<');
+ static QLatin1Char semiColon(';');
+ static QLatin1String ellipsis("...");
+ while (truncatedString.length() > 1) {
+ int chopIndex(-1);
+ int chopCount(1);
+ QChar lastChar(truncatedString.at(truncatedString.length() - 1));
+
+ if (lastChar == closeTag)
+ chopIndex = truncatedString.lastIndexOf(openTag);
+ else if (lastChar == semiColon)
+ chopIndex = truncateMatcher.indexIn(truncatedString, 0);
+
+ if (chopIndex != -1)
+ chopCount = truncatedString.length() - chopIndex;
+ truncatedString.chop(chopCount);
+ testStrings[count] = truncatedString + ellipsis;
+ count++;
+ }
+
+ // Binary search for best fit
+ int minIndex(0);
+ int maxIndex(count - 1);
+ int bestIndex(count);
+ QRectF checkRect;
+
+ while (maxIndex >= minIndex) {
+ int mid = (maxIndex + minIndex) / 2;
+ checkRect = textBoundingRect(font, testStrings.at(mid), angle);
+ if (checkRect.width() > maxWidth || checkRect.height() > maxHeight) {
+ // Checked index too large, all under this are also too large
+ minIndex = mid + 1;
+ } else {
+ // Checked index fits, all over this also fit
+ maxIndex = mid - 1;
+ bestIndex = mid;
+ boundingRect = checkRect;
+ }
+ }
+ // Default to "..." if nothing fits
+ if (bestIndex == count) {
+ boundingRect = textBoundingRect(font, ellipsis, angle);
+ truncatedString = ellipsis;
+ } else {
+ truncatedString = testStrings.at(bestIndex);
+ }
+ }
+
+ return truncatedString;
+}
+
+QString ChartPresenter::numberToString(double value, char f, int prec)
+{
+ if (m_localizeNumbers)
+ return m_locale.toString(value, f, prec);
+ else
+ return QString::number(value, f, prec);
+}
+
+QString ChartPresenter::numberToString(int value)
+{
+ if (m_localizeNumbers)
+ return m_locale.toString(value);
+ else
+ return QString::number(value);
+}
+
+#include "moc_chartpresenter_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/chartpresenter_p.h b/src/charts/chartpresenter_p.h
new file mode 100644
index 00000000..85f1b1bb
--- /dev/null
+++ b/src/charts/chartpresenter_p.h
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTPRESENTER_H
+#define CHARTPRESENTER_H
+
+#include "qchartglobal.h"
+#include "qchart.h" //because of QChart::ChartThemeId
+#include <QRectF>
+#include <QMargins>
+#include <QLocale>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartItem;
+class AxisItem;
+class QAbstractSeries;
+class ChartDataSet;
+class AbstractDomain;
+class ChartAxisElement;
+class ChartAnimator;
+class ChartBackground;
+class ChartTitle;
+class ChartAnimation;
+class AbstractChartLayout;
+
+class ChartPresenter: public QObject
+{
+ Q_OBJECT
+public:
+ enum ZValues {
+ BackgroundZValue = -1,
+ PlotAreaZValue,
+ ShadesZValue,
+ GridZValue,
+ AxisZValue,
+ SeriesZValue,
+ LineChartZValue = SeriesZValue,
+ SplineChartZValue = SeriesZValue,
+ BarSeriesZValue = SeriesZValue,
+ ScatterSeriesZValue = SeriesZValue,
+ PieSeriesZValue = SeriesZValue,
+ BoxPlotSeriesZValue = SeriesZValue,
+ LegendZValue,
+ TopMostZValue
+ };
+
+ enum State {
+ ShowState,
+ ScrollUpState,
+ ScrollDownState,
+ ScrollLeftState,
+ ScrollRightState,
+ ZoomInState,
+ ZoomOutState
+ };
+
+ ChartPresenter(QChart *chart, QChart::ChartType type);
+ virtual ~ChartPresenter();
+
+
+ void setGeometry(QRectF rect);
+ QRectF geometry() const;
+
+ QGraphicsItem *rootItem(){ return m_chart; }
+ ChartBackground *backgroundElement();
+ QAbstractGraphicsShapeItem *plotAreaElement();
+ ChartTitle *titleElement();
+ QList<ChartAxisElement *> axisItems() const;
+ QList<ChartItem *> chartItems() const;
+
+ QLegend *legend();
+
+ void setBackgroundBrush(const QBrush &brush);
+ QBrush backgroundBrush() const;
+
+ void setBackgroundPen(const QPen &pen);
+ QPen backgroundPen() const;
+
+ void setBackgroundRoundness(qreal diameter);
+ qreal backgroundRoundness() const;
+
+ void setPlotAreaBackgroundBrush(const QBrush &brush);
+ QBrush plotAreaBackgroundBrush() const;
+
+ void setPlotAreaBackgroundPen(const QPen &pen);
+ QPen plotAreaBackgroundPen() const;
+
+ void setTitle(const QString &title);
+ QString title() const;
+
+ void setTitleFont(const QFont &font);
+ QFont titleFont() const;
+
+ void setTitleBrush(const QBrush &brush);
+ QBrush titleBrush() const;
+
+ void setBackgroundVisible(bool visible);
+ bool isBackgroundVisible() const;
+
+ void setPlotAreaBackgroundVisible(bool visible);
+ bool isPlotAreaBackgroundVisible() const;
+
+ void setBackgroundDropShadowEnabled(bool enabled);
+ bool isBackgroundDropShadowEnabled() const;
+
+ void setLocalizeNumbers(bool localize);
+ inline bool localizeNumbers() const { return m_localizeNumbers; }
+ void setLocale(const QLocale &locale);
+ inline const QLocale &locale() const { return m_locale; }
+
+ void setVisible(bool visible);
+
+ void setAnimationOptions(QChart::AnimationOptions options);
+ QChart::AnimationOptions animationOptions() const;
+
+ void startAnimation(ChartAnimation *animation);
+
+ void setState(State state,QPointF point);
+ State state() const { return m_state; }
+ QPointF statePoint() const { return m_statePoint; }
+ AbstractChartLayout *layout();
+
+ QChart::ChartType chartType() const { return m_chart->chartType(); }
+ QChart *chart() { return m_chart; }
+
+ static QRectF textBoundingRect(const QFont &font, const QString &text, qreal angle = 0.0);
+ static QString truncatedText(const QFont &font, const QString &text, qreal angle,
+ qreal maxWidth, qreal maxHeight, QRectF &boundingRect);
+ inline static qreal textMargin() { return qreal(0.5); }
+
+ QString numberToString(double value, char f = 'g', int prec = 6);
+ QString numberToString(int value);
+
+private:
+ void createBackgroundItem();
+ void createPlotAreaBackgroundItem();
+ void createTitleItem();
+
+public Q_SLOTS:
+ void handleSeriesAdded(QAbstractSeries *series);
+ void handleSeriesRemoved(QAbstractSeries *series);
+ void handleAxisAdded(QAbstractAxis *axis);
+ void handleAxisRemoved(QAbstractAxis *axis);
+
+private:
+ QChart *m_chart;
+ QList<ChartItem *> m_chartItems;
+ QList<ChartAxisElement *> m_axisItems;
+ QList<QAbstractSeries *> m_series;
+ QList<QAbstractAxis *> m_axes;
+ QChart::AnimationOptions m_options;
+ State m_state;
+ QPointF m_statePoint;
+ AbstractChartLayout *m_layout;
+ ChartBackground *m_background;
+ QAbstractGraphicsShapeItem *m_plotAreaBackground;
+ ChartTitle *m_title;
+ QRectF m_rect;
+ bool m_localizeNumbers;
+ QLocale m_locale;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTPRESENTER_H */
diff --git a/src/charts/charts.pro b/src/charts/charts.pro
new file mode 100644
index 00000000..8e18fb7c
--- /dev/null
+++ b/src/charts/charts.pro
@@ -0,0 +1,82 @@
+############################# BUILD CONFIG ######################################
+
+TARGET = QtCharts
+
+message($$QT_CONFIG)
+QT = core gui widgets
+DEFINES += QT_CHARTS_LIBRARY
+# Fix exports in static builds for applications linking charts module
+static: MODULE_DEFINES += QT_CHARTS_STATICLIB
+
+MODULE_INCNAME = QtCharts
+
+QMAKE_DOCS = $$PWD/doc/qtcharts.qdocconf
+
+load(qt_module)
+CONFIG -= create_cmake
+
+############################# SOURCES ##########################################
+
+SOURCES += \
+ $$PWD/chartdataset.cpp \
+ $$PWD/chartpresenter.cpp \
+ $$PWD/chartthememanager.cpp \
+ $$PWD/qchart.cpp \
+ $$PWD/qchartview.cpp \
+ $$PWD/qabstractseries.cpp \
+ $$PWD/chartbackground.cpp \
+ $$PWD/chartelement.cpp \
+ $$PWD/chartitem.cpp \
+ $$PWD/scroller.cpp \
+ $$PWD/charttitle.cpp \
+ $$PWD/qpolarchart.cpp
+PRIVATE_HEADERS += \
+ $$PWD/chartdataset_p.h \
+ $$PWD/chartitem_p.h \
+ $$PWD/chartpresenter_p.h \
+ $$PWD/chartthememanager_p.h \
+ $$PWD/chartbackground_p.h \
+ $$PWD/chartelement_p.h \
+ $$PWD/chartconfig_p.h \
+ $$PWD/qchart_p.h \
+ $$PWD/qchartview_p.h \
+ $$PWD/scroller_p.h \
+ $$PWD/qabstractseries_p.h \
+ $$PWD/charttitle_p.h \
+ $$PWD/charthelpers_p.h
+PUBLIC_HEADERS += \
+ $$PWD/qchart.h \
+ $$PWD/qchartglobal.h \
+ $$PWD/qabstractseries.h \
+ $$PWD/qchartview.h \
+ $$PWD/chartsnamespace.h \
+ $$PWD/qpolarchart.h
+
+include($$PWD/common.pri)
+include($$PWD/animations/animations.pri)
+include($$PWD/areachart/areachart.pri)
+include($$PWD/axis/axis.pri)
+include($$PWD/domain/domain.pri)
+include($$PWD/barchart/barchart.pri)
+include($$PWD/legend/legend.pri)
+include($$PWD/linechart/linechart.pri)
+include($$PWD/piechart/piechart.pri)
+include($$PWD/scatterchart/scatter.pri)
+include($$PWD/splinechart/splinechart.pri)
+include($$PWD/themes/themes.pri)
+include($$PWD/xychart/xychart.pri)
+include($$PWD/layout/layout.pri)
+include($$PWD/boxplotchart/boxplotchart.pri)
+
+HEADERS += $$PUBLIC_HEADERS
+HEADERS += $$PRIVATE_HEADERS
+HEADERS += $$THEMES
+
+OTHER_FILES += doc/qtcharts.qdocconf \
+ doc/src/* \
+ doc/images/*
+
+#Define for unit tests
+CONFIG(debug, debug|release) {
+ DEFINES += BUILD_PRIVATE_UNIT_TESTS
+}
diff --git a/src/charts/chartsnamespace.h b/src/charts/chartsnamespace.h
new file mode 100644
index 00000000..f4c76944
--- /dev/null
+++ b/src/charts/chartsnamespace.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHARTSNAMESPACE_H
+#define CHARTSNAMESPACE_H
+
+// this is needed by the designer plugin.
+
+QT_CHARTS_USE_NAMESPACE
+
+#endif /* CHARTSNAMESPACE_H */
diff --git a/src/charts/chartthememanager.cpp b/src/charts/chartthememanager.cpp
new file mode 100644
index 00000000..211552da
--- /dev/null
+++ b/src/charts/chartthememanager.cpp
@@ -0,0 +1,249 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qabstractseries_p.h"
+#include "qabstractaxis_p.h"
+#include <QTime>
+//themes
+#include "chartthemesystem_p.h"
+#include "chartthemelight_p.h"
+#include "chartthemebluecerulean_p.h"
+#include "chartthemedark_p.h"
+#include "chartthemebrownsand_p.h"
+#include "chartthemebluencs_p.h"
+#include "chartthemehighcontrast_p.h"
+#include "chartthemeblueicy_p.h"
+#include "chartthemeqt_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartThemeManager::ChartThemeManager(QChart* chart) :
+ m_chart(chart)
+{
+ qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
+}
+
+
+void ChartThemeManager::setTheme(QChart::ChartTheme theme)
+{
+ if (m_theme.isNull() || theme != m_theme->id()) {
+ switch (theme) {
+ case QChart::ChartThemeLight:
+ m_theme.reset(new ChartThemeLight());
+ break;
+ case QChart::ChartThemeBlueCerulean:
+ m_theme.reset(new ChartThemeBlueCerulean());
+ break;
+ case QChart::ChartThemeDark:
+ m_theme.reset(new ChartThemeDark());
+ break;
+ case QChart::ChartThemeBrownSand:
+ m_theme.reset(new ChartThemeBrownSand());
+ break;
+ case QChart::ChartThemeBlueNcs:
+ m_theme.reset(new ChartThemeBlueNcs());
+ break;
+ case QChart::ChartThemeHighContrast:
+ m_theme.reset(new ChartThemeHighContrast());
+ break;
+ case QChart::ChartThemeBlueIcy:
+ m_theme.reset(new ChartThemeBlueIcy());
+ break;
+ case QChart::ChartThemeQt:
+ m_theme.reset(new ChartThemeQt());
+ break;
+ default:
+ m_theme.reset(new ChartThemeSystem());
+ break;
+ }
+
+ if (!m_theme.isNull()) {
+ decorateChart(m_chart,m_theme.data());
+ decorateLegend(m_chart->legend(),m_theme.data());
+ foreach (QAbstractAxis* axis, m_axisList)
+ axis->d_ptr->initializeTheme(m_theme.data(), true);
+ foreach (QAbstractSeries* series, m_seriesMap.keys())
+ series->d_ptr->initializeTheme(m_seriesMap[series], m_theme.data(), true);
+ }
+ }
+}
+
+// decorateChart is only called when theme is forcibly initialized
+void ChartThemeManager::decorateChart(QChart *chart, ChartTheme *theme) const
+{
+ chart->setBackgroundBrush(theme->chartBackgroundGradient());
+
+ QPen pen(Qt::transparent);
+ QBrush brush;
+ chart->setPlotAreaBackgroundBrush(brush);
+ chart->setPlotAreaBackgroundPen(pen);
+ chart->setPlotAreaBackgroundVisible(false);
+
+ chart->setTitleFont(theme->masterFont());
+ chart->setTitleBrush(theme->labelBrush());
+ chart->setDropShadowEnabled(theme->isBackgroundDropShadowEnabled());
+}
+
+// decorateLegend is only called when theme is forcibly initialized
+void ChartThemeManager::decorateLegend(QLegend *legend, ChartTheme *theme) const
+{
+ legend->setPen(theme->axisLinePen());
+ legend->setBrush(theme->chartBackgroundGradient());
+ legend->setFont(theme->labelFont());
+ legend->setLabelBrush(theme->labelBrush());
+}
+
+int ChartThemeManager::createIndexKey(QList<int> keys) const
+{
+ std::sort(keys.begin(), keys.end());
+
+ int key = 0;
+ QList<int>::iterator i;
+ i = keys.begin();
+
+ while (i != keys.end()) {
+ if (*i != key)
+ break;
+ key++;
+ i++;
+ }
+
+ return key;
+}
+
+int ChartThemeManager::seriesCount(QAbstractSeries::SeriesType type) const
+{
+ int count = 0;
+ QList<QAbstractSeries *> series = m_seriesMap.keys();
+ foreach(QAbstractSeries *s, series) {
+ if (s->type() == type)
+ count++;
+ }
+ return count;
+}
+
+void ChartThemeManager::handleSeriesAdded(QAbstractSeries *series)
+{
+ int key = createIndexKey(m_seriesMap.values());
+ m_seriesMap.insert(series,key);
+ series->d_ptr->initializeTheme(key,m_theme.data(),false);
+}
+
+void ChartThemeManager::handleSeriesRemoved(QAbstractSeries *series)
+{
+ m_seriesMap.remove(series);
+}
+
+void ChartThemeManager::handleAxisAdded(QAbstractAxis *axis)
+{
+ m_axisList.append(axis);
+ axis->d_ptr->initializeTheme(m_theme.data(),false);
+}
+
+void ChartThemeManager::handleAxisRemoved(QAbstractAxis *axis)
+{
+ m_axisList.removeAll(axis);
+}
+
+void ChartThemeManager::updateSeries(QAbstractSeries *series)
+{
+ if(m_seriesMap.contains(series)){
+ series->d_ptr->initializeTheme(m_seriesMap[series],m_theme.data(),false);
+ }
+}
+QList<QGradient> ChartThemeManager::generateSeriesGradients(const QList<QColor>& colors)
+{
+ QList<QGradient> result;
+ // Generate gradients in HSV color space
+ foreach (const QColor &color, colors) {
+ QLinearGradient g;
+ qreal h = color.hsvHueF();
+ qreal s = color.hsvSaturationF();
+
+ QColor start = color;
+ start.setHsvF(h, 0.0, 1.0);
+ g.setColorAt(0.0, start);
+
+ g.setColorAt(0.5, color);
+
+ QColor end = color;
+ end.setHsvF(h, s, 0.25);
+ g.setColorAt(1.0, end);
+
+ result << g;
+ }
+
+ return result;
+}
+
+
+QColor ChartThemeManager::colorAt(const QColor &start, const QColor &end, qreal pos)
+{
+ Q_ASSERT(pos >= 0.0 && pos <= 1.0);
+ qreal r = start.redF() + ((end.redF() - start.redF()) * pos);
+ qreal g = start.greenF() + ((end.greenF() - start.greenF()) * pos);
+ qreal b = start.blueF() + ((end.blueF() - start.blueF()) * pos);
+ QColor c;
+ c.setRgbF(r, g, b);
+ return c;
+}
+
+QColor ChartThemeManager::colorAt(const QGradient &gradient, qreal pos)
+{
+ Q_ASSERT(pos >= 0 && pos <= 1.0);
+
+ QGradientStops stops = gradient.stops();
+ int count = stops.count();
+
+ // find previous stop relative to position
+ QGradientStop prev = stops.first();
+ for (int i = 0; i < count; i++) {
+ QGradientStop stop = stops.at(i);
+ if (pos > stop.first)
+ prev = stop;
+
+ // given position is actually a stop position?
+ if (pos == stop.first) {
+ //qDebug() << "stop color" << pos;
+ return stop.second;
+ }
+ }
+
+ // find next stop relative to position
+ QGradientStop next = stops.last();
+ for (int i = count - 1; i >= 0; i--) {
+ QGradientStop stop = stops.at(i);
+ if (pos < stop.first)
+ next = stop;
+ }
+
+ //qDebug() << "prev" << prev.first << "pos" << pos << "next" << next.first;
+
+ qreal range = next.first - prev.first;
+ qreal posDelta = pos - prev.first;
+ qreal relativePos = posDelta / range;
+
+ //qDebug() << "range" << range << "posDelta" << posDelta << "relativePos" << relativePos;
+
+ return colorAt(prev.second, next.second, relativePos);
+}
+
+#include "moc_chartthememanager_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/chartthememanager_p.h b/src/charts/chartthememanager_p.h
new file mode 100644
index 00000000..3eabd8e5
--- /dev/null
+++ b/src/charts/chartthememanager_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMEMANAGER_H
+#define CHARTTHEMEMANAGER_H
+
+#include "qchartglobal.h"
+#include "qchart.h"
+#include <QColor>
+#include <QGradientStops>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class ChartTheme;
+
+class ChartThemeManager: public QObject
+{
+ Q_OBJECT
+public:
+ enum BackgroundShadesMode {
+ BackgroundShadesNone = 0,
+ BackgroundShadesVertical,
+ BackgroundShadesHorizontal,
+ BackgroundShadesBoth
+ };
+
+public:
+ explicit ChartThemeManager(QChart* chart);
+ void setTheme(QChart::ChartTheme theme);
+ ChartTheme* theme() const { return m_theme.data(); }
+ void decorateChart(QChart *chart, ChartTheme* theme) const;
+ void decorateLegend(QLegend *legend, ChartTheme* theme) const;
+ void updateSeries(QAbstractSeries *series);
+
+public:
+ static QList<QGradient> generateSeriesGradients(const QList<QColor>& colors);
+ static QColor colorAt(const QColor &start, const QColor &end, qreal pos);
+ static QColor colorAt(const QGradient &gradient, qreal pos);
+
+private:
+ int createIndexKey(QList<int> keys) const;
+ int seriesCount(QAbstractSeries::SeriesType type) const;
+
+public Q_SLOTS:
+ void handleSeriesAdded(QAbstractSeries *series);
+ void handleSeriesRemoved(QAbstractSeries *series);
+ void handleAxisAdded(QAbstractAxis *axis);
+ void handleAxisRemoved(QAbstractAxis *axis);
+
+protected:
+ QScopedPointer<ChartTheme> m_theme;
+ QMap<QAbstractSeries *,int> m_seriesMap;
+ QList<QAbstractAxis *> m_axisList;
+ QChart* m_chart;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // CHARTTHEME_H
diff --git a/src/charts/charttitle.cpp b/src/charts/charttitle.cpp
new file mode 100644
index 00000000..c7e18b7e
--- /dev/null
+++ b/src/charts/charttitle.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "charttitle_p.h"
+#include "chartpresenter_p.h"
+#include <QFont>
+#include <QFontMetrics>
+#include <QDebug>
+#include <QTextDocument>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ChartTitle::ChartTitle(QGraphicsItem *parent)
+ : QGraphicsTextItem(parent)
+{
+ document()->setDocumentMargin(ChartPresenter::textMargin());
+}
+
+ChartTitle::~ChartTitle()
+{
+
+}
+
+void ChartTitle::setText(const QString &text)
+{
+ m_text = text;
+}
+
+QString ChartTitle::text() const
+{
+ return m_text;
+}
+
+void ChartTitle::setGeometry(const QRectF &rect)
+{
+ QRectF truncatedRect;
+ QGraphicsTextItem::setHtml(ChartPresenter::truncatedText(font(), m_text, qreal(0.0),
+ rect.width(), rect.height(),
+ truncatedRect));
+ QGraphicsTextItem::setTextWidth(truncatedRect.width());
+ setPos(rect.topLeft());
+}
+
+
+QSizeF ChartTitle::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint);
+ QSizeF sh;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF titleRect = ChartPresenter::textBoundingRect(font(), QStringLiteral("..."));
+ sh = QSizeF(titleRect.width(), titleRect.height());
+ break;
+ }
+ case Qt::PreferredSize:
+ case Qt::MaximumSize: {
+ QRectF titleRect = ChartPresenter::textBoundingRect(font(), m_text);
+ sh = QSizeF(titleRect.width(), titleRect.height());
+ break;
+ }
+ case Qt::MinimumDescent: {
+ QFontMetrics fn(font());
+ sh = QSizeF(0, fn.descent());
+ break;
+ }
+ default:
+ break;
+ }
+
+ return sh;
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/charttitle_p.h b/src/charts/charttitle_p.h
new file mode 100644
index 00000000..dbdb4fbb
--- /dev/null
+++ b/src/charts/charttitle_p.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTITLE_P_H_
+#define CHARTTITLE_P_H_
+
+#include "qchartglobal.h"
+#include <QGraphicsTextItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartTitle : public QGraphicsTextItem
+{
+public:
+ ChartTitle(QGraphicsItem *parent = 0);
+ ~ChartTitle();
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+ void setText(const QString &text);
+ QString text() const;
+ void setGeometry(const QRectF &rect);
+private:
+ QString m_text;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* CHARTTITLE_P_H_ */
diff --git a/src/charts/common.pri b/src/charts/common.pri
new file mode 100644
index 00000000..1d5b6494
--- /dev/null
+++ b/src/charts/common.pri
@@ -0,0 +1,15 @@
+INCLUDEPATH += $$PWD/ \
+ $$PWD/animations \
+ $$PWD/areachart \
+ $$PWD/axis \
+ $$PWD/barchart \
+ $$PWD/boxplotchart \
+ $$PWD/domain \
+ $$PWD/layout \
+ $$PWD/legend \
+ $$PWD/linechart \
+ $$PWD/piechart \
+ $$PWD/scatterchart \
+ $$PWD/splinechart \
+ $$PWD/themes \
+ $$PWD/xychart
diff --git a/doc/images/api_category_axis.png b/src/charts/doc/images/api_category_axis.png
index 97fe6cd3..97fe6cd3 100644
--- a/doc/images/api_category_axis.png
+++ b/src/charts/doc/images/api_category_axis.png
Binary files differ
diff --git a/doc/images/api_datatime_axis.png b/src/charts/doc/images/api_datatime_axis.png
index 1c8c8311..1c8c8311 100644
--- a/doc/images/api_datatime_axis.png
+++ b/src/charts/doc/images/api_datatime_axis.png
Binary files differ
diff --git a/doc/images/arrow_down.png b/src/charts/doc/images/arrow_down.png
index 9d01e97f..9d01e97f 100644
--- a/doc/images/arrow_down.png
+++ b/src/charts/doc/images/arrow_down.png
Binary files differ
diff --git a/doc/images/bg.png b/src/charts/doc/images/bg.png
index 91c180a2..91c180a2 100644
--- a/doc/images/bg.png
+++ b/src/charts/doc/images/bg.png
Binary files differ
diff --git a/doc/images/breadcrumb.png b/src/charts/doc/images/breadcrumb.png
index 0ded5514..0ded5514 100644
--- a/doc/images/breadcrumb.png
+++ b/src/charts/doc/images/breadcrumb.png
Binary files differ
diff --git a/doc/images/bullet_dn.png b/src/charts/doc/images/bullet_dn.png
index f7762472..f7762472 100644
--- a/doc/images/bullet_dn.png
+++ b/src/charts/doc/images/bullet_dn.png
Binary files differ
diff --git a/doc/images/bullet_gt.png b/src/charts/doc/images/bullet_gt.png
index 7561b4ed..7561b4ed 100644
--- a/doc/images/bullet_gt.png
+++ b/src/charts/doc/images/bullet_gt.png
Binary files differ
diff --git a/doc/images/bullet_sq.png b/src/charts/doc/images/bullet_sq.png
index a84845e3..a84845e3 100644
--- a/doc/images/bullet_sq.png
+++ b/src/charts/doc/images/bullet_sq.png
Binary files differ
diff --git a/doc/images/bullet_up.png b/src/charts/doc/images/bullet_up.png
index 7de2f069..7de2f069 100644
--- a/doc/images/bullet_up.png
+++ b/src/charts/doc/images/bullet_up.png
Binary files differ
diff --git a/doc/images/digia_logo.png b/src/charts/doc/images/digia_logo.png
index 6ca67c84..6ca67c84 100644
--- a/doc/images/digia_logo.png
+++ b/src/charts/doc/images/digia_logo.png
Binary files differ
diff --git a/doc/images/examples_areachart.png b/src/charts/doc/images/examples_areachart.png
index d48f7147..d48f7147 100644
--- a/doc/images/examples_areachart.png
+++ b/src/charts/doc/images/examples_areachart.png
Binary files differ
diff --git a/doc/images/demos_audio.png b/src/charts/doc/images/examples_audio.png
index 8859ee2e..8859ee2e 100644
--- a/doc/images/demos_audio.png
+++ b/src/charts/doc/images/examples_audio.png
Binary files differ
diff --git a/doc/images/examples_barchart.png b/src/charts/doc/images/examples_barchart.png
index bdd51199..bdd51199 100644
--- a/doc/images/examples_barchart.png
+++ b/src/charts/doc/images/examples_barchart.png
Binary files differ
diff --git a/doc/images/examples_barmodelmapper.png b/src/charts/doc/images/examples_barmodelmapper.png
index 6d41e5f5..6d41e5f5 100644
--- a/doc/images/examples_barmodelmapper.png
+++ b/src/charts/doc/images/examples_barmodelmapper.png
Binary files differ
diff --git a/doc/images/examples_boxplotchart.png b/src/charts/doc/images/examples_boxplotchart.png
index 6547a34b..6547a34b 100644
--- a/doc/images/examples_boxplotchart.png
+++ b/src/charts/doc/images/examples_boxplotchart.png
Binary files differ
diff --git a/doc/images/demos_callout.png b/src/charts/doc/images/examples_callout.png
index cc597110..cc597110 100644
--- a/doc/images/demos_callout.png
+++ b/src/charts/doc/images/examples_callout.png
Binary files differ
diff --git a/doc/images/demo_chartthemes_blue_cerulean.png b/src/charts/doc/images/examples_chartthemes_blue_cerulean.png
index 69ac3793..69ac3793 100644
--- a/doc/images/demo_chartthemes_blue_cerulean.png
+++ b/src/charts/doc/images/examples_chartthemes_blue_cerulean.png
Binary files differ
diff --git a/doc/images/demo_chartthemes_brown_sand.png b/src/charts/doc/images/examples_chartthemes_brown_sand.png
index ff5157a9..ff5157a9 100644
--- a/doc/images/demo_chartthemes_brown_sand.png
+++ b/src/charts/doc/images/examples_chartthemes_brown_sand.png
Binary files differ
diff --git a/doc/images/demo_chartthemes_light.png b/src/charts/doc/images/examples_chartthemes_light.png
index e6a64992..e6a64992 100644
--- a/doc/images/demo_chartthemes_light.png
+++ b/src/charts/doc/images/examples_chartthemes_light.png
Binary files differ
diff --git a/doc/images/examples_customchart.png b/src/charts/doc/images/examples_customchart.png
index c416ef54..c416ef54 100644
--- a/doc/images/examples_customchart.png
+++ b/src/charts/doc/images/examples_customchart.png
Binary files differ
diff --git a/doc/images/examples_datetimeaxis.png b/src/charts/doc/images/examples_datetimeaxis.png
index cedda80a..cedda80a 100644
--- a/doc/images/examples_datetimeaxis.png
+++ b/src/charts/doc/images/examples_datetimeaxis.png
Binary files differ
diff --git a/doc/images/examples_donutbreakdown.png b/src/charts/doc/images/examples_donutbreakdown.png
index a0569239..a0569239 100644
--- a/doc/images/examples_donutbreakdown.png
+++ b/src/charts/doc/images/examples_donutbreakdown.png
Binary files differ
diff --git a/doc/images/examples_donutchart.png b/src/charts/doc/images/examples_donutchart.png
index 5eaf3fa3..5eaf3fa3 100644
--- a/doc/images/examples_donutchart.png
+++ b/src/charts/doc/images/examples_donutchart.png
Binary files differ
diff --git a/doc/images/demos_dynamicspline1.png b/src/charts/doc/images/examples_dynamicspline1.png
index bcee80ed..bcee80ed 100644
--- a/doc/images/demos_dynamicspline1.png
+++ b/src/charts/doc/images/examples_dynamicspline1.png
Binary files differ
diff --git a/doc/images/demos_dynamicspline2.png b/src/charts/doc/images/examples_dynamicspline2.png
index 595c38b1..595c38b1 100644
--- a/doc/images/demos_dynamicspline2.png
+++ b/src/charts/doc/images/examples_dynamicspline2.png
Binary files differ
diff --git a/doc/images/examples_horizontalbarchart.png b/src/charts/doc/images/examples_horizontalbarchart.png
index dfa50d60..dfa50d60 100644
--- a/doc/images/examples_horizontalbarchart.png
+++ b/src/charts/doc/images/examples_horizontalbarchart.png
Binary files differ
diff --git a/doc/images/examples_horizontalpercentbarchart.png b/src/charts/doc/images/examples_horizontalpercentbarchart.png
index 726a715b..726a715b 100644
--- a/doc/images/examples_horizontalpercentbarchart.png
+++ b/src/charts/doc/images/examples_horizontalpercentbarchart.png
Binary files differ
diff --git a/doc/images/examples_horizontalstackedbarchart.png b/src/charts/doc/images/examples_horizontalstackedbarchart.png
index 32806bb6..32806bb6 100644
--- a/doc/images/examples_horizontalstackedbarchart.png
+++ b/src/charts/doc/images/examples_horizontalstackedbarchart.png
Binary files differ
diff --git a/doc/images/examples_legend_detach.png b/src/charts/doc/images/examples_legend_detach.png
index 3376a4a0..3376a4a0 100644
--- a/doc/images/examples_legend_detach.png
+++ b/src/charts/doc/images/examples_legend_detach.png
Binary files differ
diff --git a/doc/images/examples_legend_detach2.png b/src/charts/doc/images/examples_legend_detach2.png
index 5cc33819..5cc33819 100644
--- a/doc/images/examples_legend_detach2.png
+++ b/src/charts/doc/images/examples_legend_detach2.png
Binary files differ
diff --git a/doc/images/examples_legendmarkers.png b/src/charts/doc/images/examples_legendmarkers.png
index ac0ffef1..ac0ffef1 100644
--- a/doc/images/examples_legendmarkers.png
+++ b/src/charts/doc/images/examples_legendmarkers.png
Binary files differ
diff --git a/doc/images/examples_lineandbar.png b/src/charts/doc/images/examples_lineandbar.png
index 0d7a66d7..0d7a66d7 100644
--- a/doc/images/examples_lineandbar.png
+++ b/src/charts/doc/images/examples_lineandbar.png
Binary files differ
diff --git a/doc/images/examples_linechart.png b/src/charts/doc/images/examples_linechart.png
index 57177907..57177907 100644
--- a/doc/images/examples_linechart.png
+++ b/src/charts/doc/images/examples_linechart.png
Binary files differ
diff --git a/doc/images/examples_logvalueaxis.png b/src/charts/doc/images/examples_logvalueaxis.png
index 36ae562d..36ae562d 100644
--- a/doc/images/examples_logvalueaxis.png
+++ b/src/charts/doc/images/examples_logvalueaxis.png
Binary files differ
diff --git a/doc/images/examples_modeldata.png b/src/charts/doc/images/examples_modeldata.png
index aa301fb9..aa301fb9 100644
--- a/doc/images/examples_modeldata.png
+++ b/src/charts/doc/images/examples_modeldata.png
Binary files differ
diff --git a/doc/images/examples_multiaxis.png b/src/charts/doc/images/examples_multiaxis.png
index 4e6c23f2..4e6c23f2 100644
--- a/doc/images/examples_multiaxis.png
+++ b/src/charts/doc/images/examples_multiaxis.png
Binary files differ
diff --git a/doc/images/demos_nesteddonuts.png b/src/charts/doc/images/examples_nesteddonuts.png
index bc8825c8..bc8825c8 100644
--- a/doc/images/demos_nesteddonuts.png
+++ b/src/charts/doc/images/examples_nesteddonuts.png
Binary files differ
diff --git a/doc/images/examples_percentbarchart.png b/src/charts/doc/images/examples_percentbarchart.png
index 74d7389b..74d7389b 100644
--- a/doc/images/examples_percentbarchart.png
+++ b/src/charts/doc/images/examples_percentbarchart.png
Binary files differ
diff --git a/doc/images/examples_percentbarchart_legend.png b/src/charts/doc/images/examples_percentbarchart_legend.png
index ed1ed4f6..ed1ed4f6 100644
--- a/doc/images/examples_percentbarchart_legend.png
+++ b/src/charts/doc/images/examples_percentbarchart_legend.png
Binary files differ
diff --git a/doc/images/examples_piechart.png b/src/charts/doc/images/examples_piechart.png
index 4977fa33..4977fa33 100644
--- a/doc/images/examples_piechart.png
+++ b/src/charts/doc/images/examples_piechart.png
Binary files differ
diff --git a/doc/images/examples_piechartdrill1.png b/src/charts/doc/images/examples_piechartdrill1.png
index cdc56a9d..cdc56a9d 100644
--- a/doc/images/examples_piechartdrill1.png
+++ b/src/charts/doc/images/examples_piechartdrill1.png
Binary files differ
diff --git a/doc/images/examples_piechartdrill2.png b/src/charts/doc/images/examples_piechartdrill2.png
index 384acda8..384acda8 100644
--- a/doc/images/examples_piechartdrill2.png
+++ b/src/charts/doc/images/examples_piechartdrill2.png
Binary files differ
diff --git a/doc/images/examples_polarchart.png b/src/charts/doc/images/examples_polarchart.png
index 55f922c9..55f922c9 100644
--- a/doc/images/examples_polarchart.png
+++ b/src/charts/doc/images/examples_polarchart.png
Binary files differ
diff --git a/doc/images/demos_qmlaxes1.png b/src/charts/doc/images/examples_qmlaxes1.png
index 3494766a..3494766a 100644
--- a/doc/images/demos_qmlaxes1.png
+++ b/src/charts/doc/images/examples_qmlaxes1.png
Binary files differ
diff --git a/doc/images/demos_qmlaxes2.png b/src/charts/doc/images/examples_qmlaxes2.png
index d6c9164d..d6c9164d 100644
--- a/doc/images/demos_qmlaxes2.png
+++ b/src/charts/doc/images/examples_qmlaxes2.png
Binary files differ
diff --git a/doc/images/demos_qmlaxes3.png b/src/charts/doc/images/examples_qmlaxes3.png
index eeef7bfa..eeef7bfa 100644
--- a/doc/images/demos_qmlaxes3.png
+++ b/src/charts/doc/images/examples_qmlaxes3.png
Binary files differ
diff --git a/doc/images/examples_qmlboxplot.png b/src/charts/doc/images/examples_qmlboxplot.png
index f9ddc489..f9ddc489 100644
--- a/doc/images/examples_qmlboxplot.png
+++ b/src/charts/doc/images/examples_qmlboxplot.png
Binary files differ
diff --git a/doc/images/demos_qmlchart1.png b/src/charts/doc/images/examples_qmlchart1.png
index 6a3c7812..6a3c7812 100644
--- a/doc/images/demos_qmlchart1.png
+++ b/src/charts/doc/images/examples_qmlchart1.png
Binary files differ
diff --git a/doc/images/demos_qmlchart10.png b/src/charts/doc/images/examples_qmlchart10.png
index 5fdd744c..5fdd744c 100644
--- a/doc/images/demos_qmlchart10.png
+++ b/src/charts/doc/images/examples_qmlchart10.png
Binary files differ
diff --git a/doc/images/demos_qmlchart11.png b/src/charts/doc/images/examples_qmlchart11.png
index 663967e7..663967e7 100644
--- a/doc/images/demos_qmlchart11.png
+++ b/src/charts/doc/images/examples_qmlchart11.png
Binary files differ
diff --git a/doc/images/demos_qmlchart12.png b/src/charts/doc/images/examples_qmlchart12.png
index e00465ad..e00465ad 100644
--- a/doc/images/demos_qmlchart12.png
+++ b/src/charts/doc/images/examples_qmlchart12.png
Binary files differ
diff --git a/doc/images/demos_qmlchart2.png b/src/charts/doc/images/examples_qmlchart2.png
index 36a7873b..36a7873b 100644
--- a/doc/images/demos_qmlchart2.png
+++ b/src/charts/doc/images/examples_qmlchart2.png
Binary files differ
diff --git a/doc/images/demos_qmlchart3.png b/src/charts/doc/images/examples_qmlchart3.png
index 74e3299c..74e3299c 100644
--- a/doc/images/demos_qmlchart3.png
+++ b/src/charts/doc/images/examples_qmlchart3.png
Binary files differ
diff --git a/doc/images/demos_qmlchart4.png b/src/charts/doc/images/examples_qmlchart4.png
index 7b0d96a3..7b0d96a3 100644
--- a/doc/images/demos_qmlchart4.png
+++ b/src/charts/doc/images/examples_qmlchart4.png
Binary files differ
diff --git a/doc/images/demos_qmlchart5.png b/src/charts/doc/images/examples_qmlchart5.png
index 129a4e90..129a4e90 100644
--- a/doc/images/demos_qmlchart5.png
+++ b/src/charts/doc/images/examples_qmlchart5.png
Binary files differ
diff --git a/doc/images/demos_qmlchart6.png b/src/charts/doc/images/examples_qmlchart6.png
index 6968ffe3..6968ffe3 100644
--- a/doc/images/demos_qmlchart6.png
+++ b/src/charts/doc/images/examples_qmlchart6.png
Binary files differ
diff --git a/doc/images/demos_qmlchart7.png b/src/charts/doc/images/examples_qmlchart7.png
index acf29aed..acf29aed 100644
--- a/doc/images/demos_qmlchart7.png
+++ b/src/charts/doc/images/examples_qmlchart7.png
Binary files differ
diff --git a/doc/images/demos_qmlchart8.png b/src/charts/doc/images/examples_qmlchart8.png
index d1671758..d1671758 100644
--- a/doc/images/demos_qmlchart8.png
+++ b/src/charts/doc/images/examples_qmlchart8.png
Binary files differ
diff --git a/doc/images/demos_qmlchart9.png b/src/charts/doc/images/examples_qmlchart9.png
index 1ebbc7dc..1ebbc7dc 100644
--- a/doc/images/demos_qmlchart9.png
+++ b/src/charts/doc/images/examples_qmlchart9.png
Binary files differ
diff --git a/doc/images/demos_qmlcustomizations.png b/src/charts/doc/images/examples_qmlcustomizations.png
index d28f5c80..d28f5c80 100644
--- a/doc/images/demos_qmlcustomizations.png
+++ b/src/charts/doc/images/examples_qmlcustomizations.png
Binary files differ
diff --git a/doc/images/demos-qmlcustomlegend1.png b/src/charts/doc/images/examples_qmlcustomlegend1.png
index 7f235934..7f235934 100644
--- a/doc/images/demos-qmlcustomlegend1.png
+++ b/src/charts/doc/images/examples_qmlcustomlegend1.png
Binary files differ
diff --git a/doc/images/demos-qmlcustomlegend2.png b/src/charts/doc/images/examples_qmlcustomlegend2.png
index 184615e9..184615e9 100644
--- a/doc/images/demos-qmlcustomlegend2.png
+++ b/src/charts/doc/images/examples_qmlcustomlegend2.png
Binary files differ
diff --git a/doc/images/demos-qmlcustomlegend3.png b/src/charts/doc/images/examples_qmlcustomlegend3.png
index 6f0c81c4..6f0c81c4 100644
--- a/doc/images/demos-qmlcustomlegend3.png
+++ b/src/charts/doc/images/examples_qmlcustomlegend3.png
Binary files differ
diff --git a/doc/images/demos_qmlcustommodel.png b/src/charts/doc/images/examples_qmlcustommodel.png
index 1bf610f8..1bf610f8 100644
--- a/doc/images/demos_qmlcustommodel.png
+++ b/src/charts/doc/images/examples_qmlcustommodel.png
Binary files differ
diff --git a/doc/images/demos_qmlf1legends.png b/src/charts/doc/images/examples_qmlf1legends.png
index 789d45ab..789d45ab 100644
--- a/doc/images/demos_qmlf1legends.png
+++ b/src/charts/doc/images/examples_qmlf1legends.png
Binary files differ
diff --git a/doc/images/demos_qmloscilloscope.png b/src/charts/doc/images/examples_qmloscilloscope.png
index 32e28ffb..32e28ffb 100644
--- a/doc/images/demos_qmloscilloscope.png
+++ b/src/charts/doc/images/examples_qmloscilloscope.png
Binary files differ
diff --git a/doc/images/examples_qmlpiechart.png b/src/charts/doc/images/examples_qmlpiechart.png
index bd347551..bd347551 100644
--- a/doc/images/examples_qmlpiechart.png
+++ b/src/charts/doc/images/examples_qmlpiechart.png
Binary files differ
diff --git a/doc/images/demos_qmlpolarchart1.png b/src/charts/doc/images/examples_qmlpolarchart1.png
index 8cb3e8d1..8cb3e8d1 100644
--- a/doc/images/demos_qmlpolarchart1.png
+++ b/src/charts/doc/images/examples_qmlpolarchart1.png
Binary files differ
diff --git a/doc/images/demos_qmlpolarchart2.png b/src/charts/doc/images/examples_qmlpolarchart2.png
index 02bcd778..02bcd778 100644
--- a/doc/images/demos_qmlpolarchart2.png
+++ b/src/charts/doc/images/examples_qmlpolarchart2.png
Binary files differ
diff --git a/doc/images/demos_qmlpolarchart3.png b/src/charts/doc/images/examples_qmlpolarchart3.png
index 184f5c9e..184f5c9e 100644
--- a/doc/images/demos_qmlpolarchart3.png
+++ b/src/charts/doc/images/examples_qmlpolarchart3.png
Binary files differ
diff --git a/doc/images/demos_qmlweather.png b/src/charts/doc/images/examples_qmlweather.png
index feab0364..feab0364 100644
--- a/doc/images/demos_qmlweather.png
+++ b/src/charts/doc/images/examples_qmlweather.png
Binary files differ
diff --git a/doc/images/examples_scatterchart.png b/src/charts/doc/images/examples_scatterchart.png
index 41900f66..41900f66 100644
--- a/doc/images/examples_scatterchart.png
+++ b/src/charts/doc/images/examples_scatterchart.png
Binary files differ
diff --git a/doc/images/examples_scatterinteractions.png b/src/charts/doc/images/examples_scatterinteractions.png
index cd4c78c0..cd4c78c0 100644
--- a/doc/images/examples_scatterinteractions.png
+++ b/src/charts/doc/images/examples_scatterinteractions.png
Binary files differ
diff --git a/doc/images/examples_splinechart.png b/src/charts/doc/images/examples_splinechart.png
index 733ddb17..733ddb17 100644
--- a/doc/images/examples_splinechart.png
+++ b/src/charts/doc/images/examples_splinechart.png
Binary files differ
diff --git a/doc/images/examples_stackedbarchart.png b/src/charts/doc/images/examples_stackedbarchart.png
index 0c721305..0c721305 100644
--- a/doc/images/examples_stackedbarchart.png
+++ b/src/charts/doc/images/examples_stackedbarchart.png
Binary files differ
diff --git a/doc/images/examples_stackedbarchartdrilldown1.png b/src/charts/doc/images/examples_stackedbarchartdrilldown1.png
index 9f128b6f..9f128b6f 100644
--- a/doc/images/examples_stackedbarchartdrilldown1.png
+++ b/src/charts/doc/images/examples_stackedbarchartdrilldown1.png
Binary files differ
diff --git a/doc/images/examples_stackedbarchartdrilldown2.png b/src/charts/doc/images/examples_stackedbarchartdrilldown2.png
index 67f8afbc..67f8afbc 100644
--- a/doc/images/examples_stackedbarchartdrilldown2.png
+++ b/src/charts/doc/images/examples_stackedbarchartdrilldown2.png
Binary files differ
diff --git a/doc/images/examples_temperaturerecords.png b/src/charts/doc/images/examples_temperaturerecords.png
index ce54eede..ce54eede 100644
--- a/doc/images/examples_temperaturerecords.png
+++ b/src/charts/doc/images/examples_temperaturerecords.png
Binary files differ
diff --git a/doc/images/examples_zoomlinechart1.png b/src/charts/doc/images/examples_zoomlinechart1.png
index 9162035e..9162035e 100644
--- a/doc/images/examples_zoomlinechart1.png
+++ b/src/charts/doc/images/examples_zoomlinechart1.png
Binary files differ
diff --git a/doc/images/examples_zoomlinechart2.png b/src/charts/doc/images/examples_zoomlinechart2.png
index 2a971311..2a971311 100644
--- a/doc/images/examples_zoomlinechart2.png
+++ b/src/charts/doc/images/examples_zoomlinechart2.png
Binary files differ
diff --git a/doc/images/horBar.png b/src/charts/doc/images/horBar.png
index 100fe91c..100fe91c 100644
--- a/doc/images/horBar.png
+++ b/src/charts/doc/images/horBar.png
Binary files differ
diff --git a/doc/images/piechart_customization.png b/src/charts/doc/images/piechart_customization.png
index d52ad583..d52ad583 100644
--- a/doc/images/piechart_customization.png
+++ b/src/charts/doc/images/piechart_customization.png
Binary files differ
diff --git a/doc/images/qcharts.png b/src/charts/doc/images/qcharts.png
index 69098333..69098333 100644
--- a/doc/images/qcharts.png
+++ b/src/charts/doc/images/qcharts.png
Binary files differ
diff --git a/doc/images/qt-logo.png b/src/charts/doc/images/qt-logo.png
index 14ddf2a0..14ddf2a0 100644
--- a/doc/images/qt-logo.png
+++ b/src/charts/doc/images/qt-logo.png
Binary files differ
diff --git a/src/charts/doc/qtcharts.qdocconf b/src/charts/doc/qtcharts.qdocconf
new file mode 100644
index 00000000..5fb7181c
--- /dev/null
+++ b/src/charts/doc/qtcharts.qdocconf
@@ -0,0 +1,66 @@
+include($QT_INSTALL_DOCS/global/macros.qdocconf)
+include($QT_INSTALL_DOCS/global/qt-cpp-defines.qdocconf)
+include($QT_INSTALL_DOCS/global/compat.qdocconf)
+include($QT_INSTALL_DOCS/global/fileextensions.qdocconf)
+include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
+
+project = Qt Charts
+description = Qt Charts Reference Documentation
+version = 2.0.0
+
+sourcedirs += ..
+headerdirs += ..
+exampledirs += ../../../examples/charts \
+ snippets
+imagedirs += images
+examplesinstallpath = charts
+
+indexes += $QT_INSTALL_DOCS/qtcore/qtcore.index \
+ $QT_INSTALL_DOCS/qtgui/qtgui.index \
+ $QT_INSTALL_DOCS/qtqml/qtqml.index \
+ $QT_INSTALL_DOCS/qtquick/qtquick.index \
+ $QT_INSTALL_DOCS/qtmultimedia/qtmultimedia.index
+
+Cpp.ignoretokens = Q_INVOKABLE \
+ QT_CHARTS_EXPORT \
+ QT_CHARTS_END_NAMESPACE \
+ QT_CHARTS_BEGIN_NAMESPACE
+
+qhp.projects = QtCharts
+qhp.QtCharts.file = qtcharts.qhp
+qhp.QtCharts.namespace = com.digia.qtcharts.200
+qhp.QtCharts.virtualFolder = qtcharts
+qhp.QtCharts.indexTitle = Qt Charts Reference
+qhp.QtCharts.indexRoot =
+
+qhp.QtCharts.filterAttributes = qtcharts 2.0.0 qtrefdoc
+qhp.QtCharts.customFilters.Qt.name = QtCharts 2.0.0
+qhp.QtCharts.customFilters.Qt.filterAttributes = qtcharts 2.0.0
+
+qhp.QtCharts.subprojects = gettingstarted classes types examples
+
+qhp.QtCharts.subprojects.gettingstarted.title = Getting Started
+qhp.QtCharts.subprojects.gettingstarted.indexTitle = Qt Charts Getting Started
+qhp.QtCharts.subprojects.gettingstarted.selectors = fake:page
+qhp.QtCharts.subprojects.gettingstarted.sortPages = true
+
+qhp.QtCharts.subprojects.classes.title = C++ Classes
+qhp.QtCharts.subprojects.classes.indexTitle = Qt Charts C++ Classes
+qhp.QtCharts.subprojects.classes.selectors = class
+qhp.QtCharts.subprojects.classes.sortPages = true
+
+qhp.QtCharts.subprojects.types.title = QML Types
+qhp.QtCharts.subprojects.types.indexTitle = Qt Charts QML Types
+qhp.QtCharts.subprojects.types.selectors = fake:qmlclass
+qhp.QtCharts.subprojects.types.sortPages = true
+
+qhp.QtCharts.subprojects.examples.title = Examples
+qhp.QtCharts.subprojects.examples.indexTitle = Qt Charts Examples
+qhp.QtCharts.subprojects.examples.selectors = fake:example
+qhp.QtCharts.subprojects.examples.sortPages = true
+
+navigation.landingpage = Qt Charts
+navigation.cppclassespage = Qt Charts C++ Classes
+navigation.qmltypespage = Qt Charts QML Types
+
+buildversion = Qt Charts $QT_VERSION Reference Documentation
diff --git a/src/charts/doc/snippets/doc_src_qmlcharts.cpp b/src/charts/doc/snippets/doc_src_qmlcharts.cpp
new file mode 100644
index 00000000..3047db7a
--- /dev/null
+++ b/src/charts/doc/snippets/doc_src_qmlcharts.cpp
@@ -0,0 +1,21 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtCharts module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//! [0]
+import QtCharts 2.0
+//! [0]
diff --git a/src/charts/doc/snippets/doc_src_qtcharts.cpp b/src/charts/doc/snippets/doc_src_qtcharts.cpp
new file mode 100644
index 00000000..d841bb88
--- /dev/null
+++ b/src/charts/doc/snippets/doc_src_qtcharts.cpp
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtCharts module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+//! [0]
+#include <QtCharts>
+
+using namespace QtCharts;
+//! [0]
+
+//! [1]
+qmake CONFIG+=static
+make
+make install
+//! [1]
+
+//! [2]
+qmake
+make
+./qmlpolarchart
+//! [2]
diff --git a/src/charts/doc/snippets/doc_src_qtcharts.pro b/src/charts/doc/snippets/doc_src_qtcharts.pro
new file mode 100644
index 00000000..819b1c9c
--- /dev/null
+++ b/src/charts/doc/snippets/doc_src_qtcharts.pro
@@ -0,0 +1,21 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtCharts module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+#! [0]
+QT += charts
+#! [0]
diff --git a/src/charts/doc/src/examples-areachart.qdoc b/src/charts/doc/src/examples-areachart.qdoc
new file mode 100644
index 00000000..f399adbe
--- /dev/null
+++ b/src/charts/doc/src/examples-areachart.qdoc
@@ -0,0 +1,30 @@
+/*!
+ \example areachart
+ \title AreaChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple area chart.
+
+ \image examples_areachart.png
+
+ To create area charts, we need two QLineSeries instances. They are going to define the upper and lower boundary of the area.
+
+ \snippet areachart/main.cpp 1
+
+ We add data to both series and use the stream operator.
+
+ \snippet areachart/main.cpp 2
+
+ Now we create a QAreaSeries instance using two line series objects. We set the custom gradient fill and width of the outline.
+
+ \snippet areachart/main.cpp 3
+
+ Last we create the QChartView instance, set the title, set anti-aliasing, and add the area series. We also create the default axes and specify the ranges on them.
+
+ \snippet areachart/main.cpp 4
+
+ The chart is ready to be shown.
+
+ \snippet areachart/main.cpp 5
+
+*/
diff --git a/src/charts/doc/src/examples-audio.qdoc b/src/charts/doc/src/examples-audio.qdoc
new file mode 100644
index 00000000..2a3a98ec
--- /dev/null
+++ b/src/charts/doc/src/examples-audio.qdoc
@@ -0,0 +1,8 @@
+/*!
+ \example audio
+ \title Audio example
+ \ingroup qtcharts_examples
+
+ \brief This example shows the drawing of dynamic data (microphone input).
+ \image examples_audio.png
+*/
diff --git a/src/charts/doc/src/examples-barchart.qdoc b/src/charts/doc/src/examples-barchart.qdoc
new file mode 100644
index 00000000..d217faac
--- /dev/null
+++ b/src/charts/doc/src/examples-barchart.qdoc
@@ -0,0 +1,47 @@
+/*!
+ \example barchart
+ \title BarChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a bar chart.
+
+ BarChart shows the data in sets as separate bars, which are in categories.
+
+ \image examples_barchart.png
+
+ The barsets are used in the same way in all barcharts.
+ To illustrate the difference between various barcharts, we use the same data in the examples.
+ Data that the barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data
+ to them. The data is appended here with the << operator. Alternatively, the append method could be used.
+
+ \snippet barchart/main.cpp 1
+
+ We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
+ First values of each set are grouped together at first category second value to second category and so on.
+
+ \snippet barchart/main.cpp 2
+
+ Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
+ setAnimationOptions(QChart::SeriesAnimations)
+
+ \snippet barchart/main.cpp 3
+
+ To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with a list of categories and
+ set it to be the x-axis of the chart. The chart takes ownership of axis. For y-axis we use default axis, which is created and scaled to series data
+ by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
+ override the category axis.
+
+ \snippet barchart/main.cpp 4
+
+ We also want to show the legend. To do that, we get the legend pointer from the chart and set it to visible. We also place the legend to the bottom of the chart by setting its alignment to Qt::AlignBottom.
+
+ \snippet barchart/main.cpp 5
+
+ Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
+
+ \snippet barchart/main.cpp 6
+
+ The chart is ready to be shown. We set the chart to be central widget of the window. We also set the size for the chart window and show it.
+
+ \snippet barchart/main.cpp 7
+*/
diff --git a/src/charts/doc/src/examples-barmodelmapper.qdoc b/src/charts/doc/src/examples-barmodelmapper.qdoc
new file mode 100644
index 00000000..00d23326
--- /dev/null
+++ b/src/charts/doc/src/examples-barmodelmapper.qdoc
@@ -0,0 +1,58 @@
+/*!
+ \example barmodelmapper
+ \title BarModelMapper example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to use QAbstractItemModel derived model as the data for the bar
+ series.
+
+ \image examples_barmodelmapper.png
+
+ Let's start by creating an instance of CustomTableModel class.
+ The CustomTableModel class is derived from QAbstractTableModel, and it was created for the purpose of this example.
+ The constructor of this class populates the model's internal data store with the data required for our chart example.
+
+ \snippet barmodelmapper/tablewidget.cpp 1
+
+ We now have a model with data that we would like to display both on the chart and in a QTableView.
+ First, we create QTableView and tell it to use the model as a data source. To have the data presented nicely, the minimum width of the table view is set and its headers resize mode changed to stretch.
+
+ \snippet barmodelmapper/tablewidget.cpp 2
+
+ Now we need a QChart instance to display the same data on the chart.
+ We also enable animations. It makes it easier to see how a modification to the model's data affects the chart.
+
+ \snippet barmodelmapper/tablewidget.cpp 3
+
+ The first line of the code below creates new bar series. Variables firstRow and rowCount are used to define a custom model mapping.
+ Custom mapping allows to take only part of the data from the model. In this case data from 5 rows starting with the row with the index 3.
+ The following three lines create an instance of the QVBarModelMapper class and specify that the data for the bar sets should be taken from the model's columns with indexes from 1 to 4 (inclusive).
+ To create a connection between the series and the model we set both of those objects to QVBarModelMapper.
+
+ Finally the series is added to the chart.
+
+ \snippet barmodelmapper/tablewidget.cpp 4
+
+ To show in QTableView which data corresponds with which bar set, this example uses table coloring.
+ When series is added to the chart, it is assigned a color based on the currently selected theme.
+ Code below extracts that color from the series and uses it to create colored QTableView.
+ Coloring of the view is not a part of the QChart functionality.
+
+ \snippet barmodelmapper/tablewidget.cpp 5
+
+ We would like to have categories placed on the chart's axis that describe what the data means.
+ Next snippet shows how to do that.
+
+ \snippet barmodelmapper/tablewidget.cpp 6
+
+ To avoid setting up the QGraphicsScene we use the QChartView class that does it for us. The QChart object pointer is used as a parameter of the QChartView constructor.
+ To make the render look nicer Antialiasing is turned on and the minimum size of the chartView widget is set.
+
+ \snippet barmodelmapper/tablewidget.cpp 7
+
+ Finally, we place both widgets in a layout and use the layout as the application layout.
+
+ \snippet barmodelmapper/tablewidget.cpp 8
+
+ The application is ready. Try modifying the data in the table view and see how it affects the chart.
+*/
diff --git a/src/charts/doc/src/examples-boxplotchart.qdoc b/src/charts/doc/src/examples-boxplotchart.qdoc
new file mode 100644
index 00000000..c4d1eea4
--- /dev/null
+++ b/src/charts/doc/src/examples-boxplotchart.qdoc
@@ -0,0 +1,78 @@
+/*!
+ \example boxplotchart
+ \title Box and Whiskers Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a box-and-whiskers chart.
+
+ The example also shows how to read the non-continuous data from a file,
+ arrange it and find medians needed for box-and-whiskers plotting.
+
+ \image examples_boxplotchart.png
+
+ To show the share deviation of two companies we start by creating two QBoxPlotSeries to handle monthly data.
+
+ \snippet boxplotchart/main.cpp 1
+
+ QFile class is used to open a text file where the non-continuous data is kept. The BoxDataReader is an auxiliary class for
+ reading the text file and finding the extreme and median values from the data. The BoxDataReader is explained in more detail later.
+ The method readBox reads the values and sets them to the QBoxSet item which the method returns for the caller. The returned QBoxSet
+ item is added to the series.
+
+ \snippet boxplotchart/main.cpp 2
+
+ In this section a second file is opened for reading the data for the second company.
+
+ \snippet boxplotchart/main.cpp 3
+
+ In this code snippet a new QChart instance is created and previously created series are added to it. The title is also defined and
+ animation is set to be SeriesAnimation.
+
+ \snippet boxplotchart/main.cpp 4
+
+ Here we ask the chart to create default axes for our presentation. We also set the range for the vertical axis by querying the pointer
+ for the axis from the chart, and then setting the min and max for that axis.
+
+ \snippet boxplotchart/main.cpp 5
+
+ In this section we set the legends to be visible and place them at the bottom of the chart.
+
+ \snippet boxplotchart/main.cpp 6
+
+ Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
+
+ \snippet boxplotchart/main.cpp 7
+
+ The chart is ready to be shown. We set the chart to be the central widget of the window.
+ We also set the size for the chart window and show it.
+
+ \snippet boxplotchart/main.cpp 8
+
+ Here the method readBox is explained in detail. Firstly, a line is read from the file and lines starting with # are rejected
+ since they are considered as comment lines.
+
+ \snippet boxplotchart/boxdatareader.cpp 1
+
+ In this file the data is arranged as number, space, number, or space. On this snippet the line is split into single number strings which
+ are stored on QStringList.
+
+ \snippet boxplotchart/boxdatareader.cpp 2
+
+ The sortedList will hold the numbers in continuous order and in this code segment we show how to do it. First the sortedList is cleared and numbers
+ are read from the strList and stored into sortedList in double format. The qSort method arranges the sortedList into continuous order
+ starting from the smallest.
+
+ \snippet boxplotchart/boxdatareader.cpp 3
+
+ Below you will find a code sample showing how to select extremes and medians from the continuous data. Firstly a new QBoxSet is created.
+ Lower and upper extremes are simple to select; they are just first and last items on the sortedList. For medians we use a helper
+ method findMedian which is explained later. For the median from the upper half we need to adjust the begin number if the
+ amount of the numbers is even or uneven. The end number for lower half comes naturally from int rounding.
+
+ \snippet boxplotchart/boxdatareader.cpp 4
+
+ Below you will find the code sample for the method findMedian. If the amount of numbers is uneven we select the number from
+ the middle. For even amount numbers we take two numbers from the middle and calculate the mean value.
+
+ \snippet boxplotchart/boxdatareader.cpp 5
+*/
diff --git a/src/charts/doc/src/examples-callout.qdoc b/src/charts/doc/src/examples-callout.qdoc
new file mode 100644
index 00000000..1f5f8dcc
--- /dev/null
+++ b/src/charts/doc/src/examples-callout.qdoc
@@ -0,0 +1,15 @@
+/*!
+ \example callout
+ \title Callout example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to draw an additional element (a callout) on top of the chart.
+ \image examples_callout.png
+
+ QChart class provides two methods that map between the scene coordinates and the series domain
+ (defined by the axes ranges).
+
+ QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series)
+
+ QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series)
+*/
diff --git a/src/charts/doc/src/examples-chartthemes.qdoc b/src/charts/doc/src/examples-chartthemes.qdoc
new file mode 100644
index 00000000..d6121435
--- /dev/null
+++ b/src/charts/doc/src/examples-chartthemes.qdoc
@@ -0,0 +1,15 @@
+/*!
+ \example chartthemes
+ \title Chart themes example
+ \ingroup qtcharts_examples
+
+ \brief The example shows the look and feel of the different built-in themes.
+
+ This example shows the look and feel of the different built-in themes for all supported chart
+ types. In order to give the result a more harmonious look, the background palette of the
+ application is customized to the theme selected.
+
+ \image examples_chartthemes_light.png
+ \image examples_chartthemes_brown_sand.png
+ \image examples_chartthemes_blue_cerulean.png
+*/
diff --git a/src/charts/doc/src/examples-customchart.qdoc b/src/charts/doc/src/examples-customchart.qdoc
new file mode 100644
index 00000000..4d1cee42
--- /dev/null
+++ b/src/charts/doc/src/examples-customchart.qdoc
@@ -0,0 +1,26 @@
+/*!
+ \example customchart
+ \title Custom Chart Example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to customize the appearance of the different elements on a chart.
+ \image examples_customchart.png
+
+ We begin by creating a simple line series and a chart object.
+ \snippet customchart/main.cpp 1
+
+ First we customize the series and the chart's title and background.
+ \snippet customchart/main.cpp 2
+
+ Then we customize the axes.
+ \snippet customchart/main.cpp 3
+
+ Then the axis label values and ranges. Once the axes are ready, we set them to be used by the chart.
+ \snippet customchart/main.cpp 4
+
+ Finally, we create a view containing the chart.
+ \snippet customchart/main.cpp 5
+
+ Now we are ready to show the chart on a main window.
+ \snippet customchart/main.cpp 6
+*/
diff --git a/src/charts/doc/src/examples-datetimeaxis.qdoc b/src/charts/doc/src/examples-datetimeaxis.qdoc
new file mode 100644
index 00000000..b667af4d
--- /dev/null
+++ b/src/charts/doc/src/examples-datetimeaxis.qdoc
@@ -0,0 +1,38 @@
+/*!
+ \example datetimeaxis
+ \title DateTimeAxis Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to use QLineChart with QDateTimeAxis.
+
+ \image examples_datetimeaxis.png
+
+ To create line chart, QLineSeries instance is needed. Let's create one.
+
+ \snippet datetimeaxis/main.cpp 1
+
+ On the charts we will present how the number of sun spots changes in time. The data (from the Space Weather Prediction Center) is read from a text file.
+ In the snippet below, notice how the QDateTime::toMSecsSinceEpoch method is used to convert the QDateTime object into a number that can be passed to the QLineSeries append method.
+
+ \snippet datetimeaxis/main.cpp 2
+
+ To present the data on the chart we need the QChart instance. We add the series to it, hide the legend, create the default axes and set the title of the chart.
+
+ \snippet datetimeaxis/main.cpp 3
+
+ Since we use QLineSeries, calling createDefaultAxes will create QValueAxis both as X- and Y-axis. To use QDateTimeAxis we need to set it manually to the chart.
+ First, the instance of QDateTimeAxis is created, then the number of ticks to be shown is set. The number of sun spots is provided as an average for the month.
+ Therefore we don't need the axis labels to contain the information about the time and the day. This is achieved by setting a custom label format.
+ Please refer to the QDateTime::toString() method documentation to learn about the available format options.
+
+ \snippet datetimeaxis/main.cpp 4
+
+ Then we create a QChartView object with QChart as a parameter. This way we don't need to create the QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer.
+
+ \snippet datetimeaxis/main.cpp 5
+
+ The chart is ready to be shown.
+
+ \snippet datetimeaxis/main.cpp 6
+
+*/
diff --git a/src/charts/doc/src/examples-donutbreakdown.qdoc b/src/charts/doc/src/examples-donutbreakdown.qdoc
new file mode 100644
index 00000000..5586a81c
--- /dev/null
+++ b/src/charts/doc/src/examples-donutbreakdown.qdoc
@@ -0,0 +1,45 @@
+/*!
+ \example donutbreakdown
+ \title Donut chart breakdown example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to use create a donut breakdown chart using QPieSeries API.
+ \image examples_donutbreakdown.png
+
+ Let's start by defining some data for the chart.
+
+ \snippet donutbreakdown/main.cpp 1
+
+ Then we create a chart where we add the data. Note that this is our own chart derived from QChart.
+
+ \snippet donutbreakdown/main.cpp 2
+
+ Our own chart works in such a way that we create a main series in the constructor we create a main series,
+ which aggregates the data provided by the breakdown series. This is the piechart in the center.
+
+ \snippet donutbreakdown/donutbreakdownchart.cpp 1
+
+ When a breakdown series is added the data is used to create a slice in the main series and the
+ breakdown series itself is used to create a segment of a donut positioned so that it is aligned
+ with the corresponding slice in the main series.
+
+ \snippet donutbreakdown/donutbreakdownchart.cpp 2
+
+ Here's how the start and end angles for the donut segments are calculated.
+
+ \snippet donutbreakdown/donutbreakdownchart.cpp 3
+
+ The legend markers are customized to show the breakdown percentage. The markers for the main level slices are hidden.
+
+ \snippet donutbreakdown/donutbreakdownchart.cpp 4
+
+ Instead the main level slices show the percentage on the label.
+
+ \snippet donutbreakdown/mainslice.cpp 1
+ \snippet donutbreakdown/mainslice.cpp 2
+
+ Now that we have our chart defined, we can finally create a QChartView and show the chart.
+
+ \snippet donutbreakdown/main.cpp 3
+
+*/
diff --git a/src/charts/doc/src/examples-donutchart.qdoc b/src/charts/doc/src/examples-donutchart.qdoc
new file mode 100644
index 00000000..4aa0d8b8
--- /dev/null
+++ b/src/charts/doc/src/examples-donutchart.qdoc
@@ -0,0 +1,9 @@
+/*!
+ \example donutchart
+ \title Donutchart Example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to create a simple donut chart, and do some customizations to
+ a slice.
+ \image examples_donutchart.png
+*/
diff --git a/src/charts/doc/src/examples-dynamicspline.qdoc b/src/charts/doc/src/examples-dynamicspline.qdoc
new file mode 100644
index 00000000..60814a6f
--- /dev/null
+++ b/src/charts/doc/src/examples-dynamicspline.qdoc
@@ -0,0 +1,10 @@
+/*!
+ \example dynamicspline
+ \title Dynamic spline example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to draw dynamic data.
+
+ \image examples_dynamicspline1.png
+ \image examples_dynamicspline2.png
+*/
diff --git a/src/charts/doc/src/examples-horizontalbarchart.qdoc b/src/charts/doc/src/examples-horizontalbarchart.qdoc
new file mode 100644
index 00000000..3ec69192
--- /dev/null
+++ b/src/charts/doc/src/examples-horizontalbarchart.qdoc
@@ -0,0 +1,50 @@
+/*!
+ \example horizontalbarchart
+ \title HorizontalBarChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a horizontal bar chart.
+
+ QHorizontalBarChart shows the data in sets as separate bars, which are grouped in categories. QHorizontalBarChart works just like
+ QBarChart, except that the bars are drawn horizontally on the chart.
+
+ \image examples_horizontalbarchart.png
+
+ The bar sets are used in the same way in all bar charts.
+ To illustrate the difference between various bar charts, we use the same data in all examples.
+ Data that bar chart visualizes, is defined by QBarSet instances. Here we create the sets and append data
+ to them. The data is appended here with << operator. Alternatively, the append method could also be used.
+
+ \snippet horizontalbarchart/main.cpp 1
+
+ We create the series and append the bar sets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
+ The first values of each set are grouped together in the first category; the second values in the second category, and so on.
+
+ \snippet horizontalbarchart/main.cpp 2
+
+ Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
+ setAnimationOptions(QChart::SeriesAnimations).
+
+ \snippet horizontalbarchart/main.cpp 3
+
+ To have the categories displayed on axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and
+ set it to be the y-axis of the chart. The chart takes ownership of axis. For the x-axis we use the default axis, which is created and scaled to series data
+ by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be done before we set the category axis. Otherwise the default axis will
+ override the category axis.
+
+ \snippet horizontalbarchart/main.cpp 4
+
+ We also want to show the legend. To do so, we get the legend pointer from chart and set it to visible. We also place the legend to the bottom of the chart by setting its alignment
+ to Qt::AlignBottom.
+
+ \snippet horizontalbarchart/main.cpp 5
+
+ Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
+
+ \snippet horizontalbarchart/main.cpp 6
+
+ The chart is ready to be shown. We set the chart to be the central widget of the window.
+ We also set the size for the chart window and show it.
+
+ \snippet horizontalbarchart/main.cpp 7
+*/
diff --git a/src/charts/doc/src/examples-horizontalpercentbarchart.qdoc b/src/charts/doc/src/examples-horizontalpercentbarchart.qdoc
new file mode 100644
index 00000000..f3e79353
--- /dev/null
+++ b/src/charts/doc/src/examples-horizontalpercentbarchart.qdoc
@@ -0,0 +1,56 @@
+/*!
+ \example horizontalpercentbarchart
+ \title HorizontalPercentBarChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple horizontal percent bar chart.
+
+ The horizontal percent bar chart shows the data in a set as a percentage of
+ all sets per category.
+
+ Creating a horizontal percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
+ horizontal percent bar chart, we use the QHorizontalPercentBarSeries api instead of QBarSeries. Also, in the
+ \l {BarChart Example} {bar chart}, we used a nice numbers algorithm to make the y-axis numbering look better. With
+ the percent bar chart there is no need for that, because the maximum y-axis value is always 100.
+
+ \image examples_horizontalpercentbarchart.png
+
+ The barsets are used in same way in all barcharts.
+ To illustrate the difference between various barcharts, we use same data in examples.
+ The data which the bar chart visualizes is defined by QBarSet instances. Here we create the sets and append data
+ to them. The data is appended here with << operator. Alternatively the append method could be used.
+
+ \snippet horizontalpercentbarchart/main.cpp 1
+
+ We create the series and append the bar sets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
+ The first values of each set are grouped together in the first category, the second value in the second category etc.
+
+ \snippet horizontalpercentbarchart/main.cpp 2
+
+ Here we create the chart object and add the series to it. We set the title for chart with setTitle and then turn on animations of the series by calling
+ setAnimationOptions(QChart::SeriesAnimations)
+
+ \snippet horizontalpercentbarchart/main.cpp 3
+
+ To have the categories displayed on an axis, we need to create a QBarCategoryAxis first. Here we create a category axis with a list of categories and
+ set it to be the y-axis of the chart. The chart takes ownership of the axis. For the x-axis we use the default axis, which is created and scaled to series data
+ by calling createDefaultAxes of the chart. Note that createDefaultAxes must be called before we set the category axis. Otherwise the default axis will
+ override the category axis.
+
+ \snippet horizontalpercentbarchart/main.cpp 4
+
+ We also want to show the legend. To do that, we get the legend pointer from the chart
+ and set it to visible. We also place the legend to bottom of the chart by setting its
+ alignment to Qt::AlignBottom.
+
+ \snippet horizontalpercentbarchart/main.cpp 5
+
+ Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
+
+ \snippet horizontalpercentbarchart/main.cpp 6
+
+ The chart is ready to be shown. We set the chart to be the central widget of the window.
+ We also set the size for the chart window and show it.
+
+ \snippet horizontalpercentbarchart/main.cpp 7
+*/
diff --git a/src/charts/doc/src/examples-horizontalstackedbarchart.qdoc b/src/charts/doc/src/examples-horizontalstackedbarchart.qdoc
new file mode 100644
index 00000000..19e1d1ba
--- /dev/null
+++ b/src/charts/doc/src/examples-horizontalstackedbarchart.qdoc
@@ -0,0 +1,53 @@
+/*!
+ \example horizontalstackedbarchart
+ \title HorizontalStackedBarChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple stacked horizontal bar chart.
+
+ The stacked bar chart shows the data in sets as bars that are
+ stacked on top of each other. The stacking is done per category.
+ Creating a stacked horizontal bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
+ stacked horizontal bar chart, we use the QHorizontalStackedBarSeries api instead of QBarSeries.
+
+ \image examples_horizontalstackedbarchart.png
+
+ The bar sets are used in same way in all bar charts.
+ To illustrate the difference between various barcharts, we use the same data in all examples.
+ The data that barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data
+ to them. The data is appended here with the << operator. Alternatively, the append method could also be used.
+
+ \snippet horizontalstackedbarchart/main.cpp 1
+
+ We create the series and append the bar sets to it. The series takes ownership of the bar sets. The series groups the data from sets to categories.
+ The first values of each set are grouped together in the first category, the second values in the second category and so on.
+
+ \snippet horizontalstackedbarchart/main.cpp 2
+
+ Here we create the chart object and add the series to it. We set the title for the chart with setTitle, and then turn on the animations of the series by calling
+ setAnimationOptions(QChart::SeriesAnimations).
+
+ \snippet horizontalstackedbarchart/main.cpp 3
+
+ To have categories displayed on an axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and
+ set it to be the y-axis of the chart. The chart takes ownership of the axis. For the x-axis we use the default axis, which is created and scaled to series data
+ by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
+ override the category axis.
+
+ \snippet horizontalstackedbarchart/main.cpp 4
+
+ We also want to show the legend. To do that, we get the legend pointer from the chart and
+ set it to visible. We also place the legend to the bottom of the chart by setting its alignment
+ to Qt::AlignBottom.
+
+ \snippet horizontalstackedbarchart/main.cpp 5
+
+ Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
+
+ \snippet horizontalstackedbarchart/main.cpp 6
+
+ The chart is ready to be shown. We set the chart to be the central widget of the window.
+ We also set the size for the chart window and show it.
+
+ \snippet horizontalstackedbarchart/main.cpp 7
+*/
diff --git a/src/charts/doc/src/examples-legend.qdoc b/src/charts/doc/src/examples-legend.qdoc
new file mode 100644
index 00000000..0886058c
--- /dev/null
+++ b/src/charts/doc/src/examples-legend.qdoc
@@ -0,0 +1,40 @@
+/*!
+ \example legend
+ \title Legend Example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to detach the legend from the chart and how to attach it back.
+
+ By default the chart draws the legend inside the same view with the chart. In some cases the
+ user may want to draw the legend to somewhere else. To make this possible the legend can be
+ detached from the chart. Detaching means that the chart doesn't draw the legend or try to
+ change its layout. Detached legend can then be drawn wherever the user wishes, for example,
+ in a different graphics scene. The behavior of the legend can be inspected by running the
+ legend example.
+ In the example we use the bar series where we add or remove the bar sets. The legend reflects
+ the changes in series. The legend can be detached or attached back to the chart and its
+ alignment can be modified.
+ When the legend is detached, it can be resized and positioned freely.
+
+ \table
+ \row
+ \li \inlineimage examples_legend_detach.png
+ \li \inlineimage examples_legend_detach2.png
+ \endtable
+
+ Here we turn the legend visible and set its alignment to the bottom of the chart.
+
+ \snippet legend/mainwidget.cpp 1
+
+ This snippet shows how to detach the legend from the chart. After detaching, we turn its background to visible and set a different color to it. This makes it easier to see how the items inside the legend are arranged in detached mode.
+
+ \snippet legend/mainwidget.cpp 2
+
+ Here we attach the legend back to the chart. The background is turned invisible.
+
+ \snippet legend/mainwidget.cpp 3
+
+ This shows how we set the detached legend dimensions. After setting the new values, we call update to show changes on screen.
+
+ \snippet legend/mainwidget.cpp 4
+*/
diff --git a/src/charts/doc/src/examples-legendmarkers.qdoc b/src/charts/doc/src/examples-legendmarkers.qdoc
new file mode 100644
index 00000000..35ae5254
--- /dev/null
+++ b/src/charts/doc/src/examples-legendmarkers.qdoc
@@ -0,0 +1,43 @@
+/*!
+ \example legendmarkers
+ \title LegendMarkers Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to make use of legend markers.
+
+ In this example we create an application which uses the QLegendMarker clicked signal to show/hide the corresponding series
+ in a chart. The connect marker button connects a clicked signal from all markers in a legend to the handleMarkerClicked slot.
+
+ \image examples_legendmarkers.png
+
+ Our application has buttons for adding or removing a series in a chart and a button to connect or disconnect the legend markers clicked signal to our handler.
+ In the image above we have connected the markers and clicked on one of them.
+
+ \snippet legendmarkers/mainwidget.cpp 1
+
+ Here we connect the markers in the legend to our handler. To avoid connecting the same marker more than once, we first disconnect it.
+
+ \snippet legendmarkers/mainwidget.cpp 2
+
+ Here we disconnect all markers from our handler.
+
+ \snippet legendmarkers/mainwidget.cpp 3
+
+ In our handler we first cast the sender of the event to the QLegendMarker.
+
+ \snippet legendmarkers/mainwidget.cpp 4
+
+ Then we check the type of the marker. This is required if we want to access the detailed methods of the marker and cast it to the correct type.
+ If all we need is the pointer to QAbstractSeries, the casting isn't necessary. In case of a pie or bar series, we may need the pointer to a related QPieSlice or QBarSet.
+
+ \snippet legendmarkers/mainwidget.cpp 5
+
+ We want to toggle the visibility of the series, when the marker is clicked. To do so, we get the pointer to a related series from the marker and toggle its visibility.
+ Since the legend marker follows the visibility of the series by default, we also set the marked back to visible. If we don't do so, the marker will be
+ invisible in the legend and we can't click on it anymore.
+
+ \snippet legendmarkers/mainwidget.cpp 6
+
+ Instead of making the marker invisible when the series is hidden, we dim the color of the marker. Here we do it by modifying the color of the laberBrush.
+
+*/
diff --git a/src/charts/doc/src/examples-lineandbarchart.qdoc b/src/charts/doc/src/examples-lineandbarchart.qdoc
new file mode 100644
index 00000000..d3f69e76
--- /dev/null
+++ b/src/charts/doc/src/examples-lineandbarchart.qdoc
@@ -0,0 +1,48 @@
+/*!
+ \example lineandbar
+ \title Line and BarChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to combine different charts and set the axes.
+
+ In the example we combine a linechart with
+ a barchart and use the category axis as a common axis for both.
+
+ \image examples_lineandbar.png
+
+ Here we create data for our bar series.
+
+ \snippet lineandbar/main.cpp 1
+
+ We create a bar series and append sets to it.
+ The first values of each set are grouped together in the first category, the second values in the second category and so on.
+
+ \snippet lineandbar/main.cpp 2
+
+ Then we create a line series and add data to it. To make the data match with the barchart, we use the index as an x-value for our line series, so that
+ first point is at (0,value) second at (1,value) and so on.
+
+ \snippet lineandbar/main.cpp 8
+
+ Here we create the chart and add both series to it.
+
+ \snippet lineandbar/main.cpp 3
+
+ To make the chart show the series properly, we have to create custom axes for the series. If we don't create custom axes, then each series will get scaled to
+ use the maximum area of the chart (like in single series case) and the result will be incorrect. With custom axes we set the range of both series to follow the
+ same axis. For the x-axis we use the QBarCategoryAxis and for the y-axis we use QValuesAxis.
+
+ \snippet lineandbar/main.cpp 4
+
+ And we also want to show the legend.
+
+ \snippet lineandbar/main.cpp 5
+
+ Finally we add the chart onto a view.
+
+ \snippet lineandbar/main.cpp 6
+
+ Now it is ready to be shown in a window.
+
+ \snippet lineandbar/main.cpp 7
+*/
diff --git a/src/charts/doc/src/examples-linechart.qdoc b/src/charts/doc/src/examples-linechart.qdoc
new file mode 100644
index 00000000..d425788a
--- /dev/null
+++ b/src/charts/doc/src/examples-linechart.qdoc
@@ -0,0 +1,30 @@
+/*!
+ \example linechart
+ \title LineChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple line chart.
+
+ \image examples_linechart.png
+
+ To create a line chart, a QLineSeries instance is needed. Let's create one.
+
+ \snippet linechart/main.cpp 1
+
+ Then we add data to the series. We can use the append() member function or use the stream operator.
+
+ \snippet linechart/main.cpp 2
+
+ To present the data on the chart we need a QChart instance. We add the series to it, create the default axes, and set the title of the chart.
+
+ \snippet linechart/main.cpp 3
+
+ Then we create a QChartView object with QChart as a parameter. This way we don't need to create a QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines look nicer.
+
+ \snippet linechart/main.cpp 4
+
+ The chart is ready to be shown.
+
+ \snippet linechart/main.cpp 5
+
+*/
diff --git a/src/charts/doc/src/examples-logvalueaxis.qdoc b/src/charts/doc/src/examples-logvalueaxis.qdoc
new file mode 100644
index 00000000..f37db92e
--- /dev/null
+++ b/src/charts/doc/src/examples-logvalueaxis.qdoc
@@ -0,0 +1,30 @@
+/*!
+ \example logvalueaxis
+ \title Logarithmic Axis Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to use QLogValueAxis.
+
+ \image examples_logvalueaxis.png
+
+ Create a QLineSeries instance and add some data to it.
+
+ \snippet logvalueaxis/main.cpp 1
+
+ To present the data on the chart we need a QChart instance. Add the series to it, hide the legend and set the title of the chart.
+
+ \snippet logvalueaxis/main.cpp 2
+
+ Create the axes. Add them to the chart and attach to the series.
+
+ \snippet logvalueaxis/main.cpp 3
+
+ Then create a QChartView object with QChart as a parameter. Enable antialiasing to have the rendered line look nicer.
+
+ \snippet logvalueaxis/main.cpp 4
+
+ The chart is ready to be shown.
+
+ \snippet logvalueaxis/main.cpp 5
+
+*/
diff --git a/src/charts/doc/src/examples-modeldata.qdoc b/src/charts/doc/src/examples-modeldata.qdoc
new file mode 100644
index 00000000..507aa4cb
--- /dev/null
+++ b/src/charts/doc/src/examples-modeldata.qdoc
@@ -0,0 +1,59 @@
+/*!
+ \example modeldata
+ \title Model Data Example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to use the QAbstractItemModel derived model as the data for the
+ series.
+
+ \image examples_modeldata.png
+
+ Let's start by creating an instance of the CustomTableModel class.
+ The CustomTableModel class is derived from QAbstractTableModel and it was created for the purpose of this example.
+ The constructor of this class populates the internal data store of the model with the data that is suitable for our chart example.
+
+ \snippet modeldata/tablewidget.cpp 1
+
+ We now have a model with data that we would like to display both on the chart and in a QTableView.
+ First, we create QTableView and tell it to use the model as a data source. To make the data cells fill the table view we also change headers resize mode.
+
+ \snippet modeldata/tablewidget.cpp 2
+
+ Now we need the QChart instance to display the same data on the chart.
+ We also enable animations. It makes it easier to see how modifying the model's data affect the chart.
+
+ \snippet modeldata/tablewidget.cpp 3
+
+ The code below creates new line series and gives it a name. The following line creates an instance of QVXYModelMapper class.
+ The next two lines specify that X-coordinates are taken from the model's column(Qt::Vertical) with index 0. The Y-coordinates are taken from the model's column with index 1.
+ To create a connection between the series and the model we set both of those objects to QVXYModelMapper.
+
+ Finally, the series is added to the chart.
+
+ \snippet modeldata/tablewidget.cpp 4
+
+ To show in QTableView which data corresponds with which series this example uses table coloring.
+ When a series is added to the chart it is assigned a color based on the currently selected theme.
+ The code below extracts that color from the series and uses it to create a colored QTableView.
+ The coloring of the view is not a part of the QChart functionality.
+
+ \snippet modeldata/tablewidget.cpp 5
+
+ The same operations are done with a second series. Notice that for this series different columns of the same model are mapped.
+
+ \snippet modeldata/tablewidget.cpp 6
+
+ \snippet modeldata/tablewidget.cpp 7
+
+ To avoid setting up the QGraphicsScene we use the QChartView class that does it for us.
+ QChart object pointer is used as a parameter of the QChartView constructor.
+ To make the chart look nicer, Antialiasing is turned on and the minimum size of the chartView widget is set.
+
+ \snippet modeldata/tablewidget.cpp 8
+
+ Finally we place both widgets in a layout and use the layout as the application layout.
+
+ \snippet modeldata/tablewidget.cpp 9
+
+ The application is ready. Try modifying the data in the table view and see how it affects the chart.
+*/
diff --git a/src/charts/doc/src/examples-multiaxis.qdoc b/src/charts/doc/src/examples-multiaxis.qdoc
new file mode 100644
index 00000000..4d82e2f5
--- /dev/null
+++ b/src/charts/doc/src/examples-multiaxis.qdoc
@@ -0,0 +1,37 @@
+/*!
+ \example multiaxis
+ \title Multiple Axes Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple chart with two vertical axes. One for each
+ series.
+
+ \image examples_multiaxis.png
+
+ Create the QChart instance, hide the legend of the chart, and set its title.
+
+ \snippet multiaxis/main.cpp 1
+
+ Create a QValueAxis instance that will be used as a horizontal axis by both series and add it the bottom of the chart.
+ The axis can be shared between many series, but each series can have only one vertical and horizontal axis.
+
+ \snippet multiaxis/main.cpp 2
+
+ Create the first series, and add the data to it. Finally, add the series to the chart. Instantiate its own Y-axis, add it to the chart. Then attach both the common X-axis and the series specific Y-axis.
+ In this example the color of the axis line is set to be the same as the color of the series to make it possible to distinguish which axis is attached to which series.
+
+ \snippet multiaxis/main.cpp 3
+
+ Similarly prepare another series. This time a different axis type is used. Additionally grid lines color is also set to be the same as the color of the series.
+
+ \snippet multiaxis/main.cpp 4
+
+ Create a QChartView object with QChart as a parameter. Enable Antialiasing to have the rendered splines look nicer.
+
+ \snippet multiaxis/main.cpp 5
+
+ The chart is ready to be shown.
+
+ \snippet multiaxis/main.cpp 6
+
+*/
diff --git a/src/charts/doc/src/examples-nesteddonuts.qdoc b/src/charts/doc/src/examples-nesteddonuts.qdoc
new file mode 100644
index 00000000..697a59b4
--- /dev/null
+++ b/src/charts/doc/src/examples-nesteddonuts.qdoc
@@ -0,0 +1,50 @@
+/*!
+ \example nesteddonuts
+ \title Nested donuts example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to create a nested donuts chart using the QPieSeries API.
+ \image examples_nesteddonuts.png
+
+ Let's start by creating a QChartView instance and enabling the Antialiasing on it. A QChart object is then obtained from the QChartView instance.
+ The legend is disabled and the title of the chart is set. Last line enables the animations of the chart.
+
+ \snippet nesteddonuts/widget.cpp 1
+
+ Three variables are defined that will be used to define the donut chart. Min and max size define the relative size of the whole donut.
+ minSize is the relative inner size of the smallest donut. maxSize is the relative outer size of the biggest donut.
+
+ \snippet nesteddonuts/widget.cpp 2
+
+ The following block of code defines the individual donuts and their slices. First a new QPieSeries object is created.
+ The number of slices in each donut is randomized.
+ The internal for loop creates the slices with a random value and label same as the value.
+ Next the label of the slice is set to be visible and its color is set to white.
+ To make the example more interesting the hovered signal of the slice is connected to widget's slot, of which the inner workings are explained later.
+ Finally the slice is added to the donut. The donut's size is adjusted to achieve the nesting of the donuts.
+ Then the donut is added to the widget's list of donuts and to the chart.
+
+ \snippet nesteddonuts/widget.cpp 3
+
+ Finally the widget is placed in a layout used by the application.
+
+ \snippet nesteddonuts/widget.cpp 4
+
+ To make the example more interesting the donuts are rotated randomly every 1.25 sec.
+
+ \snippet nesteddonuts/widget.cpp 5
+
+ The widget's updatedRotation slot is defined below.
+ It goes through all of the donuts and modifies their current rotation by a random value.
+
+ \snippet nesteddonuts/widget.cpp 6
+
+ The earlier mentioned explodeSlice slot code is provided below.
+ If the slice is set to exploded, then stop the timer that controls the donuts rotation.
+ Then the slice's start and end angles are obtained from the slice.
+ To highlight the selected slice all the other donuts that lie outward from the one that contains the selected slice
+ have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice.
+ If the slice is no longer selected return to the original state.
+
+ \snippet nesteddonuts/widget.cpp 7
+*/
diff --git a/src/charts/doc/src/examples-percentbarchart.qdoc b/src/charts/doc/src/examples-percentbarchart.qdoc
new file mode 100644
index 00000000..d1316e80
--- /dev/null
+++ b/src/charts/doc/src/examples-percentbarchart.qdoc
@@ -0,0 +1,55 @@
+/*!
+ \example percentbarchart
+ \title PercentBarChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple percent bar chart.
+
+ A percent bar chart shows the data in sets as a percentage of
+ all sets per category.
+
+ Creating percent bar charts is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
+ percent bar charts, we use the QPercentBarSeries api instead of QBarSeries. Also, in the
+ \l {BarChart Example} {bar chart} we used the nice numbers algorithm to make the y-axis numbering look better. With
+ the percent bar chart there is no need for that, because the maximum y-axis value is always 100.
+
+ \image examples_percentbarchart.png
+
+ The barsets are used in same way in all barcharts.
+ To illustrate the difference between various barcharts, we use the same data in all examples.
+ The data visualized by the bar chart is defined by QBarSet instances. Here we create the sets and append data
+ to them. The data is appended here with the << operator. Alternatively the append method could be used.
+
+ \snippet percentbarchart/main.cpp 1
+
+ We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
+ The first values of each set are grouped together in the first category, the second values in the second category etc.
+
+ \snippet percentbarchart/main.cpp 2
+
+ Here we create the chart object and add the series to it. We set the title of the chart with setTitle, and then turn on animations of the series by calling
+ setAnimationOptions(QChart::SeriesAnimations)
+
+ \snippet percentbarchart/main.cpp 3
+
+ To have categories displayed on axis, we need to create a QBarCategoryAxis for that. Here we create a category axis with a list of categories and
+ set it to be the x-axis of the chart. The chart takes ownership of the axis. For the y-axis we use the default axis, which is created and scaled
+ to series data by calling createDefaultAxes of the chart. Note that createDefaultAxes must be called before we set the category axis.
+ Otherwise the default axis will override the category axis.
+
+ \snippet percentbarchart/main.cpp 4
+
+ We also want to show the legend. To do so, we get the legend pointer from the chart and set it to visible. We also place the legend to bottom of
+ the chart by setting its alignment to Qt::AlignBottom.
+
+ \snippet percentbarchart/main.cpp 5
+
+ Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
+
+ \snippet percentbarchart/main.cpp 6
+
+ The chart is ready to be shown. We set the chart to be central widget of the window.
+ We also set the size for the chart window and show it.
+
+ \snippet percentbarchart/main.cpp 7
+*/
diff --git a/src/charts/doc/src/examples-piechart.qdoc b/src/charts/doc/src/examples-piechart.qdoc
new file mode 100644
index 00000000..1ae2b3ea
--- /dev/null
+++ b/src/charts/doc/src/examples-piechart.qdoc
@@ -0,0 +1,9 @@
+/*!
+ \example piechart
+ \title Piechart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple pie chart and do some customizations to
+ a pie slice.
+ \image examples_piechart.png
+*/
diff --git a/src/charts/doc/src/examples-piechartcustomization.qdoc b/src/charts/doc/src/examples-piechartcustomization.qdoc
new file mode 100644
index 00000000..8a6915c3
--- /dev/null
+++ b/src/charts/doc/src/examples-piechartcustomization.qdoc
@@ -0,0 +1,8 @@
+/*!
+ \example piechartcustomization
+ \title Pie chart customization example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how the look and feel of a pie chart can be customized.
+ \image piechart_customization.png
+*/
diff --git a/src/charts/doc/src/examples-piechartdrilldown.qdoc b/src/charts/doc/src/examples-piechartdrilldown.qdoc
new file mode 100644
index 00000000..f53d9745
--- /dev/null
+++ b/src/charts/doc/src/examples-piechartdrilldown.qdoc
@@ -0,0 +1,9 @@
+/*!
+ \example piechartdrilldown
+ \title Piechart Drilldown Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to implement a piechart with drilldown effect.
+ \image examples_piechartdrill1.png
+ \image examples_piechartdrill2.png
+*/
diff --git a/src/charts/doc/src/examples-polarchart.qdoc b/src/charts/doc/src/examples-polarchart.qdoc
new file mode 100644
index 00000000..9d27aafa
--- /dev/null
+++ b/src/charts/doc/src/examples-polarchart.qdoc
@@ -0,0 +1,34 @@
+/*!
+ \example polarchart
+ \title Polar Chart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple polar chart with multiple different series.
+
+ It also shows how to implement scrolling and zooming of the polar chart as well as
+ visually demonstrate how polar charts and cartesian charts relate to each other.
+
+ \image examples_polarchart.png
+
+ Creating a polar chart is done with a QPolarChart instance instead of a QChart instance.
+
+ \snippet polarchart/main.cpp 1
+
+ Axes are created similarly to cartesian charts, but when axes are added to the chart,
+ you can use polar orientations instead of alignments.
+
+ \snippet polarchart/main.cpp 2
+
+ Zooming and scrolling of a polar chart is logically nearly identical to zooming and scrolling of a cartesian chart.
+ The main difference is that when scrolling along the X-axis (angular axis), the angle is used instead of the number of pixels.
+ Another difference is that zooming to a rectangle cannot be done.
+
+ \snippet polarchart/chartview.cpp 1
+
+ The same axes and series can be used in both cartesian and polar charts, though not simultaneously.
+ To switch between chart types, you first need to remove the series and axes from the old chart, and then add
+ them to the new chart. If you want to preserve the axis ranges, those need to be copied, too.
+
+ \snippet polarchart/chartview.cpp 2
+
+*/
diff --git a/src/charts/doc/src/examples-qmlaxes.qdoc b/src/charts/doc/src/examples-qmlaxes.qdoc
new file mode 100644
index 00000000..88ab61fc
--- /dev/null
+++ b/src/charts/doc/src/examples-qmlaxes.qdoc
@@ -0,0 +1,32 @@
+/*!
+ \example qmlaxes
+ \title Qml Axes
+ \ingroup qtcharts_examples
+
+ \brief This is a demonstration of how to use axes in your QML application.
+
+ \table
+ \row
+ \li \br
+ We begin with a chart that has a line series and a scatter series with random
+ data. Both series use the same axes.
+ \br
+ \br
+ \snippet qmlaxes/qml/qmlaxes/View1.qml 1
+ \li \inlineimage examples_qmlaxes1.png
+ \row
+ \li \br
+ The next example shows a chart with some accurate historical data that makes us to use a DateTimeAxis.
+ \br
+ \br
+ \snippet qmlaxes/qml/qmlaxes/View2.qml 1
+ \li \inlineimage examples_qmlaxes2.png
+ \row
+ \li \br
+ And the final example with a chart that uses a CategoryAxis to make the data easier to understand.
+ \br
+ \br
+ \snippet qmlaxes/qml/qmlaxes/View3.qml 1
+ \li \inlineimage examples_qmlaxes3.png
+ \endtable
+*/
diff --git a/src/charts/doc/src/examples-qmlchart.qdoc b/src/charts/doc/src/examples-qmlchart.qdoc
new file mode 100644
index 00000000..8696461c
--- /dev/null
+++ b/src/charts/doc/src/examples-qmlchart.qdoc
@@ -0,0 +1,125 @@
+/*!
+ \example qmlchart
+ \title Qml charts example
+ \ingroup qtcharts_examples
+
+ \brief This basic demonstration shows how to use the different chart types by using qml.
+
+ Creating each chart type begins with the creation of a ChartView.
+
+ \table
+ \row
+ \li \br
+ To create a pie, we use the PieSeries API together with a few PieSlices:
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View1.qml 1
+ \li \inlineimage examples_qmlchart1.png
+ \endtable
+
+ \table
+ \row
+ \li \br
+ To create a chart with a line series:
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View2.qml 1
+ \li \inlineimage examples_qmlchart2.png
+ \endtable
+
+ \table
+ \row
+ \li \br
+ And spline series:
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View3.qml 1
+ \li \inlineimage examples_qmlchart3.png
+ \endtable
+
+ \table
+ \row
+ \li \br
+ Then we create a chart that illustrates the NHL All-Star player selections by using
+ three area series:
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View4.qml 1
+ \dots
+ \li \inlineimage examples_qmlchart4.png
+ \endtable
+
+ \table
+ \row
+ \li \br
+ Then a couple of scatter series:
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View5.qml 1
+ \dots
+ \li \inlineimage examples_qmlchart5.png
+ \endtable
+
+ And a few different bar series:
+ \table
+ \row
+ \li \br
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View6.qml 1
+ \li \inlineimage examples_qmlchart6.png
+ \endtable
+ \table
+ \row
+ \li \br
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View7.qml 1
+ \li \inlineimage examples_qmlchart7.png
+ \endtable
+ \table
+ \row
+ \li \br
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View8.qml 1
+ \li \inlineimage examples_qmlchart8.png
+ \endtable
+ \table
+ \row
+ \li \br
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View9.qml 1
+ \li \inlineimage examples_qmlchart9.png
+ \endtable
+ \table
+ \row
+ \li \br
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View10.qml 1
+ \li \inlineimage examples_qmlchart10.png
+ \endtable
+ \table
+ \row
+ \li \br
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View11.qml 1
+ \li \inlineimage examples_qmlchart11.png
+ \endtable
+
+ \table
+ \row
+ \li \br
+ And finally an example demonstrating how to create a donut chart with two pie
+ series:
+ \br
+ \br
+ \snippet qmlchart/qml/qmlchart/View12.qml 1
+ \li \inlineimage examples_qmlchart12.png
+ \endtable
+
+ Additionally, antialiasing is set with the qml property in Qt Quick 2.
+*/
diff --git a/src/charts/doc/src/examples-qmlcustomizations.qdoc b/src/charts/doc/src/examples-qmlcustomizations.qdoc
new file mode 100644
index 00000000..3d09009d
--- /dev/null
+++ b/src/charts/doc/src/examples-qmlcustomizations.qdoc
@@ -0,0 +1,28 @@
+/*!
+ \example qmlcustomizations
+ \title Qml Customizations
+ \ingroup qtcharts_examples
+
+ \image examples_qmlcustomizations.png
+
+ \brief This application shows you how to customize different visual properties of a ChartView
+ and series.
+
+ This example shows a wheel of fortune by customizing a pie series.
+
+ First we create the ChartView and a couple of series.
+ \snippet qmlcustomizations/qml/qmlcustomizations/main.qml 1
+
+ The application data is generated in Component.onCompleted of the main rectangle:
+ \snippet qmlcustomizations/qml/qmlcustomizations/main.qml 2
+
+ The following customizations are done repeatedly with a timer. To highlight one of the pie
+ slices at time we modify its exploded property:
+ \snippet qmlcustomizations/qml/qmlcustomizations/main.qml 3
+
+ Then an animation using a scatter series with one data point:
+ \snippet qmlcustomizations/qml/qmlcustomizations/main.qml 4
+
+ When the wheel of fortune has stopped, we make the active slice blink by modifying its colors.
+ \snippet qmlcustomizations/qml/qmlcustomizations/main.qml 5
+*/
diff --git a/src/charts/doc/src/examples-qmlcustomlegend.qdoc b/src/charts/doc/src/examples-qmlcustomlegend.qdoc
new file mode 100644
index 00000000..b8f307ef
--- /dev/null
+++ b/src/charts/doc/src/examples-qmlcustomlegend.qdoc
@@ -0,0 +1,43 @@
+/*!
+ \example qmlcustomlegend
+ \title Qml Custom Legend
+ \ingroup qtcharts_examples
+
+ \brief This example shows you how to create your own custom legend.
+
+ This application shows you how to create your own custom legend instead of using the
+ built-in legend of ChartView API.
+
+ \table
+ \row
+ \li \br
+ The main view of the application shows a stacked area chart. This is how one of
+ \br
+ the stacked areas is created. See ChartViewStacked.qml and AnimatedAreaSeries.qml.
+ \br
+ \br
+ \snippet qmlcustomlegend/qml/qmlcustomlegend/ChartViewStacked.qml 1
+ \li \inlineimage examples_qmlcustomlegend1.png
+ \row
+ \li \br
+ Hovering with mouse on top of the legend will highlight the hovered series.
+ \br
+ (see CustomLegend.qml).
+ \br
+ \br
+ \snippet qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml 1
+ \snippet qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml 2
+ \dots
+ \snippet qmlcustomlegend/qml/qmlcustomlegend/CustomLegend.qml 3
+ \li \inlineimage examples_qmlcustomlegend2.png
+ \row
+ \li \br
+ You can also select one of the stacked areas for a closer look as a line series by
+ \br
+ a mouse click (see ChartViewHighlighted.qml).
+ \br
+ \br
+ \snippet qmlcustomlegend/qml/qmlcustomlegend/ChartViewHighlighted.qml 1
+ \li \inlineimage examples_qmlcustomlegend3.png
+ \endtable
+*/
diff --git a/src/charts/doc/src/examples-qmlf1legends.qdoc b/src/charts/doc/src/examples-qmlf1legends.qdoc
new file mode 100644
index 00000000..da7a73b2
--- /dev/null
+++ b/src/charts/doc/src/examples-qmlf1legends.qdoc
@@ -0,0 +1,23 @@
+/*!
+ \example qmlf1legends
+ \title Qml F1 Legends
+ \ingroup qtcharts_examples
+
+ \image examples_qmlf1legends.png
+
+ \brief This application demonstrates how to use XmlListModel as a datasource for a Chart.
+
+ Let's define an empty ChartView first:
+ \snippet qmlf1legends/qml/qmlf1legends/main.qml 1
+
+ Our XmlListModel uses hard-coded test data. In a real application the data source would be a
+ timing system.
+ \snippet qmlf1legends/qml/qmlf1legends/SpeedsXml.qml 1
+ \dots
+ \snippet qmlf1legends/qml/qmlf1legends/SpeedsXml.qml 2
+ \snippet qmlf1legends/qml/qmlf1legends/main.qml 2
+
+ The data is parsed with a timer. The line series representing each driver are created on the
+ fly.
+ \snippet qmlf1legends/qml/qmlf1legends/main.qml 3
+*/
diff --git a/src/charts/doc/src/examples-qmloscilloscope.qdoc b/src/charts/doc/src/examples-qmloscilloscope.qdoc
new file mode 100644
index 00000000..eb6c5f43
--- /dev/null
+++ b/src/charts/doc/src/examples-qmloscilloscope.qdoc
@@ -0,0 +1,47 @@
+/*!
+ \example qmloscilloscope
+ \title QML Oscilloscope
+ \ingroup qtcharts_examples
+
+ \image examples_qmloscilloscope.png
+
+ \brief The example shows how to implement application with strict performance requirements
+ using the Qt Charts QML API.
+
+ The oscilloscope application demonstrates how to use the Qt Charts QML API to implement an
+ application with strict performance requirements. The application uses generated data with
+ configurable characteristics to mimic a simple oscilloscope user interface. To find out the
+ actual screen refresh performance of the application, you can set QML_SHOW_FRAMERATE = 1 to
+ your run environment settings to get the framerate shown in the application output console.
+ To do so go to Projects - Run - Run environment in Qt Creator and select Add. Then you can
+ experiment with the different configurable options of the example application to find the
+ configuration that gives you the best performance in your environment.
+
+ Note: You can try if enabling OpenGL improves the performance with the following startup
+ parameter:
+ \code
+ -graphicssystem opengl
+ \endcode
+
+ The application window is shared by control and scope views:
+ \snippet qmloscilloscope/qml/qmloscilloscope/main.qml 1
+ \dots
+ \snippet qmloscilloscope/qml/qmloscilloscope/main.qml 2
+
+ ControlView implements the buttons used for configuring. ScopeView uses a ChartView to show
+ a chart with two line series:
+ \snippet qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 1
+ \dots
+
+ The data of the line series is updated with a QML timer. In a real life application the
+ updating could be triggered with a signal from Qt C++ code.
+ \snippet qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 2
+
+ The oscilloscope also allows you to switch the type of the series used for visualizing the
+ signal sources. This is implemented by dynamically destroying and creating series:
+ \snippet qmloscilloscope/qml/qmloscilloscope/ScopeView.qml 3
+
+ \note QML_SHOW_FRAMERATE environment variable doesn't work with Qt Quick 2.
+ From Qt 5.1.0 on, the QSG_RENDER_TIMING environment variable can be used
+ similarly to display rendering time.
+*/
diff --git a/src/charts/doc/src/examples-qmlpolarchart.qdoc b/src/charts/doc/src/examples-qmlpolarchart.qdoc
new file mode 100644
index 00000000..59115cd1
--- /dev/null
+++ b/src/charts/doc/src/examples-qmlpolarchart.qdoc
@@ -0,0 +1,35 @@
+/*!
+ \example qmlpolarchart
+ \title Qml Polar Chart
+ \ingroup qtcharts_examples
+
+ \brief This is a demonstration on how to use a polar chart in your QML application.
+
+ \table
+ \row
+ \li \br
+ We begin with a chart that has a spline series and a scatter series with random
+ data. Both series use the same axes.
+ \br
+ \br
+ \snippet qmlpolarchart/qml/qmlpolarchart/View1.qml 1
+ \li \inlineimage examples_qmlpolarchart1.png
+ \row
+ \li \br
+ The next example shows a chart with some accurate historical data for which we need
+ to use a DateTimeAxis
+ and a AreaSeries.
+ \br
+ \br
+ \snippet qmlpolarchart/qml/qmlpolarchart/View2.qml 1
+ \li \inlineimage examples_qmlpolarchart2.png
+ \row
+ \li \br
+ And the final example with a chart that uses a CategoryAxis to make the data easier
+ to understand.
+ \br
+ \br
+ \snippet qmlpolarchart/qml/qmlpolarchart/View3.qml 1
+ \li \inlineimage examples_qmlpolarchart3.png
+ \endtable
+*/
diff --git a/src/charts/doc/src/examples-qmlweather.qdoc b/src/charts/doc/src/examples-qmlweather.qdoc
new file mode 100644
index 00000000..87e9010b
--- /dev/null
+++ b/src/charts/doc/src/examples-qmlweather.qdoc
@@ -0,0 +1,34 @@
+/*!
+ \example qmlweather
+ \title Qml Weather
+ \ingroup qtcharts_examples
+
+ \image examples_qmlweather.png
+
+ \brief This is a basic demonstration showing how to use the different chart types by using qml.
+
+ By default the application uses static test data to mimic a weather forecast. You can also
+ obtain an application id from http://www.worldweatheronline.com/ to get access to weather API
+ provided by World Weather Online. You can then give your application id as a parameter to the
+ Qml Weather executable to make it use live data.
+
+ For example:
+ \code
+ bin\qmlweather.exe 1234567890abcdef123456
+ \endcode
+
+ The example application uses a ChartView and a some series to visualize weather data:
+ \snippet qmlweather/qml/qmlweather/main.qml 1
+ \snippet qmlweather/qml/qmlweather/main.qml 2
+
+ To get data with weather forecast data, we make an HTTP GET request to World Weather Online. We
+ request the response in JSON data format.
+ \snippet qmlweather/qml/qmlweather/main.qml 3
+
+ The JSON response contains an array of forecast data:
+ \snippet qmlweather/qml/qmlweather/main.qml 4
+
+ That is then used as input data for our series and a ListModel we use as a container for weather
+ icon URLs:
+ \snippet qmlweather/qml/qmlweather/main.qml 5
+*/
diff --git a/src/charts/doc/src/examples-scatterchart.qdoc b/src/charts/doc/src/examples-scatterchart.qdoc
new file mode 100644
index 00000000..66ef518c
--- /dev/null
+++ b/src/charts/doc/src/examples-scatterchart.qdoc
@@ -0,0 +1,39 @@
+/*!
+ \example scatterchart
+ \title ScatterChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple scatter chart.
+
+ \image examples_scatterchart.png
+
+ To create scatter charts, a QScatterSeries instance is needed. Here we create a scatter series
+ instance, and set the type and width of outline for the scatter points.
+
+ \snippet scatterchart/chartview.cpp 1
+
+ We add the data to be shown. We can use the append() member function or use the stream operator.
+
+ \snippet scatterchart/chartview.cpp 2
+
+ We can define the brush of the scatter series to be an image. Here the image is a star created
+ using QPainterPath.
+
+ \snippet scatterchart/chartview.cpp 3
+
+ In the end we enable anti-aliasing, set the chart title, and add the scatter series onto the
+ chart. We also disable drop shadow, because it would not look good on an application with only
+ chart view shown.
+
+ \snippet scatterchart/chartview.cpp 4
+
+ The image used as a brush for the scatter series may contain several colors. Therefore we need
+ to set the desired color explicitly by setting the brush for the legend marker items.
+
+ \snippet scatterchart/chartview.cpp 5
+
+ The chart is ready to be shown.
+
+ \snippet scatterchart/main.cpp 4
+
+*/
diff --git a/src/charts/doc/src/examples-scatterinteractions.qdoc b/src/charts/doc/src/examples-scatterinteractions.qdoc
new file mode 100644
index 00000000..e616e086
--- /dev/null
+++ b/src/charts/doc/src/examples-scatterinteractions.qdoc
@@ -0,0 +1,10 @@
+/*!
+ \example scatterinteractions
+ \title ScatterInteractions Example
+ \ingroup qtcharts_examples
+
+ \brief This example shows how to create a simple scatter chart and how to interact with the
+ chart.
+
+ \image examples_scatterinteractions.png
+*/
diff --git a/src/charts/doc/src/examples-splinechart.qdoc b/src/charts/doc/src/examples-splinechart.qdoc
new file mode 100644
index 00000000..50c634fc
--- /dev/null
+++ b/src/charts/doc/src/examples-splinechart.qdoc
@@ -0,0 +1,34 @@
+/*!
+ \example splinechart
+ \title SplineChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple spline chart.
+
+ \image examples_splinechart.png
+
+ To create spline charts we need to put our data into QSplineSeries. QSplineSeries automatically
+ calculates spline segment control points that are needed to properly draw the spline.
+
+ \snippet splinechart/main.cpp 1
+
+ Now let's add some data points to the series.
+
+ \snippet splinechart/main.cpp 2
+
+ The data series has been populated. To display it on a chart we create a QChart object and add
+ the data series to it. We also set the title and the values range on the y-axis, so that our
+ chart's visibility is better.
+
+ \snippet splinechart/main.cpp 3
+
+ Then we create a QChartView object with QChart as a parameter. This way we don't need to create
+ a QGraphicsView scene ourselves. We also set the Antialiasing on to have the rendered lines
+ look nicer.
+
+ \snippet splinechart/main.cpp 4
+
+ Finally, we set the QChartView as the windows's central widget.
+
+ \snippet splinechart/main.cpp 5
+*/
diff --git a/src/charts/doc/src/examples-stackedbarchart.qdoc b/src/charts/doc/src/examples-stackedbarchart.qdoc
new file mode 100644
index 00000000..1e9d8928
--- /dev/null
+++ b/src/charts/doc/src/examples-stackedbarchart.qdoc
@@ -0,0 +1,53 @@
+/*!
+ \example stackedbarchart
+ \title StackedBarChart Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a simple stacked bar chart.
+
+ The stacked bar chart shows the data in sets as bars stacked on top of each other. The stacking
+ is done per category. The example shows how to create a simple stacked bar chart. Stacked bar
+ chart shows the data in sets as bars that are stacked on top of each other. The stacking is done
+ per category. Creating a stacked bar chart is just like creating a regular \l {BarChart Example}
+ {bar chart}, except that for a stacked bar chart, we use the QStackedBarSeries API instead of
+ QBarSeries.
+
+ \image examples_stackedbarchart.png
+
+ The barsets are used in same way in all barcharts.
+ To illustrate the difference between various barcharts, we use same data in all examples.
+ Data, which the barchart visualizes, is defined by the QBarSet instances. Here we create the sets and append data
+ to them. The data is appended here with << operator. Alternatively the append method could be used.
+
+ \snippet stackedbarchart/main.cpp 1
+
+ We create the series and append the barsets to it. The series takes ownership of the barsets. The series groups the data from sets to categories.
+ The first values of each set are grouped together in the first category, the second values in the second category etc.
+
+ \snippet stackedbarchart/main.cpp 2
+
+ Here we create the chart object and add the series to it. We set the title for the chart with setTitle, and then turn on animations of the series by calling
+ setAnimationOptions(QChart::SeriesAnimations).
+
+ \snippet stackedbarchart/main.cpp 3
+
+ To have categories displayed on the axis, we need to create a QBarCategoryAxis. Here we create a category axis with list of categories and
+ set it to be the x-axis of the chart. The chart takes ownership of the axis. For the y-axis we use default axis, which is created and scaled to series data
+ by calling createDefaultAxes of the chart. Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will
+ override the category axis.
+
+ \snippet stackedbarchart/main.cpp 4
+
+ We also want to show the legend. To do so, we get the legend pointer from the chart and set it to visible. We also place the legend to the bottom of the chart by setting its alignment to Qt::AlignBottom.
+
+ \snippet stackedbarchart/main.cpp 5
+
+ Finally, we add the chart onto a view. We also turn on the antialiasing for the chartView.
+
+ \snippet stackedbarchart/main.cpp 6
+
+ The chart is ready to be shown. We set the chart to be the central widget of the window.
+ We also set the size for the chart window and show it.
+
+ \snippet stackedbarchart/main.cpp 7
+*/
diff --git a/src/charts/doc/src/examples-stackedbarchartdrilldown.qdoc b/src/charts/doc/src/examples-stackedbarchartdrilldown.qdoc
new file mode 100644
index 00000000..0bfe5fd2
--- /dev/null
+++ b/src/charts/doc/src/examples-stackedbarchartdrilldown.qdoc
@@ -0,0 +1,50 @@
+/*!
+ \example stackedbarchartdrilldown
+ \title StackedBarChart Drilldown Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to implement drilldown using a stacked barchart.
+
+ In the drilldown example we create a stacked bar chart, which shows the harvest of various chili
+ peppers during season. In season view the harvest is grouped by month. To drill down to weekly
+ view, right-click the selected month. On weekly view, the harvest of the month clicked is shown
+ by week.
+
+ The season view looks like this:
+ \image examples_stackedbarchartdrilldown1.png
+
+ Clicking on a month shows that month's harvest:
+ \image examples_stackedbarchartdrilldown2.png
+
+ First we define a drilldown series class, which adds categories to the stacked bar series and mapping for categories to other drilldown series.
+ The purpose of the drilldown series is to contain knowledge of the drilldown structure. The mapDrilldownSeries function maps the category to a given series. We can request the mapping for a category with the drilldownSeries(int category) function.
+
+ \snippet stackedbarchartdrilldown/drilldownseries.h 1
+
+ Next we define our own drilldown chart, which implements the handler for the mouse click. All QBarSeries derived classes send out the clicked(QBarSet*, int) signal when a series is clicked with the mouse. The parameter QBarSet contains the pointer to the clicked bar set and parameter int contains the index of the clicked category.
+
+ \snippet stackedbarchartdrilldown/drilldownchart.h 1
+
+ Now we have our drilldown classes and we can start using them.
+ First create the chart.
+
+ \snippet stackedbarchartdrilldown/main.cpp 1
+
+ We define the categories from which the drilldown series will be constructed.
+
+ \snippet stackedbarchartdrilldown/main.cpp 2
+
+ To create the drilldown structure, we first create our top level series, which we call seasonSeries. For each month in seasonSeries we create a drilldown series called weeklySeries which contains more detailed data for that month.
+ In weeklySeries, we use the drilldown handler to bring us back to seasonSeries. To do so we add mapping to the series. The seasonSeries is mapped to weeklySeries for each month. Every weeklySeries is mapped back to the seasonSeries.
+ To make mapping work, we connect the clicked signals from our series to the drilldownChart.
+
+ \snippet stackedbarchartdrilldown/main.cpp 3
+
+ When we have our drilldown structure ready, we can add the data to it. Here we generate a random crop for each plant in each week. The monthly crop is calculated from weekly crops and is set as value to the monthly series.
+
+ \snippet stackedbarchartdrilldown/main.cpp 4
+
+ Here we set the chart to show the top level series initially.
+
+ \snippet stackedbarchartdrilldown/main.cpp 5
+*/
diff --git a/src/charts/doc/src/examples-temperaturerecords.qdoc b/src/charts/doc/src/examples-temperaturerecords.qdoc
new file mode 100644
index 00000000..ce1c5998
--- /dev/null
+++ b/src/charts/doc/src/examples-temperaturerecords.qdoc
@@ -0,0 +1,46 @@
+/*!
+ \example temperaturerecords
+ \title Temperature records example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create a bar chart with negative bars.
+
+ For our example we use temperature data.
+
+ \image examples_temperaturerecords.png
+
+ First we create two barsets and append the data to them. One set represents the minimum temperatures and another the maximum temperatures.
+
+ \snippet temperaturerecords/main.cpp 1
+
+ We create the series and append the barsets to it. The series takes ownership of the barsets.
+
+ \snippet temperaturerecords/main.cpp 2
+
+ Here we create the chart object and add the series to it. We set the title for the chart with setTitle, and then turn on animations of the series by calling
+ setAnimationOptions(QChart::SeriesAnimations)
+
+ \snippet temperaturerecords/main.cpp 3
+
+ To have categories displayed on an axis, we need to create a QBarCategoryAxis. Here we create a category axis with a list of categories and
+ set it to be the x-axis of the chart. The chart takes ownership of the axis. For y-axis we use the default axis, which is created and scaled to the series data
+ by calling createDefaultAxes of the chart. We change the range for the y-axis, since this gives nicer result than with autoscaling.
+
+ Note that the call for createDefaultAxes must be before we set the category axis. Otherwise the default axis will override the category axis.
+
+ \snippet temperaturerecords/main.cpp 4
+
+ We also want to show the legend. To do so, we get the legend pointer from the chart and set it to visible. We also place the legend to the bottom
+ of the chart by setting its alignment to Qt::AlignBottom.
+
+ \snippet temperaturerecords/main.cpp 5
+
+ Finally we add the chart onto a view. We also turn on the antialiasing for the chartView.
+
+ \snippet temperaturerecords/main.cpp 6
+
+ Chart is ready to be shown. We set the chart to be the central widget of the window.
+ We also set the size for the chart window and show it.
+
+ \snippet temperaturerecords/main.cpp 7
+*/
diff --git a/src/charts/doc/src/examples-zoomlinechart.qdoc b/src/charts/doc/src/examples-zoomlinechart.qdoc
new file mode 100644
index 00000000..f0ec866a
--- /dev/null
+++ b/src/charts/doc/src/examples-zoomlinechart.qdoc
@@ -0,0 +1,33 @@
+/*!
+ \example zoomlinechart
+ \title Zoom Line Example
+ \ingroup qtcharts_examples
+
+ \brief The example shows how to create your own custom zooming effect
+
+ The example shows how to create your own custom zooming effect with QRubberBand by using a mouse
+ and how to use touch gestures for paning and zooming.
+ \image examples_zoomlinechart1.png
+ \image examples_zoomlinechart2.png
+
+ Let's first create a line series with some example data.
+ \snippet zoomlinechart/main.cpp 1
+
+ Then we create a custom chart view by deriving from QChartView:
+ \snippet zoomlinechart/chartview.h 1
+
+ We override mouse and key event handling
+ \snippet zoomlinechart/chartview.h 2
+
+ Then we implement a custom logic for mouse and key events. For example pressing the '+' key will zoom in and pressing
+ the '-' key will zoom out.
+ \snippet zoomlinechart/chartview.cpp 1
+
+ We also create our own QChart:
+ \snippet zoomlinechart/chart.h 1
+
+ Where we can handle the gestures:
+ \snippet zoomlinechart/chart.cpp 1
+
+ Note that you will need to call grabGesture() to both QMainWindow and QChart.
+*/
diff --git a/src/charts/doc/src/index.qdoc b/src/charts/doc/src/index.qdoc
new file mode 100644
index 00000000..15408f24
--- /dev/null
+++ b/src/charts/doc/src/index.qdoc
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtCharts module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+/*!
+ \title Qt Charts
+ \page index.html
+ \keyword About
+
+ Qt Charts is a part of the Qt Enterprise addons package. It provides a set of easy to use chart
+ components which are available for Qt customers. It uses the Qt Graphics View
+ Framework, therefore charts can be easily integrated to modern user interfaces. Qt Charts can
+ be used as QWidgets, QGraphicsWidget, or QML types. Users can easily create impressive
+ graphs by selecting one of the charts themes.
+
+ \section1 Getting Started
+
+ To import Qt Charts QML types, add the following import statement to your \c .qml file:
+
+ \snippet doc_src_qmlcharts.cpp 0
+
+ If you intend to use Qt Charts C++ classes in your application, use the
+ following include and using directives:
+
+ \snippet doc_src_qtcharts.cpp 0
+
+ \note If you are only using a few classes from this module, we recommend including only those
+ specific classes instead of the whole module.
+
+ To link against the Qt Charts module, add this line to your \c qmake project file:
+
+ \snippet doc_src_qtcharts.pro 0
+
+ See the \l{Qt Charts Getting Started}{Getting started} page for further information on
+ how to use Qt Charts in your application.
+
+ \section1 References
+ \list
+ \li \l{Qt Charts C++ Classes}
+ \li \l{Qt Charts QML Types}
+ \endlist
+
+ Qt Charts comes with the following examples:
+
+ \annotatedlist qtcharts_examples
+
+*/
diff --git a/src/charts/doc/src/qtcharts.qdoc b/src/charts/doc/src/qtcharts.qdoc
new file mode 100644
index 00000000..16194833
--- /dev/null
+++ b/src/charts/doc/src/qtcharts.qdoc
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the QtCharts module.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+**
+****************************************************************************/
+
+/*!
+ \module Qt Charts
+ \title Qt Charts C++ Classes
+ \ingroup modules
+
+ \brief C++ classes for the Qt Charts API.
+
+ Charts API is built on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using the QChart class. However
+ there is also the convenience class QChartView, which is QWidget based. These enable us to quickly use Qt Charts as a normal Qt widget.
+
+ Each chart type is represented by the QAbstractSeries derived class. To create charts, the users have to use an instance of the related
+ series class and add it to a QChart instance.
+ \code
+ QLineSeries* series = new QLineSeries();
+ series->add(0, 6);
+ series->add(2, 4);
+ ...
+ chartView->chart()->addSeries(series);
+ chartView->chart()->createDefaultAxes();
+ \endcode
+*/
+
+/*!
+ \qmlmodule QtCharts 2.0
+ \title Qt Charts QML Types
+ \ingroup qmlmodules
+
+ \brief QML types for the Qt Charts API.
+
+ The Qt Charts QML API is an intuitive and simple way to show charts in your QML
+ applications.
+
+ \table
+ \row
+ \li \br
+ Use the following QML to create a simple pie chart:
+ \br
+ \br
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 1
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 2
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 3
+ \li \inlineimage examples_qmlpiechart.png
+ \endtable
+
+ \note Since Qt Creator 3.0 the project created with Qt Quick Application wizard based on
+ Qt Quick 2 template uses QGuiApplication by default. As Qt Charts utilizes Qt Graphics View
+ Framework for drawing, QApplication must be used. The project created with the wizard is
+ usable with Qt Charts after the QGuiApplication is replaced with QApplication.
+
+ \section1 QML Types
+*/
+
+/*!
+ \group charts_examples
+ \ingroup all-examples
+ \title Qt Charts Examples
+
+ \brief Examples for the Qt Charts.
+
+ For some code examples, see one of the Qt Charts examples:
+
+ \section1 Examples
+
+ \annotatedlist qtcharts_examples
+*/
+
+/*!
+ \group qtcharts_getting_started
+ \title Qt Charts Getting Started
+
+ \section1 Installing the Qt Charts module
+
+ Use the \c {Package Manager} in \c {Maintenance Tool} or the \c {Online installer} to install
+ the Qt Charts module. The module can be found under \c {Qt Enterprise Add-Ons} in the
+ package manager.
+
+ After installation Qt Charts documentation and examples are available in Qt Creator.
+ Examples can be found on the examples page of Qt Creator by selecting the Qt Charts
+ component from the drop-down menu.
+
+ The source code is installed into the QtCharts folder under EnterpriseAddOns.
+
+ \section1 Building Qt Charts
+
+ To build the Qt Charts module from source code yourself, set up a command prompt with
+ an environment for building Qt applications, navigate to the directory containing
+ \c {qtcharts.pro}, and configure the project with qmake:
+ \code
+ qmake
+ \endcode
+
+ After running qmake, build the project with make:
+ \table
+ \header
+ \li OS \li Make command
+ \row
+ \li Linux \li make
+ \row
+ \li Windows (MinGw) \li mingw32-make
+ \row
+ \li Windows (MSVC) \li nmake
+ \row
+ \li OSX \li make
+ \endtable
+
+ The above generates the default makefiles for your configuration, which is typically
+ the release build if you are using precompiled binary Qt distribution. To build both debug
+ and release, or one specifically, use one of the following qmake lines instead.
+
+ For debug builds:
+ \code
+ qmake CONFIG+=debug
+ make
+ \endcode
+ or
+ \code
+ qmake CONFIG+=debug_and_release
+ make debug
+ \endcode
+
+ For release builds:
+ \code
+ qmake CONFIG+=release
+ make
+ \endcode
+ or
+ \code
+ qmake CONFIG+=debug_and_release
+ make release
+ \endcode
+
+ For both builds (Windows/OS X only):
+ \code
+ qmake CONFIG+="debug_and_release build_all"
+ make
+ \endcode
+
+ After building, install the module to your Qt directory:
+ \code
+ make install
+ \endcode
+
+ If you want to uninstall the module:
+ \code
+ make uninstall
+ \endcode
+
+ To build a statically linked version of the Qt Charts module, give the following commands:
+
+ \snippet doc_src_qtcharts.cpp 1
+
+ \section1 Running examples
+
+ Qt Charts examples are found under the \c examples subdirectory. To build and run a single
+ example, in this case qmlpolarchart, navigate to the example directory and enter the following
+ commands:
+
+ \snippet doc_src_qtcharts.cpp 2
+
+ \note On some platforms, such as Windows, the executable can be generated under debug or
+ release folders, depending on your build.
+
+ \section1 Creating a simple application
+
+ To create a simple application, start by creating a new Qt Gui Application project in Qt
+ Creator and add this line to the \c .pro file of the project:
+
+ \snippet doc_src_qtcharts.pro 0
+
+ In the \c main.cpp file, include the module headers and declare namespace usage:
+
+ \snippet doc_src_qtcharts.cpp 0
+
+ \note Since Qt Creator 3.0 the project created with Qt Quick Application wizard based on
+ Qt Quick 2 template uses QGuiApplication by default. As Qt Charts utilizes Qt Graphics View
+ Framework for drawing, QApplication must be used. The project created with the wizard is
+ usable with Qt Charts after the QGuiApplication is replaced with QApplication.
+
+ For further code examples, see one of the Qt Charts examples:
+
+ \annotatedlist qtcharts_examples
+*/
diff --git a/doc/style/offline.css b/src/charts/doc/style/offline.css
index 7a728b49..7a728b49 100644
--- a/doc/style/offline.css
+++ b/src/charts/doc/style/offline.css
diff --git a/src/charts/domain/abstractdomain.cpp b/src/charts/domain/abstractdomain.cpp
new file mode 100644
index 00000000..c16e46d5
--- /dev/null
+++ b/src/charts/domain/abstractdomain.cpp
@@ -0,0 +1,265 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "abstractdomain_p.h"
+#include "qabstractaxis_p.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+AbstractDomain::AbstractDomain(QObject *parent)
+ : QObject(parent),
+ m_minX(0),
+ m_maxX(0),
+ m_minY(0),
+ m_maxY(0),
+ m_signalsBlocked(false),
+ m_zoomed(false),
+ m_zoomResetMinX(0),
+ m_zoomResetMaxX(0),
+ m_zoomResetMinY(0),
+ m_zoomResetMaxY(0)
+
+{
+}
+
+AbstractDomain::~AbstractDomain()
+{
+}
+
+void AbstractDomain::setSize(const QSizeF &size)
+{
+ if (m_size != size) {
+ m_size=size;
+ emit updated();
+ }
+}
+
+QSizeF AbstractDomain::size() const
+{
+ return m_size;
+}
+
+void AbstractDomain::setRangeX(qreal min, qreal max)
+{
+ setRange(min, max, m_minY, m_maxY);
+}
+
+void AbstractDomain::setRangeY(qreal min, qreal max)
+{
+ setRange(m_minX, m_maxX, min, max);
+}
+
+void AbstractDomain::setMinX(qreal min)
+{
+ setRange(min, m_maxX, m_minY, m_maxY);
+}
+
+void AbstractDomain::setMaxX(qreal max)
+{
+ setRange(m_minX, max, m_minY, m_maxY);
+}
+
+void AbstractDomain::setMinY(qreal min)
+{
+ setRange(m_minX, m_maxX, min, m_maxY);
+}
+
+void AbstractDomain::setMaxY(qreal max)
+{
+ setRange(m_minX, m_maxX, m_minY, max);
+}
+
+qreal AbstractDomain::spanX() const
+{
+ Q_ASSERT(m_maxX >= m_minX);
+ return m_maxX - m_minX;
+}
+
+qreal AbstractDomain::spanY() const
+{
+ Q_ASSERT(m_maxY >= m_minY);
+ return m_maxY - m_minY;
+}
+
+bool AbstractDomain::isEmpty() const
+{
+ return qFuzzyCompare(spanX(), 0) || qFuzzyCompare(spanY(), 0) || m_size.isEmpty();
+}
+
+QPointF AbstractDomain::calculateDomainPoint(const QPointF &point) const
+{
+ const qreal deltaX = m_size.width() / (m_maxX - m_minX);
+ const qreal deltaY = m_size.height() / (m_maxY - m_minY);
+ qreal x = point.x() / deltaX + m_minX;
+ qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY;
+ return QPointF(x, y);
+}
+
+// handlers
+
+void AbstractDomain::handleVerticalAxisRangeChanged(qreal min, qreal max)
+{
+ setRangeY(min, max);
+}
+
+void AbstractDomain::handleHorizontalAxisRangeChanged(qreal min, qreal max)
+{
+ setRangeX(min, max);
+}
+
+void AbstractDomain::blockRangeSignals(bool block)
+{
+ if (m_signalsBlocked!=block) {
+ m_signalsBlocked=block;
+ if (!block) {
+ emit rangeHorizontalChanged(m_minX,m_maxX);
+ emit rangeVerticalChanged(m_minY,m_maxY);
+ }
+ }
+}
+
+void AbstractDomain::zoomReset()
+{
+ if (m_zoomed) {
+ setRange(m_zoomResetMinX,
+ m_zoomResetMaxX,
+ m_zoomResetMinY,
+ m_zoomResetMaxY);
+ m_zoomed = false;
+ }
+}
+
+void AbstractDomain::storeZoomReset()
+{
+ if (!m_zoomed) {
+ m_zoomed = true;
+ m_zoomResetMinX = m_minX;
+ m_zoomResetMaxX = m_maxX;
+ m_zoomResetMinY = m_minY;
+ m_zoomResetMaxY = m_maxY;
+ }
+}
+
+//algorithm defined by Paul S.Heckbert GraphicalGems I
+
+void AbstractDomain::looseNiceNumbers(qreal &min, qreal &max, int &ticksCount)
+{
+ qreal range = niceNumber(max - min, true); //range with ceiling
+ qreal step = niceNumber(range / (ticksCount - 1), false);
+ min = qFloor(min / step);
+ max = qCeil(max / step);
+ ticksCount = int(max - min) + 1;
+ min *= step;
+ max *= step;
+}
+
+//nice numbers can be expressed as form of 1*10^n, 2* 10^n or 5*10^n
+
+qreal AbstractDomain::niceNumber(qreal x, bool ceiling)
+{
+ qreal z = qPow(10, qFloor(log10(x))); //find corresponding number of the form of 10^n than is smaller than x
+ qreal q = x / z; //q<10 && q>=1;
+
+ if (ceiling) {
+ if (q <= 1.0) q = 1;
+ else if (q <= 2.0) q = 2;
+ else if (q <= 5.0) q = 5;
+ else q = 10;
+ } else {
+ if (q < 1.5) q = 1;
+ else if (q < 3.0) q = 2;
+ else if (q < 7.0) q = 5;
+ else q = 10;
+ }
+ return q * z;
+}
+
+bool AbstractDomain::attachAxis(QAbstractAxis *axis)
+{
+ if (axis->orientation() == Qt::Vertical) {
+ QObject::connect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), this, SLOT(handleVerticalAxisRangeChanged(qreal,qreal)));
+ QObject::connect(this, SIGNAL(rangeVerticalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal)));
+ }
+
+ if (axis->orientation() == Qt::Horizontal) {
+ QObject::connect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), this, SLOT(handleHorizontalAxisRangeChanged(qreal,qreal)));
+ QObject::connect(this, SIGNAL(rangeHorizontalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal)));
+ }
+
+ return true;
+}
+
+bool AbstractDomain::detachAxis(QAbstractAxis *axis)
+{
+ if (axis->orientation() == Qt::Vertical) {
+ QObject::disconnect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), this, SLOT(handleVerticalAxisRangeChanged(qreal,qreal)));
+ QObject::disconnect(this, SIGNAL(rangeVerticalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal)));
+ }
+
+ if (axis->orientation() == Qt::Horizontal) {
+ QObject::disconnect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), this, SLOT(handleHorizontalAxisRangeChanged(qreal,qreal)));
+ QObject::disconnect(this, SIGNAL(rangeHorizontalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal)));
+ }
+
+ return true;
+}
+
+// operators
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2)
+{
+ return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
+ && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
+ && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
+ && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
+}
+
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2)
+{
+ return !(domain1 == domain2);
+}
+
+
+QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain)
+{
+#ifdef QT_NO_TEXTSTREAM
+ Q_UNUSED(domain)
+#else
+ dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
+#endif
+ return dbg.maybeSpace();
+}
+
+// This function adjusts min/max ranges to failsafe values if negative/zero values are attempted.
+void AbstractDomain::adjustLogDomainRanges(qreal &min, qreal &max)
+{
+ if (min <= 0) {
+ min = 1.0;
+ if (max <= min)
+ max = min + 1.0;
+ }
+}
+
+
+#include "moc_abstractdomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/abstractdomain_p.h b/src/charts/domain/abstractdomain_p.h
new file mode 100644
index 00000000..dfd4025f
--- /dev/null
+++ b/src/charts/domain/abstractdomain_p.h
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef ABSTRACTDOMAIN_H
+#define ABSTRACTDOMAIN_H
+#include "qchartglobal.h"
+#include <QRectF>
+#include <QSizeF>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractAxis;
+
+class QT_CHARTS_AUTOTEST_EXPORT AbstractDomain: public QObject
+{
+ Q_OBJECT
+public:
+ enum DomainType { UndefinedDomain,
+ XYDomain,
+ XLogYDomain,
+ LogXYDomain,
+ LogXLogYDomain,
+ XYPolarDomain,
+ XLogYPolarDomain,
+ LogXYPolarDomain,
+ LogXLogYPolarDomain };
+public:
+ explicit AbstractDomain(QObject *object = 0);
+ virtual ~AbstractDomain();
+
+ virtual void setSize(const QSizeF &size);
+ QSizeF size() const;
+
+ virtual DomainType type() = 0;
+
+ virtual void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) = 0;
+ void setRangeX(qreal min, qreal max);
+ void setRangeY(qreal min, qreal max);
+ void setMinX(qreal min);
+ void setMaxX(qreal max);
+ void setMinY(qreal min);
+ void setMaxY(qreal max);
+
+ qreal minX() const { return m_minX; }
+ qreal maxX() const { return m_maxX; }
+ qreal minY() const { return m_minY; }
+ qreal maxY() const { return m_maxY; }
+
+ qreal spanX() const;
+ qreal spanY() const;
+ bool isEmpty() const;
+
+ void blockRangeSignals(bool block);
+ bool rangeSignalsBlocked() const { return m_signalsBlocked; }
+
+ void zoomReset();
+ void storeZoomReset();
+ bool isZoomed() { return m_zoomed; }
+
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2);
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2);
+ friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain);
+
+ virtual void zoomIn(const QRectF &rect) = 0;
+ virtual void zoomOut(const QRectF &rect) = 0;
+ virtual void move(qreal dx, qreal dy) = 0;
+
+ virtual QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const = 0;
+ virtual QPointF calculateDomainPoint(const QPointF &point) const = 0;
+ virtual QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const = 0;
+
+ virtual bool attachAxis(QAbstractAxis *axis);
+ virtual bool detachAxis(QAbstractAxis *axis);
+
+ static void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount);
+ static qreal niceNumber(qreal x, bool ceiling);
+
+Q_SIGNALS:
+ void updated();
+ void rangeHorizontalChanged(qreal min, qreal max);
+ void rangeVerticalChanged(qreal min, qreal max);
+
+public Q_SLOTS:
+ void handleVerticalAxisRangeChanged(qreal min,qreal max);
+ void handleHorizontalAxisRangeChanged(qreal min,qreal max);
+
+protected:
+ void adjustLogDomainRanges(qreal &min, qreal &max);
+
+ qreal m_minX;
+ qreal m_maxX;
+ qreal m_minY;
+ qreal m_maxY;
+ QSizeF m_size;
+ bool m_signalsBlocked;
+ bool m_zoomed;
+ qreal m_zoomResetMinX;
+ qreal m_zoomResetMaxX;
+ qreal m_zoomResetMinY;
+ qreal m_zoomResetMaxY;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // ABSTRACTDOMAIN_H
diff --git a/src/domain/domain.pri b/src/charts/domain/domain.pri
index ab4fcfce..ab4fcfce 100644
--- a/src/domain/domain.pri
+++ b/src/charts/domain/domain.pri
diff --git a/src/charts/domain/logxlogydomain.cpp b/src/charts/domain/logxlogydomain.cpp
new file mode 100644
index 00000000..a2e781e3
--- /dev/null
+++ b/src/charts/domain/logxlogydomain.cpp
@@ -0,0 +1,278 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "logxlogydomain_p.h"
+#include "qabstractaxis_p.h"
+#include "qlogvalueaxis.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+LogXLogYDomain::LogXLogYDomain(QObject *parent)
+ : AbstractDomain(parent),
+ m_logLeftX(0),
+ m_logRightX(1),
+ m_logBaseX(10),
+ m_logLeftY(0),
+ m_logRightY(1),
+ m_logBaseY(10)
+{
+}
+
+LogXLogYDomain::~LogXLogYDomain()
+{
+}
+
+void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
+{
+ bool axisXChanged = false;
+ bool axisYChanged = false;
+
+ adjustLogDomainRanges(minX, maxX);
+ adjustLogDomainRanges(minY, maxY);
+
+ if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) {
+ m_minX = minX;
+ m_maxX = maxX;
+ axisXChanged = true;
+ qreal logMinX = log10(m_minX) / log10(m_logBaseX);
+ qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
+ m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
+ m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
+ if(!m_signalsBlocked)
+ emit rangeHorizontalChanged(m_minX, m_maxX);
+ }
+
+ if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
+ m_minY = minY;
+ m_maxY = maxY;
+ axisYChanged = true;
+ qreal logMinY = log10(m_minY) / log10(m_logBaseY);
+ qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
+ m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
+ m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
+ if (!m_signalsBlocked)
+ emit rangeVerticalChanged(m_minY, m_maxY);
+ }
+
+ if (axisXChanged || axisYChanged)
+ emit updated();
+}
+
+void LogXLogYDomain::zoomIn(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal logLeftX = rect.left() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
+ qreal logRightX = rect.right() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
+ qreal leftX = qPow(m_logBaseX, logLeftX);
+ qreal rightX = qPow(m_logBaseX, logRightX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal logLeftY = m_logRightY - rect.bottom() * (m_logRightY - m_logLeftY) / m_size.height();
+ qreal logRightY = m_logRightY - rect.top() * (m_logRightY - m_logLeftY) / m_size.height();
+ qreal leftY = qPow(m_logBaseY, logLeftY);
+ qreal rightY = qPow(m_logBaseY, logRightY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void LogXLogYDomain::zoomOut(const QRectF &rect)
+{
+ storeZoomReset();
+ const qreal factorX = m_size.width() / rect.width();
+ const qreal factorY = m_size.height() / rect.height();
+
+ qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 - factorX);
+ qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 + factorX);
+ qreal leftX = qPow(m_logBaseX, logLeftX);
+ qreal rightX = qPow(m_logBaseX, logRIghtX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal newLogMinY = m_logLeftY + (m_logRightY - m_logLeftY) / 2 * (1 - factorY);
+ qreal newLogMaxY = m_logLeftY + (m_logRightY - m_logLeftY) / 2 * (1 + factorY);
+ qreal leftY = qPow(m_logBaseY, newLogMinY);
+ qreal rightY = qPow(m_logBaseY, newLogMaxY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void LogXLogYDomain::move(qreal dx, qreal dy)
+{
+ qreal stepX = dx * qAbs(m_logRightX - m_logLeftX) / m_size.width();
+ qreal leftX = qPow(m_logBaseX, m_logLeftX + stepX);
+ qreal rightX = qPow(m_logBaseX, m_logRightX + stepX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal stepY = dy * (m_logRightY - m_logLeftY) / m_size.height();
+ qreal leftY = qPow(m_logBaseY, m_logLeftY + stepY);
+ qreal rightY = qPow(m_logBaseY, m_logRightY + stepY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+QPointF LogXLogYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
+{
+ const qreal deltaX = m_size.width() / qAbs(m_logRightX - m_logLeftX);
+ const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
+ qreal x(0);
+ qreal y(0);
+ if (point.x() > 0 && point.y() > 0) {
+ x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
+ y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
+ ok = true;
+ } else {
+ qWarning() << "Logarithms of zero and negative values are undefined.";
+ ok = false;
+ if (point.x() > 0)
+ x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
+ else
+ x = 0;
+ if (point.y() > 0) {
+ y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY
+ + m_size.height();
+ } else {
+ y = m_size.height();
+ }
+ }
+ return QPointF(x, y);
+}
+
+QVector<QPointF> LogXLogYDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
+{
+ const qreal deltaX = m_size.width() / qAbs(m_logRightX - m_logLeftX);
+ const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
+
+ QVector<QPointF> result;
+ result.resize(vector.count());
+
+ for (int i = 0; i < vector.count(); ++i) {
+ if (vector[i].x() > 0 && vector[i].y() > 0) {
+ qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
+ qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
+ result[i].setX(x);
+ result[i].setY(y);
+ } else {
+ qWarning() << "Logarithms of zero and negative values are undefined.";
+ return QVector<QPointF>();
+ }
+ }
+ return result;
+}
+
+QPointF LogXLogYDomain::calculateDomainPoint(const QPointF &point) const
+{
+ const qreal deltaX = m_size.width() / qAbs(m_logRightX - m_logLeftX);
+ const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
+ qreal x = qPow(m_logBaseX, m_logLeftX + point.x() / deltaX);
+ qreal y = qPow(m_logBaseY, m_logLeftY + (m_size.height() - point.y()) / deltaY);
+ return QPointF(x, y);
+}
+
+bool LogXLogYDomain::attachAxis(QAbstractAxis *axis)
+{
+ AbstractDomain::attachAxis(axis);
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Vertical) {
+ QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
+ handleVerticalAxisBaseChanged(logAxis->base());
+ }
+
+ if (logAxis && logAxis->orientation() == Qt::Horizontal) {
+ QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
+ handleHorizontalAxisBaseChanged(logAxis->base());
+ }
+
+ return true;
+}
+
+bool LogXLogYDomain::detachAxis(QAbstractAxis *axis)
+{
+ AbstractDomain::detachAxis(axis);
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Vertical)
+ QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
+
+ if (logAxis && logAxis->orientation() == Qt::Horizontal)
+ QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
+
+ return true;
+}
+
+void LogXLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
+{
+ m_logBaseY = baseY;
+ qreal logMinY = log10(m_minY) / log10(m_logBaseY);
+ qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
+ m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
+ m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
+ emit updated();
+}
+
+void LogXLogYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
+{
+ m_logBaseX = baseX;
+ qreal logMinX = log10(m_minX) / log10(m_logBaseX);
+ qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
+ m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
+ m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
+ emit updated();
+}
+
+// operators
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2)
+{
+ return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
+ && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
+ && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
+ && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
+}
+
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2)
+{
+ return !(domain1 == domain2);
+}
+
+
+QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYDomain &domain)
+{
+#ifdef QT_NO_TEXTSTREAM
+ Q_UNUSED(domain)
+#else
+ dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
+#endif
+ return dbg.maybeSpace();
+}
+
+#include "moc_logxlogydomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/logxlogydomain_p.h b/src/charts/domain/logxlogydomain_p.h
new file mode 100644
index 00000000..eeb7d7f2
--- /dev/null
+++ b/src/charts/domain/logxlogydomain_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef LOGXLOGYDOMAIN_H
+#define LOGXLOGYDOMAIN_H
+#include "abstractdomain_p.h"
+#include <QRectF>
+#include <QSizeF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QT_CHARTS_AUTOTEST_EXPORT LogXLogYDomain: public AbstractDomain
+{
+ Q_OBJECT
+public:
+ explicit LogXLogYDomain(QObject *object = 0);
+ virtual ~LogXLogYDomain();
+
+ DomainType type(){ return AbstractDomain::LogXLogYDomain;}
+
+ void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
+
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
+ friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYDomain &domain);
+
+ void zoomIn(const QRectF &rect);
+ void zoomOut(const QRectF &rect);
+ void move(qreal dx, qreal dy);
+
+ QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
+ QPointF calculateDomainPoint(const QPointF &point) const;
+ QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
+
+ bool attachAxis(QAbstractAxis *axis);
+ bool detachAxis(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ void handleVerticalAxisBaseChanged(qreal baseY);
+ void handleHorizontalAxisBaseChanged(qreal baseX);
+
+private:
+ qreal m_logLeftX;
+ qreal m_logRightX;
+ qreal m_logBaseX;
+ qreal m_logLeftY;
+ qreal m_logRightY;
+ qreal m_logBaseY;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // LOGXLOGYDOMAIN_H
diff --git a/src/charts/domain/logxlogypolardomain.cpp b/src/charts/domain/logxlogypolardomain.cpp
new file mode 100644
index 00000000..33d8eff9
--- /dev/null
+++ b/src/charts/domain/logxlogypolardomain.cpp
@@ -0,0 +1,273 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "logxlogypolardomain_p.h"
+#include "qabstractaxis_p.h"
+#include "qlogvalueaxis.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+LogXLogYPolarDomain::LogXLogYPolarDomain(QObject *parent)
+ : PolarDomain(parent),
+ m_logLeftX(0),
+ m_logRightX(1),
+ m_logBaseX(10),
+ m_logInnerY(0),
+ m_logOuterY(1),
+ m_logBaseY(10)
+{
+}
+
+LogXLogYPolarDomain::~LogXLogYPolarDomain()
+{
+}
+
+void LogXLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
+{
+ bool axisXChanged = false;
+ bool axisYChanged = false;
+
+ adjustLogDomainRanges(minX, maxX);
+ adjustLogDomainRanges(minY, maxY);
+
+ if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
+ m_minX = minX;
+ m_maxX = maxX;
+ axisXChanged = true;
+ qreal logMinX = log10(m_minX) / log10(m_logBaseX);
+ qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
+ m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
+ m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
+ if (!m_signalsBlocked)
+ emit rangeHorizontalChanged(m_minX, m_maxX);
+ }
+
+ if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
+ m_minY = minY;
+ m_maxY = maxY;
+ axisYChanged = true;
+ qreal logMinY = log10(m_minY) / log10(m_logBaseY);
+ qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
+ m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
+ m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
+ if (!m_signalsBlocked)
+ emit rangeVerticalChanged(m_minY, m_maxY);
+ }
+
+ if (axisXChanged || axisYChanged)
+ emit updated();
+}
+
+void LogXLogYPolarDomain::zoomIn(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal logLeftX = rect.left() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
+ qreal logRightX = rect.right() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
+ qreal leftX = qPow(m_logBaseX, logLeftX);
+ qreal rightX = qPow(m_logBaseX, logRightX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal logLeftY = m_logOuterY - rect.bottom() * (m_logOuterY - m_logInnerY) / m_size.height();
+ qreal logRightY = m_logOuterY - rect.top() * (m_logOuterY - m_logInnerY) / m_size.height();
+ qreal leftY = qPow(m_logBaseY, logLeftY);
+ qreal rightY = qPow(m_logBaseY, logRightY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void LogXLogYPolarDomain::zoomOut(const QRectF &rect)
+{
+ storeZoomReset();
+ const qreal factorX = m_size.width() / rect.width();
+
+ qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2.0 * (1.0 - factorX);
+ qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2.0 * (1.0 + factorX);
+ qreal leftX = qPow(m_logBaseX, logLeftX);
+ qreal rightX = qPow(m_logBaseX, logRIghtX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ const qreal factorY = m_size.height() / rect.height();
+ qreal newLogMinY = m_logInnerY + (m_logOuterY - m_logInnerY) / 2.0 * (1.0 - factorY);
+ qreal newLogMaxY = m_logInnerY + (m_logOuterY - m_logInnerY) / 2.0 * (1.0 + factorY);
+ qreal leftY = qPow(m_logBaseY, newLogMinY);
+ qreal rightY = qPow(m_logBaseY, newLogMaxY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void LogXLogYPolarDomain::move(qreal dx, qreal dy)
+{
+ qreal stepX = dx * (m_logRightX - m_logLeftX) / m_size.width();
+ qreal leftX = qPow(m_logBaseX, m_logLeftX + stepX);
+ qreal rightX = qPow(m_logBaseX, m_logRightX + stepX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal stepY = dy * (m_logOuterY - m_logInnerY) / m_radius;
+ qreal leftY = qPow(m_logBaseY, m_logInnerY + stepY);
+ qreal rightY = qPow(m_logBaseY, m_logOuterY + stepY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+qreal LogXLogYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
+{
+ qreal retVal;
+ if (value <= 0) {
+ ok = false;
+ retVal = 0.0;
+ } else {
+ ok = true;
+ const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX);
+ const qreal logValue = log10(value) / log10(m_logBaseX);
+ const qreal valueDelta = logValue - m_logLeftX;
+
+ retVal = valueDelta * tickSpan;
+ }
+ return retVal;
+}
+
+qreal LogXLogYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
+{
+ qreal retVal;
+ if (value <= 0) {
+ ok = false;
+ retVal = 0.0;
+ } else {
+ ok = true;
+ const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY);
+ const qreal logValue = log10(value) / log10(m_logBaseY);
+ const qreal valueDelta = logValue - m_logInnerY;
+
+ retVal = valueDelta * tickSpan;
+
+ if (retVal < 0.0)
+ retVal = 0.0;
+ }
+ return retVal;
+}
+
+QPointF LogXLogYPolarDomain::calculateDomainPoint(const QPointF &point) const
+{
+ if (point == m_center)
+ return QPointF(0.0, m_minY);
+
+ QLineF line(m_center, point);
+ qreal a = 90.0 - line.angle();
+ if (a < 0.0)
+ a += 360.0;
+
+ const qreal deltaX = 360.0 / qAbs(m_logRightX - m_logLeftX);
+ a = qPow(m_logBaseX, m_logLeftX + (a / deltaX));
+
+ const qreal deltaY = m_radius / qAbs(m_logOuterY - m_logInnerY);
+ qreal r = qPow(m_logBaseY, m_logInnerY + (line.length() / deltaY));
+
+ return QPointF(a, r);
+}
+
+bool LogXLogYPolarDomain::attachAxis(QAbstractAxis *axis)
+{
+ AbstractDomain::attachAxis(axis);
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Horizontal) {
+ QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
+ handleHorizontalAxisBaseChanged(logAxis->base());
+ } else if (logAxis && logAxis->orientation() == Qt::Vertical){
+ QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
+ handleVerticalAxisBaseChanged(logAxis->base());
+ }
+
+ return true;
+}
+
+bool LogXLogYPolarDomain::detachAxis(QAbstractAxis *axis)
+{
+ AbstractDomain::detachAxis(axis);
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Horizontal)
+ QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
+ else if (logAxis && logAxis->orientation() == Qt::Vertical)
+ QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
+
+ return true;
+}
+
+void LogXLogYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX)
+{
+ m_logBaseX = baseX;
+ qreal logMinX = log10(m_minX) / log10(m_logBaseX);
+ qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
+ m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
+ m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
+ emit updated();
+}
+
+void LogXLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY)
+{
+ m_logBaseY = baseY;
+ qreal logMinY = log10(m_minY) / log10(m_logBaseY);
+ qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
+ m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
+ m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
+ emit updated();
+}
+
+// operators
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2)
+{
+ return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
+ && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
+ && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
+ && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
+}
+
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2)
+{
+ return !(domain1 == domain2);
+}
+
+
+QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYPolarDomain &domain)
+{
+#ifdef QT_NO_TEXTSTREAM
+ Q_UNUSED(domain)
+#else
+ dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
+#endif
+ return dbg.maybeSpace();
+}
+
+#include "moc_logxlogypolardomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/logxlogypolardomain_p.h b/src/charts/domain/logxlogypolardomain_p.h
new file mode 100644
index 00000000..853e5d3c
--- /dev/null
+++ b/src/charts/domain/logxlogypolardomain_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef LOGXLOGYPOLARDOMAIN_H
+#define LOGXLOGYPOLARDOMAIN_H
+#include "polardomain_p.h"
+#include <QRectF>
+#include <QSizeF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QT_CHARTS_AUTOTEST_EXPORT LogXLogYPolarDomain: public PolarDomain
+{
+ Q_OBJECT
+public:
+ explicit LogXLogYPolarDomain(QObject *object = 0);
+ virtual ~LogXLogYPolarDomain();
+
+ DomainType type() { return AbstractDomain::LogXLogYPolarDomain; }
+
+ void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
+
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2);
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2);
+ friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYPolarDomain &domain);
+
+ void zoomIn(const QRectF &rect);
+ void zoomOut(const QRectF &rect);
+ void move(qreal dx, qreal dy);
+
+ QPointF calculateDomainPoint(const QPointF &point) const;
+
+ bool attachAxis(QAbstractAxis *axis);
+ bool detachAxis(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ void handleVerticalAxisBaseChanged(qreal baseY);
+ void handleHorizontalAxisBaseChanged(qreal baseX);
+
+protected:
+ qreal toAngularCoordinate(qreal value, bool &ok) const;
+ qreal toRadialCoordinate(qreal value, bool &ok) const;
+
+private:
+ qreal m_logLeftX;
+ qreal m_logRightX;
+ qreal m_logBaseX;
+ qreal m_logInnerY;
+ qreal m_logOuterY;
+ qreal m_logBaseY;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // LOGXLOGYPOLARDOMAIN_H
diff --git a/src/charts/domain/logxydomain.cpp b/src/charts/domain/logxydomain.cpp
new file mode 100644
index 00000000..2901bd26
--- /dev/null
+++ b/src/charts/domain/logxydomain.cpp
@@ -0,0 +1,245 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "logxydomain_p.h"
+#include "qabstractaxis_p.h"
+#include "qlogvalueaxis.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+LogXYDomain::LogXYDomain(QObject *parent)
+ : AbstractDomain(parent),
+ m_logLeftX(0),
+ m_logRightX(1),
+ m_logBaseX(10)
+{
+}
+
+LogXYDomain::~LogXYDomain()
+{
+}
+
+void LogXYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
+{
+ bool axisXChanged = false;
+ bool axisYChanged = false;
+
+ adjustLogDomainRanges(minX, maxX);
+
+ if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
+ m_minX = minX;
+ m_maxX = maxX;
+ axisXChanged = true;
+ qreal logMinX = log10(m_minX) / log10(m_logBaseX);
+ qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
+ m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
+ m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
+ if(!m_signalsBlocked)
+ emit rangeHorizontalChanged(m_minX, m_maxX);
+ }
+
+ if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
+ m_minY = minY;
+ m_maxY = maxY;
+ axisYChanged = true;
+ if (!m_signalsBlocked)
+ emit rangeVerticalChanged(m_minY, m_maxY);
+ }
+
+ if (axisXChanged || axisYChanged)
+ emit updated();
+}
+
+void LogXYDomain::zoomIn(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal logLeftX = rect.left() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
+ qreal logRightX = rect.right() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
+ qreal leftX = qPow(m_logBaseX, logLeftX);
+ qreal rightX = qPow(m_logBaseX, logRightX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal dy = spanY() / m_size.height();
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ minY = maxY - dy * rect.bottom();
+ maxY = maxY - dy * rect.top();
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void LogXYDomain::zoomOut(const QRectF &rect)
+{
+ storeZoomReset();
+ const qreal factorX = m_size.width() / rect.width();
+
+ qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 - factorX);
+ qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 + factorX);
+ qreal leftX = qPow(m_logBaseX, logLeftX);
+ qreal rightX = qPow(m_logBaseX, logRIghtX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal dy = spanY() / rect.height();
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ maxY = minY + dy * rect.bottom();
+ minY = maxY - dy * m_size.height();
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void LogXYDomain::move(qreal dx, qreal dy)
+{
+ qreal stepX = dx * (m_logRightX - m_logLeftX) / m_size.width();
+ qreal leftX = qPow(m_logBaseX, m_logLeftX + stepX);
+ qreal rightX = qPow(m_logBaseX, m_logRightX + stepX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal y = spanY() / m_size.height();
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ if (dy != 0) {
+ minY = minY + y * dy;
+ maxY = maxY + y * dy;
+ }
+ setRange(minX, maxX, minY, maxY);
+}
+
+QPointF LogXYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
+{
+ const qreal deltaX = m_size.width() / (m_logRightX - m_logLeftX);
+ const qreal deltaY = m_size.height() / (m_maxY - m_minY);
+
+ qreal x(0);
+ qreal y = (point.y() - m_minY) * -deltaY + m_size.height();
+ if (point.x() > 0) {
+ x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
+ ok = true;
+ } else {
+ x = 0;
+ qWarning() << "Logarithms of zero and negative values are undefined.";
+ ok = false;
+ }
+ return QPointF(x, y);
+}
+
+QVector<QPointF> LogXYDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
+{
+ const qreal deltaX = m_size.width() / (m_logRightX - m_logLeftX);
+ const qreal deltaY = m_size.height() / (m_maxY - m_minY);
+
+ QVector<QPointF> result;
+ result.resize(vector.count());
+
+ for (int i = 0; i < vector.count(); ++i) {
+ if (vector[i].x() > 0) {
+ qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
+ qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height();
+ result[i].setX(x);
+ result[i].setY(y);
+ } else {
+ qWarning() << "Logarithms of zero and negative values are undefined.";
+ return QVector<QPointF>();
+ }
+
+ }
+ return result;
+}
+
+QPointF LogXYDomain::calculateDomainPoint(const QPointF &point) const
+{
+ const qreal deltaX = m_size.width() / (m_logRightX - m_logLeftX);
+ const qreal deltaY = m_size.height() / (m_maxY - m_minY);
+ qreal x = qPow(m_logBaseX, m_logLeftX + point.x() / deltaX);
+ qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY;
+ return QPointF(x, y);
+}
+
+bool LogXYDomain::attachAxis(QAbstractAxis *axis)
+{
+ AbstractDomain::attachAxis(axis);
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Horizontal) {
+ QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
+ handleHorizontalAxisBaseChanged(logAxis->base());
+ }
+
+ return true;
+}
+
+bool LogXYDomain::detachAxis(QAbstractAxis *axis)
+{
+ AbstractDomain::detachAxis(axis);
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Horizontal)
+ QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
+
+ return true;
+}
+
+void LogXYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
+{
+ m_logBaseX = baseX;
+ qreal logMinX = log10(m_minX) / log10(m_logBaseX);
+ qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
+ m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
+ m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
+ emit updated();
+}
+
+// operators
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2)
+{
+ return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
+ && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
+ && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
+ && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
+}
+
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXYDomain &domain1, const LogXYDomain &domain2)
+{
+ return !(domain1 == domain2);
+}
+
+
+QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYDomain &domain)
+{
+#ifdef QT_NO_TEXTSTREAM
+ Q_UNUSED(domain)
+#else
+ dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
+#endif
+ return dbg.maybeSpace();
+}
+
+#include "moc_logxydomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/logxydomain_p.h b/src/charts/domain/logxydomain_p.h
new file mode 100644
index 00000000..a9b507c4
--- /dev/null
+++ b/src/charts/domain/logxydomain_p.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef LOGXYDOMAIN_H
+#define LOGXYDOMAIN_H
+#include "abstractdomain_p.h"
+#include <QRectF>
+#include <QSizeF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QT_CHARTS_AUTOTEST_EXPORT LogXYDomain: public AbstractDomain
+{
+ Q_OBJECT
+public:
+ explicit LogXYDomain(QObject *object = 0);
+ virtual ~LogXYDomain();
+
+ DomainType type(){ return AbstractDomain::LogXYDomain;}
+
+ void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
+
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2);
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXYDomain &domain1, const LogXYDomain &domain2);
+ friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYDomain &domain);
+
+ void zoomIn(const QRectF &rect);
+ void zoomOut(const QRectF &rect);
+ void move(qreal dx, qreal dy);
+
+ QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
+ QPointF calculateDomainPoint(const QPointF &point) const;
+ QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
+
+ bool attachAxis(QAbstractAxis *axis);
+ bool detachAxis(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ void handleHorizontalAxisBaseChanged(qreal baseX);
+
+private:
+ qreal m_logLeftX;
+ qreal m_logRightX;
+ qreal m_logBaseX;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // LOGXYDOMAIN_H
diff --git a/src/charts/domain/logxypolardomain.cpp b/src/charts/domain/logxypolardomain.cpp
new file mode 100644
index 00000000..bcbac505
--- /dev/null
+++ b/src/charts/domain/logxypolardomain.cpp
@@ -0,0 +1,242 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "logxypolardomain_p.h"
+#include "qabstractaxis_p.h"
+#include "qlogvalueaxis.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+LogXYPolarDomain::LogXYPolarDomain(QObject *parent)
+ : PolarDomain(parent),
+ m_logLeftX(0),
+ m_logRightX(1),
+ m_logBaseX(10)
+{
+}
+
+LogXYPolarDomain::~LogXYPolarDomain()
+{
+}
+
+void LogXYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
+{
+ bool axisXChanged = false;
+ bool axisYChanged = false;
+
+ adjustLogDomainRanges(minX, maxX);
+
+ if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
+ m_minX = minX;
+ m_maxX = maxX;
+ axisXChanged = true;
+ qreal logMinX = log10(m_minX) / log10(m_logBaseX);
+ qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
+ m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
+ m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
+ if (!m_signalsBlocked)
+ emit rangeHorizontalChanged(m_minX, m_maxX);
+ }
+
+ if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
+ m_minY = minY;
+ m_maxY = maxY;
+ axisYChanged = true;
+ if (!m_signalsBlocked)
+ emit rangeVerticalChanged(m_minY, m_maxY);
+ }
+
+ if (axisXChanged || axisYChanged)
+ emit updated();
+}
+
+void LogXYPolarDomain::zoomIn(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal logLeftX = rect.left() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
+ qreal logRightX = rect.right() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
+ qreal leftX = qPow(m_logBaseX, logLeftX);
+ qreal rightX = qPow(m_logBaseX, logRightX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal dy = spanY() / m_size.height();
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ minY = maxY - dy * rect.bottom();
+ maxY = maxY - dy * rect.top();
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void LogXYPolarDomain::zoomOut(const QRectF &rect)
+{
+ storeZoomReset();
+ const qreal factorX = m_size.width() / rect.width();
+
+ qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2.0 * (1.0 - factorX);
+ qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2.0 * (1.0 + factorX);
+ qreal leftX = qPow(m_logBaseX, logLeftX);
+ qreal rightX = qPow(m_logBaseX, logRIghtX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal dy = spanY() / rect.height();
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ maxY = minY + dy * rect.bottom();
+ minY = maxY - dy * m_size.height();
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void LogXYPolarDomain::move(qreal dx, qreal dy)
+{
+ qreal stepX = dx * (m_logRightX - m_logLeftX) / m_size.width();
+ qreal leftX = qPow(m_logBaseX, m_logLeftX + stepX);
+ qreal rightX = qPow(m_logBaseX, m_logRightX + stepX);
+ qreal minX = leftX < rightX ? leftX : rightX;
+ qreal maxX = leftX > rightX ? leftX : rightX;
+
+ qreal y = spanY() / m_radius;
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ if (dy != 0) {
+ minY = minY + y * dy;
+ maxY = maxY + y * dy;
+ }
+ setRange(minX, maxX, minY, maxY);
+}
+
+qreal LogXYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
+{
+ qreal retVal;
+ if (value <= 0) {
+ ok = false;
+ retVal = 0.0;
+ } else {
+ ok = true;
+ const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX);
+ const qreal logValue = log10(value) / log10(m_logBaseX);
+ const qreal valueDelta = logValue - m_logLeftX;
+
+ retVal = valueDelta * tickSpan;
+ }
+ return retVal;
+}
+
+qreal LogXYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
+{
+ ok = true;
+ if (value < m_minY)
+ value = m_minY;
+
+ // Dont limit the max. The drawing should clip the stuff that goes out of the grid
+ qreal f = (value - m_minY) / (m_maxY - m_minY);
+
+ return f * m_radius;
+}
+
+QPointF LogXYPolarDomain::calculateDomainPoint(const QPointF &point) const
+{
+ if (point == m_center)
+ return QPointF(0.0, m_minY);
+
+ QLineF line(m_center, point);
+ qreal a = 90.0 - line.angle();
+ if (a < 0.0)
+ a += 360.0;
+
+ const qreal deltaX = 360.0 / qAbs(m_logRightX - m_logLeftX);
+ a = qPow(m_logBaseX, m_logLeftX + (a / deltaX));
+
+ qreal r = m_minY + ((m_maxY - m_minY) * (line.length() / m_radius));
+
+ return QPointF(a, r);
+}
+
+bool LogXYPolarDomain::attachAxis(QAbstractAxis *axis)
+{
+ AbstractDomain::attachAxis(axis);
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Horizontal) {
+ QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
+ handleHorizontalAxisBaseChanged(logAxis->base());
+ }
+
+ return true;
+}
+
+bool LogXYPolarDomain::detachAxis(QAbstractAxis *axis)
+{
+ AbstractDomain::detachAxis(axis);
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Horizontal)
+ QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
+
+ return true;
+}
+
+void LogXYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX)
+{
+ m_logBaseX = baseX;
+ qreal logMinX = log10(m_minX) / log10(m_logBaseX);
+ qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
+ m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
+ m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
+ emit updated();
+}
+
+// operators
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2)
+{
+ return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
+ && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
+ && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
+ && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
+}
+
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2)
+{
+ return !(domain1 == domain2);
+}
+
+
+QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYPolarDomain &domain)
+{
+#ifdef QT_NO_TEXTSTREAM
+ Q_UNUSED(domain)
+#else
+ dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
+#endif
+ return dbg.maybeSpace();
+}
+
+#include "moc_logxypolardomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/logxypolardomain_p.h b/src/charts/domain/logxypolardomain_p.h
new file mode 100644
index 00000000..6234b593
--- /dev/null
+++ b/src/charts/domain/logxypolardomain_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef LOGXYPOLARDOMAIN_H
+#define LOGXYPOLARDOMAIN_H
+#include "polardomain_p.h"
+#include <QRectF>
+#include <QSizeF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QT_CHARTS_AUTOTEST_EXPORT LogXYPolarDomain: public PolarDomain
+{
+ Q_OBJECT
+public:
+ explicit LogXYPolarDomain(QObject *object = 0);
+ virtual ~LogXYPolarDomain();
+
+ DomainType type() { return AbstractDomain::LogXYPolarDomain; }
+
+ void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
+
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2);
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2);
+ friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYPolarDomain &domain);
+
+ void zoomIn(const QRectF &rect);
+ void zoomOut(const QRectF &rect);
+ void move(qreal dx, qreal dy);
+
+ QPointF calculateDomainPoint(const QPointF &point) const;
+
+ bool attachAxis(QAbstractAxis *axis);
+ bool detachAxis(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ void handleHorizontalAxisBaseChanged(qreal baseX);
+
+protected:
+ qreal toAngularCoordinate(qreal value, bool &ok) const;
+ qreal toRadialCoordinate(qreal value, bool &ok) const;
+
+private:
+ qreal m_logLeftX;
+ qreal m_logRightX;
+ qreal m_logBaseX;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // LOGXYPOLARDOMAIN_H
diff --git a/src/charts/domain/polardomain.cpp b/src/charts/domain/polardomain.cpp
new file mode 100644
index 00000000..1c01071e
--- /dev/null
+++ b/src/charts/domain/polardomain.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polardomain_p.h"
+#include "qabstractaxis_p.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PolarDomain::PolarDomain(QObject *parent)
+ : AbstractDomain(parent)
+{
+}
+
+PolarDomain::~PolarDomain()
+{
+}
+
+void PolarDomain::setSize(const QSizeF &size)
+{
+ Q_ASSERT(size.width() == size.height());
+ m_radius = size.height() / 2.0;
+ m_center = QPointF(m_radius, m_radius);
+ AbstractDomain::setSize(size);
+}
+
+QPointF PolarDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
+{
+ qreal r = 0.0;
+ qreal a = toAngularCoordinate(point.x(), ok);
+ if (ok)
+ r = toRadialCoordinate(point.y(), ok);
+ if (ok) {
+ return m_center + polarCoordinateToPoint(a, r);
+ } else {
+ qWarning() << "Logarithm of negative value is undefined. Empty layout returned.";
+ return QPointF();
+ }
+}
+
+QVector<QPointF> PolarDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
+{
+ QVector<QPointF> result;
+ result.resize(vector.count());
+ bool ok;
+ qreal r = 0.0;
+ qreal a = 0.0;
+
+ for (int i = 0; i < vector.count(); ++i) {
+ a = toAngularCoordinate(vector[i].x(), ok);
+ if (ok)
+ r = toRadialCoordinate(vector[i].y(), ok);
+ if (ok) {
+ result[i] = m_center + polarCoordinateToPoint(a, r);
+ } else {
+ qWarning() << "Logarithm of negative value is undefined. Empty layout returned.";
+ return QVector<QPointF>();
+ }
+ }
+
+ return result;
+}
+
+QPointF PolarDomain::polarCoordinateToPoint(qreal angularCoordinate, qreal radialCoordinate) const
+{
+ qreal dx = qSin(angularCoordinate * (M_PI / 180)) * radialCoordinate;
+ qreal dy = qCos(angularCoordinate * (M_PI / 180)) * radialCoordinate;
+
+ return QPointF(dx, -dy);
+}
+
+#include "moc_polardomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/polardomain_p.h b/src/charts/domain/polardomain_p.h
new file mode 100644
index 00000000..06c2993c
--- /dev/null
+++ b/src/charts/domain/polardomain_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARDOMAIN_H
+#define POLARDOMAIN_H
+#include "abstractdomain_p.h"
+#include <QRectF>
+#include <QSizeF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QT_CHARTS_AUTOTEST_EXPORT PolarDomain: public AbstractDomain
+{
+ Q_OBJECT
+public:
+ explicit PolarDomain(QObject *object = 0);
+ virtual ~PolarDomain();
+
+ void setSize(const QSizeF &size);
+
+ QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
+ QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
+
+ virtual qreal toAngularCoordinate(qreal value, bool &ok) const = 0;
+ virtual qreal toRadialCoordinate(qreal value, bool &ok) const = 0;
+
+protected:
+ QPointF polarCoordinateToPoint(qreal angularCoordinate, qreal radialCoordinate) const;
+
+ QPointF m_center;
+ qreal m_radius;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARDOMAIN_H
diff --git a/src/charts/domain/xlogydomain.cpp b/src/charts/domain/xlogydomain.cpp
new file mode 100644
index 00000000..d13bbb67
--- /dev/null
+++ b/src/charts/domain/xlogydomain.cpp
@@ -0,0 +1,241 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "xlogydomain_p.h"
+#include "qabstractaxis_p.h"
+#include "qlogvalueaxis.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+XLogYDomain::XLogYDomain(QObject *parent)
+ : AbstractDomain(parent),
+ m_logLeftY(0),
+ m_logRightY(1),
+ m_logBaseY(10)
+{
+}
+
+XLogYDomain::~XLogYDomain()
+{
+}
+
+void XLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
+{
+ bool axisXChanged = false;
+ bool axisYChanged = false;
+
+ adjustLogDomainRanges(minY, maxY);
+
+ if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) {
+ m_minX = minX;
+ m_maxX = maxX;
+ axisXChanged = true;
+ if(!m_signalsBlocked)
+ emit rangeHorizontalChanged(m_minX, m_maxX);
+ }
+
+ if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
+ m_minY = minY;
+ m_maxY = maxY;
+ axisYChanged = true;
+ qreal logMinY = log10(m_minY) / log10(m_logBaseY);
+ qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
+ m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
+ m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
+ if (!m_signalsBlocked)
+ emit rangeVerticalChanged(m_minY, m_maxY);
+ }
+
+ if (axisXChanged || axisYChanged)
+ emit updated();
+}
+
+void XLogYDomain::zoomIn(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal dx = spanX() / m_size.width();
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+
+ maxX = minX + dx * rect.right();
+ minX = minX + dx * rect.left();
+
+ qreal logLeftY = m_logRightY - rect.bottom() * (m_logRightY - m_logLeftY) / m_size.height();
+ qreal logRightY = m_logRightY - rect.top() * (m_logRightY - m_logLeftY) / m_size.height();
+ qreal leftY = qPow(m_logBaseY, logLeftY);
+ qreal rightY = qPow(m_logBaseY, logRightY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void XLogYDomain::zoomOut(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal dx = spanX() / rect.width();
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+
+ minX = maxX - dx * rect.right();
+ maxX = minX + dx * m_size.width();
+
+ const qreal factorY = m_size.height() / rect.height();
+ qreal newLogMinY = m_logLeftY + (m_logRightY - m_logLeftY) / 2 * (1 - factorY);
+ qreal newLogMaxY = m_logLeftY + (m_logRightY - m_logLeftY) / 2 * (1 + factorY);
+ qreal leftY = qPow(m_logBaseY, newLogMinY);
+ qreal rightY = qPow(m_logBaseY, newLogMaxY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void XLogYDomain::move(qreal dx, qreal dy)
+{
+ qreal x = spanX() / m_size.width();
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+
+ if (dx != 0) {
+ minX = minX + x * dx;
+ maxX = maxX + x * dx;
+ }
+
+ qreal stepY = dy * (m_logRightY - m_logLeftY) / m_size.height();
+ qreal leftY = qPow(m_logBaseY, m_logLeftY + stepY);
+ qreal rightY = qPow(m_logBaseY, m_logRightY + stepY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+QPointF XLogYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
+{
+ const qreal deltaX = m_size.width() / (m_maxX - m_minX);
+ const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
+
+ qreal x = (point.x() - m_minX) * deltaX;
+ qreal y(0);
+ if (point.y() > 0) {
+ y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
+ ok = true;
+ } else {
+ y = m_size.height();
+ qWarning() << "Logarithms of zero and negative values are undefined.";
+ ok = false;
+ }
+ return QPointF(x, y);
+}
+
+QVector<QPointF> XLogYDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
+{
+ const qreal deltaX = m_size.width() / (m_maxX - m_minX);
+ const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
+
+ QVector<QPointF> result;
+ result.resize(vector.count());
+
+ for (int i = 0; i < vector.count(); ++i) {
+ if (vector[i].y() > 0) {
+ qreal x = (vector[i].x() - m_minX) * deltaX;
+ qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
+ result[i].setX(x);
+ result[i].setY(y);
+ } else {
+ qWarning() << "Logarithms of zero and negative values are undefined.";
+ return QVector<QPointF>();
+ }
+ }
+ return result;
+}
+
+QPointF XLogYDomain::calculateDomainPoint(const QPointF &point) const
+{
+ const qreal deltaX = m_size.width() / (m_maxX - m_minX);
+ const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
+ qreal x = point.x() / deltaX + m_minX;
+ qreal y = qPow(m_logBaseY, m_logLeftY + (m_size.height() - point.y()) / deltaY);
+ return QPointF(x, y);
+}
+
+bool XLogYDomain::attachAxis(QAbstractAxis *axis)
+{
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Vertical) {
+ QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
+ handleVerticalAxisBaseChanged(logAxis->base());
+ }
+ return AbstractDomain::attachAxis(axis);
+}
+
+bool XLogYDomain::detachAxis(QAbstractAxis *axis)
+{
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Vertical)
+ QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
+
+ return AbstractDomain::detachAxis(axis);
+}
+
+void XLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
+{
+ m_logBaseY = baseY;
+ qreal logMinY = log10(m_minY) / log10(m_logBaseY);
+ qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
+ m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
+ m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
+ emit updated();
+}
+
+// operators
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2)
+{
+ return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
+ && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
+ && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
+ && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
+}
+
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XLogYDomain &domain1, const XLogYDomain &domain2)
+{
+ return !(domain1 == domain2);
+}
+
+
+QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYDomain &domain)
+{
+#ifdef QT_NO_TEXTSTREAM
+ Q_UNUSED(domain)
+#else
+ dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
+#endif
+ return dbg.maybeSpace();
+}
+
+#include "moc_xlogydomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/xlogydomain_p.h b/src/charts/domain/xlogydomain_p.h
new file mode 100644
index 00000000..8d14d4a7
--- /dev/null
+++ b/src/charts/domain/xlogydomain_p.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef XLOGYDOMAIN_H
+#define XLOGYDOMAIN_H
+#include "abstractdomain_p.h"
+#include <QRectF>
+#include <QSizeF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QT_CHARTS_AUTOTEST_EXPORT XLogYDomain: public AbstractDomain
+{
+ Q_OBJECT
+public:
+ explicit XLogYDomain(QObject *object = 0);
+ virtual ~XLogYDomain();
+
+ DomainType type(){ return AbstractDomain::XLogYDomain;};
+
+ void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
+
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2);
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XLogYDomain &domain1, const XLogYDomain &domain2);
+ friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYDomain &domain);
+
+ void zoomIn(const QRectF &rect);
+ void zoomOut(const QRectF &rect);
+ void move(qreal dx, qreal dy);
+
+ QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
+ QPointF calculateDomainPoint(const QPointF &point) const;
+ QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
+
+ bool attachAxis(QAbstractAxis *axis);
+ bool detachAxis(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ void handleVerticalAxisBaseChanged(qreal baseY);
+
+private:
+ qreal m_logLeftY;
+ qreal m_logRightY;
+ qreal m_logBaseY;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // XLOGYDOMAIN_H
diff --git a/src/charts/domain/xlogypolardomain.cpp b/src/charts/domain/xlogypolardomain.cpp
new file mode 100644
index 00000000..76c92c51
--- /dev/null
+++ b/src/charts/domain/xlogypolardomain.cpp
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "xlogypolardomain_p.h"
+#include "qabstractaxis_p.h"
+#include "qlogvalueaxis.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+XLogYPolarDomain::XLogYPolarDomain(QObject *parent)
+ : PolarDomain(parent),
+ m_logInnerY(0),
+ m_logOuterY(1),
+ m_logBaseY(10)
+{
+}
+
+XLogYPolarDomain::~XLogYPolarDomain()
+{
+}
+
+void XLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
+{
+ bool axisXChanged = false;
+ bool axisYChanged = false;
+
+ adjustLogDomainRanges(minY, maxY);
+
+ if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) {
+ m_minX = minX;
+ m_maxX = maxX;
+ axisXChanged = true;
+ if (!m_signalsBlocked)
+ emit rangeHorizontalChanged(m_minX, m_maxX);
+ }
+
+ if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
+ m_minY = minY;
+ m_maxY = maxY;
+ axisYChanged = true;
+ qreal logMinY = log10(m_minY) / log10(m_logBaseY);
+ qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
+ m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
+ m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
+ if (!m_signalsBlocked)
+ emit rangeVerticalChanged(m_minY, m_maxY);
+ }
+
+ if (axisXChanged || axisYChanged)
+ emit updated();
+}
+
+void XLogYPolarDomain::zoomIn(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal dx = spanX() / m_size.width();
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+
+ maxX = minX + dx * rect.right();
+ minX = minX + dx * rect.left();
+
+ qreal logLeftY = m_logOuterY - rect.bottom() * (m_logOuterY - m_logInnerY) / m_size.height();
+ qreal logRightY = m_logOuterY - rect.top() * (m_logOuterY - m_logInnerY) / m_size.height();
+ qreal leftY = qPow(m_logBaseY, logLeftY);
+ qreal rightY = qPow(m_logBaseY, logRightY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void XLogYPolarDomain::zoomOut(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal dx = spanX() / rect.width();
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+
+ minX = maxX - dx * rect.right();
+ maxX = minX + dx * m_size.width();
+
+ const qreal factorY = m_size.height() / rect.height();
+ qreal newLogMinY = m_logInnerY + (m_logOuterY - m_logInnerY) / 2.0 * (1.0 - factorY);
+ qreal newLogMaxY = m_logInnerY + (m_logOuterY - m_logInnerY) / 2.0 * (1.0 + factorY);
+ qreal leftY = qPow(m_logBaseY, newLogMinY);
+ qreal rightY = qPow(m_logBaseY, newLogMaxY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void XLogYPolarDomain::move(qreal dx, qreal dy)
+{
+ qreal x = spanX() / 360.0;
+
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+
+ if (dx != 0) {
+ minX = minX + x * dx;
+ maxX = maxX + x * dx;
+ }
+
+ qreal stepY = dy * (m_logOuterY - m_logInnerY) / m_radius;
+ qreal leftY = qPow(m_logBaseY, m_logInnerY + stepY);
+ qreal rightY = qPow(m_logBaseY, m_logOuterY + stepY);
+ qreal minY = leftY < rightY ? leftY : rightY;
+ qreal maxY = leftY > rightY ? leftY : rightY;
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+qreal XLogYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
+{
+ ok = true;
+ qreal f = (value - m_minX) / (m_maxX - m_minX);
+ return f * 360.0;
+}
+
+qreal XLogYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
+{
+ qreal retVal;
+ if (value <= 0) {
+ ok = false;
+ retVal = 0.0;
+ } else {
+ ok = true;
+ const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY);
+ const qreal logValue = log10(value) / log10(m_logBaseY);
+ const qreal valueDelta = logValue - m_logInnerY;
+
+ retVal = valueDelta * tickSpan;
+
+ if (retVal < 0.0)
+ retVal = 0.0;
+ }
+ return retVal;
+}
+
+QPointF XLogYPolarDomain::calculateDomainPoint(const QPointF &point) const
+{
+ if (point == m_center)
+ return QPointF(0.0, m_minY);
+
+ QLineF line(m_center, point);
+ qreal a = 90.0 - line.angle();
+ if (a < 0.0)
+ a += 360.0;
+ a = ((a / 360.0) * (m_maxX - m_minX)) + m_minX;
+
+ const qreal deltaY = m_radius / qAbs(m_logOuterY - m_logInnerY);
+ qreal r = qPow(m_logBaseY, m_logInnerY + (line.length() / deltaY));
+
+ return QPointF(a, r);
+}
+
+bool XLogYPolarDomain::attachAxis(QAbstractAxis *axis)
+{
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Vertical) {
+ QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
+ handleVerticalAxisBaseChanged(logAxis->base());
+ }
+ return AbstractDomain::attachAxis(axis);
+}
+
+bool XLogYPolarDomain::detachAxis(QAbstractAxis *axis)
+{
+ QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
+
+ if (logAxis && logAxis->orientation() == Qt::Vertical)
+ QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
+
+ return AbstractDomain::detachAxis(axis);
+}
+
+void XLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY)
+{
+ m_logBaseY = baseY;
+ qreal logMinY = log10(m_minY) / log10(m_logBaseY);
+ qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
+ m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
+ m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
+ emit updated();
+}
+
+// operators
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2)
+{
+ return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
+ && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
+ && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
+ && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
+}
+
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2)
+{
+ return !(domain1 == domain2);
+}
+
+
+QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYPolarDomain &domain)
+{
+#ifdef QT_NO_TEXTSTREAM
+ Q_UNUSED(domain)
+#else
+ dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
+#endif
+ return dbg.maybeSpace();
+}
+
+#include "moc_xlogypolardomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/xlogypolardomain_p.h b/src/charts/domain/xlogypolardomain_p.h
new file mode 100644
index 00000000..5beace20
--- /dev/null
+++ b/src/charts/domain/xlogypolardomain_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef XLOGYPOLARDOMAIN_H
+#define XLOGYPOLARDOMAIN_H
+#include "polardomain_p.h"
+#include <QRectF>
+#include <QSizeF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QT_CHARTS_AUTOTEST_EXPORT XLogYPolarDomain: public PolarDomain
+{
+ Q_OBJECT
+public:
+ explicit XLogYPolarDomain(QObject *object = 0);
+ virtual ~XLogYPolarDomain();
+
+ DomainType type() { return AbstractDomain::XLogYPolarDomain; }
+
+ void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
+
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2);
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2);
+ friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYPolarDomain &domain);
+
+ void zoomIn(const QRectF &rect);
+ void zoomOut(const QRectF &rect);
+ void move(qreal dx, qreal dy);
+
+ QPointF calculateDomainPoint(const QPointF &point) const;
+
+ bool attachAxis(QAbstractAxis *axis);
+ bool detachAxis(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ void handleVerticalAxisBaseChanged(qreal baseY);
+
+protected:
+ qreal toAngularCoordinate(qreal value, bool &ok) const;
+ qreal toRadialCoordinate(qreal value, bool &ok) const;
+
+private:
+ qreal m_logInnerY;
+ qreal m_logOuterY;
+ qreal m_logBaseY;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // XLOGYPOLARDOMAIN_H
diff --git a/src/charts/domain/xydomain.cpp b/src/charts/domain/xydomain.cpp
new file mode 100644
index 00000000..9916b7ca
--- /dev/null
+++ b/src/charts/domain/xydomain.cpp
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "xydomain_p.h"
+#include "qabstractaxis_p.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+XYDomain::XYDomain(QObject *parent)
+ : AbstractDomain(parent)
+{
+}
+
+XYDomain::~XYDomain()
+{
+}
+
+void XYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
+{
+ bool axisXChanged = false;
+ bool axisYChanged = false;
+
+ if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
+ m_minX = minX;
+ m_maxX = maxX;
+ axisXChanged = true;
+ if(!m_signalsBlocked)
+ emit rangeHorizontalChanged(m_minX, m_maxX);
+ }
+
+ if (!qFuzzyCompare(m_minY, minY) || !qFuzzyCompare(m_maxY, maxY)) {
+ m_minY = minY;
+ m_maxY = maxY;
+ axisYChanged = true;
+ if(!m_signalsBlocked)
+ emit rangeVerticalChanged(m_minY, m_maxY);
+ }
+
+ if (axisXChanged || axisYChanged)
+ emit updated();
+}
+
+
+void XYDomain::zoomIn(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal dx = spanX() / m_size.width();
+ qreal dy = spanY() / m_size.height();
+
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ maxX = minX + dx * rect.right();
+ minX = minX + dx * rect.left();
+ minY = maxY - dy * rect.bottom();
+ maxY = maxY - dy * rect.top();
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void XYDomain::zoomOut(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal dx = spanX() / rect.width();
+ qreal dy = spanY() / rect.height();
+
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ minX = maxX - dx * rect.right();
+ maxX = minX + dx * m_size.width();
+ maxY = minY + dy * rect.bottom();
+ minY = maxY - dy * m_size.height();
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void XYDomain::move(qreal dx, qreal dy)
+{
+ qreal x = spanX() / m_size.width();
+ qreal y = spanY() / m_size.height();
+
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ if (dx != 0) {
+ minX = minX + x * dx;
+ maxX = maxX + x * dx;
+ }
+ if (dy != 0) {
+ minY = minY + y * dy;
+ maxY = maxY + y * dy;
+ }
+ setRange(minX, maxX, minY, maxY);
+}
+
+QPointF XYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
+{
+ const qreal deltaX = m_size.width() / (m_maxX - m_minX);
+ const qreal deltaY = m_size.height() / (m_maxY - m_minY);
+ qreal x = (point.x() - m_minX) * deltaX;
+ qreal y = (point.y() - m_minY) * -deltaY + m_size.height();
+ ok = true;
+ return QPointF(x, y);
+}
+
+QVector<QPointF> XYDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
+{
+ const qreal deltaX = m_size.width() / (m_maxX - m_minX);
+ const qreal deltaY = m_size.height() / (m_maxY - m_minY);
+
+ QVector<QPointF> result;
+ result.resize(vector.count());
+
+ for (int i = 0; i < vector.count(); ++i) {
+ qreal x = (vector[i].x() - m_minX) * deltaX;
+ qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height();
+ result[i].setX(x);
+ result[i].setY(y);
+ }
+ return result;
+}
+
+QPointF XYDomain::calculateDomainPoint(const QPointF &point) const
+{
+ const qreal deltaX = m_size.width() / (m_maxX - m_minX);
+ const qreal deltaY = m_size.height() / (m_maxY - m_minY);
+ qreal x = point.x() / deltaX + m_minX;
+ qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY;
+ return QPointF(x, y);
+}
+
+// operators
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XYDomain &domain1, const XYDomain &domain2)
+{
+ return (qFuzzyCompare(domain1.m_maxX, domain2.m_maxX)
+ && qFuzzyCompare(domain1.m_maxY, domain2.m_maxY)
+ && qFuzzyCompare(domain1.m_minX, domain2.m_minX)
+ && qFuzzyCompare(domain1.m_minY, domain2.m_minY));
+}
+
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XYDomain &domain1, const XYDomain &domain2)
+{
+ return !(domain1 == domain2);
+}
+
+
+QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYDomain &domain)
+{
+#ifdef QT_NO_TEXTSTREAM
+ Q_UNUSED(domain)
+#else
+ dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
+#endif
+ return dbg.maybeSpace();
+}
+
+#include "moc_xydomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/xydomain_p.h b/src/charts/domain/xydomain_p.h
new file mode 100644
index 00000000..a82596ba
--- /dev/null
+++ b/src/charts/domain/xydomain_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef XYDOMAIN_H
+#define XYDOMAIN_H
+#include "abstractdomain_p.h"
+#include <QRectF>
+#include <QSizeF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QT_CHARTS_AUTOTEST_EXPORT XYDomain: public AbstractDomain
+{
+ Q_OBJECT
+public:
+ explicit XYDomain(QObject *object = 0);
+ virtual ~XYDomain();
+
+ DomainType type(){ return AbstractDomain::XYDomain;}
+
+ void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
+
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XYDomain &Domain1, const XYDomain &Domain2);
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XYDomain &Domain1, const XYDomain &Domain2);
+ friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYDomain &AbstractDomain);
+
+ void zoomIn(const QRectF &rect);
+ void zoomOut(const QRectF &rect);
+ void move(qreal dx, qreal dy);
+
+ QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
+ QPointF calculateDomainPoint(const QPointF &point) const;
+ QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // XYDOMAIN_H
diff --git a/src/charts/domain/xypolardomain.cpp b/src/charts/domain/xypolardomain.cpp
new file mode 100644
index 00000000..30fdacd3
--- /dev/null
+++ b/src/charts/domain/xypolardomain.cpp
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "xypolardomain_p.h"
+#include "qabstractaxis_p.h"
+#include <qmath.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+XYPolarDomain::XYPolarDomain(QObject *parent)
+ : PolarDomain(parent)
+{
+}
+
+XYPolarDomain::~XYPolarDomain()
+{
+}
+
+void XYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
+{
+ bool axisXChanged = false;
+ bool axisYChanged = false;
+
+ if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
+ m_minX = minX;
+ m_maxX = maxX;
+ axisXChanged = true;
+ if (!m_signalsBlocked)
+ emit rangeHorizontalChanged(m_minX, m_maxX);
+ }
+
+ if (!qFuzzyCompare(m_minY, minY) || !qFuzzyCompare(m_maxY, maxY)) {
+ m_minY = minY;
+ m_maxY = maxY;
+ axisYChanged = true;
+ if (!m_signalsBlocked)
+ emit rangeVerticalChanged(m_minY, m_maxY);
+ }
+
+ if (axisXChanged || axisYChanged)
+ emit updated();
+}
+
+
+void XYPolarDomain::zoomIn(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal dx = spanX() / m_size.width();
+ qreal dy = spanY() / m_size.height();
+
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ maxX = minX + dx * rect.right();
+ minX = minX + dx * rect.left();
+ minY = maxY - dy * rect.bottom();
+ maxY = maxY - dy * rect.top();
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void XYPolarDomain::zoomOut(const QRectF &rect)
+{
+ storeZoomReset();
+ qreal dx = spanX() / rect.width();
+ qreal dy = spanY() / rect.height();
+
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ minX = maxX - dx * rect.right();
+ maxX = minX + dx * m_size.width();
+ maxY = minY + dy * rect.bottom();
+ minY = maxY - dy * m_size.height();
+
+ setRange(minX, maxX, minY, maxY);
+}
+
+void XYPolarDomain::move(qreal dx, qreal dy)
+{
+ // One unit scrolls one degree angular and one pixel radial
+ qreal x = spanX() / 360.0;
+ qreal y = spanY() / m_radius;
+
+ qreal maxX = m_maxX;
+ qreal minX = m_minX;
+ qreal minY = m_minY;
+ qreal maxY = m_maxY;
+
+ if (dx != 0) {
+ minX = minX + x * dx;
+ maxX = maxX + x * dx;
+ }
+ if (dy != 0) {
+ minY = minY + y * dy;
+ maxY = maxY + y * dy;
+ }
+ setRange(minX, maxX, minY, maxY);
+}
+
+QPointF XYPolarDomain::calculateDomainPoint(const QPointF &point) const
+{
+ if (point == m_center)
+ return QPointF(0.0, m_minX);
+
+ QLineF line(m_center, point);
+ qreal a = 90.0 - line.angle();
+ if (a < 0.0)
+ a += 360.0;
+ a = ((a / 360.0) * (m_maxX - m_minX)) + m_minX;
+ qreal r = m_minY + ((m_maxY - m_minY) * (line.length() / m_radius));
+ return QPointF(a, r);
+}
+
+qreal XYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
+{
+ ok = true;
+ qreal f = (value - m_minX) / (m_maxX - m_minX);
+ return f * 360.0;
+}
+
+qreal XYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
+{
+ ok = true;
+ if (value < m_minY)
+ value = m_minY;
+
+ // Dont limit the max. The drawing should clip the stuff that goes out of the grid
+ qreal f = (value - m_minY) / (m_maxY - m_minY);
+
+ return f * m_radius;
+}
+
+// operators
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XYPolarDomain &domain1, const XYPolarDomain &domain2)
+{
+ return (qFuzzyCompare(domain1.m_maxX, domain2.m_maxX)
+ && qFuzzyCompare(domain1.m_maxY, domain2.m_maxY)
+ && qFuzzyCompare(domain1.m_minX, domain2.m_minX)
+ && qFuzzyCompare(domain1.m_minY, domain2.m_minY));
+}
+
+
+bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XYPolarDomain &domain1, const XYPolarDomain &domain2)
+{
+ return !(domain1 == domain2);
+}
+
+
+QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYPolarDomain &domain)
+{
+#ifdef QT_NO_TEXTSTREAM
+ Q_UNUSED(domain)
+#else
+ dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
+#endif
+ return dbg.maybeSpace();
+}
+
+#include "moc_xypolardomain_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/domain/xypolardomain_p.h b/src/charts/domain/xypolardomain_p.h
new file mode 100644
index 00000000..0d5abbab
--- /dev/null
+++ b/src/charts/domain/xypolardomain_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef XYPOLARDOMAIN_H
+#define XYPOLARDOMAIN_H
+#include "polardomain_p.h"
+#include <QRectF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QT_CHARTS_AUTOTEST_EXPORT XYPolarDomain: public PolarDomain
+{
+ Q_OBJECT
+public:
+ explicit XYPolarDomain(QObject *object = 0);
+ virtual ~XYPolarDomain();
+
+ DomainType type(){ return AbstractDomain::XYPolarDomain;}
+
+ void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
+
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator== (const XYPolarDomain &Domain1, const XYPolarDomain &Domain2);
+ friend bool QT_CHARTS_AUTOTEST_EXPORT operator!= (const XYPolarDomain &Domain1, const XYPolarDomain &Domain2);
+ friend QDebug QT_CHARTS_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYPolarDomain &AbstractDomain);
+
+ void zoomIn(const QRectF &rect);
+ void zoomOut(const QRectF &rect);
+ void move(qreal dx, qreal dy);
+
+ QPointF calculateDomainPoint(const QPointF &point) const;
+
+protected:
+ qreal toAngularCoordinate(qreal value, bool &ok) const;
+ qreal toRadialCoordinate(qreal value, bool &ok) const;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // XYPOLARDOMAIN_H
diff --git a/src/charts/layout/abstractchartlayout.cpp b/src/charts/layout/abstractchartlayout.cpp
new file mode 100644
index 00000000..b0d3d067
--- /dev/null
+++ b/src/charts/layout/abstractchartlayout.cpp
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "abstractchartlayout_p.h"
+#include "chartpresenter_p.h"
+#include "qlegend_p.h"
+#include "chartaxiselement_p.h"
+#include "charttitle_p.h"
+#include "chartbackground_p.h"
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+static const qreal golden_ratio = 0.4;
+
+AbstractChartLayout::AbstractChartLayout(ChartPresenter *presenter)
+ : m_presenter(presenter),
+ m_margins(20, 20, 20, 20),
+ m_minChartRect(0, 0, 200, 200)
+{
+}
+
+AbstractChartLayout::~AbstractChartLayout()
+{
+}
+
+void AbstractChartLayout::setGeometry(const QRectF &rect)
+{
+ if (!rect.isValid())
+ return;
+
+ if (m_presenter->chart()->isVisible()) {
+ QList<ChartAxisElement *> axes = m_presenter->axisItems();
+ ChartTitle *title = m_presenter->titleElement();
+ QLegend *legend = m_presenter->legend();
+ ChartBackground *background = m_presenter->backgroundElement();
+
+ QRectF contentGeometry = calculateBackgroundGeometry(rect, background);
+
+ contentGeometry = calculateContentGeometry(contentGeometry);
+
+ if (title && title->isVisible())
+ contentGeometry = calculateTitleGeometry(contentGeometry, title);
+
+ if (legend->isAttachedToChart() && legend->isVisible())
+ contentGeometry = calculateLegendGeometry(contentGeometry, legend);
+
+ contentGeometry = calculateAxisGeometry(contentGeometry, axes);
+
+ m_presenter->setGeometry(contentGeometry);
+ if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian)
+ static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
+ else
+ static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
+ }
+
+ QGraphicsLayout::setGeometry(rect);
+}
+
+QRectF AbstractChartLayout::calculateContentGeometry(const QRectF &geometry) const
+{
+ return geometry.adjusted(m_margins.left(), m_margins.top(), -m_margins.right(), -m_margins.bottom());
+}
+
+QRectF AbstractChartLayout::calculateContentMinimum(const QRectF &minimum) const
+{
+ return minimum.adjusted(0, 0, m_margins.left() + m_margins.right(), m_margins.top() + m_margins.bottom());
+}
+
+
+QRectF AbstractChartLayout::calculateBackgroundGeometry(const QRectF &geometry, ChartBackground *background) const
+{
+ qreal left;
+ qreal top;
+ qreal right;
+ qreal bottom;
+ getContentsMargins(&left, &top, &right, &bottom);
+ QRectF backgroundGeometry = geometry.adjusted(left, top, -right, -bottom);
+ if (background)
+ background->setRect(backgroundGeometry);
+ return backgroundGeometry;
+}
+
+QRectF AbstractChartLayout::calculateBackgroundMinimum(const QRectF &minimum) const
+{
+ qreal left;
+ qreal top;
+ qreal right;
+ qreal bottom;
+ getContentsMargins(&left, &top, &right, &bottom);
+ return minimum.adjusted(0, 0, left + right, top + bottom);
+}
+
+QRectF AbstractChartLayout::calculateLegendGeometry(const QRectF &geometry, QLegend *legend) const
+{
+ QSizeF size = legend->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1));
+ QRectF legendRect;
+ QRectF result;
+
+ switch (legend->alignment()) {
+ case Qt::AlignTop: {
+ legendRect = QRectF(geometry.topLeft(), QSizeF(geometry.width(), size.height()));
+ result = geometry.adjusted(0, legendRect.height(), 0, 0);
+ break;
+ }
+ case Qt::AlignBottom: {
+ legendRect = QRectF(QPointF(geometry.left(), geometry.bottom() - size.height()), QSizeF(geometry.width(), size.height()));
+ result = geometry.adjusted(0, 0, 0, -legendRect.height());
+ break;
+ }
+ case Qt::AlignLeft: {
+ qreal width = qMin(size.width(), geometry.width() * golden_ratio);
+ legendRect = QRectF(geometry.topLeft(), QSizeF(width, geometry.height()));
+ result = geometry.adjusted(width, 0, 0, 0);
+ break;
+ }
+ case Qt::AlignRight: {
+ qreal width = qMin(size.width(), geometry.width() * golden_ratio);
+ legendRect = QRectF(QPointF(geometry.right() - width, geometry.top()), QSizeF(width, geometry.height()));
+ result = geometry.adjusted(0, 0, -width, 0);
+ break;
+ }
+ default: {
+ legendRect = QRectF(0, 0, 0, 0);
+ result = geometry;
+ break;
+ }
+ }
+
+ legend->setGeometry(legendRect);
+
+ return result;
+}
+
+QRectF AbstractChartLayout::calculateLegendMinimum(const QRectF &geometry, QLegend *legend) const
+{
+ QSizeF minSize = legend->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, -1));
+ return geometry.adjusted(0, 0, minSize.width(), minSize.height());
+}
+
+QRectF AbstractChartLayout::calculateTitleGeometry(const QRectF &geometry, ChartTitle *title) const
+{
+ title->setGeometry(geometry);
+ QPointF center = geometry.center() - title->boundingRect().center();
+ title->setPos(center.x(), title->pos().y());
+ return geometry.adjusted(0, title->boundingRect().height()+1, 0, 0);
+}
+
+QRectF AbstractChartLayout::calculateTitleMinimum(const QRectF &minimum, ChartTitle *title) const
+{
+ QSizeF min = title->sizeHint(Qt::MinimumSize);
+ return minimum.adjusted(0, 0, min.width(), min.height());
+}
+
+QSizeF AbstractChartLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(constraint);
+ if (which == Qt::MinimumSize) {
+ QList<ChartAxisElement *> axes = m_presenter->axisItems();
+ ChartTitle *title = m_presenter->titleElement();
+ QLegend *legend = m_presenter->legend();
+ QRectF minimumRect(0, 0, 0, 0);
+ minimumRect = calculateBackgroundMinimum(minimumRect);
+ minimumRect = calculateContentMinimum(minimumRect);
+ minimumRect = calculateTitleMinimum(minimumRect, title);
+ minimumRect = calculateLegendMinimum(minimumRect, legend);
+ minimumRect = calculateAxisMinimum(minimumRect, axes);
+ return minimumRect.united(m_minChartRect).size().toSize();
+ }
+ return QSize(-1, -1);
+}
+
+void AbstractChartLayout::setMargins(const QMargins &margins)
+{
+ if (m_margins != margins) {
+ m_margins = margins;
+ updateGeometry();
+ }
+}
+
+QMargins AbstractChartLayout::margins() const
+{
+ return m_margins;
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/layout/abstractchartlayout_p.h b/src/charts/layout/abstractchartlayout_p.h
new file mode 100644
index 00000000..a0bf6f25
--- /dev/null
+++ b/src/charts/layout/abstractchartlayout_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef ABSTRACTCHARTLAYOUT_H
+#define ABSTRACTCHARTLAYOUT_H
+
+#include <QGraphicsLayout>
+#include <QMargins>
+#include "qchartglobal.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartTitle;
+class ChartAxisElement;
+class ChartPresenter;
+class QLegend;
+class ChartBackground;
+
+class AbstractChartLayout : public QGraphicsLayout
+{
+public:
+ AbstractChartLayout(ChartPresenter *presenter);
+ virtual ~AbstractChartLayout();
+
+ virtual void setMargins(const QMargins &margins);
+ virtual QMargins margins() const;
+ virtual void setGeometry(const QRectF &rect);
+
+protected:
+ virtual QRectF calculateBackgroundGeometry(const QRectF &geometry, ChartBackground *background) const;
+ virtual QRectF calculateBackgroundMinimum(const QRectF &minimum) const;
+ virtual QRectF calculateContentGeometry(const QRectF &geometry) const;
+ virtual QRectF calculateContentMinimum(const QRectF &minimum) const;
+ virtual QRectF calculateTitleGeometry(const QRectF &geometry, ChartTitle *title) const;
+ virtual QRectF calculateTitleMinimum(const QRectF &minimum, ChartTitle *title) const;
+ virtual QRectF calculateLegendGeometry(const QRectF &geometry, QLegend *legend) const;
+ virtual QRectF calculateLegendMinimum(const QRectF &minimum, QLegend *legend) const;
+
+ virtual QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *>& axes) const = 0;
+ virtual QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *>& axes) const = 0;
+
+ // from QGraphicsLayout
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+ int count() const { return 0; }
+ QGraphicsLayoutItem *itemAt(int) const { return 0; };
+ void removeAt(int) {};
+
+ ChartPresenter *m_presenter;
+ QMargins m_margins;
+ QRectF m_minChartRect;
+ QRectF m_minAxisRect;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // ABSTRACTCHARTLAYOUT_H
diff --git a/src/charts/layout/cartesianchartlayout.cpp b/src/charts/layout/cartesianchartlayout.cpp
new file mode 100644
index 00000000..7018a638
--- /dev/null
+++ b/src/charts/layout/cartesianchartlayout.cpp
@@ -0,0 +1,246 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "cartesianchartlayout_p.h"
+#include "chartpresenter_p.h"
+#include "chartaxiselement_p.h"
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+static const qreal maxAxisPortion = 0.4;
+
+CartesianChartLayout::CartesianChartLayout(ChartPresenter *presenter)
+ : AbstractChartLayout(presenter)
+{
+}
+
+CartesianChartLayout::~CartesianChartLayout()
+{
+}
+
+QRectF CartesianChartLayout::calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const
+{
+ QSizeF left(0,0);
+ QSizeF minLeft(0,0);
+ QSizeF right(0,0);
+ QSizeF minRight(0,0);
+ QSizeF bottom(0,0);
+ QSizeF minBottom(0,0);
+ QSizeF top(0,0);
+ QSizeF minTop(0,0);
+ QSizeF labelExtents(0,0);
+ int leftCount = 0;
+ int rightCount = 0;
+ int topCount = 0;
+ int bottomCount = 0;
+
+ foreach (ChartAxisElement *axis , axes) {
+
+ if (!axis->isVisible())
+ continue;
+
+
+ QSizeF size = axis->effectiveSizeHint(Qt::PreferredSize);
+ //this is used to get single thick font size
+ QSizeF minSize = axis->effectiveSizeHint(Qt::MinimumSize);
+
+ switch (axis->axis()->alignment()) {
+ case Qt::AlignLeft:
+ left.setWidth(left.width()+size.width());
+ left.setHeight(qMax(left.height(),size.height()));
+ minLeft.setWidth(minLeft.width()+minSize.width());
+ minLeft.setHeight(qMax(minLeft.height(),minSize.height()));
+ labelExtents.setHeight(qMax(size.height(), labelExtents.height()));
+ leftCount++;
+ break;
+ case Qt::AlignRight:
+ right.setWidth(right.width()+size.width());
+ right.setHeight(qMax(right.height(),size.height()));
+ minRight.setWidth(minRight.width()+minSize.width());
+ minRight.setHeight(qMax(minRight.height(),minSize.height()));
+ labelExtents.setHeight(qMax(size.height(), labelExtents.height()));
+ rightCount++;
+ break;
+ case Qt::AlignTop:
+ top.setWidth(qMax(top.width(),size.width()));
+ top.setHeight(top.height()+size.height());
+ minTop.setWidth(qMax(minTop.width(),minSize.width()));
+ minTop.setHeight(minTop.height()+minSize.height());
+ labelExtents.setWidth(qMax(size.width(), labelExtents.width()));
+ topCount++;
+ break;
+ case Qt::AlignBottom:
+ bottom.setWidth(qMax(bottom.width(), size.width()));
+ bottom.setHeight(bottom.height() + size.height());
+ minBottom.setWidth(qMax(minBottom.width(),minSize.width()));
+ minBottom.setHeight(minBottom.height() + minSize.height());
+ labelExtents.setWidth(qMax(size.width(), labelExtents.width()));
+ bottomCount++;
+ break;
+ default:
+ qWarning()<<"Axis is without alignment !";
+ break;
+ }
+ }
+
+ qreal totalVerticalAxes = leftCount + rightCount;
+ qreal leftSqueezeRatio = 1.0;
+ qreal rightSqueezeRatio = 1.0;
+ qreal vratio = 0;
+
+ if (totalVerticalAxes > 0)
+ vratio = (maxAxisPortion * geometry.width()) / totalVerticalAxes;
+
+ if (leftCount > 0) {
+ int maxWidth = vratio * leftCount;
+ if (left.width() > maxWidth) {
+ leftSqueezeRatio = maxWidth / left.width();
+ left.setWidth(maxWidth);
+ }
+ }
+ if (rightCount > 0) {
+ int maxWidth = vratio * rightCount;
+ if (right.width() > maxWidth) {
+ rightSqueezeRatio = maxWidth / right.width();
+ right.setWidth(maxWidth);
+ }
+ }
+
+ qreal totalHorizontalAxes = topCount + bottomCount;
+ qreal topSqueezeRatio = 1.0;
+ qreal bottomSqueezeRatio = 1.0;
+ qreal hratio = 0;
+
+ if (totalHorizontalAxes > 0)
+ hratio = (maxAxisPortion * geometry.height()) / totalHorizontalAxes;
+
+ if (topCount > 0) {
+ int maxHeight = hratio * topCount;
+ if (top.height() > maxHeight) {
+ topSqueezeRatio = maxHeight / top.height();
+ top.setHeight(maxHeight);
+ }
+ }
+ if (bottomCount > 0) {
+ int maxHeight = hratio * bottomCount;
+ if (bottom.height() > maxHeight) {
+ bottomSqueezeRatio = maxHeight / bottom.height();
+ bottom.setHeight(maxHeight);
+ }
+ }
+
+ qreal minHeight = qMax(minLeft.height(),minRight.height()) + 1;
+ qreal minWidth = qMax(minTop.width(),minBottom.width()) + 1;
+
+ // Ensure that there is enough space for first and last tick labels.
+ left.setWidth(qMax(labelExtents.width(), left.width()));
+ right.setWidth(qMax(labelExtents.width(), right.width()));
+ top.setHeight(qMax(labelExtents.height(), top.height()));
+ bottom.setHeight(qMax(labelExtents.height(), bottom.height()));
+
+ QRectF chartRect = geometry.adjusted(qMax(left.width(),minWidth/2), qMax(top.height(), minHeight/2),-qMax(right.width(),minWidth/2),-qMax(bottom.height(),minHeight/2));
+
+ qreal leftOffset = 0;
+ qreal rightOffset = 0;
+ qreal topOffset = 0;
+ qreal bottomOffset = 0;
+
+ foreach (ChartAxisElement *axis , axes) {
+
+ if (!axis->isVisible())
+ continue;
+
+ QSizeF size = axis->effectiveSizeHint(Qt::PreferredSize);
+
+ switch (axis->axis()->alignment()){
+ case Qt::AlignLeft:{
+ qreal width = size.width();
+ if (leftSqueezeRatio < 1.0)
+ width *= leftSqueezeRatio;
+ leftOffset+=width;
+ axis->setGeometry(QRect(chartRect.left()-leftOffset, geometry.top(),width, geometry.bottom()),chartRect);
+ break;
+ }
+ case Qt::AlignRight:{
+ qreal width = size.width();
+ if (rightSqueezeRatio < 1.0)
+ width *= rightSqueezeRatio;
+ axis->setGeometry(QRect(chartRect.right()+rightOffset,geometry.top(),width,geometry.bottom()),chartRect);
+ rightOffset+=width;
+ break;
+ }
+ case Qt::AlignTop: {
+ qreal height = size.height();
+ if (topSqueezeRatio < 1.0)
+ height *= topSqueezeRatio;
+ axis->setGeometry(QRect(geometry.left(), chartRect.top() - topOffset - height, geometry.width(), height), chartRect);
+ topOffset += height;
+ break;
+ }
+ case Qt::AlignBottom:
+ qreal height = size.height();
+ if (bottomSqueezeRatio < 1.0)
+ height *= bottomSqueezeRatio;
+ axis->setGeometry(QRect(geometry.left(), chartRect.bottom() + bottomOffset, geometry.width(), height), chartRect);
+ bottomOffset += height;
+ break;
+ }
+ }
+
+ return chartRect;
+}
+
+QRectF CartesianChartLayout::calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const
+{
+ QSizeF left;
+ QSizeF right;
+ QSizeF bottom;
+ QSizeF top;
+
+ foreach (ChartAxisElement *axis, axes) {
+ QSizeF size = axis->effectiveSizeHint(Qt::MinimumSize);
+
+ if (!axis->isVisible())
+ continue;
+
+ switch (axis->axis()->alignment()) {
+ case Qt::AlignLeft:
+ left.setWidth(left.width() + size.width());
+ left.setHeight(qMax(left.height() * 2, size.height()));
+ break;
+ case Qt::AlignRight:
+ right.setWidth(right.width() + size.width());
+ right.setHeight(qMax(right.height() * 2, size.height()));
+ break;
+ case Qt::AlignTop:
+ top.setWidth(qMax(top.width(), size.width()));
+ top.setHeight(top.height() + size.height());
+ break;
+ case Qt::AlignBottom:
+ bottom.setWidth(qMax(bottom.width(), size.width()));
+ bottom.setHeight(bottom.height() + size.height());
+ break;
+ }
+ }
+ return minimum.adjusted(0, 0, left.width() + right.width() + qMax(top.width(), bottom.width()), top.height() + bottom.height() + qMax(left.height(), right.height()));
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/layout/cartesianchartlayout_p.h b/src/charts/layout/cartesianchartlayout_p.h
new file mode 100644
index 00000000..2adcc233
--- /dev/null
+++ b/src/charts/layout/cartesianchartlayout_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CARTESIANCHARTLAYOUT_H
+#define CARTESIANCHARTLAYOUT_H
+
+#include "abstractchartlayout_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class CartesianChartLayout : public AbstractChartLayout
+{
+public:
+ CartesianChartLayout(ChartPresenter *presenter);
+ virtual ~CartesianChartLayout();
+
+ // from AbstractChartLayout
+ QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const;
+ QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // CARTESIANCHARTLAYOUT_H
diff --git a/src/layout/layout.pri b/src/charts/layout/layout.pri
index 159eab13..159eab13 100644
--- a/src/layout/layout.pri
+++ b/src/charts/layout/layout.pri
diff --git a/src/charts/layout/polarchartlayout.cpp b/src/charts/layout/polarchartlayout.cpp
new file mode 100644
index 00000000..1f4bda39
--- /dev/null
+++ b/src/charts/layout/polarchartlayout.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "polarchartlayout_p.h"
+#include "chartpresenter_p.h"
+#include "polarchartaxis_p.h"
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+static const qreal golden_ratio = 0.4;
+
+PolarChartLayout::PolarChartLayout(ChartPresenter *presenter)
+ : AbstractChartLayout(presenter)
+{
+}
+
+PolarChartLayout::~PolarChartLayout()
+{
+}
+
+QRectF PolarChartLayout::calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const
+{
+ // How to handle multiple angular/radial axes?
+ qreal axisRadius = geometry.height() / 2.0;
+ if (geometry.width() < geometry.height())
+ axisRadius = geometry.width() / 2.0;
+
+ int titleHeight = 0;
+ foreach (ChartAxisElement *chartAxis, axes) {
+ if (!chartAxis->isVisible())
+ continue;
+
+ PolarChartAxis *polarChartAxis = static_cast<PolarChartAxis *>(chartAxis);
+ qreal radius = polarChartAxis->preferredAxisRadius(geometry.size());
+ if (radius < axisRadius)
+ axisRadius = radius;
+
+ if (chartAxis->axis()->orientation() == Qt::Horizontal
+ && chartAxis->axis()->isTitleVisible()
+ && !chartAxis->axis()->titleText().isEmpty()) {
+ // If axis has angular title, adjust geometry down by the space title takes
+ QRectF dummyRect = ChartPresenter::textBoundingRect(chartAxis->axis()->titleFont(), chartAxis->axis()->titleText());
+ titleHeight = (dummyRect.height() / 2.0) + chartAxis->titlePadding();
+ }
+ }
+
+ QRectF axisRect;
+ axisRect.setSize(QSizeF(axisRadius * 2.0, axisRadius * 2.0));
+ axisRect.moveCenter(geometry.center());
+ axisRect.adjust(0, titleHeight, 0, titleHeight);
+
+ foreach (ChartAxisElement *chartAxis, axes)
+ chartAxis->setGeometry(axisRect, QRectF());
+
+ return axisRect;
+}
+
+QRectF PolarChartLayout::calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const
+{
+ Q_UNUSED(axes);
+ return minimum;
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/layout/polarchartlayout_p.h b/src/charts/layout/polarchartlayout_p.h
new file mode 100644
index 00000000..38cd8612
--- /dev/null
+++ b/src/charts/layout/polarchartlayout_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef POLARCHARTLAYOUT_H
+#define POLARCHARTLAYOUT_H
+
+#include "abstractchartlayout_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class PolarChartLayout : public AbstractChartLayout
+{
+public:
+ PolarChartLayout(ChartPresenter *presenter);
+ virtual ~PolarChartLayout();
+
+ // from AbstractChartLayout
+ QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const;
+ QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // POLARCHARTLAYOUT_H
diff --git a/src/legend/legend.pri b/src/charts/legend/legend.pri
index c14cf6b0..c14cf6b0 100644
--- a/src/legend/legend.pri
+++ b/src/charts/legend/legend.pri
diff --git a/src/charts/legend/legendlayout.cpp b/src/charts/legend/legendlayout.cpp
new file mode 100644
index 00000000..b4e443c0
--- /dev/null
+++ b/src/charts/legend/legendlayout.cpp
@@ -0,0 +1,506 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "legendlayout_p.h"
+#include "chartpresenter_p.h"
+#include "qlegend_p.h"
+#include "abstractchartlayout_p.h"
+
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include "qlegendmarker.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+LegendLayout::LegendLayout(QLegend *legend)
+ : m_legend(legend),
+ m_offsetX(0),
+ m_offsetY(0)
+{
+
+}
+
+LegendLayout::~LegendLayout()
+{
+
+}
+
+void LegendLayout::setOffset(qreal x, qreal y)
+{
+ bool scrollHorizontal = true;
+ switch (m_legend->alignment()) {
+ case Qt::AlignTop:
+ case Qt::AlignBottom:
+ scrollHorizontal = true;
+ break;
+ case Qt::AlignLeft:
+ case Qt::AlignRight:
+ scrollHorizontal = false;
+ break;
+ }
+
+ // If detached, the scrolling direction is vertical instead of horizontal and vice versa.
+ if (!m_legend->isAttachedToChart())
+ scrollHorizontal = !scrollHorizontal;
+
+ QRectF boundingRect = geometry();
+ qreal left, top, right, bottom;
+ getContentsMargins(&left, &top, &right, &bottom);
+ boundingRect.adjust(left, top, -right, -bottom);
+
+ // Limit offset between m_minOffset and m_maxOffset
+ if (scrollHorizontal) {
+ if (m_width <= boundingRect.width())
+ return;
+
+ if (x != m_offsetX) {
+ m_offsetX = qBound(m_minOffsetX, x, m_maxOffsetX);
+ m_legend->d_ptr->items()->setPos(-m_offsetX, boundingRect.top());
+ }
+ } else {
+ if (m_height <= boundingRect.height())
+ return;
+
+ if (y != m_offsetY) {
+ m_offsetY = qBound(m_minOffsetY, y, m_maxOffsetY);
+ m_legend->d_ptr->items()->setPos(boundingRect.left(), -m_offsetY);
+ }
+ }
+}
+
+QPointF LegendLayout::offset() const
+{
+ return QPointF(m_offsetX, m_offsetY);
+}
+
+void LegendLayout::invalidate()
+{
+ QGraphicsLayout::invalidate();
+ if (m_legend->isAttachedToChart())
+ m_legend->d_ptr->m_presenter->layout()->invalidate();
+}
+
+void LegendLayout::setGeometry(const QRectF &rect)
+{
+ m_legend->d_ptr->items()->setVisible(m_legend->isVisible());
+
+ QGraphicsLayout::setGeometry(rect);
+
+ if (m_legend->isAttachedToChart())
+ setAttachedGeometry(rect);
+ else
+ setDettachedGeometry(rect);
+}
+
+void LegendLayout::setAttachedGeometry(const QRectF &rect)
+{
+ if (!rect.isValid())
+ return;
+
+ qreal oldOffsetX = m_offsetX;
+ qreal oldOffsetY = m_offsetY;
+ m_offsetX = 0;
+ m_offsetY = 0;
+
+ QSizeF size(0, 0);
+
+ if (m_legend->d_ptr->markers().isEmpty()) {
+ return;
+ }
+
+ m_width = 0;
+ m_height = 0;
+
+ qreal left, top, right, bottom;
+ getContentsMargins(&left, &top, &right, &bottom);
+
+ QRectF geometry = rect.adjusted(left, top, -right, -bottom);
+
+ switch(m_legend->alignment()) {
+ case Qt::AlignTop:
+ case Qt::AlignBottom: {
+ // Calculate the space required for items and add them to a sorted list.
+ qreal markerItemsWidth = 0;
+ qreal itemMargins = 0;
+ QList<LegendWidthStruct *> legendWidthList;
+ foreach (QLegendMarker *marker, m_legend->d_ptr->markers()) {
+ LegendMarkerItem *item = marker->d_ptr->item();
+ if (item->isVisible()) {
+ QSizeF dummySize;
+ qreal itemWidth = item->sizeHint(Qt::PreferredSize, dummySize).width();
+ LegendWidthStruct *structItem = new LegendWidthStruct;
+ structItem->item = item;
+ structItem->width = itemWidth;
+ legendWidthList.append(structItem);
+ markerItemsWidth += itemWidth;
+ itemMargins += marker->d_ptr->item()->m_margin;
+ }
+ }
+ std::sort(legendWidthList.begin(), legendWidthList.end(), widthLongerThan);
+
+ // If the items would occupy more space than is available, start truncating them
+ // from the longest one.
+ qreal availableGeometry = geometry.width() - right - left * 2 - itemMargins;
+ if (markerItemsWidth >= availableGeometry && legendWidthList.count() > 0) {
+ bool truncated(false);
+ int count = legendWidthList.count();
+ for (int i = 1; i < count; i++) {
+ int truncateIndex = i - 1;
+
+ while (legendWidthList.at(truncateIndex)->width >= legendWidthList.at(i)->width
+ && !truncated) {
+ legendWidthList.at(truncateIndex)->width--;
+ markerItemsWidth--;
+ if (i > 1) {
+ // Truncate the items that are before the truncated one in the list.
+ for (int j = truncateIndex - 1; j >= 0; j--) {
+ if (legendWidthList.at(truncateIndex)->width
+ < legendWidthList.at(j)->width) {
+ legendWidthList.at(j)->width--;
+ markerItemsWidth--;
+ }
+ }
+ }
+ if (markerItemsWidth < availableGeometry)
+ truncated = true;
+ }
+ // Truncate the last item if needed.
+ if (i == count - 1) {
+ if (legendWidthList.at(count - 1)->width
+ > legendWidthList.at(truncateIndex)->width) {
+ legendWidthList.at(count - 1)->width--;
+ markerItemsWidth--;
+ }
+ }
+
+ if (truncated)
+ break;
+ }
+ // Items are of same width and all of them need to be truncated
+ // or there is just one item that is truncated.
+ while (markerItemsWidth >= availableGeometry) {
+ for (int i = 0; i < count; i++) {
+ legendWidthList.at(i)->width--;
+ markerItemsWidth--;
+ }
+ }
+ }
+
+ QPointF point(0,0);
+
+ int markerCount = m_legend->d_ptr->markers().count();
+ for (int i = 0; i < markerCount; i++) {
+ QLegendMarker *marker;
+ if (m_legend->d_ptr->m_reverseMarkers)
+ marker = m_legend->d_ptr->markers().at(markerCount - 1 - i);
+ else
+ marker = m_legend->d_ptr->markers().at(i);
+ LegendMarkerItem *item = marker->d_ptr->item();
+ if (item->isVisible()) {
+ QRectF itemRect = geometry;
+ qreal availableWidth = 0;
+ for (int i = 0; i < legendWidthList.size(); ++i) {
+ if (legendWidthList.at(i)->item == item) {
+ availableWidth = legendWidthList.at(i)->width;
+ break;
+ }
+ }
+ itemRect.setWidth(availableWidth);
+ item->setGeometry(itemRect);
+ item->setPos(point.x(),geometry.height()/2 - item->boundingRect().height()/2);
+ const QRectF &rect = item->boundingRect();
+ size = size.expandedTo(rect.size());
+ qreal w = rect.width();
+ m_width = m_width + w - item->m_margin;
+ point.setX(point.x() + w);
+ }
+ }
+ // Delete structs from the container
+ qDeleteAll(legendWidthList);
+
+ if (m_width < geometry.width())
+ m_legend->d_ptr->items()->setPos(geometry.width() / 2 - m_width / 2, geometry.top());
+ else
+ m_legend->d_ptr->items()->setPos(geometry.topLeft());
+ m_height = size.height();
+ }
+ break;
+ case Qt::AlignLeft:
+ case Qt::AlignRight: {
+ QPointF point(0,0);
+ int markerCount = m_legend->d_ptr->markers().count();
+ for (int i = 0; i < markerCount; i++) {
+ QLegendMarker *marker;
+ if (m_legend->d_ptr->m_reverseMarkers)
+ marker = m_legend->d_ptr->markers().at(markerCount - 1 - i);
+ else
+ marker = m_legend->d_ptr->markers().at(i);
+ LegendMarkerItem *item = marker->d_ptr->item();
+ if (item->isVisible()) {
+ item->setGeometry(geometry);
+ item->setPos(point);
+ const QRectF &rect = item->boundingRect();
+ qreal h = rect.height();
+ size = size.expandedTo(rect.size());
+ m_height+=h;
+ point.setY(point.y() + h);
+ }
+ }
+
+ if (m_height < geometry.height())
+ m_legend->d_ptr->items()->setPos(geometry.left(), geometry.height() / 2 - m_height / 2);
+ else
+ m_legend->d_ptr->items()->setPos(geometry.topLeft());
+ m_width = size.width();
+ break;
+ }
+ }
+
+ m_minOffsetX = -left;
+ m_minOffsetY = - top;
+ m_maxOffsetX = m_width - geometry.width() - right;
+ m_maxOffsetY = m_height - geometry.height() - bottom;
+
+ setOffset(oldOffsetX, oldOffsetY);
+}
+
+void LegendLayout::setDettachedGeometry(const QRectF &rect)
+{
+ if (!rect.isValid())
+ return;
+
+ // Detached layout is different.
+ // In detached mode legend may have multiple rows and columns, so layout calculations
+ // differ a log from attached mode.
+ // Also the scrolling logic is bit different.
+
+ qreal oldOffsetX = m_offsetX;
+ qreal oldOffsetY = m_offsetY;
+ m_offsetX = 0;
+ m_offsetY = 0;
+
+ qreal left, top, right, bottom;
+ getContentsMargins(&left, &top, &right, &bottom);
+ QRectF geometry = rect.adjusted(left, top, -right, -bottom);
+
+ QSizeF size(0, 0);
+
+ QList<QLegendMarker *> markers = m_legend->d_ptr->markers();
+
+ if (markers.isEmpty())
+ return;
+
+ switch (m_legend->alignment()) {
+ case Qt::AlignTop: {
+ QPointF point(0, 0);
+ m_width = 0;
+ m_height = 0;
+ for (int i = 0; i < markers.count(); i++) {
+ LegendMarkerItem *item = markers.at(i)->d_ptr->item();
+ if (item->isVisible()) {
+ item->setGeometry(geometry);
+ item->setPos(point.x(),point.y());
+ const QRectF &boundingRect = item->boundingRect();
+ qreal w = boundingRect.width();
+ qreal h = boundingRect.height();
+ m_width = qMax(m_width,w);
+ m_height = qMax(m_height,h);
+ point.setX(point.x() + w);
+ if (point.x() + w > geometry.left() + geometry.width() - right) {
+ // Next item would go off rect.
+ point.setX(0);
+ point.setY(point.y() + h);
+ if (i+1 < markers.count()) {
+ m_height += h;
+ }
+ }
+ }
+ }
+ m_legend->d_ptr->items()->setPos(geometry.topLeft());
+
+ m_minOffsetX = -left;
+ m_minOffsetY = -top;
+ m_maxOffsetX = m_width - geometry.width() - right;
+ m_maxOffsetY = m_height - geometry.height() - bottom;
+ }
+ break;
+ case Qt::AlignBottom: {
+ QPointF point(0, geometry.height());
+ m_width = 0;
+ m_height = 0;
+ for (int i = 0; i < markers.count(); i++) {
+ LegendMarkerItem *item = markers.at(i)->d_ptr->item();
+ if (item->isVisible()) {
+ item->setGeometry(geometry);
+ const QRectF &boundingRect = item->boundingRect();
+ qreal w = boundingRect.width();
+ qreal h = boundingRect.height();
+ m_width = qMax(m_width,w);
+ m_height = qMax(m_height,h);
+ item->setPos(point.x(),point.y() - h);
+ point.setX(point.x() + w);
+ if (point.x() + w > geometry.left() + geometry.width() - right) {
+ // Next item would go off rect.
+ point.setX(0);
+ point.setY(point.y() - h);
+ if (i+1 < markers.count()) {
+ m_height += h;
+ }
+ }
+ }
+ }
+ m_legend->d_ptr->items()->setPos(geometry.topLeft());
+
+ m_minOffsetX = -left;
+ m_minOffsetY = -m_height + geometry.height() - top;
+ m_maxOffsetX = m_width - geometry.width() - right;
+ m_maxOffsetY = -bottom;
+ }
+ break;
+ case Qt::AlignLeft: {
+ QPointF point(0, 0);
+ m_width = 0;
+ m_height = 0;
+ qreal maxWidth = 0;
+ for (int i = 0; i < markers.count(); i++) {
+ LegendMarkerItem *item = markers.at(i)->d_ptr->item();
+ if (item->isVisible()) {
+ item->setGeometry(geometry);
+ const QRectF &boundingRect = item->boundingRect();
+ qreal w = boundingRect.width();
+ qreal h = boundingRect.height();
+ m_height = qMax(m_height,h);
+ maxWidth = qMax(maxWidth,w);
+ item->setPos(point.x(),point.y());
+ point.setY(point.y() + h);
+ if (point.y() + h > geometry.bottom() - bottom) {
+ // Next item would go off rect.
+ point.setX(point.x() + maxWidth);
+ point.setY(0);
+ if (i+1 < markers.count()) {
+ m_width += maxWidth;
+ maxWidth = 0;
+ }
+ }
+ }
+ }
+ m_width += maxWidth;
+ m_legend->d_ptr->items()->setPos(geometry.topLeft());
+
+ m_minOffsetX = -left;
+ m_minOffsetY = -top;
+ m_maxOffsetX = m_width - geometry.width() - right;
+ m_maxOffsetY = m_height - geometry.height() - bottom;
+ }
+ break;
+ case Qt::AlignRight: {
+ QPointF point(geometry.width(), 0);
+ m_width = 0;
+ m_height = 0;
+ qreal maxWidth = 0;
+ for (int i = 0; i < markers.count(); i++) {
+ LegendMarkerItem *item = markers.at(i)->d_ptr->item();
+ if (item->isVisible()) {
+ item->setGeometry(geometry);
+ const QRectF &boundingRect = item->boundingRect();
+ qreal w = boundingRect.width();
+ qreal h = boundingRect.height();
+ m_height = qMax(m_height,h);
+ maxWidth = qMax(maxWidth,w);
+ item->setPos(point.x() - w,point.y());
+ point.setY(point.y() + h);
+ if (point.y() + h > geometry.bottom()-bottom) {
+ // Next item would go off rect.
+ point.setX(point.x() - maxWidth);
+ point.setY(0);
+ if (i+1 < markers.count()) {
+ m_width += maxWidth;
+ maxWidth = 0;
+ }
+ }
+ }
+ }
+ m_width += maxWidth;
+ m_legend->d_ptr->items()->setPos(geometry.topLeft());
+
+ m_minOffsetX = - m_width + geometry.width() - left;
+ m_minOffsetY = -top;
+ m_maxOffsetX = - right;
+ m_maxOffsetY = m_height - geometry.height() - bottom;
+ }
+ break;
+ default:
+ break;
+ }
+
+ setOffset(oldOffsetX, oldOffsetY);
+}
+
+QSizeF LegendLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ QSizeF size(0, 0);
+ qreal left, top, right, bottom;
+ getContentsMargins(&left, &top, &right, &bottom);
+
+ if(constraint.isValid()) {
+ foreach(QLegendMarker *marker, m_legend->d_ptr->markers()) {
+ LegendMarkerItem *item = marker->d_ptr->item();
+ size = size.expandedTo(item->effectiveSizeHint(which));
+ }
+ size = size.boundedTo(constraint);
+ }
+ else if (constraint.width() >= 0) {
+ qreal width = 0;
+ qreal height = 0;
+ foreach(QLegendMarker *marker, m_legend->d_ptr->markers()) {
+ LegendMarkerItem *item = marker->d_ptr->item();
+ width+=item->effectiveSizeHint(which).width();
+ height=qMax(height,item->effectiveSizeHint(which).height());
+ }
+
+ size = QSizeF(qMin(constraint.width(),width), height);
+ }
+ else if (constraint.height() >= 0) {
+ qreal width = 0;
+ qreal height = 0;
+ foreach(QLegendMarker *marker, m_legend->d_ptr->markers()) {
+ LegendMarkerItem *item = marker->d_ptr->item();
+ width=qMax(width,item->effectiveSizeHint(which).width());
+ height+=height,item->effectiveSizeHint(which).height();
+ }
+ size = QSizeF(width,qMin(constraint.height(),height));
+ }
+ else {
+ foreach(QLegendMarker *marker, m_legend->d_ptr->markers()) {
+ LegendMarkerItem *item = marker->d_ptr->item();
+ size = size.expandedTo(item->effectiveSizeHint(which));
+ }
+ }
+ size += QSize(left + right, top + bottom);
+ return size;
+}
+
+bool LegendLayout::widthLongerThan(const LegendWidthStruct *item1,
+ const LegendWidthStruct *item2)
+{
+ return item1->width > item2->width;
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/legend/legendlayout_p.h b/src/charts/legend/legendlayout_p.h
new file mode 100644
index 00000000..ec96aa31
--- /dev/null
+++ b/src/charts/legend/legendlayout_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef LEGENDLAYOUT_H
+#define LEGENDLAYOUT_H
+#include <QGraphicsLayout>
+#include "qchartglobal.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLegend;
+class LegendMarkerItem;
+
+class LegendLayout : public QGraphicsLayout
+{
+public:
+
+ LegendLayout(QLegend *legend);
+ virtual ~LegendLayout();
+
+ void setGeometry(const QRectF &rect);
+
+ void setOffset(qreal x, qreal y);
+ QPointF offset() const;
+
+ void invalidate();
+protected:
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+ int count() const { return 0; }
+ QGraphicsLayoutItem *itemAt(int) const { return 0; };
+ void removeAt(int) {};
+
+private:
+ void setAttachedGeometry(const QRectF &rect);
+ void setDettachedGeometry(const QRectF &rect);
+
+ struct LegendWidthStruct {
+ LegendMarkerItem *item;
+ qreal width;
+ };
+ static bool widthLongerThan(const LegendWidthStruct *item1,
+ const LegendWidthStruct *item2);
+
+private:
+ QLegend *m_legend;
+ qreal m_offsetX;
+ qreal m_offsetY;
+ qreal m_minOffsetX;
+ qreal m_minOffsetY;
+ qreal m_maxOffsetX;
+ qreal m_maxOffsetY;
+ qreal m_width;
+ qreal m_height;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/legend/legendmarkeritem.cpp b/src/charts/legend/legendmarkeritem.cpp
new file mode 100644
index 00000000..f40e4dd0
--- /dev/null
+++ b/src/charts/legend/legendmarkeritem.cpp
@@ -0,0 +1,192 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include <QPainter>
+#include <QGraphicsSceneEvent>
+#include <QGraphicsTextItem>
+#include <QTextDocument>
+
+#include "qlegend.h"
+#include "qlegend_p.h"
+#include "qlegendmarker.h"
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include "chartpresenter_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+LegendMarkerItem::LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject *parent) :
+ QGraphicsObject(parent),
+ m_marker(marker),
+ m_markerRect(0,0,10.0,10.0),
+ m_boundingRect(0,0,0,0),
+ m_textItem(new QGraphicsTextItem(this)),
+ m_rectItem(new QGraphicsRectItem(this)),
+ m_margin(3),
+ m_space(4),
+ m_hovering(false),
+ m_pressPos(0, 0)
+{
+ m_rectItem->setRect(m_markerRect);
+ m_textItem->document()->setDocumentMargin(ChartPresenter::textMargin());
+ setAcceptHoverEvents(true);
+}
+
+LegendMarkerItem::~LegendMarkerItem()
+{
+ if (m_hovering) {
+ emit m_marker->q_ptr->hovered(false);
+ }
+}
+
+void LegendMarkerItem::setPen(const QPen &pen)
+{
+ m_rectItem->setPen(pen);
+}
+
+QPen LegendMarkerItem::pen() const
+{
+ return m_rectItem->pen();
+}
+
+void LegendMarkerItem::setBrush(const QBrush &brush)
+{
+ m_rectItem->setBrush(brush);
+}
+
+QBrush LegendMarkerItem::brush() const
+{
+ return m_rectItem->brush();
+}
+
+void LegendMarkerItem::setFont(const QFont &font)
+{
+ m_textItem->setFont(font);
+ QFontMetrics fn(font);
+ m_markerRect = QRectF(0,0,fn.height()/2,fn.height()/2);
+ updateGeometry();
+}
+
+QFont LegendMarkerItem::font() const
+{
+ return m_textItem->font();
+}
+
+void LegendMarkerItem::setLabel(const QString label)
+{
+ m_label = label;
+ updateGeometry();
+}
+
+QString LegendMarkerItem::label() const
+{
+ return m_label;
+}
+
+void LegendMarkerItem::setLabelBrush(const QBrush &brush)
+{
+ m_textItem->setDefaultTextColor(brush.color());
+}
+
+QBrush LegendMarkerItem::labelBrush() const
+{
+ return QBrush(m_textItem->defaultTextColor());
+}
+
+void LegendMarkerItem::setGeometry(const QRectF &rect)
+{
+ qreal width = rect.width();
+ qreal x = m_margin + m_markerRect.width() + m_space + m_margin;
+ QRectF truncatedRect;
+
+ m_textItem->setHtml(ChartPresenter::truncatedText(m_textItem->font(), m_label, qreal(0.0),
+ width - x, rect.height(), truncatedRect));
+ m_textItem->setTextWidth(truncatedRect.width());
+
+ qreal y = qMax(m_markerRect.height() + 2 * m_margin, truncatedRect.height() + 2 * m_margin);
+
+ const QRectF &textRect = m_textItem->boundingRect();
+
+ m_textItem->setPos(x - m_margin, y / 2 - textRect.height() / 2);
+ m_rectItem->setRect(m_markerRect);
+ // The textMargin adjustments to position are done to make default case rects less blurry with anti-aliasing
+ m_rectItem->setPos(m_margin - ChartPresenter::textMargin(), y / 2.0 - m_markerRect.height() / 2.0 + ChartPresenter::textMargin());
+
+ prepareGeometryChange();
+ m_boundingRect = QRectF(0, 0, x + textRect.width() + m_margin, y);
+}
+
+QRectF LegendMarkerItem::boundingRect() const
+{
+ return m_boundingRect;
+}
+
+void LegendMarkerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
+ Q_UNUSED(painter)
+}
+
+QSizeF LegendMarkerItem::sizeHint(Qt::SizeHint which, const QSizeF& constraint) const
+{
+ Q_UNUSED(constraint)
+
+ QSizeF sh;
+
+ switch (which) {
+ case Qt::MinimumSize: {
+ QRectF labelRect = ChartPresenter::textBoundingRect(m_textItem->font(),
+ QStringLiteral("..."));
+ sh = QSizeF(labelRect.width() + (2.0 * m_margin) + m_space + m_markerRect.width(),
+ qMax(m_markerRect.height(), labelRect.height()) + (2.0 * m_margin));
+ break;
+ }
+ case Qt::PreferredSize: {
+ QRectF labelRect = ChartPresenter::textBoundingRect(m_textItem->font(), m_label);
+ sh = QSizeF(labelRect.width() + (2.0 * m_margin) + m_space + m_markerRect.width(),
+ qMax(m_markerRect.height(), labelRect.height()) + (2.0 * m_margin));
+ break;
+ }
+ default:
+ break;
+ }
+
+ return sh;
+}
+
+void LegendMarkerItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event)
+ m_hovering = true;
+ emit m_marker->q_ptr->hovered(true);
+}
+
+void LegendMarkerItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event)
+ m_hovering = false;
+ emit m_marker->q_ptr->hovered(false);
+}
+
+
+#include "moc_legendmarkeritem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/legend/legendmarkeritem_p.h b/src/charts/legend/legendmarkeritem_p.h
new file mode 100644
index 00000000..8c49b9d0
--- /dev/null
+++ b/src/charts/legend/legendmarkeritem_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef LEGENDMARKERITEM_P_H
+#define LEGENDMARKERITEM_P_H
+
+#include <qchartglobal.h>
+#include <QGraphicsObject>
+#include <QFont>
+#include <QBrush>
+#include <QPen>
+#include <QGraphicsTextItem>
+#include <QGraphicsLayoutItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLegendMarkerPrivate;
+
+class LegendMarkerItem : public QGraphicsObject, public QGraphicsLayoutItem
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsLayoutItem)
+public:
+ explicit LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject *parent = 0);
+ ~LegendMarkerItem();
+
+ void setPen(const QPen &pen);
+ QPen pen() const;
+
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+
+ void setFont(const QFont &font);
+ QFont font() const;
+
+ void setLabel(const QString label);
+ QString label() const;
+
+ void setLabelBrush(const QBrush &brush);
+ QBrush labelBrush() const;
+
+ void setGeometry(const QRectF &rect);
+ QRectF boundingRect() const;
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ QSizeF sizeHint (Qt::SizeHint which, const QSizeF &constraint) const;
+
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+
+protected:
+ QLegendMarkerPrivate *m_marker; // Knows
+ QRectF m_markerRect;
+ QRectF m_boundingRect;
+ QGraphicsTextItem *m_textItem;
+ QGraphicsRectItem *m_rectItem;
+ qreal m_margin;
+ qreal m_space;
+ QString m_label;
+
+ QBrush m_labelBrush;
+ QPen m_pen;
+ QBrush m_brush;
+ bool m_hovering;
+
+ QPointF m_pressPos;
+
+ friend class QLegendMarker;
+ friend class QLegendMarkerPrivate;
+ friend class LegendLayout;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // LEGENDMARKERITEM_P_H
diff --git a/src/charts/legend/legendscroller.cpp b/src/charts/legend/legendscroller.cpp
new file mode 100644
index 00000000..ac1784b3
--- /dev/null
+++ b/src/charts/legend/legendscroller.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include <QGraphicsSceneMouseEvent>
+#include <QGraphicsScene>
+#include <QLegendMarker>
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include "legendscroller_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+LegendScroller::LegendScroller(QChart *chart) : QLegend(chart)
+{
+}
+
+void LegendScroller::setOffset(const QPointF &point)
+{
+ d_ptr->setOffset(point);
+}
+
+QPointF LegendScroller::offset() const
+{
+ return d_ptr->offset();
+}
+
+void LegendScroller::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ Scroller::handleMousePressEvent(event);
+}
+
+void LegendScroller::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ Scroller::handleMouseMoveEvent(event);
+}
+
+void LegendScroller::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ Scroller::handleMouseReleaseEvent(event);
+
+ if (!event->isAccepted()) {
+ QList<QGraphicsItem *> items = scene()->items(event->scenePos());
+
+ foreach (QGraphicsItem *i, items) {
+ if (d_ptr->m_markerHash.contains(i)) {
+ QLegendMarker *marker = d_ptr->m_markerHash.value(i);
+ emit marker->clicked();
+ }
+ }
+ event->accept();
+ }
+}
+
+
+#include "moc_legendscroller_p.cpp"
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/legend/legendscroller_p.h b/src/charts/legend/legendscroller_p.h
new file mode 100644
index 00000000..8ea63d78
--- /dev/null
+++ b/src/charts/legend/legendscroller_p.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+
+#ifndef LEGENDSCROLLER_P_H
+#define LEGENDSCROLLER_P_H
+
+#include <QtCharts/qlegend.h>
+#include "qlegend_p.h"
+#include "scroller_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class LegendScroller: public QLegend, public Scroller
+{
+ Q_OBJECT
+
+public:
+ LegendScroller(QChart *chart);
+
+ void setOffset(const QPointF &point);
+ QPointF offset() const;
+
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/legend/qarealegendmarker.cpp b/src/charts/legend/qarealegendmarker.cpp
new file mode 100644
index 00000000..6e8a1d53
--- /dev/null
+++ b/src/charts/legend/qarealegendmarker.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qarealegendmarker.h"
+#include "qarealegendmarker_p.h"
+#include "qareaseries_p.h"
+#include <QAreaSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QAreaLegendMarker
+ \inmodule Qt Charts
+ \brief QLegendMarker subclass for area series.
+ \mainclass
+
+ QAreaLegendMarker is related to QAreaSeries. One QAreaSeries results in one marker.
+
+ \sa QLegend, QAreaSeries
+*/
+
+/*!
+ \fn virtual LegendMarkerType QAreaLegendMarker::type()
+ Returns QLegendMarker::LegendMarkerTypeArea
+*/
+
+/*!
+ \internal
+*/
+QAreaLegendMarker::QAreaLegendMarker(QAreaSeries *series, QLegend *legend, QObject *parent) :
+ QLegendMarker(*new QAreaLegendMarkerPrivate(this,series,legend), parent)
+{
+ d_ptr->updated();
+}
+
+/*!
+ Destructor
+*/
+QAreaLegendMarker::~QAreaLegendMarker()
+{
+}
+
+/*!
+ \internal
+*/
+QAreaLegendMarker::QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *parent) :
+ QLegendMarker(d, parent)
+{
+}
+
+/*!
+ Returns related series of marker
+*/
+QAreaSeries* QAreaLegendMarker::series()
+{
+ Q_D(QAreaLegendMarker);
+ return d->m_series;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QAreaLegendMarkerPrivate::QAreaLegendMarkerPrivate(QAreaLegendMarker *q, QAreaSeries *series, QLegend *legend) :
+ QLegendMarkerPrivate(q,legend),
+ q_ptr(q),
+ m_series(series)
+{
+ QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(updated()));
+ QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated()));
+}
+
+QAreaLegendMarkerPrivate::~QAreaLegendMarkerPrivate()
+{
+}
+
+QAreaSeries* QAreaLegendMarkerPrivate::series()
+{
+ return m_series;
+}
+
+QObject* QAreaLegendMarkerPrivate::relatedObject()
+{
+ return m_series;
+}
+
+void QAreaLegendMarkerPrivate::updated()
+{
+ bool labelChanged = false;
+ bool brushChanged = false;
+
+ if (!m_customBrush && (m_item->brush() != m_series->brush())) {
+ m_item->setBrush(m_series->brush());
+ brushChanged = true;
+ }
+ if (!m_customLabel && (m_item->label() != m_series->name())) {
+ m_item->setLabel(m_series->name());
+ labelChanged = true;
+ }
+ invalidateLegend();
+
+ if (labelChanged)
+ emit q_ptr->labelChanged();
+ if (brushChanged)
+ emit q_ptr->brushChanged();
+}
+
+#include "moc_qarealegendmarker.cpp"
+#include "moc_qarealegendmarker_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/legend/qarealegendmarker.h b/src/charts/legend/qarealegendmarker.h
new file mode 100644
index 00000000..687b4431
--- /dev/null
+++ b/src/charts/legend/qarealegendmarker.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QAREALEGENDMARKER_H
+#define QAREALEGENDMARKER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/QLegendMarker>
+#include <QtCharts/QAreaSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAreaLegendMarkerPrivate;
+
+class QT_CHARTS_EXPORT QAreaLegendMarker : public QLegendMarker
+{
+ Q_OBJECT
+
+public:
+ explicit QAreaLegendMarker(QAreaSeries *series, QLegend *legend, QObject *parent = 0);
+ virtual ~QAreaLegendMarker();
+
+ virtual LegendMarkerType type() { return LegendMarkerTypeArea; }
+
+ // Related series
+ virtual QAreaSeries* series();
+
+protected:
+ QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *parent = 0);
+
+private:
+ Q_DECLARE_PRIVATE(QAreaLegendMarker)
+ Q_DISABLE_COPY(QAreaLegendMarker)
+
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QAREALEGENDMARKER_H
diff --git a/src/charts/legend/qarealegendmarker_p.h b/src/charts/legend/qarealegendmarker_p.h
new file mode 100644
index 00000000..54d4e657
--- /dev/null
+++ b/src/charts/legend/qarealegendmarker_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QAREALEGENDMARKER_P_H
+#define QAREALEGENDMARKER_P_H
+
+#include "qchartglobal.h"
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include <QAreaSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAreaLegendMarker;
+
+class QAreaLegendMarkerPrivate : public QLegendMarkerPrivate
+{
+ Q_OBJECT
+public:
+ explicit QAreaLegendMarkerPrivate(QAreaLegendMarker *q, QAreaSeries *series, QLegend *legend);
+ virtual ~QAreaLegendMarkerPrivate();
+
+ virtual QAreaSeries* series();
+ virtual QObject* relatedObject();
+
+public Q_SLOTS:
+ virtual void updated();
+
+private:
+ QAreaLegendMarker *q_ptr;
+ QAreaSeries *m_series;
+
+ Q_DECLARE_PUBLIC(QAreaLegendMarker)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QAREALEGENDMARKER_P_H
diff --git a/src/charts/legend/qbarlegendmarker.cpp b/src/charts/legend/qbarlegendmarker.cpp
new file mode 100644
index 00000000..710c4129
--- /dev/null
+++ b/src/charts/legend/qbarlegendmarker.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbarlegendmarker.h"
+#include "qbarlegendmarker_p.h"
+#include <QAbstractBarSeries>
+#include <QBarSet>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QBarLegendMarker
+ \inmodule Qt Charts
+ \brief QLegendMarker subclass for bar series.
+ \mainclass
+
+ QBarLegendMarker is related to QAbstractBarSeries derived classes. With bar series, each marker is related to one QBarSet.
+
+ \sa QLegend, QAbstractBarSeries, QBarSet
+*/
+
+/*!
+ \fn virtual LegendMarkerType QBarLegendMarker::type()
+ Returns QLegendMarker::LegendMarkerTypeBar
+*/
+
+/*!
+ \internal
+ Constructor
+*/
+QBarLegendMarker::QBarLegendMarker(QAbstractBarSeries *series, QBarSet *barset, QLegend *legend, QObject *parent) :
+ QLegendMarker(*new QBarLegendMarkerPrivate(this,series,barset,legend), parent)
+{
+ d_ptr->updated();
+}
+
+/*!
+ Desturctor
+*/
+QBarLegendMarker::~QBarLegendMarker()
+{
+}
+
+/*!
+ \internal
+*/
+QBarLegendMarker::QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent) :
+ QLegendMarker(d, parent)
+{
+}
+
+/*!
+ Returns the related series of marker
+*/
+QAbstractBarSeries *QBarLegendMarker::series()
+{
+ Q_D(QBarLegendMarker);
+ return d->m_series;
+}
+
+/*!
+ Returns the related barset of marker
+*/
+QBarSet* QBarLegendMarker::barset()
+{
+ Q_D(QBarLegendMarker);
+ return d->m_barset;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QBarLegendMarkerPrivate::QBarLegendMarkerPrivate(QBarLegendMarker *q, QAbstractBarSeries *series, QBarSet *barset, QLegend *legend) :
+ QLegendMarkerPrivate(q,legend),
+ q_ptr(q),
+ m_series(series),
+ m_barset(barset)
+{
+ QObject::connect(m_barset, SIGNAL(penChanged()), this, SLOT(updated()));
+ QObject::connect(m_barset, SIGNAL(labelChanged()), this, SLOT(updated()));
+ QObject::connect(m_barset, SIGNAL(brushChanged()), this, SLOT(updated()));
+}
+
+QBarLegendMarkerPrivate::~QBarLegendMarkerPrivate()
+{
+}
+
+QAbstractBarSeries* QBarLegendMarkerPrivate::series()
+{
+ return m_series;
+}
+
+QObject* QBarLegendMarkerPrivate::relatedObject()
+{
+ return m_barset;
+}
+
+void QBarLegendMarkerPrivate::updated()
+{
+ bool labelChanged = false;
+ bool brushChanged = false;
+ bool penChanged = false;
+
+ if (!m_customPen && (m_item->pen() != m_barset->pen())) {
+ m_item->setPen(m_barset->pen());
+ penChanged = true;
+ }
+ if (!m_customBrush && (m_item->brush() != m_barset->brush())) {
+ m_item->setBrush(m_barset->brush());
+ brushChanged = true;
+ }
+ if (!m_customLabel && (m_item->label() != m_barset->label())) {
+ m_item->setLabel(m_barset->label());
+ labelChanged = true;
+ }
+ invalidateLegend();
+
+ if (labelChanged)
+ emit q_ptr->labelChanged();
+ if (brushChanged)
+ emit q_ptr->brushChanged();
+ if (penChanged)
+ emit q_ptr->penChanged();
+}
+
+#include "moc_qbarlegendmarker.cpp"
+#include "moc_qbarlegendmarker_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/legend/qbarlegendmarker.h b/src/charts/legend/qbarlegendmarker.h
new file mode 100644
index 00000000..4af967f7
--- /dev/null
+++ b/src/charts/legend/qbarlegendmarker.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QBARLEGENDMARKER_H
+#define QBARLEGENDMARKER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/QLegendMarker>
+#include <QtCharts/QAbstractBarSeries>
+#include <QtCharts/QBarSet>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLegend;
+class QBarLegendMarkerPrivate;
+
+class QT_CHARTS_EXPORT QBarLegendMarker : public QLegendMarker
+{
+ Q_OBJECT
+public:
+ explicit QBarLegendMarker(QAbstractBarSeries *series, QBarSet *barset, QLegend *legend, QObject *parent = 0);
+ virtual ~QBarLegendMarker();
+
+ virtual LegendMarkerType type() { return LegendMarkerTypeBar; }
+
+ // Related series and barset
+ virtual QAbstractBarSeries* series();
+ QBarSet* barset();
+
+protected:
+ QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent = 0);
+
+private:
+ Q_DECLARE_PRIVATE(QBarLegendMarker)
+ Q_DISABLE_COPY(QBarLegendMarker)
+
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARLEGENDMARKER_H
diff --git a/src/charts/legend/qbarlegendmarker_p.h b/src/charts/legend/qbarlegendmarker_p.h
new file mode 100644
index 00000000..a42fd0fa
--- /dev/null
+++ b/src/charts/legend/qbarlegendmarker_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBARLEGENDMARKER_P_H
+#define QBARLEGENDMARKER_P_H
+
+#include "qchartglobal.h"
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include <QAbstractBarSeries>
+#include <QBarSet>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBarLegendMarker;
+
+class QBarLegendMarkerPrivate : public QLegendMarkerPrivate
+{
+ Q_OBJECT
+public:
+ explicit QBarLegendMarkerPrivate(QBarLegendMarker *q, QAbstractBarSeries *series, QBarSet *barset, QLegend *legend);
+ virtual ~QBarLegendMarkerPrivate();
+
+ virtual QAbstractBarSeries* series();
+ virtual QObject* relatedObject();
+
+public Q_SLOTS:
+ virtual void updated();
+
+private:
+ QBarLegendMarker *q_ptr;
+ QAbstractBarSeries *m_series;
+ QBarSet *m_barset;
+
+ Q_DECLARE_PUBLIC(QBarLegendMarker)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBARLEGENDMARKER_P_H
diff --git a/src/charts/legend/qboxplotlegendmarker.cpp b/src/charts/legend/qboxplotlegendmarker.cpp
new file mode 100644
index 00000000..53594737
--- /dev/null
+++ b/src/charts/legend/qboxplotlegendmarker.cpp
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qboxplotlegendmarker.h"
+#include "qboxplotlegendmarker_p.h"
+#include "qboxplotseries.h"
+#include "qboxplotseries_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QBoxPlotLegendMarker
+ \inmodule Qt Charts
+ \brief QLegendMarker subclass for box plot series.
+ \mainclass
+
+ QBoxPlotLegendMarker is related to QBoxPlotSeries classes.
+
+ \sa QLegend, QBoxPlotSeries
+*/
+
+/*!
+ \fn virtual LegendMarkerType QBoxPlotLegendMarker::type()
+ Returns QLegendMarker::LegendMarkerTypeBoxPlot
+*/
+
+/*!
+ \internal
+*/
+QBoxPlotLegendMarker::QBoxPlotLegendMarker(QBoxPlotSeries *series, QLegend *legend, QObject *parent) :
+ QLegendMarker(*new QBoxPlotLegendMarkerPrivate(this,series,legend), parent)
+{
+ d_ptr->updated();
+}
+
+/*!
+ Destructor
+*/
+QBoxPlotLegendMarker::~QBoxPlotLegendMarker()
+{
+}
+
+/*!
+ \internal
+*/
+QBoxPlotLegendMarker::QBoxPlotLegendMarker(QBoxPlotLegendMarkerPrivate &d, QObject *parent) :
+ QLegendMarker(d, parent)
+{
+}
+
+/*!
+ Returns the related series
+*/
+QBoxPlotSeries* QBoxPlotLegendMarker::series()
+{
+ Q_D(QBoxPlotLegendMarker);
+ return d->m_series;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QBoxPlotLegendMarkerPrivate::QBoxPlotLegendMarkerPrivate(QBoxPlotLegendMarker *q, QBoxPlotSeries *series, QLegend *legend) :
+ QLegendMarkerPrivate(q,legend),
+ q_ptr(q),
+ m_series(series)
+{
+ QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated()));
+ QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(updated()));
+}
+
+QBoxPlotLegendMarkerPrivate::~QBoxPlotLegendMarkerPrivate()
+{
+}
+
+QAbstractSeries* QBoxPlotLegendMarkerPrivate::series()
+{
+ return m_series;
+}
+
+QObject* QBoxPlotLegendMarkerPrivate::relatedObject()
+{
+ return m_series;
+}
+
+void QBoxPlotLegendMarkerPrivate::updated()
+{
+ bool labelChanged = false;
+ bool brushChanged = false;
+
+ if (!m_customLabel && (m_item->label() != m_series->name())) {
+ m_item->setLabel(m_series->name());
+ labelChanged = true;
+ }
+ if (!m_customBrush && (m_item->brush() != m_series->brush())) {
+ m_item->setBrush(m_series->brush());
+ brushChanged = true;
+ }
+ invalidateLegend();
+
+ if (labelChanged)
+ emit q_ptr->labelChanged();
+ if (brushChanged)
+ emit q_ptr->brushChanged();
+}
+
+#include "moc_qboxplotlegendmarker.cpp"
+#include "moc_qboxplotlegendmarker_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/legend/qboxplotlegendmarker.h b/src/charts/legend/qboxplotlegendmarker.h
new file mode 100644
index 00000000..49a5859a
--- /dev/null
+++ b/src/charts/legend/qboxplotlegendmarker.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBOXPLOTLEGENDMARKER_H
+#define QBOXPLOTLEGENDMARKER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/QLegendMarker>
+#include <QtCharts/QBoxPlotSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBoxPlotLegendMarkerPrivate;
+
+class QT_CHARTS_EXPORT QBoxPlotLegendMarker : public QLegendMarker
+{
+ Q_OBJECT
+
+public:
+ explicit QBoxPlotLegendMarker(QBoxPlotSeries *series, QLegend *legend, QObject *parent = 0);
+ virtual ~QBoxPlotLegendMarker();
+
+ virtual LegendMarkerType type() { return LegendMarkerTypeBoxPlot; }
+
+ // Related series
+ virtual QBoxPlotSeries* series();
+
+protected:
+ QBoxPlotLegendMarker(QBoxPlotLegendMarkerPrivate &d, QObject *parent = 0);
+
+private:
+ Q_DECLARE_PRIVATE(QBoxPlotLegendMarker)
+ Q_DISABLE_COPY(QBoxPlotLegendMarker)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBOXPLOTLEGENDMARKER_H
diff --git a/src/charts/legend/qboxplotlegendmarker_p.h b/src/charts/legend/qboxplotlegendmarker_p.h
new file mode 100644
index 00000000..cdabb688
--- /dev/null
+++ b/src/charts/legend/qboxplotlegendmarker_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QBOXPLOTLEGENDMARKER_P_H
+#define QBOXPLOTLEGENDMARKER_P_H
+
+#include "qchartglobal.h"
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include <QBoxPlotSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QBoxPlotLegendMarker;
+
+class QBoxPlotLegendMarkerPrivate : public QLegendMarkerPrivate
+{
+ Q_OBJECT
+public:
+ explicit QBoxPlotLegendMarkerPrivate(QBoxPlotLegendMarker *q, QBoxPlotSeries *series, QLegend *legend);
+ virtual ~QBoxPlotLegendMarkerPrivate();
+
+ virtual QAbstractSeries *series();
+ virtual QObject *relatedObject();
+
+public Q_SLOTS:
+ virtual void updated();
+
+private:
+ QBoxPlotLegendMarker *q_ptr;
+ QBoxPlotSeries *m_series;
+
+ Q_DECLARE_PUBLIC(QBoxPlotLegendMarker)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QBOXPLOTLEGENDMARKER_P_H
diff --git a/src/charts/legend/qlegend.cpp b/src/charts/legend/qlegend.cpp
new file mode 100644
index 00000000..ead1fac8
--- /dev/null
+++ b/src/charts/legend/qlegend.cpp
@@ -0,0 +1,632 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "qlegend.h"
+#include "qlegend_p.h"
+#include "qabstractseries.h"
+#include "qabstractseries_p.h"
+#include "qchart_p.h"
+#include "legendlayout_p.h"
+#include "chartpresenter_p.h"
+#include "abstractchartlayout_p.h"
+#include "qlegendmarker.h"
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include "chartdataset_p.h"
+#include <QPainter>
+#include <QPen>
+#include <QGraphicsItemGroup>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QLegend
+ \inmodule Qt Charts
+ \brief Legend object.
+ \mainclass
+
+ QLegend is a graphical object for displaying the legend of the chart. Legend state is updated by QChart, when
+ series have been changed. By default, legend is drawn by QChart, but user can set a new parent to legend and
+ handle the drawing manually.
+ User isn't supposed to create or delete legend objects, but can reference it via QChart class.
+
+ \image examples_percentbarchart_legend.png
+
+ \sa QChart
+*/
+/*!
+ \qmltype Legend
+ \instantiates QLegend
+ \inqmlmodule QtCharts
+
+ \brief Legend is part of Qt Chart QML API.
+
+ Legend is a graphical object, whics displays legend of the chart. Legend state is updated by
+ ChartView, when series have been changed. Legend is used via ChartView class. For example:
+ \code
+ ChartView {
+ legend.visible: true
+ legend.alignment: Qt.AlignBottom
+ // Add a few series...
+ }
+ \endcode
+
+ \image examples_percentbarchart_legend.png
+
+ Please note that there is no QML API available for modifying legend markers, unlike in the Qt
+ API of Charts. The use case of modifying markers can be implemented for example by creating your
+ own custom legend. For an example on how to do this,
+ see \l {qmlcustomlegend}{Qml Custom Example} application.
+*/
+
+/*!
+ \property QLegend::alignment
+ \brief The alignment of the legend.
+
+ Legend paints on the defined position in the chart. The following alignments are supported:
+ Qt::AlignTop, Qt::AlignBottom, Qt::AlignLeft, Qt::AlignRight. If you set more than one flag the result is undefined.
+*/
+/*!
+ \qmlproperty Qt.Alignment Legend::alignment
+ \brief The alignment of the legend.
+
+ Legend paints on the defined position in the chart. The following alignments are supported:
+ Qt.AlignTop, Qt.AlignBottom, Qt.AlignLeft, Qt.AlignRight. If you set more than one flag the result is undefined.
+*/
+
+/*!
+ \property QLegend::backgroundVisible
+ Whether the legend background is visible or not.
+*/
+/*!
+ \qmlproperty bool Legend::backgroundVisible
+ Whether the legend background is visible or not.
+*/
+
+/*!
+ \property QLegend::color
+ The color of the legend, i.e. the background (brush) color. Note that if you change the color
+ of the legend, the style of the legend brush is set to Qt::SolidPattern.
+*/
+/*!
+ \qmlproperty color Legend::color
+ The color of the legend, i.e. the background (brush) color.
+*/
+
+/*!
+ \property QLegend::borderColor
+ The border color of the legend, i.e. the line color.
+*/
+/*!
+ \qmlproperty color Legend::borderColor
+ The border color of the legend, i.e. the line color.
+*/
+
+/*!
+ \property QLegend::font
+ The font of markers used by legend.
+*/
+/*!
+ \qmlproperty Font Legend::font
+ The font of markers used by legend.
+*/
+
+/*!
+ \property QLegend::labelColor
+ The color of brush used to draw labels.
+*/
+/*!
+ \qmlproperty color Legend::labelColor
+ The color of brush used to draw labels.
+*/
+
+/*!
+ \property QLegend::reverseMarkers
+ Whether reverse order is used for the markers in legend or not. False by default.
+*/
+/*!
+ \qmlproperty bool Legend::reverseMarkers
+ Whether reverse order is used for the markers in legend or not. False by default.
+*/
+
+/*!
+ \fn void QLegend::backgroundVisibleChanged(bool)
+ The visibility of the legend background changed to \a visible.
+*/
+
+/*!
+ \fn void QLegend::colorChanged(QColor)
+ The color of the legend background changed to \a color.
+*/
+
+/*!
+ \fn void QLegend::borderColorChanged(QColor)
+ The border color of the legend background changed to \a color.
+*/
+
+/*!
+ \fn void QLegend::fontChanged(QFont)
+ The font of markers of the legend changed to \a font.
+*/
+
+/*!
+ \fn void QLegend::labelColorChanged(QColor color)
+ This signal is emitted when the color of brush used to draw labels has changed to \a color.
+*/
+
+/*!
+ \fn void QLegend::reverseMarkersChanged(bool)
+ The use of reverse order for the markers in legend is changed to \a reverseMarkers.
+*/
+
+QLegend::QLegend(QChart *chart): QGraphicsWidget(chart),
+ d_ptr(new QLegendPrivate(chart->d_ptr->m_presenter, chart, this))
+{
+ setZValue(ChartPresenter::LegendZValue);
+ setFlags(QGraphicsItem::ItemClipsChildrenToShape);
+ QObject::connect(chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), d_ptr.data(), SLOT(handleSeriesAdded(QAbstractSeries*)));
+ QObject::connect(chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), d_ptr.data(), SLOT(handleSeriesRemoved(QAbstractSeries*)));
+ setLayout(d_ptr->m_layout);
+}
+
+/*!
+ Destroys the legend object. Legend is always owned by a QChart, so an application should never call this.
+*/
+QLegend::~QLegend()
+{
+}
+
+/*!
+ \internal
+ */
+void QLegend::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
+
+ if (!d_ptr->m_backgroundVisible)
+ return;
+
+ painter->setOpacity(opacity());
+ painter->setPen(d_ptr->m_pen);
+ painter->setBrush(d_ptr->m_brush);
+ painter->drawRoundRect(rect(), d_ptr->roundness(rect().width()), d_ptr->roundness(rect().height()));
+}
+
+
+/*!
+ Sets the \a brush of legend. Brush affects the background of legend.
+ */
+void QLegend::setBrush(const QBrush &brush)
+{
+ if (d_ptr->m_brush != brush) {
+ d_ptr->m_brush = brush;
+ update();
+ emit colorChanged(brush.color());
+ }
+}
+
+/*!
+ Returns the brush used by legend.
+ */
+QBrush QLegend::brush() const
+{
+ return d_ptr->m_brush;
+}
+
+void QLegend::setColor(QColor color)
+{
+ QBrush b = d_ptr->m_brush;
+ if (b.style() != Qt::SolidPattern || b.color() != color) {
+ b.setStyle(Qt::SolidPattern);
+ b.setColor(color);
+ setBrush(b);
+ }
+}
+
+QColor QLegend::color()
+{
+ return d_ptr->m_brush.color();
+}
+
+/*!
+ Sets the \a pen of legend. Pen affects the legend borders.
+ */
+void QLegend::setPen(const QPen &pen)
+{
+ if (d_ptr->m_pen != pen) {
+ d_ptr->m_pen = pen;
+ update();
+ emit borderColorChanged(pen.color());
+ }
+}
+
+/*!
+ Returns the pen used by legend.
+ */
+
+QPen QLegend::pen() const
+{
+ return d_ptr->m_pen;
+}
+
+void QLegend::setFont(const QFont &font)
+{
+ if (d_ptr->m_font != font) {
+ // Hide items to avoid flickering
+ d_ptr->items()->setVisible(false);
+ d_ptr->m_font = font;
+ foreach (QLegendMarker *marker, d_ptr->markers()) {
+ marker->setFont(d_ptr->m_font);
+ }
+ layout()->invalidate();
+ emit fontChanged(font);
+ }
+}
+
+QFont QLegend::font() const
+{
+ return d_ptr->m_font;
+}
+
+void QLegend::setBorderColor(QColor color)
+{
+ QPen p = d_ptr->m_pen;
+ if (p.color() != color) {
+ p.setColor(color);
+ setPen(p);
+ }
+}
+
+QColor QLegend::borderColor()
+{
+ return d_ptr->m_pen.color();
+}
+
+/*!
+ Set brush used to draw labels to \a brush.
+*/
+void QLegend::setLabelBrush(const QBrush &brush)
+{
+ if (d_ptr->m_labelBrush != brush) {
+ d_ptr->m_labelBrush = brush;
+ foreach (QLegendMarker *marker, d_ptr->markers()) {
+ marker->setLabelBrush(d_ptr->m_labelBrush);
+ // Note: The pen of the marker rectangle could be exposed in the public QLegend API
+ // instead of mapping it from label brush color
+ marker->setPen(brush.color());
+ }
+ emit labelColorChanged(brush.color());
+ }
+}
+
+/*!
+ Brush used to draw labels.
+*/
+QBrush QLegend::labelBrush() const
+{
+ return d_ptr->m_labelBrush;
+}
+
+void QLegend::setLabelColor(QColor color)
+{
+ QBrush b = d_ptr->m_labelBrush;
+ if (b.style() != Qt::SolidPattern || b.color() != color) {
+ b.setStyle(Qt::SolidPattern);
+ b.setColor(color);
+ setLabelBrush(b);
+ }
+}
+
+QColor QLegend::labelColor() const
+{
+ return d_ptr->m_labelBrush.color();
+}
+
+
+void QLegend::setAlignment(Qt::Alignment alignment)
+{
+ if (d_ptr->m_alignment != alignment) {
+ d_ptr->m_alignment = alignment;
+ layout()->invalidate();
+ }
+}
+
+Qt::Alignment QLegend::alignment() const
+{
+ return d_ptr->m_alignment;
+}
+
+/*!
+ Detaches the legend from chart. Chart won't change layout of the legend.
+ */
+void QLegend::detachFromChart()
+{
+ d_ptr->m_attachedToChart = false;
+// layout()->invalidate();
+ d_ptr->m_chart->layout()->invalidate();
+ setParent(0);
+
+}
+
+/*!
+ Attaches the legend to chart. Chart may change layout of the legend.
+ */
+void QLegend::attachToChart()
+{
+ d_ptr->m_attachedToChart = true;
+// layout()->invalidate();
+ d_ptr->m_chart->layout()->invalidate();
+ setParent(d_ptr->m_chart);
+}
+
+/*!
+ Returns true, if legend is attached to chart.
+ */
+bool QLegend::isAttachedToChart()
+{
+ return d_ptr->m_attachedToChart;
+}
+
+/*!
+ Sets the visibility of legend background to \a visible
+ */
+void QLegend::setBackgroundVisible(bool visible)
+{
+ if (d_ptr->m_backgroundVisible != visible) {
+ d_ptr->m_backgroundVisible = visible;
+ update();
+ emit backgroundVisibleChanged(visible);
+ }
+}
+
+/*!
+ Returns the visibility of legend background
+ */
+bool QLegend::isBackgroundVisible() const
+{
+ return d_ptr->m_backgroundVisible;
+}
+
+/*!
+ Returns the list of markers in legend. The list can be filtered with \a series parameter.
+ If \a series is given, only markers related to that series are returned.
+*/
+QList<QLegendMarker*> QLegend::markers(QAbstractSeries *series) const
+{
+ return d_ptr->markers(series);
+}
+
+bool QLegend::reverseMarkers()
+{
+ return d_ptr->m_reverseMarkers;
+}
+
+void QLegend::setReverseMarkers(bool reverseMarkers)
+{
+ if (d_ptr->m_reverseMarkers != reverseMarkers) {
+ d_ptr->m_reverseMarkers = reverseMarkers;
+ layout()->invalidate();
+ emit reverseMarkersChanged(reverseMarkers);
+ }
+}
+
+/*!
+ \internal \a event see QGraphicsWidget for details
+ */
+void QLegend::hideEvent(QHideEvent *event)
+{
+ if (isAttachedToChart())
+ d_ptr->m_presenter->layout()->invalidate();
+ QGraphicsWidget::hideEvent(event);
+}
+/*!
+ \internal \a event see QGraphicsWidget for details
+ */
+void QLegend::showEvent(QShowEvent *event)
+{
+ if (isAttachedToChart())
+ layout()->invalidate();
+ QGraphicsWidget::showEvent(event);
+ //layout activation will show the items
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QLegendPrivate::QLegendPrivate(ChartPresenter *presenter, QChart *chart, QLegend *q)
+ : q_ptr(q),
+ m_presenter(presenter),
+ m_layout(new LegendLayout(q)),
+ m_chart(chart),
+ m_items(new QGraphicsItemGroup(q)),
+ m_alignment(Qt::AlignTop),
+ m_brush(QBrush()),
+ m_pen(QPen()),
+ m_labelBrush(QBrush()),
+ m_diameter(5),
+ m_attachedToChart(true),
+ m_backgroundVisible(false),
+ m_reverseMarkers(false)
+{
+ m_items->setHandlesChildEvents(false);
+}
+
+QLegendPrivate::~QLegendPrivate()
+{
+
+}
+
+void QLegendPrivate::setOffset(const QPointF &offset)
+{
+ m_layout->setOffset(offset.x(), offset.y());
+}
+
+QPointF QLegendPrivate::offset() const
+{
+ return m_layout->offset();
+}
+
+int QLegendPrivate::roundness(qreal size)
+{
+ return 100 * m_diameter / int(size);
+}
+
+QList<QLegendMarker*> QLegendPrivate::markers(QAbstractSeries *series)
+{
+ // Return all markers
+ if (!series) {
+ return m_markers;
+ }
+
+ // Create filtered list
+ QList<QLegendMarker *> markers;
+ foreach (QLegendMarker *marker, m_markers) {
+ if (marker->series() == series) {
+ markers.append(marker);
+ }
+ }
+ return markers;
+}
+
+void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series)
+{
+ if (m_series.contains(series)) {
+ return;
+ }
+
+ QList<QLegendMarker*> newMarkers = series->d_ptr->createLegendMarkers(q_ptr);
+ decorateMarkers(newMarkers);
+ addMarkers(newMarkers);
+
+ QObject::connect(series->d_ptr.data(), SIGNAL(countChanged()), this, SLOT(handleCountChanged()));
+ QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
+
+ m_series.append(series);
+ m_items->setVisible(false);
+ m_layout->invalidate();
+}
+
+void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series)
+{
+ if (m_series.contains(series)) {
+ m_series.removeOne(series);
+ }
+
+ // Find out, which markers to remove
+ QList<QLegendMarker *> removed;
+ foreach (QLegendMarker *m, m_markers) {
+ if (m->series() == series) {
+ removed << m;
+ }
+ }
+ removeMarkers(removed);
+
+ QObject::disconnect(series->d_ptr.data(), SIGNAL(countChanged()), this, SLOT(handleCountChanged()));
+ QObject::disconnect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
+
+ m_layout->invalidate();
+}
+
+void QLegendPrivate::handleSeriesVisibleChanged()
+{
+ QAbstractSeries *series = qobject_cast<QAbstractSeries *> (sender());
+ Q_ASSERT(series);
+
+ foreach (QLegendMarker *marker, m_markers) {
+ if (marker->series() == series) {
+ marker->setVisible(series->isVisible());
+ }
+ }
+
+ if (m_chart->isVisible())
+ m_layout->invalidate();
+}
+
+void QLegendPrivate::handleCountChanged()
+{
+ // Here we handle the changes in marker count.
+ // Can happen for example when pieslice(s) have been added to or removed from pieseries.
+
+ QAbstractSeriesPrivate *series = qobject_cast<QAbstractSeriesPrivate *> (sender());
+ QList<QLegendMarker *> createdMarkers = series->createLegendMarkers(q_ptr);
+
+ // Find out removed markers and created markers
+ QList<QLegendMarker *> removedMarkers;
+ foreach (QLegendMarker *oldMarker, m_markers) {
+ // we have marker, which is related to sender.
+ if (oldMarker->series() == series->q_ptr) {
+ bool found = false;
+ foreach(QLegendMarker *newMarker, createdMarkers) {
+ // New marker considered existing if:
+ // - d_ptr->relatedObject() is same for both markers.
+ if (newMarker->d_ptr->relatedObject() == oldMarker->d_ptr->relatedObject()) {
+ // Delete the new marker, since we already have existing marker, that might be connected on user side.
+ found = true;
+ createdMarkers.removeOne(newMarker);
+ delete newMarker;
+ }
+ }
+ if (!found) {
+ // No related object found for marker, add to removedMarkers list
+ removedMarkers << oldMarker;
+ }
+ }
+ }
+
+ removeMarkers(removedMarkers);
+ decorateMarkers(createdMarkers);
+ addMarkers(createdMarkers);
+
+ q_ptr->layout()->invalidate();
+}
+
+void QLegendPrivate::addMarkers(QList<QLegendMarker *> markers)
+{
+ foreach (QLegendMarker *marker, markers) {
+ m_items->addToGroup(marker->d_ptr.data()->item());
+ m_markers << marker;
+ m_markerHash.insert(marker->d_ptr->item(), marker);
+ }
+}
+
+void QLegendPrivate::removeMarkers(QList<QLegendMarker *> markers)
+{
+ foreach (QLegendMarker *marker, markers) {
+ marker->d_ptr->item()->setVisible(false);
+ m_items->removeFromGroup(marker->d_ptr->item());
+ m_markers.removeOne(marker);
+ m_markerHash.remove(marker->d_ptr->item());
+ delete marker;
+ }
+}
+
+void QLegendPrivate::decorateMarkers(QList<QLegendMarker *> markers)
+{
+ foreach (QLegendMarker *marker, markers) {
+ marker->setFont(m_font);
+ marker->setLabelBrush(m_labelBrush);
+ }
+}
+
+
+#include "moc_qlegend.cpp"
+#include "moc_qlegend_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/legend/qlegend.h b/src/charts/legend/qlegend.h
new file mode 100644
index 00000000..c727e8f3
--- /dev/null
+++ b/src/charts/legend/qlegend.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLEGEND_H
+#define QLEGEND_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QGraphicsWidget>
+#include <QPen>
+#include <QBrush>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QChart;
+class QLegendPrivate;
+class QLegendMarker;
+class QAbstractSeries;
+
+class QT_CHARTS_EXPORT QLegend : public QGraphicsWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
+ Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
+ Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
+ Q_PROPERTY(bool reverseMarkers READ reverseMarkers WRITE setReverseMarkers NOTIFY reverseMarkersChanged)
+
+private:
+ explicit QLegend(QChart *chart);
+
+public:
+ ~QLegend();
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+ void setColor(QColor color);
+ QColor color();
+
+ void setPen(const QPen &pen);
+ QPen pen() const;
+ void setBorderColor(QColor color);
+ QColor borderColor();
+
+ void setFont(const QFont &font);
+ QFont font() const;
+ void setLabelBrush(const QBrush &brush);
+ QBrush labelBrush() const;
+
+ void setLabelColor(QColor color);
+ QColor labelColor() const;
+
+ void setAlignment(Qt::Alignment alignment);
+ Qt::Alignment alignment() const;
+
+ void detachFromChart();
+ void attachToChart();
+ bool isAttachedToChart();
+
+ void setBackgroundVisible(bool visible = true);
+ bool isBackgroundVisible() const;
+
+ QList <QLegendMarker*> markers(QAbstractSeries *series = 0) const;
+
+ bool reverseMarkers();
+ void setReverseMarkers(bool reverseMarkers = true);
+
+protected:
+ void hideEvent(QHideEvent *event);
+ void showEvent(QShowEvent *event);
+
+Q_SIGNALS:
+ void backgroundVisibleChanged(bool visible);
+ void colorChanged(QColor color);
+ void borderColorChanged(QColor color);
+ void fontChanged(QFont font);
+ void labelColorChanged(QColor color);
+ void reverseMarkersChanged(bool reverseMarkers);
+
+private:
+ QScopedPointer<QLegendPrivate> d_ptr;
+ Q_DISABLE_COPY(QLegend)
+ friend class LegendScroller;
+ friend class LegendLayout;
+ friend class ChartLayout;
+ friend class LegendMarkerItem;
+ friend class QLegendMarkerPrivate;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QLEGEND_H
diff --git a/src/charts/legend/qlegend_p.h b/src/charts/legend/qlegend_p.h
new file mode 100644
index 00000000..655825c6
--- /dev/null
+++ b/src/charts/legend/qlegend_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QLEGEND_P_H
+#define QLEGEND_P_H
+
+#include "qlegend.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QChart;
+class ChartPresenter;
+class QAbstractSeries;
+class LegendLayout;
+class QLegendMarker;
+
+class QLegendPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QLegendPrivate(ChartPresenter *presenter, QChart *chart, QLegend *q);
+ ~QLegendPrivate();
+
+ void setOffset(const QPointF &offset);
+ QPointF offset() const;
+ int roundness(qreal size);
+
+ QGraphicsItemGroup* items() { return m_items; }
+
+ QList<QLegendMarker*> markers(QAbstractSeries *series = 0);
+
+public Q_SLOTS:
+ void handleSeriesAdded(QAbstractSeries *series);
+ void handleSeriesRemoved(QAbstractSeries *series);
+ void handleSeriesVisibleChanged();
+ void handleCountChanged();
+
+private:
+ // Internal helpers
+ void addMarkers(QList<QLegendMarker *> markers);
+ void removeMarkers(QList<QLegendMarker *> markers);
+ void decorateMarkers(QList<QLegendMarker *> markers);
+
+private:
+ QLegend *q_ptr;
+ ChartPresenter *m_presenter;
+ LegendLayout *m_layout;
+ QChart *m_chart;
+ QGraphicsItemGroup *m_items;
+ Qt::Alignment m_alignment;
+ QBrush m_brush;
+ QPen m_pen;
+ QFont m_font;
+ QBrush m_labelBrush;
+
+ qreal m_diameter;
+ bool m_attachedToChart;
+ bool m_backgroundVisible;
+ bool m_reverseMarkers;
+
+ QList<QLegendMarker *> m_markers;
+ QList<QAbstractSeries *> m_series;
+
+ QHash<QGraphicsItem *, QLegendMarker *> m_markerHash;
+
+ friend class QLegend;
+ friend class LegendMarkerItem;
+ friend class LegendLayout;
+ friend class QLegendMarkerPrivate;
+ friend class LegendScroller;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/legend/qlegendmarker.cpp b/src/charts/legend/qlegendmarker.cpp
new file mode 100644
index 00000000..e170cb4d
--- /dev/null
+++ b/src/charts/legend/qlegendmarker.cpp
@@ -0,0 +1,294 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "qlegendmarker.h"
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include "qlegend.h"
+#include "qlegend_p.h"
+#include "legendlayout_p.h"
+#include <QFontMetrics>
+#include <QGraphicsSceneEvent>
+#include <QAbstractSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QLegendMarker
+ \inmodule Qt Charts
+ \brief LegendMarker object.
+ \mainclass
+
+ QLegendMarker is abstract object that can be used to access markers inside QLegend. Legend marker consists of two
+ items: The colored box, which reflects the color of series and label, which is the name of series (or label of slice/barset
+ in case of pie or bar series)
+ The QLegendMarker is always related to one series.
+
+ \image examples_percentbarchart_legend.png
+
+ \sa QLegend
+*/
+/*!
+ \enum QLegendMarker::LegendMarkerType
+
+ The type of the legendmarker object.
+
+ \value LegendMarkerTypeArea
+ \value LegendMarkerTypeBar
+ \value LegendMarkerTypePie
+ \value LegendMarkerTypeXY
+ \value LegendMarkerTypeBoxPlot
+*/
+
+/*!
+ \fn virtual LegendMarkerType QLegendMarker::type() = 0;
+ Returns the type of legendmarker. Type depends of the related series. LegendMarkerTypeXY is used for all QXYSeries derived
+ classes.
+*/
+
+/*!
+ \fn virtual QAbstractSeries* QLegendMarker::series() = 0;
+ Returns pointer to series, which is related to this marker. Marker is always related to some series.
+*/
+
+/*!
+ \fn void QLegendMarker::clicked();
+ This signal is emitted, when marker is clicked with mouse.
+*/
+
+/*!
+ \fn void QLegendMarker::hovered(bool status);
+ This signal is emitted, when mouse is hovered over marker. \a status is true, when mouse enters the marker
+ and false when it leaves the marker.
+*/
+
+/*!
+ \fn void QLegendMarker::labelChanged()
+ This signal is emitted when the label of the legend marker has changed.
+*/
+
+/*!
+ \fn void QLegendMarker::labelBrushChanged()
+ This signal is emitted when the label brush of the legend marker has changed.
+*/
+
+/*!
+ \fn void QLegendMarker::fontChanged()
+ This signal is emitted when the (label) font of the legend marker has changed.
+*/
+
+/*!
+ \fn void QLegendMarker::penChanged()
+ This signal is emitted when the pen of the legend marker has changed.
+*/
+
+/*!
+ \fn void QLegendMarker::brushChanged()
+ This signal is emitted when the brush of the legend marker has changed.
+*/
+
+/*!
+ \fn void QLegendMarker::visibleChanged()
+ This signal is emitted when the visibility of the legend marker has changed.
+*/
+
+/*!
+ \property QLegendMarker::label
+ Label of the marker. This is the text that is shown in legend.
+*/
+
+/*!
+ \property QLegendMarker::labelBrush
+ Brush of the label
+*/
+
+/*!
+ \property QLegendMarker::font
+ Font of the label
+*/
+
+/*!
+ \property QLegendMarker::pen
+ Pen of the marker. This is the outline of the colored square.
+*/
+
+/*!
+ \property QLegendMarker::brush
+ Brush of the marker. This is the inside of the colored square.
+*/
+
+/*!
+ \property QLegendMarker::visible
+ Visibility of the legend marker. Affects label and the colored square.
+*/
+
+
+/*!
+ \internal
+ */
+QLegendMarker::QLegendMarker(QLegendMarkerPrivate &d, QObject *parent) :
+ QObject(parent),
+ d_ptr(&d)
+{
+ d_ptr->m_item->setVisible(d_ptr->series()->isVisible());
+}
+
+/*!
+ Destructor of marker
+*/
+QLegendMarker::~QLegendMarker()
+{
+}
+
+/*!
+ Returns the label of the marker.
+*/
+QString QLegendMarker::label() const
+{
+ return d_ptr->m_item->label();
+}
+
+/*!
+ Sets the \a label of marker. Note that changing name of series will also change label of its marker.
+*/
+void QLegendMarker::setLabel(const QString &label)
+{
+ if (label.isEmpty()) {
+ d_ptr->m_customLabel = false;
+ } else {
+ d_ptr->m_customLabel = true;
+ d_ptr->m_item->setLabel(label);
+ }
+}
+/*!
+ Returns the brush which is used to draw label.
+*/
+QBrush QLegendMarker::labelBrush() const
+{
+ return d_ptr->m_item->labelBrush();
+}
+
+/*!
+ Sets the \a brush of label
+*/
+void QLegendMarker::setLabelBrush(const QBrush &brush)
+{
+ d_ptr->m_item->setLabelBrush(brush);
+}
+
+/*!
+ Retuns the font of label
+*/
+QFont QLegendMarker::font() const
+{
+ return d_ptr->m_item->font();
+}
+
+/*!
+ Sets the \a font of label
+*/
+void QLegendMarker::setFont(const QFont &font)
+{
+ d_ptr->m_item->setFont(font);
+}
+
+/*!
+ Returns the pen of marker item
+*/
+QPen QLegendMarker::pen() const
+{
+ return d_ptr->m_item->pen();
+}
+
+/*!
+ Sets the \a pen of marker item
+*/
+void QLegendMarker::setPen(const QPen &pen)
+{
+ if (pen == QPen(Qt::NoPen)) {
+ d_ptr->m_customPen = false;
+ } else {
+ d_ptr->m_customPen = true;
+ d_ptr->m_item->setPen(pen);
+ }
+}
+
+/*!
+ Returns the brush of marker item
+*/
+QBrush QLegendMarker::brush() const
+{
+ return d_ptr->m_item->brush();
+}
+
+/*!
+ Sets the \a brush of marker item. Note that changing color of the series also changes this.
+*/
+void QLegendMarker::setBrush(const QBrush &brush)
+{
+ if (brush == QBrush(Qt::NoBrush)) {
+ d_ptr->m_customBrush = false;
+ } else {
+ d_ptr->m_customBrush = true;
+ d_ptr->m_item->setBrush(brush);
+ }
+}
+
+/*!
+ Returns visibility of the marker
+*/
+bool QLegendMarker::isVisible() const
+{
+ return d_ptr->m_item->isVisible();
+}
+
+/*!
+ Sets markers visibility to \a visible
+*/
+void QLegendMarker::setVisible(bool visible)
+{
+ d_ptr->m_item->setVisible(visible);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+QLegendMarkerPrivate::QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend) :
+ m_legend(legend),
+ m_customLabel(false),
+ m_customBrush(false),
+ m_customPen(false),
+ q_ptr(q)
+{
+ m_item = new LegendMarkerItem(this);
+}
+
+QLegendMarkerPrivate::~QLegendMarkerPrivate()
+{
+ delete m_item;
+}
+
+void QLegendMarkerPrivate::invalidateLegend()
+{
+ m_legend->d_ptr->m_layout->invalidate();
+}
+
+#include "moc_qlegendmarker.cpp"
+#include "moc_qlegendmarker_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/legend/qlegendmarker.h b/src/charts/legend/qlegendmarker.h
new file mode 100644
index 00000000..0d683886
--- /dev/null
+++ b/src/charts/legend/qlegendmarker.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#ifndef QLEGENDMARKER_H
+#define QLEGENDMARKER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QObject>
+#include <QPen>
+#include <QBrush>
+#include <QFont>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLegendMarkerPrivate;
+class QAbstractSeries;
+class QLegend;
+
+class QT_CHARTS_EXPORT QLegendMarker : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum LegendMarkerType {
+ LegendMarkerTypeArea,
+ LegendMarkerTypeBar,
+ LegendMarkerTypePie,
+ LegendMarkerTypeXY,
+ LegendMarkerTypeBoxPlot
+ };
+
+ Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
+ Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged)
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
+ Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
+ Q_ENUMS(LegendMarkerType)
+
+public:
+ virtual ~QLegendMarker();
+ virtual LegendMarkerType type() = 0;
+
+ QString label() const;
+ void setLabel(const QString &label);
+
+ QBrush labelBrush() const;
+ void setLabelBrush(const QBrush &brush);
+
+ QFont font() const;
+ void setFont(const QFont &font);
+
+ QPen pen() const;
+ void setPen(const QPen &pen);
+
+ QBrush brush() const;
+ void setBrush(const QBrush &brush);
+
+ bool isVisible() const;
+ void setVisible(bool visible);
+
+ virtual QAbstractSeries* series() = 0;
+
+Q_SIGNALS:
+ void clicked();
+ void hovered(bool status);
+ void labelChanged();
+ void labelBrushChanged();
+ void fontChanged();
+ void penChanged();
+ void brushChanged();
+ void visibleChanged();
+
+protected:
+ explicit QLegendMarker(QLegendMarkerPrivate &d, QObject *parent = 0);
+
+ QScopedPointer<QLegendMarkerPrivate> d_ptr;
+ Q_DISABLE_COPY(QLegendMarker)
+ friend class QLegendPrivate;
+ friend class QLegendMarkerPrivate;
+ friend class LegendMarkerItem;
+ friend class LegendLayout;
+ friend class LegendScroller;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QLEGENDMARKER_H
diff --git a/src/charts/legend/qlegendmarker_p.h b/src/charts/legend/qlegendmarker_p.h
new file mode 100644
index 00000000..09e46f09
--- /dev/null
+++ b/src/charts/legend/qlegendmarker_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QLEGENDMARKERPRIVATE_H
+#define QLEGENDMARKERPRIVATE_H
+
+#include "qchartglobal.h"
+#include <QGraphicsObject>
+#include <QBrush>
+#include <QPen>
+#include <QGraphicsLayoutItem>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractSeries;
+class QLegend;
+
+class QLegendMarker;
+class LegendMarkerItem;
+
+class QLegendMarkerPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend);
+ virtual ~QLegendMarkerPrivate();
+
+ // Helper for now. (or declare LegendLayout as friend)
+ LegendMarkerItem* item() const { return m_item; }
+
+ virtual QAbstractSeries* series() = 0;
+ virtual QObject* relatedObject() = 0;
+
+ void invalidateLegend();
+
+public Q_SLOTS:
+ virtual void updated() = 0;
+
+protected:
+ LegendMarkerItem *m_item;
+ QLegend *m_legend;
+ bool m_customLabel;
+ bool m_customBrush;
+ bool m_customPen;
+
+private:
+ QLegendMarker *q_ptr;
+
+ friend class QLegendPrivate;
+ friend class LegendMarkerItem;
+ Q_DECLARE_PUBLIC(QLegendMarker)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QLEGENDMARKERPRIVATE_H
diff --git a/src/charts/legend/qpielegendmarker.cpp b/src/charts/legend/qpielegendmarker.cpp
new file mode 100644
index 00000000..e7bc7281
--- /dev/null
+++ b/src/charts/legend/qpielegendmarker.cpp
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpielegendmarker.h"
+#include "qpielegendmarker_p.h"
+#include <QPieSeries>
+#include <QPieSlice>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QPieLegendMarker
+ \inmodule Qt Charts
+ \brief QLegendMarker subclass for pie series.
+ \mainclass
+
+ QPieLegendMarker is related to QPieSeries. With QPieSeries, each slice of pie is related to one marker in QLegend.
+
+ \sa QLegend, QPieSeries, QPieSlice
+*/
+
+/*!
+ \fn virtual LegendMarkerType QPieLegendMarker::type()
+ Returns QLegendMarker::LegendMarkerTypePie
+*/
+
+/*!
+ \internal
+*/
+QPieLegendMarker::QPieLegendMarker(QPieSeries *series, QPieSlice *slice, QLegend *legend, QObject *parent) :
+ QLegendMarker(*new QPieLegendMarkerPrivate(this,series,slice,legend), parent)
+{
+ d_ptr->updated();
+}
+
+/*!
+ Destructor
+*/
+QPieLegendMarker::~QPieLegendMarker()
+{
+}
+
+/*!
+ \internal
+*/
+QPieLegendMarker::QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent) :
+ QLegendMarker(d, parent)
+{
+}
+
+/*!
+ Returns the related series of marker.
+*/
+QPieSeries* QPieLegendMarker::series()
+{
+ Q_D(QPieLegendMarker);
+ return d->m_series;
+}
+
+/*!
+ Returns the related slice of marker.
+*/
+QPieSlice* QPieLegendMarker::slice()
+{
+ Q_D(QPieLegendMarker);
+ return d->m_slice;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QPieLegendMarkerPrivate::QPieLegendMarkerPrivate(QPieLegendMarker *q, QPieSeries *series, QPieSlice *slice, QLegend *legend) :
+ QLegendMarkerPrivate(q,legend),
+ q_ptr(q),
+ m_series(series),
+ m_slice(slice)
+{
+ QObject::connect(m_slice, SIGNAL(labelChanged()), this, SLOT(updated()));
+ QObject::connect(m_slice, SIGNAL(brushChanged()), this, SLOT(updated()));
+ QObject::connect(m_slice, SIGNAL(penChanged()), this, SLOT(updated()));
+}
+
+QPieLegendMarkerPrivate::~QPieLegendMarkerPrivate()
+{
+}
+
+QPieSeries* QPieLegendMarkerPrivate::series()
+{
+ return m_series;
+}
+
+QObject* QPieLegendMarkerPrivate::relatedObject()
+{
+ return m_slice;
+}
+
+void QPieLegendMarkerPrivate::updated()
+{
+ bool labelChanged = false;
+ bool brushChanged = false;
+ bool penChanged = false;
+
+ if (!m_customPen && (m_item->pen() != m_slice->pen())) {
+ m_item->setPen(m_slice->pen());
+ penChanged = true;
+ }
+ if (!m_customBrush && (m_item->brush() != m_slice->brush())) {
+ m_item->setBrush(m_slice->brush());
+ brushChanged = true;
+ }
+ if (!m_customLabel && (m_item->label() != m_slice->label())) {
+ m_item->setLabel(m_slice->label());
+ labelChanged = true;
+ }
+ invalidateLegend();
+
+ if (labelChanged)
+ emit q_ptr->labelChanged();
+ if (brushChanged)
+ emit q_ptr->brushChanged();
+ if (penChanged)
+ emit q_ptr->penChanged();
+}
+
+#include "moc_qpielegendmarker.cpp"
+#include "moc_qpielegendmarker_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/legend/qpielegendmarker.h b/src/charts/legend/qpielegendmarker.h
new file mode 100644
index 00000000..c40fcf3a
--- /dev/null
+++ b/src/charts/legend/qpielegendmarker.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPIELEGENDMARKER_H
+#define QPIELEGENDMARKER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/QLegendMarker>
+#include <QtCharts/QPieSeries>
+#include <QtCharts/QPieSlice>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QPieLegendMarkerPrivate;
+
+class QT_CHARTS_EXPORT QPieLegendMarker : public QLegendMarker
+{
+ Q_OBJECT
+
+public:
+ explicit QPieLegendMarker(QPieSeries *series, QPieSlice *slice, QLegend *legend, QObject *parent = 0);
+ virtual ~QPieLegendMarker();
+
+ virtual LegendMarkerType type() { return LegendMarkerTypePie; }
+
+ // Related series and slice
+ virtual QPieSeries* series();
+ QPieSlice* slice();
+
+protected:
+ QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent = 0);
+
+private:
+ Q_DECLARE_PRIVATE(QPieLegendMarker)
+ Q_DISABLE_COPY(QPieLegendMarker)
+
+};
+
+QT_CHARTS_END_NAMESPACE
+#endif // QPIELEGENDMARKER_H
diff --git a/src/charts/legend/qpielegendmarker_p.h b/src/charts/legend/qpielegendmarker_p.h
new file mode 100644
index 00000000..44faf50b
--- /dev/null
+++ b/src/charts/legend/qpielegendmarker_p.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QPIELEGENDMARKER_P_H
+#define QPIELEGENDMARKER_P_H
+
+#include "qchartglobal.h"
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include <QPieSeries>
+#include <QPieSlice>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QPieLegendMarker;
+
+class QPieLegendMarkerPrivate : public QLegendMarkerPrivate
+{
+ Q_OBJECT
+public:
+ explicit QPieLegendMarkerPrivate(QPieLegendMarker *q, QPieSeries *series, QPieSlice *slice, QLegend *legend);
+ virtual ~QPieLegendMarkerPrivate();
+
+ // internal
+ virtual QPieSeries* series();
+ virtual QObject* relatedObject();
+
+public Q_SLOTS:
+ virtual void updated();
+
+private:
+ QPieLegendMarker *q_ptr;
+
+ QPieSeries *m_series;
+ QPieSlice *m_slice;
+
+ Q_DECLARE_PUBLIC(QPieLegendMarker)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QPIELEGENDMARKER_P_H
diff --git a/src/charts/legend/qxylegendmarker.cpp b/src/charts/legend/qxylegendmarker.cpp
new file mode 100644
index 00000000..711e74c6
--- /dev/null
+++ b/src/charts/legend/qxylegendmarker.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxylegendmarker.h"
+#include "qxylegendmarker_p.h"
+#include "qxyseries_p.h"
+#include <QXYSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QXYLegendMarker
+ \inmodule Qt Charts
+ \brief QLegendMarker subclass for QXYSeries.
+ \mainclass
+
+ QXYLegendMarker is related to QXYSeries derived classes. Each marker is related to one series.
+
+ \sa QLegend, QXYSeries, QSplineSeries, QScatterSeries, QLineSeries
+*/
+
+/*!
+ \fn virtual LegendMarkerType QXYLegendMarker::type()
+ Returns QLegendMarker::LegendMarkerTypeXY
+*/
+
+/*!
+ \internal
+*/
+QXYLegendMarker::QXYLegendMarker(QXYSeries *series, QLegend *legend, QObject *parent) :
+ QLegendMarker(*new QXYLegendMarkerPrivate(this,series,legend), parent)
+{
+ d_ptr->updated();
+}
+
+/*!
+ Destructor
+*/
+QXYLegendMarker::~QXYLegendMarker()
+{
+}
+
+/*!
+ \internal
+*/
+QXYLegendMarker::QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent) :
+ QLegendMarker(d, parent)
+{
+}
+
+/*!
+ Returns the related series
+*/
+QXYSeries* QXYLegendMarker::series()
+{
+ Q_D(QXYLegendMarker);
+ return d->m_series;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QXYLegendMarkerPrivate::QXYLegendMarkerPrivate(QXYLegendMarker *q, QXYSeries *series, QLegend *legend) :
+ QLegendMarkerPrivate(q,legend),
+ q_ptr(q),
+ m_series(series)
+{
+ QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated()));
+ QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(updated()));
+}
+
+QXYLegendMarkerPrivate::~QXYLegendMarkerPrivate()
+{
+}
+
+QAbstractSeries* QXYLegendMarkerPrivate::series()
+{
+ return m_series;
+}
+
+QObject* QXYLegendMarkerPrivate::relatedObject()
+{
+ return m_series;
+}
+
+void QXYLegendMarkerPrivate::updated()
+{
+ bool labelChanged = false;
+ bool brushChanged = false;
+
+ if (!m_customLabel && (m_item->label() != m_series->name())) {
+ m_item->setLabel(m_series->name());
+ labelChanged = true;
+ }
+
+ if (m_series->type()== QAbstractSeries::SeriesTypeScatter) {
+ if (!m_customBrush && (m_item->brush() != m_series->brush())) {
+ m_item->setBrush(m_series->brush());
+ brushChanged = true;
+ }
+ } else {
+ QBrush emptyBrush;
+ if (!m_customBrush
+ && (m_item->brush() == emptyBrush
+ || m_item->brush().color() != m_series->pen().color())) {
+ m_item->setBrush(QBrush(m_series->pen().color()));
+ brushChanged = true;
+ }
+ }
+ invalidateLegend();
+
+ if (labelChanged)
+ emit q_ptr->labelChanged();
+ if (brushChanged)
+ emit q_ptr->brushChanged();
+}
+
+#include "moc_qxylegendmarker.cpp"
+#include "moc_qxylegendmarker_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/legend/qxylegendmarker.h b/src/charts/legend/qxylegendmarker.h
new file mode 100644
index 00000000..24f0fa44
--- /dev/null
+++ b/src/charts/legend/qxylegendmarker.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QXYLEGENDMARKER_H
+#define QXYLEGENDMARKER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/QLegendMarker>
+#include <QtCharts/QXYSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QXYLegendMarkerPrivate;
+
+class QT_CHARTS_EXPORT QXYLegendMarker : public QLegendMarker
+{
+ Q_OBJECT
+public:
+ explicit QXYLegendMarker(QXYSeries *series, QLegend *legend, QObject *parent = 0);
+ virtual ~QXYLegendMarker();
+
+ virtual LegendMarkerType type() { return LegendMarkerTypeXY; }
+
+ // Related series
+ virtual QXYSeries* series();
+
+protected:
+ QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent = 0);
+
+private:
+ Q_DECLARE_PRIVATE(QXYLegendMarker)
+ Q_DISABLE_COPY(QXYLegendMarker)
+
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QXYLEGENDMARKER_H
diff --git a/src/charts/legend/qxylegendmarker_p.h b/src/charts/legend/qxylegendmarker_p.h
new file mode 100644
index 00000000..196d942f
--- /dev/null
+++ b/src/charts/legend/qxylegendmarker_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QXYLEGENDMARKER_P_H
+#define QXYLEGENDMARKER_P_H
+
+#include "qchartglobal.h"
+#include "qlegendmarker_p.h"
+#include "legendmarkeritem_p.h"
+#include <QXYSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QXYLegendMarker;
+
+class QXYLegendMarkerPrivate : public QLegendMarkerPrivate
+{
+ Q_OBJECT
+public:
+ explicit QXYLegendMarkerPrivate(QXYLegendMarker *q, QXYSeries *series, QLegend *legend);
+ virtual ~QXYLegendMarkerPrivate();
+
+ virtual QAbstractSeries* series();
+ virtual QObject* relatedObject();
+
+public Q_SLOTS:
+ virtual void updated();
+
+private:
+ QXYLegendMarker *q_ptr;
+ QXYSeries *m_series;
+
+ Q_DECLARE_PUBLIC(QXYLegendMarker)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QXYLEGENDMARKER_P_H
diff --git a/src/linechart/linechart.pri b/src/charts/linechart/linechart.pri
index 573b23d2..573b23d2 100644
--- a/src/linechart/linechart.pri
+++ b/src/charts/linechart/linechart.pri
diff --git a/src/charts/linechart/linechartitem.cpp b/src/charts/linechart/linechartitem.cpp
new file mode 100644
index 00000000..1a87342e
--- /dev/null
+++ b/src/charts/linechart/linechartitem.cpp
@@ -0,0 +1,405 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "linechartitem_p.h"
+#include "qlineseries.h"
+#include "qlineseries_p.h"
+#include "chartpresenter_p.h"
+#include "polardomain_p.h"
+#include "chartthememanager_p.h"
+#include "charttheme_p.h"
+#include <QPainter>
+#include <QGraphicsSceneMouseEvent>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+const qreal mouseEventMinWidth(12);
+
+LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item)
+ : XYChart(series,item),
+ m_series(series),
+ m_pointsVisible(false),
+ m_chartType(QChart::ChartTypeUndefined),
+ m_pointLabelsVisible(false),
+ m_pointLabelsFormat(series->pointLabelsFormat()),
+ m_pointLabelsFont(series->pointLabelsFont()),
+ m_pointLabelsColor(series->pointLabelsColor())
+{
+ setAcceptHoverEvents(true);
+ setZValue(ChartPresenter::LineChartZValue);
+ QObject::connect(series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
+ this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
+ this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
+ handleUpdated();
+}
+
+QRectF LineChartItem::boundingRect() const
+{
+ return m_rect;
+}
+
+QPainterPath LineChartItem::shape() const
+{
+ return m_shapePath;
+}
+
+void LineChartItem::updateGeometry()
+{
+ m_points = geometryPoints();
+ const QVector<QPointF> &points = m_points;
+
+ if (points.size() == 0) {
+ prepareGeometryChange();
+ m_fullPath = QPainterPath();
+ m_linePath = QPainterPath();
+ m_rect = QRect();
+ return;
+ }
+
+ QPainterPath linePath;
+ QPainterPath fullPath;
+ // Use worst case scenario to determine required margin.
+ qreal margin = m_linePen.width() * 1.42;
+
+ // Area series use component line series that aren't necessarily added to the chart themselves,
+ // so check if chart type is forced before trying to obtain it from the chart.
+ QChart::ChartType chartType = m_chartType;
+ if (chartType == QChart::ChartTypeUndefined)
+ chartType = m_series->chart()->chartType();
+
+ // For polar charts, we need special handling for angular (horizontal)
+ // points that are off-grid.
+ if (chartType == QChart::ChartTypePolar) {
+ QPainterPath linePathLeft;
+ QPainterPath linePathRight;
+ QPainterPath *currentSegmentPath = 0;
+ QPainterPath *previousSegmentPath = 0;
+ qreal minX = domain()->minX();
+ qreal maxX = domain()->maxX();
+ qreal minY = domain()->minY();
+ QPointF currentSeriesPoint = m_series->at(0);
+ QPointF currentGeometryPoint = points.at(0);
+ QPointF previousGeometryPoint = points.at(0);
+ int size = m_linePen.width();
+ bool pointOffGrid = false;
+ bool previousPointWasOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
+
+ qreal domainRadius = domain()->size().height() / 2.0;
+ const QPointF centerPoint(domainRadius, domainRadius);
+
+ if (!previousPointWasOffGrid) {
+ fullPath.moveTo(points.at(0));
+ if (m_pointsVisible && currentSeriesPoint.y() >= minY) {
+ // Do not draw ellipses for points below minimum Y.
+ linePath.addEllipse(points.at(0), size, size);
+ fullPath.addEllipse(points.at(0), size, size);
+ linePath.moveTo(points.at(0));
+ fullPath.moveTo(points.at(0));
+ }
+ }
+
+ qreal leftMarginLine = centerPoint.x() - margin;
+ qreal rightMarginLine = centerPoint.x() + margin;
+ qreal horizontal = centerPoint.y();
+
+ // See ScatterChartItem::updateGeometry() for explanation why seriesLastIndex is needed
+ const int seriesLastIndex = m_series->count() - 1;
+
+ for (int i = 1; i < points.size(); i++) {
+ // Interpolating line fragments would be ugly when thick pen is used,
+ // so we work around it by utilizing three separate
+ // paths for line segments and clip those with custom regions at paint time.
+ // "Right" path contains segments that cross the axis line with visible point on the
+ // right side of the axis line, as well as segments that have one point within the margin
+ // on the right side of the axis line and another point on the right side of the chart.
+ // "Left" path contains points with similarly on the left side.
+ // "Full" path contains rest of the points.
+ // This doesn't yield perfect results always. E.g. when segment covers more than 90
+ // degrees and both of the points are within the margin, one in the top half and one in the
+ // bottom half of the chart, the bottom one gets clipped incorrectly.
+ // However, this should be rare occurrence in any sensible chart.
+ currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
+ currentGeometryPoint = points.at(i);
+ pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
+
+ // Draw something unless both off-grid
+ if (!pointOffGrid || !previousPointWasOffGrid) {
+ QPointF intersectionPoint;
+ qreal y;
+ if (pointOffGrid != previousPointWasOffGrid) {
+ if (currentGeometryPoint.x() == previousGeometryPoint.x()) {
+ y = currentGeometryPoint.y() + (currentGeometryPoint.y() - previousGeometryPoint.y()) / 2.0;
+ } else {
+ qreal ratio = (centerPoint.x() - currentGeometryPoint.x()) / (currentGeometryPoint.x() - previousGeometryPoint.x());
+ y = currentGeometryPoint.y() + (currentGeometryPoint.y() - previousGeometryPoint.y()) * ratio;
+ }
+ intersectionPoint = QPointF(centerPoint.x(), y);
+ }
+
+ bool dummyOk; // We know points are ok, but this is needed
+ qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
+ qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
+
+ if ((qAbs(currentAngle - previousAngle) > 180.0)) {
+ // If the angle between two points is over 180 degrees (half X range),
+ // any direct segment between them becomes meaningless.
+ // In this case two line segments are drawn instead, from previous
+ // point to the center and from center to current point.
+ if ((previousAngle < 0.0 || (previousAngle <= 180.0 && previousGeometryPoint.x() < rightMarginLine))
+ && previousGeometryPoint.y() < horizontal) {
+ currentSegmentPath = &linePathRight;
+ } else if ((previousAngle > 360.0 || (previousAngle > 180.0 && previousGeometryPoint.x() > leftMarginLine))
+ && previousGeometryPoint.y() < horizontal) {
+ currentSegmentPath = &linePathLeft;
+ } else if (previousAngle > 0.0 && previousAngle < 360.0) {
+ currentSegmentPath = &linePath;
+ } else {
+ currentSegmentPath = 0;
+ }
+
+ if (currentSegmentPath) {
+ if (previousSegmentPath != currentSegmentPath)
+ currentSegmentPath->moveTo(previousGeometryPoint);
+ if (previousPointWasOffGrid)
+ fullPath.moveTo(intersectionPoint);
+
+ currentSegmentPath->lineTo(centerPoint);
+ fullPath.lineTo(centerPoint);
+ }
+
+ previousSegmentPath = currentSegmentPath;
+
+ if ((currentAngle < 0.0 || (currentAngle <= 180.0 && currentGeometryPoint.x() < rightMarginLine))
+ && currentGeometryPoint.y() < horizontal) {
+ currentSegmentPath = &linePathRight;
+ } else if ((currentAngle > 360.0 || (currentAngle > 180.0 &&currentGeometryPoint.x() > leftMarginLine))
+ && currentGeometryPoint.y() < horizontal) {
+ currentSegmentPath = &linePathLeft;
+ } else if (currentAngle > 0.0 && currentAngle < 360.0) {
+ currentSegmentPath = &linePath;
+ } else {
+ currentSegmentPath = 0;
+ }
+
+ if (currentSegmentPath) {
+ if (previousSegmentPath != currentSegmentPath)
+ currentSegmentPath->moveTo(centerPoint);
+ if (!previousSegmentPath)
+ fullPath.moveTo(centerPoint);
+
+ currentSegmentPath->lineTo(currentGeometryPoint);
+ if (pointOffGrid)
+ fullPath.lineTo(intersectionPoint);
+ else
+ fullPath.lineTo(currentGeometryPoint);
+ }
+ } else {
+ if (previousAngle < 0.0 || currentAngle < 0.0
+ || ((previousAngle <= 180.0 && currentAngle <= 180.0)
+ && ((previousGeometryPoint.x() < rightMarginLine && previousGeometryPoint.y() < horizontal)
+ || (currentGeometryPoint.x() < rightMarginLine && currentGeometryPoint.y() < horizontal)))) {
+ currentSegmentPath = &linePathRight;
+ } else if (previousAngle > 360.0 || currentAngle > 360.0
+ || ((previousAngle > 180.0 && currentAngle > 180.0)
+ && ((previousGeometryPoint.x() > leftMarginLine && previousGeometryPoint.y() < horizontal)
+ || (currentGeometryPoint.x() > leftMarginLine && currentGeometryPoint.y() < horizontal)))) {
+ currentSegmentPath = &linePathLeft;
+ } else {
+ currentSegmentPath = &linePath;
+ }
+
+ if (currentSegmentPath != previousSegmentPath)
+ currentSegmentPath->moveTo(previousGeometryPoint);
+ if (previousPointWasOffGrid)
+ fullPath.moveTo(intersectionPoint);
+
+ if (pointOffGrid)
+ fullPath.lineTo(intersectionPoint);
+ else
+ fullPath.lineTo(currentGeometryPoint);
+ currentSegmentPath->lineTo(currentGeometryPoint);
+ }
+ } else {
+ currentSegmentPath = 0;
+ }
+
+ previousPointWasOffGrid = pointOffGrid;
+ if (m_pointsVisible && !pointOffGrid && currentSeriesPoint.y() >= minY) {
+ linePath.addEllipse(points.at(i), size, size);
+ fullPath.addEllipse(points.at(i), size, size);
+ linePath.moveTo(points.at(i));
+ fullPath.moveTo(points.at(i));
+ }
+ previousSegmentPath = currentSegmentPath;
+ previousGeometryPoint = currentGeometryPoint;
+ }
+ m_linePathPolarRight = linePathRight;
+ m_linePathPolarLeft = linePathLeft;
+ // Note: This construction of m_fullpath is not perfect. The partial segments that are
+ // outside left/right clip regions at axis boundary still generate hover/click events,
+ // because shape doesn't get clipped. It doesn't seem possible to do sensibly.
+ } else { // not polar
+ linePath.moveTo(points.at(0));
+ if (m_pointsVisible) {
+ int size = m_linePen.width();
+ linePath.addEllipse(points.at(0), size, size);
+ linePath.moveTo(points.at(0));
+ for (int i = 1; i < points.size(); i++) {
+ linePath.lineTo(points.at(i));
+ linePath.addEllipse(points.at(i), size, size);
+ linePath.moveTo(points.at(i));
+ }
+ } else {
+ for (int i = 1; i < points.size(); i++)
+ linePath.lineTo(points.at(i));
+ }
+ fullPath = linePath;
+ }
+
+ QPainterPathStroker stroker;
+ // QPainter::drawLine does not respect join styles, for example BevelJoin becomes MiterJoin.
+ // This is why we are prepared for the "worst case" scenario, i.e. use always MiterJoin and
+ // multiply line width with square root of two when defining shape and bounding rectangle.
+ stroker.setWidth(margin);
+ stroker.setJoinStyle(Qt::MiterJoin);
+ stroker.setCapStyle(Qt::SquareCap);
+ stroker.setMiterLimit(m_linePen.miterLimit());
+
+ QPainterPath checkShapePath = stroker.createStroke(fullPath);
+
+ // Only zoom in if the bounding rects of the paths fit inside int limits. QWidget::update() uses
+ // a region that has to be compatible with QRect.
+ if (checkShapePath.boundingRect().height() <= INT_MAX
+ && checkShapePath.boundingRect().width() <= INT_MAX
+ && linePath.boundingRect().height() <= INT_MAX
+ && linePath.boundingRect().width() <= INT_MAX
+ && fullPath.boundingRect().height() <= INT_MAX
+ && fullPath.boundingRect().width() <= INT_MAX) {
+ prepareGeometryChange();
+
+ m_linePath = linePath;
+ m_fullPath = fullPath;
+ m_shapePath = checkShapePath;
+
+ m_rect = m_shapePath.boundingRect();
+ } else {
+ update();
+ }
+}
+
+void LineChartItem::handleUpdated()
+{
+ // If points visibility has changed, a geometry update is needed.
+ // Also, if pen changes when points are visible, geometry update is needed.
+ bool doGeometryUpdate =
+ (m_pointsVisible != m_series->pointsVisible())
+ || (m_series->pointsVisible() && (m_linePen != m_series->pen()));
+ setVisible(m_series->isVisible());
+ setOpacity(m_series->opacity());
+ m_pointsVisible = m_series->pointsVisible();
+ m_linePen = m_series->pen();
+ m_pointLabelsFormat = m_series->pointLabelsFormat();
+ m_pointLabelsVisible = m_series->pointLabelsVisible();
+ m_pointLabelsFont = m_series->pointLabelsFont();
+ m_pointLabelsColor = m_series->pointLabelsColor();
+ if (doGeometryUpdate)
+ updateGeometry();
+ update();
+}
+
+void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(widget)
+ Q_UNUSED(option)
+
+ QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
+
+ painter->save();
+ painter->setPen(m_linePen);
+ bool alwaysUsePath = false;
+
+ if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
+ qreal halfWidth = domain()->size().width() / 2.0;
+ QRectF clipRectLeft = QRectF(0, 0, halfWidth, domain()->size().height());
+ QRectF clipRectRight = QRectF(halfWidth, 0, halfWidth, domain()->size().height());
+ QRegion fullPolarClipRegion(clipRect.toRect(), QRegion::Ellipse);
+ QRegion clipRegionLeft(fullPolarClipRegion.intersected(clipRectLeft.toRect()));
+ QRegion clipRegionRight(fullPolarClipRegion.intersected(clipRectRight.toRect()));
+ painter->setClipRegion(clipRegionLeft);
+ painter->drawPath(m_linePathPolarLeft);
+ painter->setClipRegion(clipRegionRight);
+ painter->drawPath(m_linePathPolarRight);
+ painter->setClipRegion(fullPolarClipRegion);
+ alwaysUsePath = true; // required for proper clipping
+ } else {
+ painter->setClipRect(clipRect);
+ }
+
+ if (m_pointsVisible) {
+ painter->setBrush(m_linePen.color());
+ painter->drawPath(m_linePath);
+ } else {
+ painter->setBrush(QBrush(Qt::NoBrush));
+ if (m_linePen.style() != Qt::SolidLine || alwaysUsePath) {
+ // If pen style is not solid line, always fall back to path painting
+ // to ensure proper continuity of the pattern
+ painter->drawPath(m_linePath);
+ } else {
+ for (int i(1); i < m_points.size(); i++)
+ painter->drawLine(m_points.at(i - 1), m_points.at(i));
+ }
+ }
+
+ if (m_pointLabelsVisible)
+ m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2);
+
+ painter->restore();
+
+}
+
+void LineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ emit XYChart::clicked(domain()->calculateDomainPoint(event->pos()));
+ QGraphicsItem::mousePressEvent(event);
+}
+
+void LineChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), true);
+// event->accept();
+ QGraphicsItem::hoverEnterEvent(event);
+}
+
+void LineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), false);
+// event->accept();
+ QGraphicsItem::hoverEnterEvent(event);
+}
+
+#include "moc_linechartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/linechart/linechartitem_p.h b/src/charts/linechart/linechartitem_p.h
new file mode 100644
index 00000000..08b304f2
--- /dev/null
+++ b/src/charts/linechart/linechartitem_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef LINECHARTITEM_H
+#define LINECHARTITEM_H
+
+#include "qchartglobal.h"
+#include "xychart_p.h"
+#include "qchart.h"
+#include <QPen>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLineSeries;
+class ChartPresenter;
+
+class LineChartItem : public XYChart
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsItem)
+public:
+ explicit LineChartItem(QLineSeries *series, QGraphicsItem *item = 0);
+ ~LineChartItem() {}
+
+ //from QGraphicsItem
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ QPainterPath shape() const;
+
+ QPainterPath path() const { return m_fullPath; }
+
+public Q_SLOTS:
+ void handleUpdated();
+
+protected:
+ void updateGeometry();
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+ void suppressPoints() { m_pointsVisible = false; }
+ void forceChartType(QChart::ChartType chartType) { m_chartType = chartType; }
+
+private:
+ QLineSeries *m_series;
+ QPainterPath m_linePath;
+ QPainterPath m_linePathPolarRight;
+ QPainterPath m_linePathPolarLeft;
+ QPainterPath m_fullPath;
+ QPainterPath m_shapePath;
+
+ QVector<QPointF> m_points;
+ QRectF m_rect;
+ QPen m_linePen;
+ bool m_pointsVisible;
+ QChart::ChartType m_chartType;
+
+ bool m_pointLabelsVisible;
+ QString m_pointLabelsFormat;
+ QFont m_pointLabelsFont;
+ QColor m_pointLabelsColor;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/linechart/qlineseries.cpp b/src/charts/linechart/qlineseries.cpp
new file mode 100644
index 00000000..b4171b9c
--- /dev/null
+++ b/src/charts/linechart/qlineseries.cpp
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qlineseries.h"
+#include "qlineseries_p.h"
+#include "linechartitem_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "qchart_p.h"
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QLineSeries
+ \inmodule Qt Charts
+ \brief The QLineSeries class is used for making line charts.
+
+ \mainclass
+
+ A line chart is used to show information as a series of data points
+ connected by straight lines.
+
+ \image examples_linechart.png
+
+ Creating basic line chart is simple:
+ \code
+ QLineSeries* series = new QLineSeries();
+ series->append(0, 6);
+ series->append(2, 4);
+ ...
+ chart->addSeries(series);
+ \endcode
+*/
+/*!
+ \qmltype LineSeries
+ \instantiates QLineSeries
+ \inqmlmodule QtCharts
+
+ \inherits XYSeries
+
+ \brief The LineSeries type is used for making line charts.
+
+ The following QML shows how to create a simple line chart:
+ \snippet qmlchart/qml/qmlchart/View2.qml 1
+ \beginfloatleft
+ \image examples_qmlchart2.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ \fn virtual SeriesType QLineSeries::type() const
+ \brief Returns type of series.
+ \sa QAbstractSeries, SeriesType
+*/
+
+/*!
+ \qmlproperty real LineSeries::width
+ The width of the line. By default the width is 2.0.
+*/
+
+/*!
+ \qmlproperty Qt::PenStyle LineSeries::style
+ Controls the style of the line. Set to one of Qt.NoPen, Qt.SolidLine, Qt.DashLine, Qt.DotLine,
+ Qt.DashDotLine or Qt.DashDotDotLine. Using Qt.CustomDashLine is not supported in the QML API.
+ By default the style is Qt.SolidLine.
+*/
+
+/*!
+ \qmlproperty Qt::PenCapStyle LineSeries::capStyle
+ Controls the cap style of the line. Set to one of Qt.FlatCap, Qt.SquareCap or Qt.RoundCap. By
+ default the cap style is Qt.SquareCap.
+*/
+
+/*!
+ Constructs empty series object which is a child of \a parent.
+ When series object is added to QChartView or QChart instance ownerships is transferred.
+*/
+QLineSeries::QLineSeries(QObject *parent)
+ : QXYSeries(*new QLineSeriesPrivate(this), parent)
+{
+
+}
+
+/*!
+ \internal
+*/
+QLineSeries::QLineSeries(QLineSeriesPrivate &d, QObject *parent)
+ : QXYSeries(d, parent)
+{
+
+}
+/*!
+ Destroys the object. Series added to QChartView or QChart instances are owned by those,
+ and are deleted when mentioned object are destroyed.
+*/
+QLineSeries::~QLineSeries()
+{
+ Q_D(QLineSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+
+QAbstractSeries::SeriesType QLineSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeLine;
+}
+
+/*
+QDebug operator<< (QDebug debug, const QLineSeries series)
+{
+ Q_ASSERT(series.d_func()->m_x.size() == series.d_func()->m_y.size());
+ int size = series.d_func()->m_x.size();
+ for (int i=0; i<size; i++) {
+ debug.nospace() << "(" << series.d_func()->m_x.at(i) << ','<< series.d_func()->m_y.at(i) << ") ";
+ }
+ return debug.space();
+}
+*/
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QLineSeriesPrivate::QLineSeriesPrivate(QLineSeries *q)
+ : QXYSeriesPrivate(q)
+{
+
+};
+
+void QLineSeriesPrivate::initializeGraphics(QGraphicsItem *parent)
+{
+ Q_Q(QLineSeries);
+ LineChartItem *line = new LineChartItem(q,parent);
+ m_item.reset(line);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+void QLineSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
+{
+ Q_Q(QLineSeries);
+ const QList<QColor> colors = theme->seriesColors();
+
+ if (forced || QChartPrivate::defaultPen() == m_pen) {
+ QPen pen;
+ pen.setColor(colors.at(index % colors.size()));
+ pen.setWidthF(2);
+ q->setPen(pen);
+ }
+
+ if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
+ QColor color = theme->labelBrush().color();
+ q->setPointLabelsColor(color);
+ }
+}
+
+#include "moc_qlineseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/linechart/qlineseries.h b/src/charts/linechart/qlineseries.h
new file mode 100644
index 00000000..02303c11
--- /dev/null
+++ b/src/charts/linechart/qlineseries.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLINESERIES_H
+#define QLINESERIES_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/qxyseries.h>
+#include <QPen>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QLineSeriesPrivate;
+
+class QT_CHARTS_EXPORT QLineSeries : public QXYSeries
+{
+ Q_OBJECT
+
+public:
+ explicit QLineSeries(QObject *parent = 0);
+ ~QLineSeries();
+ QAbstractSeries::SeriesType type() const;
+
+protected:
+ QLineSeries(QLineSeriesPrivate &d, QObject *parent = 0);
+
+private:
+ Q_DECLARE_PRIVATE(QLineSeries)
+ Q_DISABLE_COPY(QLineSeries)
+ friend class LineChartItem;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QLINESERIES_H
diff --git a/src/charts/linechart/qlineseries_p.h b/src/charts/linechart/qlineseries_p.h
new file mode 100644
index 00000000..4fc9b904
--- /dev/null
+++ b/src/charts/linechart/qlineseries_p.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QLINESERIES_P_H
+#define QLINESERIES_P_H
+
+#include "qxyseries_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+
+class QLineSeriesPrivate: public QXYSeriesPrivate
+{
+public:
+ QLineSeriesPrivate(QLineSeries *q);
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeTheme(int index, ChartTheme* theme, bool forced = false);
+
+private:
+ Q_DECLARE_PUBLIC(QLineSeries);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/piechart/piechart.pri b/src/charts/piechart/piechart.pri
index 2c45c4e6..2c45c4e6 100644
--- a/src/piechart/piechart.pri
+++ b/src/charts/piechart/piechart.pri
diff --git a/src/charts/piechart/piechartitem.cpp b/src/charts/piechart/piechartitem.cpp
new file mode 100644
index 00000000..dbf7edf8
--- /dev/null
+++ b/src/charts/piechart/piechartitem.cpp
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "piechartitem_p.h"
+#include "piesliceitem_p.h"
+#include "qpieslice.h"
+#include "qpieslice_p.h"
+#include "qpieseries.h"
+#include "qpieseries_p.h"
+#include "chartpresenter_p.h"
+#include "chartdataset_p.h"
+#include "pieanimation_p.h"
+#include <QPainter>
+#include <QTimer>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+PieChartItem::PieChartItem(QPieSeries *series, QGraphicsItem* item)
+ : ChartItem(series->d_func(),item),
+ m_series(series),
+ m_animation(0)
+{
+ Q_ASSERT(series);
+
+ QPieSeriesPrivate *p = QPieSeriesPrivate::fromSeries(series);
+ connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
+ connect(series, SIGNAL(opacityChanged()), this, SLOT(handleOpacityChanged()));
+ connect(series, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleSlicesAdded(QList<QPieSlice*>)));
+ connect(series, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleSlicesRemoved(QList<QPieSlice*>)));
+ connect(p, SIGNAL(horizontalPositionChanged()), this, SLOT(updateLayout()));
+ connect(p, SIGNAL(verticalPositionChanged()), this, SLOT(updateLayout()));
+ connect(p, SIGNAL(pieSizeChanged()), this, SLOT(updateLayout()));
+ connect(p, SIGNAL(calculatedDataChanged()), this, SLOT(updateLayout()));
+
+ // Note: the following does not affect as long as the item does not have anything to paint
+ setZValue(ChartPresenter::PieSeriesZValue);
+
+ // Note: will not create slice items until we have a proper rectangle to draw on.
+}
+
+PieChartItem::~PieChartItem()
+{
+ // slices deleted automatically through QGraphicsItem
+ if (m_series) {
+ m_series->disconnect(this);
+ QPieSeriesPrivate::fromSeries(m_series)->disconnect(this);
+ }
+ foreach (QPieSlice *slice, m_sliceItems.keys()) {
+ slice->disconnect(this);
+ QPieSlicePrivate::fromSlice(slice)->disconnect(this);
+ }
+}
+
+void PieChartItem::setAnimation(PieAnimation *animation)
+{
+ m_animation = animation;
+}
+
+ChartAnimation *PieChartItem::animation() const
+{
+ return m_animation;
+}
+
+void PieChartItem::handleDomainUpdated()
+{
+ QRectF rect(QPointF(0,0),domain()->size());
+ if(m_rect!=rect){
+ prepareGeometryChange();
+ m_rect = rect;
+ updateLayout();
+
+ if (m_sliceItems.isEmpty())
+ handleSlicesAdded(m_series->slices());
+ }
+}
+
+void PieChartItem::updateLayout()
+{
+ // find pie center coordinates
+ m_pieCenter.setX(m_rect.left() + (m_rect.width() * m_series->horizontalPosition()));
+ m_pieCenter.setY(m_rect.top() + (m_rect.height() * m_series->verticalPosition()));
+
+ // find maximum radius for pie
+ m_pieRadius = m_rect.height() / 2;
+ if (m_rect.width() < m_rect.height())
+ m_pieRadius = m_rect.width() / 2;
+
+ m_holeSize = m_pieRadius;
+ // apply size factor
+ m_pieRadius *= m_series->pieSize();
+ m_holeSize *= m_series->holeSize();
+
+ // set layouts for existing slice items
+ foreach (QPieSlice *slice, m_series->slices()) {
+ PieSliceItem *sliceItem = m_sliceItems.value(slice);
+ if (sliceItem) {
+ PieSliceData sliceData = updateSliceGeometry(slice);
+ if (m_animation)
+ presenter()->startAnimation(m_animation->updateValue(sliceItem, sliceData));
+ else
+ sliceItem->setLayout(sliceData);
+ }
+ }
+
+ update();
+}
+
+void PieChartItem::handleSlicesAdded(QList<QPieSlice *> slices)
+{
+ // delay creating slice items until there is a proper rectangle
+ if (!m_rect.isValid() && m_sliceItems.isEmpty())
+ return;
+
+ themeManager()->updateSeries(m_series);
+
+ bool startupAnimation = m_sliceItems.isEmpty();
+
+ foreach(QPieSlice * slice, slices) {
+ PieSliceItem *sliceItem = new PieSliceItem(this);
+ m_sliceItems.insert(slice, sliceItem);
+
+ // Note: no need to connect to slice valueChanged() etc.
+ // This is handled through calculatedDataChanged signal.
+ connect(slice, SIGNAL(labelChanged()), this, SLOT(handleSliceChanged()));
+ connect(slice, SIGNAL(labelVisibleChanged()), this, SLOT(handleSliceChanged()));
+ connect(slice, SIGNAL(penChanged()), this, SLOT(handleSliceChanged()));
+ connect(slice, SIGNAL(brushChanged()), this, SLOT(handleSliceChanged()));
+ connect(slice, SIGNAL(labelBrushChanged()), this, SLOT(handleSliceChanged()));
+ connect(slice, SIGNAL(labelFontChanged()), this, SLOT(handleSliceChanged()));
+
+ QPieSlicePrivate *p = QPieSlicePrivate::fromSlice(slice);
+ connect(p, SIGNAL(labelPositionChanged()), this, SLOT(handleSliceChanged()));
+ connect(p, SIGNAL(explodedChanged()), this, SLOT(handleSliceChanged()));
+ connect(p, SIGNAL(labelArmLengthFactorChanged()), this, SLOT(handleSliceChanged()));
+ connect(p, SIGNAL(explodeDistanceFactorChanged()), this, SLOT(handleSliceChanged()));
+
+ connect(sliceItem, SIGNAL(clicked(Qt::MouseButtons)), slice, SIGNAL(clicked()));
+ connect(sliceItem, SIGNAL(hovered(bool)), slice, SIGNAL(hovered(bool)));
+
+ PieSliceData sliceData = updateSliceGeometry(slice);
+ if (m_animation)
+ presenter()->startAnimation(m_animation->addSlice(sliceItem, sliceData, startupAnimation));
+ else
+ sliceItem->setLayout(sliceData);
+ }
+}
+
+void PieChartItem::handleSlicesRemoved(QList<QPieSlice *> slices)
+{
+ themeManager()->updateSeries(m_series);
+
+ foreach (QPieSlice *slice, slices) {
+
+ PieSliceItem *sliceItem = m_sliceItems.value(slice);
+
+ // this can happen if you call append() & remove() in a row so that PieSliceItem is not even created
+ if (!sliceItem)
+ continue;
+
+ m_sliceItems.remove(slice);
+ slice->disconnect(this);
+ QPieSlicePrivate::fromSlice(slice)->disconnect(this);
+
+ if (m_animation)
+ presenter()->startAnimation(m_animation->removeSlice(sliceItem)); // animator deletes the PieSliceItem
+ else
+ delete sliceItem;
+ }
+}
+
+void PieChartItem::handleSliceChanged()
+{
+ QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
+ if (!slice) {
+ QPieSlicePrivate *slicep = qobject_cast<QPieSlicePrivate *>(sender());
+ slice = slicep->q_ptr;
+ }
+ Q_ASSERT(m_sliceItems.contains(slice));
+
+ PieSliceItem *sliceItem = m_sliceItems.value(slice);
+ PieSliceData sliceData = updateSliceGeometry(slice);
+ if (m_animation)
+ presenter()->startAnimation(m_animation->updateValue(sliceItem, sliceData));
+ else
+ sliceItem->setLayout(sliceData);
+
+ update();
+}
+
+void PieChartItem::handleSeriesVisibleChanged()
+{
+ setVisible(m_series->isVisible());
+}
+
+void PieChartItem::handleOpacityChanged()
+{
+ setOpacity(m_series->opacity());
+}
+
+PieSliceData PieChartItem::updateSliceGeometry(QPieSlice *slice)
+{
+ PieSliceData &sliceData = QPieSlicePrivate::fromSlice(slice)->m_data;
+ sliceData.m_center = PieSliceItem::sliceCenter(m_pieCenter, m_pieRadius, slice);
+ sliceData.m_radius = m_pieRadius;
+ sliceData.m_holeRadius = m_holeSize;
+ return sliceData;
+}
+
+#include "moc_piechartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/piechart/piechartitem_p.h b/src/charts/piechart/piechartitem_p.h
new file mode 100644
index 00000000..a6511b42
--- /dev/null
+++ b/src/charts/piechart/piechartitem_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef PIECHARTITEM_H
+#define PIECHARTITEM_H
+
+#include "qpieseries.h"
+#include "chartitem_p.h"
+#include "piesliceitem_p.h"
+#include <QPointer>
+
+class QGraphicsItem;
+QT_CHARTS_BEGIN_NAMESPACE
+class QPieSlice;
+class ChartPresenter;
+class PieAnimation;
+
+class PieChartItem : public ChartItem
+{
+ Q_OBJECT
+
+public:
+ explicit PieChartItem(QPieSeries *series, QGraphicsItem* item = 0);
+ ~PieChartItem();
+
+ // from QGraphicsItem
+ QRectF boundingRect() const { return m_rect; }
+ void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {}
+
+public Q_SLOTS:
+ // from Chart
+ virtual void handleDomainUpdated();
+
+ void updateLayout();
+ void handleSlicesAdded(QList<QPieSlice *> slices);
+ void handleSlicesRemoved(QList<QPieSlice *> slices);
+ void handleSliceChanged();
+ void handleSeriesVisibleChanged();
+ void handleOpacityChanged();
+
+ void setAnimation(PieAnimation *animation);
+ ChartAnimation *animation() const;
+
+private:
+ PieSliceData updateSliceGeometry(QPieSlice *slice);
+
+private:
+ QHash<QPieSlice *, PieSliceItem *> m_sliceItems;
+ QPointer<QPieSeries> m_series;
+ QRectF m_rect;
+ QPointF m_pieCenter;
+ qreal m_pieRadius;
+ qreal m_holeSize;
+ PieAnimation *m_animation;
+
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // PIECHARTITEM_H
diff --git a/src/charts/piechart/pieslicedata_p.h b/src/charts/piechart/pieslicedata_p.h
new file mode 100644
index 00000000..37985121
--- /dev/null
+++ b/src/charts/piechart/pieslicedata_p.h
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef PIESLICEDATA_P_H
+#define PIESLICEDATA_P_H
+
+#include <qchartglobal.h>
+#include <qpieslice.h>
+#include <QPen>
+#include <QBrush>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+template <class T>
+class Themed : public T
+{
+public:
+ Themed(): m_isThemed(true) {}
+
+ inline T &operator=(const T &other) { return T::operator =(other); }
+
+ inline bool operator!=(const T &other) const { return T::operator !=(other); }
+ inline bool operator!=(const Themed &other) const
+ {
+ if (T::operator !=(other))
+ return true;
+
+ if (m_isThemed != other.m_isThemed)
+ return true;
+
+ return false;
+ }
+
+ inline void setThemed(bool state) { m_isThemed = state; }
+ inline bool isThemed() const { return m_isThemed; }
+
+private:
+ bool m_isThemed;
+};
+
+class PieSliceData
+{
+public:
+ PieSliceData() :
+ m_value(0),
+ m_isExploded(false),
+ m_explodeDistanceFactor(0.15),
+ m_isLabelVisible(false),
+ m_labelPosition(QPieSlice::LabelOutside),
+ m_labelArmLengthFactor(0.15),
+ m_percentage(0),
+ m_radius(0),
+ m_startAngle(0),
+ m_angleSpan(0),
+ m_holeRadius(0)
+ {
+ }
+
+ bool operator!=(const PieSliceData &other) const {
+ if (!qFuzzyIsNull(m_value - other.m_value))
+ return true;
+
+ if (m_slicePen != other.m_slicePen ||
+ m_sliceBrush != other.m_sliceBrush)
+ return true;
+
+ if (m_isExploded != other.m_isExploded ||
+ !qFuzzyIsNull(m_explodeDistanceFactor - other.m_explodeDistanceFactor))
+ return true;
+
+ if (m_isLabelVisible != other.m_isLabelVisible ||
+ m_labelText != other.m_labelText ||
+ m_labelFont != other.m_labelFont ||
+ m_labelPosition != other.m_labelPosition ||
+ !qFuzzyIsNull(m_labelArmLengthFactor - other.m_labelArmLengthFactor) ||
+ m_labelBrush != other.m_labelBrush)
+ return true;
+
+ if (!qFuzzyIsNull(m_percentage - other.m_percentage) ||
+ m_center != other.m_center ||
+ !qFuzzyIsNull(m_radius - other.m_radius) ||
+ !qFuzzyIsNull(m_startAngle - other.m_startAngle) ||
+ !qFuzzyIsNull(m_angleSpan - other.m_angleSpan))
+ return true;
+
+ return false;
+ }
+
+ qreal m_value;
+
+ Themed<QPen> m_slicePen;
+ Themed<QBrush> m_sliceBrush;
+
+ bool m_isExploded;
+ qreal m_explodeDistanceFactor;
+
+ bool m_isLabelVisible;
+ QString m_labelText;
+ Themed<QFont> m_labelFont;
+ QPieSlice::LabelPosition m_labelPosition;
+ qreal m_labelArmLengthFactor;
+ Themed<QBrush> m_labelBrush;
+
+ qreal m_percentage;
+ QPointF m_center;
+ qreal m_radius;
+ qreal m_startAngle;
+ qreal m_angleSpan;
+
+ qreal m_holeRadius;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // PIESLICEDATA_P_H
diff --git a/src/charts/piechart/piesliceitem.cpp b/src/charts/piechart/piesliceitem.cpp
new file mode 100644
index 00000000..70f03a94
--- /dev/null
+++ b/src/charts/piechart/piesliceitem.cpp
@@ -0,0 +1,319 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "piesliceitem_p.h"
+#include "piechartitem_p.h"
+#include "qpieseries.h"
+#include "qpieslice.h"
+#include "chartpresenter_p.h"
+#include <QPainter>
+#include <qmath.h>
+#include <QGraphicsSceneEvent>
+#include <QTime>
+#include <QTextDocument>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+QPointF offset(qreal angle, qreal length)
+{
+ qreal dx = qSin(angle * (M_PI / 180)) * length;
+ qreal dy = qCos(angle * (M_PI / 180)) * length;
+ return QPointF(dx, -dy);
+}
+
+PieSliceItem::PieSliceItem(QGraphicsItem *parent)
+ : QGraphicsObject(parent),
+ m_hovered(false)
+{
+ setAcceptHoverEvents(true);
+ setAcceptedMouseButtons(Qt::MouseButtonMask);
+ setZValue(ChartPresenter::PieSeriesZValue);
+ m_labelItem = new QGraphicsTextItem(this);
+ m_labelItem->document()->setDocumentMargin(1.0);
+}
+
+PieSliceItem::~PieSliceItem()
+{
+ // If user is hovering over the slice and it gets destroyed we do
+ // not get a hover leave event. So we must emit the signal here.
+ if (m_hovered)
+ emit hovered(false);
+}
+
+QRectF PieSliceItem::boundingRect() const
+{
+ return m_boundingRect;
+}
+
+QPainterPath PieSliceItem::shape() const
+{
+ // Don't include the label and label arm.
+ // This is used to detect a mouse clicks. We do not want clicks from label.
+ return m_slicePath;
+}
+
+void PieSliceItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
+{
+ painter->save();
+ painter->setClipRect(parentItem()->boundingRect());
+ painter->setPen(m_data.m_slicePen);
+ painter->setBrush(m_data.m_sliceBrush);
+ painter->drawPath(m_slicePath);
+ painter->restore();
+
+ if (m_data.m_isLabelVisible) {
+ painter->save();
+
+ // Pen for label arm not defined in the QPieSeries api, let's use brush's color instead
+ painter->setBrush(m_data.m_labelBrush);
+
+ if (m_data.m_labelPosition == QPieSlice::LabelOutside) {
+ painter->setClipRect(parentItem()->boundingRect());
+ painter->strokePath(m_labelArmPath, m_data.m_labelBrush.color());
+ }
+
+ painter->restore();
+ }
+}
+
+void PieSliceItem::hoverEnterEvent(QGraphicsSceneHoverEvent * /*event*/)
+{
+ m_hovered = true;
+ emit hovered(true);
+}
+
+void PieSliceItem::hoverLeaveEvent(QGraphicsSceneHoverEvent * /*event*/)
+{
+ m_hovered = false;
+ emit hovered(false);
+}
+
+void PieSliceItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ emit clicked(event->buttons());
+}
+
+void PieSliceItem::setLayout(const PieSliceData &sliceData)
+{
+ m_data = sliceData;
+ updateGeometry();
+ update();
+}
+
+void PieSliceItem::updateGeometry()
+{
+ if (m_data.m_radius <= 0)
+ return;
+
+ prepareGeometryChange();
+
+ // slice path
+ qreal centerAngle;
+ QPointF armStart;
+ m_slicePath = slicePath(m_data.m_center, m_data.m_radius, m_data.m_startAngle, m_data.m_angleSpan, &centerAngle, &armStart);
+
+ m_labelItem->setVisible(m_data.m_isLabelVisible);
+
+ if (m_data.m_isLabelVisible) {
+ // text rect
+ m_labelTextRect = ChartPresenter::textBoundingRect(m_data.m_labelFont,
+ m_data.m_labelText,
+ 0);
+
+ QString label(m_data.m_labelText);
+ m_labelItem->setDefaultTextColor(m_data.m_labelBrush.color());
+ m_labelItem->setFont(m_data.m_labelFont);
+
+ // text position
+ if (m_data.m_labelPosition == QPieSlice::LabelOutside) {
+ setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
+
+ // label arm path
+ QPointF labelTextStart;
+ m_labelArmPath = labelArmPath(armStart, centerAngle,
+ m_data.m_radius * m_data.m_labelArmLengthFactor,
+ m_labelTextRect.width(), &labelTextStart);
+
+ m_labelTextRect.moveBottomLeft(labelTextStart);
+ if (m_labelTextRect.left() < 0)
+ m_labelTextRect.setLeft(0);
+ else if (m_labelTextRect.left() < parentItem()->boundingRect().left())
+ m_labelTextRect.setLeft(parentItem()->boundingRect().left());
+ if (m_labelTextRect.right() > parentItem()->boundingRect().right())
+ m_labelTextRect.setRight(parentItem()->boundingRect().right());
+
+ label = ChartPresenter::truncatedText(m_data.m_labelFont, m_data.m_labelText,
+ qreal(0.0), m_labelTextRect.width(),
+ m_labelTextRect.height(), m_labelTextRect);
+ m_labelArmPath = labelArmPath(armStart, centerAngle,
+ m_data.m_radius * m_data.m_labelArmLengthFactor,
+ m_labelTextRect.width(), &labelTextStart);
+ m_labelTextRect.moveBottomLeft(labelTextStart);
+
+ m_labelItem->setTextWidth(m_labelTextRect.width()
+ + m_labelItem->document()->documentMargin());
+ m_labelItem->setHtml(label);
+ m_labelItem->setRotation(0);
+ m_labelItem->setPos(m_labelTextRect.x(), m_labelTextRect.y() + 1.0);
+ } else {
+ // label inside
+ setFlag(QGraphicsItem::ItemClipsChildrenToShape);
+ m_labelItem->setTextWidth(m_labelTextRect.width()
+ + m_labelItem->document()->documentMargin());
+ m_labelItem->setHtml(label);
+
+ QPointF textCenter;
+ if (m_data.m_holeRadius > 0) {
+ textCenter = m_data.m_center + offset(centerAngle, m_data.m_holeRadius
+ + (m_data.m_radius
+ - m_data.m_holeRadius) / 2);
+ } else {
+ textCenter = m_data.m_center + offset(centerAngle, m_data.m_radius / 2);
+ }
+ m_labelItem->setPos(textCenter.x() - m_labelItem->boundingRect().width() / 2,
+ textCenter.y() - m_labelTextRect.height() / 2);
+
+ QPointF labelCenter = m_labelItem->boundingRect().center();
+ m_labelItem->setTransformOriginPoint(labelCenter);
+
+ if (m_data.m_labelPosition == QPieSlice::LabelInsideTangential) {
+ m_labelItem->setRotation(m_data.m_startAngle + m_data.m_angleSpan / 2);
+ } else if (m_data.m_labelPosition == QPieSlice::LabelInsideNormal) {
+ if (m_data.m_startAngle + m_data.m_angleSpan / 2 < 180)
+ m_labelItem->setRotation(m_data.m_startAngle + m_data.m_angleSpan / 2 - 90);
+ else
+ m_labelItem->setRotation(m_data.m_startAngle + m_data.m_angleSpan / 2 + 90);
+ } else {
+ m_labelItem->setRotation(0);
+ }
+ }
+ // Hide label if it's outside the bounding rect of parent item
+ QRectF labelRect(m_labelItem->boundingRect());
+ labelRect.moveTopLeft(m_labelItem->pos());
+ if ((parentItem()->boundingRect().left()
+ < (labelRect.left() + m_labelItem->document()->documentMargin() + 1.0))
+ && (parentItem()->boundingRect().right()
+ > (labelRect.right() - m_labelItem->document()->documentMargin() - 1.0))
+ && (parentItem()->boundingRect().top()
+ < (labelRect.top() + m_labelItem->document()->documentMargin() + 1.0))
+ && (parentItem()->boundingRect().bottom()
+ > (labelRect.bottom() - m_labelItem->document()->documentMargin() - 1.0)))
+ m_labelItem->show();
+ else
+ m_labelItem->hide();
+ }
+
+ // bounding rect
+ if (m_data.m_isLabelVisible)
+ m_boundingRect = m_slicePath.boundingRect().united(m_labelArmPath.boundingRect()).united(m_labelTextRect);
+ else
+ m_boundingRect = m_slicePath.boundingRect();
+
+ // Inflate bounding rect by 2/3 pen width to make sure it encompasses whole slice also for thick pens
+ // and miter joins.
+ int penWidth = (m_data.m_slicePen.width() * 2) / 3;
+ m_boundingRect = m_boundingRect.adjusted(-penWidth, -penWidth, penWidth, penWidth);
+}
+
+QPointF PieSliceItem::sliceCenter(QPointF point, qreal radius, QPieSlice *slice)
+{
+ if (slice->isExploded()) {
+ qreal centerAngle = slice->startAngle() + (slice->angleSpan() / 2);
+ qreal len = radius * slice->explodeDistanceFactor();
+ point += offset(centerAngle, len);
+ }
+ return point;
+}
+
+QPainterPath PieSliceItem::slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart)
+{
+ // calculate center angle
+ *centerAngle = startAngle + (angleSpan / 2);
+
+ // calculate slice rectangle
+ QRectF rect(center.x() - radius, center.y() - radius, radius * 2, radius * 2);
+
+ // slice path
+ QPainterPath path;
+ if (m_data.m_holeRadius > 0) {
+ QRectF insideRect(center.x() - m_data.m_holeRadius, center.y() - m_data.m_holeRadius, m_data.m_holeRadius * 2, m_data.m_holeRadius * 2);
+ path.arcMoveTo(rect, -startAngle + 90);
+ path.arcTo(rect, -startAngle + 90, -angleSpan);
+ path.arcTo(insideRect, -startAngle + 90 - angleSpan, angleSpan);
+ path.closeSubpath();
+ } else {
+ path.moveTo(rect.center());
+ path.arcTo(rect, -startAngle + 90, -angleSpan);
+ path.closeSubpath();
+ }
+
+ // calculate label arm start point
+ *armStart = center;
+ *armStart += offset(*centerAngle, radius + PIESLICE_LABEL_GAP);
+
+ return path;
+}
+
+QPainterPath PieSliceItem::labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart)
+{
+ // Normalize the angle to 0-360 range
+ // NOTE: We are using int here on purpose. Depenging on platform and hardware
+ // qreal can be a double, float or something the user gives to the Qt configure
+ // (QT_COORD_TYPE). Compilers do not seem to support modulo for double or float
+ // but there are fmod() and fmodf() functions for that. So instead of some #ifdef
+ // that might break we just use int. Precision for this is just fine for our needs.
+ int normalized = angle * 10.0;
+ normalized = normalized % 3600;
+ if (normalized < 0)
+ normalized += 3600;
+ angle = (qreal) normalized / 10.0;
+
+ // prevent label arm pointing straight down because it will look bad
+ if (angle < 180 && angle > 170)
+ angle = 170;
+ if (angle > 180 && angle < 190)
+ angle = 190;
+
+ // line from slice to label
+ QPointF parm1 = start + offset(angle, length);
+
+ // line to underline the label
+ QPointF parm2 = parm1;
+ if (angle < 180) { // arm swings the other way on the left side
+ parm2 += QPointF(textWidth, 0);
+ *textStart = parm1;
+ } else {
+ parm2 += QPointF(-textWidth, 0);
+ *textStart = parm2;
+ }
+
+ QPainterPath path;
+ path.moveTo(start);
+ path.lineTo(parm1);
+ path.lineTo(parm2);
+
+ return path;
+}
+
+#include "moc_piesliceitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
diff --git a/src/charts/piechart/piesliceitem_p.h b/src/charts/piechart/piesliceitem_p.h
new file mode 100644
index 00000000..d6b7768c
--- /dev/null
+++ b/src/charts/piechart/piesliceitem_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef PIESLICEITEM_H
+#define PIESLICEITEM_H
+
+#include "qchartglobal.h"
+#include "charttheme_p.h"
+#include "qpieseries.h"
+#include "pieslicedata_p.h"
+#include <QGraphicsItem>
+#include <QRectF>
+#include <QColor>
+#include <QPen>
+
+#define PIESLICE_LABEL_GAP 5
+
+QT_CHARTS_BEGIN_NAMESPACE
+class PieChartItem;
+class PieSliceLabel;
+class QPieSlice;
+
+class PieSliceItem : public QGraphicsObject
+{
+ Q_OBJECT
+
+public:
+ PieSliceItem(QGraphicsItem *parent = 0);
+ ~PieSliceItem();
+
+ // from QGraphicsItem
+ QRectF boundingRect() const;
+ QPainterPath shape() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+
+ void setLayout(const PieSliceData &sliceData);
+ static QPointF sliceCenter(QPointF point, qreal radius, QPieSlice *slice);
+
+Q_SIGNALS:
+ void clicked(Qt::MouseButtons buttons);
+ void hovered(bool state);
+
+private:
+ void updateGeometry();
+ QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart);
+ QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart);
+
+private:
+ PieSliceData m_data;
+ QRectF m_boundingRect;
+ QPainterPath m_slicePath;
+ QPainterPath m_labelArmPath;
+ QRectF m_labelTextRect;
+ bool m_hovered;
+ QGraphicsTextItem *m_labelItem;
+
+ friend class PieSliceAnimation;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // PIESLICEITEM_H
diff --git a/src/charts/piechart/qhpiemodelmapper.cpp b/src/charts/piechart/qhpiemodelmapper.cpp
new file mode 100644
index 00000000..b1c7d84f
--- /dev/null
+++ b/src/charts/piechart/qhpiemodelmapper.cpp
@@ -0,0 +1,267 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qhpiemodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QHPieModelMapper
+ \inmodule Qt Charts
+ \brief Horizontal model mapper for pie series.
+ \mainclass
+
+ Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
+ Horizontal model mapper is used to create a connection between QPieSeries and QAbstractItemModel derived model object that keeps the consecutive pie slices data in rows.
+ It is possible to use both QAbstractItemModel and QPieSeries model API. QHPieModelMapper makes sure that Pie and the model are kept in sync.
+ \note Used model has to support adding/removing rows/columns and modifying the data of the cells.
+*/
+/*!
+ \qmltype HPieModelMapper
+ \instantiates QHPieModelMapper
+ \inqmlmodule QtCharts
+
+ \brief Horizontal model mapper for pie series.
+
+ HPieModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as
+ a data source for a pie series. It is possible to use both QAbstractItemModel and PieSeries data
+ API to manipulate data. HPieModelMapper keeps the Pie and the model in sync.
+
+ The following QML example would create a pie series with four slices (assuming the model has
+ at least five columns). Each slice would contain a label from row 1 and a value from row 2.
+ \code
+ HPieModelMapper {
+ series: pieSeries
+ model: customModel
+ labelsRow: 1
+ valuesRow: 2
+ firstColumn: 1
+ columnCount: 4
+ }
+ \endcode
+*/
+
+/*!
+ \property QHPieModelMapper::series
+ \brief Defines the QPieSeries object that is used by the mapper.
+
+ All the data in the series is discarded when it is set to the mapper.
+ When new series is specified the old series is disconnected (it preserves its data)
+*/
+/*!
+ \qmlproperty PieSeries HPieModelMapper::series
+ Defines the PieSeries object that is used by the mapper. If you define the mapper element as a child for a
+ PieSeries, leave this property undefined. All the data in the series is discarded when it is set to the mapper.
+ When new series is specified the old series is disconnected (it preserves its data).
+*/
+
+/*!
+ \property QHPieModelMapper::model
+ \brief Defines the model that is used by the mapper.
+*/
+/*!
+ \qmlproperty SomeModel HPieModelMapper::model
+ The QAbstractItemModel based model that is used by the mapper. You need to implement the model
+ and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
+ the data of the cells.
+*/
+
+/*!
+ \property QHPieModelMapper::valuesRow
+ \brief Defines which row of the model is kept in sync with the values of the pie's slices.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int HPieModelMapper::valuesRow
+ Defines which row of the model is kept in sync with the values of the pie's slices. Default value is: -1 (invalid
+ mapping).
+*/
+
+/*!
+ \property QHPieModelMapper::labelsRow
+ \brief Defines which row of the model is kept in sync with the labels of the pie's slices.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int HPieModelMapper::labelsRow
+ Defines which row of the model is kept in sync with the labels of the pie's slices
+ Default value is: -1 (invalid mapping)
+*/
+
+/*!
+ \property QHPieModelMapper::firstColumn
+ \brief Defines which column of the model contains the first slice value.
+
+ Minimal and default value is: 0
+*/
+/*!
+ \qmlproperty int HPieModelMapper::firstColumn
+ Defines which column of the model contains the first slice value.
+ The default value is 0.
+*/
+
+/*!
+ \property QHPieModelMapper::columnCount
+ \brief Defines the number of columns of the model that are mapped as the data for QPieSeries.
+
+ Minimal and default value is: -1 (count limited by the number of columns in the model)
+*/
+/*!
+ \qmlproperty int HPieModelMapper::columnCount
+ Defines the number of columns of the model that are mapped as the data for QPieSeries. The default value is
+ -1 (count limited by the number of columns in the model)
+*/
+
+/*!
+ \fn void QHPieModelMapper::seriesReplaced()
+ Emitted when the series to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QHPieModelMapper::modelReplaced()
+ Emitted when the model to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QHPieModelMapper::valuesRowChanged()
+ Emitted when the valuesRow has changed.
+*/
+
+/*!
+ \fn void QHPieModelMapper::labelsRowChanged()
+ Emitted when the labelsRow has changed.
+*/
+
+/*!
+ \fn void QHPieModelMapper::firstColumnChanged()
+ Emitted when the firstColumn has changed.
+*/
+
+/*!
+ \fn void QHPieModelMapper::columnCountChanged()
+ Emitted when the columnCount has changed.
+*/
+
+/*!
+ Constructs a mapper object which is a child of \a parent.
+*/
+QHPieModelMapper::QHPieModelMapper(QObject *parent) :
+ QPieModelMapper(parent)
+{
+ setOrientation(Qt::Horizontal);
+}
+
+QAbstractItemModel *QHPieModelMapper::model() const
+{
+ return QPieModelMapper::model();
+}
+
+void QHPieModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model != QPieModelMapper::model()) {
+ QPieModelMapper::setModel(model);
+ emit modelReplaced();
+ }
+}
+
+QPieSeries *QHPieModelMapper::series() const
+{
+ return QPieModelMapper::series();
+}
+
+void QHPieModelMapper::setSeries(QPieSeries *series)
+{
+ if (series != QPieModelMapper::series()) {
+ QPieModelMapper::setSeries(series);
+ emit seriesReplaced();
+ }
+}
+
+/*!
+ Returns which row of the model is kept in sync with the values of the pie's slices
+*/
+int QHPieModelMapper::valuesRow() const
+{
+ return valuesSection();
+}
+
+/*!
+ Sets the model row that is kept in sync with the pie slices values.
+ Parameter \a valuesRow specifies the row of the model.
+*/
+void QHPieModelMapper::setValuesRow(int valuesRow)
+{
+ if (valuesRow != valuesSection()) {
+ setValuesSection(valuesRow);
+ emit valuesRowChanged();
+ }
+}
+
+/*!
+ Returns which row of the model is kept in sync with the labels of the pie's slices
+*/
+int QHPieModelMapper::labelsRow() const
+{
+ return labelsSection();
+}
+
+/*!
+ Sets the model row that is kept in sync with the pie's slices labels.
+ Parameter \a labelsRow specifies the row of the model.
+*/
+void QHPieModelMapper::setLabelsRow(int labelsRow)
+{
+ if (labelsRow != labelsSection()) {
+ setLabelsSection(labelsRow);
+ emit labelsRowChanged();
+ }
+}
+
+int QHPieModelMapper::firstColumn() const
+{
+ return first();
+}
+
+void QHPieModelMapper::setFirstColumn(int firstColumn)
+{
+ if (firstColumn != first()) {
+ setFirst(firstColumn);
+ emit firstColumnChanged();
+ }
+}
+
+int QHPieModelMapper::columnCount() const
+{
+ return count();
+}
+
+void QHPieModelMapper::setColumnCount(int columnCount)
+{
+ if (columnCount != count()) {
+ setCount(columnCount);
+ emit columnCountChanged();
+ }
+}
+
+#include "moc_qhpiemodelmapper.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/piechart/qhpiemodelmapper.h b/src/charts/piechart/qhpiemodelmapper.h
new file mode 100644
index 00000000..50b5c6f2
--- /dev/null
+++ b/src/charts/piechart/qhpiemodelmapper.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHPIEMODELMAPPER_H
+#define QHPIEMODELMAPPER_H
+
+#include <QtCharts/qpiemodelmapper.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/* Comment line for syncqt to generate the fwd-include correctly, due to QTBUG-22432 */
+class QT_CHARTS_EXPORT QHPieModelMapper : public QPieModelMapper
+{
+ Q_OBJECT
+ Q_PROPERTY(QPieSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
+ Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
+ Q_PROPERTY(int valuesRow READ valuesRow WRITE setValuesRow NOTIFY valuesRowChanged)
+ Q_PROPERTY(int labelsRow READ labelsRow WRITE setLabelsRow NOTIFY labelsRowChanged)
+ Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged)
+ Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
+
+public:
+ explicit QHPieModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QPieSeries *series() const;
+ void setSeries(QPieSeries *series);
+
+ int valuesRow() const;
+ void setValuesRow(int valuesRow);
+
+ int labelsRow() const;
+ void setLabelsRow(int labelsRow);
+
+ int firstColumn() const;
+ void setFirstColumn(int firstColumn);
+
+ int columnCount() const;
+ void setColumnCount(int columnCount);
+
+Q_SIGNALS:
+ void seriesReplaced();
+ void modelReplaced();
+ void valuesRowChanged();
+ void labelsRowChanged();
+ void firstColumnChanged();
+ void columnCountChanged();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QHPIEMODELMAPPER_H
diff --git a/src/charts/piechart/qpiemodelmapper.cpp b/src/charts/piechart/qpiemodelmapper.cpp
new file mode 100644
index 00000000..186be815
--- /dev/null
+++ b/src/charts/piechart/qpiemodelmapper.cpp
@@ -0,0 +1,568 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpiemodelmapper.h"
+#include "qpiemodelmapper_p.h"
+#include "qpieseries.h"
+#include "qpieslice.h"
+#include <QAbstractItemModel>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+QPieModelMapper::QPieModelMapper(QObject *parent)
+ : QObject(parent),
+ d_ptr(new QPieModelMapperPrivate(this))
+{
+}
+
+QAbstractItemModel *QPieModelMapper::model() const
+{
+ Q_D(const QPieModelMapper);
+ return d->m_model;
+}
+
+void QPieModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model == 0)
+ return;
+
+ Q_D(QPieModelMapper);
+ if (d->m_model) {
+ disconnect(d->m_model, 0, d, 0);
+ }
+
+ d->m_model = model;
+ d->initializePieFromModel();
+ // connect signals from the model
+ connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
+ connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
+}
+
+QPieSeries *QPieModelMapper::series() const
+{
+ Q_D(const QPieModelMapper);
+ return d->m_series;
+}
+
+void QPieModelMapper::setSeries(QPieSeries *series)
+{
+ Q_D(QPieModelMapper);
+ if (d->m_series) {
+ disconnect(d->m_series, 0, d, 0);
+ }
+
+ if (series == 0)
+ return;
+
+ d->m_series = series;
+ d->initializePieFromModel();
+ // connect the signals from the series
+ connect(d->m_series, SIGNAL(added(QList<QPieSlice*>)), d, SLOT(slicesAdded(QList<QPieSlice*>)));
+ connect(d->m_series, SIGNAL(removed(QList<QPieSlice*>)), d, SLOT(slicesRemoved(QList<QPieSlice*>)));
+ connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
+}
+
+/*!
+ Defines which row/column of the model contains the first slice value.
+ Minimal and default value is: 0
+*/
+int QPieModelMapper::first() const
+{
+ Q_D(const QPieModelMapper);
+ return d->m_first;
+}
+
+/*!
+ Sets which row/column of the model contains the \a first slice value.
+ Minimal and default value is: 0
+*/
+void QPieModelMapper::setFirst(int first)
+{
+ Q_D(QPieModelMapper);
+ d->m_first = qMax(first, 0);
+ d->initializePieFromModel();
+}
+
+/*!
+ Defines the number of rows/columns of the model that are mapped as the data for QPieSeries
+ Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
+*/
+int QPieModelMapper::count() const
+{
+ Q_D(const QPieModelMapper);
+ return d->m_count;
+}
+
+/*!
+ Defines the \a count of rows/columns of the model that are mapped as the data for QPieSeries
+ Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
+*/
+void QPieModelMapper::setCount(int count)
+{
+ Q_D(QPieModelMapper);
+ d->m_count = qMax(count, -1);
+ d->initializePieFromModel();
+}
+
+/*!
+ Returns the orientation that is used when QPieModelMapper accesses the model.
+ This mean whether the consecutive values/labels of the pie are read from row (Qt::Horizontal)
+ or from columns (Qt::Vertical)
+*/
+Qt::Orientation QPieModelMapper::orientation() const
+{
+ Q_D(const QPieModelMapper);
+ return d->m_orientation;
+}
+
+/*!
+ Returns the \a orientation that is used when QPieModelMapper accesses the model.
+ This mean whether the consecutive values/labels of the pie are read from row (Qt::Horizontal)
+ or from columns (Qt::Vertical)
+*/
+void QPieModelMapper::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QPieModelMapper);
+ d->m_orientation = orientation;
+ d->initializePieFromModel();
+}
+
+/*!
+ Returns which section of the model is kept in sync with the values of the pie's slices
+*/
+int QPieModelMapper::valuesSection() const
+{
+ Q_D(const QPieModelMapper);
+ return d->m_valuesSection;
+}
+
+/*!
+ Sets the model section that is kept in sync with the pie slices values.
+ Parameter \a valuesSection specifies the section of the model.
+*/
+void QPieModelMapper::setValuesSection(int valuesSection)
+{
+ Q_D(QPieModelMapper);
+ d->m_valuesSection = qMax(-1, valuesSection);
+ d->initializePieFromModel();
+}
+
+/*!
+ Returns which section of the model is kept in sync with the labels of the pie's slices
+*/
+int QPieModelMapper::labelsSection() const
+{
+ Q_D(const QPieModelMapper);
+ return d->m_labelsSection;
+}
+
+/*!
+ Sets the model section that is kept in sync with the pie slices labels.
+ Parameter \a labelsSection specifies the section of the model.
+*/
+void QPieModelMapper::setLabelsSection(int labelsSection)
+{
+ Q_D(QPieModelMapper);
+ d->m_labelsSection = qMax(-1, labelsSection);
+ d->initializePieFromModel();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QPieModelMapperPrivate::QPieModelMapperPrivate(QPieModelMapper *q) :
+ QObject(q),
+ m_series(0),
+ m_model(0),
+ m_first(0),
+ m_count(-1),
+ m_orientation(Qt::Vertical),
+ m_valuesSection(-1),
+ m_labelsSection(-1),
+ m_seriesSignalsBlock(false),
+ m_modelSignalsBlock(false),
+ q_ptr(q)
+{
+}
+
+void QPieModelMapperPrivate::blockModelSignals(bool block)
+{
+ m_modelSignalsBlock = block;
+}
+
+void QPieModelMapperPrivate::blockSeriesSignals(bool block)
+{
+ m_seriesSignalsBlock = block;
+}
+
+
+QPieSlice *QPieModelMapperPrivate::pieSlice(QModelIndex index) const
+{
+ if (!index.isValid())
+ return 0; // index is invalid
+
+ if (m_orientation == Qt::Vertical && (index.column() == m_valuesSection || index.column() == m_labelsSection)) {
+ if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) {
+ if (m_model->index(index.row(), m_valuesSection).isValid() && m_model->index(index.row(), m_labelsSection).isValid())
+ return m_series->slices().at(index.row() - m_first);
+ else
+ return 0;
+ }
+ } else if (m_orientation == Qt::Horizontal && (index.row() == m_valuesSection || index.row() == m_labelsSection)) {
+ if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) {
+ if (m_model->index(m_valuesSection, index.column()).isValid() && m_model->index(m_labelsSection, index.column()).isValid())
+ return m_series->slices().at(index.column() - m_first);
+ else
+ return 0;
+ }
+ }
+ return 0; // This part of model has not been mapped to any slice
+}
+
+QModelIndex QPieModelMapperPrivate::valueModelIndex(int slicePos)
+{
+ if (m_count != -1 && slicePos >= m_count)
+ return QModelIndex(); // invalid
+
+ if (m_orientation == Qt::Vertical)
+ return m_model->index(slicePos + m_first, m_valuesSection);
+ else
+ return m_model->index(m_valuesSection, slicePos + m_first);
+}
+
+QModelIndex QPieModelMapperPrivate::labelModelIndex(int slicePos)
+{
+ if (m_count != -1 && slicePos >= m_count)
+ return QModelIndex(); // invalid
+
+ if (m_orientation == Qt::Vertical)
+ return m_model->index(slicePos + m_first, m_labelsSection);
+ else
+ return m_model->index(m_labelsSection, slicePos + m_first);
+}
+
+bool QPieModelMapperPrivate::isLabelIndex(QModelIndex index) const
+{
+ if (m_orientation == Qt::Vertical && index.column() == m_labelsSection)
+ return true;
+ else if (m_orientation == Qt::Horizontal && index.row() == m_labelsSection)
+ return true;
+
+ return false;
+}
+
+bool QPieModelMapperPrivate::isValueIndex(QModelIndex index) const
+{
+ if (m_orientation == Qt::Vertical && index.column() == m_valuesSection)
+ return true;
+ else if (m_orientation == Qt::Horizontal && index.row() == m_valuesSection)
+ return true;
+
+ return false;
+}
+
+void QPieModelMapperPrivate::slicesAdded(QList<QPieSlice *> slices)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (slices.count() == 0)
+ return;
+
+ int firstIndex = m_series->slices().indexOf(slices.at(0));
+ if (firstIndex == -1)
+ return;
+
+ if (m_count != -1)
+ m_count += slices.count();
+
+ for (int i = firstIndex; i < firstIndex + slices.count(); i++) {
+ m_slices.insert(i, slices.at(i - firstIndex));
+ connect(slices.at(i - firstIndex), SIGNAL(labelChanged()), this, SLOT(sliceLabelChanged()));
+ connect(slices.at(i - firstIndex), SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
+ }
+
+ blockModelSignals();
+ if (m_orientation == Qt::Vertical)
+ m_model->insertRows(firstIndex + m_first, slices.count());
+ else
+ m_model->insertColumns(firstIndex + m_first, slices.count());
+
+ for (int i = firstIndex; i < firstIndex + slices.count(); i++) {
+ m_model->setData(valueModelIndex(i), slices.at(i - firstIndex)->value());
+ m_model->setData(labelModelIndex(i), slices.at(i - firstIndex)->label());
+ }
+ blockModelSignals(false);
+}
+
+void QPieModelMapperPrivate::slicesRemoved(QList<QPieSlice *> slices)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (slices.count() == 0)
+ return;
+
+ int firstIndex = m_slices.indexOf(slices.at(0));
+ if (firstIndex == -1)
+ return;
+
+ if (m_count != -1)
+ m_count -= slices.count();
+
+ for (int i = firstIndex + slices.count() - 1; i >= firstIndex; i--)
+ m_slices.removeAt(i);
+
+ blockModelSignals();
+ if (m_orientation == Qt::Vertical)
+ m_model->removeRows(firstIndex + m_first, slices.count());
+ else
+ m_model->removeColumns(firstIndex + m_first, slices.count());
+ blockModelSignals(false);
+}
+
+void QPieModelMapperPrivate::sliceLabelChanged()
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ blockModelSignals();
+ QPieSlice *slice = qobject_cast<QPieSlice *>(QObject::sender());
+ m_model->setData(labelModelIndex(m_series->slices().indexOf(slice)), slice->label());
+ blockModelSignals(false);
+}
+
+void QPieModelMapperPrivate::sliceValueChanged()
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ blockModelSignals();
+ QPieSlice *slice = qobject_cast<QPieSlice *>(QObject::sender());
+ m_model->setData(valueModelIndex(m_series->slices().indexOf(slice)), slice->value());
+ blockModelSignals(false);
+}
+
+void QPieModelMapperPrivate::handleSeriesDestroyed()
+{
+ m_series = 0;
+}
+
+void QPieModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ QModelIndex index;
+ QPieSlice *slice;
+ for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
+ for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
+ index = topLeft.sibling(row, column);
+ slice = pieSlice(index);
+ if (slice) {
+ if (isValueIndex(index))
+ slice->setValue(m_model->data(index, Qt::DisplayRole).toReal());
+ if (isLabelIndex(index))
+ slice->setLabel(m_model->data(index, Qt::DisplayRole).toString());
+ }
+ }
+ }
+ blockSeriesSignals(false);
+}
+
+
+void QPieModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent);
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Vertical)
+ insertData(start, end);
+ else if (start <= m_valuesSection || start <= m_labelsSection) // if the changes affect the map - reinitialize the pie
+ initializePieFromModel();
+ blockSeriesSignals(false);
+}
+
+void QPieModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent);
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Vertical)
+ removeData(start, end);
+ else if (start <= m_valuesSection || start <= m_labelsSection) // if the changes affect the map - reinitialize the pie
+ initializePieFromModel();
+ blockSeriesSignals(false);
+}
+
+void QPieModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent);
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Horizontal)
+ insertData(start, end);
+ else if (start <= m_valuesSection || start <= m_labelsSection) // if the changes affect the map - reinitialize the pie
+ initializePieFromModel();
+ blockSeriesSignals(false);
+}
+
+void QPieModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent);
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Horizontal)
+ removeData(start, end);
+ else if (start <= m_valuesSection || start <= m_labelsSection) // if the changes affect the map - reinitialize the pie
+ initializePieFromModel();
+ blockSeriesSignals(false);
+}
+
+void QPieModelMapperPrivate::handleModelDestroyed()
+{
+ m_model = 0;
+}
+
+void QPieModelMapperPrivate::insertData(int start, int end)
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ if (m_count != -1 && start >= m_first + m_count) {
+ return;
+ } else {
+ int addedCount = end - start + 1;
+ if (m_count != -1 && addedCount > m_count)
+ addedCount = m_count;
+ int first = qMax(start, m_first);
+ int last = qMin(first + addedCount - 1, m_orientation == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1);
+ for (int i = first; i <= last; i++) {
+ QModelIndex valueIndex = valueModelIndex(i - m_first);
+ QModelIndex labelIndex = labelModelIndex(i - m_first);
+ if (valueIndex.isValid() && labelIndex.isValid()) {
+ QPieSlice *slice = new QPieSlice;
+ slice->setValue(m_model->data(valueIndex, Qt::DisplayRole).toDouble());
+ slice->setLabel(m_model->data(labelIndex, Qt::DisplayRole).toString());
+ connect(slice, SIGNAL(labelChanged()), this, SLOT(sliceLabelChanged()));
+ connect(slice, SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
+ m_series->insert(i - m_first, slice);
+ m_slices.insert(i - m_first, slice);
+ }
+ }
+
+ // remove excess of slices (abouve m_count)
+ if (m_count != -1 && m_series->slices().size() > m_count)
+ for (int i = m_series->slices().size() - 1; i >= m_count; i--) {
+ m_series->remove(m_series->slices().at(i));
+ m_slices.removeAt(i);
+ }
+ }
+}
+
+void QPieModelMapperPrivate::removeData(int start, int end)
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ int removedCount = end - start + 1;
+ if (m_count != -1 && start >= m_first + m_count) {
+ return;
+ } else {
+ int toRemove = qMin(m_series->slices().size(), removedCount); // first find how many items can actually be removed
+ int first = qMax(start, m_first); // get the index of the first item that will be removed.
+ int last = qMin(first + toRemove - 1, m_series->slices().size() + m_first - 1); // get the index of the last item that will be removed.
+ for (int i = last; i >= first; i--) {
+ m_series->remove(m_series->slices().at(i - m_first));
+ m_slices.removeAt(i - m_first);
+ }
+
+ if (m_count != -1) {
+ int itemsAvailable; // check how many are available to be added
+ if (m_orientation == Qt::Vertical)
+ itemsAvailable = m_model->rowCount() - m_first - m_series->slices().size();
+ else
+ itemsAvailable = m_model->columnCount() - m_first - m_series->slices().size();
+ int toBeAdded = qMin(itemsAvailable, m_count - m_series->slices().size()); // add not more items than there is space left to be filled.
+ int currentSize = m_series->slices().size();
+ if (toBeAdded > 0)
+ for (int i = m_series->slices().size(); i < currentSize + toBeAdded; i++) {
+ QModelIndex valueIndex = valueModelIndex(i - m_first);
+ QModelIndex labelIndex = labelModelIndex(i - m_first);
+ if (valueIndex.isValid() && labelIndex.isValid()) {
+ QPieSlice *slice = new QPieSlice;
+ slice->setValue(m_model->data(valueIndex, Qt::DisplayRole).toDouble());
+ slice->setLabel(m_model->data(labelIndex, Qt::DisplayRole).toString());
+ m_series->insert(i, slice);
+ m_slices.insert(i, slice);
+ }
+ }
+ }
+ }
+}
+
+void QPieModelMapperPrivate::initializePieFromModel()
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ blockSeriesSignals();
+ // clear current content
+ m_series->clear();
+ m_slices.clear();
+
+ // create the initial slices set
+ int slicePos = 0;
+ QModelIndex valueIndex = valueModelIndex(slicePos);
+ QModelIndex labelIndex = labelModelIndex(slicePos);
+ while (valueIndex.isValid() && labelIndex.isValid()) {
+ QPieSlice *slice = new QPieSlice;
+ slice->setLabel(m_model->data(labelIndex, Qt::DisplayRole).toString());
+ slice->setValue(m_model->data(valueIndex, Qt::DisplayRole).toDouble());
+ connect(slice, SIGNAL(labelChanged()), this, SLOT(sliceLabelChanged()));
+ connect(slice, SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
+ m_series->append(slice);
+ m_slices.append(slice);
+ slicePos++;
+ valueIndex = valueModelIndex(slicePos);
+ labelIndex = labelModelIndex(slicePos);
+ }
+ blockSeriesSignals(false);
+}
+
+#include "moc_qpiemodelmapper_p.cpp"
+#include "moc_qpiemodelmapper.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/piechart/qpiemodelmapper.h b/src/charts/piechart/qpiemodelmapper.h
new file mode 100644
index 00000000..a4ab6a2c
--- /dev/null
+++ b/src/charts/piechart/qpiemodelmapper.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPIEMODELMAPPER_H
+#define QPIEMODELMAPPER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QObject>
+
+class QAbstractItemModel;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QPieModelMapperPrivate;
+class QPieSeries;
+
+class QT_CHARTS_EXPORT QPieModelMapper : public QObject
+{
+ Q_OBJECT
+
+protected:
+ explicit QPieModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QPieSeries *series() const;
+ void setSeries(QPieSeries *series);
+
+ int first() const;
+ void setFirst(int first);
+
+ int count() const;
+ void setCount(int count);
+
+ int valuesSection() const;
+ void setValuesSection(int valuesSection);
+
+ int labelsSection() const;
+ void setLabelsSection(int labelsSection);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+protected:
+ QPieModelMapperPrivate * const d_ptr;
+ Q_DECLARE_PRIVATE(QPieModelMapper)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QPIEMODELMAPPER_H
diff --git a/src/charts/piechart/qpiemodelmapper_p.h b/src/charts/piechart/qpiemodelmapper_p.h
new file mode 100644
index 00000000..a287497f
--- /dev/null
+++ b/src/charts/piechart/qpiemodelmapper_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QPIEMODELMAPPER_P_H
+#define QPIEMODELMAPPER_P_H
+
+#include <QObject>
+#include <qpiemodelmapper.h>
+
+class QModelIndex;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QPieSlice;
+
+class QPieModelMapperPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit QPieModelMapperPrivate(QPieModelMapper *q);
+
+public Q_SLOTS:
+ // for the model
+ void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
+ void modelRowsAdded(QModelIndex parent, int start, int end);
+ void modelRowsRemoved(QModelIndex parent, int start, int end);
+ void modelColumnsAdded(QModelIndex parent, int start, int end);
+ void modelColumnsRemoved(QModelIndex parent, int start, int end);
+ void handleModelDestroyed();
+
+ // for the series
+ void slicesAdded(QList<QPieSlice *> slices);
+ void slicesRemoved(QList<QPieSlice *> slices);
+ void sliceLabelChanged();
+ void sliceValueChanged();
+ void handleSeriesDestroyed();
+
+ void initializePieFromModel();
+
+private:
+ QPieSlice *pieSlice(QModelIndex index) const;
+ bool isLabelIndex(QModelIndex index) const;
+ bool isValueIndex(QModelIndex index) const;
+ QModelIndex valueModelIndex(int slicePos);
+ QModelIndex labelModelIndex(int slicePos);
+ void insertData(int start, int end);
+ void removeData(int start, int end);
+
+ void blockModelSignals(bool block = true);
+ void blockSeriesSignals(bool block = true);
+
+private:
+ QPieSeries *m_series;
+ QList<QPieSlice *> m_slices;
+ QAbstractItemModel *m_model;
+ int m_first;
+ int m_count;
+ Qt::Orientation m_orientation;
+ int m_valuesSection;
+ int m_labelsSection;
+ bool m_seriesSignalsBlock;
+ bool m_modelSignalsBlock;
+
+private:
+
+ QPieModelMapper *q_ptr;
+ Q_DECLARE_PUBLIC(QPieModelMapper)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QPIEMODELMAPPER_P_H
diff --git a/src/charts/piechart/qpieseries.cpp b/src/charts/piechart/qpieseries.cpp
new file mode 100644
index 00000000..733429d1
--- /dev/null
+++ b/src/charts/piechart/qpieseries.cpp
@@ -0,0 +1,947 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpieseries.h"
+#include "qpieseries_p.h"
+#include "qpieslice.h"
+#include "qpieslice_p.h"
+#include "pieslicedata_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "qabstractaxis.h"
+#include "pieanimation_p.h"
+#include "charthelpers_p.h"
+
+#include "qpielegendmarker.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QPieSeries
+ \inmodule Qt Charts
+ \brief Pie series API for Qt Charts.
+
+ The pie series defines a pie chart which consists of pie slices which are defined as QPieSlice objects.
+ The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices.
+ The actual slice size is determined by that relative value.
+
+ Pie size and position on the chart is controlled by using relative values which range from 0.0 to 1.0.
+ These relate to the actual chart rectangle.
+
+ By default the pie is defined as a full pie but it can also be a partial pie.
+ This can be done by setting a starting angle and angle span to the series.
+ Full pie is 360 degrees where 0 is at 12 a'clock.
+
+ See the \l {PieChart Example} {pie chart example} or \l {DonutChart Example} {donut chart example} to learn how to use QPieSeries.
+ \table 100%
+ \row
+ \li \image examples_piechart.png
+ \li \image examples_donutchart.png
+ \endtable
+*/
+/*!
+ \qmltype PieSeries
+ \instantiates QPieSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractSeries
+
+ \brief The PieSeries type is used for making pie charts.
+
+ The following QML shows how to create a simple pie chart.
+
+ \snippet qmlchart/qml/qmlchart/View1.qml 1
+
+ \beginfloatleft
+ \image examples_qmlchart1.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ \property QPieSeries::horizontalPosition
+ \brief Defines the horizontal position of the pie.
+
+ The value is a relative value to the chart rectangle where:
+
+ \list
+ \li 0.0 is the absolute left.
+ \li 1.0 is the absolute right.
+ \endlist
+ Default value is 0.5 (center).
+ \sa verticalPosition
+*/
+
+/*!
+ \qmlproperty real PieSeries::horizontalPosition
+
+ Defines the horizontal position of the pie.
+
+ The value is a relative value to the chart rectangle where:
+
+ \list
+ \li 0.0 is the absolute left.
+ \li 1.0 is the absolute right.
+ \endlist
+ Default value is 0.5 (center).
+ \sa verticalPosition
+*/
+
+/*!
+ \property QPieSeries::verticalPosition
+ \brief Defines the vertical position of the pie.
+
+ The value is a relative value to the chart rectangle where:
+
+ \list
+ \li 0.0 is the absolute top.
+ \li 1.0 is the absolute bottom.
+ \endlist
+ Default value is 0.5 (center).
+ \sa horizontalPosition
+*/
+
+/*!
+ \qmlproperty real PieSeries::verticalPosition
+
+ Defines the vertical position of the pie.
+
+ The value is a relative value to the chart rectangle where:
+
+ \list
+ \li 0.0 is the absolute top.
+ \li 1.0 is the absolute bottom.
+ \endlist
+ Default value is 0.5 (center).
+ \sa horizontalPosition
+*/
+
+/*!
+ \property QPieSeries::size
+ \brief Defines the pie size.
+
+ The value is a relative value to the chart rectangle where:
+
+ \list
+ \li 0.0 is the minimum size (pie not drawn).
+ \li 1.0 is the maximum size that can fit the chart.
+ \endlist
+
+ When setting this property the holeSize property is adjusted if necessary, to ensure that the hole size is not greater than the outer size.
+
+ Default value is 0.7.
+*/
+
+/*!
+ \qmlproperty real PieSeries::size
+
+ Defines the pie size.
+
+ The value is a relative value to the chart rectangle where:
+
+ \list
+ \li 0.0 is the minimum size (pie not drawn).
+ \li 1.0 is the maximum size that can fit the chart.
+ \endlist
+
+ Default value is 0.7.
+*/
+
+/*!
+ \property QPieSeries::holeSize
+ \brief Defines the donut hole size.
+
+ The value is a relative value to the chart rectangle where:
+
+ \list
+ \li 0.0 is the minimum size (full pie drawn, without any hole inside).
+ \li 1.0 is the maximum size that can fit the chart. (donut has no width)
+ \endlist
+
+ The value is never greater then size property.
+ Default value is 0.0.
+*/
+
+/*!
+ \qmlproperty real PieSeries::holeSize
+
+ Defines the donut hole size.
+
+ The value is a relative value to the chart rectangle where:
+
+ \list
+ \li 0.0 is the minimum size (full pie drawn, without any hole inside).
+ \li 1.0 is the maximum size that can fit the chart. (donut has no width)
+ \endlist
+
+ When setting this property the size property is adjusted if necessary, to ensure that the inner size is not greater than the outer size.
+
+ Default value is 0.0.
+*/
+
+/*!
+ \property QPieSeries::startAngle
+ \brief Defines the starting angle of the pie.
+
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+
+ Default is value is 0.
+*/
+
+/*!
+ \qmlproperty real PieSeries::startAngle
+
+ Defines the starting angle of the pie.
+
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+
+ Default is value is 0.
+*/
+
+/*!
+ \property QPieSeries::endAngle
+ \brief Defines the ending angle of the pie.
+
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+
+ Default is value is 360.
+*/
+
+/*!
+ \qmlproperty real PieSeries::endAngle
+
+ Defines the ending angle of the pie.
+
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+
+ Default is value is 360.
+*/
+
+/*!
+ \property QPieSeries::count
+
+ Number of slices in the series.
+*/
+
+/*!
+ \qmlproperty int PieSeries::count
+
+ Number of slices in the series.
+*/
+
+/*!
+ \fn void QPieSeries::countChanged()
+ Emitted when the slice count has changed.
+ \sa count
+*/
+/*!
+ \qmlsignal PieSeries::onCountChanged()
+ Emitted when the slice count has changed.
+*/
+
+/*!
+ \property QPieSeries::sum
+
+ Sum of all slices.
+
+ The series keeps track of the sum of all slices it holds.
+*/
+
+/*!
+ \qmlproperty real PieSeries::sum
+
+ Sum of all slices.
+
+ The series keeps track of the sum of all slices it holds.
+*/
+
+/*!
+ \fn void QPieSeries::sumChanged()
+ Emitted when the sum of all slices has changed.
+ \sa sum
+*/
+/*!
+ \qmlsignal PieSeries::onSumChanged()
+ Emitted when the sum of all slices has changed. This may happen for example if you add or remove slices, or if you
+ change value of a slice.
+*/
+
+/*!
+ \fn void QPieSeries::added(QList<QPieSlice*> slices)
+
+ This signal is emitted when \a slices have been added to the series.
+
+ \sa append(), insert()
+*/
+/*!
+ \qmlsignal PieSeries::onAdded(PieSlice slice)
+ Emitted when \a slice has been added to the series.
+*/
+
+/*!
+ \fn void QPieSeries::removed(QList<QPieSlice*> slices)
+ This signal is emitted when \a slices have been removed from the series.
+ \sa remove()
+*/
+/*!
+ \qmlsignal PieSeries::onRemoved(PieSlice slice)
+ Emitted when \a slice has been removed from the series.
+*/
+
+/*!
+ \fn void QPieSeries::clicked(QPieSlice* slice)
+ This signal is emitted when a \a slice has been clicked.
+ \sa QPieSlice::clicked()
+*/
+/*!
+ \qmlsignal PieSeries::onClicked(PieSlice slice)
+ This signal is emitted when a \a slice has been clicked.
+*/
+
+/*!
+ \fn void QPieSeries::hovered(QPieSlice* slice, bool state)
+ This signal is emitted when user has hovered over or away from the \a slice.
+ \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
+ \sa QPieSlice::hovered()
+*/
+/*!
+ \qmlsignal PieSeries::onHovered(PieSlice slice, bool state)
+ This signal is emitted when user has hovered over or away from the \a slice. \a state is true when user has hovered
+ over the slice and false when hover has moved away from the slice.
+*/
+
+/*!
+ \qmlmethod PieSlice PieSeries::at(int index)
+ Returns slice at \a index. Returns null if the index is not valid.
+*/
+
+/*!
+ \qmlmethod PieSlice PieSeries::find(string label)
+ Returns the first slice with \a label. Returns null if the index is not valid.
+*/
+
+/*!
+ \qmlmethod PieSlice PieSeries::append(string label, real value)
+ Adds a new slice with \a label and \a value to the pie.
+*/
+
+/*!
+ \qmlmethod bool PieSeries::remove(PieSlice slice)
+ Removes the \a slice from the pie. Returns true if the removal was successful, false otherwise.
+*/
+
+/*!
+ \qmlmethod PieSeries::clear()
+ Removes all slices from the pie.
+*/
+
+/*!
+ Constructs a series object which is a child of \a parent.
+*/
+QPieSeries::QPieSeries(QObject *parent)
+ : QAbstractSeries(*new QPieSeriesPrivate(this), parent)
+{
+ Q_D(QPieSeries);
+ QObject::connect(this, SIGNAL(countChanged()), d, SIGNAL(countChanged()));
+}
+
+/*!
+ Destroys the series and its slices.
+*/
+QPieSeries::~QPieSeries()
+{
+ // NOTE: d_prt destroyed by QObject
+ clear();
+}
+
+/*!
+ Returns QAbstractSeries::SeriesTypePie.
+*/
+QAbstractSeries::SeriesType QPieSeries::type() const
+{
+ return QAbstractSeries::SeriesTypePie;
+}
+
+/*!
+ Appends a single \a slice to the series.
+ Slice ownership is passed to the series.
+
+ Returns true if append was succesfull.
+*/
+bool QPieSeries::append(QPieSlice *slice)
+{
+ return append(QList<QPieSlice *>() << slice);
+}
+
+/*!
+ Appends an array of \a slices to the series.
+ Slice ownership is passed to the series.
+
+ Returns true if append was successful.
+*/
+bool QPieSeries::append(QList<QPieSlice *> slices)
+{
+ Q_D(QPieSeries);
+
+ if (slices.count() == 0)
+ return false;
+
+ foreach (QPieSlice *s, slices) {
+ if (!s || d->m_slices.contains(s))
+ return false;
+ if (s->series()) // already added to some series
+ return false;
+ if (!isValidValue(s->value()))
+ return false;
+ }
+
+ foreach (QPieSlice *s, slices) {
+ s->setParent(this);
+ QPieSlicePrivate::fromSlice(s)->m_series = this;
+ d->m_slices << s;
+ }
+
+ d->updateDerivativeData();
+
+ foreach(QPieSlice * s, slices) {
+ connect(s, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
+ connect(s, SIGNAL(clicked()), d, SLOT(sliceClicked()));
+ connect(s, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
+ }
+
+ emit added(slices);
+ emit countChanged();
+
+ return true;
+}
+
+/*!
+ Appends a single \a slice to the series and returns a reference to the series.
+ Slice ownership is passed to the series.
+*/
+QPieSeries &QPieSeries::operator << (QPieSlice *slice)
+{
+ append(slice);
+ return *this;
+}
+
+
+/*!
+ Appends a single slice to the series with give \a value and \a label.
+ Slice ownership is passed to the series.
+ Returns NULL if value is NaN, Inf or -Inf and no slice is added to the series.
+*/
+QPieSlice *QPieSeries::append(QString label, qreal value)
+{
+ if (isValidValue(value)) {
+ QPieSlice *slice = new QPieSlice(label, value);
+ append(slice);
+ return slice;
+ } else {
+ return 0;
+ }
+}
+
+/*!
+ Inserts a single \a slice to the series before the slice at \a index position.
+ Slice ownership is passed to the series.
+
+ Returns true if insert was successful.
+*/
+bool QPieSeries::insert(int index, QPieSlice *slice)
+{
+ Q_D(QPieSeries);
+
+ if (index < 0 || index > d->m_slices.count())
+ return false;
+
+ if (!slice || d->m_slices.contains(slice))
+ return false;
+
+ if (slice->series()) // already added to some series
+ return false;
+
+ if (!isValidValue(slice->value()))
+ return false;
+
+ slice->setParent(this);
+ QPieSlicePrivate::fromSlice(slice)->m_series = this;
+ d->m_slices.insert(index, slice);
+
+ d->updateDerivativeData();
+
+ connect(slice, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
+ connect(slice, SIGNAL(clicked()), d, SLOT(sliceClicked()));
+ connect(slice, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
+
+ emit added(QList<QPieSlice *>() << slice);
+ emit countChanged();
+
+ return true;
+}
+
+/*!
+ Removes a single \a slice from the series and deletes the slice.
+
+ Do not reference the pointer after this call.
+
+ Returns true if remove was successful.
+*/
+bool QPieSeries::remove(QPieSlice *slice)
+{
+ Q_D(QPieSeries);
+
+ if (!d->m_slices.removeOne(slice))
+ return false;
+
+ d->updateDerivativeData();
+
+ emit removed(QList<QPieSlice *>() << slice);
+ emit countChanged();
+
+ delete slice;
+ slice = 0;
+
+ return true;
+}
+
+/*!
+ Takes a single \a slice from the series. Does not destroy the slice object.
+
+ \note The series remains as the slice's parent object. You must set the
+ parent object to take full ownership.
+
+ Returns true if take was successful.
+*/
+bool QPieSeries::take(QPieSlice *slice)
+{
+ Q_D(QPieSeries);
+
+ if (!d->m_slices.removeOne(slice))
+ return false;
+
+ QPieSlicePrivate::fromSlice(slice)->m_series = 0;
+ slice->disconnect(d);
+
+ d->updateDerivativeData();
+
+ emit removed(QList<QPieSlice *>() << slice);
+ emit countChanged();
+
+ return true;
+}
+
+/*!
+ Clears all slices from the series.
+*/
+void QPieSeries::clear()
+{
+ Q_D(QPieSeries);
+ if (d->m_slices.count() == 0)
+ return;
+
+ QList<QPieSlice *> slices = d->m_slices;
+ foreach (QPieSlice *s, d->m_slices)
+ d->m_slices.removeOne(s);
+
+ d->updateDerivativeData();
+
+ emit removed(slices);
+ emit countChanged();
+
+ foreach (QPieSlice *s, slices)
+ delete s;
+}
+
+/*!
+ Returns a list of slices that belong to this series.
+*/
+QList<QPieSlice *> QPieSeries::slices() const
+{
+ Q_D(const QPieSeries);
+ return d->m_slices;
+}
+
+/*!
+ returns the number of the slices in this series.
+*/
+int QPieSeries::count() const
+{
+ Q_D(const QPieSeries);
+ return d->m_slices.count();
+}
+
+/*!
+ Returns true is the series is empty.
+*/
+bool QPieSeries::isEmpty() const
+{
+ Q_D(const QPieSeries);
+ return d->m_slices.isEmpty();
+}
+
+/*!
+ Returns the sum of all slice values in this series.
+
+ \sa QPieSlice::value(), QPieSlice::setValue(), QPieSlice::percentage()
+*/
+qreal QPieSeries::sum() const
+{
+ Q_D(const QPieSeries);
+ return d->m_sum;
+}
+
+void QPieSeries::setHoleSize(qreal holeSize)
+{
+ Q_D(QPieSeries);
+ holeSize = qBound((qreal)0.0, holeSize, (qreal)1.0);
+ d->setSizes(holeSize, qMax(d->m_pieRelativeSize, holeSize));
+}
+
+qreal QPieSeries::holeSize() const
+{
+ Q_D(const QPieSeries);
+ return d->m_holeRelativeSize;
+}
+
+void QPieSeries::setHorizontalPosition(qreal relativePosition)
+{
+ Q_D(QPieSeries);
+
+ if (relativePosition < 0.0)
+ relativePosition = 0.0;
+ if (relativePosition > 1.0)
+ relativePosition = 1.0;
+
+ if (!qFuzzyCompare(d->m_pieRelativeHorPos, relativePosition)) {
+ d->m_pieRelativeHorPos = relativePosition;
+ emit d->horizontalPositionChanged();
+ }
+}
+
+qreal QPieSeries::horizontalPosition() const
+{
+ Q_D(const QPieSeries);
+ return d->m_pieRelativeHorPos;
+}
+
+void QPieSeries::setVerticalPosition(qreal relativePosition)
+{
+ Q_D(QPieSeries);
+
+ if (relativePosition < 0.0)
+ relativePosition = 0.0;
+ if (relativePosition > 1.0)
+ relativePosition = 1.0;
+
+ if (!qFuzzyCompare(d->m_pieRelativeVerPos, relativePosition)) {
+ d->m_pieRelativeVerPos = relativePosition;
+ emit d->verticalPositionChanged();
+ }
+}
+
+qreal QPieSeries::verticalPosition() const
+{
+ Q_D(const QPieSeries);
+ return d->m_pieRelativeVerPos;
+}
+
+void QPieSeries::setPieSize(qreal relativeSize)
+{
+ Q_D(QPieSeries);
+ relativeSize = qBound((qreal)0.0, relativeSize, (qreal)1.0);
+ d->setSizes(qMin(d->m_holeRelativeSize, relativeSize), relativeSize);
+
+}
+
+qreal QPieSeries::pieSize() const
+{
+ Q_D(const QPieSeries);
+ return d->m_pieRelativeSize;
+}
+
+
+void QPieSeries::setPieStartAngle(qreal angle)
+{
+ Q_D(QPieSeries);
+ if (qFuzzyCompare(d->m_pieStartAngle, angle))
+ return;
+ d->m_pieStartAngle = angle;
+ d->updateDerivativeData();
+ emit d->pieStartAngleChanged();
+}
+
+qreal QPieSeries::pieStartAngle() const
+{
+ Q_D(const QPieSeries);
+ return d->m_pieStartAngle;
+}
+
+/*!
+ Sets the end angle of the pie.
+
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+
+ \a angle must be greater than start angle.
+
+ \sa pieEndAngle(), pieStartAngle(), setPieStartAngle()
+*/
+void QPieSeries::setPieEndAngle(qreal angle)
+{
+ Q_D(QPieSeries);
+ if (qFuzzyCompare(d->m_pieEndAngle, angle))
+ return;
+ d->m_pieEndAngle = angle;
+ d->updateDerivativeData();
+ emit d->pieEndAngleChanged();
+}
+
+/*!
+ Returns the end angle of the pie.
+
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+
+ \sa setPieEndAngle(), pieStartAngle(), setPieStartAngle()
+*/
+qreal QPieSeries::pieEndAngle() const
+{
+ Q_D(const QPieSeries);
+ return d->m_pieEndAngle;
+}
+
+/*!
+ Sets the all the slice labels \a visible or invisible.
+
+ Note that this affects only the current slices in the series.
+ If user adds a new slice the default label visibility is false.
+
+ \sa QPieSlice::isLabelVisible(), QPieSlice::setLabelVisible()
+*/
+void QPieSeries::setLabelsVisible(bool visible)
+{
+ Q_D(QPieSeries);
+ foreach (QPieSlice *s, d->m_slices)
+ s->setLabelVisible(visible);
+}
+
+/*!
+ Sets the all the slice labels \a position
+
+ Note that this affects only the current slices in the series.
+ If user adds a new slice the default label position is LabelOutside
+
+ \sa QPieSlice::labelPosition(), QPieSlice::setLabelPosition()
+*/
+void QPieSeries::setLabelsPosition(QPieSlice::LabelPosition position)
+{
+ Q_D(QPieSeries);
+ foreach (QPieSlice *s, d->m_slices)
+ s->setLabelPosition(position);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent) :
+ QAbstractSeriesPrivate(parent),
+ m_pieRelativeHorPos(0.5),
+ m_pieRelativeVerPos(0.5),
+ m_pieRelativeSize(0.7),
+ m_pieStartAngle(0),
+ m_pieEndAngle(360),
+ m_sum(0),
+ m_holeRelativeSize(0.0)
+{
+}
+
+QPieSeriesPrivate::~QPieSeriesPrivate()
+{
+}
+
+void QPieSeriesPrivate::updateDerivativeData()
+{
+ // calculate sum of all slices
+ qreal sum = 0;
+ foreach (QPieSlice *s, m_slices)
+ sum += s->value();
+
+ if (!qFuzzyCompare(m_sum, sum)) {
+ m_sum = sum;
+ emit q_func()->sumChanged();
+ }
+
+ // nothing to show..
+ if (qFuzzyCompare(m_sum, 0))
+ return;
+
+ // update slice attributes
+ qreal sliceAngle = m_pieStartAngle;
+ qreal pieSpan = m_pieEndAngle - m_pieStartAngle;
+ QVector<QPieSlice *> changed;
+ foreach (QPieSlice *s, m_slices) {
+ QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s);
+ d->setPercentage(s->value() / m_sum);
+ d->setStartAngle(sliceAngle);
+ d->setAngleSpan(pieSpan * s->percentage());
+ sliceAngle += s->angleSpan();
+ }
+
+
+ emit calculatedDataChanged();
+}
+
+void QPieSeriesPrivate::setSizes(qreal innerSize, qreal outerSize)
+{
+ bool changed = false;
+
+ if (!qFuzzyCompare(m_holeRelativeSize, innerSize)) {
+ m_holeRelativeSize = innerSize;
+ changed = true;
+ }
+
+ if (!qFuzzyCompare(m_pieRelativeSize, outerSize)) {
+ m_pieRelativeSize = outerSize;
+ changed = true;
+ }
+
+ if (changed)
+ emit pieSizeChanged();
+}
+
+QPieSeriesPrivate *QPieSeriesPrivate::fromSeries(QPieSeries *series)
+{
+ return series->d_func();
+}
+
+void QPieSeriesPrivate::sliceValueChanged()
+{
+ Q_ASSERT(m_slices.contains(qobject_cast<QPieSlice *>(sender())));
+ updateDerivativeData();
+}
+
+void QPieSeriesPrivate::sliceClicked()
+{
+ QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
+ Q_ASSERT(m_slices.contains(slice));
+ Q_Q(QPieSeries);
+ emit q->clicked(slice);
+}
+
+void QPieSeriesPrivate::sliceHovered(bool state)
+{
+ QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
+ if (!m_slices.isEmpty()) {
+ Q_ASSERT(m_slices.contains(slice));
+ Q_Q(QPieSeries);
+ emit q->hovered(slice, state);
+ }
+}
+
+void QPieSeriesPrivate::initializeDomain()
+{
+ // does not apply to pie
+}
+
+void QPieSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QPieSeries);
+ PieChartItem *pie = new PieChartItem(q,parent);
+ m_item.reset(pie);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+void QPieSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options)
+{
+ PieChartItem *item = static_cast<PieChartItem *>(m_item.data());
+ Q_ASSERT(item);
+ if (item->animation())
+ item->animation()->stopAndDestroyLater();
+
+ if (options.testFlag(QChart::SeriesAnimations))
+ item->setAnimation(new PieAnimation(item));
+ else
+ item->setAnimation(0);
+ QAbstractSeriesPrivate::initializeAnimations(options);
+}
+
+QList<QLegendMarker*> QPieSeriesPrivate::createLegendMarkers(QLegend* legend)
+{
+ Q_Q(QPieSeries);
+ QList<QLegendMarker*> markers;
+ foreach(QPieSlice* slice, q->slices()) {
+ QPieLegendMarker* marker = new QPieLegendMarker(q,slice,legend);
+ markers << marker;
+ }
+ return markers;
+}
+
+void QPieSeriesPrivate::initializeAxes()
+{
+
+}
+
+QAbstractAxis::AxisType QPieSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
+{
+ Q_UNUSED(orientation);
+ return QAbstractAxis::AxisTypeNoAxis;
+}
+
+QAbstractAxis* QPieSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
+{
+ Q_UNUSED(orientation);
+ return 0;
+}
+
+void QPieSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
+{
+ //Q_Q(QPieSeries);
+ //const QList<QColor>& colors = theme->seriesColors();
+ const QList<QGradient>& gradients = theme->seriesGradients();
+
+ for (int i(0); i < m_slices.count(); i++) {
+
+ QColor penColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0);
+
+ // Get color for a slice from a gradient linearly, beginning from the start of the gradient
+ qreal pos = (qreal)(i + 1) / (qreal) m_slices.count();
+ QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), pos);
+
+ QPieSlice *s = m_slices.at(i);
+ QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s);
+
+ if (forced || d->m_data.m_slicePen.isThemed())
+ d->setPen(penColor, true);
+
+ if (forced || d->m_data.m_sliceBrush.isThemed())
+ d->setBrush(brushColor, true);
+
+ if (forced || d->m_data.m_labelBrush.isThemed())
+ d->setLabelBrush(theme->labelBrush().color(), true);
+
+ if (forced || d->m_data.m_labelFont.isThemed())
+ d->setLabelFont(theme->labelFont(), true);
+ }
+}
+
+
+#include "moc_qpieseries.cpp"
+#include "moc_qpieseries_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/piechart/qpieseries.h b/src/charts/piechart/qpieseries.h
new file mode 100644
index 00000000..27c8042b
--- /dev/null
+++ b/src/charts/piechart/qpieseries.h
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPIESERIES_H
+#define QPIESERIES_H
+
+#include <QtCharts/qabstractseries.h>
+#include <QtCharts/QPieSlice>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QPieSeriesPrivate;
+
+class QT_CHARTS_EXPORT QPieSeries : public QAbstractSeries
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition)
+ Q_PROPERTY(qreal verticalPosition READ verticalPosition WRITE setVerticalPosition)
+ Q_PROPERTY(qreal size READ pieSize WRITE setPieSize)
+ Q_PROPERTY(qreal startAngle READ pieStartAngle WRITE setPieStartAngle)
+ Q_PROPERTY(qreal endAngle READ pieEndAngle WRITE setPieEndAngle)
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(qreal sum READ sum NOTIFY sumChanged)
+ Q_PROPERTY(qreal holeSize READ holeSize WRITE setHoleSize)
+
+public:
+ explicit QPieSeries(QObject *parent = 0);
+ virtual ~QPieSeries();
+
+ QAbstractSeries::SeriesType type() const;
+
+ bool append(QPieSlice *slice);
+ bool append(QList<QPieSlice *> slices);
+ QPieSeries &operator << (QPieSlice *slice);
+ QPieSlice *append(QString label, qreal value);
+
+ bool insert(int index, QPieSlice *slice);
+
+ bool remove(QPieSlice *slice);
+ bool take(QPieSlice *slice);
+ void clear();
+
+ QList<QPieSlice *> slices() const;
+ int count() const;
+
+ bool isEmpty() const;
+
+ qreal sum() const;
+
+ void setHoleSize(qreal holeSize);
+ qreal holeSize() const;
+
+ void setHorizontalPosition(qreal relativePosition);
+ qreal horizontalPosition() const;
+
+ void setVerticalPosition(qreal relativePosition);
+ qreal verticalPosition() const;
+
+ void setPieSize(qreal relativeSize);
+ qreal pieSize() const;
+
+ void setPieStartAngle(qreal startAngle);
+ qreal pieStartAngle() const;
+
+ void setPieEndAngle(qreal endAngle);
+ qreal pieEndAngle() const;
+
+ void setLabelsVisible(bool visible = true);
+ void setLabelsPosition(QPieSlice::LabelPosition position);
+
+Q_SIGNALS:
+ void added(QList<QPieSlice *> slices);
+ void removed(QList<QPieSlice *> slices);
+ void clicked(QPieSlice *slice);
+ void hovered(QPieSlice *slice, bool state);
+ void countChanged();
+ void sumChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QPieSeries)
+ Q_DISABLE_COPY(QPieSeries)
+ friend class PieChartItem;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QPIESERIES_H
diff --git a/src/charts/piechart/qpieseries_p.h b/src/charts/piechart/qpieseries_p.h
new file mode 100644
index 00000000..f2a52180
--- /dev/null
+++ b/src/charts/piechart/qpieseries_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QPIESERIES_P_H
+#define QPIESERIES_P_H
+
+#include "qpieseries.h"
+#include "qabstractseries_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QLegendPrivate;
+
+class QPieSeriesPrivate : public QAbstractSeriesPrivate
+{
+ Q_OBJECT
+
+public:
+ QPieSeriesPrivate(QPieSeries *parent);
+ ~QPieSeriesPrivate();
+
+ void initializeDomain();
+ void initializeAxes();
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeAnimations(QtCharts::QChart::AnimationOptions options);
+ void initializeTheme(int index, ChartTheme* theme, bool forced = false);
+
+ QList<QLegendMarker *> createLegendMarkers(QLegend *legend);
+
+ QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
+ QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
+
+ void updateDerivativeData();
+ void setSizes(qreal innerSize, qreal outerSize);
+
+ static QPieSeriesPrivate *fromSeries(QPieSeries *series);
+
+signals:
+ void calculatedDataChanged();
+ void pieSizeChanged();
+ void pieStartAngleChanged();
+ void pieEndAngleChanged();
+ void horizontalPositionChanged();
+ void verticalPositionChanged();
+
+public Q_SLOTS:
+ void sliceValueChanged();
+ void sliceClicked();
+ void sliceHovered(bool state);
+
+private:
+ QList<QPieSlice *> m_slices;
+ qreal m_pieRelativeHorPos;
+ qreal m_pieRelativeVerPos;
+ qreal m_pieRelativeSize;
+ qreal m_pieStartAngle;
+ qreal m_pieEndAngle;
+ qreal m_sum;
+ qreal m_holeRelativeSize;
+
+public:
+ friend class QLegendPrivate;
+ Q_DECLARE_PUBLIC(QPieSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QPIESERIES_P_H
diff --git a/src/charts/piechart/qpieslice.cpp b/src/charts/piechart/qpieslice.cpp
new file mode 100644
index 00000000..48227e26
--- /dev/null
+++ b/src/charts/piechart/qpieslice.cpp
@@ -0,0 +1,794 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpieslice.h"
+#include "qpieslice_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QPieSlice
+ \inmodule Qt Charts
+ \brief Defines a slice in pie series.
+
+ This object defines the properties of a single slice in a QPieSeries.
+
+ In addition to the obvious value and label properties the user can also control
+ the visual appearance of a slice. By modifying the visual appearance also means that
+ the user is overriding the default appearance set by the theme.
+
+ Note that if the user has customized slices and theme is changed all customizations will be lost.
+
+ To enable user interaction with the pie some basic signals are provided about clicking and hovering.
+*/
+
+/*!
+ \qmltype PieSlice
+ \instantiates QPieSlice
+ \inqmlmodule QtCharts
+
+ \brief Defines a slice in pie series.
+
+ PieSlice defines the properties of a single slice in a PieSeries. The element should be used
+ as a child for a PieSeries. For example:
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 2
+
+ An alternative (dynamic) method for adding slices to a PieSeries is using PieSeries.append
+ method.
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 4
+
+ In that case you may want to use PieSeries.at or PieSeries.find to access the properties of
+ an individual PieSlice instance.
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 5
+ \sa PieSeries
+*/
+
+/*!
+ \enum QPieSlice::LabelPosition
+
+ This enum describes the position of the slice label.
+
+ \value LabelOutside Label is outside the slice with an arm.
+ \value LabelInsideHorizontal Label is centered inside the slice and laid out horizontally.
+ \value LabelInsideTangential Label is centered inside the slice and rotated to be parallel to the tangential of the slice's arc.
+ \value LabelInsideNormal Label is centered inside the slice rotated to be parallel to the normal of the slice's arc.
+ */
+
+/*!
+ \property QPieSlice::label
+ Label of the slice.
+ \sa labelVisible, labelBrush, labelFont, labelArmLengthFactor
+*/
+/*!
+ \qmlproperty string PieSlice::label
+ Label (text) of the slice.
+*/
+
+/*!
+ \fn void QPieSlice::labelChanged()
+ This signal emitted when the slice label has been changed.
+ \sa label
+*/
+/*!
+ \qmlsignal PieSlice::onLabelChanged()
+ This signal emitted when the slice label has been changed.
+ \sa label
+*/
+
+/*!
+ \property QPieSlice::value
+ Value of the slice.
+ Note that if users sets a negative value it is converted to a positive value.
+ \sa percentage(), QPieSeries::sum()
+*/
+/*!
+ \qmlproperty real PieSlice::value
+ Value of the slice. Note that if users sets a negative value it is converted to a positive value.
+*/
+
+/*!
+ \fn void QPieSlice::valueChanged()
+ This signal is emitted when the slice value changes.
+ \sa value
+*/
+/*!
+ \qmlsignal PieSlice::onValueChanged()
+ This signal is emitted when the slice value changes.
+ \sa value
+*/
+
+/*!
+ \property QPieSlice::labelVisible
+ Defines the visibility of slice label. By default the label is not visible.
+ \sa label, labelBrush, labelFont, labelArmLengthFactor
+*/
+/*!
+ \qmlproperty bool PieSlice::labelVisible
+ Defines the visibility of slice label. By default the label is not visible.
+*/
+
+/*!
+ \fn void QPieSlice::labelVisibleChanged()
+ This signal emitted when visibility of the slice label has changed.
+ \sa labelVisible
+*/
+/*!
+ \qmlsignal PieSlice::onLabelVisibleChanged()
+ This signal emitted when visibility of the slice label has changed.
+ \sa labelVisible
+*/
+
+/*!
+ \property QPieSlice::exploded
+ If set to true the slice is "exploded" away from the pie.
+ \sa explodeDistanceFactor
+*/
+/*!
+ \qmlproperty bool PieSlice::exploded
+ If set to true the slice is "exploded" away from the pie.
+ \sa explodeDistanceFactor
+*/
+
+/*!
+ \property QPieSlice::pen
+ Pen used to draw the slice border.
+*/
+
+/*!
+ \fn void QPieSlice::penChanged()
+ This signal is emitted when the pen of the slice has changed.
+ \sa pen
+*/
+
+/*!
+ \property QPieSlice::borderColor
+ Color used to draw the slice border.
+ This is a convenience property for modifying the slice pen.
+ \sa pen, borderWidth
+*/
+/*!
+ \qmlproperty color PieSlice::borderColor
+ Color used to draw the slice border (pen color).
+ \sa borderWidth
+*/
+
+/*!
+ \fn void QPieSlice::borderColorChanged()
+ This signal is emitted when slice border color changes.
+ \sa pen, borderColor
+*/
+/*!
+ \qmlsignal PieSlice::onBorderColorChanged()
+ This signal is emitted when slice border color changes.
+ \sa borderColor
+*/
+
+/*!
+ \property QPieSlice::borderWidth
+ Width of the slice border.
+ This is a convenience property for modifying the slice pen.
+ \sa pen, borderColor
+*/
+/*!
+ \qmlproperty int PieSlice::borderWidth
+ Width of the slice border.
+ This is a convenience property for modifying the slice pen.
+ \sa borderColor
+*/
+
+/*!
+ \fn void QPieSlice::borderWidthChanged()
+ This signal is emitted when slice border width changes.
+ \sa pen, borderWidth
+*/
+/*!
+ \qmlsignal PieSlice::onBorderWidthChanged()
+ This signal is emitted when slice border width changes.
+ \sa borderWidth
+*/
+
+/*!
+ \property QPieSlice::brush
+ Brush used to draw the slice.
+*/
+
+/*!
+ \fn void QPieSlice::brushChanged()
+ This signal is emitted when the brush of the slice has changed.
+ \sa brush
+*/
+
+/*!
+ \qmlproperty QString PieSlice::brushFilename
+ The name of the file used as a brush for the slice.
+*/
+
+/*!
+ \property QPieSlice::color
+ Fill (brush) color of the slice.
+ This is a convenience property for modifying the slice brush.
+ \sa brush
+*/
+/*!
+ \qmlproperty color PieSlice::color
+ Fill (brush) color of the slice.
+*/
+
+/*!
+ \fn void QPieSlice::colorChanged()
+ This signal is emitted when slice color changes.
+ \sa brush
+*/
+/*!
+ \qmlsignal PieSlice::onColorChanged()
+ This signal is emitted when slice color changes.
+*/
+
+/*!
+ \property QPieSlice::labelBrush
+ Brush used to draw label and label arm of the slice.
+ \sa label, labelVisible, labelFont, labelArmLengthFactor
+*/
+
+/*!
+ \fn void QPieSlice::labelBrushChanged()
+ This signal is emitted when the label brush of the slice has changed.
+ \sa labelBrush
+*/
+
+/*!
+ \property QPieSlice::labelColor
+ Color used to draw the slice label.
+ This is a convenience property for modifying the slice label brush.
+ \sa labelBrush
+*/
+/*!
+ \qmlproperty color PieSlice::labelColor
+ Color used to draw the slice label.
+*/
+
+/*!
+ \fn void QPieSlice::labelColorChanged()
+ This signal is emitted when slice label color changes.
+ \sa labelColor
+*/
+/*!
+ \qmlsignal PieSlice::onLabelColorChanged()
+ This signal is emitted when slice label color changes.
+ \sa labelColor
+*/
+
+/*!
+ \property QPieSlice::labelFont
+ Font used for drawing label text.
+ \sa label, labelVisible, labelArmLengthFactor
+*/
+
+/*!
+ \fn void QPieSlice::labelFontChanged()
+ This signal is emitted when the label font of the slice has changed.
+ \sa labelFont
+*/
+
+/*!
+ \qmlproperty Font PieSlice::labelFont
+
+ Defines the font used for slice label.
+
+ See the Qt documentation for more details of Font.
+
+ \sa labelVisible, labelPosition
+*/
+
+/*!
+ \property QPieSlice::labelPosition
+ Position of the slice label.
+ \sa label, labelVisible
+*/
+/*!
+ \qmlproperty LabelPosition PieSlice::labelPosition
+ Position of the slice label. One of PieSlice.LabelOutside, PieSlice.LabelInsideHorizontal,
+ PieSlice.LabelInsideTangential or PieSlice.LabelInsideNormal. By default the position is
+ PieSlice.LabelOutside.
+ \sa labelVisible
+*/
+
+/*!
+ \property QPieSlice::labelArmLengthFactor
+ Defines the length of the label arm.
+ The factor is relative to pie radius. For example:
+ 1.0 means the length is the same as the radius.
+ 0.5 means the length is half of the radius.
+ By default the arm length is 0.15
+ \sa label, labelVisible, labelBrush, labelFont
+*/
+/*!
+ \qmlproperty real PieSlice::labelArmLengthFactor
+ Defines the length of the label arm.
+ The factor is relative to pie radius. For example:
+ 1.0 means the length is the same as the radius.
+ 0.5 means the length is half of the radius.
+ By default the arm length is 0.15
+ \sa labelVisible
+*/
+
+/*!
+ \property QPieSlice::explodeDistanceFactor
+ When the slice is exploded this factor defines how far the slice is exploded away from the pie.
+ The factor is relative to pie radius. For example:
+ 1.0 means the distance is the same as the radius.
+ 0.5 means the distance is half of the radius.
+ By default the distance is is 0.15
+ \sa exploded
+*/
+/*!
+ \qmlproperty real PieSlice::explodeDistanceFactor
+ When the slice is exploded this factor defines how far the slice is exploded away from the pie.
+ The factor is relative to pie radius. For example:
+ 1.0 means the distance is the same as the radius.
+ 0.5 means the distance is half of the radius.
+ By default the distance is is 0.15
+ \sa exploded
+*/
+
+/*!
+ \property QPieSlice::percentage
+ Percentage of the slice compared to the sum of all slices in the series.
+ The actual value ranges from 0.0 to 1.0.
+ Updated automatically once the slice is added to the series.
+ \sa value, QPieSeries::sum
+*/
+/*!
+ \qmlproperty real PieSlice::percentage
+ Percentage of the slice compared to the sum of all slices in the series.
+ The actual value ranges from 0.0 to 1.0.
+ Updated automatically once the slice is added to the series.
+*/
+
+/*!
+ \fn void QPieSlice::percentageChanged()
+ This signal is emitted when the percentage of the slice has changed.
+ \sa percentage
+*/
+/*!
+ \qmlsignal void PieSlice::onPercentageChanged()
+ This signal is emitted when the percentage of the slice has changed.
+ \sa percentage
+*/
+
+/*!
+ \property QPieSlice::startAngle
+ Defines the starting angle of this slice in the series it belongs to.
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+ Updated automatically once the slice is added to the series.
+*/
+/*!
+ \qmlproperty real PieSlice::startAngle
+ Defines the starting angle of this slice in the series it belongs to.
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+ Updated automatically once the slice is added to the series.
+*/
+
+/*!
+ \fn void QPieSlice::startAngleChanged()
+ This signal is emitted when the starting angle f the slice has changed.
+ \sa startAngle
+*/
+/*!
+ \qmlsignal PieSlice::onStartAngleChanged()
+ This signal is emitted when the starting angle f the slice has changed.
+ \sa startAngle
+*/
+
+/*!
+ \property QPieSlice::angleSpan
+ Span of the slice in degrees.
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+ Updated automatically once the slice is added to the series.
+*/
+/*!
+ \qmlproperty real PieSlice::angleSpan
+ Span of the slice in degrees.
+ Full pie is 360 degrees where 0 degrees is at 12 a'clock.
+ Updated automatically once the slice is added to the series.
+*/
+
+/*!
+ \fn void QPieSlice::angleSpanChanged()
+ This signal is emitted when the angle span of the slice has changed.
+ \sa angleSpan
+*/
+/*!
+ \qmlsignal PieSlice::onAngleSpanChanged()
+ This signal is emitted when the angle span of the slice has changed.
+ \sa angleSpan
+*/
+
+/*!
+ \fn void QPieSlice::clicked()
+ This signal is emitted when user has clicked the slice.
+ \sa QPieSeries::clicked()
+*/
+/*!
+ \qmlsignal PieSlice::onClicked()
+ This signal is emitted when user has clicked the slice.
+*/
+
+/*!
+ \fn void QPieSlice::hovered(bool state)
+ This signal is emitted when user has hovered over or away from the slice.
+ \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
+ \sa QPieSeries::hovered()
+*/
+/*!
+ \qmlsignal PieSlice::onHovered(bool state)
+ This signal is emitted when user has hovered over or away from the slice.
+ \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
+*/
+
+/*!
+ Constructs an empty slice with a \a parent.
+ \sa QPieSeries::append(), QPieSeries::insert()
+*/
+QPieSlice::QPieSlice(QObject *parent)
+ : QObject(parent),
+ d_ptr(new QPieSlicePrivate(this))
+{
+
+}
+
+/*!
+ Constructs an empty slice with given \a value, \a label and a \a parent.
+ \sa QPieSeries::append(), QPieSeries::insert()
+*/
+QPieSlice::QPieSlice(QString label, qreal value, QObject *parent)
+ : QObject(parent),
+ d_ptr(new QPieSlicePrivate(this))
+{
+ setValue(value);
+ setLabel(label);
+}
+
+/*!
+ Destroys the slice.
+ User should not delete the slice if it has been added to the series.
+*/
+QPieSlice::~QPieSlice()
+{
+
+}
+
+void QPieSlice::setLabel(QString label)
+{
+ if (d_ptr->m_data.m_labelText != label) {
+ d_ptr->m_data.m_labelText = label;
+ emit labelChanged();
+ }
+}
+
+QString QPieSlice::label() const
+{
+ return d_ptr->m_data.m_labelText;
+}
+
+void QPieSlice::setValue(qreal value)
+{
+ value = qAbs(value); // negative values not allowed
+ if (!qFuzzyCompare(d_ptr->m_data.m_value, value)) {
+ d_ptr->m_data.m_value = value;
+ emit valueChanged();
+ }
+}
+
+qreal QPieSlice::value() const
+{
+ return d_ptr->m_data.m_value;
+}
+
+void QPieSlice::setLabelVisible(bool visible)
+{
+ if (d_ptr->m_data.m_isLabelVisible != visible) {
+ d_ptr->m_data.m_isLabelVisible = visible;
+ emit labelVisibleChanged();
+ }
+}
+
+bool QPieSlice::isLabelVisible() const
+{
+ return d_ptr->m_data.m_isLabelVisible;
+}
+
+void QPieSlice::setExploded(bool exploded)
+{
+ if (d_ptr->m_data.m_isExploded != exploded) {
+ d_ptr->m_data.m_isExploded = exploded;
+ emit d_ptr->explodedChanged();
+ }
+}
+
+QPieSlice::LabelPosition QPieSlice::labelPosition()
+{
+ return d_ptr->m_data.m_labelPosition;
+}
+
+void QPieSlice::setLabelPosition(LabelPosition position)
+{
+ if (d_ptr->m_data.m_labelPosition != position) {
+ d_ptr->m_data.m_labelPosition = position;
+ emit d_ptr->labelPositionChanged();
+ }
+}
+
+bool QPieSlice::isExploded() const
+{
+ return d_ptr->m_data.m_isExploded;
+}
+
+void QPieSlice::setPen(const QPen &pen)
+{
+ d_ptr->setPen(pen, false);
+}
+
+QPen QPieSlice::pen() const
+{
+ return d_ptr->m_data.m_slicePen;
+}
+
+QColor QPieSlice::borderColor()
+{
+ return pen().color();
+}
+
+void QPieSlice::setBorderColor(QColor color)
+{
+ QPen p = pen();
+ if (color != p.color()) {
+ p.setColor(color);
+ setPen(p);
+ }
+}
+
+int QPieSlice::borderWidth()
+{
+ return pen().width();
+}
+
+void QPieSlice::setBorderWidth(int width)
+{
+ QPen p = pen();
+ if (width != p.width()) {
+ p.setWidth(width);
+ setPen(p);
+ }
+}
+
+void QPieSlice::setBrush(const QBrush &brush)
+{
+ d_ptr->setBrush(brush, false);
+}
+
+QBrush QPieSlice::brush() const
+{
+ return d_ptr->m_data.m_sliceBrush;
+}
+
+QColor QPieSlice::color()
+{
+ return brush().color();
+}
+
+void QPieSlice::setColor(QColor color)
+{
+ QBrush b = brush();
+
+ if (b == QBrush())
+ b.setStyle(Qt::SolidPattern);
+ b.setColor(color);
+ setBrush(b);
+}
+
+void QPieSlice::setLabelBrush(const QBrush &brush)
+{
+ d_ptr->setLabelBrush(brush, false);
+}
+
+QBrush QPieSlice::labelBrush() const
+{
+ return d_ptr->m_data.m_labelBrush;
+}
+
+QColor QPieSlice::labelColor()
+{
+ return labelBrush().color();
+}
+
+void QPieSlice::setLabelColor(QColor color)
+{
+ QBrush b = labelBrush();
+ if (color != b.color()) {
+ b.setColor(color);
+ setLabelBrush(b);
+ }
+}
+
+void QPieSlice::setLabelFont(const QFont &font)
+{
+ d_ptr->setLabelFont(font, false);
+}
+
+QFont QPieSlice::labelFont() const
+{
+ return d_ptr->m_data.m_labelFont;
+}
+
+void QPieSlice::setLabelArmLengthFactor(qreal factor)
+{
+ if (!qFuzzyCompare(d_ptr->m_data.m_labelArmLengthFactor, factor)) {
+ d_ptr->m_data.m_labelArmLengthFactor = factor;
+ emit d_ptr->labelArmLengthFactorChanged();
+ }
+}
+
+qreal QPieSlice::labelArmLengthFactor() const
+{
+ return d_ptr->m_data.m_labelArmLengthFactor;
+}
+
+void QPieSlice::setExplodeDistanceFactor(qreal factor)
+{
+ if (!qFuzzyCompare(d_ptr->m_data.m_explodeDistanceFactor, factor)) {
+ d_ptr->m_data.m_explodeDistanceFactor = factor;
+ emit d_ptr->explodeDistanceFactorChanged();
+ }
+}
+
+qreal QPieSlice::explodeDistanceFactor() const
+{
+ return d_ptr->m_data.m_explodeDistanceFactor;
+}
+
+qreal QPieSlice::percentage() const
+{
+ return d_ptr->m_data.m_percentage;
+}
+
+qreal QPieSlice::startAngle() const
+{
+ return d_ptr->m_data.m_startAngle;
+}
+
+qreal QPieSlice::angleSpan() const
+{
+ return d_ptr->m_data.m_angleSpan;
+}
+
+/*!
+ Returns the series that this slice belongs to.
+
+ \sa QPieSeries::append()
+*/
+QPieSeries *QPieSlice::series() const
+{
+ return d_ptr->m_series;
+}
+
+QPieSlicePrivate::QPieSlicePrivate(QPieSlice *parent)
+ : QObject(parent),
+ q_ptr(parent),
+ m_series(0)
+{
+
+}
+
+QPieSlicePrivate::~QPieSlicePrivate()
+{
+
+}
+
+QPieSlicePrivate *QPieSlicePrivate::fromSlice(QPieSlice *slice)
+{
+ return slice->d_func();
+}
+
+void QPieSlicePrivate::setPen(const QPen &pen, bool themed)
+{
+ if (m_data.m_slicePen != pen) {
+
+ QPen oldPen = m_data.m_slicePen;
+
+ m_data.m_slicePen = pen;
+ m_data.m_slicePen.setThemed(themed);
+
+ emit q_ptr->penChanged();
+ if (oldPen.color() != pen.color())
+ emit q_ptr->borderColorChanged();
+ if (oldPen.width() != pen.width())
+ emit q_ptr->borderWidthChanged();
+ }
+}
+
+void QPieSlicePrivate::setBrush(const QBrush &brush, bool themed)
+{
+ if (m_data.m_sliceBrush != brush) {
+
+ QBrush oldBrush = m_data.m_sliceBrush;
+
+ m_data.m_sliceBrush = brush;
+ m_data.m_sliceBrush.setThemed(themed);
+
+ emit q_ptr->brushChanged();
+ if (oldBrush.color() != brush.color())
+ emit q_ptr->colorChanged();
+ }
+}
+
+void QPieSlicePrivate::setLabelBrush(const QBrush &brush, bool themed)
+{
+ if (m_data.m_labelBrush != brush) {
+
+ QBrush oldBrush = m_data.m_labelBrush;
+
+ m_data.m_labelBrush = brush;
+ m_data.m_labelBrush.setThemed(themed);
+
+ emit q_ptr->labelBrushChanged();
+ if (oldBrush.color() != brush.color())
+ emit q_ptr->labelColorChanged();
+ }
+}
+
+void QPieSlicePrivate::setLabelFont(const QFont &font, bool themed)
+{
+ if (m_data.m_labelFont != font) {
+ m_data.m_labelFont = font;
+ m_data.m_labelFont.setThemed(themed);
+ emit q_ptr->labelFontChanged();
+ }
+}
+
+void QPieSlicePrivate::setPercentage(qreal percentage)
+{
+ if (!qFuzzyCompare(m_data.m_percentage, percentage)) {
+ m_data.m_percentage = percentage;
+ emit q_ptr->percentageChanged();
+ }
+}
+
+void QPieSlicePrivate::setStartAngle(qreal angle)
+{
+ if (!qFuzzyCompare(m_data.m_startAngle, angle)) {
+ m_data.m_startAngle = angle;
+ emit q_ptr->startAngleChanged();
+ }
+}
+
+void QPieSlicePrivate::setAngleSpan(qreal span)
+{
+ if (!qFuzzyCompare(m_data.m_angleSpan, span)) {
+ m_data.m_angleSpan = span;
+ emit q_ptr->angleSpanChanged();
+ }
+}
+
+QT_CHARTS_END_NAMESPACE
+
+QT_CHARTS_USE_NAMESPACE
+#include "moc_qpieslice.cpp"
+#include "moc_qpieslice_p.cpp"
diff --git a/src/charts/piechart/qpieslice.h b/src/charts/piechart/qpieslice.h
new file mode 100644
index 00000000..8be5d3cc
--- /dev/null
+++ b/src/charts/piechart/qpieslice.h
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPIESLICE_H
+#define QPIESLICE_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QObject>
+#include <QPen>
+#include <QBrush>
+#include <QFont>
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QPieSlicePrivate;
+class QPieSeries;
+
+class QT_CHARTS_EXPORT QPieSlice : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(LabelPosition)
+ Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged)
+ Q_PROPERTY(bool labelVisible READ isLabelVisible WRITE setLabelVisible NOTIFY labelVisibleChanged)
+ Q_PROPERTY(LabelPosition labelPosition READ labelPosition WRITE setLabelPosition)
+ Q_PROPERTY(bool exploded READ isExploded WRITE setExploded)
+ Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
+ Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
+ Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged)
+ Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
+ Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged)
+ Q_PROPERTY(qreal labelArmLengthFactor READ labelArmLengthFactor WRITE setLabelArmLengthFactor)
+ Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor)
+ Q_PROPERTY(qreal percentage READ percentage NOTIFY percentageChanged)
+ Q_PROPERTY(qreal startAngle READ startAngle NOTIFY startAngleChanged)
+ Q_PROPERTY(qreal angleSpan READ angleSpan NOTIFY angleSpanChanged)
+
+public:
+ enum LabelPosition {
+ LabelOutside,
+ LabelInsideHorizontal,
+ LabelInsideTangential,
+ LabelInsideNormal
+ };
+
+public:
+ explicit QPieSlice(QObject *parent = 0);
+ QPieSlice(QString label, qreal value, QObject *parent = 0);
+ virtual ~QPieSlice();
+
+ void setLabel(QString label);
+ QString label() const;
+
+ void setValue(qreal value);
+ qreal value() const;
+
+ void setLabelVisible(bool visible = true);
+ bool isLabelVisible() const;
+
+ LabelPosition labelPosition();
+ void setLabelPosition(LabelPosition position);
+
+ void setExploded(bool exploded = true);
+ bool isExploded() const;
+
+ void setPen(const QPen &pen);
+ QPen pen() const;
+
+ QColor borderColor();
+ void setBorderColor(QColor color);
+
+ int borderWidth();
+ void setBorderWidth(int width);
+
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+
+ QColor color();
+ void setColor(QColor color);
+
+ void setLabelBrush(const QBrush &brush);
+ QBrush labelBrush() const;
+
+ QColor labelColor();
+ void setLabelColor(QColor color);
+
+ void setLabelFont(const QFont &font);
+ QFont labelFont() const;
+
+ void setLabelArmLengthFactor(qreal factor);
+ qreal labelArmLengthFactor() const;
+
+ void setExplodeDistanceFactor(qreal factor);
+ qreal explodeDistanceFactor() const;
+
+ qreal percentage() const;
+ qreal startAngle() const;
+ qreal angleSpan() const;
+
+ QPieSeries *series() const;
+
+Q_SIGNALS:
+ void clicked();
+ void hovered(bool state);
+ void labelChanged();
+ void valueChanged();
+ void labelVisibleChanged();
+ void penChanged();
+ void brushChanged();
+ void labelBrushChanged();
+ void labelFontChanged();
+ void percentageChanged();
+ void startAngleChanged();
+ void angleSpanChanged();
+ void colorChanged();
+ void borderColorChanged();
+ void borderWidthChanged();
+ void labelColorChanged();
+
+private:
+ QPieSlicePrivate * const d_ptr;
+ Q_DECLARE_PRIVATE(QPieSlice)
+ Q_DISABLE_COPY(QPieSlice)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QPIESLICE_H
diff --git a/src/charts/piechart/qpieslice_p.h b/src/charts/piechart/qpieslice_p.h
new file mode 100644
index 00000000..340a4753
--- /dev/null
+++ b/src/charts/piechart/qpieslice_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QPIESLICE_P_H
+#define QPIESLICE_P_H
+
+#include <QObject>
+#include "qpieslice.h"
+#include "pieslicedata_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+class QPieSeries;
+
+class QPieSlicePrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ QPieSlicePrivate(QPieSlice *parent);
+ ~QPieSlicePrivate();
+
+ static QPieSlicePrivate *fromSlice(QPieSlice *slice);
+
+ void setPen(const QPen &pen, bool themed);
+ void setBrush(const QBrush &brush, bool themed);
+ void setLabelBrush(const QBrush &brush, bool themed);
+ void setLabelFont(const QFont &font, bool themed);
+
+ void setPercentage(qreal percentage);
+ void setStartAngle(qreal angle);
+ void setAngleSpan(qreal span);
+
+Q_SIGNALS:
+ void labelPositionChanged();
+ void explodedChanged();
+ void labelArmLengthFactorChanged();
+ void explodeDistanceFactorChanged();
+
+private:
+ friend class QPieSeries;
+ friend class QPieSeriesPrivate;
+ friend class ChartThemeManager;
+ friend class PieChartItem;
+
+ QPieSlice * const q_ptr;
+ Q_DECLARE_PUBLIC(QPieSlice)
+
+ PieSliceData m_data;
+ QPieSeries *m_series;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QPIESLICE_P_H
diff --git a/src/charts/piechart/qvpiemodelmapper.cpp b/src/charts/piechart/qvpiemodelmapper.cpp
new file mode 100644
index 00000000..7b9c0a0c
--- /dev/null
+++ b/src/charts/piechart/qvpiemodelmapper.cpp
@@ -0,0 +1,270 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvpiemodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QVPieModelMapper
+ \inmodule Qt Charts
+ \brief Vertical model mapper for pie series.
+ \mainclass
+
+ Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
+ Vertical model mapper is used to create a connection between QPieSeries and QAbstractItemModel derived model object that keeps the consecutive pie slices data in columns.
+ It is possible to use both QAbstractItemModel and QPieSeries model API. QVPieModelMapper makes sure that Pie and the model are kept in sync.
+ \note Used model has to support adding/removing rows/columns and modifying the data of the cells.
+*/
+/*!
+ \qmltype VPieModelMapper
+ \instantiates QVPieModelMapper
+ \inqmlmodule QtCharts
+
+ \brief Vertical model mapper for pie series.
+
+ VPieModelMapper allows you to use your own QAbstractItemModel derived model with data in columns
+ as a data source for a pie series. It is possible to use both QAbstractItemModel and PieSeries
+ data API to manipulate data. VPieModelMapper keeps the Pie and the model in sync.
+
+ The following QML example would create a pie series with four slices (assuming the model has at
+ least five rows). Each slice would contain a label from column 1 and a value from column 2.
+ \code
+ VPieModelMapper {
+ series: pieSeries
+ model: customModel
+ labelsColumn: 1
+ valuesColumn: 2
+ firstRow: 1
+ rowCount: 4
+ }
+ \endcode
+*/
+
+/*!
+ \property QVPieModelMapper::series
+ \brief Defines the QPieSeries object that is used by the mapper.
+ All the data in the series is discarded when it is set to the mapper.
+ When new series is specified the old series is disconnected (it preserves its data)
+*/
+/*!
+ \qmlproperty PieSeries VPieModelMapper::series
+ Defines the PieSeries object that is used by the mapper. If you define the mapper element as a child for a
+ PieSeries, leave this property undefined. All the data in the series is discarded when it is set to the mapper.
+ When new series is specified the old series is disconnected (it preserves its data).
+*/
+
+/*!
+ \property QVPieModelMapper::model
+ \brief Defines the model that is used by the mapper.
+*/
+/*!
+ \qmlproperty SomeModel VPieModelMapper::model
+ The QAbstractItemModel based model that is used by the mapper. You need to implement the model
+ and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
+ the data of the cells.
+*/
+
+/*!
+ \property QVPieModelMapper::valuesColumn
+ \brief Defines which column of the model is kept in sync with the values of the pie's slices.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int VPieModelMapper::valuesColumn
+ Defines which column of the model is kept in sync with the values of the pie's slices. Default value is -1 (invalid
+ mapping).
+*/
+
+/*!
+ \property QVPieModelMapper::labelsColumn
+ \brief Defines which column of the model is kept in sync with the labels of the pie's slices.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int VPieModelMapper::labelsColumn
+ Defines which column of the model is kept in sync with the labels of the pie's slices. Default value is -1 (invalid
+ mapping).
+*/
+
+/*!
+ \property QVPieModelMapper::firstRow
+ \brief Defines which row of the model contains the first slice value.
+
+ Minimal and default value is: 0
+*/
+/*!
+ \qmlproperty int VPieModelMapper::firstRow
+ Defines which row of the model contains the first slice value.
+ The default value is 0.
+*/
+
+/*!
+ \property QVPieModelMapper::rowCount
+ \brief Defines the number of rows of the model that are mapped as the data for QPieSeries.
+
+ Minimal and default value is: -1 (count limited by the number of rows in the model)
+*/
+/*!
+ \qmlproperty int VPieModelMapper::columnCount
+ Defines the number of rows of the model that are mapped as the data for QPieSeries. The default value is
+ -1 (count limited by the number of rows in the model)
+*/
+
+/*!
+ \fn void QVPieModelMapper::seriesReplaced()
+
+ Emitted when the series to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QVPieModelMapper::modelReplaced()
+
+ Emitted when the model to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QVPieModelMapper::valuesColumnChanged()
+
+ Emitted when the valuesColumn has changed.
+*/
+
+/*!
+ \fn void QVPieModelMapper::labelsColumnChanged()
+
+ Emitted when the labelsColumn has changed.
+*/
+
+/*!
+ \fn void QVPieModelMapper::firstRowChanged()
+ Emitted when the firstRow has changed.
+*/
+
+/*!
+ \fn void QVPieModelMapper::rowCountChanged()
+ Emitted when the rowCount has changed.
+*/
+
+/*!
+ Constructs a mapper object which is a child of \a parent.
+*/
+QVPieModelMapper::QVPieModelMapper(QObject *parent) :
+ QPieModelMapper(parent)
+{
+ QPieModelMapper::setOrientation(Qt::Vertical);
+}
+
+QAbstractItemModel *QVPieModelMapper::model() const
+{
+ return QPieModelMapper::model();
+}
+
+void QVPieModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model != QPieModelMapper::model()) {
+ QPieModelMapper::setModel(model);
+ emit modelReplaced();
+ }
+}
+
+QPieSeries *QVPieModelMapper::series() const
+{
+ return QPieModelMapper::series();
+}
+
+void QVPieModelMapper::setSeries(QPieSeries *series)
+{
+ if (series != QPieModelMapper::series()) {
+ QPieModelMapper::setSeries(series);
+ emit seriesReplaced();
+ }
+}
+
+/*!
+ Returns which column of the model is kept in sync with the values of the pie's slices
+*/
+int QVPieModelMapper::valuesColumn() const
+{
+ return QPieModelMapper::valuesSection();
+}
+
+/*!
+ Sets the model column that is kept in sync with the pie slices values.
+ Parameter \a valuesColumn specifies the row of the model.
+*/
+void QVPieModelMapper::setValuesColumn(int valuesColumn)
+{
+ if (valuesColumn != valuesSection()) {
+ QPieModelMapper::setValuesSection(valuesColumn);
+ emit valuesColumnChanged();
+ }
+}
+
+/*!
+ Returns which column of the model is kept in sync with the labels of the pie's slices
+*/
+int QVPieModelMapper::labelsColumn() const
+{
+ return QPieModelMapper::labelsSection();
+}
+
+/*!
+ Sets the model column that is kept in sync with the pie's slices labels.
+ Parameter \a labelsColumn specifies the row of the model.
+*/
+void QVPieModelMapper::setLabelsColumn(int labelsColumn)
+{
+ if (labelsColumn != labelsSection()) {
+ QPieModelMapper::setLabelsSection(labelsColumn);
+ emit labelsColumnChanged();
+ }
+}
+
+int QVPieModelMapper::firstRow() const
+{
+ return first();
+}
+
+void QVPieModelMapper::setFirstRow(int firstRow)
+{
+ if (firstRow != first()) {
+ setFirst(firstRow);
+ emit firstRowChanged();
+ }
+}
+
+int QVPieModelMapper::rowCount() const
+{
+ return count();
+}
+
+void QVPieModelMapper::setRowCount(int rowCount)
+{
+ if (rowCount != count()) {
+ setCount(rowCount);
+ emit rowCountChanged();
+ }
+}
+
+#include "moc_qvpiemodelmapper.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/piechart/qvpiemodelmapper.h b/src/charts/piechart/qvpiemodelmapper.h
new file mode 100644
index 00000000..2135ff9b
--- /dev/null
+++ b/src/charts/piechart/qvpiemodelmapper.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVPIEMODELMAPPER_H
+#define QVPIEMODELMAPPER_H
+
+#include <QtCharts/qpiemodelmapper.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/* Comment line for syncqt to generate the fwd-include correctly, due to QTBUG-22432 */
+class QT_CHARTS_EXPORT QVPieModelMapper : public QPieModelMapper
+{
+ Q_OBJECT
+ Q_PROPERTY(QPieSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
+ Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
+ Q_PROPERTY(int valuesColumn READ valuesColumn WRITE setValuesColumn NOTIFY valuesColumnChanged)
+ Q_PROPERTY(int labelsColumn READ labelsColumn WRITE setLabelsColumn NOTIFY labelsColumnChanged)
+ Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
+ Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
+
+public:
+ explicit QVPieModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QPieSeries *series() const;
+ void setSeries(QPieSeries *series);
+
+ int valuesColumn() const;
+ void setValuesColumn(int valuesColumn);
+
+ int labelsColumn() const;
+ void setLabelsColumn(int labelsColumn);
+
+ int firstRow() const;
+ void setFirstRow(int firstRow);
+
+ int rowCount() const;
+ void setRowCount(int rowCount);
+
+Q_SIGNALS:
+ void seriesReplaced();
+ void modelReplaced();
+ void valuesColumnChanged();
+ void labelsColumnChanged();
+ void firstRowChanged();
+ void rowCountChanged();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QVPIEMODELMAPPER_H
diff --git a/src/charts/qabstractseries.cpp b/src/charts/qabstractseries.cpp
new file mode 100644
index 00000000..1db799f2
--- /dev/null
+++ b/src/charts/qabstractseries.cpp
@@ -0,0 +1,328 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractseries.h"
+#include "qabstractseries_p.h"
+#include "chartdataset_p.h"
+#include "qchart.h"
+#include "qchart_p.h"
+#include "chartitem_p.h"
+#include "xydomain_p.h"
+#include "xlogydomain_p.h"
+#include "logxydomain_p.h"
+#include "logxlogydomain_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QAbstractSeries
+ \inmodule Qt Charts
+ \brief Base class for all Qt Chart series.
+ \mainclass
+
+ Usually you use the series type specific inherited classes instead of the base class.
+ \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries,
+ QPercentBarSeries, QPieSeries
+*/
+/*!
+ \qmltype AbstractSeries
+ \instantiates QAbstractSeries
+ \inqmlmodule QtCharts
+
+ \brief Base class for all Qt Chart series.
+
+ AbstractSeries is the base class for all series.
+ The class cannot be instantiated by the user.
+*/
+
+/*!
+ \enum QAbstractSeries::SeriesType
+
+ The type of the series object.
+
+ \value SeriesTypeLine
+ \value SeriesTypeArea
+ \value SeriesTypeBar
+ \value SeriesTypeStackedBar
+ \value SeriesTypePercentBar
+ \value SeriesTypePie
+ \value SeriesTypeScatter
+ \value SeriesTypeSpline
+ \value SeriesTypeHorizontalBar
+ \value SeriesTypeHorizontalStackedBar
+ \value SeriesTypeHorizontalPercentBar
+ \value SeriesTypeBoxPlot
+*/
+
+/*!
+ \property QAbstractSeries::type
+ The type of the series.
+*/
+/*!
+ \qmlproperty ChartView.SeriesType AbstractSeries::type
+ The type of the series.
+*/
+
+/*!
+ \property QAbstractSeries::name
+ \brief name of the series property. The name is shown in legend for series and supports html formatting.
+*/
+/*!
+ \qmlproperty string AbstractSeries::name
+ Name of the series. The name is shown in legend for series and supports html formatting.
+*/
+
+/*!
+ \fn void QAbstractSeries::nameChanged()
+ This signal is emitted when the series name changes.
+*/
+/*!
+ \qmlsignal AbstractSeries::onNameChanged()
+ This signal is emitted when the series name changes.
+*/
+
+/*!
+ \property QAbstractSeries::visible
+ \brief whether the series is visible or not; true by default.
+*/
+/*!
+ \qmlproperty bool AbstractSeries::visible
+ Visibility of the series. True by default.
+*/
+
+/*!
+ \fn void QAbstractSeries::visibleChanged()
+ Emitted when the series visibility changes.
+*/
+/*!
+ \qmlsignal AbstractSeries::onVisibleChanged()
+ Emitted when the series visibility changes.
+*/
+
+/*!
+ \property QAbstractSeries::opacity
+ \brief The opacity of the series.
+
+ By default the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque).
+*/
+/*!
+ \qmlproperty real AbstractSeries::opacity
+ The opacity of the series. By default the opacity is 1.0.
+ The valid values range from 0.0 (transparent) to 1.0 (opaque).
+*/
+
+/*!
+ \fn void QAbstractSeries::opacityChanged()
+ Emitted when the opacity of the series changes.
+*/
+/*!
+ \qmlsignal AbstractSeries::onOpacityChanged()
+ Emitted when the opacity of the series changes.
+*/
+
+/*!
+ \internal
+ \brief Constructs QAbstractSeries object with \a parent.
+*/
+QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) :
+ QObject(parent),
+ d_ptr(&d)
+{
+}
+
+/*!
+ \brief Virtual destructor for the chart series.
+*/
+QAbstractSeries::~QAbstractSeries()
+{
+ if (d_ptr->m_chart)
+ qFatal("Series still bound to a chart when destroyed!");
+}
+
+void QAbstractSeries::setName(const QString &name)
+{
+ if (name != d_ptr->m_name) {
+ d_ptr->m_name = name;
+ emit nameChanged();
+ }
+}
+
+QString QAbstractSeries::name() const
+{
+ return d_ptr->m_name;
+}
+
+void QAbstractSeries::setVisible(bool visible)
+{
+ if (visible != d_ptr->m_visible) {
+ d_ptr->m_visible = visible;
+ emit visibleChanged();
+ }
+}
+
+bool QAbstractSeries::isVisible() const
+{
+ return d_ptr->m_visible;
+}
+
+qreal QAbstractSeries::opacity() const
+{
+ return d_ptr->m_opacity;
+}
+
+void QAbstractSeries::setOpacity(qreal opacity)
+{
+ if (opacity != d_ptr->m_opacity) {
+ d_ptr->m_opacity = opacity;
+ emit opacityChanged();
+ }
+}
+
+/*!
+ \brief Returns the chart where series belongs to.
+
+ Set automatically when the series is added to the chart
+ and unset when the series is removed from the chart.
+*/
+QChart *QAbstractSeries::chart() const
+{
+ return d_ptr->m_chart;
+}
+
+/*!
+ \brief Sets the visibility of the series to true.
+
+ \sa setVisible(), isVisible()
+*/
+void QAbstractSeries::show()
+{
+ setVisible(true);
+}
+
+/*!
+ \brief Sets the visibility of the series to false.
+
+ \sa setVisible(), isVisible()
+*/
+void QAbstractSeries::hide()
+{
+ setVisible(false);
+}
+
+/*!
+ Attach \a axis to the series.
+ \return true if the axis was attached successfully, false otherwise.
+ \note If multiple axes of same orientation are attached to same series,
+ they will have same min/max ranges.
+ \sa QChart::addAxis(), QChart::createDefaultAxes()
+ */
+bool QAbstractSeries::attachAxis(QAbstractAxis* axis)
+{
+ if(d_ptr->m_chart) {
+ return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this, axis);
+ } else {
+ qWarning()<<"Series not in the chart. Please addSeries to chart first.";
+ return false;
+ }
+}
+
+/*!
+ Detach \a axis from the series.
+ \return true if the axis was detached successfully, false otherwise.
+ \sa QChart::removeAxis()
+ */
+bool QAbstractSeries::detachAxis(QAbstractAxis* axis)
+{
+ if(d_ptr->m_chart) {
+ return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this, axis);
+ }
+ else {
+ qWarning()<<"Series not in the chart. Please addSeries to chart first.";
+ return false;
+ }
+}
+
+/*!
+ Returns the list of axes attached to the series. Usually there is an x-axis and a y-axis attached to a series, except
+ in case of a QPieSeries, which does not have any axes attached.
+ \sa attachAxis(), detachAxis()
+ */
+QList<QAbstractAxis*> QAbstractSeries::attachedAxes()
+{
+ return d_ptr->m_axes;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q)
+ : q_ptr(q),
+ m_chart(0),
+ m_item(0),
+ m_domain(new XYDomain()),
+ m_visible(true),
+ m_opacity(1.0)
+{
+}
+
+QAbstractSeriesPrivate::~QAbstractSeriesPrivate()
+{
+}
+
+void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain)
+{
+ Q_ASSERT(domain);
+ if(m_domain.data()!=domain) {
+ if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated()));
+ m_domain.reset(domain);
+ if(!m_item.isNull()) {
+ QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
+ m_item->handleDomainUpdated();
+ }
+ }
+}
+
+void QAbstractSeriesPrivate::setPresenter(ChartPresenter *presenter)
+{
+ m_presenter = presenter;
+}
+
+ChartPresenter *QAbstractSeriesPrivate::presenter() const
+{
+ return m_presenter;
+}
+
+void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_ASSERT(!m_item.isNull());
+ Q_UNUSED(parent);
+ QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
+}
+
+void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
+{
+ Q_UNUSED(options);
+}
+
+#include "moc_qabstractseries.cpp"
+#include "moc_qabstractseries_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
+
+
diff --git a/src/charts/qabstractseries.h b/src/charts/qabstractseries.h
new file mode 100644
index 00000000..43e726ac
--- /dev/null
+++ b/src/charts/qabstractseries.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QABSTRACTSERIES_H
+#define QABSTRACTSERIES_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/qabstractaxis.h>
+#include <QObject>
+#include <QPen>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractSeriesPrivate;
+class QChart;
+
+class QT_CHARTS_EXPORT QAbstractSeries : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
+ Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
+ Q_PROPERTY(SeriesType type READ type)
+ Q_ENUMS(SeriesType)
+
+public:
+ enum SeriesType {
+ SeriesTypeLine,
+ SeriesTypeArea,
+ SeriesTypeBar,
+ SeriesTypeStackedBar,
+ SeriesTypePercentBar,
+ SeriesTypePie,
+ SeriesTypeScatter,
+ SeriesTypeSpline,
+ SeriesTypeHorizontalBar,
+ SeriesTypeHorizontalStackedBar,
+ SeriesTypeHorizontalPercentBar,
+ SeriesTypeBoxPlot
+ };
+
+protected:
+ QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent = 0);
+
+public:
+ ~QAbstractSeries();
+ virtual SeriesType type() const = 0;
+
+ void setName(const QString &name);
+ QString name() const;
+ void setVisible(bool visible = true);
+ bool isVisible() const;
+ qreal opacity() const;
+ void setOpacity(qreal opacity);
+
+ QChart *chart() const;
+
+ bool attachAxis(QAbstractAxis *axis);
+ bool detachAxis(QAbstractAxis *axis);
+ QList<QAbstractAxis*> attachedAxes();
+
+ void show();
+ void hide();
+
+Q_SIGNALS:
+ void nameChanged();
+ void visibleChanged();
+ void opacityChanged();
+
+protected:
+ QScopedPointer<QAbstractSeriesPrivate> d_ptr;
+ friend class ChartDataSet;
+ friend class ChartPresenter;
+ friend class ChartThemeManager;
+ friend class QLegendPrivate;
+ friend class DeclarativeChart;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QABSTRACTSERIES_H
diff --git a/src/charts/qabstractseries_p.h b/src/charts/qabstractseries_p.h
new file mode 100644
index 00000000..3668829d
--- /dev/null
+++ b/src/charts/qabstractseries_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QABSTRACTSERIES_P_H
+#define QABSTRACTSERIES_P_H
+
+#include "qabstractseries.h"
+#include "qchart.h"
+#include "abstractdomain_p.h"
+
+class QGraphicsItem;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartPresenter;
+class ChartElement;
+class LegendMarker;
+class QLegend;
+class ChartDataSet;
+class QAbstractAxis;
+class QLegendMarker;
+class ChartTheme;
+class ChartAnimation;
+class ChartItem;
+class BoxPlotChartItem;
+
+class QAbstractSeriesPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QAbstractSeriesPrivate(QAbstractSeries *q);
+ ~QAbstractSeriesPrivate();
+
+ virtual void initializeDomain() = 0;
+ virtual void initializeAxes() = 0;
+ virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0;
+ virtual void initializeGraphics(QGraphicsItem* parent) = 0;
+ virtual void initializeAnimations(QChart::AnimationOptions options) = 0;
+
+ virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0;
+
+ virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0;
+ virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0;
+
+ ChartItem* chartItem() { return m_item.data(); }
+
+ virtual void setDomain(AbstractDomain* domain);
+ AbstractDomain* domain() { return m_domain.data(); }
+
+ virtual void setPresenter(ChartPresenter *presenter);
+ ChartPresenter *presenter() const;
+
+ QChart* chart() { return m_chart; }
+
+Q_SIGNALS:
+ void countChanged();
+
+protected:
+ QAbstractSeries *q_ptr;
+ QChart *m_chart;
+ QScopedPointer<ChartItem> m_item;
+ QList<QAbstractAxis*> m_axes;
+private:
+ QScopedPointer<AbstractDomain> m_domain;
+ QString m_name;
+ bool m_visible;
+ qreal m_opacity;
+ ChartPresenter *m_presenter;
+
+ friend class QAbstractSeries;
+ friend class ChartDataSet;
+ friend class ChartPresenter;
+ friend class QLegendPrivate;
+ friend class BoxPlotChartItem;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/qchart.cpp b/src/charts/qchart.cpp
new file mode 100644
index 00000000..9f26ffee
--- /dev/null
+++ b/src/charts/qchart.cpp
@@ -0,0 +1,872 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qchart.h"
+#include "qchart_p.h"
+#include "legendscroller_p.h"
+#include "qlegend_p.h"
+#include "chartbackground_p.h"
+#include "qabstractaxis.h"
+#include "abstractchartlayout_p.h"
+#include "charttheme_p.h"
+#include "chartpresenter_p.h"
+#include "chartdataset_p.h"
+#include <QGraphicsScene>
+#include <QGraphicsSceneResizeEvent>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \enum QChart::ChartTheme
+
+ This enum describes the theme used by the chart.
+
+ \value ChartThemeLight The default theme
+ \value ChartThemeBlueCerulean
+ \value ChartThemeDark
+ \value ChartThemeBrownSand
+ \value ChartThemeBlueNcs
+ \value ChartThemeHighContrast
+ \value ChartThemeBlueIcy
+ \value ChartThemeQt
+ */
+
+/*!
+ \enum QChart::AnimationOption
+
+ For enabling/disabling animations. Defaults to NoAnimation.
+
+ \value NoAnimation
+ \value GridAxisAnimations
+ \value SeriesAnimations
+ \value AllAnimations
+ */
+
+/*!
+ \enum QChart::ChartType
+
+ This enum describes the chart type.
+
+ \value ChartTypeUndefined
+ \value ChartTypeCartesian
+ \value ChartTypePolar
+ */
+
+/*!
+ \class QChart
+ \inmodule Qt Charts
+ \brief Main chart API for Qt Charts.
+
+ QChart is a QGraphicsWidget that you can show in a QGraphicsScene. It manages the graphical
+ representation of different types of series and other chart related objects like legend and
+ axes. If you simply want to show a chart in a layout, you can use the
+ convenience class QChartView instead of QChart.
+ \sa QChartView, QPolarChart
+ */
+
+/*!
+ \property QChart::animationOptions
+ The animation \a options for the chart. Animations are enabled/disabled based on this setting.
+ */
+
+/*!
+ \property QChart::backgroundVisible
+ Specifies whether the chart background is visible or not.
+ \sa setBackgroundBrush(), setBackgroundPen(), plotAreaBackgroundVisible
+ */
+
+/*!
+ \property QChart::dropShadowEnabled
+ If set to true, the background drop shadow effect is enabled. If set to false, it is disabled. Note that the drop
+ shadow effect depends on theme, which means the setting may be changed if you switch to another theme.
+ */
+
+/*!
+ \property QChart::backgroundRoundness
+ The diameter of the rounding cirle at the corners of the chart background.
+ */
+
+/*!
+ \property QChart::minimumMargins
+ Minimum margins between the plot area (axes) and the edge of the chart widget.
+ This property is deprecated; use margins property instead.
+
+ \sa margins
+ */
+
+/*!
+ \property QChart::margins
+ Margins between the plot area (axes) and the edge of the chart widget.
+ */
+
+/*!
+ \property QChart::theme
+ Theme is a built-in collection of UI style related settings applied for all visual elements of a chart, like colors,
+ pens, brushes, and fonts of series, axes, title, and legend. \l {Chart themes example} shows an example with a few
+ different themes.
+ \note Changing the theme will overwrite all customizations previously applied to the series.
+ */
+
+/*!
+ \property QChart::title
+ Title is the name (label) of a chart. It is shown as a headline on top of the chart. Chart title supports html formatting.
+ */
+
+/*!
+ \property QChart::chartType
+ Chart type indicates if the chart is a cartesian chart or a polar chart.
+ This property is set internally and it is read only.
+ \sa QPolarChart
+ */
+
+/*!
+ \property QChart::plotAreaBackgroundVisible
+ Specifies whether the chart plot area background is visible or not.
+ \note By default the plot area background is not visible and the plot area uses
+ the general chart background.
+ \sa setPlotAreaBackgroundBrush(), setPlotAreaBackgroundPen(), backgroundVisible
+ */
+
+/*!
+ \property QChart::localizeNumbers
+ \since QtCharts 2.0
+ When \c{true}, all generated numbers appearing in various series and axis labels will be
+ localized using the QLocale set with the locale property.
+ When \c{false}, the "C" locale is always used.
+ Defaults to \c{false}.
+ \note This property doesn't affect QDateTimeAxis labels, which always use the QLocale set with
+ the locale property.
+
+ \sa locale
+*/
+
+/*!
+ \property QChart::locale
+ \since QtCharts 2.0
+ Sets the locale used to format various chart labels when localizeNumbers is \c{true}.
+ This also determines the locale used to format QDateTimeAxis labels regardless of
+ localizeNumbers property.
+ Defaults to application default locale at the time the chart is constructed.
+
+ \sa localizeNumbers
+*/
+
+/*!
+ \internal
+ Constructs a chart object of \a type which is a child of a \a parent.
+ Parameter \a wFlags is passed to the QGraphicsWidget constructor.
+ This constructor is called only by subclasses.
+*/
+QChart::QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags)
+ : QGraphicsWidget(parent, wFlags),
+ d_ptr(new QChartPrivate(this, type))
+{
+ d_ptr->init();
+}
+
+/*!
+ Constructs a chart object which is a child of a \a parent.
+ Parameter \a wFlags is passed to the QGraphicsWidget constructor.
+ */
+QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
+ : QGraphicsWidget(parent, wFlags),
+ d_ptr(new QChartPrivate(this, ChartTypeCartesian))
+{
+ d_ptr->init();
+}
+
+/*!
+ Destroys the chart object and its children, like series and axis objects added to it.
+ */
+QChart::~QChart()
+{
+ //start by deleting dataset, it will remove all series and axes
+ delete d_ptr->m_dataset;
+ d_ptr->m_dataset = 0;
+}
+
+/*!
+ Adds the \a series onto the chart and takes the ownership of it.
+
+ \note A newly added series is attached to no axes by default, including any axes that were created for the chart
+ using createDefaultAxes() before the series was added to the chart. If no axes are attached to
+ the newly added series before the chart is shown, the series will get drawn as if it had axes with ranges
+ that exactly fit the series to the plot area of the chart. This can be confusing if the same chart also displays other
+ series that have properly attached axes, so always make sure you either call createDefaultAxes() after
+ a series has been added or explicitly attach axes for the series.
+
+ \sa removeSeries(), removeAllSeries(), createDefaultAxes(), QAbstractSeries::attachAxis()
+ */
+void QChart::addSeries(QAbstractSeries *series)
+{
+ Q_ASSERT(series);
+ d_ptr->m_dataset->addSeries(series);
+}
+
+/*!
+ Removes the \a series from the chart.
+ The chart releases its ownership of the specified \a series object.
+
+ \sa addSeries(), removeAllSeries()
+ */
+void QChart::removeSeries(QAbstractSeries *series)
+{
+ Q_ASSERT(series);
+ d_ptr->m_dataset->removeSeries(series);
+}
+
+/*!
+ Removes and deletes all series objects that have been added to the chart.
+
+ \sa addSeries(), removeSeries()
+ */
+void QChart::removeAllSeries()
+{
+ foreach (QAbstractSeries *s , d_ptr->m_dataset->series()){
+ removeSeries(s);
+ delete s;
+ }
+}
+
+/*!
+ Sets the \a brush that is used for painting the background of the chart area.
+ */
+void QChart::setBackgroundBrush(const QBrush &brush)
+{
+ d_ptr->m_presenter->setBackgroundBrush(brush);
+}
+
+/*!
+ Gets the brush that is used for painting the background of the chart area.
+ */
+QBrush QChart::backgroundBrush() const
+{
+ return d_ptr->m_presenter->backgroundBrush();
+}
+
+/*!
+ Sets the \a pen that is used for painting the background of the chart area.
+ */
+void QChart::setBackgroundPen(const QPen &pen)
+{
+ d_ptr->m_presenter->setBackgroundPen(pen);
+}
+
+/*!
+ Gets the pen that is used for painting the background of the chart area.
+ */
+QPen QChart::backgroundPen() const
+{
+ return d_ptr->m_presenter->backgroundPen();
+}
+
+void QChart::setTitle(const QString &title)
+{
+ d_ptr->m_presenter->setTitle(title);
+}
+
+QString QChart::title() const
+{
+ return d_ptr->m_presenter->title();
+}
+
+/*!
+ Sets the \a font that is used for drawing the chart title.
+ */
+void QChart::setTitleFont(const QFont &font)
+{
+ d_ptr->m_presenter->setTitleFont(font);
+}
+
+/*!
+ Gets the font that is used for drawing the chart title.
+ */
+QFont QChart::titleFont() const
+{
+ return d_ptr->m_presenter->titleFont();
+}
+
+/*!
+ Sets the \a brush used for drawing the title text.
+ */
+void QChart::setTitleBrush(const QBrush &brush)
+{
+ d_ptr->m_presenter->setTitleBrush(brush);
+}
+
+/*!
+ Returns the brush used for drawing the title text.
+ */
+QBrush QChart::titleBrush() const
+{
+ return d_ptr->m_presenter->titleBrush();
+}
+
+void QChart::setTheme(QChart::ChartTheme theme)
+{
+ d_ptr->m_themeManager->setTheme(theme);
+}
+
+QChart::ChartTheme QChart::theme() const
+{
+ return d_ptr->m_themeManager->theme()->id();
+}
+
+/*!
+ Zooms in the view by a factor of two.
+ */
+void QChart::zoomIn()
+{
+ d_ptr->zoomIn(2.0);
+}
+
+/*!
+ Zooms in the view to a maximum level at which \a rect is still fully visible.
+ \note This is not supported for polar charts.
+ */
+void QChart::zoomIn(const QRectF &rect)
+{
+ if (d_ptr->m_type == QChart::ChartTypePolar)
+ return;
+ d_ptr->zoomIn(rect);
+}
+
+/*!
+ Zooms out the view by a factor of two.
+ */
+void QChart::zoomOut()
+{
+ d_ptr->zoomOut(2.0);
+}
+
+/*!
+ Zooms in the view by a custom \a factor.
+
+ A factor over 1.0 zooms the view in and factor between 0.0 and 1.0 zooms out.
+ */
+void QChart::zoom(qreal factor)
+{
+ if (qFuzzyCompare(factor, 0))
+ return;
+
+ if (qFuzzyCompare(factor, (qreal)1.0))
+ return;
+
+ if (factor < 0)
+ return;
+
+ if (factor > 1.0)
+ d_ptr->zoomIn(factor);
+ else
+ d_ptr->zoomOut(1.0 / factor);
+}
+
+
+/*!
+ Resets the series domains to what they were before any zoom method was called.
+ Note that this will also reset any scrolls and explicit axis range settings done between
+ the first zoom operation and calling this method. If no zoom operation has been
+ done, this method does nothing.
+ */
+void QChart::zoomReset()
+{
+ d_ptr->zoomReset();
+}
+
+/*!
+ Returns true if any series has a zoomed domain.
+ */
+bool QChart::isZoomed()
+{
+ return d_ptr->isZoomed();
+}
+
+/*!
+ Returns a pointer to the horizontal axis attached to the specified \a series.
+ If no \a series is specified, the first horizontal axis added to the chart is returned.
+
+ \sa addAxis(), QAbstractSeries::attachAxis()
+ */
+QAbstractAxis *QChart::axisX(QAbstractSeries *series) const
+{
+ QList<QAbstractAxis *> axisList = axes(Qt::Horizontal, series);
+ if (axisList.count())
+ return axisList[0];
+ return 0;
+}
+
+/*!
+ Returns a pointer to the vertical axis attached to the specified \a series.
+ If no \a series is specified, the first vertical axis added to the chart is returned.
+
+ \sa addAxis(), QAbstractSeries::attachAxis()
+ */
+QAbstractAxis *QChart::axisY(QAbstractSeries *series) const
+{
+ QList<QAbstractAxis *> axisList = axes(Qt::Vertical, series);
+ if (axisList.count())
+ return axisList[0];
+ return 0;
+}
+
+/*!
+ Returns the axes attached to the \a series with \a orientation. If no \a series is provided,
+ then all axes added to the chart with the specified orientation are returned.
+ \sa addAxis(), createDefaultAxes()
+ */
+QList<QAbstractAxis *> QChart::axes(Qt::Orientations orientation, QAbstractSeries *series) const
+{
+ QList<QAbstractAxis *> result ;
+
+ if (series) {
+ foreach (QAbstractAxis *axis, series->attachedAxes()){
+ if (orientation.testFlag(axis->orientation()))
+ result << axis;
+ }
+ } else {
+ foreach (QAbstractAxis *axis, d_ptr->m_dataset->axes()){
+ if (orientation.testFlag(axis->orientation()) && !result.contains(axis))
+ result << axis;
+ }
+ }
+
+ return result;
+}
+
+/*!
+ Creates axes for the chart based on the series that have already been added to the chart. Any axes previously added to
+ the chart will be deleted.
+
+ \note This function has to be called after all series have been added to the chart. The axes created by this function
+ will NOT get automatically attached to any series added to the chart after this function has been called.
+ A series with no axes attached will by default scale to utilize the entire plot area of the chart, which can be confusing
+ if there are other series with properly attached axes also present.
+
+ \table
+ \header
+ \li Series type
+ \li X-axis
+ \li Y-axis
+ \row
+ \li QXYSeries
+ \li QValueAxis
+ \li QValueAxis
+ \row
+ \li QBarSeries
+ \li QBarCategoryAxis
+ \li QValueAxis
+ \row
+ \li QPieSeries
+ \li None
+ \li None
+ \endtable
+
+ If there are several QXYSeries derived series added to the chart and no series of other types have been added, then only one pair of axes is created.
+ If there are several series of different types added to the chart, then each series gets its own axes pair.
+
+ The axes specific to the series can be later obtained from the chart by providing the series as the parameter for axes() function call.
+ QPieSeries does not create any axes.
+
+ \sa axisX(), axisY(), axes(), setAxisX(), setAxisY(), QAbstractSeries::attachAxis()
+ */
+void QChart::createDefaultAxes()
+{
+ d_ptr->m_dataset->createDefaultAxes();
+}
+
+/*!
+ Returns the legend object of the chart. Ownership stays with the chart.
+ */
+QLegend *QChart::legend() const
+{
+ return d_ptr->m_legend;
+}
+
+void QChart::setMinimumMargins(const QMargins &margins)
+{
+ qWarning() << "QChart::setMinimumMargins is deprecated. Use QChart::setMargins instead.";
+ d_ptr->m_presenter->layout()->setMargins(margins);
+}
+
+QMargins QChart::minimumMargins() const
+{
+ qWarning() << "QChart::minimumMargins is deprecated. Use QChart::margins instead.";
+ return d_ptr->m_presenter->layout()->margins();
+}
+
+void QChart::setMargins(const QMargins &margins)
+{
+ d_ptr->m_presenter->layout()->setMargins(margins);
+}
+
+QMargins QChart::margins() const
+{
+ return d_ptr->m_presenter->layout()->margins();
+}
+
+QChart::ChartType QChart::chartType() const
+{
+ return d_ptr->m_type;
+}
+
+/*!
+ Returns the the rectangle within which the drawing of the chart is done.
+ It does not include the area defined by margins.
+ */
+QRectF QChart::plotArea() const
+{
+ return d_ptr->m_presenter->geometry();
+}
+
+/*!
+ Sets the \a brush for the background of the plot area of the chart.
+
+ \sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundPen(), plotAreaBackgroundBrush()
+ */
+void QChart::setPlotAreaBackgroundBrush(const QBrush &brush)
+{
+ d_ptr->m_presenter->setPlotAreaBackgroundBrush(brush);
+}
+
+/*!
+ Returns the brush for the background of the plot area of the chart.
+
+ \sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundPen(), setPlotAreaBackgroundBrush()
+ */
+QBrush QChart::plotAreaBackgroundBrush() const
+{
+ return d_ptr->m_presenter->plotAreaBackgroundBrush();
+}
+
+/*!
+ Sets the \a pen for the background of the plot area of the chart.
+
+ \sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundBrush(), plotAreaBackgroundPen()
+ */
+void QChart::setPlotAreaBackgroundPen(const QPen &pen)
+{
+ d_ptr->m_presenter->setPlotAreaBackgroundPen(pen);
+}
+
+/*!
+ Returns the pen for the background of the plot area of the chart.
+
+ \sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundBrush(), setPlotAreaBackgroundPen()
+ */
+QPen QChart::plotAreaBackgroundPen() const
+{
+ return d_ptr->m_presenter->plotAreaBackgroundPen();
+}
+
+void QChart::setPlotAreaBackgroundVisible(bool visible)
+{
+ d_ptr->m_presenter->setPlotAreaBackgroundVisible(visible);
+}
+
+bool QChart::isPlotAreaBackgroundVisible() const
+{
+ return d_ptr->m_presenter->isPlotAreaBackgroundVisible();
+}
+
+void QChart::setLocalizeNumbers(bool localize)
+{
+ d_ptr->m_presenter->setLocalizeNumbers(localize);
+}
+
+bool QChart::localizeNumbers() const
+{
+ return d_ptr->m_presenter->localizeNumbers();
+}
+
+void QChart::setLocale(const QLocale &locale)
+{
+ d_ptr->m_presenter->setLocale(locale);
+}
+
+QLocale QChart::locale() const
+{
+ return d_ptr->m_presenter->locale();
+}
+
+void QChart::setAnimationOptions(AnimationOptions options)
+{
+ d_ptr->m_presenter->setAnimationOptions(options);
+}
+
+QChart::AnimationOptions QChart::animationOptions() const
+{
+ return d_ptr->m_presenter->animationOptions();
+}
+
+/*!
+ Scrolls the visible area of the chart by the distance defined in the \a dx and \a dy.
+
+ For polar charts, \a dx indicates the angle along angular axis instead of distance.
+ */
+void QChart::scroll(qreal dx, qreal dy)
+{
+ d_ptr->scroll(dx,dy);
+}
+
+void QChart::setBackgroundVisible(bool visible)
+{
+ d_ptr->m_presenter->setBackgroundVisible(visible);
+}
+
+bool QChart::isBackgroundVisible() const
+{
+ return d_ptr->m_presenter->isBackgroundVisible();
+}
+
+void QChart::setDropShadowEnabled(bool enabled)
+{
+ d_ptr->m_presenter->setBackgroundDropShadowEnabled(enabled);
+}
+
+bool QChart::isDropShadowEnabled() const
+{
+ return d_ptr->m_presenter->isBackgroundDropShadowEnabled();
+}
+
+void QChart::setBackgroundRoundness(qreal diameter)
+{
+ d_ptr->m_presenter->setBackgroundRoundness(diameter);
+}
+
+qreal QChart::backgroundRoundness() const
+{
+ return d_ptr->m_presenter->backgroundRoundness();
+}
+
+/*!
+ Returns all series that are added to the chart.
+
+ \sa addSeries(), removeSeries(), removeAllSeries()
+*/
+QList<QAbstractSeries *> QChart::series() const
+{
+ return d_ptr->m_dataset->series();
+}
+
+/*!
+ Adds the \a axis to the chart and attaches it to the \a series as a bottom-aligned horizontal axis.
+ The chart takes ownership of both the \a axis and the \a series.
+ Any horizontal axes previously attached to the \a series are deleted.
+
+ \sa axisX(), axisY(), setAxisY(), createDefaultAxes(), QAbstractSeries::attachAxis()
+*/
+void QChart::setAxisX(QAbstractAxis *axis ,QAbstractSeries *series)
+{
+ QList<QAbstractAxis*> list = axes(Qt::Horizontal, series);
+
+ foreach (QAbstractAxis* a, list) {
+ d_ptr->m_dataset->removeAxis(a);
+ delete a;
+ }
+
+ if (!d_ptr->m_dataset->axes().contains(axis))
+ d_ptr->m_dataset->addAxis(axis, Qt::AlignBottom);
+ d_ptr->m_dataset->attachAxis(series, axis);
+}
+
+/*!
+ Adds the \a axis to the chart and attaches it to the \a series as a left-aligned vertical axis.
+ The chart takes ownership of both the \a axis and the \a series.
+ Any vertical axes previously attached to the \a series are deleted.
+
+ \sa axisX(), axisY(), setAxisX(), createDefaultAxes(), QAbstractSeries::attachAxis()
+*/
+void QChart::setAxisY(QAbstractAxis *axis ,QAbstractSeries *series)
+{
+ QList<QAbstractAxis*> list = axes(Qt::Vertical, series);
+
+ foreach (QAbstractAxis* a, list) {
+ d_ptr->m_dataset->removeAxis(a);
+ delete a;
+ }
+
+ if (!d_ptr->m_dataset->axes().contains(axis))
+ d_ptr->m_dataset->addAxis(axis, Qt::AlignLeft);
+ d_ptr->m_dataset->attachAxis(series, axis);
+}
+
+/*!
+ Adds the \a axis to the chart with \a alignment. The chart takes the ownership of the axis.
+
+ \sa removeAxis(), createDefaultAxes(), QAbstractSeries::attachAxis()
+*/
+void QChart::addAxis(QAbstractAxis *axis, Qt::Alignment alignment)
+{
+ d_ptr->m_dataset->addAxis(axis, alignment);
+}
+
+/*!
+ Removes the \a axis from the chart.
+ The chart releases its ownership of the specified \a axis object.
+
+ \sa addAxis(), createDefaultAxes(), QAbstractSeries::detachAxis()
+*/
+void QChart::removeAxis(QAbstractAxis *axis)
+{
+ d_ptr->m_dataset->removeAxis(axis);
+}
+
+/*!
+ Returns the value in the \a series domain that corresponds to the \a position relative to chart widget.
+*/
+QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series)
+{
+ return d_ptr->m_dataset->mapToValue(position, series);
+}
+
+/*!
+ Returns the position on the chart widget that corresponds to the \a value in the \a series domain.
+*/
+QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series)
+{
+ return d_ptr->m_dataset->mapToPosition(value, series);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QChartPrivate::QChartPrivate(QChart *q, QChart::ChartType type):
+ q_ptr(q),
+ m_legend(0),
+ m_dataset(new ChartDataSet(q)),
+ m_presenter(new ChartPresenter(q, type)),
+ m_themeManager(new ChartThemeManager(q)),
+ m_type(type)
+{
+ QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_presenter, SLOT(handleSeriesAdded(QAbstractSeries*)));
+ QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_presenter, SLOT(handleSeriesRemoved(QAbstractSeries*)));
+ QObject::connect(m_dataset, SIGNAL(axisAdded(QAbstractAxis*)), m_presenter, SLOT(handleAxisAdded(QAbstractAxis*)));
+ QObject::connect(m_dataset, SIGNAL(axisRemoved(QAbstractAxis*)), m_presenter, SLOT(handleAxisRemoved(QAbstractAxis*)));
+ QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_themeManager, SLOT(handleSeriesAdded(QAbstractSeries*)));
+ QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_themeManager, SLOT(handleSeriesRemoved(QAbstractSeries*)));
+ QObject::connect(m_dataset, SIGNAL(axisAdded(QAbstractAxis*)), m_themeManager, SLOT(handleAxisAdded(QAbstractAxis*)));
+ QObject::connect(m_dataset, SIGNAL(axisRemoved(QAbstractAxis*)), m_themeManager, SLOT(handleAxisRemoved(QAbstractAxis*)));
+}
+
+QChartPrivate::~QChartPrivate()
+{
+}
+
+// Hackish solution to the problem of explicitly assigning the default pen/brush/font
+// to a series or axis and having theme override it:
+// Initialize pens, brushes, and fonts to something nobody is likely to ever use,
+// so that default theme initialization will always set these properly.
+QPen &QChartPrivate::defaultPen()
+{
+ static QPen defaultPen(QColor(1, 2, 0), 0.93247536);
+ return defaultPen;
+}
+
+QBrush &QChartPrivate::defaultBrush()
+{
+ static QBrush defaultBrush(QColor(1, 2, 0), Qt::Dense7Pattern);
+ return defaultBrush;
+}
+
+QFont &QChartPrivate::defaultFont()
+{
+ static bool defaultFontInitialized(false);
+ static QFont defaultFont;
+ if (!defaultFontInitialized) {
+ defaultFont.setPointSizeF(8.34563465);
+ defaultFontInitialized = true;
+ }
+ return defaultFont;
+}
+
+void QChartPrivate::init()
+{
+ m_legend = new LegendScroller(q_ptr);
+ q_ptr->setTheme(QChart::ChartThemeLight);
+ q_ptr->setLayout(m_presenter->layout());
+}
+
+void QChartPrivate::zoomIn(qreal factor)
+{
+ QRectF rect = m_presenter->geometry();
+ rect.setWidth(rect.width() / factor);
+ rect.setHeight(rect.height() / factor);
+ rect.moveCenter(m_presenter->geometry().center());
+ zoomIn(rect);
+}
+
+void QChartPrivate::zoomIn(const QRectF &rect)
+{
+ if (!rect.isValid())
+ return;
+
+ QRectF r = rect.normalized();
+ const QRectF geometry = m_presenter->geometry();
+ r.translate(-geometry.topLeft());
+
+ if (!r.isValid())
+ return;
+
+ QPointF zoomPoint(r.center().x() / geometry.width(), r.center().y() / geometry.height());
+ m_presenter->setState(ChartPresenter::ZoomInState,zoomPoint);
+ m_dataset->zoomInDomain(r);
+ m_presenter->setState(ChartPresenter::ShowState,QPointF());
+
+}
+
+void QChartPrivate::zoomReset()
+{
+ m_dataset->zoomResetDomain();
+}
+
+bool QChartPrivate::isZoomed()
+{
+ return m_dataset->isZoomedDomain();
+}
+
+void QChartPrivate::zoomOut(qreal factor)
+{
+ const QRectF geometry = m_presenter->geometry();
+
+ QRectF r;
+ r.setSize(geometry.size() / factor);
+ r.moveCenter(QPointF(geometry.size().width()/2 ,geometry.size().height()/2));
+ if (!r.isValid())
+ return;
+
+ QPointF zoomPoint(r.center().x() / geometry.width(), r.center().y() / geometry.height());
+ m_presenter->setState(ChartPresenter::ZoomOutState,zoomPoint);
+ m_dataset->zoomOutDomain(r);
+ m_presenter->setState(ChartPresenter::ShowState,QPointF());
+}
+
+void QChartPrivate::scroll(qreal dx, qreal dy)
+{
+ if (dx < 0) m_presenter->setState(ChartPresenter::ScrollLeftState,QPointF());
+ if (dx > 0) m_presenter->setState(ChartPresenter::ScrollRightState,QPointF());
+ if (dy < 0) m_presenter->setState(ChartPresenter::ScrollUpState,QPointF());
+ if (dy > 0) m_presenter->setState(ChartPresenter::ScrollDownState,QPointF());
+
+ m_dataset->scrollDomain(dx, dy);
+ m_presenter->setState(ChartPresenter::ShowState,QPointF());
+}
+
+#include "moc_qchart.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/qchart.h b/src/charts/qchart.h
new file mode 100644
index 00000000..9e8c869d
--- /dev/null
+++ b/src/charts/qchart.h
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCHART_H
+#define QCHART_H
+
+#include <QtCharts/QAbstractSeries>
+#include <QtCharts/QLegend>
+#include <QGraphicsWidget>
+#include <QMargins>
+
+class QGraphicsSceneResizeEvent;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractSeries;
+class QAbstractAxis;
+class QLegend;
+class QChartPrivate;
+class QBoxPlotSeries;
+
+class QT_CHARTS_EXPORT QChart : public QGraphicsWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme)
+ Q_PROPERTY(QString title READ title WRITE setTitle)
+ Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible)
+ Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled)
+ Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness)
+ Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions)
+ Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
+ Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
+ Q_PROPERTY(QChart::ChartType chartType READ chartType)
+ Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible)
+ Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale)
+ Q_ENUMS(ChartTheme)
+ Q_ENUMS(AnimationOption)
+ Q_ENUMS(ChartType)
+
+public:
+ enum ChartType {
+ ChartTypeUndefined = 0,
+ ChartTypeCartesian,
+ ChartTypePolar
+ };
+
+ enum ChartTheme {
+ ChartThemeLight = 0,
+ ChartThemeBlueCerulean,
+ ChartThemeDark,
+ ChartThemeBrownSand,
+ ChartThemeBlueNcs,
+ ChartThemeHighContrast,
+ ChartThemeBlueIcy,
+ ChartThemeQt
+ };
+
+ enum AnimationOption {
+ NoAnimation = 0x0,
+ GridAxisAnimations = 0x1,
+ SeriesAnimations = 0x2,
+ AllAnimations = 0x3
+ };
+
+ Q_DECLARE_FLAGS(AnimationOptions, AnimationOption)
+
+public:
+ explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
+ ~QChart();
+
+ void addSeries(QAbstractSeries *series);
+ void removeSeries(QAbstractSeries *series);
+ void removeAllSeries();
+ QList<QAbstractSeries *> series() const;
+
+ // *** deprecated ***
+ void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0);
+ void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0);
+ QAbstractAxis *axisX(QAbstractSeries *series = 0) const;
+ QAbstractAxis *axisY(QAbstractSeries *series = 0) const;
+ // ******************
+
+ void addAxis(QAbstractAxis *axis, Qt::Alignment alignment);
+ void removeAxis(QAbstractAxis *axis);
+ QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const;
+
+ void createDefaultAxes();
+
+ void setTheme(QChart::ChartTheme theme);
+ QChart::ChartTheme theme() const;
+
+ void setTitle(const QString &title);
+ QString title() const;
+ void setTitleFont(const QFont &font);
+ QFont titleFont() const;
+ void setTitleBrush(const QBrush &brush);
+ QBrush titleBrush() const;
+
+ void setBackgroundBrush(const QBrush &brush);
+ QBrush backgroundBrush() const;
+ void setBackgroundPen(const QPen &pen);
+ QPen backgroundPen() const;
+ void setBackgroundVisible(bool visible = true);
+ bool isBackgroundVisible() const;
+
+ void setDropShadowEnabled(bool enabled = true);
+ bool isDropShadowEnabled() const;
+ void setBackgroundRoundness(qreal diameter);
+ qreal backgroundRoundness() const;
+ void setAnimationOptions(AnimationOptions options);
+ AnimationOptions animationOptions() const;
+
+ void zoomIn();
+ void zoomOut();
+
+ void zoomIn(const QRectF &rect);
+ void zoom(qreal factor);
+ void zoomReset();
+ bool isZoomed();
+
+ void scroll(qreal dx, qreal dy);
+
+ QLegend *legend() const;
+
+ void setMinimumMargins(const QMargins& margins);
+ QMargins minimumMargins() const;
+
+ void setMargins(const QMargins &margins);
+ QMargins margins() const;
+
+ QRectF plotArea() const;
+ void setPlotAreaBackgroundBrush(const QBrush &brush);
+ QBrush plotAreaBackgroundBrush() const;
+ void setPlotAreaBackgroundPen(const QPen &pen);
+ QPen plotAreaBackgroundPen() const;
+ void setPlotAreaBackgroundVisible(bool visible = true);
+ bool isPlotAreaBackgroundVisible() const;
+ void setLocalizeNumbers(bool localize);
+ bool localizeNumbers() const;
+ void setLocale(const QLocale &locale);
+ QLocale locale() const;
+
+ QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0);
+ QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0);
+
+ ChartType chartType() const;
+
+protected:
+ explicit QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags);
+ QScopedPointer<QChartPrivate> d_ptr;
+ friend class QLegend;
+ friend class DeclarativeChart;
+ friend class ChartDataSet;
+ friend class ChartPresenter;
+ friend class ChartThemeManager;
+ friend class QAbstractSeries;
+ friend class QBoxPlotSeriesPrivate;
+ Q_DISABLE_COPY(QChart)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QT_CHARTS_NAMESPACE::QChart::AnimationOptions)
+
+#endif // QCHART_H
diff --git a/src/charts/qchart_p.h b/src/charts/qchart_p.h
new file mode 100644
index 00000000..e43ae07d
--- /dev/null
+++ b/src/charts/qchart_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QCHART_P_H
+#define QCHART_P_H
+
+#include "qchartglobal.h"
+#include "qchart.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeManager;
+class ChartPresenter;
+class QLegend;
+class ChartDataSet;
+
+class QChartPrivate
+{
+
+public:
+ QChartPrivate(QChart *q, QChart::ChartType type);
+ ~QChartPrivate();
+ QChart *q_ptr;
+ QLegend *m_legend;
+ ChartDataSet *m_dataset;
+ ChartPresenter *m_presenter;
+ ChartThemeManager *m_themeManager;
+ QChart::ChartType m_type;
+
+ static QPen &defaultPen();
+ static QBrush &defaultBrush();
+ static QFont &defaultFont();
+
+ void init();
+ void zoomIn(qreal factor);
+ void zoomOut(qreal factor);
+ void zoomIn(const QRectF &rect);
+ void zoomReset();
+ bool isZoomed();
+ void scroll(qreal dx, qreal dy);
+};
+
+QT_CHARTS_END_NAMESPACE
+#endif
diff --git a/src/charts/qchartglobal.h b/src/charts/qchartglobal.h
new file mode 100644
index 00000000..ade1942e
--- /dev/null
+++ b/src/charts/qchartglobal.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCHARTGLOBAL_H
+#define QCHARTGLOBAL_H
+
+#include <qglobal.h>
+
+#define QT_CHARTS_VERSION_STR "2.0.0"
+/*
+ QT_CHARTS_VERSION is (major << 16) + (minor << 8) + patch.
+*/
+#define QT_CHARTS_VERSION 0x020000
+/*
+ can be used like #if (QT_CHARTS_VERSION >= QT_CHARTS_VERSION_CHECK(1, 1, 0))
+*/
+#define QT_CHARTS_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
+
+#if defined(QT_CHARTS_LIBRARY)
+# define QT_CHARTS_EXPORT Q_DECL_EXPORT
+#else
+# define QT_CHARTS_EXPORT Q_DECL_IMPORT
+#endif
+
+#if defined(BUILD_PRIVATE_UNIT_TESTS) && defined(QT_CHARTS_LIBRARY)
+# define QT_CHARTS_AUTOTEST_EXPORT Q_DECL_EXPORT
+#elif defined(BUILD_PRIVATE_UNIT_TESTS) && !defined(QT_CHARTS_LIBRARY)
+# define QT_CHARTS_AUTOTEST_EXPORT Q_DECL_IMPORT
+#else
+# define QT_CHARTS_AUTOTEST_EXPORT
+#endif
+
+#ifdef QT_CHARTS_STATICLIB
+# undef QT_CHARTS_EXPORT
+# undef QT_CHARTS_AUTOTEST_EXPORT
+# define QT_CHARTS_EXPORT
+# define QT_CHARTS_AUTOTEST_EXPORT
+#endif
+
+#define QT_CHARTS_NAMESPACE QtCharts
+
+#ifdef QT_CHARTS_NAMESPACE
+# define QT_CHARTS_BEGIN_NAMESPACE namespace QT_CHARTS_NAMESPACE {
+# define QT_CHARTS_END_NAMESPACE }
+# define QT_CHARTS_USE_NAMESPACE using namespace QT_CHARTS_NAMESPACE;
+#else
+# define QT_CHARTS_BEGIN_NAMESPACE
+# define QT_CHARTS_END_NAMESPACE
+# define QT_CHARTS_USE_NAMESPACE
+#endif
+
+/*
+ On Windows min and max conflict with standard macros
+*/
+#ifdef Q_OS_WIN
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#endif
+
+#endif // QCHARTGLOBAL_H
diff --git a/src/charts/qchartview.cpp b/src/charts/qchartview.cpp
new file mode 100644
index 00000000..234ef080
--- /dev/null
+++ b/src/charts/qchartview.cpp
@@ -0,0 +1,317 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qchartview.h"
+#include "qchartview_p.h"
+#include "qchart_p.h"
+#include <QGraphicsScene>
+#include <QRubberBand>
+
+/*!
+ \enum QChartView::RubberBand
+
+ This enum describes the different types of rubber bands that can be used for zoom rect selection
+
+ \value NoRubberBand
+ \value VerticalRubberBand
+ \value HorizonalRubberBand
+ \value RectangleRubberBand
+*/
+
+/*!
+ \class QChartView
+ \inmodule Qt Charts
+ \brief Standalone charting widget.
+
+ QChartView is a standalone widget that can display charts. It does not require separate
+ QGraphicsScene to work. If you want to display a chart in your existing QGraphicsScene,
+ you need to use the QChart (or QPolarChart) class instead.
+
+ \sa QChart, QPolarChart
+*/
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ Constructs a chartView object with parent \a parent.
+*/
+
+QChartView::QChartView(QWidget *parent)
+ : QGraphicsView(parent),
+ d_ptr(new QChartViewPrivate(this))
+{
+
+}
+
+/*!
+ Constructs a chartview object with parent \a parent to display a \a chart.
+ Ownership of the \a chart is passed to chartview.
+*/
+
+QChartView::QChartView(QChart *chart, QWidget *parent)
+ : QGraphicsView(parent),
+ d_ptr(new QChartViewPrivate(this, chart))
+{
+
+}
+
+
+/*!
+ Destroys the chartview object and the associated chart.
+*/
+QChartView::~QChartView()
+{
+}
+
+/*!
+ Returns the pointer to the associated chart.
+*/
+QChart *QChartView::chart() const
+{
+ return d_ptr->m_chart;
+}
+
+/*!
+ Sets the current chart to \a chart. Ownership of the new chart is passed to chartview
+ and ownership of the previous chart is released.
+
+ To avoid memory leaks users need to make sure the previous chart is deleted.
+*/
+
+void QChartView::setChart(QChart *chart)
+{
+ d_ptr->setChart(chart);
+}
+
+/*!
+ Sets the rubber band flags to \a rubberBand.
+ Selected flags determine the way zooming is performed.
+
+ \note Rubber band zooming is not supported for polar charts.
+*/
+void QChartView::setRubberBand(const RubberBands &rubberBand)
+{
+#ifndef QT_NO_RUBBERBAND
+ d_ptr->m_rubberBandFlags = rubberBand;
+
+ if (!d_ptr->m_rubberBandFlags) {
+ delete d_ptr->m_rubberBand;
+ d_ptr->m_rubberBand = 0;
+ return;
+ }
+
+ if (!d_ptr->m_rubberBand) {
+ d_ptr->m_rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
+ d_ptr->m_rubberBand->setEnabled(true);
+ }
+#else
+ Q_UNUSED(rubberBand);
+ qWarning("Unable to set rubber band because Qt is configured without it.");
+#endif
+}
+
+/*!
+ Returns the rubber band flags that are currently being used by the widget.
+*/
+QChartView::RubberBands QChartView::rubberBand() const
+{
+ return d_ptr->m_rubberBandFlags;
+}
+
+/*!
+ If Left mouse button is pressed and the rubber band is enabled the \a event is accepted and the rubber band is displayed on the screen allowing the user to select the zoom area.
+ If different mouse button is pressed and/or the rubber band is disabled then the \a event is passed to QGraphicsView::mousePressEvent() implementation.
+*/
+void QChartView::mousePressEvent(QMouseEvent *event)
+{
+#ifndef QT_NO_RUBBERBAND
+ QRectF plotArea = d_ptr->m_chart->plotArea();
+ if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isEnabled()
+ && event->button() == Qt::LeftButton && plotArea.contains(event->pos())) {
+ d_ptr->m_rubberBandOrigin = event->pos();
+ d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin, QSize()));
+ d_ptr->m_rubberBand->show();
+ event->accept();
+ } else {
+#endif
+ QGraphicsView::mousePressEvent(event);
+#ifndef QT_NO_RUBBERBAND
+ }
+#endif
+}
+
+/*!
+ If the rubber band rectange has been displayed in pressEvent then \a event data is used to update the rubber band geometry.
+ Otherwise the default QGraphicsView::mouseMoveEvent implementation is called.
+*/
+void QChartView::mouseMoveEvent(QMouseEvent *event)
+{
+#ifndef QT_NO_RUBBERBAND
+ if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
+ QRect rect = d_ptr->m_chart->plotArea().toRect();
+ int width = event->pos().x() - d_ptr->m_rubberBandOrigin.x();
+ int height = event->pos().y() - d_ptr->m_rubberBandOrigin.y();
+ if (!d_ptr->m_rubberBandFlags.testFlag(VerticalRubberBand)) {
+ d_ptr->m_rubberBandOrigin.setY(rect.top());
+ height = rect.height();
+ }
+ if (!d_ptr->m_rubberBandFlags.testFlag(HorizonalRubberBand)) {
+ d_ptr->m_rubberBandOrigin.setX(rect.left());
+ width = rect.width();
+ }
+ d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin.x(), d_ptr->m_rubberBandOrigin.y(), width, height).normalized());
+ } else {
+#endif
+ QGraphicsView::mouseMoveEvent(event);
+#ifndef QT_NO_RUBBERBAND
+ }
+#endif
+}
+
+/*!
+ If left mouse button is released and the rubber band is enabled then \a event is accepted and
+ the view is zoomed into the rect specified by the rubber band.
+ If it is a right mouse button \a event then the view is zoomed out.
+*/
+void QChartView::mouseReleaseEvent(QMouseEvent *event)
+{
+#ifndef QT_NO_RUBBERBAND
+ if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
+ if (event->button() == Qt::LeftButton) {
+ d_ptr->m_rubberBand->hide();
+ QRectF rect = d_ptr->m_rubberBand->geometry();
+ // Since plotArea uses QRectF and rubberband uses QRect, we can't just blindly use
+ // rubberband's dimensions for vertical and horizontal rubberbands, where one
+ // dimension must match the corresponding plotArea dimension exactly.
+ if (d_ptr->m_rubberBandFlags == VerticalRubberBand) {
+ rect.setX(d_ptr->m_chart->plotArea().x());
+ rect.setWidth(d_ptr->m_chart->plotArea().width());
+ } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
+ rect.setY(d_ptr->m_chart->plotArea().y());
+ rect.setHeight(d_ptr->m_chart->plotArea().height());
+ }
+ d_ptr->m_chart->zoomIn(rect);
+ event->accept();
+ }
+
+ } else if (d_ptr->m_rubberBand && event->button() == Qt::RightButton) {
+ // If vertical or horizontal rubberband mode, restrict zoom out to specified axis.
+ // Since there is no suitable API for that, use zoomIn with rect bigger than the
+ // plot area.
+ if (d_ptr->m_rubberBandFlags == VerticalRubberBand
+ || d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
+ QRectF rect = d_ptr->m_chart->plotArea();
+ if (d_ptr->m_rubberBandFlags == VerticalRubberBand) {
+ qreal adjustment = rect.height() / 2;
+ rect.adjust(0, -adjustment, 0, adjustment);
+ } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
+ qreal adjustment = rect.width() / 2;
+ rect.adjust(-adjustment, 0, adjustment, 0);
+ }
+ d_ptr->m_chart->zoomIn(rect);
+ } else {
+ d_ptr->m_chart->zoomOut();
+ }
+ event->accept();
+ } else {
+#endif
+ QGraphicsView::mouseReleaseEvent(event);
+#ifndef QT_NO_RUBBERBAND
+ }
+#endif
+}
+
+/*!
+ Resizes and updates the chart area using the \a event data
+*/
+void QChartView::resizeEvent(QResizeEvent *event)
+{
+ QGraphicsView::resizeEvent(event);
+ d_ptr->resize();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QChartViewPrivate::QChartViewPrivate(QChartView *q, QChart *chart)
+ : q_ptr(q),
+ m_scene(new QGraphicsScene(q)),
+ m_chart(chart),
+#ifndef QT_NO_RUBBERBAND
+ m_rubberBand(0),
+#endif
+ m_rubberBandFlags(QChartView::NoRubberBand)
+{
+ q_ptr->setFrameShape(QFrame::NoFrame);
+ q_ptr->setBackgroundRole(QPalette::Window);
+ q_ptr->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ q_ptr->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ q_ptr->setScene(m_scene);
+ q_ptr->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ if (!m_chart)
+ m_chart = new QChart();
+ m_scene->addItem(m_chart);
+}
+
+QChartViewPrivate::~QChartViewPrivate()
+{
+}
+
+void QChartViewPrivate::setChart(QChart *chart)
+{
+ Q_ASSERT(chart);
+
+ if (m_chart == chart)
+ return;
+
+ if (m_chart)
+ m_scene->removeItem(m_chart);
+
+ m_chart = chart;
+ m_scene->addItem(m_chart);
+
+ resize();
+}
+
+void QChartViewPrivate::resize()
+{
+ // Fit the chart into view if it has been rotated
+ qreal sinA = qAbs(q_ptr->transform().m21());
+ qreal cosA = qAbs(q_ptr->transform().m11());
+ QSize chartSize = q_ptr->size();
+
+ if (sinA == 1.0) {
+ chartSize.setHeight(q_ptr->size().width());
+ chartSize.setWidth(q_ptr->size().height());
+ } else if (sinA != 0.0) {
+ // Non-90 degree rotation, find largest square chart that can fit into the view.
+ qreal minDimension = qMin(q_ptr->size().width(), q_ptr->size().height());
+ qreal h = (minDimension - (minDimension / ((sinA / cosA) + 1.0))) / sinA;
+ chartSize.setHeight(h);
+ chartSize.setWidth(h);
+ }
+
+ m_chart->resize(chartSize);
+ q_ptr->setMinimumSize(m_chart->minimumSize().toSize());
+ q_ptr->setSceneRect(m_chart->geometry());
+}
+
+#include "moc_qchartview.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/qchartview.h b/src/charts/qchartview.h
new file mode 100644
index 00000000..89aca5d4
--- /dev/null
+++ b/src/charts/qchartview.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCHARTVIEW_H
+#define QCHARTVIEW_H
+
+#include <QtCharts/QAbstractAxis>
+#include <QtCharts/QAbstractSeries>
+#include <QtCharts/QChart>
+#include <QGraphicsView>
+
+class QGraphicsScene;
+class QRubberBand;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QChartViewPrivate;
+
+class QT_CHARTS_EXPORT QChartView : public QGraphicsView
+{
+ Q_OBJECT
+ Q_ENUMS(RubberBand)
+public:
+
+ enum RubberBand {
+ NoRubberBand = 0x0,
+ VerticalRubberBand = 0x1,
+ HorizonalRubberBand = 0x2,
+ RectangleRubberBand = 0x3
+ };
+
+ Q_DECLARE_FLAGS(RubberBands, RubberBand)
+
+ explicit QChartView(QWidget *parent = 0);
+ explicit QChartView(QChart *chart, QWidget *parent = 0);
+ ~QChartView();
+
+ void setRubberBand(const RubberBands &rubberBands);
+ RubberBands rubberBand() const;
+
+ QChart *chart() const;
+ void setChart(QChart *chart);
+
+protected:
+ void resizeEvent(QResizeEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+
+protected:
+ QScopedPointer<QChartViewPrivate> d_ptr;
+ Q_DISABLE_COPY(QChartView)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QCHARTVIEW_H
diff --git a/src/charts/qchartview_p.h b/src/charts/qchartview_p.h
new file mode 100644
index 00000000..a6103de6
--- /dev/null
+++ b/src/charts/qchartview_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QCHARTVIEW_P_H
+#define QCHARTVIEW_P_H
+
+#include "qchartview.h"
+
+class QGraphicsScene;
+class ChartPresenter;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QChart;
+class QChartView;
+
+class QChartViewPrivate
+{
+public:
+ explicit QChartViewPrivate(QChartView *q, QChart *chart = 0);
+ ~QChartViewPrivate();
+ void setChart(QChart *chart);
+ void resize();
+
+protected:
+ QChartView *q_ptr;
+
+public:
+ QGraphicsScene *m_scene;
+ QChart *m_chart;
+ QPoint m_rubberBandOrigin;
+#ifndef QT_NO_RUBBERBAND
+ QRubberBand *m_rubberBand;
+#endif
+ QChartView::RubberBands m_rubberBandFlags;
+};
+
+QT_CHARTS_END_NAMESPACE
+#endif
diff --git a/src/charts/qpolarchart.cpp b/src/charts/qpolarchart.cpp
new file mode 100644
index 00000000..b8ad49ee
--- /dev/null
+++ b/src/charts/qpolarchart.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpolarchart.h"
+#include "qabstractaxis.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \enum QPolarChart::PolarOrientation
+
+ This type is used to specify the polar orientation of an axis.
+
+ \value PolarOrientationRadial
+ \value PolarOrientationAngular
+*/
+
+/*!
+ \class QPolarChart
+ \inmodule Qt Charts
+ \brief Polar chart API for Qt Charts.
+
+ QPolarChart is a specialization of QChart to show a polar chart.
+
+ Polar charts support line, spline, area, and scatter series, and all axis types
+ supported by those series.
+
+ \note When setting ticks to an angular QValueAxis, keep in mind that the first and last tick
+ are co-located at 0/360 degree angle.
+
+ \note If the angular distance between two consecutive points in a series is more than 180 degrees,
+ any line connecting the two points becomes meaningless, so choose the axis ranges accordingly
+ when displaying line, spline, or area series. In such case series don't draw a direct line between
+ the two points, but instead draw a line to and from the center of the chart.
+
+ \note Polar charts draw all axes of same orientation in the same position, so using multiple
+ axes of same orientation can be confusing, unless the extra axes are only used to customize the
+ grid (e.g. you can display a highlighted range with a secondary shaded QCategoryAxis or provide
+ unlabeled subticks with a secondary QValueAxis that has its labels hidden).
+
+ \sa QChart
+ */
+
+/*!
+ Constructs a polar chart as a child of the \a parent.
+ Parameter \a wFlags is passed to the QChart constructor.
+ */
+QPolarChart::QPolarChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
+ : QChart(QChart::ChartTypePolar, parent, wFlags)
+{
+}
+
+/*!
+ Destroys the polar chart object and its children, like series and axis objects added to it.
+ */
+QPolarChart::~QPolarChart()
+{
+}
+
+/*!
+ Returns the axes added for the \a series with \a polarOrientation. If no series is provided, then any axis with the
+ specified polar orientation is returned.
+
+ \sa addAxis()
+ */
+QList<QAbstractAxis *> QPolarChart::axes(PolarOrientations polarOrientation, QAbstractSeries *series) const
+{
+ Qt::Orientations orientation(0);
+ if (polarOrientation.testFlag(PolarOrientationAngular))
+ orientation |= Qt::Horizontal;
+ if (polarOrientation.testFlag(PolarOrientationRadial))
+ orientation |= Qt::Vertical;
+
+ return QChart::axes(orientation, series);
+}
+
+/*!
+ This convenience method adds \a axis to the polar chart with \a polarOrientation.
+ The chart takes the ownership of the axis.
+
+ \note Axes can be added to a polar chart also with QChart::addAxis() instead of this method.
+ The specified alignment determines the polar orientation: horizontal alignments indicate angular
+ axis and vertical alignments indicate radial axis.
+
+ \sa QChart::removeAxis(), QChart::createDefaultAxes(), QAbstractSeries::attachAxis(), QChart::addAxis()
+*/
+void QPolarChart::addAxis(QAbstractAxis *axis, PolarOrientation polarOrientation)
+{
+ if (!axis || axis->type() == QAbstractAxis::AxisTypeBarCategory) {
+ qWarning("QAbstractAxis::AxisTypeBarCategory is not a supported axis type for polar charts.");
+ } else {
+ Qt::Alignment alignment = Qt::AlignLeft;
+ if (polarOrientation == PolarOrientationAngular)
+ alignment = Qt::AlignBottom;
+ QChart::addAxis(axis, alignment);
+ }
+}
+
+/*!
+ Angular axes of a polar chart report horizontal orientation and radial axes report
+ vertical orientation.
+ This function is a convenience function for converting the orientation of an \a axis to
+ corresponding polar orientation. If the \a axis is NULL or not added to a polar chart,
+ the return value is meaningless.
+*/
+QPolarChart::PolarOrientation QPolarChart::axisPolarOrientation(QAbstractAxis *axis)
+{
+ if (axis && axis->orientation() == Qt::Horizontal)
+ return PolarOrientationAngular;
+ else
+ return PolarOrientationRadial;
+}
+
+#include "moc_qpolarchart.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/qpolarchart.h b/src/charts/qpolarchart.h
new file mode 100644
index 00000000..e9512525
--- /dev/null
+++ b/src/charts/qpolarchart.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPOLARCHART_H
+#define QPOLARCHART_H
+
+#include <QtCharts/qchart.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractSeries;
+class QAbstractAxis;
+
+class QT_CHARTS_EXPORT QPolarChart : public QChart
+{
+ Q_OBJECT
+ Q_ENUMS(PolarOrientation)
+ Q_FLAGS(PolarOrientations)
+
+public:
+ enum PolarOrientation {
+ PolarOrientationRadial = 0x1,
+ PolarOrientationAngular = 0x2
+ };
+ Q_DECLARE_FLAGS(PolarOrientations, PolarOrientation)
+
+public:
+ explicit QPolarChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
+ ~QPolarChart();
+
+ void addAxis(QAbstractAxis *axis, PolarOrientation polarOrientation);
+
+ QList<QAbstractAxis*> axes(PolarOrientations polarOrientation = PolarOrientations(PolarOrientationRadial | PolarOrientationAngular), QAbstractSeries *series = 0) const;
+
+ static PolarOrientation axisPolarOrientation(QAbstractAxis *axis);
+
+protected:
+ Q_DISABLE_COPY(QPolarChart)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QCHART_H
diff --git a/src/charts/scatterchart/qscatterseries.cpp b/src/charts/scatterchart/qscatterseries.cpp
new file mode 100644
index 00000000..346ca83b
--- /dev/null
+++ b/src/charts/scatterchart/qscatterseries.cpp
@@ -0,0 +1,336 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qscatterseries.h"
+#include "qscatterseries_p.h"
+#include "scatterchartitem_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "scatteranimation_p.h"
+#include "qchart_p.h"
+
+/*!
+ \class QScatterSeries
+ \inmodule Qt Charts
+ \brief The QScatterSeries class is used for making scatter charts.
+
+ \mainclass
+
+ The scatter data is displayed as a collection of points on the chart. Each point determines the position on the horizontal axis
+ and the vertical axis.
+
+ \image examples_scatterchart.png
+
+ Creating basic scatter chart is simple:
+ \code
+ QScatterSeries* series = new QScatterSeries();
+ series->append(0, 6);
+ series->append(2, 4);
+ ...
+ chart->addSeries(series);
+ \endcode
+*/
+/*!
+ \qmltype ScatterSeries
+ \instantiates QScatterSeries
+ \inqmlmodule QtCharts
+
+ \inherits XYSeries
+
+ \brief The ScatterSeries type is used for making scatter charts.
+
+ The following QML shows how to create a chart with two simple scatter series:
+ \snippet qmlchart/qml/qmlchart/View5.qml 1
+
+ \beginfloatleft
+ \image examples_qmlchart5.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ \enum QScatterSeries::MarkerShape
+
+ This enum describes the shape used when rendering marker items.
+
+ \value MarkerShapeCircle
+ \value MarkerShapeRectangle
+*/
+
+/*!
+ \property QScatterSeries::brush
+ Brush used to draw the series.
+*/
+
+/*!
+ \property QScatterSeries::color
+ Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
+ \sa QScatterSeries::brush()
+*/
+
+/*!
+ \property QScatterSeries::borderColor
+ Line (pen) color of the series. This is a convenience property for modifying the color of pen.
+ \sa QScatterSeries::pen()
+*/
+/*!
+ \qmlproperty color ScatterSeries::borderColor
+ Border (pen) color of the series.
+*/
+
+/*!
+ \qmlproperty real ScatterSeries::borderWidth
+ The width of the border line. By default the width is 2.0.
+*/
+
+/*!
+ \property QScatterSeries::markerShape
+ Defines the shape of the marker used to draw the points in the series. The default shape is MarkerShapeCircle.
+*/
+/*!
+ \qmlproperty MarkerShape ScatterSeries::markerShape
+ Defines the shape of the marker used to draw the points in the series. One of ScatterSeries
+ ScatterSeries.MarkerShapeCircle or ScatterSeries.MarkerShapeRectangle.
+ The default shape is ScatterSeries.MarkerShapeCircle.
+*/
+
+/*!
+ \property QScatterSeries::markerSize
+ Defines the size of the marker used to draw the points in the series. The default size is 15.0.
+*/
+/*!
+ \qmlproperty real ScatterSeries::markerSize
+ Defines the size of the marker used to draw the points in the series. The default size is 15.0.
+*/
+
+/*!
+ \qmlproperty QString ScatterSeries::brushFilename
+ The name of the file used as a brush for the series.
+*/
+
+/*!
+ \fn void QScatterSeries::colorChanged(QColor color)
+ Signal is emitted when the fill (brush) color has changed to \a color.
+*/
+
+/*!
+ \fn void QScatterSeries::borderColorChanged(QColor color)
+ Signal is emitted when the line (pen) color has changed to \a color.
+*/
+/*!
+ \qmlsignal ScatterSeries::borderColorChanged(color color)
+ Signal is emitted when the line (pen) color has changed to \a color.
+*/
+
+/*!
+ \fn QAbstractSeries::SeriesType QScatterSeries::type() const
+ Returns QAbstractSeries::SeriesTypeScatter.
+ \sa QAbstractSeries, SeriesType
+*/
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ Constructs a series object which is a child of \a parent.
+*/
+QScatterSeries::QScatterSeries(QObject *parent)
+ : QXYSeries(*new QScatterSeriesPrivate(this), parent)
+{
+}
+
+/*!
+ Destroys the object. Note that adding series to QChart transfers the ownership to the chart.
+*/
+QScatterSeries::~QScatterSeries()
+{
+ Q_D(QScatterSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+
+QAbstractSeries::SeriesType QScatterSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeScatter;
+}
+
+/*!
+ Sets \a pen used for drawing points' border on the chart. If the pen is not defined, the
+ pen from chart theme is used.
+ \sa QChart::setTheme()
+*/
+void QScatterSeries::setPen(const QPen &pen)
+{
+ Q_D(QXYSeries);
+ if (d->m_pen != pen) {
+ bool emitColorChanged = d->m_pen.color() != pen.color();
+ d->m_pen = pen;
+ emit d->updated();
+ if (emitColorChanged)
+ emit borderColorChanged(pen.color());
+ }
+}
+
+/*!
+ Sets \a brush used for drawing points on the chart. If the brush is not defined, brush
+ from chart theme setting is used.
+ \sa QChart::setTheme()
+*/
+void QScatterSeries::setBrush(const QBrush &brush)
+{
+ Q_D(QScatterSeries);
+ if (d->m_brush != brush) {
+ bool emitColorChanged = d->m_brush.color() != brush.color();
+ d->m_brush = brush;
+ emit d->updated();
+ if (emitColorChanged)
+ emit colorChanged(brush.color());
+ }
+}
+
+QBrush QScatterSeries::brush() const
+{
+ Q_D(const QScatterSeries);
+ if (d->m_brush == QChartPrivate::defaultBrush())
+ return QBrush();
+ else
+ return d->m_brush;
+}
+
+void QScatterSeries::setColor(const QColor &color)
+{
+ QBrush b = brush();
+ if (b == QChartPrivate::defaultBrush())
+ b = QBrush();
+ if (b == QBrush())
+ b.setStyle(Qt::SolidPattern);
+ b.setColor(color);
+ setBrush(b);
+}
+
+QColor QScatterSeries::color() const
+{
+ return brush().color();
+}
+
+void QScatterSeries::setBorderColor(const QColor &color)
+{
+ QPen p = pen();
+ if (p == QChartPrivate::defaultPen())
+ p = QPen();
+ p.setColor(color);
+ setPen(p);
+}
+
+QColor QScatterSeries::borderColor() const
+{
+ return pen().color();
+}
+
+QScatterSeries::MarkerShape QScatterSeries::markerShape() const
+{
+ Q_D(const QScatterSeries);
+ return d->m_shape;
+}
+
+void QScatterSeries::setMarkerShape(MarkerShape shape)
+{
+ Q_D(QScatterSeries);
+ if (d->m_shape != shape) {
+ d->m_shape = shape;
+ emit d->updated();
+ }
+}
+
+qreal QScatterSeries::markerSize() const
+{
+ Q_D(const QScatterSeries);
+ return d->m_size;
+}
+
+void QScatterSeries::setMarkerSize(qreal size)
+{
+ Q_D(QScatterSeries);
+
+ if (!qFuzzyCompare(d->m_size, size)) {
+ d->m_size = size;
+ emit d->updated();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QScatterSeriesPrivate::QScatterSeriesPrivate(QScatterSeries *q)
+ : QXYSeriesPrivate(q),
+ m_shape(QScatterSeries::MarkerShapeCircle),
+ m_size(15.0)
+{
+}
+
+void QScatterSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QScatterSeries);
+ ScatterChartItem *scatter = new ScatterChartItem(q,parent);
+ m_item.reset(scatter);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+void QScatterSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
+{
+ Q_Q(QScatterSeries);
+ const QList<QColor> colors = theme->seriesColors();
+ const QList<QGradient> gradients = theme->seriesGradients();
+
+ if (forced || QChartPrivate::defaultPen() == m_pen) {
+ QPen pen;
+ pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
+ pen.setWidthF(2);
+ q->setPen(pen);
+ }
+
+ if (forced || QChartPrivate::defaultBrush() == m_brush) {
+ QBrush brush(colors.at(index % colors.size()));
+ q->setBrush(brush);
+ }
+
+ if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
+ QColor color = theme->labelBrush().color();
+ q->setPointLabelsColor(color);
+ }
+}
+
+void QScatterSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
+{
+ ScatterChartItem *item = static_cast<ScatterChartItem *>(m_item.data());
+ Q_ASSERT(item);
+
+ if (item->animation())
+ item->animation()->stopAndDestroyLater();
+
+ if (options.testFlag(QChart::SeriesAnimations))
+ item->setAnimation(new ScatterAnimation(item));
+ else
+ item->setAnimation(0);
+
+ QAbstractSeriesPrivate::initializeAnimations(options);
+}
+
+#include "moc_qscatterseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/scatterchart/qscatterseries.h b/src/charts/scatterchart/qscatterseries.h
new file mode 100644
index 00000000..d7f9504a
--- /dev/null
+++ b/src/charts/scatterchart/qscatterseries.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCATTERSERIES_H
+#define QSCATTERSERIES_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/qxyseries.h>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QScatterSeriesPrivate;
+
+class QT_CHARTS_EXPORT QScatterSeries : public QXYSeries
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
+ Q_PROPERTY(MarkerShape markerShape READ markerShape WRITE setMarkerShape)
+ Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
+ Q_ENUMS(MarkerShape)
+
+public:
+ enum MarkerShape {
+ MarkerShapeCircle,
+ MarkerShapeRectangle
+ };
+
+public:
+ explicit QScatterSeries(QObject *parent = 0);
+ ~QScatterSeries();
+ QAbstractSeries::SeriesType type() const;
+ void setPen(const QPen &pen);
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+ void setColor(const QColor &color);
+ QColor color() const;
+ void setBorderColor(const QColor &color);
+ QColor borderColor() const;
+ MarkerShape markerShape() const;
+ void setMarkerShape(MarkerShape shape);
+ qreal markerSize() const;
+ void setMarkerSize(qreal size);
+
+Q_SIGNALS:
+ void colorChanged(QColor color);
+ void borderColorChanged(QColor color);
+
+private:
+ Q_DECLARE_PRIVATE(QScatterSeries)
+ Q_DISABLE_COPY(QScatterSeries)
+ friend class ScatterChartItem;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QSCATTERSERIES_H
diff --git a/src/charts/scatterchart/qscatterseries_p.h b/src/charts/scatterchart/qscatterseries_p.h
new file mode 100644
index 00000000..69e91655
--- /dev/null
+++ b/src/charts/scatterchart/qscatterseries_p.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QSCATTERSERIES_P_H
+#define QSCATTERSERIES_P_H
+
+#include "qxyseries_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QScatterSeriesPrivate: public QXYSeriesPrivate
+{
+public:
+ QScatterSeriesPrivate(QScatterSeries *q);
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeTheme(int index, ChartTheme* theme, bool forced = false);
+ void initializeAnimations(QtCharts::QChart::AnimationOptions options);
+
+private:
+ QScatterSeries::MarkerShape m_shape;
+ qreal m_size;
+ Q_DECLARE_PUBLIC(QScatterSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/scatterchart/scatter.pri b/src/charts/scatterchart/scatter.pri
index fcbd119d..fcbd119d 100644
--- a/src/scatterchart/scatter.pri
+++ b/src/charts/scatterchart/scatter.pri
diff --git a/src/charts/scatterchart/scatterchartitem.cpp b/src/charts/scatterchart/scatterchartitem.cpp
new file mode 100644
index 00000000..597d5d52
--- /dev/null
+++ b/src/charts/scatterchart/scatterchartitem.cpp
@@ -0,0 +1,237 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "scatterchartitem_p.h"
+#include "qscatterseries.h"
+#include "qscatterseries_p.h"
+#include "chartpresenter_p.h"
+#include "abstractdomain_p.h"
+#include "qchart.h"
+#include <QPainter>
+#include <QGraphicsScene>
+#include <QDebug>
+#include <QGraphicsSceneMouseEvent>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item)
+ : XYChart(series,item),
+ m_series(series),
+ m_items(this),
+ m_visible(true),
+ m_shape(QScatterSeries::MarkerShapeRectangle),
+ m_size(15),
+ m_pointLabelsVisible(false),
+ m_pointLabelsFormat(series->pointLabelsFormat()),
+ m_pointLabelsFont(series->pointLabelsFont()),
+ m_pointLabelsColor(series->pointLabelsColor())
+{
+ QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
+ QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
+ QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
+ this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
+ this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
+
+ setZValue(ChartPresenter::ScatterSeriesZValue);
+ setFlags(QGraphicsItem::ItemClipsChildrenToShape);
+
+ handleUpdated();
+
+ m_items.setHandlesChildEvents(false);
+}
+
+QRectF ScatterChartItem::boundingRect() const
+{
+ return m_rect;
+}
+
+void ScatterChartItem::createPoints(int count)
+{
+ for (int i = 0; i < count; ++i) {
+
+ QGraphicsItem *item = 0;
+
+ switch (m_shape) {
+ case QScatterSeries::MarkerShapeCircle: {
+ item = new CircleMarker(0, 0, m_size, m_size, this);
+ const QRectF &rect = item->boundingRect();
+ item->setPos(-rect.width() / 2, -rect.height() / 2);
+ break;
+ }
+ case QScatterSeries::MarkerShapeRectangle:
+ item = new RectangleMarker(0, 0, m_size, m_size, this);
+ item->setPos(-m_size / 2, -m_size / 2);
+ break;
+ default:
+ qWarning() << "Unsupported marker type";
+ break;
+ }
+ m_items.addToGroup(item);
+ }
+}
+
+void ScatterChartItem::deletePoints(int count)
+{
+ QList<QGraphicsItem *> items = m_items.childItems();
+
+ for (int i = 0; i < count; ++i) {
+ QGraphicsItem *item = items.takeLast();
+ m_markerMap.remove(item);
+ delete(item);
+ }
+}
+
+void ScatterChartItem::markerSelected(QGraphicsItem *marker)
+{
+ emit XYChart::clicked(m_markerMap[marker]);
+}
+
+void ScatterChartItem::markerHovered(QGraphicsItem *marker, bool state)
+{
+ emit XYChart::hovered(m_markerMap[marker], state);
+}
+
+void ScatterChartItem::updateGeometry()
+{
+
+ const QVector<QPointF>& points = geometryPoints();
+
+ if (points.size() == 0) {
+ deletePoints(m_items.childItems().count());
+ return;
+ }
+
+ int diff = m_items.childItems().size() - points.size();
+
+ if (diff > 0)
+ deletePoints(diff);
+ else if (diff < 0)
+ createPoints(-diff);
+
+ if (diff != 0)
+ handleUpdated();
+
+ QList<QGraphicsItem *> items = m_items.childItems();
+
+ QRectF clipRect(QPointF(0,0),domain()->size());
+
+ // Only zoom in if the clipRect fits inside int limits. QWidget::update() uses
+ // a region that has to be compatible with QRect.
+ if (clipRect.height() <= INT_MAX
+ && clipRect.width() <= INT_MAX) {
+ QVector<bool> offGridStatus = offGridStatusVector();
+ const int seriesLastIndex = m_series->count() - 1;
+
+ for (int i = 0; i < points.size(); i++) {
+ QGraphicsItem *item = items.at(i);
+ const QPointF &point = points.at(i);
+ const QRectF &rect = item->boundingRect();
+ // During remove animation series may have different number of points,
+ // so ensure we don't go over the index. Animation handling itself ensures that
+ // if there is actually no points in the series, then it won't generate a fake point,
+ // so we can be assured there is always at least one point in m_series here.
+ // Note that marker map values can be technically incorrect during the animation,
+ // if it was caused by an insert, but this shouldn't be a problem as the points are
+ // fake anyway. After remove animation stops, geometry is updated to correct one.
+ m_markerMap[item] = m_series->at(qMin(seriesLastIndex, i));
+ item->setPos(point.x() - rect.width() / 2, point.y() - rect.height() / 2);
+
+ if (!m_visible || offGridStatus.at(i))
+ item->setVisible(false);
+ else
+ item->setVisible(true);
+ }
+
+ prepareGeometryChange();
+ m_rect = clipRect;
+ }
+}
+
+void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
+
+ QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
+
+ painter->save();
+ painter->setClipRect(clipRect);
+
+ if (m_pointLabelsVisible) {
+ m_series->d_func()->drawSeriesPointLabels(painter, m_points,
+ m_series->markerSize() / 2
+ + m_series->pen().width());
+ }
+
+ painter->restore();
+}
+
+void ScatterChartItem::setPen(const QPen &pen)
+{
+ foreach (QGraphicsItem *item , m_items.childItems())
+ static_cast<QAbstractGraphicsShapeItem*>(item)->setPen(pen);
+}
+
+void ScatterChartItem::setBrush(const QBrush &brush)
+{
+ foreach (QGraphicsItem *item , m_items.childItems())
+ static_cast<QAbstractGraphicsShapeItem*>(item)->setBrush(brush);
+}
+
+void ScatterChartItem::handleUpdated()
+{
+ int count = m_items.childItems().count();
+
+ if (count == 0)
+ return;
+
+ bool recreate = m_visible != m_series->isVisible()
+ || m_size != m_series->markerSize()
+ || m_shape != m_series->markerShape();
+
+ m_visible = m_series->isVisible();
+ m_size = m_series->markerSize();
+ m_shape = m_series->markerShape();
+ setOpacity(m_series->opacity());
+ m_pointLabelsFormat = m_series->pointLabelsFormat();
+ m_pointLabelsVisible = m_series->pointLabelsVisible();
+ m_pointLabelsFont = m_series->pointLabelsFont();
+ m_pointLabelsColor = m_series->pointLabelsColor();
+
+ if (recreate) {
+ deletePoints(count);
+ createPoints(count);
+
+ // Updating geometry is now safe, because it won't call handleUpdated unless it creates/deletes points
+ updateGeometry();
+ }
+
+ setPen(m_series->pen());
+ setBrush(m_series->brush());
+ update();
+}
+
+#include "moc_scatterchartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/scatterchart/scatterchartitem_p.h b/src/charts/scatterchart/scatterchartitem_p.h
new file mode 100644
index 00000000..3c18546e
--- /dev/null
+++ b/src/charts/scatterchart/scatterchartitem_p.h
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef SCATTERCHARTITEM_H
+#define SCATTERCHARTITEM_H
+
+#include "qchartglobal.h"
+#include "xychart_p.h"
+#include <QGraphicsEllipseItem>
+#include <QPen>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QScatterSeries;
+
+class ScatterChartItem : public XYChart
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsItem)
+public:
+ explicit ScatterChartItem(QScatterSeries *series, QGraphicsItem *item = 0);
+
+public:
+ //from QGraphicsItem
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+ void setPen(const QPen &pen);
+ void setBrush(const QBrush &brush);
+
+ void markerSelected(QGraphicsItem *item);
+ void markerHovered(QGraphicsItem *item, bool state);
+
+public Q_SLOTS:
+ void handleUpdated();
+
+private:
+ void createPoints(int count);
+ void deletePoints(int count);
+
+protected:
+ void updateGeometry();
+
+private:
+ QScatterSeries *m_series;
+ QGraphicsItemGroup m_items;
+ bool m_visible;
+ int m_shape;
+ int m_size;
+ QRectF m_rect;
+ QMap<QGraphicsItem *, QPointF> m_markerMap;
+
+ bool m_pointLabelsVisible;
+ QString m_pointLabelsFormat;
+ QFont m_pointLabelsFont;
+ QColor m_pointLabelsColor;
+};
+
+class CircleMarker: public QGraphicsEllipseItem
+{
+
+public:
+ CircleMarker(qreal x, qreal y, qreal w, qreal h, ScatterChartItem *parent)
+ : QGraphicsEllipseItem(x, y, w, h, parent),
+ m_parent(parent)
+ {
+ setAcceptHoverEvents(true);
+ }
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event)
+ {
+ QGraphicsEllipseItem::mousePressEvent(event);
+ m_parent->markerSelected(this);
+ }
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+ {
+ QGraphicsEllipseItem::hoverEnterEvent(event);
+ m_parent->markerHovered(this, true);
+ }
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+ {
+ QGraphicsEllipseItem::hoverLeaveEvent(event);
+ m_parent->markerHovered(this, false);
+ }
+
+private:
+ ScatterChartItem *m_parent;
+};
+
+class RectangleMarker: public QGraphicsRectItem
+{
+
+public:
+ RectangleMarker(qreal x, qreal y, qreal w, qreal h, ScatterChartItem *parent)
+ : QGraphicsRectItem(x, y, w, h, parent),
+ m_parent(parent)
+ {
+ setAcceptHoverEvents(true);
+ }
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event)
+ {
+ QGraphicsRectItem::mousePressEvent(event);
+ m_parent->markerSelected(this);
+ }
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+ {
+ QGraphicsRectItem::hoverEnterEvent(event);
+ m_parent->markerHovered(this, true);
+ }
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+ {
+ QGraphicsRectItem::hoverLeaveEvent(event);
+ m_parent->markerHovered(this, false);
+ }
+
+private:
+ ScatterChartItem *m_parent;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // SCATTERPRESENTER_H
diff --git a/src/charts/scroller.cpp b/src/charts/scroller.cpp
new file mode 100644
index 00000000..add8f92a
--- /dev/null
+++ b/src/charts/scroller.cpp
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "scroller_p.h"
+#include "qlegend.h"
+#include <QGraphicsSceneMouseEvent>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+Scroller::Scroller()
+ : m_ticker(this),
+ m_timeTresholdMin(50),
+ m_timeTresholdMax(300),
+ m_state(Idle),
+ m_treshold(10)
+{
+
+}
+
+Scroller::~Scroller()
+{
+}
+
+void Scroller::move(const QPointF &delta)
+{
+ switch (m_state) {
+ case Pressed:
+ m_timeStamp = QTime::currentTime();
+ break;
+ case Scroll:
+ stopTicker();
+ m_timeStamp = QTime::currentTime();
+ break;
+ default:
+ break;
+ }
+ setOffset(offset() - delta);
+}
+
+void Scroller::scrollTo(const QPointF &delta)
+{
+ // Starts scrolling, if at least m_timeTresholdMin msecs has gone since timestamp
+ // current time is no more than m_timeTresholdMax from timestamp
+
+ if ((m_timeStamp.elapsed() > m_timeTresholdMin) && (m_timeStamp.msecsTo(QTime::currentTime()) < m_timeTresholdMax)) {
+ // Release was quick enough. Start scrolling.
+ qreal interval = 25;
+ qreal time = m_timeStamp.msecsTo(QTime::currentTime());
+ if (qFuzzyCompare(time, 0)) {
+ m_speed = delta / 5;
+ } else {
+ m_speed = delta * interval / time;
+ }
+
+ qreal fraction = qMax(qAbs(m_speed.x()), qAbs(m_speed.y()));
+
+ if (!qFuzzyCompare(fraction, 0)) {
+ m_fraction.setX(qAbs(m_speed.x() / fraction));
+ m_fraction.setY(qAbs(m_speed.y() / fraction));
+ } else {
+ m_fraction.setX(1);
+ m_fraction.setY(1);
+ }
+ startTicker(interval);
+ } else {
+ stopTicker(); // Stop ticker, if one is running.
+ }
+}
+
+void Scroller::handleMousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ stopTicker();
+ m_pressPos = event->screenPos();
+ m_lastPos = m_pressPos;
+ m_state = Pressed;
+ event->accept();
+}
+
+void Scroller::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ QPointF delta = event->screenPos() - m_lastPos;
+
+ switch (m_state) {
+ case Pressed: {
+ // calculate treshold. If enough, change to move state and send out move deltas.
+ if (qAbs(delta.x()) > m_treshold || qAbs(delta.y()) > m_treshold) {
+ m_lastPos = event->screenPos();
+ move(delta);
+ m_state = Move;
+ }
+ event->accept();
+ break;
+ }
+ case Move: {
+ m_lastPos = event->screenPos();
+ move(delta);
+ event->accept();
+ break;
+ }
+ case Idle:
+ default: {
+ event->ignore();
+ break;
+ }
+ }
+}
+
+void Scroller::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ switch (m_state) {
+ case Move:
+ {
+ scrollTo(m_lastPos - m_pressPos);
+ event->accept();
+ break;
+ }
+ default:
+ {
+ m_state = Idle;
+ event->ignore();
+ break;
+ }
+ }
+}
+
+void Scroller::startTicker(int interval)
+{
+ m_state = Scroll;
+ m_ticker.start(interval);
+}
+
+void Scroller::stopTicker()
+{
+ m_state = Idle;
+ m_ticker.stop();
+}
+
+void Scroller::scrollTick()
+{
+ switch (m_state) {
+ case Scroll:
+ lowerSpeed(m_speed);
+ setOffset(offset() - m_speed);
+ if (m_speed == QPointF(0, 0)) {
+ m_state = Idle;
+ m_ticker.stop();
+ }
+ break;
+ default:
+ qWarning() << __FUNCTION__ << "Scroller unexpected state" << m_state;
+ m_ticker.stop();
+ m_state = Idle;
+ break;
+ }
+}
+
+void Scroller::lowerSpeed(QPointF &speed, qreal maxSpeed)
+{
+ qreal x = qBound(-maxSpeed, speed.x(), maxSpeed);
+ qreal y = qBound(-maxSpeed, speed.y(), maxSpeed);
+
+ x = (x == 0) ? x :
+ (x > 0) ? qMax(qreal(0), x - m_fraction.x()) : qMin(qreal(0), x + m_fraction.x());
+ y = (y == 0) ? y :
+ (y > 0) ? qMax(qreal(0), y - m_fraction.y()) : qMin(qreal(0), y + m_fraction.y());
+ speed.setX(x);
+ speed.setY(y);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ScrollTicker::ScrollTicker(Scroller *scroller, QObject *parent)
+ : QObject(parent),
+ m_scroller(scroller)
+{
+
+}
+
+void ScrollTicker::start(int interval)
+{
+ if (!m_timer.isActive())
+ m_timer.start(interval, this);
+}
+
+void ScrollTicker::stop()
+{
+ m_timer.stop();
+}
+
+void ScrollTicker::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event);
+ m_scroller->scrollTick();
+}
+
+#include "moc_scroller_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/scroller_p.h b/src/charts/scroller_p.h
new file mode 100644
index 00000000..35258fc7
--- /dev/null
+++ b/src/charts/scroller_p.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef SCROLLER_P_H
+#define SCROLLER_P_H
+
+#include "qchartglobal.h"
+#include <QBasicTimer>
+#include <QTime>
+#include <QPointF>
+
+class QGraphicsSceneMouseEvent;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class Scroller;
+class QLegend;
+
+class ScrollTicker : public QObject
+{
+ Q_OBJECT
+public:
+ explicit ScrollTicker(Scroller *scroller, QObject *parent = 0);
+ void start(int interval);
+ void stop();
+protected:
+ void timerEvent(QTimerEvent *event);
+
+private:
+ QBasicTimer m_timer;
+ Scroller *m_scroller;
+};
+
+class Scroller
+{
+public:
+ enum State {
+ Idle,
+ Pressed,
+ Move,
+ Scroll
+ };
+
+ Scroller();
+ virtual ~Scroller();
+
+ virtual void setOffset(const QPointF &point) = 0;
+ virtual QPointF offset() const = 0;
+
+ void move(const QPointF &delta);
+ void scrollTo(const QPointF &delta);
+
+ void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
+ void handleMouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+
+ void scrollTick();
+
+private:
+ void startTicker(int interval);
+ void stopTicker();
+
+private:
+ void calculateSpeed(const QPointF &position);
+ void lowerSpeed(QPointF &speed, qreal maxSpeed = 100);
+
+private:
+ ScrollTicker m_ticker;
+ QTime m_timeStamp;
+ QPointF m_speed;
+ QPointF m_fraction;
+ int m_timeTresholdMin;
+ int m_timeTresholdMax;
+
+ State m_state;
+ QPointF m_pressPos;
+ QPointF m_lastPos;
+ qreal m_treshold;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif /* SCROLLER_P_H */
diff --git a/src/charts/splinechart/qsplineseries.cpp b/src/charts/splinechart/qsplineseries.cpp
new file mode 100644
index 00000000..2ac5cabf
--- /dev/null
+++ b/src/charts/splinechart/qsplineseries.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsplineseries.h"
+#include "qsplineseries_p.h"
+#include "splinechartitem_p.h"
+#include "chartdataset_p.h"
+#include "charttheme_p.h"
+#include "splineanimation_p.h"
+#include "qchart_p.h"
+
+/*!
+ \class QSplineSeries
+ \inmodule Qt Charts
+ \brief Series type used to store data needed to draw a spline.
+
+ QSplineSeries stores the data points along with the segment control points needed by QPainterPath to draw spline
+ Control points are automatically calculated when data changes. The algorithm computes the points so that the normal spline can be drawn.
+
+ \image examples_splinechart.png
+
+ Creating basic spline chart is simple:
+ \code
+ QSplineSeries* series = new QSplineSeries();
+ series->append(0, 6);
+ series->append(2, 4);
+ ...
+ chart->addSeries(series);
+ \endcode
+*/
+/*!
+ \qmltype SplineSeries
+ \instantiates QSplineSeries
+ \inqmlmodule QtCharts
+
+ \inherits XYSeries
+
+ \brief The SplineSeries type is used for making spline charts.
+
+ The following QML shows how to create a simple spline chart:
+ \snippet qmlchart/qml/qmlchart/View3.qml 1
+ \beginfloatleft
+ \image examples_qmlchart3.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ \fn QSeriesType QSplineSeries::type() const
+ Returns the type of the series
+*/
+
+/*!
+ \qmlproperty real SplineSeries::width
+ The width of the line. By default the width is 2.0.
+*/
+
+/*!
+ \qmlproperty Qt::PenStyle SplineSeries::style
+ Controls the style of the line. Set to one of Qt.NoPen, Qt.SolidLine, Qt.DashLine, Qt.DotLine,
+ Qt.DashDotLine or Qt.DashDotDotLine. Using Qt.CustomDashLine is not supported in the QML API.
+ By default the style is Qt.SolidLine.
+*/
+
+/*!
+ \qmlproperty Qt::PenCapStyle SplineSeries::capStyle
+ Controls the cap style of the line. Set to one of Qt.FlatCap, Qt.SquareCap or Qt.RoundCap. By
+ default the cap style is Qt.SquareCap.
+*/
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ Constructs empty series object which is a child of \a parent.
+ When series object is added to a QChart instance then the ownerships is transferred.
+ */
+
+QSplineSeries::QSplineSeries(QObject *parent)
+ : QLineSeries(*new QSplineSeriesPrivate(this), parent)
+{
+}
+
+/*!
+ Destroys the object.
+*/
+QSplineSeries::~QSplineSeries()
+{
+ Q_D(QSplineSeries);
+ if (d->m_chart)
+ d->m_chart->removeSeries(this);
+}
+
+QAbstractSeries::SeriesType QSplineSeries::type() const
+{
+ return QAbstractSeries::SeriesTypeSpline;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QSplineSeriesPrivate::QSplineSeriesPrivate(QSplineSeries *q)
+ : QLineSeriesPrivate(q)
+{
+}
+
+void QSplineSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
+{
+ Q_Q(QSplineSeries);
+ SplineChartItem *spline = new SplineChartItem(q,parent);
+ m_item.reset(spline);
+ QAbstractSeriesPrivate::initializeGraphics(parent);
+}
+
+void QSplineSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
+{
+ Q_Q(QSplineSeries);
+ const QList<QColor> colors = theme->seriesColors();
+
+ if (forced || QChartPrivate::defaultPen() == m_pen) {
+ QPen pen;
+ pen.setColor(colors.at(index % colors.size()));
+ pen.setWidthF(2);
+ q->setPen(pen);
+ }
+
+ if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
+ QColor color = theme->labelBrush().color();
+ q->setPointLabelsColor(color);
+ }
+}
+
+void QSplineSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options)
+{
+ SplineChartItem *item = static_cast<SplineChartItem *>(m_item.data());
+ Q_ASSERT(item);
+ if (item->animation())
+ item->animation()->stopAndDestroyLater();
+
+ if (options.testFlag(QChart::SeriesAnimations))
+ item->setAnimation(new SplineAnimation(item));
+ else
+ item->setAnimation(0);
+ QAbstractSeriesPrivate::initializeAnimations(options);
+}
+
+#include "moc_qsplineseries.cpp"
+#include "moc_qsplineseries_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/splinechart/qsplineseries.h b/src/charts/splinechart/qsplineseries.h
new file mode 100644
index 00000000..a427f02c
--- /dev/null
+++ b/src/charts/splinechart/qsplineseries.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSPLINESERIES_H
+#define QSPLINESERIES_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/qlineseries.h>
+#include <QList>
+#include <QPointF>
+#include <QtGlobal>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QSplineSeriesPrivate;
+
+class QT_CHARTS_EXPORT QSplineSeries : public QLineSeries
+{
+ Q_OBJECT
+
+public:
+ explicit QSplineSeries(QObject *parent = 0);
+ ~QSplineSeries();
+ QAbstractSeries::SeriesType type() const;
+
+private:
+ Q_DECLARE_PRIVATE(QSplineSeries)
+ Q_DISABLE_COPY(QSplineSeries)
+ friend class SplineChartItem;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QSPLINESERIES_H
diff --git a/src/charts/splinechart/qsplineseries_p.h b/src/charts/splinechart/qsplineseries_p.h
new file mode 100644
index 00000000..9a786009
--- /dev/null
+++ b/src/charts/splinechart/qsplineseries_p.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QSPLINESERIES_P_H
+#define QSPLINESERIES_P_H
+
+#include "qlineseries_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+
+class QSplineSeriesPrivate: public QLineSeriesPrivate
+{
+ Q_OBJECT
+public:
+ QSplineSeriesPrivate(QSplineSeries *q);
+
+ void initializeTheme(int index, ChartTheme* theme, bool forced = false);
+ void initializeGraphics(QGraphicsItem* parent);
+ void initializeAnimations(QtCharts::QChart::AnimationOptions options);
+
+private:
+ Q_DECLARE_PUBLIC(QSplineSeries)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/splinechart/splinechart.pri b/src/charts/splinechart/splinechart.pri
index 4038685f..4038685f 100644
--- a/src/splinechart/splinechart.pri
+++ b/src/charts/splinechart/splinechart.pri
diff --git a/src/charts/splinechart/splinechartitem.cpp b/src/charts/splinechart/splinechartitem.cpp
new file mode 100644
index 00000000..d47cd7ce
--- /dev/null
+++ b/src/charts/splinechart/splinechartitem.cpp
@@ -0,0 +1,485 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "splinechartitem_p.h"
+#include "qsplineseries_p.h"
+#include "chartpresenter_p.h"
+#include "splineanimation_p.h"
+#include "polardomain_p.h"
+#include <QPainter>
+#include <QGraphicsSceneMouseEvent>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item)
+ : XYChart(series,item),
+ m_series(series),
+ m_pointsVisible(false),
+ m_animation(0),
+ m_pointLabelsVisible(false),
+ m_pointLabelsFormat(series->pointLabelsFormat()),
+ m_pointLabelsFont(series->pointLabelsFont()),
+ m_pointLabelsColor(series->pointLabelsColor())
+{
+ setAcceptHoverEvents(true);
+ setZValue(ChartPresenter::SplineChartZValue);
+ QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
+ this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
+ this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
+ QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
+ handleUpdated();
+}
+
+QRectF SplineChartItem::boundingRect() const
+{
+ return m_rect;
+}
+
+QPainterPath SplineChartItem::shape() const
+{
+ return m_fullPath;
+}
+
+void SplineChartItem::setAnimation(SplineAnimation *animation)
+{
+ m_animation = animation;
+ XYChart::setAnimation(animation);
+}
+
+ChartAnimation *SplineChartItem::animation() const
+{
+ return m_animation;
+}
+
+void SplineChartItem::setControlGeometryPoints(QVector<QPointF>& points)
+{
+ m_controlPoints = points;
+}
+
+QVector<QPointF> SplineChartItem::controlGeometryPoints() const
+{
+ return m_controlPoints;
+}
+
+void SplineChartItem::updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index)
+{
+ QVector<QPointF> controlPoints;
+ if (newPoints.count() >= 2)
+ controlPoints = calculateControlPoints(newPoints);
+
+ if (m_animation)
+ m_animation->setup(oldPoints, newPoints, m_controlPoints, controlPoints, index);
+
+ m_points = newPoints;
+ m_controlPoints = controlPoints;
+ setDirty(false);
+
+ if (m_animation)
+ presenter()->startAnimation(m_animation);
+ else
+ updateGeometry();
+}
+
+void SplineChartItem::updateGeometry()
+{
+ const QVector<QPointF> &points = m_points;
+ const QVector<QPointF> &controlPoints = m_controlPoints;
+
+ if ((points.size() < 2) || (controlPoints.size() < 2)) {
+ prepareGeometryChange();
+ m_path = QPainterPath();
+ m_rect = QRect();
+ return;
+ }
+
+ Q_ASSERT(points.count() * 2 - 2 == controlPoints.count());
+
+ QPainterPath splinePath;
+ QPainterPath fullPath;
+ // Use worst case scenario to determine required margin.
+ qreal margin = m_linePen.width() * 1.42;
+
+ if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
+ QPainterPath splinePathLeft;
+ QPainterPath splinePathRight;
+ QPainterPath *currentSegmentPath = 0;
+ QPainterPath *previousSegmentPath = 0;
+ qreal minX = domain()->minX();
+ qreal maxX = domain()->maxX();
+ qreal minY = domain()->minY();
+ QPointF currentSeriesPoint = m_series->at(0);
+ QPointF currentGeometryPoint = points.at(0);
+ QPointF previousGeometryPoint = points.at(0);
+ bool pointOffGrid = false;
+ bool previousPointWasOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
+ m_visiblePoints.clear();
+ m_visiblePoints.reserve(points.size());
+
+ qreal domainRadius = domain()->size().height() / 2.0;
+ const QPointF centerPoint(domainRadius, domainRadius);
+
+ if (!previousPointWasOffGrid) {
+ fullPath.moveTo(points.at(0));
+ // Do not draw points for points below minimum Y.
+ if (m_pointsVisible && currentSeriesPoint.y() >= minY)
+ m_visiblePoints.append(currentGeometryPoint);
+ }
+
+ qreal leftMarginLine = centerPoint.x() - margin;
+ qreal rightMarginLine = centerPoint.x() + margin;
+ qreal horizontal = centerPoint.y();
+
+ // See ScatterChartItem::updateGeometry() for explanation why seriesLastIndex is needed
+ const int seriesLastIndex = m_series->count() - 1;
+
+ for (int i = 1; i < points.size(); i++) {
+ // Interpolating spline fragments accurately is not trivial, and would anyway be ugly
+ // when thick pen is used, so we work around it by utilizing three separate
+ // paths for spline segments and clip those with custom regions at paint time.
+ // "Right" path contains segments that cross the axis line with visible point on the
+ // right side of the axis line, as well as segments that have one point within the margin
+ // on the right side of the axis line and another point on the right side of the chart.
+ // "Left" path contains points with similarly on the left side.
+ // "Full" path contains rest of the points.
+ // This doesn't yield perfect results always. E.g. when segment covers more than 90
+ // degrees and both of the points are within the margin, one in the top half and one in the
+ // bottom half of the chart, the bottom one gets clipped incorrectly.
+ // However, this should be rare occurrence in any sensible chart.
+ currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
+ currentGeometryPoint = points.at(i);
+ pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
+
+ // Draw something unless both off-grid
+ if (!pointOffGrid || !previousPointWasOffGrid) {
+ bool dummyOk; // We know points are ok, but this is needed
+ qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
+ qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
+
+ if ((qAbs(currentAngle - previousAngle) > 180.0)) {
+ // If the angle between two points is over 180 degrees (half X range),
+ // any direct segment between them becomes meaningless.
+ // In this case two line segments are drawn instead, from previous
+ // point to the center and from center to current point.
+ if ((previousAngle < 0.0 || (previousAngle <= 180.0 && previousGeometryPoint.x() < rightMarginLine))
+ && previousGeometryPoint.y() < horizontal) {
+ currentSegmentPath = &splinePathRight;
+ } else if ((previousAngle > 360.0 || (previousAngle > 180.0 && previousGeometryPoint.x() > leftMarginLine))
+ && previousGeometryPoint.y() < horizontal) {
+ currentSegmentPath = &splinePathLeft;
+ } else if (previousAngle > 0.0 && previousAngle < 360.0) {
+ currentSegmentPath = &splinePath;
+ } else {
+ currentSegmentPath = 0;
+ }
+
+ if (currentSegmentPath) {
+ if (previousSegmentPath != currentSegmentPath)
+ currentSegmentPath->moveTo(previousGeometryPoint);
+ if (!previousSegmentPath)
+ fullPath.moveTo(previousGeometryPoint);
+
+ currentSegmentPath->lineTo(centerPoint);
+ fullPath.lineTo(centerPoint);
+ }
+
+ previousSegmentPath = currentSegmentPath;
+
+ if ((currentAngle < 0.0 || (currentAngle <= 180.0 && currentGeometryPoint.x() < rightMarginLine))
+ && currentGeometryPoint.y() < horizontal) {
+ currentSegmentPath = &splinePathRight;
+ } else if ((currentAngle > 360.0 || (currentAngle > 180.0 &&currentGeometryPoint.x() > leftMarginLine))
+ && currentGeometryPoint.y() < horizontal) {
+ currentSegmentPath = &splinePathLeft;
+ } else if (currentAngle > 0.0 && currentAngle < 360.0) {
+ currentSegmentPath = &splinePath;
+ } else {
+ currentSegmentPath = 0;
+ }
+
+ if (currentSegmentPath) {
+ if (previousSegmentPath != currentSegmentPath)
+ currentSegmentPath->moveTo(centerPoint);
+ if (!previousSegmentPath)
+ fullPath.moveTo(centerPoint);
+
+ currentSegmentPath->lineTo(currentGeometryPoint);
+ fullPath.lineTo(currentGeometryPoint);
+ }
+ } else {
+ QPointF cp1 = controlPoints[2 * (i - 1)];
+ QPointF cp2 = controlPoints[(2 * i) - 1];
+
+ if (previousAngle < 0.0 || currentAngle < 0.0
+ || ((previousAngle <= 180.0 && currentAngle <= 180.0)
+ && ((previousGeometryPoint.x() < rightMarginLine && previousGeometryPoint.y() < horizontal)
+ || (currentGeometryPoint.x() < rightMarginLine && currentGeometryPoint.y() < horizontal)))) {
+ currentSegmentPath = &splinePathRight;
+ } else if (previousAngle > 360.0 || currentAngle > 360.0
+ || ((previousAngle > 180.0 && currentAngle > 180.0)
+ && ((previousGeometryPoint.x() > leftMarginLine && previousGeometryPoint.y() < horizontal)
+ || (currentGeometryPoint.x() > leftMarginLine && currentGeometryPoint.y() < horizontal)))) {
+ currentSegmentPath = &splinePathLeft;
+ } else {
+ currentSegmentPath = &splinePath;
+ }
+
+ if (currentSegmentPath != previousSegmentPath)
+ currentSegmentPath->moveTo(previousGeometryPoint);
+ if (!previousSegmentPath)
+ fullPath.moveTo(previousGeometryPoint);
+
+ fullPath.cubicTo(cp1, cp2, currentGeometryPoint);
+ currentSegmentPath->cubicTo(cp1, cp2, currentGeometryPoint);
+ }
+ } else {
+ currentSegmentPath = 0;
+ }
+
+ previousPointWasOffGrid = pointOffGrid;
+ if (!pointOffGrid && m_pointsVisible && currentSeriesPoint.y() >= minY)
+ m_visiblePoints.append(currentGeometryPoint);
+ previousSegmentPath = currentSegmentPath;
+ previousGeometryPoint = currentGeometryPoint;
+ }
+
+ m_pathPolarRight = splinePathRight;
+ m_pathPolarLeft = splinePathLeft;
+ // Note: This construction of m_fullpath is not perfect. The partial segments that are
+ // outside left/right clip regions at axis boundary still generate hover/click events,
+ // because shape doesn't get clipped. It doesn't seem possible to do sensibly.
+ } else { // not polar
+ splinePath.moveTo(points.at(0));
+ for (int i = 0; i < points.size() - 1; i++) {
+ const QPointF &point = points.at(i + 1);
+ splinePath.cubicTo(controlPoints[2 * i], controlPoints[2 * i + 1], point);
+ }
+ fullPath = splinePath;
+ }
+
+ QPainterPathStroker stroker;
+ // The full path is comprised of three separate paths.
+ // This is why we are prepared for the "worst case" scenario, i.e. use always MiterJoin and
+ // multiply line width with square root of two when defining shape and bounding rectangle.
+ stroker.setWidth(margin);
+ stroker.setJoinStyle(Qt::MiterJoin);
+ stroker.setCapStyle(Qt::SquareCap);
+ stroker.setMiterLimit(m_linePen.miterLimit());
+
+ // Only zoom in if the bounding rects of the path fit inside int limits. QWidget::update() uses
+ // a region that has to be compatible with QRect.
+ QPainterPath checkShapePath = stroker.createStroke(fullPath);
+ if (checkShapePath.boundingRect().height() <= INT_MAX
+ && checkShapePath.boundingRect().width() <= INT_MAX
+ && splinePath.boundingRect().height() <= INT_MAX
+ && splinePath.boundingRect().width() <= INT_MAX) {
+ m_path = splinePath;
+
+ prepareGeometryChange();
+
+ m_fullPath = checkShapePath;
+ m_rect = m_fullPath.boundingRect();
+ }
+}
+
+/*!
+ Calculates control points which are needed by QPainterPath.cubicTo function to draw the cubic Bezier cureve between two points.
+ */
+QVector<QPointF> SplineChartItem::calculateControlPoints(const QVector<QPointF> &points)
+{
+ QVector<QPointF> controlPoints;
+ controlPoints.resize(points.count() * 2 - 2);
+
+ int n = points.count() - 1;
+
+ if (n == 1) {
+ //for n==1
+ controlPoints[0].setX((2 * points[0].x() + points[1].x()) / 3);
+ controlPoints[0].setY((2 * points[0].y() + points[1].y()) / 3);
+ controlPoints[1].setX(2 * controlPoints[0].x() - points[0].x());
+ controlPoints[1].setY(2 * controlPoints[0].y() - points[0].y());
+ return controlPoints;
+ }
+
+ // Calculate first Bezier control points
+ // Set of equations for P0 to Pn points.
+ //
+ // | 2 1 0 0 ... 0 0 0 ... 0 0 0 | | P1_1 | | P0 + 2 * P1 |
+ // | 1 4 1 0 ... 0 0 0 ... 0 0 0 | | P1_2 | | 4 * P1 + 2 * P2 |
+ // | 0 1 4 1 ... 0 0 0 ... 0 0 0 | | P1_3 | | 4 * P2 + 2 * P3 |
+ // | . . . . . . . . . . . . | | ... | | ... |
+ // | 0 0 0 0 ... 1 4 1 ... 0 0 0 | * | P1_i | = | 4 * P(i-1) + 2 * Pi |
+ // | . . . . . . . . . . . . | | ... | | ... |
+ // | 0 0 0 0 0 0 0 0 ... 1 4 1 | | P1_(n-1)| | 4 * P(n-2) + 2 * P(n-1) |
+ // | 0 0 0 0 0 0 0 0 ... 0 2 7 | | P1_n | | 8 * P(n-1) + Pn |
+ //
+ QVector<qreal> vector;
+ vector.resize(n);
+
+ vector[0] = points[0].x() + 2 * points[1].x();
+
+
+ for (int i = 1; i < n - 1; ++i)
+ vector[i] = 4 * points[i].x() + 2 * points[i + 1].x();
+
+ vector[n - 1] = (8 * points[n - 1].x() + points[n].x()) / 2.0;
+
+ QVector<qreal> xControl = firstControlPoints(vector);
+
+ vector[0] = points[0].y() + 2 * points[1].y();
+
+ for (int i = 1; i < n - 1; ++i)
+ vector[i] = 4 * points[i].y() + 2 * points[i + 1].y();
+
+ vector[n - 1] = (8 * points[n - 1].y() + points[n].y()) / 2.0;
+
+ QVector<qreal> yControl = firstControlPoints(vector);
+
+ for (int i = 0, j = 0; i < n; ++i, ++j) {
+
+ controlPoints[j].setX(xControl[i]);
+ controlPoints[j].setY(yControl[i]);
+
+ j++;
+
+ if (i < n - 1) {
+ controlPoints[j].setX(2 * points[i + 1].x() - xControl[i + 1]);
+ controlPoints[j].setY(2 * points[i + 1].y() - yControl[i + 1]);
+ } else {
+ controlPoints[j].setX((points[n].x() + xControl[n - 1]) / 2);
+ controlPoints[j].setY((points[n].y() + yControl[n - 1]) / 2);
+ }
+ }
+ return controlPoints;
+}
+
+QVector<qreal> SplineChartItem::firstControlPoints(const QVector<qreal>& vector)
+{
+ QVector<qreal> result;
+
+ int count = vector.count();
+ result.resize(count);
+ result[0] = vector[0] / 2.0;
+
+ QVector<qreal> temp;
+ temp.resize(count);
+ temp[0] = 0;
+
+ qreal b = 2.0;
+
+ for (int i = 1; i < count; i++) {
+ temp[i] = 1 / b;
+ b = (i < count - 1 ? 4.0 : 3.5) - temp[i];
+ result[i] = (vector[i] - result[i - 1]) / b;
+ }
+
+ for (int i = 1; i < count; i++)
+ result[count - i - 1] -= temp[count - i] * result[count - i];
+
+ return result;
+}
+
+//handlers
+
+void SplineChartItem::handleUpdated()
+{
+ setVisible(m_series->isVisible());
+ setOpacity(m_series->opacity());
+ m_pointsVisible = m_series->pointsVisible();
+ m_linePen = m_series->pen();
+ m_pointPen = m_series->pen();
+ m_pointPen.setWidthF(2 * m_pointPen.width());
+ m_pointLabelsFormat = m_series->pointLabelsFormat();
+ m_pointLabelsVisible = m_series->pointLabelsVisible();
+ m_pointLabelsFont = m_series->pointLabelsFont();
+ m_pointLabelsColor = m_series->pointLabelsColor();
+ update();
+}
+
+//painter
+
+void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(widget)
+ Q_UNUSED(option)
+
+ QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
+
+ painter->save();
+ painter->setPen(m_linePen);
+ painter->setBrush(Qt::NoBrush);
+
+ if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
+ qreal halfWidth = domain()->size().width() / 2.0;
+ QRectF clipRectLeft = QRectF(0, 0, halfWidth, domain()->size().height());
+ QRectF clipRectRight = QRectF(halfWidth, 0, halfWidth, domain()->size().height());
+ QRegion fullPolarClipRegion(clipRect.toRect(), QRegion::Ellipse);
+ QRegion clipRegionLeft(fullPolarClipRegion.intersected(clipRectLeft.toRect()));
+ QRegion clipRegionRight(fullPolarClipRegion.intersected(clipRectRight.toRect()));
+ painter->setClipRegion(clipRegionLeft);
+ painter->drawPath(m_pathPolarLeft);
+ painter->setClipRegion(clipRegionRight);
+ painter->drawPath(m_pathPolarRight);
+ painter->setClipRegion(fullPolarClipRegion);
+ } else {
+ painter->setClipRect(clipRect);
+ }
+
+ painter->drawPath(m_path);
+
+ if (m_pointsVisible) {
+ painter->setPen(m_pointPen);
+ if (m_series->chart()->chartType() == QChart::ChartTypePolar)
+ painter->drawPoints(m_visiblePoints);
+ else
+ painter->drawPoints(geometryPoints());
+ }
+
+ if (m_pointLabelsVisible)
+ m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2);
+
+ painter->restore();
+}
+
+void SplineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ emit XYChart::clicked(domain()->calculateDomainPoint(event->pos()));
+ QGraphicsItem::mousePressEvent(event);
+}
+
+void SplineChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), true);
+ QGraphicsItem::hoverEnterEvent(event);
+}
+
+void SplineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), false);
+ QGraphicsItem::hoverLeaveEvent(event);
+}
+
+#include "moc_splinechartitem_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/splinechart/splinechartitem_p.h b/src/charts/splinechart/splinechartitem_p.h
new file mode 100644
index 00000000..ac323e59
--- /dev/null
+++ b/src/charts/splinechart/splinechartitem_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef SPLINECHARTITEM_P_H
+#define SPLINECHARTITEM_P_H
+
+#include "qsplineseries.h"
+#include "xychart_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class SplineAnimation;
+
+class SplineChartItem : public XYChart
+{
+ Q_OBJECT
+ Q_INTERFACES(QGraphicsItem)
+public:
+ SplineChartItem(QSplineSeries *series, QGraphicsItem *item = 0);
+
+ //from QGraphicsItem
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ QPainterPath shape() const;
+
+ void setControlGeometryPoints(QVector<QPointF>& points);
+ QVector<QPointF> controlGeometryPoints() const;
+
+ void setAnimation(SplineAnimation *animation);
+ ChartAnimation *animation() const;
+
+public Q_SLOTS:
+ void handleUpdated();
+
+protected:
+ void updateGeometry();
+ QVector<QPointF> calculateControlPoints(const QVector<QPointF> &points);
+ QVector<qreal> firstControlPoints(const QVector<qreal>& vector);
+ void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index);
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+
+private:
+ QSplineSeries *m_series;
+ QPainterPath m_path;
+ QPainterPath m_pathPolarRight;
+ QPainterPath m_pathPolarLeft;
+ QPainterPath m_fullPath;
+ QRectF m_rect;
+ QPen m_linePen;
+ QPen m_pointPen;
+ bool m_pointsVisible;
+ QVector<QPointF> m_controlPoints;
+ QVector<QPointF> m_visiblePoints;
+ SplineAnimation *m_animation;
+
+ bool m_pointLabelsVisible;
+ QString m_pointLabelsFormat;
+ QFont m_pointLabelsFont;
+ QColor m_pointLabelsColor;
+
+ friend class SplineAnimation;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // SPLINECHARTITEM_P_H
diff --git a/src/charts/themes/charttheme_p.h b/src/charts/themes/charttheme_p.h
new file mode 100644
index 00000000..58510bd7
--- /dev/null
+++ b/src/charts/themes/charttheme_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEME_H
+#define CHARTTHEME_H
+
+#include "chartthememanager_p.h"
+#include <QColor>
+#include <QGradientStops>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartTheme
+{
+
+public:
+ enum BackgroundShadesMode {
+ BackgroundShadesNone = 0,
+ BackgroundShadesVertical,
+ BackgroundShadesHorizontal,
+ BackgroundShadesBoth
+ };
+
+protected:
+ explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id),
+ m_backgroundShadesBrush(Qt::SolidPattern),
+ m_backgroundShades(BackgroundShadesNone),
+ m_backgroundDropShadowEnabled(false)
+ {};
+public:
+ QChart::ChartTheme id() const { return m_id; }
+ QList<QGradient> seriesGradients() const { return m_seriesGradients; }
+ QList<QColor> seriesColors() const { return m_seriesColors; }
+ QLinearGradient chartBackgroundGradient() const { return m_chartBackgroundGradient; }
+ QFont masterFont() const { return m_masterFont; }
+ QFont labelFont() const { return m_labelFont; }
+ QBrush labelBrush() const { return m_labelBrush; }
+ QPen axisLinePen() const { return m_axisLinePen; }
+ QPen backgroundShadesPen() const { return m_backgroundShadesPen; }
+ QPen outlinePen() const { return m_outlinePen; }
+ QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; }
+ BackgroundShadesMode backgroundShades() const { return m_backgroundShades; }
+ bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; }
+ QPen girdLinePen() const { return m_gridLinePen; }
+
+protected:
+ QChart::ChartTheme m_id;
+ QList<QColor> m_seriesColors;
+ QList<QGradient> m_seriesGradients;
+ QLinearGradient m_chartBackgroundGradient;
+
+ QFont m_masterFont;
+ QFont m_labelFont;
+ QBrush m_labelBrush;
+ QPen m_axisLinePen;
+ QPen m_backgroundShadesPen;
+ QPen m_outlinePen;
+ QBrush m_backgroundShadesBrush;
+ BackgroundShadesMode m_backgroundShades;
+ bool m_backgroundDropShadowEnabled;
+ QPen m_gridLinePen;
+
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // CHARTTHEME_H
diff --git a/src/charts/themes/chartthemebluecerulean_p.h b/src/charts/themes/chartthemebluecerulean_p.h
new file mode 100644
index 00000000..83f1441a
--- /dev/null
+++ b/src/charts/themes/chartthemebluecerulean_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMEBLUECERULEAN_P_H
+#define CHARTTHEMEBLUECERULEAN_P_H
+
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeBlueCerulean: public ChartTheme
+{
+public:
+ ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) {
+ // Series colors
+ m_seriesColors << QRgb(0xc7e85b);
+ m_seriesColors << QRgb(0x1cb54f);
+ m_seriesColors << QRgb(0x5cbf9b);
+ m_seriesColors << QRgb(0x009fbf);
+ m_seriesColors << QRgb(0xee7392);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
+ backgroundGradient.setColorAt(0.0, QRgb(0x056189));
+ backgroundGradient.setColorAt(1.0, QRgb(0x101a31));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+
+ // Axes and other
+ m_labelBrush = QBrush(QRgb(0xffffff));
+ m_axisLinePen = QPen(QRgb(0xd6d6d6));
+ m_axisLinePen.setWidth(2);
+ m_gridLinePen = QPen(QRgb(0x84a2b0));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+ m_outlinePen = QPen(QRgb(0xebebeb));
+ m_outlinePen.setWidthF(2.0);
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/themes/chartthemeblueicy_p.h b/src/charts/themes/chartthemeblueicy_p.h
new file mode 100644
index 00000000..6dc6c9c4
--- /dev/null
+++ b/src/charts/themes/chartthemeblueicy_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMEBLUEICY_P_H
+#define CHARTTHEMEBLUEICY_P_H
+
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeBlueIcy: public ChartTheme
+{
+public:
+ ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy)
+ {
+ // Series colors
+ m_seriesColors << QRgb(0x3daeda);
+ m_seriesColors << QRgb(0x2685bf);
+ m_seriesColors << QRgb(0x0c2673);
+ m_seriesColors << QRgb(0x5f3dba);
+ m_seriesColors << QRgb(0x2fa3b4);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
+ backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
+ backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+ m_backgroundDropShadowEnabled = true;
+
+ // Axes and other
+ m_labelBrush = QBrush(QRgb(0x404044));
+ m_axisLinePen = QPen(QRgb(0xd6d6d6));
+ m_axisLinePen.setWidth(2);
+ m_gridLinePen = QPen(QRgb(0xe2e2e2));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+ m_outlinePen = QPen(QRgb(0x474747));
+ m_outlinePen.setWidthF(2.0);
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/themes/chartthemebluencs_p.h b/src/charts/themes/chartthemebluencs_p.h
new file mode 100644
index 00000000..7806fd02
--- /dev/null
+++ b/src/charts/themes/chartthemebluencs_p.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMEBLUENCS_P_H
+#define CHARTTHEMEBLUENCS_P_H
+
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeBlueNcs: public ChartTheme
+{
+public:
+ ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs)
+ {
+ // Series colors
+ m_seriesColors << QRgb(0x1db0da);
+ m_seriesColors << QRgb(0x1341a6);
+ m_seriesColors << QRgb(0x88d41e);
+ m_seriesColors << QRgb(0xff8e1a);
+ m_seriesColors << QRgb(0x398ca3);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient;
+ backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
+ backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+
+ // Axes and other
+ m_labelBrush = QBrush(QRgb(0x404044));
+ m_axisLinePen = QPen(QRgb(0xd6d6d6));
+ m_axisLinePen.setWidth(2);
+ m_gridLinePen = QPen(QRgb(0xe2e2e2));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+ m_outlinePen = QPen(QRgb(0x474747));
+ m_outlinePen.setWidthF(2.0);
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/themes/chartthemebrownsand_p.h b/src/charts/themes/chartthemebrownsand_p.h
new file mode 100644
index 00000000..9a980855
--- /dev/null
+++ b/src/charts/themes/chartthemebrownsand_p.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMEBROWNSAND_P_H
+#define CHARTTHEMEBROWNSAND_P_H
+
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeBrownSand: public ChartTheme
+{
+public:
+ ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand)
+ {
+ // Series colors
+ m_seriesColors << QRgb(0xb39b72);
+ m_seriesColors << QRgb(0xb3b376);
+ m_seriesColors << QRgb(0xc35660);
+ m_seriesColors << QRgb(0x536780);
+ m_seriesColors << QRgb(0x494345);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient;
+ backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0));
+ backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+
+ // Axes and other
+ m_labelBrush = QBrush(QRgb(0x404044));
+ m_axisLinePen = QPen(QRgb(0xb5b0a7));
+ m_axisLinePen.setWidth(2);
+ m_gridLinePen = QPen(QRgb(0xd4cec3));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+ m_outlinePen = QPen(QRgb(0x222222));
+ m_outlinePen.setWidthF(2.0);
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/themes/chartthemedark_p.h b/src/charts/themes/chartthemedark_p.h
new file mode 100644
index 00000000..6ad3eaf7
--- /dev/null
+++ b/src/charts/themes/chartthemedark_p.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMEDARK_P_H
+#define CHARTTHEMEDARK_P_H
+
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeDark : public ChartTheme
+{
+public:
+ ChartThemeDark() : ChartTheme(QChart::ChartThemeDark)
+ {
+ // Series colors
+ m_seriesColors << QRgb(0x38ad6b);
+ m_seriesColors << QRgb(0x3c84a7);
+ m_seriesColors << QRgb(0xeb8817);
+ m_seriesColors << QRgb(0x7b7f8c);
+ m_seriesColors << QRgb(0xbf593e);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
+ backgroundGradient.setColorAt(0.0, QRgb(0x2e303a));
+ backgroundGradient.setColorAt(1.0, QRgb(0x121218));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+
+ // Axes and other
+ m_labelBrush = QBrush(QRgb(0xffffff));
+ m_axisLinePen = QPen(QRgb(0x86878c));
+ m_axisLinePen.setWidth(2);
+ m_gridLinePen = QPen(QRgb(0x86878c));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+ m_outlinePen = QPen(QRgb(0xd6d6d6));
+ m_outlinePen.setWidthF(2.0);
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/themes/chartthemehighcontrast_p.h b/src/charts/themes/chartthemehighcontrast_p.h
new file mode 100644
index 00000000..353cc659
--- /dev/null
+++ b/src/charts/themes/chartthemehighcontrast_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMEHIGHCONTRAST_P_H
+#define CHARTTHEMEHIGHCONTRAST_P_H
+
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeHighContrast : public ChartTheme
+{
+public:
+ ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast)
+ {
+ // Series colors
+ m_seriesColors << QRgb(0x202020);
+ m_seriesColors << QRgb(0x596a74);
+ m_seriesColors << QRgb(0xffab03);
+ m_seriesColors << QRgb(0x038e9b);
+ m_seriesColors << QRgb(0xff4a41);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
+ backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
+ backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+ m_backgroundDropShadowEnabled = true;
+
+ // Axes and other
+ m_labelBrush = QBrush(QRgb(0x181818));
+ m_axisLinePen = QPen(QRgb(0x8c8c8c));
+ m_axisLinePen.setWidth(2);
+ m_gridLinePen = QPen(QRgb(0x8c8c8c));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShadesBrush = QBrush(QRgb(0xffeecd));
+ m_backgroundShades = BackgroundShadesHorizontal;
+ m_outlinePen = QPen(QColor(Qt::black));
+ m_outlinePen.setWidthF(2.0);
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/themes/chartthemelight_p.h b/src/charts/themes/chartthemelight_p.h
new file mode 100644
index 00000000..161c3567
--- /dev/null
+++ b/src/charts/themes/chartthemelight_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMELIGHT_P_H
+#define CHARTTHEMELIGHT_P_H
+
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeLight: public ChartTheme
+{
+public:
+ ChartThemeLight() : ChartTheme(QChart::ChartThemeLight)
+ {
+ // Series colors
+ m_seriesColors << QRgb(0x209fdf);
+ m_seriesColors << QRgb(0x99ca53);
+ m_seriesColors << QRgb(0xf6a625);
+ m_seriesColors << QRgb(0x6d5fd5);
+ m_seriesColors << QRgb(0xbf593e);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient;
+ backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
+ backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+ // There is a performance issue in the drop shadow implementation, so disabled for now
+// m_backgroundDropShadowEnabled = true;
+
+ // Axes and other
+ m_axisLinePen = QPen(0xd6d6d6);
+ m_axisLinePen.setWidth(1);
+ m_labelBrush = QBrush(QRgb(0x404044));
+ m_gridLinePen = QPen(QRgb(0xe2e2e2));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+ m_outlinePen = QPen(0x4d4d4d);
+ m_outlinePen.setWidthF(2.0);
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/themes/chartthemeqt_p.h b/src/charts/themes/chartthemeqt_p.h
new file mode 100644
index 00000000..06c10eee
--- /dev/null
+++ b/src/charts/themes/chartthemeqt_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMEQT_P_H
+#define CHARTTHEMEQT_P_H
+
+#include "charttheme_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeQt : public ChartTheme
+{
+public:
+ ChartThemeQt() : ChartTheme(QChart::ChartThemeQt)
+ {
+ // Series colors
+ m_seriesColors << QRgb(0x80c342);
+ m_seriesColors << QRgb(0x328930);
+ m_seriesColors << QRgb(0x006325);
+ m_seriesColors << QRgb(0x35322f);
+ m_seriesColors << QRgb(0x5d5b59);
+ m_seriesColors << QRgb(0x868482);
+ m_seriesColors << QRgb(0xaeadac);
+ m_seriesColors << QRgb(0xd7d6d5);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
+ backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
+ backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+
+ // Axes and other
+ m_labelBrush = QBrush(QRgb(0x35322f));
+ m_axisLinePen = QPen(QRgb(0xd7d6d5));
+ m_axisLinePen.setWidth(1);
+ m_gridLinePen = QPen(QRgb(0xd7d6d5));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+ m_outlinePen = QPen(QRgb(0x35322f));
+ m_outlinePen.setWidthF(2.0);
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/themes/chartthemesystem_p.h b/src/charts/themes/chartthemesystem_p.h
new file mode 100644
index 00000000..8d99d5b1
--- /dev/null
+++ b/src/charts/themes/chartthemesystem_p.h
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef CHARTTHEMESYSTEM_P_H
+#define CHARTTHEMESYSTEM_P_H
+
+#include "charttheme_p.h"
+#ifdef Q_OS_WIN
+#include <windows.h>
+#include <stdio.h>
+#endif
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartThemeSystem: public ChartTheme
+{
+public:
+ // System theme not used at the moment (the user is not able to select this theme)
+ ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/)
+ {
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+ // We could also use theme specific window frame color as a series base color (it would give more
+ // variation to the base colors in addition to the blue and black used now)
+
+ // First series base color from COLOR_HIGHLIGHT
+ DWORD colorHighlight;
+ colorHighlight = GetSysColor(COLOR_HIGHLIGHT);
+ m_seriesColors.append(QColor(GetRValue(colorHighlight),
+ GetGValue(colorHighlight),
+ GetBValue(colorHighlight)));
+
+ // Second series base color from COLOR_WINDOWFRAME
+ DWORD colorWindowFrame;
+ colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME);
+ m_seriesColors.append(QColor(GetRValue(colorWindowFrame),
+ GetGValue(colorWindowFrame),
+ GetBValue(colorWindowFrame)));
+
+ // Third series base color from the middle of the COLOR_ACTIVECAPTION /
+ // COLOR_GRADIENTACTIVECAPTION gradient
+ DWORD colorGradientActiveCaptionLeft;
+ colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION);
+ DWORD colorGradientActiveCaptionRight;
+ colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION);
+ QLinearGradient g;
+ QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft),
+ GetGValue(colorGradientActiveCaptionLeft),
+ GetBValue(colorGradientActiveCaptionLeft));
+ g.setColorAt(0.0, start);
+ QColor end = QColor(GetRValue(colorGradientActiveCaptionRight),
+ GetGValue(colorGradientActiveCaptionRight),
+ GetBValue(colorGradientActiveCaptionRight));
+ g.setColorAt(1.0, end);
+ m_seriesColors.append(ChartThemeManager::colorAt(g, 0.5));
+
+ // Generate gradients from the base colors
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background fill color from COLOR_WINDOW
+ QLinearGradient backgroundGradient;
+ DWORD colorWindow;
+ colorWindow = GetSysColor(COLOR_WINDOW);
+ backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow),
+ GetGValue(colorWindow),
+ GetBValue(colorWindow)));
+ backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow),
+ GetGValue(colorWindow),
+ GetBValue(colorWindow)));
+ // Axes and other
+ m_axisLinePen = QPen(0xd6d6d6);
+ m_axisLinePen.setWidth(1);
+ m_labelBrush = QBrush(QRgb(0x404044));
+ m_gridLinePen = QPen(QRgb(0xe2e2e2));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+
+#elif defined(Q_OS_LINUX)
+ // Using a hard coded theme for Linux system theme
+ m_seriesColors << QRgb(0x60a6e6);
+ m_seriesColors << QRgb(0x92ca66);
+ m_seriesColors << QRgb(0xeba85f);
+ m_seriesColors << QRgb(0xfc5751);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient;
+ backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
+ backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+
+ // Axes and other
+ m_axisLinePen = QPen(0xd6d6d6);
+ m_axisLinePen.setWidth(1);
+ m_labelBrush = QBrush(QRgb(0x404044));
+ m_gridLinePen = QPen(QRgb(0xe2e2e2));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+
+#elif defined(Q_OS_MAC)
+ // Using a hard coded theme for OSX system theme; the colors match the OSX 10.7 colors
+ m_seriesColors << QRgb(0x60a6e6);
+ m_seriesColors << QRgb(0x92ca66);
+ m_seriesColors << QRgb(0xeba85f);
+ m_seriesColors << QRgb(0xfc5751);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient;
+ backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
+ backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+
+ // Axes and other
+ m_axisLinePen = QPen(0xd6d6d6);
+ m_axisLinePen.setWidth(1);
+ m_labelBrush = QBrush(QRgb(0x404044));
+ m_gridLinePen = QPen(QRgb(0xe2e2e2));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+
+#else
+ // Hard coded theme
+ m_seriesColors << QRgb(0x60a6e6);
+ m_seriesColors << QRgb(0x92ca66);
+ m_seriesColors << QRgb(0xeba85f);
+ m_seriesColors << QRgb(0xfc5751);
+ m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
+
+ // Background
+ QLinearGradient backgroundGradient;
+ backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
+ backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
+ backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
+ m_chartBackgroundGradient = backgroundGradient;
+
+ // Axes and other
+ m_axisLinePen = QPen(0xd6d6d6);
+ m_axisLinePen.setWidth(1);
+ m_labelBrush = QBrush(QRgb(0x404044));
+ m_gridLinePen = QPen(QRgb(0xe2e2e2));
+ m_gridLinePen.setWidth(1);
+ m_backgroundShades = BackgroundShadesNone;
+#endif
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // CHARTTHEMESYSTEM_P_H
diff --git a/src/themes/themes.pri b/src/charts/themes/themes.pri
index 656552af..656552af 100644
--- a/src/themes/themes.pri
+++ b/src/charts/themes/themes.pri
diff --git a/src/charts/xychart/qhxymodelmapper.cpp b/src/charts/xychart/qhxymodelmapper.cpp
new file mode 100644
index 00000000..4edc8aeb
--- /dev/null
+++ b/src/charts/xychart/qhxymodelmapper.cpp
@@ -0,0 +1,243 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qhxymodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QHXYModelMapper
+ \inmodule Qt Charts
+ \brief Horizontal model mapper for QXYSeries.
+ \mainclass
+
+ Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
+ Horizontal model mapper is used to create a connection between QXYSeries and QAbstractItemModel derived model object.
+ It is possible to use both QAbstractItemModel and QXYSeries model API. QXYModelMapper makes sure that QXYSeries and the model are kept in sync.
+ Note: used model has to support adding/removing rows/columns and modifying the data of the cells.
+*/
+/*!
+ \qmltype HXYModelMapper
+ \instantiates QHXYModelMapper
+ \inqmlmodule QtCharts
+
+ \brief Horizontal model mapper for QXYSeries
+
+ HXYModelMapper allows you to use your own QAbstractItemModel derived model with data in rows as
+ a data source for XYSeries based series. It is possible to use both QAbstractItemModel and
+ XYSeries data API to manipulate data. HXYModelMapper keeps the series and the model in sync.
+*/
+
+/*!
+ \property QHXYModelMapper::series
+ \brief Defines the QXYSeries object that is used by the mapper.
+
+ All the data in the series is discarded when it is set to the mapper.
+ When new series is specified the old series is disconnected (it preserves its data)
+*/
+/*!
+ \qmlproperty XYSeries HXYModelMapper::series
+ Defines the XYSeries object that is used by the mapper. All the data in the series is discarded when it is set to
+ the mapper. When new series is specified the old series is disconnected (it preserves its data).
+*/
+
+/*!
+ \property QHXYModelMapper::model
+ \brief Defines the model that is used by the mapper.
+*/
+/*!
+ \qmlproperty SomeModel HXYModelMapper::model
+ The QAbstractItemModel based model that is used by the mapper. You need to implement the model
+ and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
+ the data of the cells.
+*/
+
+/*!
+ \property QHXYModelMapper::xRow
+ \brief Defines which row of the model is kept in sync with the x values of the QXYSeries.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int HXYModelMapper::xRow
+ Defines which row of the model is kept in sync with the x values of the series. Default value is -1 (invalid
+ mapping).
+*/
+
+/*!
+ \property QHXYModelMapper::yRow
+ \brief Defines which row of the model is kept in sync with the y values of the QXYSeries.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int HXYModelMapper::yRow
+ Defines which row of the model is kept in sync with the y values of the series. Default value is -1
+ (invalid mapping).
+*/
+
+/*!
+ \property QHXYModelMapper::firstColumn
+ \brief Defines which column of the model contains the data for the first point of the series.
+
+ Minimal and default value is: 0
+*/
+/*!
+ \qmlproperty int HXYModelMapper::firstColumn
+ Defines which column of the model contains the data for the first point of the series.
+ The default value is 0.
+*/
+
+/*!
+ \property QHXYModelMapper::columnCount
+ \brief Defines the number of columns of the model that are mapped as the data for series.
+
+ Minimal and default value is: -1 (count limited by the number of columns in the model)
+*/
+/*!
+ \qmlproperty int HXYModelMapper::columnCount
+ Defines the number of columns of the model that are mapped as the data for series. The default value is
+ -1 (count limited by the number of columns in the model)
+*/
+
+/*!
+ \fn void QHXYModelMapper::seriesReplaced()
+
+ Emitted when the series to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QHXYModelMapper::modelReplaced()
+
+ Emitted when the model to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QHXYModelMapper::xRowChanged()
+
+ Emitted when the xRow has changed.
+*/
+
+/*!
+ \fn void QHXYModelMapper::yRowChanged()
+
+ Emitted when the yRow has changed.
+*/
+
+/*!
+ \fn void QHXYModelMapper::firstColumnChanged()
+ Emitted when the firstColumn has changed.
+*/
+
+/*!
+ \fn void QHXYModelMapper::columnCountChanged()
+ Emitted when the columnCount has changed.
+*/
+
+/*!
+ Constructs a mapper object which is a child of \a parent.
+*/
+QHXYModelMapper::QHXYModelMapper(QObject *parent) :
+ QXYModelMapper(parent)
+{
+ QXYModelMapper::setOrientation(Qt::Horizontal);
+}
+
+QAbstractItemModel *QHXYModelMapper::model() const
+{
+ return QXYModelMapper::model();
+}
+
+void QHXYModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model != QXYModelMapper::model()) {
+ QXYModelMapper::setModel(model);
+ emit modelReplaced();
+ }
+}
+
+QXYSeries *QHXYModelMapper::series() const
+{
+ return QXYModelMapper::series();
+}
+
+void QHXYModelMapper::setSeries(QXYSeries *series)
+{
+ if (series != QXYModelMapper::series()) {
+ QXYModelMapper::setSeries(series);
+ emit seriesReplaced();
+ }
+}
+
+int QHXYModelMapper::xRow() const
+{
+ return QXYModelMapper::xSection();
+}
+
+void QHXYModelMapper::setXRow(int xRow)
+{
+ if (xRow != xSection()) {
+ QXYModelMapper::setXSection(xRow);
+ emit xRowChanged();
+ }
+}
+
+int QHXYModelMapper::yRow() const
+{
+ return QXYModelMapper::ySection();
+}
+
+void QHXYModelMapper::setYRow(int yRow)
+{
+ if (yRow != ySection()) {
+ QXYModelMapper::setYSection(yRow);
+ emit yRowChanged();
+ }
+}
+
+int QHXYModelMapper::firstColumn() const
+{
+ return first();
+}
+
+void QHXYModelMapper::setFirstColumn(int firstColumn)
+{
+ if (firstColumn != first()) {
+ setFirst(firstColumn);
+ emit firstColumnChanged();
+ }
+}
+
+int QHXYModelMapper::columnCount() const
+{
+ return count();
+}
+
+void QHXYModelMapper::setColumnCount(int columnCount)
+{
+ if (columnCount != count()) {
+ setCount(columnCount);
+ emit columnCountChanged();
+ }
+}
+
+#include "moc_qhxymodelmapper.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/xychart/qhxymodelmapper.h b/src/charts/xychart/qhxymodelmapper.h
new file mode 100644
index 00000000..cc95da4d
--- /dev/null
+++ b/src/charts/xychart/qhxymodelmapper.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHXYMODELMAPPER_H
+#define QHXYMODELMAPPER_H
+
+#include <QtCharts/QXYModelMapper>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/* Comment line for syncqt to generate the fwd-include correctly, due to QTBUG-22432 */
+class QT_CHARTS_EXPORT QHXYModelMapper : public QXYModelMapper
+{
+ Q_OBJECT
+ Q_PROPERTY(QXYSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
+ Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
+ Q_PROPERTY(int xRow READ xRow WRITE setXRow NOTIFY xRowChanged)
+ Q_PROPERTY(int yRow READ yRow WRITE setYRow NOTIFY yRowChanged)
+ Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged)
+ Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
+
+public:
+ explicit QHXYModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QXYSeries *series() const;
+ void setSeries(QXYSeries *series);
+
+ int xRow() const;
+ void setXRow(int xRow);
+
+ int yRow() const;
+ void setYRow(int yRow);
+
+ int firstColumn() const;
+ void setFirstColumn(int firstColumn);
+
+ int columnCount() const;
+ void setColumnCount(int columnCount);
+
+Q_SIGNALS:
+ void seriesReplaced();
+ void modelReplaced();
+ void xRowChanged();
+ void yRowChanged();
+ void firstColumnChanged();
+ void columnCountChanged();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QHXYMODELMAPPER_H
diff --git a/src/charts/xychart/qvxymodelmapper.cpp b/src/charts/xychart/qvxymodelmapper.cpp
new file mode 100644
index 00000000..6ede138e
--- /dev/null
+++ b/src/charts/xychart/qvxymodelmapper.cpp
@@ -0,0 +1,243 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qvxymodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QVXYModelMapper
+ \inmodule Qt Charts
+ \brief Vertical model mapper for QXYSeries.
+ \mainclass
+
+ Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
+ Vertical model mapper is used to create a connection between QXYSeries and QAbstractItemModel derived model object.
+ It is possible to use both QAbstractItemModel and QXYSeries model API. QXYModelMapper makes sure that QXYSeries and the model are kept in sync.
+ Note: used model has to support adding/removing rows/columns and modifying the data of the cells.
+*/
+/*!
+ \qmltype VXYModelMapper
+ \instantiates QVXYModelMapper
+ \inqmlmodule QtCharts
+
+ \brief Vertical model mapper for QXYSeries.
+
+ VXYModelMapper allows you to use your own QAbstractItemModel derived model with data in columns
+ as a data source for XYSeries based series. It is possible to use both QAbstractItemModel and
+ XYSeries data API to manipulate data. VXYModelMapper keeps the series and the model in sync.
+*/
+
+/*!
+ \property QVXYModelMapper::series
+ \brief Defines the QXYSeries object that is used by the mapper.
+
+ All the data in the series is discarded when it is set to the mapper.
+ When new series is specified the old series is disconnected (it preserves its data)
+*/
+/*!
+ \qmlproperty XYSeries VXYModelMapper::series
+ Defines the XYSeries object that is used by the mapper. All the data in the series is discarded when it is set to
+ the mapper. When new series is specified the old series is disconnected (it preserves its data).
+*/
+
+/*!
+ \property QVXYModelMapper::model
+ \brief Defines the model that is used by the mapper.
+*/
+/*!
+ \qmlproperty SomeModel VXYModelMapper::model
+ The QAbstractItemModel based model that is used by the mapper. You need to implement the model
+ and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
+ the data of the cells.
+*/
+
+/*!
+ \property QVXYModelMapper::xColumn
+ \brief Defines which column of the model is kept in sync with the x values of QXYSeries.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int VXYModelMapper::xColumn
+ Defines which column of the model is kept in sync with the x values of the series. Default value is -1 (invalid
+ mapping).
+*/
+
+/*!
+ \property QVXYModelMapper::yColumn
+ \brief Defines which column of the model is kept in sync with the y values of QXYSeries.
+
+ Default value is: -1 (invalid mapping)
+*/
+/*!
+ \qmlproperty int VXYModelMapper::yColumn
+ Defines which column of the model is kept in sync with the y values of the series. Default value is -1 (invalid
+ mapping).
+*/
+
+/*!
+ \property QVXYModelMapper::firstRow
+ \brief Defines which row of the model contains the data for the first point of the series.
+
+ Minimal and default value is: 0
+*/
+/*!
+ \qmlproperty int VXYModelMapper::firstRow
+ Defines which row of the model contains the data for the first point of the series.
+ The default value is 0.
+*/
+
+/*!
+ \property QVXYModelMapper::rowCount
+ \brief Defines the number of rows of the model that are mapped as the data for series.
+
+ Minimal and default value is: -1 (count limited by the number of rows in the model)
+*/
+/*!
+ \qmlproperty int VXYModelMapper::columnCount
+ Defines the number of rows of the model that are mapped as the data for series. The default value is
+ -1 (count limited by the number of rows in the model).
+*/
+
+/*!
+ \fn void QVXYModelMapper::seriesReplaced()
+
+ Emitted when the series to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QVXYModelMapper::modelReplaced()
+
+ Emitted when the model to which mapper is connected to has changed.
+*/
+
+/*!
+ \fn void QVXYModelMapper::xColumnChanged()
+
+ Emitted when the xColumn has changed.
+*/
+
+/*!
+ \fn void QVXYModelMapper::yColumnChanged()
+
+ Emitted when the yColumn has changed.
+*/
+
+/*!
+ \fn void QVXYModelMapper::firstRowChanged()
+ Emitted when the firstRow has changed.
+*/
+
+/*!
+ \fn void QVXYModelMapper::rowCountChanged()
+ Emitted when the rowCount has changed.
+*/
+
+/*!
+ Constructs a mapper object which is a child of \a parent.
+*/
+QVXYModelMapper::QVXYModelMapper(QObject *parent) :
+ QXYModelMapper(parent)
+{
+ QXYModelMapper::setOrientation(Qt::Vertical);
+}
+
+QAbstractItemModel *QVXYModelMapper::model() const
+{
+ return QXYModelMapper::model();
+}
+
+void QVXYModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model != QXYModelMapper::model()) {
+ QXYModelMapper::setModel(model);
+ emit modelReplaced();
+ }
+}
+
+QXYSeries *QVXYModelMapper::series() const
+{
+ return QXYModelMapper::series();
+}
+
+void QVXYModelMapper::setSeries(QXYSeries *series)
+{
+ if (series != QXYModelMapper::series()) {
+ QXYModelMapper::setSeries(series);
+ emit seriesReplaced();
+ }
+}
+
+int QVXYModelMapper::xColumn() const
+{
+ return QXYModelMapper::xSection();
+}
+
+void QVXYModelMapper::setXColumn(int xColumn)
+{
+ if (xColumn != xSection()) {
+ QXYModelMapper::setXSection(xColumn);
+ emit xColumnChanged();
+ }
+}
+
+int QVXYModelMapper::yColumn() const
+{
+ return QXYModelMapper::ySection();
+}
+
+void QVXYModelMapper::setYColumn(int yColumn)
+{
+ if (yColumn != ySection()) {
+ QXYModelMapper::setYSection(yColumn);
+ emit yColumnChanged();
+ }
+}
+
+int QVXYModelMapper::firstRow() const
+{
+ return first();
+}
+
+void QVXYModelMapper::setFirstRow(int firstRow)
+{
+ if (firstRow != first()) {
+ setFirst(firstRow);
+ emit firstRowChanged();
+ }
+}
+
+int QVXYModelMapper::rowCount() const
+{
+ return count();
+}
+
+void QVXYModelMapper::setRowCount(int rowCount)
+{
+ if (rowCount != count()) {
+ setCount(rowCount);
+ emit rowCountChanged();
+ }
+}
+
+#include "moc_qvxymodelmapper.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/xychart/qvxymodelmapper.h b/src/charts/xychart/qvxymodelmapper.h
new file mode 100644
index 00000000..fa6301d0
--- /dev/null
+++ b/src/charts/xychart/qvxymodelmapper.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVXYMODELMAPPER_H
+#define QVXYMODELMAPPER_H
+
+#include <QtCharts/QXYModelMapper>
+
+QT_CHARTS_BEGIN_NAMESPACE
+/* Comment line for syncqt to generate the fwd-include correctly, due to QTBUG-22432 */
+class QT_CHARTS_EXPORT QVXYModelMapper : public QXYModelMapper
+{
+ Q_OBJECT
+ Q_PROPERTY(QXYSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
+ Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
+ Q_PROPERTY(int xColumn READ xColumn WRITE setXColumn NOTIFY xColumnChanged)
+ Q_PROPERTY(int yColumn READ yColumn WRITE setYColumn NOTIFY yColumnChanged)
+ Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
+ Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
+
+public:
+ explicit QVXYModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QXYSeries *series() const;
+ void setSeries(QXYSeries *series);
+
+ int xColumn() const;
+ void setXColumn(int xColumn);
+
+ int yColumn() const;
+ void setYColumn(int yColumn);
+
+ int firstRow() const;
+ void setFirstRow(int firstRow);
+
+ int rowCount() const;
+ void setRowCount(int rowCount);
+
+Q_SIGNALS:
+ void seriesReplaced();
+ void modelReplaced();
+ void xColumnChanged();
+ void yColumnChanged();
+ void firstRowChanged();
+ void rowCountChanged();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QVXYMODELMAPPER_H
diff --git a/src/charts/xychart/qxymodelmapper.cpp b/src/charts/xychart/qxymodelmapper.cpp
new file mode 100644
index 00000000..3907326d
--- /dev/null
+++ b/src/charts/xychart/qxymodelmapper.cpp
@@ -0,0 +1,533 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxymodelmapper.h"
+#include "qxymodelmapper_p.h"
+#include "qxyseries.h"
+#include <QAbstractItemModel>
+#include <QDateTime>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ Constructs a mapper object which is a child of \a parent.
+*/
+QXYModelMapper::QXYModelMapper(QObject *parent)
+ : QObject(parent),
+ d_ptr(new QXYModelMapperPrivate(this))
+{
+}
+
+/*!
+ \internal
+*/
+QAbstractItemModel *QXYModelMapper::model() const
+{
+ Q_D(const QXYModelMapper);
+ return d->m_model;
+}
+
+/*!
+ \internal
+*/
+void QXYModelMapper::setModel(QAbstractItemModel *model)
+{
+ if (model == 0)
+ return;
+
+ Q_D(QXYModelMapper);
+ if (d->m_model)
+ disconnect(d->m_model, 0, d, 0);
+
+ d->m_model = model;
+ d->initializeXYFromModel();
+ // connect signals from the model
+ connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
+ connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
+ connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
+}
+
+/*!
+ \internal
+*/
+QXYSeries *QXYModelMapper::series() const
+{
+ Q_D(const QXYModelMapper);
+ return d->m_series;
+}
+
+/*!
+ \internal
+*/
+void QXYModelMapper::setSeries(QXYSeries *series)
+{
+ Q_D(QXYModelMapper);
+ if (d->m_series)
+ disconnect(d->m_series, 0, d, 0);
+
+ if (series == 0)
+ return;
+
+ d->m_series = series;
+ d->initializeXYFromModel();
+ // connect the signals from the series
+ connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int)));
+ connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int)));
+ connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int)));
+ connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
+}
+
+/*!
+ \internal
+*/
+int QXYModelMapper::first() const
+{
+ Q_D(const QXYModelMapper);
+ return d->m_first;
+}
+
+/*!
+ \internal
+*/
+void QXYModelMapper::setFirst(int first)
+{
+ Q_D(QXYModelMapper);
+ d->m_first = qMax(first, 0);
+ d->initializeXYFromModel();
+}
+
+/*!
+ \internal
+*/
+int QXYModelMapper::count() const
+{
+ Q_D(const QXYModelMapper);
+ return d->m_count;
+}
+
+/*!
+ \internal
+*/
+void QXYModelMapper::setCount(int count)
+{
+ Q_D(QXYModelMapper);
+ d->m_count = qMax(count, -1);
+ d->initializeXYFromModel();
+}
+
+/*!
+ Returns the orientation that is used when QXYModelMapper accesses the model.
+ This mean whether the consecutive x/y values of the QXYSeries are read from rows (Qt::Horizontal)
+ or from columns (Qt::Vertical)
+*/
+Qt::Orientation QXYModelMapper::orientation() const
+{
+ Q_D(const QXYModelMapper);
+ return d->m_orientation;
+}
+
+/*!
+ Returns the \a orientation that is used when QXYModelMapper accesses the model.
+ This mean whether the consecutive x/y values of the QXYSeries are read from rows (Qt::Horizontal)
+ or from columns (Qt::Vertical)
+*/
+void QXYModelMapper::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QXYModelMapper);
+ d->m_orientation = orientation;
+ d->initializeXYFromModel();
+}
+
+/*!
+ Returns which section of the model is kept in sync with the x values of the QXYSeries
+*/
+int QXYModelMapper::xSection() const
+{
+ Q_D(const QXYModelMapper);
+ return d->m_xSection;
+}
+
+/*!
+ Sets the model section that is kept in sync with the x values of the QXYSeries.
+ Parameter \a xSection specifies the section of the model.
+*/
+void QXYModelMapper::setXSection(int xSection)
+{
+ Q_D(QXYModelMapper);
+ d->m_xSection = qMax(-1, xSection);
+ d->initializeXYFromModel();
+}
+
+/*!
+ Returns which section of the model is kept in sync with the y values of the QXYSeries
+*/
+int QXYModelMapper::ySection() const
+{
+ Q_D(const QXYModelMapper);
+ return d->m_ySection;
+}
+
+/*!
+ Sets the model section that is kept in sync with the y values of the QXYSeries.
+ Parameter \a ySection specifies the section of the model.
+*/
+void QXYModelMapper::setYSection(int ySection)
+{
+ Q_D(QXYModelMapper);
+ d->m_ySection = qMax(-1, ySection);
+ d->initializeXYFromModel();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+QXYModelMapperPrivate::QXYModelMapperPrivate(QXYModelMapper *q) :
+ QObject(q),
+ m_series(0),
+ m_model(0),
+ m_first(0),
+ m_count(-1),
+ m_orientation(Qt::Vertical),
+ m_xSection(-1),
+ m_ySection(-1),
+ m_seriesSignalsBlock(false),
+ m_modelSignalsBlock(false),
+ q_ptr(q)
+{
+}
+
+void QXYModelMapperPrivate::blockModelSignals(bool block)
+{
+ m_modelSignalsBlock = block;
+}
+
+void QXYModelMapperPrivate::blockSeriesSignals(bool block)
+{
+ m_seriesSignalsBlock = block;
+}
+
+QModelIndex QXYModelMapperPrivate::xModelIndex(int xPos)
+{
+ if (m_count != -1 && xPos >= m_count)
+ return QModelIndex(); // invalid
+
+ if (m_orientation == Qt::Vertical)
+ return m_model->index(xPos + m_first, m_xSection);
+ else
+ return m_model->index(m_xSection, xPos + m_first);
+}
+
+QModelIndex QXYModelMapperPrivate::yModelIndex(int yPos)
+{
+ if (m_count != -1 && yPos >= m_count)
+ return QModelIndex(); // invalid
+
+ if (m_orientation == Qt::Vertical)
+ return m_model->index(yPos + m_first, m_ySection);
+ else
+ return m_model->index(m_ySection, yPos + m_first);
+}
+
+qreal QXYModelMapperPrivate::valueFromModel(QModelIndex index)
+{
+ QVariant value = m_model->data(index, Qt::DisplayRole);
+ switch (value.type()) {
+ case QVariant::DateTime:
+ return value.toDateTime().toMSecsSinceEpoch();
+ case QVariant::Date:
+ return QDateTime(value.toDate()).toMSecsSinceEpoch();
+ default:
+ return value.toReal();
+ }
+}
+
+void QXYModelMapperPrivate::setValueToModel(QModelIndex index, qreal value)
+{
+ QVariant oldValue = m_model->data(index, Qt::DisplayRole);
+ switch (oldValue.type()) {
+ case QVariant::DateTime:
+ m_model->setData(index, QDateTime::fromMSecsSinceEpoch(value));
+ break;
+ case QVariant::Date:
+ m_model->setData(index, QDateTime::fromMSecsSinceEpoch(value).date());
+ break;
+ default:
+ m_model->setData(index, value);
+ }
+}
+
+void QXYModelMapperPrivate::handlePointAdded(int pointPos)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (m_count != -1)
+ m_count += 1;
+
+ blockModelSignals();
+ if (m_orientation == Qt::Vertical)
+ m_model->insertRows(pointPos + m_first, 1);
+ else
+ m_model->insertColumns(pointPos + m_first, 1);
+
+ setValueToModel(xModelIndex(pointPos), m_series->points().at(pointPos).x());
+ setValueToModel(yModelIndex(pointPos), m_series->points().at(pointPos).y());
+ blockModelSignals(false);
+}
+
+void QXYModelMapperPrivate::handlePointRemoved(int pointPos)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ if (m_count != -1)
+ m_count -= 1;
+
+ blockModelSignals();
+ if (m_orientation == Qt::Vertical)
+ m_model->removeRow(pointPos + m_first);
+ else
+ m_model->removeColumn(pointPos + m_first);
+ blockModelSignals(false);
+}
+
+void QXYModelMapperPrivate::handlePointReplaced(int pointPos)
+{
+ if (m_seriesSignalsBlock)
+ return;
+
+ blockModelSignals();
+ setValueToModel(xModelIndex(pointPos), m_series->points().at(pointPos).x());
+ setValueToModel(yModelIndex(pointPos), m_series->points().at(pointPos).y());
+ blockModelSignals(false);
+}
+
+void QXYModelMapperPrivate::handleSeriesDestroyed()
+{
+ m_series = 0;
+}
+
+void QXYModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ QModelIndex index;
+ QPointF oldPoint;
+ QPointF newPoint;
+ for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
+ for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
+ index = topLeft.sibling(row, column);
+ if (m_orientation == Qt::Vertical && (index.column() == m_xSection || index.column() == m_ySection)) {
+ if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) {
+ QModelIndex xIndex = xModelIndex(index.row() - m_first);
+ QModelIndex yIndex = yModelIndex(index.row() - m_first);
+ if (xIndex.isValid() && yIndex.isValid()) {
+ oldPoint = m_series->points().at(index.row() - m_first);
+ newPoint.setX(valueFromModel(xIndex));
+ newPoint.setY(valueFromModel(yIndex));
+ }
+ }
+ } else if (m_orientation == Qt::Horizontal && (index.row() == m_xSection || index.row() == m_ySection)) {
+ if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) {
+ QModelIndex xIndex = xModelIndex(index.column() - m_first);
+ QModelIndex yIndex = yModelIndex(index.column() - m_first);
+ if (xIndex.isValid() && yIndex.isValid()) {
+ oldPoint = m_series->points().at(index.column() - m_first);
+ newPoint.setX(valueFromModel(xIndex));
+ newPoint.setY(valueFromModel(yIndex));
+ }
+ }
+ } else {
+ continue;
+ }
+ m_series->replace(oldPoint, newPoint);
+ }
+ }
+ blockSeriesSignals(false);
+}
+
+void QXYModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent);
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Vertical)
+ insertData(start, end);
+ else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy
+ initializeXYFromModel();
+ blockSeriesSignals(false);
+}
+
+void QXYModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent);
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Vertical)
+ removeData(start, end);
+ else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy
+ initializeXYFromModel();
+ blockSeriesSignals(false);
+}
+
+void QXYModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent);
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Horizontal)
+ insertData(start, end);
+ else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy
+ initializeXYFromModel();
+ blockSeriesSignals(false);
+}
+
+void QXYModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
+{
+ Q_UNUSED(parent);
+ if (m_modelSignalsBlock)
+ return;
+
+ blockSeriesSignals();
+ if (m_orientation == Qt::Horizontal)
+ removeData(start, end);
+ else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy
+ initializeXYFromModel();
+ blockSeriesSignals(false);
+}
+
+void QXYModelMapperPrivate::handleModelDestroyed()
+{
+ m_model = 0;
+}
+
+void QXYModelMapperPrivate::insertData(int start, int end)
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ if (m_count != -1 && start >= m_first + m_count) {
+ return;
+ } else {
+ int addedCount = end - start + 1;
+ if (m_count != -1 && addedCount > m_count)
+ addedCount = m_count;
+ int first = qMax(start, m_first);
+ int last = qMin(first + addedCount - 1, m_orientation == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1);
+ for (int i = first; i <= last; i++) {
+ QPointF point;
+ QModelIndex xIndex = xModelIndex(i - m_first);
+ QModelIndex yIndex = yModelIndex(i - m_first);
+ if (xIndex.isValid() && yIndex.isValid()) {
+ point.setX(valueFromModel(xIndex));
+ point.setY(valueFromModel(yIndex));
+ m_series->insert(i - m_first, point);
+ }
+ }
+
+ // remove excess of points (above m_count)
+ if (m_count != -1 && m_series->points().size() > m_count)
+ for (int i = m_series->points().size() - 1; i >= m_count; i--) {
+ m_series->remove(m_series->points().at(i));
+ }
+ }
+}
+
+void QXYModelMapperPrivate::removeData(int start, int end)
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ int removedCount = end - start + 1;
+ if (m_count != -1 && start >= m_first + m_count) {
+ return;
+ } else {
+ int toRemove = qMin(m_series->count(), removedCount); // first find how many items can actually be removed
+ int first = qMax(start, m_first); // get the index of the first item that will be removed.
+ int last = qMin(first + toRemove - 1, m_series->count() + m_first - 1); // get the index of the last item that will be removed.
+ for (int i = last; i >= first; i--) {
+ m_series->remove(m_series->points().at(i - m_first));
+ }
+
+ if (m_count != -1) {
+ int itemsAvailable; // check how many are available to be added
+ if (m_orientation == Qt::Vertical)
+ itemsAvailable = m_model->rowCount() - m_first - m_series->count();
+ else
+ itemsAvailable = m_model->columnCount() - m_first - m_series->count();
+ int toBeAdded = qMin(itemsAvailable, m_count - m_series->count()); // add not more items than there is space left to be filled.
+ int currentSize = m_series->count();
+ if (toBeAdded > 0)
+ for (int i = m_series->count(); i < currentSize + toBeAdded; i++) {
+ QPointF point;
+ QModelIndex xIndex = xModelIndex(i);
+ QModelIndex yIndex = yModelIndex(i);
+ if (xIndex.isValid() && yIndex.isValid()) {
+ point.setX(valueFromModel(xIndex));
+ point.setY(valueFromModel(yIndex));
+ m_series->insert(i, point);
+ }
+ }
+ }
+ }
+}
+
+void QXYModelMapperPrivate::initializeXYFromModel()
+{
+ if (m_model == 0 || m_series == 0)
+ return;
+
+ blockSeriesSignals();
+ // clear current content
+ m_series->clear();
+
+ // create the initial points set
+ int pointPos = 0;
+ QModelIndex xIndex = xModelIndex(pointPos);
+ QModelIndex yIndex = yModelIndex(pointPos);
+ while (xIndex.isValid() && yIndex.isValid()) {
+ QPointF point;
+ point.setX(valueFromModel(xIndex));
+ point.setY(valueFromModel(yIndex));
+ m_series->append(point);
+ pointPos++;
+ xIndex = xModelIndex(pointPos);
+ yIndex = yModelIndex(pointPos);
+ }
+ blockSeriesSignals(false);
+}
+
+#include "moc_qxymodelmapper.cpp"
+#include "moc_qxymodelmapper_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/xychart/qxymodelmapper.h b/src/charts/xychart/qxymodelmapper.h
new file mode 100644
index 00000000..0cb6c11a
--- /dev/null
+++ b/src/charts/xychart/qxymodelmapper.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QXYMODELMAPPER_H
+#define QXYMODELMAPPER_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QObject>
+
+class QAbstractItemModel;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QXYModelMapperPrivate;
+class QXYSeries;
+
+class QT_CHARTS_EXPORT QXYModelMapper : public QObject
+{
+ Q_OBJECT
+
+protected:
+ explicit QXYModelMapper(QObject *parent = 0);
+
+ QAbstractItemModel *model() const;
+ void setModel(QAbstractItemModel *model);
+
+ QXYSeries *series() const;
+ void setSeries(QXYSeries *series);
+
+ int first() const;
+ void setFirst(int first);
+
+ int count() const;
+ void setCount(int count);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+ int xSection() const;
+ void setXSection(int xSection);
+
+ int ySection() const;
+ void setYSection(int ySection);
+
+protected:
+ QXYModelMapperPrivate *const d_ptr;
+ Q_DECLARE_PRIVATE(QXYModelMapper)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QXYMODELMAPPER_H
diff --git a/src/charts/xychart/qxymodelmapper_p.h b/src/charts/xychart/qxymodelmapper_p.h
new file mode 100644
index 00000000..390dcaf7
--- /dev/null
+++ b/src/charts/xychart/qxymodelmapper_p.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QXYMODELMAPPER_P_H
+#define QXYMODELMAPPER_P_H
+
+#include "qxymodelmapper.h"
+#include <QObject>
+
+class QModelIndex;
+class QAbstractItemModel;
+class QPointF;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QXYModelMapper;
+class QXYSeries;
+
+class QXYModelMapperPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ QXYModelMapperPrivate(QXYModelMapper *q);
+
+public Q_SLOTS:
+ // for the model
+ void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
+ void modelRowsAdded(QModelIndex parent, int start, int end);
+ void modelRowsRemoved(QModelIndex parent, int start, int end);
+ void modelColumnsAdded(QModelIndex parent, int start, int end);
+ void modelColumnsRemoved(QModelIndex parent, int start, int end);
+ void handleModelDestroyed();
+
+ // for the series
+ void handlePointAdded(int pointPos);
+ void handlePointRemoved(int pointPos);
+ void handlePointReplaced(int pointPos);
+ void handleSeriesDestroyed();
+
+ void initializeXYFromModel();
+
+private:
+ QModelIndex xModelIndex(int xPos);
+ QModelIndex yModelIndex(int yPos);
+ void insertData(int start, int end);
+ void removeData(int start, int end);
+ void blockModelSignals(bool block = true);
+ void blockSeriesSignals(bool block = true);
+ qreal valueFromModel(QModelIndex index);
+ void setValueToModel(QModelIndex index, qreal value);
+
+private:
+ QXYSeries *m_series;
+ QAbstractItemModel *m_model;
+ int m_first;
+ int m_count;
+ Qt::Orientation m_orientation;
+ int m_xSection;
+ int m_ySection;
+ bool m_seriesSignalsBlock;
+ bool m_modelSignalsBlock;
+
+private:
+ QXYModelMapper *q_ptr;
+ Q_DECLARE_PUBLIC(QXYModelMapper)
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QXYMODELMAPPER_P_H
diff --git a/src/charts/xychart/qxyseries.cpp b/src/charts/xychart/qxyseries.cpp
new file mode 100644
index 00000000..6805a1c7
--- /dev/null
+++ b/src/charts/xychart/qxyseries.cpp
@@ -0,0 +1,801 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qxyseries.h"
+#include "qxyseries_p.h"
+#include "abstractdomain_p.h"
+#include "qvalueaxis.h"
+#include "xychart_p.h"
+#include "qxylegendmarker.h"
+#include "charthelpers_p.h"
+#include "qchart_p.h"
+#include <QPainter>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \class QXYSeries
+ \inmodule Qt Charts
+ \brief The QXYSeries class is a base class for line, spline and scatter series.
+*/
+/*!
+ \qmltype XYSeries
+ \instantiates QXYSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractSeries
+
+ \brief The XYSeries type is a base type for line, spline and scatter series.
+
+ The XYSeries class is a base class for line, spline and scatter series.
+ The class cannot be instantiated directly.
+*/
+
+/*!
+ \qmlproperty AbstractAxis XYSeries::axisX
+ The x axis used for the series. If you leave both axisX and axisXTop undefined, a ValueAxis is created for
+ the series.
+ \sa axisXTop
+*/
+
+/*!
+ \qmlproperty AbstractAxis XYSeries::axisY
+ The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
+ the series.
+ \sa axisYRight
+*/
+
+/*!
+ \qmlproperty AbstractAxis XYSeries::axisXTop
+ The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
+ axisXTop, but not both.
+ \sa axisX
+*/
+
+/*!
+ \qmlproperty AbstractAxis XYSeries::axisYRight
+ The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
+ or axisYRight, but not both.
+ \sa axisY
+*/
+
+/*!
+ \qmlproperty AbstractAxis XYSeries::axisAngular
+ The angular axis used for the series, drawn around the polar chart view.
+ \sa axisX
+*/
+
+/*!
+ \qmlproperty AbstractAxis XYSeries::axisRadial
+ The radial axis used for the series, drawn inside the polar chart view.
+ \sa axisY
+*/
+
+/*!
+ \property QXYSeries::pointsVisible
+ Controls if the data points are visible and should be drawn.
+*/
+/*!
+ \qmlproperty bool XYSeries::pointsVisible
+ Controls if the data points are visible and should be drawn.
+*/
+
+/*!
+ \fn QPen QXYSeries::pen() const
+ \brief Returns pen used to draw points for series.
+ \sa setPen()
+*/
+
+/*!
+ \fn QBrush QXYSeries::brush() const
+ \brief Returns brush used to draw points for series.
+ \sa setBrush()
+*/
+
+/*!
+ \property QXYSeries::color
+ The color of the series. This is line (pen) color in case of QLineSeries or QSplineSeries and
+ fill (brush) color in case of QScatterSeries or QAreaSeries.
+ \sa QXYSeries::pen(), QXYSeries::brush()
+*/
+/*!
+ \qmlproperty color XYSeries::color
+ The color of the series. This is line (pen) color in case of LineSeries or SplineSeries and
+ fill (brush) color in case of ScatterSeries or AreaSeries.
+*/
+
+/*!
+ \property QXYSeries::pointLabelsFormat
+ The \a format used for showing labels with series points.
+
+ QXYSeries supports the following format tags:
+ \table
+ \row
+ \li @xPoint \li The x value of the data point
+ \row
+ \li @yPoint \li The y value of the data point
+ \endtable
+
+ For example, the following usage of the format tags would produce labels that have the data
+ point (x, y) shown inside brackets separated by a comma:
+ \code
+ series->setPointLabelsFormat("(@xPoint, @yPoint)");
+ \endcode
+
+ By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot
+ area, labels on the edge of the plot area are cut. If the points are close to each other the
+ labels may overlap.
+
+ \sa QXYSeries::pointLabelsVisible, QXYSeries::pointLabelsFont, QXYSeries::pointLabelsColor
+*/
+/*!
+ \qmlproperty string XYSeries::pointLabelsFormat
+ The \a format used for showing labels with series points.
+
+ \sa QXYSeries::pointLabelsFormat, pointLabelsVisible, pointLabelsFont, pointLabelsColor
+*/
+/*!
+ \fn void QXYSeries::pointLabelsFormatChanged(const QString &format)
+ Signal is emitted when the \a format of data point labels is changed.
+*/
+/*!
+ \qmlsignal XYSeries::onPointLabelsFormatChanged(string format)
+ Signal is emitted when the \a format of data point labels is changed.
+*/
+
+/*!
+ \property QXYSeries::pointLabelsVisible
+ Defines the visibility for data point labels. False by default.
+
+ \sa QXYSeries::pointLabelsFormat
+*/
+/*!
+ \qmlproperty bool XYSeries::pointLabelsVisible
+ Defines the visibility for data point labels.
+
+ \sa pointLabelsFormat
+*/
+/*!
+ \fn void QXYSeries::pointLabelsVisibilityChanged(bool visible)
+ The visibility of the data point labels is changed to \a visible.
+*/
+/*!
+ \qmlsignal XYSeries::onPointLabelsVisibilityChanged(bool visible)
+ The visibility of the data point labels is changed to \a visible.
+*/
+
+/*!
+ \property QXYSeries::pointLabelsFont
+ Defines the font used for data point labels.
+
+ \sa QXYSeries::pointLabelsFormat
+*/
+/*!
+ \qmlproperty font XYSeries::pointLabelsFont
+ Defines the font used for data point labels.
+
+ \sa pointLabelsFormat
+*/
+/*!
+ \fn void QXYSeries::pointLabelsFontChanged(const QFont &font);
+ The font used for data point labels is changed to \a font.
+*/
+/*!
+ \qmlsignal XYSeries::onPointLabelsFontChanged(Font font)
+ The font used for data point labels is changed to \a font.
+*/
+
+/*!
+ \property QXYSeries::pointLabelsColor
+ Defines the color used for data point labels. By default, the color is the color of the brush
+ defined in theme for labels.
+
+ \sa QXYSeries::pointLabelsFormat
+*/
+/*!
+ \qmlproperty font XYSeries::pointLabelsColor
+ Defines the color used for data point labels. By default, the color is the color of the brush
+ defined in theme for labels.
+
+ \sa pointLabelsFormat
+*/
+/*!
+ \fn void QXYSeries::pointLabelsColorChanged(const QColor &color);
+ The color used for data point labels is changed to \a color.
+*/
+/*!
+ \qmlsignal XYSeries::onPointLabelsColorChanged(Color color)
+ The color used for data point labels is changed to \a color.
+*/
+
+/*!
+ \fn void QXYSeries::clicked(const QPointF& point)
+ \brief Signal is emitted when user clicks the \a point on chart.
+*/
+/*!
+ \qmlsignal XYSeries::onClicked(QPointF point)
+ Signal is emitted when user clicks the \a point on chart. For example:
+ \code
+ LineSeries {
+ XYPoint { x: 0; y: 0 }
+ XYPoint { x: 1.1; y: 2.1 }
+ onClicked: console.log("onClicked: " + point.x + ", " + point.y);
+ }
+ \endcode
+*/
+
+/*!
+ \fn void QXYSeries::hovered(const QPointF &point, bool state)
+ This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
+ of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
+ the series.
+*/
+/*!
+ \qmlsignal XYSeries::onHovered(point point, bool state)
+ This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
+ of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
+ the series.
+*/
+
+/*!
+ \fn void QXYSeries::pointReplaced(int index)
+ Signal is emitted when a point has been replaced at \a index.
+ \sa replace()
+*/
+/*!
+ \qmlsignal XYSeries::onPointReplaced(int index)
+ Signal is emitted when a point has been replaced at \a index.
+*/
+
+/*!
+ \fn void QXYSeries::pointsReplaced()
+ Signal is emitted when all points have been replaced with other points.
+ \sa replace()
+*/
+/*!
+ \qmlsignal XYSeries::onPointsReplaced()
+*/
+
+/*!
+ \fn void QXYSeries::pointAdded(int index)
+ Signal is emitted when a point has been added at \a index.
+ \sa append(), insert()
+*/
+/*!
+ \qmlsignal XYSeries::onPointAdded(int index)
+ Signal is emitted when a point has been added at \a index.
+*/
+
+/*!
+ \fn void QXYSeries::pointRemoved(int index)
+ Signal is emitted when a point has been removed from \a index.
+ \sa remove()
+*/
+/*!
+ \qmlsignal XYSeries::onPointRemoved(int index)
+ Signal is emitted when a point has been removed from \a index.
+*/
+
+/*!
+ \fn void QXYSeries::colorChanged(QColor color)
+ \brief Signal is emitted when the line (pen) color has changed to \a color.
+*/
+/*!
+ \qmlsignal XYSeries::onColorChanged(color color)
+ Signal is emitted when the line (pen) color has changed to \a color.
+*/
+
+/*!
+ \fn void QXYSeriesPrivate::updated()
+ \brief \internal
+*/
+
+/*!
+ \qmlmethod XYSeries::append(real x, real y)
+ Append point (\a x, \a y) to the series
+*/
+
+/*!
+ \qmlmethod XYSeries::replace(real oldX, real oldY, real newX, real newY)
+ Replaces point (\a oldX, \a oldY) with point (\a newX, \a newY). Does nothing, if point (oldX, oldY) does not
+ exist.
+*/
+
+/*!
+ \qmlmethod XYSeries::remove(real x, real y)
+ Removes point (\a x, \a y) from the series. Does nothing, if point (x, y) does not exist.
+*/
+
+/*!
+ \qmlmethod XYSeries::insert(int index, real x, real y)
+ Inserts point (\a x, \a y) to the \a index. If index is 0 or smaller than 0 the point is prepended to the list of
+ points. If index is the same as or bigger than count, the point is appended to the list of points.
+*/
+
+/*!
+ \qmlmethod QPointF XYSeries::at(int index)
+ Returns point at \a index. Returns (0, 0) if the index is not valid.
+*/
+
+/*!
+ \internal
+
+ Constructs empty series object which is a child of \a parent.
+ When series object is added to QChart instance ownerships is transferred.
+*/
+QXYSeries::QXYSeries(QXYSeriesPrivate &d, QObject *parent)
+ : QAbstractSeries(d, parent)
+{
+}
+
+/*!
+ Destroys the object. Series added to QChart instances are owned by those,
+ and are destroyed when QChart instances are destroyed.
+*/
+QXYSeries::~QXYSeries()
+{
+}
+
+/*!
+ Adds data point (\a x, \a y) to the series.
+ */
+void QXYSeries::append(qreal x, qreal y)
+{
+ append(QPointF(x, y));
+}
+
+/*!
+ This is an overloaded function.
+ Adds data \a point to the series.
+ */
+void QXYSeries::append(const QPointF &point)
+{
+ Q_D(QXYSeries);
+
+ if (isValidValue(point)) {
+ d->m_points << point;
+ emit pointAdded(d->m_points.count() - 1);
+ }
+}
+
+/*!
+ This is an overloaded function.
+ Adds list of data \a points to the series.
+ */
+void QXYSeries::append(const QList<QPointF> &points)
+{
+ foreach (const QPointF &point , points)
+ append(point);
+}
+
+/*!
+ Replaces data point (\a oldX, \a oldY) with data point (\a newX, \a newY).
+ \sa QXYSeries::pointReplaced()
+*/
+void QXYSeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
+{
+ replace(QPointF(oldX, oldY), QPointF(newX, newY));
+}
+
+/*!
+ Replaces \a oldPoint with \a newPoint.
+ \sa QXYSeries::pointReplaced()
+*/
+void QXYSeries::replace(const QPointF &oldPoint, const QPointF &newPoint)
+{
+ Q_D(QXYSeries);
+ int index = d->m_points.indexOf(oldPoint);
+ if (index == -1)
+ return;
+ replace(index, newPoint);
+}
+
+/*!
+ Replaces the point at \a index with data point (\a newX, \a newY).
+ \sa QXYSeries::pointReplaced()
+*/
+void QXYSeries::replace(int index, qreal newX, qreal newY)
+{
+ replace(index, QPointF(newX, newY));
+}
+
+/*!
+ Replaces the point at \a index with \a newPoint.
+ \sa QXYSeries::pointReplaced()
+*/
+void QXYSeries::replace(int index, const QPointF &newPoint)
+{
+ Q_D(QXYSeries);
+ if (isValidValue(newPoint)) {
+ d->m_points[index] = newPoint;
+ emit pointReplaced(index);
+ }
+}
+
+/*!
+ Replaces the current points with \a points.
+ \note This is much faster than replacing data points one by one,
+ or first clearing all data, and then appending the new data. Emits QXYSeries::pointsReplaced()
+ when the points have been replaced.
+ \sa QXYSeries::pointsReplaced()
+*/
+void QXYSeries::replace(QList<QPointF> points)
+{
+ Q_D(QXYSeries);
+ d->m_points = points.toVector();
+ emit pointsReplaced();
+}
+
+/*!
+ Removes the point (\a x, \a y) from the series.
+*/
+void QXYSeries::remove(qreal x, qreal y)
+{
+ remove(QPointF(x, y));
+}
+
+/*!
+ Removes the \a point from the series.
+*/
+void QXYSeries::remove(const QPointF &point)
+{
+ Q_D(QXYSeries);
+ int index = d->m_points.indexOf(point);
+ if (index == -1)
+ return;
+ remove(index);
+}
+
+/*!
+ Removes the point at \a index from the series.
+*/
+void QXYSeries::remove(int index)
+{
+ Q_D(QXYSeries);
+ d->m_points.remove(index);
+ emit pointRemoved(index);
+}
+
+/*!
+ Inserts a \a point in the series at \a index position.
+*/
+void QXYSeries::insert(int index, const QPointF &point)
+{
+ Q_D(QXYSeries);
+ if (isValidValue(point)) {
+ d->m_points.insert(index, point);
+ emit pointAdded(index);
+ }
+}
+
+/*!
+ Removes all points from the series.
+*/
+void QXYSeries::clear()
+{
+ Q_D(QXYSeries);
+ for (int i = d->m_points.size() - 1; i >= 0; i--)
+ remove(d->m_points.at(i));
+}
+
+/*!
+ Returns list of points in the series.
+*/
+QList<QPointF> QXYSeries::points() const
+{
+ Q_D(const QXYSeries);
+ return d->m_points.toList();
+}
+
+/*!
+ Returns point at \a index in internal points vector.
+*/
+const QPointF &QXYSeries::at(int index) const
+{
+ Q_D(const QXYSeries);
+ return d->m_points.at(index);
+}
+
+/*!
+ Returns number of data points within series.
+*/
+int QXYSeries::count() const
+{
+ Q_D(const QXYSeries);
+ return d->m_points.count();
+}
+
+
+/*!
+ Sets \a pen used for drawing points on the chart. If the pen is not defined, the
+ pen from chart theme is used.
+ \sa QChart::setTheme()
+*/
+void QXYSeries::setPen(const QPen &pen)
+{
+ Q_D(QXYSeries);
+ if (d->m_pen != pen) {
+ bool emitColorChanged = d->m_pen.color() != pen.color();
+ d->m_pen = pen;
+ emit d->updated();
+ if (emitColorChanged)
+ emit colorChanged(pen.color());
+ }
+}
+
+QPen QXYSeries::pen() const
+{
+ Q_D(const QXYSeries);
+ if (d->m_pen == QChartPrivate::defaultPen())
+ return QPen();
+ else
+ return d->m_pen;
+}
+
+/*!
+ Sets \a brush used for drawing points on the chart. If the brush is not defined, brush
+ from chart theme setting is used.
+ \sa QChart::setTheme()
+*/
+void QXYSeries::setBrush(const QBrush &brush)
+{
+ Q_D(QXYSeries);
+ if (d->m_brush != brush) {
+ d->m_brush = brush;
+ emit d->updated();
+ }
+}
+
+QBrush QXYSeries::brush() const
+{
+ Q_D(const QXYSeries);
+ if (d->m_brush == QChartPrivate::defaultBrush())
+ return QBrush();
+ else
+ return d->m_brush;
+}
+
+void QXYSeries::setColor(const QColor &color)
+{
+ QPen p = pen();
+ if (p.color() != color) {
+ p.setColor(color);
+ setPen(p);
+ }
+}
+
+QColor QXYSeries::color() const
+{
+ return pen().color();
+}
+
+void QXYSeries::setPointsVisible(bool visible)
+{
+ Q_D(QXYSeries);
+ if (d->m_pointsVisible != visible) {
+ d->m_pointsVisible = visible;
+ emit d->updated();
+ }
+}
+
+bool QXYSeries::pointsVisible() const
+{
+ Q_D(const QXYSeries);
+ return d->m_pointsVisible;
+}
+
+void QXYSeries::setPointLabelsFormat(const QString &format)
+{
+ Q_D(QXYSeries);
+ if (d->m_pointLabelsFormat != format) {
+ d->m_pointLabelsFormat = format;
+ emit pointLabelsFormatChanged(format);
+ }
+}
+
+QString QXYSeries::pointLabelsFormat() const
+{
+ Q_D(const QXYSeries);
+ return d->m_pointLabelsFormat;
+}
+
+void QXYSeries::setPointLabelsVisible(bool visible)
+{
+ Q_D(QXYSeries);
+ if (d->m_pointLabelsVisible != visible) {
+ d->m_pointLabelsVisible = visible;
+ emit pointLabelsVisibilityChanged(visible);
+ }
+}
+
+bool QXYSeries::pointLabelsVisible() const
+{
+ Q_D(const QXYSeries);
+ return d->m_pointLabelsVisible;
+}
+
+void QXYSeries::setPointLabelsFont(const QFont &font)
+{
+ Q_D(QXYSeries);
+ if (d->m_pointLabelsFont != font) {
+ d->m_pointLabelsFont = font;
+ emit pointLabelsFontChanged(font);
+ }
+}
+
+QFont QXYSeries::pointLabelsFont() const
+{
+ Q_D(const QXYSeries);
+ return d->m_pointLabelsFont;
+}
+
+void QXYSeries::setPointLabelsColor(const QColor &color)
+{
+ Q_D(QXYSeries);
+ if (d->m_pointLabelsColor != color) {
+ d->m_pointLabelsColor = color;
+ emit pointLabelsColorChanged(color);
+ }
+}
+
+QColor QXYSeries::pointLabelsColor() const
+{
+ Q_D(const QXYSeries);
+ if (d->m_pointLabelsColor == QChartPrivate::defaultPen().color())
+ return QPen().color();
+ else
+ return d->m_pointLabelsColor;
+}
+
+/*!
+ Stream operator for adding a data \a point to the series.
+ \sa append()
+*/
+QXYSeries &QXYSeries::operator<< (const QPointF &point)
+{
+ append(point);
+ return *this;
+}
+
+
+/*!
+ Stream operator for adding a list of \a points to the series.
+ \sa append()
+*/
+
+QXYSeries &QXYSeries::operator<< (const QList<QPointF>& points)
+{
+ append(points);
+ return *this;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q)
+ : QAbstractSeriesPrivate(q),
+ m_pen(QChartPrivate::defaultPen()),
+ m_brush(QChartPrivate::defaultBrush()),
+ m_pointsVisible(false),
+ m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")),
+ m_pointLabelsVisible(false),
+ m_pointLabelsFont(QChartPrivate::defaultFont()),
+ m_pointLabelsColor(QChartPrivate::defaultPen().color())
+{
+}
+
+void QXYSeriesPrivate::initializeDomain()
+{
+ qreal minX(0);
+ qreal minY(0);
+ qreal maxX(1);
+ qreal maxY(1);
+
+ Q_Q(QXYSeries);
+
+ const QList<QPointF>& points = q->points();
+
+ if (!points.isEmpty()) {
+ minX = points[0].x();
+ minY = points[0].y();
+ maxX = minX;
+ maxY = minY;
+
+ for (int i = 0; i < points.count(); i++) {
+ qreal x = points[i].x();
+ qreal y = points[i].y();
+ minX = qMin(minX, x);
+ minY = qMin(minY, y);
+ maxX = qMax(maxX, x);
+ maxY = qMax(maxY, y);
+ }
+ }
+
+ domain()->setRange(minX, maxX, minY, maxY);
+}
+
+QList<QLegendMarker*> QXYSeriesPrivate::createLegendMarkers(QLegend* legend)
+{
+ Q_Q(QXYSeries);
+ QList<QLegendMarker*> list;
+ return list << new QXYLegendMarker(q,legend);
+}
+
+void QXYSeriesPrivate::initializeAxes()
+{
+
+}
+
+QAbstractAxis::AxisType QXYSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
+{
+ Q_UNUSED(orientation);
+ return QAbstractAxis::AxisTypeValue;
+}
+
+QAbstractAxis* QXYSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
+{
+ Q_UNUSED(orientation);
+ return new QValueAxis;
+}
+
+void QXYSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options)
+{
+ XYChart *item = static_cast<XYChart *>(m_item.data());
+ Q_ASSERT(item);
+ if (item->animation())
+ item->animation()->stopAndDestroyLater();
+
+ if (options.testFlag(QChart::SeriesAnimations))
+ item->setAnimation(new XYAnimation(item));
+ else
+ item->setAnimation(0);
+ QAbstractSeriesPrivate::initializeAnimations(options);
+}
+
+void QXYSeriesPrivate::drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points,
+ const int offset)
+{
+ static const QString xPointTag(QLatin1String("@xPoint"));
+ static const QString yPointTag(QLatin1String("@yPoint"));
+ const int labelOffset = offset + 2;
+
+ painter->setFont(m_pointLabelsFont);
+ painter->setPen(QPen(m_pointLabelsColor));
+ QFontMetrics fm(painter->font());
+
+ for (int i(0); i < m_points.size(); i++) {
+ QString pointLabel = m_pointLabelsFormat;
+ pointLabel.replace(xPointTag, presenter()->numberToString(m_points.at(i).x()));
+ pointLabel.replace(yPointTag, presenter()->numberToString(m_points.at(i).y()));
+
+ // Position text in relation to the point
+ int pointLabelWidth = fm.width(pointLabel);
+ QPointF position(points.at(i));
+ position.setX(position.x() - pointLabelWidth / 2);
+ position.setY(position.y() - labelOffset);
+
+ painter->drawText(position, pointLabel);
+ }
+}
+
+#include "moc_qxyseries.cpp"
+#include "moc_qxyseries_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/xychart/qxyseries.h b/src/charts/xychart/qxyseries.h
new file mode 100644
index 00000000..4c73bf07
--- /dev/null
+++ b/src/charts/xychart/qxyseries.h
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QXYSERIES_H
+#define QXYSERIES_H
+
+#include <QtCharts/qchartglobal.h>
+#include <QtCharts/qabstractseries.h>
+#include <QPen>
+#include <QBrush>
+
+class QModelIndex;
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QXYSeriesPrivate;
+class QXYModelMapper;
+
+class QT_CHARTS_EXPORT QXYSeries : public QAbstractSeries
+{
+ Q_OBJECT
+ Q_PROPERTY(bool pointsVisible READ pointsVisible WRITE setPointsVisible)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QString pointLabelsFormat READ pointLabelsFormat WRITE setPointLabelsFormat NOTIFY pointLabelsFormatChanged)
+ Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged)
+ Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged)
+ Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged)
+
+protected:
+ explicit QXYSeries(QXYSeriesPrivate &d, QObject *parent = 0);
+
+public:
+ ~QXYSeries();
+ void append(qreal x, qreal y);
+ void append(const QPointF &point);
+ void append(const QList<QPointF> &points);
+ void replace(qreal oldX, qreal oldY, qreal newX, qreal newY);
+ void replace(const QPointF &oldPoint, const QPointF &newPoint);
+ void replace(int index, qreal newX, qreal newY);
+ void replace(int index, const QPointF &newPoint);
+ void remove(qreal x, qreal y);
+ void remove(const QPointF &point);
+ void remove(int index);
+ void insert(int index, const QPointF &point);
+ void clear();
+
+ int count() const;
+ QList<QPointF> points() const;
+ const QPointF &at(int index) const;
+
+ QXYSeries &operator << (const QPointF &point);
+ QXYSeries &operator << (const QList<QPointF> &points);
+
+ virtual void setPen(const QPen &pen);
+ QPen pen() const;
+
+ virtual void setBrush(const QBrush &brush);
+ QBrush brush() const;
+
+ virtual void setColor(const QColor &color);
+ virtual QColor color() const;
+
+ void setPointsVisible(bool visible = true);
+ bool pointsVisible() const;
+
+ void setPointLabelsFormat(const QString &format);
+ QString pointLabelsFormat() const;
+
+ void setPointLabelsVisible(bool visible = true);
+ bool pointLabelsVisible() const;
+
+ void setPointLabelsFont(const QFont &font);
+ QFont pointLabelsFont() const;
+
+ void setPointLabelsColor(const QColor &color);
+ QColor pointLabelsColor() const;
+
+ void replace(QList<QPointF> points);
+
+Q_SIGNALS:
+ void clicked(const QPointF &point);
+ void hovered(const QPointF &point, bool state);
+ void pointReplaced(int index);
+ void pointRemoved(int index);
+ void pointAdded(int index);
+ void colorChanged(QColor color);
+ void pointsReplaced();
+ void pointLabelsFormatChanged(const QString &format);
+ void pointLabelsVisibilityChanged(bool visible);
+ void pointLabelsFontChanged(const QFont &font);
+ void pointLabelsColorChanged(const QColor &color);
+
+private:
+ Q_DECLARE_PRIVATE(QXYSeries)
+ Q_DISABLE_COPY(QXYSeries)
+ friend class QXYLegendMarkerPrivate;
+ friend class XYLegendMarker;
+ friend class XYChart;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // QXYSERIES_H
diff --git a/src/charts/xychart/qxyseries_p.h b/src/charts/xychart/qxyseries_p.h
new file mode 100644
index 00000000..cee78a08
--- /dev/null
+++ b/src/charts/xychart/qxyseries_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef QXYSERIES_P_H
+#define QXYSERIES_P_H
+
+#include "qabstractseries_p.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QXYSeries;
+class QAbstractAxis;
+
+class QXYSeriesPrivate: public QAbstractSeriesPrivate
+{
+ Q_OBJECT
+
+public:
+ QXYSeriesPrivate(QXYSeries *q);
+
+ void initializeDomain();
+ void initializeAxes();
+ void initializeAnimations(QtCharts::QChart::AnimationOptions options);
+
+ QList<QLegendMarker*> createLegendMarkers(QLegend* legend);
+
+ QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
+ QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
+
+ void drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points,
+ const int offset = 0);
+
+Q_SIGNALS:
+ void updated();
+
+protected:
+ QVector<QPointF> m_points;
+ QPen m_pen;
+ QBrush m_brush;
+ bool m_pointsVisible;
+ QString m_pointLabelsFormat;
+ bool m_pointLabelsVisible;
+ QFont m_pointLabelsFont;
+ QColor m_pointLabelsColor;
+
+private:
+ Q_DECLARE_PUBLIC(QXYSeries)
+ friend class QScatterSeries;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/charts/xychart/xychart.cpp b/src/charts/xychart/xychart.cpp
new file mode 100644
index 00000000..18347d26
--- /dev/null
+++ b/src/charts/xychart/xychart.cpp
@@ -0,0 +1,189 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2014 Digia Plc
+ ** All rights reserved.
+ ** For any questions to Digia, please use contact form at http://qt.digia.com
+ **
+ ** This file is part of the Qt Enterprise Charts Add-on.
+ **
+ ** $QT_BEGIN_LICENSE$
+ ** Licensees holding valid Qt Enterprise licenses may use this file in
+ ** accordance with the Qt Enterprise License Agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia.
+ **
+ ** If you have questions regarding the use of this file, please use
+ ** contact form at http://qt.digia.com
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "xychart_p.h"
+#include "qxyseries.h"
+#include "qxyseries_p.h"
+#include "chartpresenter_p.h"
+#include "abstractdomain_p.h"
+#include "qxymodelmapper.h"
+#include "qabstractaxis_p.h"
+#include <QPainter>
+#include <QAbstractItemModel>
+
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+XYChart::XYChart(QXYSeries *series, QGraphicsItem *item):
+ ChartItem(series->d_func(),item),
+ m_series(series),
+ m_animation(0),
+ m_dirty(true)
+{
+ QObject::connect(series, SIGNAL(pointReplaced(int)), this, SLOT(handlePointReplaced(int)));
+ QObject::connect(series, SIGNAL(pointsReplaced()), this, SLOT(handlePointsReplaced()));
+ QObject::connect(series, SIGNAL(pointAdded(int)), this, SLOT(handlePointAdded(int)));
+ QObject::connect(series, SIGNAL(pointRemoved(int)), this, SLOT(handlePointRemoved(int)));
+ QObject::connect(this, SIGNAL(clicked(QPointF)), series, SIGNAL(clicked(QPointF)));
+ QObject::connect(this, SIGNAL(hovered(QPointF,bool)), series, SIGNAL(hovered(QPointF,bool)));
+}
+
+void XYChart::setGeometryPoints(const QVector<QPointF> &points)
+{
+ m_points = points;
+}
+
+void XYChart::setAnimation(XYAnimation *animation)
+{
+ m_animation = animation;
+}
+
+void XYChart::setDirty(bool dirty)
+{
+ m_dirty = dirty;
+}
+
+// Returns a vector with same size as geometryPoints vector, indicating
+// the off grid status of points.
+QVector<bool> XYChart::offGridStatusVector()
+{
+ qreal minX = domain()->minX();
+ qreal maxX = domain()->maxX();
+ qreal minY = domain()->minY();
+ qreal maxY = domain()->maxY();
+
+ QVector<bool> returnVector;
+ returnVector.resize(m_points.size());
+ // During remove animation series may have different number of points,
+ // so ensure we don't go over the index. No need to check for zero points, this
+ // will not be called in such a situation.
+ const int seriesLastIndex = m_series->count() - 1;
+
+ for (int i = 0; i < m_points.size(); i++) {
+ const QPointF &seriesPoint = m_series->at(qMin(seriesLastIndex, i));
+ if (seriesPoint.x() < minX
+ || seriesPoint.x() > maxX
+ || seriesPoint.y() < minY
+ || seriesPoint.y() > maxY) {
+ returnVector[i] = true;
+ } else {
+ returnVector[i] = false;
+ }
+ }
+ return returnVector;
+}
+
+void XYChart::updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index)
+{
+
+ if (m_animation) {
+ m_animation->setup(oldPoints, newPoints, index);
+ m_points = newPoints;
+ setDirty(false);
+ presenter()->startAnimation(m_animation);
+ } else {
+ m_points = newPoints;
+ updateGeometry();
+ }
+}
+
+//handlers
+
+void XYChart::handlePointAdded(int index)
+{
+ Q_ASSERT(index < m_series->count());
+ Q_ASSERT(index >= 0);
+
+ QVector<QPointF> points;
+
+ if (m_dirty || m_points.isEmpty()) {
+ points = domain()->calculateGeometryPoints(m_series->points());
+ } else {
+ points = m_points;
+ QPointF point = domain()->calculateGeometryPoint(m_series->points()[index], m_validData);
+ if (!m_validData)
+ m_points.clear();
+ else
+ points.insert(index, point);
+ }
+
+ updateChart(m_points, points, index);
+}
+
+void XYChart::handlePointRemoved(int index)
+{
+ Q_ASSERT(index <= m_series->count());
+ Q_ASSERT(index >= 0);
+
+ QVector<QPointF> points;
+
+ if (m_dirty || m_points.isEmpty()) {
+ points = domain()->calculateGeometryPoints(m_series->points());
+ } else {
+ points = m_points;
+ points.remove(index);
+ }
+
+ updateChart(m_points, points, index);
+}
+
+void XYChart::handlePointReplaced(int index)
+{
+ Q_ASSERT(index < m_series->count());
+ Q_ASSERT(index >= 0);
+
+ QVector<QPointF> points;
+
+ if (m_dirty || m_points.isEmpty()) {
+ points = domain()->calculateGeometryPoints(m_series->points());
+ } else {
+ QPointF point = domain()->calculateGeometryPoint(m_series->points()[index], m_validData);
+ if (!m_validData)
+ m_points.clear();
+ points = m_points;
+ if (m_validData)
+ points.replace(index, point);
+ }
+
+ updateChart(m_points, points, index);
+}
+
+void XYChart::handlePointsReplaced()
+{
+ // All the points were replaced -> recalculate
+ QVector<QPointF> points = domain()->calculateGeometryPoints(m_series->points());
+ updateChart(m_points, points, -1);
+}
+
+void XYChart::handleDomainUpdated()
+{
+ if (isEmpty()) return;
+ QVector<QPointF> points = domain()->calculateGeometryPoints(m_series->points());
+ updateChart(m_points, points);
+}
+
+bool XYChart::isEmpty()
+{
+ return domain()->isEmpty() || m_series->points().isEmpty();
+}
+
+#include "moc_xychart_p.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/charts/xychart/xychart.pri b/src/charts/xychart/xychart.pri
new file mode 100644
index 00000000..e7af66e5
--- /dev/null
+++ b/src/charts/xychart/xychart.pri
@@ -0,0 +1,20 @@
+#INCLUDEPATH += $$PWD
+#DEPENDPATH += $$PWD
+
+SOURCES += \
+ $$PWD/xychart.cpp \
+ $$PWD/qxyseries.cpp \
+ $$PWD/qxymodelmapper.cpp \
+ $$PWD/qvxymodelmapper.cpp \
+ $$PWD/qhxymodelmapper.cpp
+
+PRIVATE_HEADERS += \
+ $$PWD/xychart_p.h \
+ $$PWD/qxyseries_p.h \
+ $$PWD/qxymodelmapper_p.h
+
+PUBLIC_HEADERS += \
+ $$PWD/qxyseries.h \
+ $$PWD/qxymodelmapper.h \
+ $$PWD/qvxymodelmapper.h \
+ $$PWD/qhxymodelmapper.h
diff --git a/src/charts/xychart/xychart_p.h b/src/charts/xychart/xychart_p.h
new file mode 100644
index 00000000..78689045
--- /dev/null
+++ b/src/charts/xychart/xychart_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt Enterprise Chart API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#ifndef XYCHART_H
+#define XYCHART_H
+
+#include <qchartglobal.h>
+#include "chartitem_p.h"
+#include "xyanimation_p.h"
+#include "qvalueaxis.h"
+#include <QPen>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class ChartPresenter;
+class QXYSeries;
+
+class XYChart : public ChartItem
+{
+ Q_OBJECT
+public:
+ explicit XYChart(QXYSeries *series,QGraphicsItem *item = 0);
+ ~XYChart() {}
+
+ void setGeometryPoints(const QVector<QPointF> &points);
+ QVector<QPointF> geometryPoints() const { return m_points; }
+
+ void setAnimation(XYAnimation *animation);
+ ChartAnimation *animation() const { return m_animation; }
+ virtual void updateGeometry() = 0;
+
+ bool isDirty() const { return m_dirty; }
+ void setDirty(bool dirty);
+
+ void getSeriesRanges(qreal &minX, qreal &maxX, qreal &minY, qreal &maxY);
+ QVector<bool> offGridStatusVector();
+
+public Q_SLOTS:
+ void handlePointAdded(int index);
+ void handlePointRemoved(int index);
+ void handlePointReplaced(int index);
+ void handlePointsReplaced();
+ void handleDomainUpdated();
+
+Q_SIGNALS:
+ void clicked(const QPointF &point);
+ void hovered(const QPointF &point, bool state);
+
+protected:
+ virtual void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index = -1);
+
+private:
+ inline bool isEmpty();
+
+protected:
+ QXYSeries *m_series;
+ QVector<QPointF> m_points;
+ XYAnimation *m_animation;
+ bool m_dirty;
+
+ friend class AreaChartItem;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif
diff --git a/src/chartsnamespace.h b/src/chartsnamespace.h
deleted file mode 100644
index c29a1a16..00000000
--- a/src/chartsnamespace.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CHARTSNAMESPACE_H
-#define CHARTSNAMESPACE_H
-
-// this is needed by the designer plugin.
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-#endif /* CHARTSNAMESPACE_H */
diff --git a/src/chartsqml2/chartsqml2.pro b/src/chartsqml2/chartsqml2.pro
new file mode 100644
index 00000000..8fc6e92d
--- /dev/null
+++ b/src/chartsqml2/chartsqml2.pro
@@ -0,0 +1,69 @@
+
+TARGET = qtchartsqml2
+QT += qml quick
+QT += charts
+TARGETPATH = QtCharts
+
+IMPORT_VERSION = $$MODULE_VERSION
+
+# Only build qml plugin static if Qt itself is also built static
+!contains(QT_CONFIG, static): CONFIG -= static staticlib
+
+INCLUDEPATH += ../../include \
+ ../../include/QtCharts \
+ ../charts \
+ ../charts/animations \
+ ../charts/axis \
+ ../charts/domain
+
+SOURCES += \
+ chartsqml2_plugin.cpp \
+ declarativechart.cpp \
+ declarativexypoint.cpp \
+ declarativexyseries.cpp \
+ declarativelineseries.cpp \
+ declarativesplineseries.cpp \
+ declarativeareaseries.cpp \
+ declarativescatterseries.cpp \
+ declarativepieseries.cpp \
+ declarativebarseries.cpp \
+ declarativecategoryaxis.cpp \
+ declarativemargins.cpp \
+ declarativeaxes.cpp \
+ declarativepolarchart.cpp \
+ declarativeboxplotseries.cpp
+
+HEADERS += \
+ declarativechart.h \
+ declarativexypoint.h \
+ declarativexyseries.h \
+ declarativelineseries.h \
+ declarativesplineseries.h \
+ declarativeareaseries.h \
+ declarativescatterseries.h \
+ declarativepieseries.h \
+ declarativebarseries.h \
+ declarativecategoryaxis.h \
+ declarativemargins.h \
+ declarativeaxes.h \
+ declarativepolarchart.h \
+ declarativeboxplotseries.h
+
+OTHER_FILES = qmldir
+
+CONFIG += no_cxx_module
+
+load(qml_plugin)
+
+# Copy qmldir to DESTDIR so we can use the plugin directly from there in our examples
+# without having to do 'make install'.
+!android:!ios {
+ copy_qmldir.target = $$DESTDIR/qmldir
+ copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
+ copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
+ QMAKE_EXTRA_TARGETS += copy_qmldir
+ PRE_TARGETDEPS += $$copy_qmldir.target
+}
+
+QML_FILES += \
+ $$PWD/plugins.qmltypes
diff --git a/src/chartsqml2/chartsqml2_plugin.cpp b/src/chartsqml2/chartsqml2_plugin.cpp
new file mode 100644
index 00000000..477f088c
--- /dev/null
+++ b/src/chartsqml2/chartsqml2_plugin.cpp
@@ -0,0 +1,312 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qchart.h"
+#include "qabstractaxis.h"
+#include "qvalueaxis.h"
+#include "qlogvalueaxis.h"
+#include "declarativecategoryaxis.h"
+#include "qbarcategoryaxis.h"
+#include "declarativechart.h"
+#include "declarativepolarchart.h"
+#include "declarativexypoint.h"
+#include "declarativelineseries.h"
+#include "declarativesplineseries.h"
+#include "declarativeareaseries.h"
+#include "declarativescatterseries.h"
+#include "declarativebarseries.h"
+#include "declarativeboxplotseries.h"
+#include "declarativepieseries.h"
+#include "declarativeaxes.h"
+#include "qvxymodelmapper.h"
+#include "qhxymodelmapper.h"
+#include "qhpiemodelmapper.h"
+#include "qvpiemodelmapper.h"
+#include "qhbarmodelmapper.h"
+#include "qvbarmodelmapper.h"
+#include "declarativemargins.h"
+#include "qarealegendmarker.h"
+#include "qbarlegendmarker.h"
+#include "qpielegendmarker.h"
+#include "qxylegendmarker.h"
+#include "qboxplotmodelmapper.h"
+#include "qvboxplotmodelmapper.h"
+#ifndef QT_ON_ARM
+ #include "qdatetimeaxis.h"
+#endif
+#include <QAbstractItemModel>
+#include <QtQml>
+
+QT_CHARTS_USE_NAMESPACE
+
+QML_DECLARE_TYPE(QList<QPieSlice *>)
+QML_DECLARE_TYPE(QList<QBarSet *>)
+QML_DECLARE_TYPE(QList<QAbstractAxis *>)
+
+QML_DECLARE_TYPE(DeclarativeChart)
+QML_DECLARE_TYPE(DeclarativePolarChart)
+QML_DECLARE_TYPE(DeclarativeMargins)
+QML_DECLARE_TYPE(DeclarativeAreaSeries)
+QML_DECLARE_TYPE(DeclarativeBarSeries)
+QML_DECLARE_TYPE(DeclarativeBarSet)
+QML_DECLARE_TYPE(DeclarativeBoxPlotSeries)
+QML_DECLARE_TYPE(DeclarativeBoxSet)
+QML_DECLARE_TYPE(DeclarativeLineSeries)
+QML_DECLARE_TYPE(DeclarativePieSeries)
+QML_DECLARE_TYPE(DeclarativePieSlice)
+QML_DECLARE_TYPE(DeclarativeScatterSeries)
+QML_DECLARE_TYPE(DeclarativeSplineSeries)
+
+QML_DECLARE_TYPE(QAbstractAxis)
+QML_DECLARE_TYPE(QValueAxis)
+QML_DECLARE_TYPE(QBarCategoryAxis)
+QML_DECLARE_TYPE(QCategoryAxis)
+QML_DECLARE_TYPE(QDateTimeAxis)
+QML_DECLARE_TYPE(QLogValueAxis)
+
+QML_DECLARE_TYPE(QLegend)
+QML_DECLARE_TYPE(QLegendMarker)
+QML_DECLARE_TYPE(QAreaLegendMarker)
+QML_DECLARE_TYPE(QBarLegendMarker)
+QML_DECLARE_TYPE(QPieLegendMarker)
+
+QML_DECLARE_TYPE(QHPieModelMapper)
+QML_DECLARE_TYPE(QHXYModelMapper)
+QML_DECLARE_TYPE(QPieModelMapper)
+QML_DECLARE_TYPE(QHBarModelMapper)
+QML_DECLARE_TYPE(QBarModelMapper)
+QML_DECLARE_TYPE(QVBarModelMapper)
+QML_DECLARE_TYPE(QVPieModelMapper)
+QML_DECLARE_TYPE(QVXYModelMapper)
+QML_DECLARE_TYPE(QXYLegendMarker)
+QML_DECLARE_TYPE(QXYModelMapper)
+QML_DECLARE_TYPE(QBoxPlotModelMapper)
+QML_DECLARE_TYPE(QVBoxPlotModelMapper)
+
+QML_DECLARE_TYPE(QAbstractSeries)
+QML_DECLARE_TYPE(QXYSeries)
+QML_DECLARE_TYPE(QAbstractBarSeries)
+QML_DECLARE_TYPE(QBarSeries)
+QML_DECLARE_TYPE(QBarSet)
+QML_DECLARE_TYPE(QAreaSeries)
+QML_DECLARE_TYPE(QHorizontalBarSeries)
+QML_DECLARE_TYPE(QHorizontalPercentBarSeries)
+QML_DECLARE_TYPE(QHorizontalStackedBarSeries)
+QML_DECLARE_TYPE(QLineSeries)
+QML_DECLARE_TYPE(QPercentBarSeries)
+QML_DECLARE_TYPE(QPieSeries)
+QML_DECLARE_TYPE(QPieSlice)
+QML_DECLARE_TYPE(QScatterSeries)
+QML_DECLARE_TYPE(QSplineSeries)
+QML_DECLARE_TYPE(QStackedBarSeries)
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QtChartsQml2Plugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ virtual void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCharts"));
+
+ // @uri QtCharts
+
+ qRegisterMetaType<QList<QPieSlice *> >();
+ qRegisterMetaType<QList<QBarSet *> >();
+ qRegisterMetaType<QList<QAbstractAxis *> >();
+
+ // QtCharts 1.0
+ qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
+ qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
+ qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
+ qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
+ qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
+ qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
+ qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
+ qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
+ qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
+ qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
+ qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
+ qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
+ qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
+ qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
+ qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
+ qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
+ qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
+ qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
+
+ qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis");
+ qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis");
+ qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
+ QLatin1String("Trying to create uncreatable: Legend."));
+ qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
+ QLatin1String("Trying to create uncreatable: XYSeries."));
+ qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
+ QLatin1String("Trying to create uncreatable: AbstractItemModel."));
+ qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
+ QLatin1String("Trying to create uncreatable: XYModelMapper."));
+ qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
+ QLatin1String("Trying to create uncreatable: PieModelMapper."));
+ qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
+ QLatin1String("Trying to create uncreatable: BarModelMapper."));
+ qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
+ QLatin1String("Trying to create uncreatable: AbstractSeries."));
+ qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
+ QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
+ qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
+ QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
+ qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase",
+ QLatin1String("Trying to create uncreatable: BarsetBase."));
+ qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries",
+ QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
+ qmlRegisterUncreatableType<DeclarativeAxes>(uri, 1, 0, "DeclarativeAxes",
+ QLatin1String("Trying to create uncreatable: DeclarativeAxes."));
+
+ // QtCharts 1.1
+ qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView");
+ qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries");
+ qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries");
+ qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries");
+ qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries");
+ qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries");
+ qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries");
+ qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries");
+ qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries");
+ qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries");
+ qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
+ qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
+ qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
+ qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis");
+#ifndef QT_ON_ARM
+ qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
+#endif
+ qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis");
+ qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange");
+ qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis");
+ qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins",
+ QLatin1String("Trying to create uncreatable: Margins."));
+
+ // QtCharts 1.2
+ qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView");
+ qmlRegisterType<DeclarativeScatterSeries, 2>(uri, 1, 2, "ScatterSeries");
+ qmlRegisterType<DeclarativeLineSeries, 2>(uri, 1, 2, "LineSeries");
+ qmlRegisterType<DeclarativeSplineSeries, 2>(uri, 1, 2, "SplineSeries");
+ qmlRegisterType<DeclarativeAreaSeries, 2>(uri, 1, 2, "AreaSeries");
+ qmlRegisterType<DeclarativeBarSeries, 2>(uri, 1, 2, "BarSeries");
+ qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 1, 2, "StackedBarSeries");
+ qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 1, 2, "PercentBarSeries");
+ qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 1, 2, "HorizontalBarSeries");
+ qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 1, 2, "HorizontalStackedBarSeries");
+ qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 1, 2, "HorizontalPercentBarSeries");
+
+ // QtCharts 1.3
+ qmlRegisterType<DeclarativeChart, 3>(uri, 1, 3, "ChartView");
+ qmlRegisterType<DeclarativePolarChart, 1>(uri, 1, 3, "PolarChartView");
+ qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 1, 3, "SplineSeries");
+ qmlRegisterType<DeclarativeScatterSeries, 3>(uri, 1, 3, "ScatterSeries");
+ qmlRegisterType<DeclarativeLineSeries, 3>(uri, 1, 3, "LineSeries");
+ qmlRegisterType<DeclarativeAreaSeries, 3>(uri, 1, 3, "AreaSeries");
+ qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis");
+ qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries");
+ qmlRegisterType<DeclarativeBoxSet>(uri, 1, 3, "BoxSet");
+
+ // QtCharts 1.4
+ qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 1, 4, "AreaSeries");
+ qmlRegisterType<DeclarativeBarSet, 2>(uri, 1, 4, "BarSet");
+ qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 1, 4, "BoxPlotSeries");
+ qmlRegisterType<DeclarativeBoxSet, 1>(uri, 1, 4, "BoxSet");
+ qmlRegisterType<DeclarativePieSlice>(uri, 1, 4, "PieSlice");
+ qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 1, 4, "ScatterSeries");
+
+ // QtCharts 2.0
+ qmlRegisterType<QVBoxPlotModelMapper>(uri, 2, 0, "VBoxPlotModelMapper");
+ qmlRegisterUncreatableType<QBoxPlotModelMapper>(uri, 2, 0, "BoxPlotModelMapper",
+ QLatin1String("Trying to create uncreatable: BoxPlotModelMapper."));
+ qmlRegisterType<DeclarativeChart, 4>(uri, 2, 0, "ChartView");
+ qmlRegisterType<DeclarativeXYPoint>(uri, 2, 0, "XYPoint");
+ qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 2, 0, "ScatterSeries");
+ qmlRegisterType<DeclarativeLineSeries, 3>(uri, 2, 0, "LineSeries");
+ qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 2, 0, "SplineSeries");
+ qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 2, 0, "AreaSeries");
+ qmlRegisterType<DeclarativeBarSeries, 2>(uri, 2, 0, "BarSeries");
+ qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 2, 0, "StackedBarSeries");
+ qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 2, 0, "PercentBarSeries");
+ qmlRegisterType<DeclarativePieSeries>(uri, 2, 0, "PieSeries");
+ qmlRegisterType<QPieSlice>(uri, 2, 0, "PieSlice");
+ qmlRegisterType<DeclarativeBarSet, 2>(uri, 2, 0, "BarSet");
+ qmlRegisterType<QHXYModelMapper>(uri, 2, 0, "HXYModelMapper");
+ qmlRegisterType<QVXYModelMapper>(uri, 2, 0, "VXYModelMapper");
+ qmlRegisterType<QHPieModelMapper>(uri, 2, 0, "HPieModelMapper");
+ qmlRegisterType<QVPieModelMapper>(uri, 2, 0, "VPieModelMapper");
+ qmlRegisterType<QHBarModelMapper>(uri, 2, 0, "HBarModelMapper");
+ qmlRegisterType<QVBarModelMapper>(uri, 2, 0, "VBarModelMapper");
+ qmlRegisterType<QValueAxis>(uri, 2, 0, "ValueAxis");
+#ifndef QT_ON_ARM
+ qmlRegisterType<QDateTimeAxis>(uri, 2, 0, "DateTimeAxis");
+#endif
+ qmlRegisterType<DeclarativeCategoryAxis>(uri, 2, 0, "CategoryAxis");
+ qmlRegisterType<DeclarativeCategoryRange>(uri, 2, 0, "CategoryRange");
+ qmlRegisterType<QBarCategoryAxis>(uri, 2, 0, "BarCategoryAxis");
+ qmlRegisterType<DeclarativePolarChart, 1>(uri, 2, 0, "PolarChartView");
+ qmlRegisterType<QLogValueAxis, 1>(uri, 2, 0, "LogValueAxis");
+ qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 2, 0, "BoxPlotSeries");
+ qmlRegisterType<DeclarativeBoxSet, 1>(uri, 2, 0, "BoxSet");
+ qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 2, 0, "HorizontalBarSeries");
+ qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 2, 0, "HorizontalStackedBarSeries");
+ qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 2, 0, "HorizontalPercentBarSeries");
+ qmlRegisterType<DeclarativePieSlice>(uri, 2, 0, "PieSlice");
+ qmlRegisterUncreatableType<QLegend>(uri, 2, 0, "Legend",
+ QLatin1String("Trying to create uncreatable: Legend."));
+ qmlRegisterUncreatableType<QXYSeries>(uri, 2, 0, "XYSeries",
+ QLatin1String("Trying to create uncreatable: XYSeries."));
+ qmlRegisterUncreatableType<QAbstractItemModel>(uri, 2, 0, "AbstractItemModel",
+ QLatin1String("Trying to create uncreatable: AbstractItemModel."));
+ qmlRegisterUncreatableType<QXYModelMapper>(uri, 2, 0, "XYModelMapper",
+ QLatin1String("Trying to create uncreatable: XYModelMapper."));
+ qmlRegisterUncreatableType<QPieModelMapper>(uri, 2, 0, "PieModelMapper",
+ QLatin1String("Trying to create uncreatable: PieModelMapper."));
+ qmlRegisterUncreatableType<QBarModelMapper>(uri, 2, 0, "BarModelMapper",
+ QLatin1String("Trying to create uncreatable: BarModelMapper."));
+ qmlRegisterUncreatableType<QAbstractSeries>(uri, 2, 0, "AbstractSeries",
+ QLatin1String("Trying to create uncreatable: AbstractSeries."));
+ qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 2, 0, "AbstractBarSeries",
+ QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
+ qmlRegisterUncreatableType<QAbstractAxis>(uri, 2, 0, "AbstractAxis",
+ QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
+ qmlRegisterUncreatableType<QBarSet>(uri, 2, 0, "BarSetBase",
+ QLatin1String("Trying to create uncreatable: BarsetBase."));
+ qmlRegisterUncreatableType<QPieSeries>(uri, 2, 0, "QPieSeries",
+ QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
+ qmlRegisterUncreatableType<DeclarativeAxes>(uri, 2, 0, "DeclarativeAxes",
+ QLatin1String("Trying to create uncreatable: DeclarativeAxes."));
+ qmlRegisterUncreatableType<DeclarativeMargins>(uri, 2, 0, "Margins",
+ QLatin1String("Trying to create uncreatable: Margins."));
+ }
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#include "chartsqml2_plugin.moc"
+
+QT_CHARTS_USE_NAMESPACE
diff --git a/src/chartsqml2/declarativeareaseries.cpp b/src/chartsqml2/declarativeareaseries.cpp
new file mode 100644
index 00000000..90d2ed4b
--- /dev/null
+++ b/src/chartsqml2/declarativeareaseries.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativeareaseries.h"
+#include "declarativelineseries.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
+ QAreaSeries(parent),
+ m_axes(new DeclarativeAxes(this))
+{
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
+}
+
+void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries *series)
+{
+ QAreaSeries::setUpperSeries(series);
+}
+
+DeclarativeLineSeries *DeclarativeAreaSeries::upperSeries() const
+{
+ return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries());
+}
+
+void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries *series)
+{
+ QAreaSeries::setLowerSeries(series);
+}
+
+DeclarativeLineSeries *DeclarativeAreaSeries::lowerSeries() const
+{
+ return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries());
+}
+
+qreal DeclarativeAreaSeries::borderWidth() const
+{
+ return pen().widthF();
+}
+
+void DeclarativeAreaSeries::setBorderWidth(qreal width)
+{
+ if (width != pen().widthF()) {
+ QPen p = pen();
+ p.setWidthF(width);
+ setPen(p);
+ emit borderWidthChanged(width);
+ }
+}
+
+QString DeclarativeAreaSeries::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeAreaSeries::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QAreaSeries::brush().textureImage() != brushImage) {
+ QBrush brush = QAreaSeries::brush();
+ brush.setTextureImage(brushImage);
+ QAreaSeries::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeAreaSeries::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QAreaSeries::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
+void DeclarativeAreaSeries::setBrush(const QBrush &brush)
+{
+ QAreaSeries::setBrush(brush);
+ emit brushChanged();
+}
+
+QBrush DeclarativeAreaSeries::brush() const
+{
+ return QAreaSeries::brush();
+}
+
+#include "moc_declarativeareaseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativeareaseries.h b/src/chartsqml2/declarativeareaseries.h
new file mode 100644
index 00000000..7072ff07
--- /dev/null
+++ b/src/chartsqml2/declarativeareaseries.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVEAREASERIES_H
+#define DECLARATIVEAREASERIES_H
+
+#include "qareaseries.h"
+#include "declarativeaxes.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+class DeclarativeLineSeries;
+
+class DeclarativeAreaSeries : public QAreaSeries
+{
+ Q_OBJECT
+ Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries)
+ Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
+ Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
+ Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4)
+
+public:
+ explicit DeclarativeAreaSeries(QObject *parent = 0);
+ void setUpperSeries(DeclarativeLineSeries *series);
+ DeclarativeLineSeries *upperSeries() const;
+ void setLowerSeries(DeclarativeLineSeries *series);
+ DeclarativeLineSeries *lowerSeries() const;
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
+ Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
+ Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ qreal borderWidth() const;
+ void setBorderWidth(qreal borderWidth);
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+
+Q_SIGNALS:
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void borderWidthChanged(qreal width);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+ Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
+ Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
+ Q_REVISION(4) void brushChanged();
+ Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename);
+
+private Q_SLOTS:
+ void handleBrushChanged();
+
+public:
+ DeclarativeAxes *m_axes;
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVEAREASERIES_H
diff --git a/src/chartsqml2/declarativeaxes.cpp b/src/chartsqml2/declarativeaxes.cpp
new file mode 100644
index 00000000..9c6d9ad8
--- /dev/null
+++ b/src/chartsqml2/declarativeaxes.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativeaxes.h"
+#include "qabstractaxis.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+DeclarativeAxes::DeclarativeAxes(QObject *parent) :
+ QObject(parent),
+ m_axisX(0),
+ m_axisY(0),
+ m_axisXTop(0),
+ m_axisYRight(0)
+{
+}
+
+void DeclarativeAxes::setAxisX(QAbstractAxis *axis)
+{
+ m_axisX = axis;
+ emit axisXChanged(axis);
+}
+
+void DeclarativeAxes::setAxisY(QAbstractAxis *axis)
+{
+ m_axisY = axis;
+ emit axisYChanged(axis);
+}
+
+void DeclarativeAxes::setAxisXTop(QAbstractAxis *axis)
+{
+ m_axisXTop = axis;
+ emit axisXTopChanged(axis);
+}
+
+void DeclarativeAxes::setAxisYRight(QAbstractAxis *axis)
+{
+ m_axisYRight = axis;
+ emit axisYRightChanged(axis);
+}
+
+#include "moc_declarativeaxes.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativeaxes.h b/src/chartsqml2/declarativeaxes.h
new file mode 100644
index 00000000..6e7d2346
--- /dev/null
+++ b/src/chartsqml2/declarativeaxes.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVEAXES_H
+#define DECLARATIVEAXES_H
+
+#include "qchartglobal.h"
+#include <QObject>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QAbstractAxis;
+
+class DeclarativeAxes : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged)
+
+public:
+ explicit DeclarativeAxes(QObject *parent = 0);
+
+ QAbstractAxis *axisX() { return m_axisX; }
+ void setAxisX(QAbstractAxis *axis);
+ QAbstractAxis *axisY() { return m_axisY; }
+ void setAxisY(QAbstractAxis *axis);
+ QAbstractAxis *axisXTop() { return m_axisXTop; }
+ void setAxisXTop(QAbstractAxis *axis);
+ QAbstractAxis *axisYRight() { return m_axisYRight; }
+ void setAxisYRight(QAbstractAxis *axis);
+
+public:
+ void emitAxisXChanged() { emit axisXChanged(m_axisX); }
+ void emitAxisYChanged() { emit axisYChanged(m_axisY); }
+ void emitAxisXTopChanged() { emit axisXTopChanged(m_axisXTop); }
+ void emitAxisYRightChanged() { emit axisYRightChanged(m_axisYRight); }
+
+signals:
+ void axisXChanged(QAbstractAxis *axis);
+ void axisYChanged(QAbstractAxis *axis);
+ void axisXTopChanged(QAbstractAxis *axis);
+ void axisYRightChanged(QAbstractAxis *axis);
+
+private:
+ QAbstractAxis *m_axisX;
+ QAbstractAxis *m_axisY;
+ QAbstractAxis *m_axisXTop;
+ QAbstractAxis *m_axisYRight;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVEAXES_H
diff --git a/src/chartsqml2/declarativebarseries.cpp b/src/chartsqml2/declarativebarseries.cpp
new file mode 100644
index 00000000..b773eb7b
--- /dev/null
+++ b/src/chartsqml2/declarativebarseries.cpp
@@ -0,0 +1,509 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativebarseries.h"
+#include "qbarset.h"
+#include "qvbarmodelmapper.h"
+#include "qhbarmodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+DeclarativeBarSet::DeclarativeBarSet(QObject *parent)
+ : QBarSet("", parent)
+{
+ connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int,int)));
+ connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int,int)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
+}
+
+void DeclarativeBarSet::handleCountChanged(int index, int count)
+{
+ Q_UNUSED(index)
+ Q_UNUSED(count)
+ emit countChanged(QBarSet::count());
+}
+
+qreal DeclarativeBarSet::borderWidth() const
+{
+ return pen().widthF();
+}
+
+void DeclarativeBarSet::setBorderWidth(qreal width)
+{
+ if (width != pen().widthF()) {
+ QPen p = pen();
+ p.setWidthF(width);
+ setPen(p);
+ emit borderWidthChanged(width);
+ }
+}
+
+QVariantList DeclarativeBarSet::values()
+{
+ QVariantList values;
+ for (int i(0); i < count(); i++)
+ values.append(QVariant(QBarSet::at(i)));
+ return values;
+}
+
+void DeclarativeBarSet::setValues(QVariantList values)
+{
+ while (count())
+ remove(count() - 1);
+
+ if (values.at(0).canConvert(QVariant::Point)) {
+ // Create list of values for appending if the first item is Qt.point
+ int maxValue = 0;
+ for (int i = 0; i < values.count(); i++) {
+ if (values.at(i).canConvert(QVariant::Point) &&
+ values.at(i).toPoint().x() > maxValue) {
+ maxValue = values.at(i).toPoint().x();
+ }
+ }
+
+ QVector<int> indexValueList;
+ indexValueList.resize(maxValue + 1);
+
+ for (int i = 0; i < values.count(); i++) {
+ if (values.at(i).canConvert(QVariant::Point)) {
+ indexValueList.replace(values.at(i).toPoint().x(), values.at(i).toPoint().y());
+ }
+ }
+
+ for (int i = 0; i < indexValueList.count(); i++)
+ QBarSet::append(indexValueList.at(i));
+
+ } else {
+ for (int i(0); i < values.count(); i++) {
+ if (values.at(i).canConvert(QVariant::Double))
+ QBarSet::append(values[i].toDouble());
+ }
+ }
+}
+
+QString DeclarativeBarSet::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeBarSet::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QBarSet::brush().textureImage() != brushImage) {
+ QBrush brush = QBarSet::brush();
+ brush.setTextureImage(brushImage);
+ QBarSet::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeBarSet::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QBarSet::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
+// Declarative bar series ======================================================================================
+DeclarativeBarSeries::DeclarativeBarSeries(QQuickItem *parent) :
+ QBarSeries(parent),
+ m_axes(new DeclarativeAxes(this))
+{
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+}
+
+void DeclarativeBarSeries::classBegin()
+{
+}
+
+void DeclarativeBarSeries::componentComplete()
+{
+ foreach (QObject *child, children()) {
+ if (qobject_cast<DeclarativeBarSet *>(child)) {
+ QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
+ } else if (qobject_cast<QVBarModelMapper *>(child)) {
+ QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
+ mapper->setSeries(this);
+ } else if (qobject_cast<QHBarModelMapper *>(child)) {
+ QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
+ mapper->setSeries(this);
+ }
+ }
+}
+
+QQmlListProperty<QObject> DeclarativeBarSeries::seriesChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren ,0,0,0);
+}
+
+void DeclarativeBarSeries::appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element)
+{
+ // Empty implementation; the children are parsed in componentComplete instead
+ Q_UNUSED(list);
+ Q_UNUSED(element);
+}
+
+DeclarativeBarSet *DeclarativeBarSeries::at(int index)
+{
+ QList<QBarSet *> setList = barSets();
+ if (index >= 0 && index < setList.count())
+ return qobject_cast<DeclarativeBarSet *>(setList[index]);
+
+ return 0;
+}
+
+DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values)
+{
+ DeclarativeBarSet *barset = new DeclarativeBarSet(this);
+ barset->setLabel(label);
+ barset->setValues(values);
+ if (QBarSeries::insert(index, barset))
+ return barset;
+ delete barset;
+ return 0;
+}
+
+// Declarative stacked bar series ==============================================================================
+DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QQuickItem *parent) :
+ QStackedBarSeries(parent),
+ m_axes(0)
+{
+ m_axes = new DeclarativeAxes(this);
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+}
+
+void DeclarativeStackedBarSeries::classBegin()
+{
+}
+
+void DeclarativeStackedBarSeries::componentComplete()
+{
+ foreach (QObject *child, children()) {
+ if (qobject_cast<DeclarativeBarSet *>(child)) {
+ QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
+ } else if (qobject_cast<QVBarModelMapper *>(child)) {
+ QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
+ mapper->setSeries(this);
+ } else if (qobject_cast<QHBarModelMapper *>(child)) {
+ QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
+ mapper->setSeries(this);
+ }
+ }
+}
+
+
+QQmlListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren ,0,0,0);
+}
+
+void DeclarativeStackedBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
+{
+ // Empty implementation; the children are parsed in componentComplete instead
+ Q_UNUSED(list);
+ Q_UNUSED(element);
+}
+
+DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index)
+{
+ QList<QBarSet *> setList = barSets();
+ if (index >= 0 && index < setList.count())
+ return qobject_cast<DeclarativeBarSet *>(setList[index]);
+
+ return 0;
+}
+
+DeclarativeBarSet *DeclarativeStackedBarSeries::insert(int index, QString label, QVariantList values)
+{
+ DeclarativeBarSet *barset = new DeclarativeBarSet(this);
+ barset->setLabel(label);
+ barset->setValues(values);
+ if (QStackedBarSeries::insert(index, barset))
+ return barset;
+ delete barset;
+ return 0;
+}
+
+// Declarative percent bar series ==============================================================================
+DeclarativePercentBarSeries::DeclarativePercentBarSeries(QQuickItem *parent) :
+ QPercentBarSeries(parent),
+ m_axes(0)
+{
+ m_axes = new DeclarativeAxes(this);
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+}
+
+void DeclarativePercentBarSeries::classBegin()
+{
+}
+
+void DeclarativePercentBarSeries::componentComplete()
+{
+ foreach (QObject *child, children()) {
+ if (qobject_cast<DeclarativeBarSet *>(child)) {
+ QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
+ } else if (qobject_cast<QVBarModelMapper *>(child)) {
+ QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
+ mapper->setSeries(this);
+ } else if (qobject_cast<QHBarModelMapper *>(child)) {
+ QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
+ mapper->setSeries(this);
+ }
+ }
+}
+
+QQmlListProperty<QObject> DeclarativePercentBarSeries::seriesChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren ,0,0,0);
+}
+
+void DeclarativePercentBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
+{
+ // Empty implementation; the children are parsed in componentComplete instead
+ Q_UNUSED(list);
+ Q_UNUSED(element);
+}
+
+DeclarativeBarSet *DeclarativePercentBarSeries::at(int index)
+{
+ QList<QBarSet *> setList = barSets();
+ if (index >= 0 && index < setList.count())
+ return qobject_cast<DeclarativeBarSet *>(setList[index]);
+
+ return 0;
+}
+
+DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label, QVariantList values)
+{
+ DeclarativeBarSet *barset = new DeclarativeBarSet(this);
+ barset->setLabel(label);
+ barset->setValues(values);
+ if (QPercentBarSeries::insert(index, barset))
+ return barset;
+ delete barset;
+ return 0;
+}
+
+// Declarative horizontal bar series ===========================================================================
+DeclarativeHorizontalBarSeries::DeclarativeHorizontalBarSeries(QQuickItem *parent) :
+ QHorizontalBarSeries(parent),
+ m_axes(0)
+{
+ m_axes = new DeclarativeAxes(this);
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+}
+
+void DeclarativeHorizontalBarSeries::classBegin()
+{
+}
+
+void DeclarativeHorizontalBarSeries::componentComplete()
+{
+ foreach (QObject *child, children()) {
+ if (qobject_cast<DeclarativeBarSet *>(child)) {
+ QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
+ } else if (qobject_cast<QVBarModelMapper *>(child)) {
+ QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
+ mapper->setSeries(this);
+ } else if (qobject_cast<QHBarModelMapper *>(child)) {
+ QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
+ mapper->setSeries(this);
+ }
+ }
+}
+
+QQmlListProperty<QObject> DeclarativeHorizontalBarSeries::seriesChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &DeclarativeHorizontalBarSeries::appendSeriesChildren ,0,0,0);
+}
+
+void DeclarativeHorizontalBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
+{
+ // Empty implementation; the children are parsed in componentComplete instead
+ Q_UNUSED(list);
+ Q_UNUSED(element);
+}
+
+DeclarativeBarSet *DeclarativeHorizontalBarSeries::at(int index)
+{
+ QList<QBarSet *> setList = barSets();
+ if (index >= 0 && index < setList.count())
+ return qobject_cast<DeclarativeBarSet *>(setList[index]);
+
+ return 0;
+}
+
+DeclarativeBarSet *DeclarativeHorizontalBarSeries::insert(int index, QString label, QVariantList values)
+{
+ DeclarativeBarSet *barset = new DeclarativeBarSet(this);
+ barset->setLabel(label);
+ barset->setValues(values);
+ if (QHorizontalBarSeries::insert(index, barset))
+ return barset;
+ delete barset;
+ return 0;
+}
+
+// Declarative horizontal stacked bar series ===================================================================
+DeclarativeHorizontalStackedBarSeries::DeclarativeHorizontalStackedBarSeries(QQuickItem *parent) :
+ QHorizontalStackedBarSeries(parent),
+ m_axes(0)
+{
+ m_axes = new DeclarativeAxes(this);
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+}
+
+void DeclarativeHorizontalStackedBarSeries::classBegin()
+{
+}
+
+void DeclarativeHorizontalStackedBarSeries::componentComplete()
+{
+ foreach (QObject *child, children()) {
+ if (qobject_cast<DeclarativeBarSet *>(child)) {
+ QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
+ } else if (qobject_cast<QVBarModelMapper *>(child)) {
+ QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
+ mapper->setSeries(this);
+ } else if (qobject_cast<QHBarModelMapper *>(child)) {
+ QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
+ mapper->setSeries(this);
+ }
+ }
+}
+
+QQmlListProperty<QObject> DeclarativeHorizontalStackedBarSeries::seriesChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &DeclarativeHorizontalStackedBarSeries::appendSeriesChildren ,0,0,0);
+}
+
+void DeclarativeHorizontalStackedBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
+{
+ // Empty implementation; the children are parsed in componentComplete instead
+ Q_UNUSED(list);
+ Q_UNUSED(element);
+}
+
+DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::at(int index)
+{
+ QList<QBarSet *> setList = barSets();
+ if (index >= 0 && index < setList.count())
+ return qobject_cast<DeclarativeBarSet *>(setList[index]);
+
+ return 0;
+}
+
+DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::insert(int index, QString label, QVariantList values)
+{
+ DeclarativeBarSet *barset = new DeclarativeBarSet(this);
+ barset->setLabel(label);
+ barset->setValues(values);
+ if (QHorizontalStackedBarSeries::insert(index, barset))
+ return barset;
+ delete barset;
+ return 0;
+}
+
+// Declarative horizontal percent bar series ===================================================================
+DeclarativeHorizontalPercentBarSeries::DeclarativeHorizontalPercentBarSeries(QQuickItem *parent) :
+ QHorizontalPercentBarSeries(parent),
+ m_axes(0)
+{
+ m_axes = new DeclarativeAxes(this);
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+}
+
+void DeclarativeHorizontalPercentBarSeries::classBegin()
+{
+}
+
+void DeclarativeHorizontalPercentBarSeries::componentComplete()
+{
+ foreach (QObject *child, children()) {
+ if (qobject_cast<DeclarativeBarSet *>(child)) {
+ QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
+ } else if (qobject_cast<QVBarModelMapper *>(child)) {
+ QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
+ mapper->setSeries(this);
+ } else if (qobject_cast<QHBarModelMapper *>(child)) {
+ QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
+ mapper->setSeries(this);
+ }
+ }
+}
+
+QQmlListProperty<QObject> DeclarativeHorizontalPercentBarSeries::seriesChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &DeclarativeHorizontalPercentBarSeries::appendSeriesChildren ,0,0,0);
+}
+
+void DeclarativeHorizontalPercentBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
+{
+ // Empty implementation; the children are parsed in componentComplete instead
+ Q_UNUSED(list);
+ Q_UNUSED(element);
+}
+
+DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::at(int index)
+{
+ QList<QBarSet *> setList = barSets();
+ if (index >= 0 && index < setList.count())
+ return qobject_cast<DeclarativeBarSet *>(setList[index]);
+
+ return 0;
+}
+
+DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::insert(int index, QString label, QVariantList values)
+{
+ DeclarativeBarSet *barset = new DeclarativeBarSet(this);
+ barset->setLabel(label);
+ barset->setValues(values);
+ if (QHorizontalPercentBarSeries::insert(index, barset))
+ return barset;
+ delete barset;
+ return 0;
+}
+
+#include "moc_declarativebarseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativebarseries.h b/src/chartsqml2/declarativebarseries.h
new file mode 100644
index 00000000..6c3b6d89
--- /dev/null
+++ b/src/chartsqml2/declarativebarseries.h
@@ -0,0 +1,361 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVEBARSERIES_H
+#define DECLARATIVEBARSERIES_H
+
+#include "qbarseries.h"
+#include "qstackedbarseries.h"
+#include "qpercentbarseries.h"
+#include "qhorizontalbarseries.h"
+#include "qhorizontalstackedbarseries.h"
+#include "qhorizontalpercentbarseries.h"
+#include "qbarset.h"
+#include "declarativeaxes.h"
+
+#include <QtQuick/QQuickItem>
+#include <QtQml/QQmlParserStatus>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QChart;
+
+class DeclarativeBarSet : public QBarSet
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariantList values READ values WRITE setValues)
+ Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 2)
+
+public:
+ explicit DeclarativeBarSet(QObject *parent = 0);
+ QVariantList values();
+ void setValues(QVariantList values);
+ qreal borderWidth() const;
+ void setBorderWidth(qreal borderWidth);
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
+
+public: // From QBarSet
+ Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
+ Q_INVOKABLE void remove(const int index, const int count = 1) { QBarSet::remove(index, count); }
+ Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); }
+ Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); }
+
+Q_SIGNALS:
+ void countChanged(int count);
+ Q_REVISION(1) void borderWidthChanged(qreal width);
+ Q_REVISION(2) void brushFilenameChanged(const QString &brushFilename);
+
+private Q_SLOTS:
+ void handleCountChanged(int index, int count);
+ void handleBrushChanged();
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
+};
+
+class DeclarativeBarSeries : public QBarSeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+ Q_CLASSINFO("DefaultProperty", "seriesChildren")
+
+public:
+ explicit DeclarativeBarSeries(QQuickItem *parent = 0);
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ QQmlListProperty<QObject> seriesChildren();
+
+public:
+ Q_INVOKABLE DeclarativeBarSet *at(int index);
+ Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
+ Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
+ Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); }
+ Q_INVOKABLE void clear() { return QBarSeries::clear(); }
+
+public: // from QDeclarativeParserStatus
+ void classBegin();
+ void componentComplete();
+
+Q_SIGNALS:
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ static void appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element);
+
+public:
+ DeclarativeAxes *m_axes;
+};
+
+class DeclarativeStackedBarSeries : public QStackedBarSeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+ Q_CLASSINFO("DefaultProperty", "seriesChildren")
+
+public:
+ explicit DeclarativeStackedBarSeries(QQuickItem *parent = 0);
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ QQmlListProperty<QObject> seriesChildren();
+
+public:
+ Q_INVOKABLE DeclarativeBarSet *at(int index);
+ Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
+ Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
+ Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); }
+ Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); }
+
+public: // from QDeclarativeParserStatus
+ void classBegin();
+ void componentComplete();
+
+Q_SIGNALS:
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ static void appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element);
+
+public:
+ DeclarativeAxes *m_axes;
+};
+
+class DeclarativePercentBarSeries : public QPercentBarSeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+ Q_CLASSINFO("DefaultProperty", "seriesChildren")
+
+public:
+ explicit DeclarativePercentBarSeries(QQuickItem *parent = 0);
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ QQmlListProperty<QObject> seriesChildren();
+
+public:
+ Q_INVOKABLE DeclarativeBarSet *at(int index);
+ Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
+ Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
+ Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); }
+ Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); }
+
+public: // from QDeclarativeParserStatus
+ void classBegin();
+ void componentComplete();
+
+Q_SIGNALS:
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ static void appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element);
+
+public:
+ DeclarativeAxes *m_axes;
+};
+
+class DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+ Q_CLASSINFO("DefaultProperty", "seriesChildren")
+
+public:
+ explicit DeclarativeHorizontalBarSeries(QQuickItem *parent = 0);
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ QQmlListProperty<QObject> seriesChildren();
+
+public:
+ Q_INVOKABLE DeclarativeBarSet *at(int index);
+ Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
+ Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
+ Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalBarSeries::remove(barset); }
+ Q_INVOKABLE void clear() { return QHorizontalBarSeries::clear(); }
+
+public: // from QDeclarativeParserStatus
+ void classBegin();
+ void componentComplete();
+
+Q_SIGNALS:
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ static void appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element);
+
+public:
+ DeclarativeAxes *m_axes;
+};
+
+class DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+ Q_CLASSINFO("DefaultProperty", "seriesChildren")
+
+public:
+ explicit DeclarativeHorizontalStackedBarSeries(QQuickItem *parent = 0);
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ QQmlListProperty<QObject> seriesChildren();
+
+public:
+ Q_INVOKABLE DeclarativeBarSet *at(int index);
+ Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
+ Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
+ Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalStackedBarSeries::remove(barset); }
+ Q_INVOKABLE void clear() { return QHorizontalStackedBarSeries::clear(); }
+
+public: // from QDeclarativeParserStatus
+ void classBegin();
+ void componentComplete();
+
+Q_SIGNALS:
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ static void appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element);
+
+public:
+ DeclarativeAxes *m_axes;
+};
+
+class DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+ Q_CLASSINFO("DefaultProperty", "seriesChildren")
+
+public:
+ explicit DeclarativeHorizontalPercentBarSeries(QQuickItem *parent = 0);
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ QQmlListProperty<QObject> seriesChildren();
+
+public:
+ Q_INVOKABLE DeclarativeBarSet *at(int index);
+ Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); }
+ Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values);
+ Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalPercentBarSeries::remove(barset); }
+ Q_INVOKABLE void clear() { return QHorizontalPercentBarSeries::clear(); }
+
+public: // from QDeclarativeParserStatus
+ void classBegin();
+ void componentComplete();
+
+Q_SIGNALS:
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+
+public Q_SLOTS:
+ static void appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element);
+
+public:
+ DeclarativeAxes *m_axes;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVEBARSERIES_H
diff --git a/src/chartsqml2/declarativeboxplotseries.cpp b/src/chartsqml2/declarativeboxplotseries.cpp
new file mode 100644
index 00000000..101dab58
--- /dev/null
+++ b/src/chartsqml2/declarativeboxplotseries.cpp
@@ -0,0 +1,423 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativebarseries.h"
+#include "declarativeboxplotseries.h"
+#include "qboxset.h"
+#include "qvboxplotmodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \qmltype BoxSet
+ \instantiates QBoxSet
+ \inqmlmodule QtCharts
+
+ BoxSet represents one box-and-whiskers item. It takes five values to create a graphical
+ representation of range and three medians. There are two ways to give the values. The first one
+ is with constructor or with append method. In these the values have to be given in the following
+ order: lower extreme, lower quartile, median, upper quartile and upper extreme. The second
+ method is to create an empty QBoxSet instance and give the values using value specific methods.
+ \sa BoxPlotSeries
+*/
+/*!
+ \qmlproperty string BoxSet::values
+ The values on the box-and-whiskers set.
+*/
+/*!
+ \qmlproperty string BoxSet::label
+ Defines the label of the box-and-whiskers set.
+*/
+/*!
+ \qmlproperty int BoxSet::count
+ The count of values on the box-and-whiskers set
+*/
+/*!
+ \qmlmethod void BoxSet::at(int index)
+ Returns the value at \a index position.
+*/
+/*!
+ \qmlmethod void BoxSet::append(qreal value)
+ Appends new value \a value to the end of set.
+*/
+/*!
+ \qmlmethod void BoxSet::clear()
+ Sets all values on the set to 0.
+*/
+/*!
+ \qmlmethod void BoxSet::setValue(int index, qreal value)
+ Sets a new \a value on the \a index position.
+*/
+/*!
+ \qmlsignal BoxSet::onClicked()
+ This signal is emitted when the user clicks with a mouse on top of box-and-whiskers item.
+*/
+/*!
+ \qmlsignal BoxSet::onHovered(bool status)
+ The signal is emitted if mouse is hovered on top of box-and-whiskers item.
+ Parameter \a status is true, if mouse entered on top of the item, and false if mouse left from top of the item.
+*/
+/*!
+ \qmlsignal BoxSet::onPenChanged()
+ This signal is emitted when the pen of the box-and-whiskers item has changed.
+*/
+/*!
+ \qmlsignal BoxSet::onBrushChanged()
+ This signal is emitted when the brush of the box-and-whiskers item has changed.
+*/
+/*!
+ \qmlsignal BoxSet::onChangedValues()
+ This signal is emitted when multiple values have been changed on the box-and-whiskers item.
+*/
+/*!
+ \qmlsignal BoxSet::onChangedValue(int index)
+ This signal is emitted values the value in the box-and-whiskers item has been modified.
+ Parameter \a index indicates the position of the modified value.
+*/
+/*!
+ \qmlsignal BoxSet::onCleared()
+ This signal is emitted when all the values on the set are cleared to 0.
+*/
+
+/*!
+ \qmltype BoxPlotSeries
+ \instantiates QBoxPlotSeries
+ \inqmlmodule QtCharts
+
+ \inherits AbstractSeries
+
+ BoxPlotSeries represents a series of data shown as box-and-whiskers bars. The purpose of this
+ class is to act as a container for single box-and-whiskers items. Each item is drawn to own
+ slot. If chart includes multiple instances of BoxPlotSeries then box-and-whiskers items with the
+ same index are drawn to same slot.
+
+ The following QML shows how to create a simple box-and-whiskers chart:
+ \code
+ import QtQuick 2.0
+ import QtCharts 2.0
+
+ ChartView {
+ title: "Box Plot series"
+ width: 400
+ height: 300
+ theme: ChartView.ChartThemeBrownSand
+ legend.alignment: Qt.AlignBottom
+
+ BoxPlotSeries {
+ id: plotSeries
+ name: "Income"
+ BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] }
+ BoxSet { label: "Feb"; values: [5, 6, 7.5, 8.6, 11.8] }
+ BoxSet { label: "Mar"; values: [3.2, 5, 5.7, 8, 9.2] }
+ BoxSet { label: "Apr"; values: [3.8, 5, 6.4, 7, 8] }
+ BoxSet { label: "May"; values: [4, 5, 5.2, 6, 7] }
+ }
+ }
+ \endcode
+
+ \beginfloatleft
+ \image examples_qmlboxplot.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ \qmlmethod BoxPlotSeries::append(string label, VariantList values)
+ Appends a new box-and-whiskers set with \a label and \a values to the series.
+ */
+/*!
+ \qmlmethod BoxPlotSeries::append(BoxSet box)
+ Appends the \a box to the series.
+*/
+/*!
+ \qmlmethod BoxPlotSeries::insert(int index, string label, VariantList values)
+ Inserts a new box-and-whiskers set with \a label and \a values at the \a index position.
+*/
+/*!
+ \qmlmethod BoxPlotSeries::remove(QBoxSet boxset)
+ Removes the \a boxset from the series.
+*/
+/*!
+ \qmlmethod BoxPlotSeries::clear()
+ Removes all boxsets from the series. Deletes removed sets.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onClicked(BoxSet boxset);
+ Signal is emitted when the user clicks the \a boxset on the chart.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onHovered(bool status, BoxSet boxset);
+ Signal is emitted when there is change in hover \a status over \a boxset.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onCountChanged();
+ Signal is emitted when there is change in count of box-and-whiskers items in the series.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onBoxsetsAdded()
+ Signal is emitted when new box-and-whiskers sets are added to the series.
+ */
+/*!
+ \qmlsignal BoxPlotSeries::onBoxsetsRemoved()
+ Signal is emitted when new box-and-whiskers sets are removed from the series.
+ */
+/*!
+ \qmlproperty AbstractAxis BoxPlotSeries::axisX
+ The x axis used for the series. If you leave both axisX and axisXTop undefined, a BarCategoriesAxis is created for
+ the series.
+ \sa axisXTop
+*/
+/*!
+ \qmlproperty AbstractAxis BoxPlotSeries::axisY
+ The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
+ the series.
+ \sa axisYRight
+*/
+/*!
+ \qmlproperty AbstractAxis BoxPlotSeries::axisXTop
+ The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
+ axisXTop, but not both.
+ \sa axisX
+*/
+/*!
+ \qmlproperty AbstractAxis BoxPlotSeries::axisYRight
+ The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
+ or axisYRight, but not both.
+ \sa axisY
+*/
+/*!
+ \qmlproperty bool BoxPlotSeries::boxOutlineVisible
+ This property configures the visibility of the middle box outline.
+*/
+/*!
+ \qmlproperty qreal BoxPlotSeries::boxWidth
+ This property configures the width of the box-and-whiskers item. The value signifies the relative
+ width of the box-and-whiskers item inside its own slot. The value can between 0.0 and 1.0. Negative values
+ are clamped to 0.0 and values over 1.0 are clamped to 1.0.
+*/
+/*!
+ \qmlproperty Pen BoxPlotSeries::pen
+ This property configures the pen of the box-and-whiskers items.
+*/
+/*!
+ \qmlproperty Brush BoxPlotSeries::brush
+ This property configures the brush of the box-and-whiskers items.
+*/
+/*!
+ \qmlproperty int BoxPlotSeries::count
+ The count of sets in series.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onBoxOutlineVisibilityChanged()
+ Signal is emitted when the middle box outline visibility is changed.
+ */
+/*!
+ \qmlsignal BoxPlotSeries::onBoxWidthChanged()
+ Signal is emitted when the width of the box-and-whiskers item is changed.
+ */
+/*!
+ \qmlsignal BoxPlotSeries::onPenChanged()
+ Signal is emitted when the pen for box-and-whiskers items has changed.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onBrushChanged()
+ Signal is emitted when the brush for box-and-whiskers items has changed.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onClicked(BoxSet boxset)
+ Signal is emitted when the user clicks the \a boxset on the chart.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onHovered(bool status, BoxSet boxset)
+ Signal is emitted when there is change in hover \a status over \a boxset.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onAxisXChanged(AbstractAxis axis)
+ Signal is emitted when there is change in X axis.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onAxisYChanged(AbstractAxis axis)
+ Signal is emitted when there is change in Y axis.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onAxisXTopChanged(AbstractAxis axis)
+ Signal is emitted when there is change in top X axis.
+*/
+/*!
+ \qmlsignal BoxPlotSeries::onAxisYRightChanged(AbstractAxis axis)
+ Signal is emitted when there is change in Y right axis.
+*/
+
+
+DeclarativeBoxSet::DeclarativeBoxSet(const QString label, QObject *parent)
+ : QBoxSet(label, parent)
+{
+ connect(this, SIGNAL(valuesChanged()), this, SIGNAL(changedValues()));
+ connect(this, SIGNAL(valueChanged(int)), this, SIGNAL(changedValue(int)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
+}
+
+QVariantList DeclarativeBoxSet::values()
+{
+ QVariantList values;
+ for (int i(0); i < 5; i++)
+ values.append(QVariant(QBoxSet::at(i)));
+ return values;
+}
+
+void DeclarativeBoxSet::setValues(QVariantList values)
+{
+ for (int i(0); i < values.count(); i++) {
+ if (values.at(i).canConvert(QVariant::Double))
+ QBoxSet::append(values[i].toDouble());
+ }
+}
+
+QString DeclarativeBoxSet::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeBoxSet::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QBoxSet::brush().textureImage() != brushImage) {
+ QBrush brush = QBoxSet::brush();
+ brush.setTextureImage(brushImage);
+ QBoxSet::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeBoxSet::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QBoxSet::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
+// =====================================================
+
+DeclarativeBoxPlotSeries::DeclarativeBoxPlotSeries(QQuickItem *parent) :
+ QBoxPlotSeries(parent),
+ m_axes(new DeclarativeAxes(this))
+{
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+ connect(this, SIGNAL(hovered(bool, QBoxSet*)), this, SLOT(onHovered(bool, QBoxSet*)));
+ connect(this, SIGNAL(clicked(QBoxSet*)), this, SLOT(onClicked(QBoxSet*)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
+}
+
+void DeclarativeBoxPlotSeries::classBegin()
+{
+}
+
+void DeclarativeBoxPlotSeries::componentComplete()
+{
+ foreach (QObject *child, children()) {
+ if (qobject_cast<DeclarativeBoxSet *>(child)) {
+ QBoxPlotSeries::append(qobject_cast<DeclarativeBoxSet *>(child));
+ } else if (qobject_cast<QVBoxPlotModelMapper *>(child)) {
+ QVBoxPlotModelMapper *mapper = qobject_cast<QVBoxPlotModelMapper *>(child);
+ mapper->setSeries(this);
+ }
+ }
+}
+
+QQmlListProperty<QObject> DeclarativeBoxPlotSeries::seriesChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &DeclarativeBoxPlotSeries::appendSeriesChildren ,0,0,0);
+}
+
+void DeclarativeBoxPlotSeries::appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element)
+{
+ // Empty implementation; the children are parsed in componentComplete instead
+ Q_UNUSED(list);
+ Q_UNUSED(element);
+}
+
+DeclarativeBoxSet *DeclarativeBoxPlotSeries::at(int index)
+{
+ QList<QBoxSet *> setList = boxSets();
+ if (index >= 0 && index < setList.count())
+ return qobject_cast<DeclarativeBoxSet *>(setList[index]);
+
+ return 0;
+}
+
+DeclarativeBoxSet *DeclarativeBoxPlotSeries::insert(int index, const QString label, QVariantList values)
+{
+ DeclarativeBoxSet *barset = new DeclarativeBoxSet(label, this);
+ barset->setValues(values);
+ if (QBoxPlotSeries::insert(index, barset))
+ return barset;
+ delete barset;
+ return 0;
+}
+
+void DeclarativeBoxPlotSeries::onHovered(bool status, QBoxSet *boxset)
+{
+ emit hovered(status, qobject_cast<DeclarativeBoxSet *>(boxset));
+}
+
+void DeclarativeBoxPlotSeries::onClicked(QBoxSet *boxset)
+{
+ emit clicked(qobject_cast<DeclarativeBoxSet *>(boxset));
+}
+
+QString DeclarativeBoxPlotSeries::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeBoxPlotSeries::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QBoxPlotSeries::brush().textureImage() != brushImage) {
+ QBrush brush = QBoxPlotSeries::brush();
+ brush.setTextureImage(brushImage);
+ QBoxPlotSeries::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeBoxPlotSeries::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QBoxPlotSeries::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
+#include "moc_declarativeboxplotseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativeboxplotseries.h b/src/chartsqml2/declarativeboxplotseries.h
new file mode 100644
index 00000000..10dab699
--- /dev/null
+++ b/src/chartsqml2/declarativeboxplotseries.h
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVEBOXPLOT_H
+#define DECLARATIVEBOXPLOT_H
+
+#include "qboxset.h"
+#include "declarativeaxes.h"
+#include "qboxplotseries.h"
+
+#include <QtQuick/QQuickItem>
+#include <QtQml/QQmlParserStatus>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativeBoxSet : public QBoxSet
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariantList values READ values WRITE setValues)
+ Q_PROPERTY(QString label READ label WRITE setLabel)
+ Q_PROPERTY(int count READ count)
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
+ Q_ENUMS(ValuePositions)
+
+public: // duplicate from QBoxSet
+ enum ValuePositions {
+ LowerExtreme = 0x0,
+ LowerQuartile,
+ Median,
+ UpperQuartile,
+ UpperExtreme
+ };
+
+public:
+ explicit DeclarativeBoxSet(const QString label = "", QObject *parent = 0);
+ QVariantList values();
+ void setValues(QVariantList values);
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
+
+public: // From QBoxSet
+ Q_INVOKABLE void append(qreal value) { QBoxSet::append(value); }
+ Q_INVOKABLE void clear() {QBoxSet::clear(); }
+ Q_INVOKABLE qreal at(int index) { return QBoxSet::at(index); }
+ Q_INVOKABLE void setValue(int index, qreal value) { QBoxSet::setValue(index, value); }
+
+Q_SIGNALS:
+ void changedValues();
+ void changedValue(int index);
+ Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename);
+
+private Q_SLOTS:
+ void handleBrushChanged();
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
+};
+
+class DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged)
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
+ Q_CLASSINFO("DefaultProperty", "seriesChildren")
+
+public:
+ explicit DeclarativeBoxPlotSeries(QQuickItem *parent = 0);
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ QQmlListProperty<QObject> seriesChildren();
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
+
+public:
+ Q_INVOKABLE DeclarativeBoxSet *at(int index);
+ Q_INVOKABLE DeclarativeBoxSet *append(const QString label, QVariantList values) { return insert(count(), label, values); }
+ Q_INVOKABLE void append(DeclarativeBoxSet *box) { QBoxPlotSeries::append(box); }
+ Q_INVOKABLE DeclarativeBoxSet *insert(int index, const QString label, QVariantList values);
+ Q_INVOKABLE bool remove(DeclarativeBoxSet *box) { return QBoxPlotSeries::remove(qobject_cast<QBoxSet *>(box)); }
+ Q_INVOKABLE void clear() { return QBoxPlotSeries::clear(); }
+
+public: // from QDeclarativeParserStatus
+ void classBegin();
+ void componentComplete();
+
+Q_SIGNALS:
+ void axisXChanged(QAbstractAxis *axis);
+ void axisYChanged(QAbstractAxis *axis);
+ void axisXTopChanged(QAbstractAxis *axis);
+ void axisYRightChanged(QAbstractAxis *axis);
+ void clicked(DeclarativeBoxSet *boxset);
+ void hovered(bool status, DeclarativeBoxSet *boxset);
+ Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename);
+
+public Q_SLOTS:
+ static void appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element);
+ void onHovered(bool status, QBoxSet *boxset);
+ void onClicked(QBoxSet *boxset);
+
+private Q_SLOTS:
+ void handleBrushChanged();
+
+public:
+ DeclarativeAxes *m_axes;
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVEBOXPLOT_H
diff --git a/src/chartsqml2/declarativecategoryaxis.cpp b/src/chartsqml2/declarativecategoryaxis.cpp
new file mode 100644
index 00000000..423aab67
--- /dev/null
+++ b/src/chartsqml2/declarativecategoryaxis.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativecategoryaxis.h"
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \qmltype CategoryRange
+ \inqmlmodule QtCharts
+
+ \brief With CategoryRange you can define a range used by a CategoryAxis.
+ \sa CategoryAxis
+*/
+
+DeclarativeCategoryRange::DeclarativeCategoryRange(QObject *parent) :
+ QObject(parent),
+ m_endValue(0),
+ m_label(QString())
+{
+}
+
+DeclarativeCategoryAxis::DeclarativeCategoryAxis(QObject *parent) :
+ QCategoryAxis(parent)
+{
+}
+
+void DeclarativeCategoryAxis::classBegin()
+{
+}
+
+void DeclarativeCategoryAxis::componentComplete()
+{
+ QList<QPair<QString, qreal> > ranges;
+ foreach (QObject *child, children()) {
+ if (qobject_cast<DeclarativeCategoryRange *>(child)) {
+ DeclarativeCategoryRange *range = qobject_cast<DeclarativeCategoryRange *>(child);
+ ranges.append(QPair<QString, qreal>(range->label(), range->endValue()));
+ }
+ }
+
+ // Sort and append the range objects according to end value
+ qSort(ranges.begin(), ranges.end(), endValueLessThan);
+ for (int i(0); i < ranges.count(); i++)
+ append(ranges.at(i).first, ranges.at(i).second);
+}
+
+bool DeclarativeCategoryAxis::endValueLessThan(const QPair<QString, qreal> &value1, const QPair<QString, qreal> &value2)
+{
+ return value1.second < value2.second;
+}
+
+QQmlListProperty<QObject> DeclarativeCategoryAxis::axisChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &DeclarativeCategoryAxis::appendAxisChildren ,0,0,0);
+}
+
+void DeclarativeCategoryAxis::append(const QString &label, qreal categoryEndValue)
+{
+ QCategoryAxis::append(label, categoryEndValue);
+}
+
+void DeclarativeCategoryAxis::remove(const QString &label)
+{
+ QCategoryAxis::remove(label);
+}
+
+void DeclarativeCategoryAxis::replace(const QString &oldLabel, const QString &newLabel)
+{
+ QCategoryAxis::replaceLabel(oldLabel, newLabel);
+}
+
+void DeclarativeCategoryAxis::appendAxisChildren(QQmlListProperty<QObject> *list, QObject *element)
+{
+ // Empty implementation; the children are parsed in componentComplete instead
+ Q_UNUSED(list)
+ Q_UNUSED(element)
+}
+
+#include "moc_declarativecategoryaxis.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativecategoryaxis.h b/src/chartsqml2/declarativecategoryaxis.h
new file mode 100644
index 00000000..3a6dda95
--- /dev/null
+++ b/src/chartsqml2/declarativecategoryaxis.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVECATEGORYAXIS_H
+#define DECLARATIVECATEGORYAXIS_H
+
+#include "qcategoryaxis.h"
+
+#include <QtQml/QQmlListProperty>
+#include <QtQml/QQmlParserStatus>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativeCategoryRange : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal endValue READ endValue WRITE setEndValue)
+ Q_PROPERTY(QString label READ label WRITE setLabel)
+
+public:
+ explicit DeclarativeCategoryRange(QObject *parent = 0);
+ qreal endValue() { return m_endValue; }
+ void setEndValue(qreal endValue) { m_endValue = endValue; }
+ QString label() { return m_label; }
+ void setLabel(QString label) { m_label = label; }
+
+private:
+ qreal m_endValue;
+ QString m_label;
+};
+
+class DeclarativeCategoryAxis : public QCategoryAxis, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QQmlListProperty<QObject> axisChildren READ axisChildren)
+ Q_CLASSINFO("DefaultProperty", "axisChildren")
+
+public:
+ explicit DeclarativeCategoryAxis(QObject *parent = 0);
+ QQmlListProperty<QObject> axisChildren();
+
+public: // from QDeclarativeParserStatus
+ void classBegin();
+ void componentComplete();
+
+public Q_SLOTS:
+ Q_INVOKABLE void append(const QString &label, qreal categoryEndValue);
+ Q_INVOKABLE void remove(const QString &label);
+ Q_INVOKABLE void replace(const QString &oldLabel, const QString &newLabel);
+ static void appendAxisChildren(QQmlListProperty<QObject> *list, QObject *element);
+
+private:
+ static bool endValueLessThan(const QPair<QString, qreal> &value1, const QPair<QString, qreal> &value2);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVECATEGORYAXIS_H
diff --git a/src/chartsqml2/declarativechart.cpp b/src/chartsqml2/declarativechart.cpp
new file mode 100644
index 00000000..d2044ed0
--- /dev/null
+++ b/src/chartsqml2/declarativechart.cpp
@@ -0,0 +1,1063 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativechart.h"
+#include <QPainter>
+#include "declarativelineseries.h"
+#include "declarativeareaseries.h"
+#include "declarativebarseries.h"
+#include "declarativepieseries.h"
+#include "declarativesplineseries.h"
+#include "declarativeboxplotseries.h"
+#include "declarativescatterseries.h"
+#include "qbarcategoryaxis.h"
+#include "qvalueaxis.h"
+#include "qlogvalueaxis.h"
+#include "qcategoryaxis.h"
+#include "qabstractseries_p.h"
+#include "declarativemargins.h"
+#include "chartdataset_p.h"
+#include "declarativeaxes.h"
+#include "qchart_p.h"
+#include "qpolarchart.h"
+
+#ifndef QT_ON_ARM
+ #include "qdatetimeaxis.h"
+#endif
+
+#include <QGraphicsSceneMouseEvent>
+#include <QGraphicsSceneHoverEvent>
+#include <QApplication>
+#include <QTimer>
+#include <QThread>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ChartView
+ \instantiates DeclarativeChart
+ \inqmlmodule QtCharts
+
+ ChartView element is the parent that is responsible for showing different chart series types.
+
+ The following QML shows how to create a simple chart with one pie series:
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 1
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 2
+ \snippet qmlpiechart/qml/qmlpiechart/main.qml 3
+
+ \beginfloatleft
+ \image examples_qmlpiechart.png
+ \endfloat
+ \clearfloat
+*/
+
+/*!
+ \qmlproperty Theme ChartView::theme
+ Theme defines the visual appearance of the chart, including for example colors, fonts, line
+ widths and chart background.
+*/
+
+/*!
+ \qmlproperty Animation ChartView::animationOptions
+ Animation configuration of the chart. One of ChartView.NoAnimation, ChartView.GridAxisAnimations,
+ ChartView.SeriesAnimations or ChartView.AllAnimations.
+*/
+
+/*!
+ \qmlproperty Font ChartView::titleFont
+ The title font of the chart.
+
+ See the Qt documentation for more details of Font.
+*/
+
+/*!
+ \qmlproperty string ChartView::title
+ The title of the chart, shown on top of the chart.
+ \sa ChartView::titleColor
+*/
+
+/*!
+ \qmlproperty color ChartView::titleColor
+ The color of the title text.
+*/
+
+/*!
+ \qmlproperty Legend ChartView::legend
+ The legend of the chart. Legend lists all the series, pie slices and bar sets added on the chart.
+*/
+
+/*!
+ \qmlproperty int ChartView::count
+ The count of series added to the chart.
+*/
+
+/*!
+ \qmlproperty color ChartView::backgroundColor
+ The color of the chart's background. By default background color is defined by chart theme.
+ \sa ChartView::theme
+*/
+
+/*!
+ \qmlproperty real ChartView::backgroundRoundness
+ The diameter of the rounding cirle at the corners of the chart background.
+*/
+
+/*!
+ \qmlproperty color ChartView::plotAreaColor
+ The color of the background of the chart's plot area. By default plot area background uses chart's
+ background color.
+ \sa ChartView::backgroundColor
+*/
+
+/*!
+ \qmlproperty bool ChartView::dropShadowEnabled
+ The chart's border drop shadow. Set to true to enable drop shadow.
+*/
+
+/*!
+ \qmlproperty real ChartView::topMargin
+ Deprecated; use margins instead.
+*/
+
+/*!
+ \qmlproperty real ChartView::bottomMargin
+ Deprecated; use margins instead.
+*/
+
+/*!
+ \qmlproperty real ChartView::leftMargin
+ Deprecated; use margins instead.
+*/
+
+/*!
+ \qmlproperty real ChartView::rightMargin
+ Deprecated; use margins instead.
+*/
+
+/*!
+ \qmlproperty Margins ChartView::minimumMargins
+ Deprecated; use margins instead.
+ The minimum margins allowed between the outer bounds and the plotArea of the ChartView. Margins
+ area of ChartView is used for drawing title, axes and legend. Please note that setting the
+ properties of minimumMargins may be bigger than the defined value, depending on other ChartView
+ properties that affect it's layout. If you need to know the actual plotting area used at any
+ given time, you can check ChartView::plotArea instead.
+*/
+
+/*!
+ \qmlproperty rect ChartView::plotArea
+ The area on the ChartView that is used for drawing series. This is the ChartView rect without the
+ margins.
+ \sa ChartView::minimumMargins
+*/
+
+/*!
+ \qmlproperty Margins ChartView::margins
+ The minimum margins allowed between the outer bounds and the plotArea of the ChartView. Margins
+ area of ChartView is used for drawing title, axes and legend.
+*/
+
+/*!
+ \qmlproperty bool ChartView::localizeNumbers
+ \since QtCharts 2.0
+ When \c{true}, all generated numbers appearing in various series and axis labels will be
+ localized using the default QLocale of the application, which defaults to the system locale.
+ When \c{false}, the "C" locale is always used.
+ Defaults to \c{false}.
+
+ \sa locale
+*/
+
+/*!
+ \qmlproperty locale ChartView::locale
+ \since QtCharts 2.0
+ Sets the locale used to format various chart labels when localizeNumbers is \c{true}.
+ This also determines the locale used to format DateTimeAxis labels regardless of
+ localizeNumbers property.
+ Defaults to application default locale at the time the chart is constructed.
+
+ \sa localizeNumbers
+*/
+
+/*!
+ \qmlmethod AbstractSeries ChartView::series(int index)
+ Returns the series with \a index on the chart. This allows you to loop through the series of a chart together with
+ the count property of the chart.
+*/
+
+/*!
+ \qmlmethod AbstractSeries ChartView::series(string name)
+ Returns the first series on the chart with \a name. If there is no series with that name, returns null.
+*/
+
+/*!
+ \qmlmethod AbstractSeries ChartView::createSeries(SeriesType type, string name, AbstractAxis axisX, AbstractAxis axisY)
+ Creates a series object of \a type to the chart with name \a name, optional axis \a axisX and
+ optional axis \a axisY. For example:
+ \code
+ // lineSeries is a LineSeries object that has already been added to the ChartView; re-use it's axes
+ var myAxisX = chartView.axisX(lineSeries);
+ var myAxisY = chartView.axisY(lineSeries);
+ var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter series", myAxisX, myAxisY);
+ \endcode
+*/
+
+/*!
+ \qmlmethod ChartView::removeSeries(AbstractSeries series)
+ Removes the \a series from the chart. The series object is also destroyed.
+*/
+
+/*!
+ \qmlmethod ChartView::removeAllSeries()
+ Removes all series from the chart. All the series objects are also destroyed.
+*/
+
+/*!
+ \qmlmethod Axis ChartView::axisX(AbstractSeries series)
+ The x-axis of the series.
+*/
+
+/*!
+ \qmlmethod Axis ChartView::axisY(AbstractSeries series)
+ The y-axis of the series.
+*/
+
+/*!
+ \qmlmethod ChartView::zoomY(real factor)
+ Zooms in by \a factor on the center of the chart.
+*/
+
+/*!
+ \qmlmethod ChartView::scrollLeft(real pixels)
+ Scrolls to left by \a pixels. This is a convenience function that suits for example for key navigation.
+*/
+
+/*!
+ \qmlmethod ChartView::scrollRight(real pixels)
+ Scrolls to right by \a pixels. This is a convenience function that suits for example for key navigation.
+*/
+
+/*!
+ \qmlmethod ChartView::scrollUp(real pixels)
+ Scrolls up by \a pixels. This is a convenience function that suits for example for key navigation.
+*/
+
+/*!
+ \qmlmethod ChartView::scrollDown(real pixels)
+ Scrolls down by \a pixels. This is a convenience function that suits for example for key navigation.
+*/
+
+/*!
+ \qmlsignal ChartView::onPlotAreaChanged(rect plotArea)
+ The plot area of the chart has changed. This may happen for example, if you modify minimumMargins
+ or if you resize the chart, or if you modify font size related properties of the legend or chart
+ title.
+*/
+
+/*!
+ \qmlsignal ChartView::seriesAdded(AbstractSeries series)
+ The \a series has been added to the chart.
+*/
+
+/*!
+ \qmlsignal ChartView::seriesRemoved(AbstractSeries series)
+ The \a series has been removed from the chart. Please note that \a series is no longer a valid
+ object after the signal handler has completed.
+*/
+
+DeclarativeChart::DeclarativeChart(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+ initChart(QChart::ChartTypeCartesian);
+}
+
+DeclarativeChart::DeclarativeChart(QChart::ChartType type, QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+ initChart(type);
+}
+
+void DeclarativeChart::initChart(QChart::ChartType type)
+{
+ m_currentSceneImage = 0;
+ m_guiThreadId = QThread::currentThreadId();
+ m_paintThreadId = 0;
+ m_updatePending = false;
+
+ if (type == QChart::ChartTypePolar)
+ m_chart = new QPolarChart();
+ else
+ m_chart = new QChart();
+
+ m_scene = new QGraphicsScene(this);
+ m_scene->addItem(m_chart);
+
+ setAntialiasing(QQuickItem::antialiasing());
+ connect(m_scene, SIGNAL(changed(QList<QRectF>)), this, SLOT(sceneChanged(QList<QRectF>)));
+ connect(this, SIGNAL(antialiasingChanged(bool)), this, SLOT(handleAntialiasingChanged(bool)));
+
+ setAcceptedMouseButtons(Qt::AllButtons);
+ setAcceptHoverEvents(true);
+
+ m_margins = new DeclarativeMargins(this);
+ m_margins->setTop(m_chart->margins().top());
+ m_margins->setLeft(m_chart->margins().left());
+ m_margins->setRight(m_chart->margins().right());
+ m_margins->setBottom(m_chart->margins().bottom());
+ connect(m_margins, SIGNAL(topChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
+ connect(m_margins, SIGNAL(bottomChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
+ connect(m_margins, SIGNAL(leftChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
+ connect(m_margins, SIGNAL(rightChanged(int,int,int,int)), this, SLOT(changeMinimumMargins(int,int,int,int)));
+ connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), this, SLOT(handleSeriesAdded(QAbstractSeries*)));
+ connect(m_chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), this, SIGNAL(seriesRemoved(QAbstractSeries*)));
+}
+
+void DeclarativeChart::handleSeriesAdded(QAbstractSeries *series)
+{
+ emit seriesAdded(series);
+}
+
+void DeclarativeChart::changeMinimumMargins(int top, int bottom, int left, int right)
+{
+ m_chart->setMargins(QMargins(left, top, right, bottom));
+ emit minimumMarginsChanged();
+ emit plotAreaChanged(m_chart->plotArea());
+}
+
+DeclarativeChart::~DeclarativeChart()
+{
+ delete m_chart;
+ m_sceneImageLock.lock();
+ delete m_currentSceneImage;
+ m_currentSceneImage = 0;
+ m_sceneImageLock.unlock();
+}
+
+void DeclarativeChart::childEvent(QChildEvent *event)
+{
+ if (event->type() == QEvent::ChildAdded) {
+ if (qobject_cast<QAbstractSeries *>(event->child())) {
+ m_chart->addSeries(qobject_cast<QAbstractSeries *>(event->child()));
+ }
+ }
+}
+
+void DeclarativeChart::componentComplete()
+{
+ foreach (QObject *child, children()) {
+ if (qobject_cast<QAbstractSeries *>(child)) {
+ // Add series to the chart
+ QAbstractSeries *series = qobject_cast<QAbstractSeries *>(child);
+ m_chart->addSeries(series);
+
+ // Connect to axis changed signals (unless this is a pie series)
+ if (!qobject_cast<DeclarativePieSeries *>(series)) {
+ connect(series, SIGNAL(axisXChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*)));
+ connect(series, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SLOT(handleAxisXTopSet(QAbstractAxis*)));
+ connect(series, SIGNAL(axisYChanged(QAbstractAxis*)), this, SLOT(handleAxisYSet(QAbstractAxis*)));
+ connect(series, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SLOT(handleAxisYRightSet(QAbstractAxis*)));
+ }
+
+ initializeAxes(series);
+ }
+ }
+
+ QQuickItem::componentComplete();
+}
+
+void DeclarativeChart::handleAxisXSet(QAbstractAxis *axis)
+{
+ QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
+ if (axis && s) {
+ if (!m_chart->axes(Qt::Horizontal).contains(axis))
+ m_chart->setAxisX(axis, s);
+ if (!s->attachedAxes().contains(axis))
+ s->attachAxis(axis);
+ } else {
+ qWarning() << "Trying to set axisX to null.";
+ }
+}
+
+void DeclarativeChart::handleAxisXTopSet(QAbstractAxis *axis)
+{
+ QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
+ if (axis && s) {
+ if (!m_chart->axes(Qt::Horizontal).contains(axis)) {
+ QList<QAbstractAxis *> oldAxes = m_chart->axes(Qt::Horizontal, s);
+ foreach (QAbstractAxis* a, oldAxes) {
+ m_chart->removeAxis(a);
+ delete a;
+ }
+ m_chart->addAxis(axis, Qt::AlignTop);
+ }
+ if (!s->attachedAxes().contains(axis))
+ s->attachAxis(axis);
+ } else {
+ qWarning() << "Trying to set axisXTop to null.";
+ }
+}
+
+void DeclarativeChart::handleAxisYSet(QAbstractAxis *axis)
+{
+ QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
+ if (axis && s) {
+ if (!m_chart->axes(Qt::Vertical).contains(axis))
+ m_chart->setAxisY(axis, s);
+ if (!s->attachedAxes().contains(axis))
+ s->attachAxis(axis);
+ } else {
+ qWarning() << "Trying to set axisY to null.";
+ }
+}
+
+void DeclarativeChart::handleAxisYRightSet(QAbstractAxis *axis)
+{
+ QAbstractSeries *s = qobject_cast<QAbstractSeries *>(sender());
+ if (axis && s) {
+ if (!m_chart->axes(Qt::Vertical).contains(axis)) {
+ QList<QAbstractAxis *> oldAxes = m_chart->axes((Qt::Vertical), s);
+ foreach (QAbstractAxis* a, oldAxes) {
+ m_chart->removeAxis(a);
+ delete a;
+ }
+ m_chart->addAxis(axis, Qt::AlignRight);
+ }
+ if (!s->attachedAxes().contains(axis))
+ s->attachAxis(axis);
+ } else {
+ qWarning() << "Trying to set axisYRight to null.";
+ }
+}
+
+void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ if (newGeometry.isValid()) {
+ if (newGeometry.width() > 0 && newGeometry.height() > 0) {
+ m_chart->resize(newGeometry.width(), newGeometry.height());
+ }
+ }
+ QQuickItem::geometryChanged(newGeometry, oldGeometry);
+
+ // It would be better to trigger the plotAreaChanged signal from QChart::plotAreaChanged or
+ // similar. Since that kind of a signal is not clearly needed in the C++ API the work-around is
+ // to implement it here for the QML API purposes.
+ emit plotAreaChanged(m_chart->plotArea());
+}
+
+void DeclarativeChart::sceneChanged(QList<QRectF> region)
+{
+ Q_UNUSED(region);
+
+ if (m_guiThreadId == m_paintThreadId) {
+ // Rendering in gui thread, no need for shenannigans, just update
+ update();
+ } else {
+ // Multi-threaded rendering, need to ensure scene is actually rendered in gui thread
+ if (!m_updatePending) {
+ m_updatePending = true;
+ // Do async render to avoid some unnecessary renders.
+ QTimer::singleShot(0, this, SLOT(renderScene()));
+ }
+ }
+}
+
+void DeclarativeChart::renderScene()
+{
+ m_updatePending = false;
+ m_sceneImageLock.lock();
+ delete m_currentSceneImage;
+ m_currentSceneImage = new QImage(m_chart->size().toSize(), QImage::Format_ARGB32);
+ m_currentSceneImage->fill(Qt::transparent);
+ QPainter painter(m_currentSceneImage);
+ if (antialiasing())
+ painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
+ QRect renderRect(QPoint(0, 0), m_chart->size().toSize());
+ m_scene->render(&painter, renderRect, renderRect);
+ m_sceneImageLock.unlock();
+
+ update();
+}
+
+void DeclarativeChart::paint(QPainter *painter)
+{
+ if (!m_paintThreadId) {
+ m_paintThreadId = QThread::currentThreadId();
+ if (m_guiThreadId == m_paintThreadId) {
+ // No need for scene image in single threaded rendering, so delete
+ // the one that got made by default before the rendering type was
+ // detected.
+ delete m_currentSceneImage;
+ m_currentSceneImage = 0;
+ }
+ }
+
+ if (m_guiThreadId == m_paintThreadId) {
+ QRectF renderRect(QPointF(0, 0), m_chart->size());
+ m_scene->render(painter, renderRect, renderRect);
+ } else {
+ m_sceneImageLock.lock();
+ if (m_currentSceneImage) {
+ QRect imageRect(QPoint(0, 0), m_currentSceneImage->size());
+ QRect itemRect(QPoint(0, 0), QSize(width(), height()));
+ painter->drawImage(itemRect, *m_currentSceneImage, imageRect);
+ }
+ m_sceneImageLock.unlock();
+ }
+}
+
+void DeclarativeChart::mousePressEvent(QMouseEvent *event)
+{
+ m_mousePressScenePoint = event->pos();
+ m_mousePressScreenPoint = event->globalPos();
+ m_lastMouseMoveScenePoint = m_mousePressScenePoint;
+ m_lastMouseMoveScreenPoint = m_mousePressScreenPoint;
+ m_mousePressButton = event->button();
+ m_mousePressButtons = event->buttons();
+
+ QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMousePress);
+ mouseEvent.setWidget(0);
+ mouseEvent.setButtonDownScenePos(m_mousePressButton, m_mousePressScenePoint);
+ mouseEvent.setButtonDownScreenPos(m_mousePressButton, m_mousePressScreenPoint);
+ mouseEvent.setScenePos(m_mousePressScenePoint);
+ mouseEvent.setScreenPos(m_mousePressScreenPoint);
+ mouseEvent.setLastScenePos(m_lastMouseMoveScenePoint);
+ mouseEvent.setLastScreenPos(m_lastMouseMoveScreenPoint);
+ mouseEvent.setButtons(m_mousePressButtons);
+ mouseEvent.setButton(m_mousePressButton);
+ mouseEvent.setModifiers(event->modifiers());
+ mouseEvent.setAccepted(false);
+
+ QApplication::sendEvent(m_scene, &mouseEvent);
+}
+
+void DeclarativeChart::mouseReleaseEvent(QMouseEvent *event)
+{
+ QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseRelease);
+ mouseEvent.setWidget(0);
+ mouseEvent.setButtonDownScenePos(m_mousePressButton, m_mousePressScenePoint);
+ mouseEvent.setButtonDownScreenPos(m_mousePressButton, m_mousePressScreenPoint);
+ mouseEvent.setScenePos(event->pos());
+ mouseEvent.setScreenPos(event->globalPos());
+ mouseEvent.setLastScenePos(m_lastMouseMoveScenePoint);
+ mouseEvent.setLastScreenPos(m_lastMouseMoveScreenPoint);
+ mouseEvent.setButtons(event->buttons());
+ mouseEvent.setButton(event->button());
+ mouseEvent.setModifiers(event->modifiers());
+ mouseEvent.setAccepted(false);
+
+ QApplication::sendEvent(m_scene, &mouseEvent);
+
+ m_mousePressButtons = event->buttons();
+ m_mousePressButton = Qt::NoButton;
+}
+
+void DeclarativeChart::hoverMoveEvent(QHoverEvent *event)
+{
+ // Convert hover move to mouse move, since we don't seem to get actual mouse move events.
+ // QGraphicsScene generates hover events from mouse move events, so we don't need
+ // to pass hover events there.
+ QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove);
+ mouseEvent.setWidget(0);
+ mouseEvent.setButtonDownScenePos(m_mousePressButton, m_mousePressScenePoint);
+ mouseEvent.setButtonDownScreenPos(m_mousePressButton, m_mousePressScreenPoint);
+ mouseEvent.setScenePos(event->pos());
+ // Hover events do not have global pos in them, and the screen position doesn't seem to
+ // matter anyway in this use case, so just pass event pos instead of trying to
+ // calculate the real screen position.
+ mouseEvent.setScreenPos(event->pos());
+ mouseEvent.setLastScenePos(m_lastMouseMoveScenePoint);
+ mouseEvent.setLastScreenPos(m_lastMouseMoveScreenPoint);
+ mouseEvent.setButtons(m_mousePressButtons);
+ mouseEvent.setButton(m_mousePressButton);
+ mouseEvent.setModifiers(event->modifiers());
+ m_lastMouseMoveScenePoint = mouseEvent.scenePos();
+ m_lastMouseMoveScreenPoint = mouseEvent.screenPos();
+ mouseEvent.setAccepted(false);
+
+ QApplication::sendEvent(m_scene, &mouseEvent);
+}
+
+void DeclarativeChart::handleAntialiasingChanged(bool enable)
+{
+ setAntialiasing(enable);
+}
+
+void DeclarativeChart::setTheme(DeclarativeChart::Theme theme)
+{
+ QChart::ChartTheme chartTheme = (QChart::ChartTheme) theme;
+ if (chartTheme != m_chart->theme())
+ m_chart->setTheme(chartTheme);
+}
+
+DeclarativeChart::Theme DeclarativeChart::theme()
+{
+ return (DeclarativeChart::Theme) m_chart->theme();
+}
+
+void DeclarativeChart::setAnimationOptions(DeclarativeChart::Animation animations)
+{
+ QChart::AnimationOption animationOptions = (QChart::AnimationOption) animations;
+ if (animationOptions != m_chart->animationOptions())
+ m_chart->setAnimationOptions(animationOptions);
+}
+
+DeclarativeChart::Animation DeclarativeChart::animationOptions()
+{
+ if (m_chart->animationOptions().testFlag(QChart::AllAnimations))
+ return DeclarativeChart::AllAnimations;
+ else if (m_chart->animationOptions().testFlag(QChart::GridAxisAnimations))
+ return DeclarativeChart::GridAxisAnimations;
+ else if (m_chart->animationOptions().testFlag(QChart::SeriesAnimations))
+ return DeclarativeChart::SeriesAnimations;
+ else
+ return DeclarativeChart::NoAnimation;
+}
+
+void DeclarativeChart::setTitle(QString title)
+{
+ if (title != m_chart->title())
+ m_chart->setTitle(title);
+}
+QString DeclarativeChart::title()
+{
+ return m_chart->title();
+}
+
+QAbstractAxis *DeclarativeChart::axisX(QAbstractSeries *series)
+{
+ QList<QAbstractAxis *> axes = m_chart->axes(Qt::Horizontal, series);
+ if (axes.count())
+ return axes[0];
+ return 0;
+}
+
+QAbstractAxis *DeclarativeChart::axisY(QAbstractSeries *series)
+{
+ QList<QAbstractAxis *> axes = m_chart->axes(Qt::Vertical, series);
+ if (axes.count())
+ return axes[0];
+ return 0;
+}
+
+QLegend *DeclarativeChart::legend()
+{
+ return m_chart->legend();
+}
+
+void DeclarativeChart::setTitleColor(QColor color)
+{
+ QBrush b = m_chart->titleBrush();
+ if (color != b.color()) {
+ b.setColor(color);
+ m_chart->setTitleBrush(b);
+ emit titleColorChanged(color);
+ }
+}
+
+QFont DeclarativeChart::titleFont() const
+{
+ return m_chart->titleFont();
+}
+
+void DeclarativeChart::setTitleFont(const QFont &font)
+{
+ m_chart->setTitleFont(font);
+}
+
+QColor DeclarativeChart::titleColor()
+{
+ return m_chart->titleBrush().color();
+}
+
+void DeclarativeChart::setBackgroundColor(QColor color)
+{
+ QBrush b = m_chart->backgroundBrush();
+ if (b.style() != Qt::SolidPattern || color != b.color()) {
+ b.setStyle(Qt::SolidPattern);
+ b.setColor(color);
+ m_chart->setBackgroundBrush(b);
+ emit backgroundColorChanged();
+ }
+}
+
+QColor DeclarativeChart::backgroundColor()
+{
+ return m_chart->backgroundBrush().color();
+}
+
+void QtCharts::DeclarativeChart::setPlotAreaColor(QColor color)
+{
+ QBrush b = m_chart->plotAreaBackgroundBrush();
+ if (b.style() != Qt::SolidPattern || color != b.color()) {
+ b.setStyle(Qt::SolidPattern);
+ b.setColor(color);
+ m_chart->setPlotAreaBackgroundBrush(b);
+ m_chart->setPlotAreaBackgroundVisible(true);
+ emit plotAreaColorChanged();
+ }
+}
+
+QColor QtCharts::DeclarativeChart::plotAreaColor()
+{
+ return m_chart->plotAreaBackgroundBrush().color();
+}
+
+void DeclarativeChart::setLocalizeNumbers(bool localize)
+{
+ if (m_chart->localizeNumbers() != localize) {
+ m_chart->setLocalizeNumbers(localize);
+ emit localizeNumbersChanged();
+ }
+}
+
+bool DeclarativeChart::localizeNumbers() const
+{
+ return m_chart->localizeNumbers();
+}
+
+void QtCharts::DeclarativeChart::setLocale(const QLocale &locale)
+{
+ if (m_chart->locale() != locale) {
+ m_chart->setLocale(locale);
+ emit localeChanged();
+ }
+}
+
+QLocale QtCharts::DeclarativeChart::locale() const
+{
+ return m_chart->locale();
+}
+
+int DeclarativeChart::count()
+{
+ return m_chart->series().count();
+}
+
+void DeclarativeChart::setDropShadowEnabled(bool enabled)
+{
+ if (enabled != m_chart->isDropShadowEnabled()) {
+ m_chart->setDropShadowEnabled(enabled);
+ dropShadowEnabledChanged(enabled);
+ }
+}
+
+bool DeclarativeChart::dropShadowEnabled()
+{
+ return m_chart->isDropShadowEnabled();
+}
+
+qreal DeclarativeChart::backgroundRoundness() const
+{
+ return m_chart->backgroundRoundness();
+}
+
+void DeclarativeChart::setBackgroundRoundness(qreal diameter)
+{
+ if (m_chart->backgroundRoundness() != diameter) {
+ m_chart->setBackgroundRoundness(diameter);
+ emit backgroundRoundnessChanged(diameter);
+ }
+}
+
+qreal DeclarativeChart::topMargin()
+{
+ qWarning() << "ChartView.topMargin is deprecated. Use margins instead.";
+ return m_chart->margins().top();
+}
+
+qreal DeclarativeChart::bottomMargin()
+{
+ qWarning() << "ChartView.bottomMargin is deprecated. Use margins instead.";
+ return m_chart->margins().bottom();
+}
+
+qreal DeclarativeChart::leftMargin()
+{
+ qWarning() << "ChartView.leftMargin is deprecated. Use margins instead.";
+ return m_chart->margins().left();
+}
+
+qreal DeclarativeChart::rightMargin()
+{
+ qWarning() << "ChartView.rightMargin is deprecated. Use margins instead.";
+ return m_chart->margins().right();
+}
+
+void DeclarativeChart::zoom(qreal factor)
+{
+ m_chart->zoom(factor);
+}
+
+void DeclarativeChart::scrollLeft(qreal pixels)
+{
+ m_chart->scroll(-pixels, 0);
+}
+
+void DeclarativeChart::scrollRight(qreal pixels)
+{
+ m_chart->scroll(pixels, 0);
+}
+
+void DeclarativeChart::scrollUp(qreal pixels)
+{
+ m_chart->scroll(0, pixels);
+}
+
+void DeclarativeChart::scrollDown(qreal pixels)
+{
+ m_chart->scroll(0, -pixels);
+}
+
+QQmlListProperty<QAbstractAxis> DeclarativeChart::axes()
+{
+ return QQmlListProperty<QAbstractAxis>(this, 0,
+ &DeclarativeChart::axesAppendFunc,
+ &DeclarativeChart::axesCountFunc,
+ &DeclarativeChart::axesAtFunc,
+ &DeclarativeChart::axesClearFunc);
+}
+
+void DeclarativeChart::axesAppendFunc(QQmlListProperty<QAbstractAxis> *list, QAbstractAxis *element)
+{
+ // Empty implementation
+ Q_UNUSED(list);
+ Q_UNUSED(element);
+}
+
+int DeclarativeChart::axesCountFunc(QQmlListProperty<QAbstractAxis> *list)
+{
+ if (qobject_cast<DeclarativeChart *>(list->object)) {
+ DeclarativeChart *chart = qobject_cast<DeclarativeChart *>(list->object);
+ return chart->m_chart->axes(Qt::Horizontal | Qt::Vertical).count();
+ }
+ return 0;
+}
+
+QAbstractAxis *DeclarativeChart::axesAtFunc(QQmlListProperty<QAbstractAxis> *list, int index)
+{
+ if (qobject_cast<DeclarativeChart *>(list->object)) {
+ DeclarativeChart *chart = qobject_cast<DeclarativeChart *>(list->object);
+ QList<QAbstractAxis *> axes = chart->m_chart->axes(Qt::Horizontal | Qt::Vertical, chart->m_chart->series()[0]);
+ return axes.at(index);
+ }
+ return 0;
+}
+
+void DeclarativeChart::axesClearFunc(QQmlListProperty<QAbstractAxis> *list)
+{
+ // Empty implementation
+ Q_UNUSED(list);
+}
+
+
+QAbstractSeries *DeclarativeChart::series(int index)
+{
+ if (index < m_chart->series().count()) {
+ return m_chart->series().at(index);
+ }
+ return 0;
+}
+
+QAbstractSeries *DeclarativeChart::series(QString seriesName)
+{
+ foreach (QAbstractSeries *series, m_chart->series()) {
+ if (series->name() == seriesName)
+ return series;
+ }
+ return 0;
+}
+
+QAbstractSeries *DeclarativeChart::createSeries(int type, QString name, QAbstractAxis *axisX, QAbstractAxis *axisY)
+{
+ QAbstractSeries *series = 0;
+
+ switch (type) {
+ case DeclarativeChart::SeriesTypeLine:
+ series = new DeclarativeLineSeries();
+ break;
+ case DeclarativeChart::SeriesTypeArea: {
+ DeclarativeAreaSeries *area = new DeclarativeAreaSeries();
+ area->setUpperSeries(new DeclarativeLineSeries());
+ series = area;
+ break;
+ }
+ case DeclarativeChart::SeriesTypeStackedBar:
+ series = new DeclarativeStackedBarSeries();
+ break;
+ case DeclarativeChart::SeriesTypePercentBar:
+ series = new DeclarativePercentBarSeries();
+ break;
+ case DeclarativeChart::SeriesTypeBar:
+ series = new DeclarativeBarSeries();
+ break;
+ case DeclarativeChart::SeriesTypeHorizontalBar:
+ series = new DeclarativeHorizontalBarSeries();
+ break;
+ case DeclarativeChart::SeriesTypeHorizontalPercentBar:
+ series = new DeclarativeHorizontalPercentBarSeries();
+ break;
+ case DeclarativeChart::SeriesTypeHorizontalStackedBar:
+ series = new DeclarativeHorizontalStackedBarSeries();
+ break;
+ case DeclarativeChart::SeriesTypeBoxPlot:
+ series = new DeclarativeBoxPlotSeries();
+ break;
+ case DeclarativeChart::SeriesTypePie:
+ series = new DeclarativePieSeries();
+ break;
+ case DeclarativeChart::SeriesTypeScatter:
+ series = new DeclarativeScatterSeries();
+ break;
+ case DeclarativeChart::SeriesTypeSpline:
+ series = new DeclarativeSplineSeries();
+ break;
+ default:
+ qWarning() << "Illegal series type";
+ }
+
+ if (series) {
+ // Connect to axis changed signals (unless this is a pie series)
+ if (!qobject_cast<DeclarativePieSeries *>(series)) {
+ connect(series, SIGNAL(axisXChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*)));
+ connect(series, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SLOT(handleAxisXSet(QAbstractAxis*)));
+ connect(series, SIGNAL(axisYChanged(QAbstractAxis*)), this, SLOT(handleAxisYSet(QAbstractAxis*)));
+ connect(series, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SLOT(handleAxisYRightSet(QAbstractAxis*)));
+ }
+
+ series->setName(name);
+ m_chart->addSeries(series);
+
+ if (axisX)
+ setAxisX(axisX, series);
+ if (axisY)
+ setAxisY(axisY, series);
+
+ if (series->attachedAxes().count() < 2)
+ initializeAxes(series);
+ }
+
+ return series;
+}
+
+void DeclarativeChart::removeSeries(QAbstractSeries *series)
+{
+ if (series)
+ m_chart->removeSeries(series);
+ else
+ qWarning("removeSeries: cannot remove null");
+}
+
+void DeclarativeChart::setAxisX(QAbstractAxis *axis, QAbstractSeries *series)
+{
+ if (axis)
+ m_chart->setAxisX(axis, series);
+}
+
+void DeclarativeChart::setAxisY(QAbstractAxis *axis, QAbstractSeries *series)
+{
+ if (axis)
+ m_chart->setAxisY(axis, series);
+}
+
+void DeclarativeChart::createDefaultAxes()
+{
+ qWarning() << "ChartView.createDefaultAxes() is deprecated. Axes are created automatically.";
+}
+
+QAbstractAxis *DeclarativeChart::defaultAxis(Qt::Orientation orientation, QAbstractSeries *series)
+{
+ if (!series) {
+ qWarning() << "No axis type defined for null series";
+ return 0;
+ }
+
+ foreach (QAbstractAxis *existingAxis, m_chart->axes(orientation)) {
+ if (existingAxis->type() == series->d_ptr->defaultAxisType(orientation))
+ return existingAxis;
+ }
+
+ switch (series->d_ptr->defaultAxisType(orientation)) {
+ case QAbstractAxis::AxisTypeValue:
+ return new QValueAxis(this);
+ case QAbstractAxis::AxisTypeBarCategory:
+ return new QBarCategoryAxis(this);
+ case QAbstractAxis::AxisTypeCategory:
+ return new QCategoryAxis(this);
+#ifndef QT_ON_ARM
+ case QAbstractAxis::AxisTypeDateTime:
+ return new QDateTimeAxis(this);
+#endif
+ case QAbstractAxis::AxisTypeLogValue:
+ return new QLogValueAxis(this);
+ default:
+ // assume AxisTypeNoAxis
+ return 0;
+ }
+}
+
+void DeclarativeChart::initializeAxes(QAbstractSeries *series)
+{
+ if (qobject_cast<DeclarativeLineSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeLineSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativeScatterSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeScatterSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativeSplineSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeSplineSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativeAreaSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeAreaSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativeBarSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeBarSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativeStackedBarSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeStackedBarSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativePercentBarSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativePercentBarSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativeHorizontalBarSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeHorizontalBarSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativeHorizontalStackedBarSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeHorizontalStackedBarSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativeHorizontalPercentBarSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeHorizontalPercentBarSeries *>(series)->m_axes);
+ else if (qobject_cast<DeclarativeBoxPlotSeries *>(series))
+ doInitializeAxes(series, qobject_cast<DeclarativeBoxPlotSeries *>(series)->m_axes);
+ // else: do nothing
+}
+
+void DeclarativeChart::doInitializeAxes(QAbstractSeries *series, DeclarativeAxes *axes)
+{
+ // Initialize axis X
+ if (axes->axisX())
+ axes->emitAxisXChanged();
+ else if (axes->axisXTop())
+ axes->emitAxisXTopChanged();
+ else
+ axes->setAxisX(defaultAxis(Qt::Horizontal, series));
+
+ // Initialize axis Y
+ if (axes->axisY())
+ axes->emitAxisYChanged();
+ else if (axes->axisYRight())
+ axes->emitAxisYRightChanged();
+ else
+ axes->setAxisY(defaultAxis(Qt::Vertical, series));
+}
+
+#include "moc_declarativechart.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativechart.h b/src/chartsqml2/declarativechart.h
new file mode 100644
index 00000000..b9936eb6
--- /dev/null
+++ b/src/chartsqml2/declarativechart.h
@@ -0,0 +1,231 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVECHART_H
+#define DECLARATIVECHART_H
+
+#include <QtCore/QtGlobal>
+#include <QtQuick/QQuickItem>
+#include <QtQuick/QQuickPaintedItem>
+#include <QtWidgets/QGraphicsScene>
+#include <QtCore/QMutex>
+
+#include "qchart.h"
+#include <QtCore/QLocale>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativeMargins;
+class Domain;
+class DeclarativeAxes;
+
+class DeclarativeChart : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(Theme theme READ theme WRITE setTheme)
+ Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions)
+ Q_PROPERTY(QString title READ title WRITE setTitle)
+ Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont)
+ Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged)
+ Q_PROPERTY(QLegend *legend READ legend CONSTANT)
+ Q_PROPERTY(int count READ count)
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
+ Q_PROPERTY(bool dropShadowEnabled READ dropShadowEnabled WRITE setDropShadowEnabled NOTIFY dropShadowEnabledChanged)
+ Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness NOTIFY backgroundRoundnessChanged REVISION 3)
+ Q_PROPERTY(qreal topMargin READ topMargin)
+ Q_PROPERTY(qreal bottomMargin READ bottomMargin)
+ Q_PROPERTY(qreal leftMargin READ leftMargin)
+ Q_PROPERTY(qreal rightMargin READ rightMargin)
+ Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins NOTIFY minimumMarginsChanged REVISION 1)
+ Q_PROPERTY(DeclarativeMargins *margins READ margins NOTIFY marginsChanged REVISION 2)
+ Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1)
+ Q_PROPERTY(QColor plotAreaColor READ plotAreaColor WRITE setPlotAreaColor NOTIFY plotAreaColorChanged REVISION 3)
+ Q_PROPERTY(QQmlListProperty<QAbstractAxis> axes READ axes REVISION 2)
+ Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers NOTIFY localizeNumbersChanged REVISION 4)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged REVISION 4)
+ Q_ENUMS(Animation)
+ Q_ENUMS(Theme)
+ Q_ENUMS(SeriesType)
+
+public:
+ // duplicating enums from QChart to make the QML api namings 1-to-1 with the C++ api
+ enum Theme {
+ ChartThemeLight = 0,
+ ChartThemeBlueCerulean,
+ ChartThemeDark,
+ ChartThemeBrownSand,
+ ChartThemeBlueNcs,
+ ChartThemeHighContrast,
+ ChartThemeBlueIcy,
+ ChartThemeQt
+ };
+
+ enum Animation {
+ NoAnimation = 0x0,
+ GridAxisAnimations = 0x1,
+ SeriesAnimations = 0x2,
+ AllAnimations = 0x3
+ };
+
+ enum SeriesType {
+ SeriesTypeLine,
+ SeriesTypeArea,
+ SeriesTypeBar,
+ SeriesTypeStackedBar,
+ SeriesTypePercentBar,
+ SeriesTypeBoxPlot,
+ SeriesTypePie,
+ SeriesTypeScatter,
+ SeriesTypeSpline,
+ SeriesTypeHorizontalBar,
+ SeriesTypeHorizontalStackedBar,
+ SeriesTypeHorizontalPercentBar
+ };
+
+public:
+ DeclarativeChart(QQuickItem *parent = 0);
+ ~DeclarativeChart();
+
+public: // From parent classes
+ void childEvent(QChildEvent *event);
+ void componentComplete();
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
+ void paint(QPainter *painter);
+protected:
+ void mousePressEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+ void hoverMoveEvent(QHoverEvent *event);
+private Q_SLOTS:
+ void handleAntialiasingChanged(bool enable);
+ void sceneChanged(QList<QRectF> region);
+ void renderScene();
+
+public:
+ void setTheme(DeclarativeChart::Theme theme);
+ DeclarativeChart::Theme theme();
+ void setAnimationOptions(DeclarativeChart::Animation animations);
+ DeclarativeChart::Animation animationOptions();
+ void setTitle(QString title);
+ QString title();
+ QLegend *legend();
+ QFont titleFont() const;
+ void setTitleFont(const QFont &font);
+ void setTitleColor(QColor color);
+ QColor titleColor();
+ void setBackgroundColor(QColor color);
+ QColor backgroundColor();
+ Q_REVISION(3) void setPlotAreaColor(QColor color);
+ Q_REVISION(3) QColor plotAreaColor();
+ Q_REVISION(4) void setLocalizeNumbers(bool localize);
+ Q_REVISION(4) bool localizeNumbers() const;
+ Q_REVISION(4) void setLocale(const QLocale &locale);
+ Q_REVISION(4) QLocale locale() const;
+
+ int count();
+ void setDropShadowEnabled(bool enabled);
+ bool dropShadowEnabled();
+ Q_REVISION(3) qreal backgroundRoundness() const;
+ Q_REVISION(3) void setBackgroundRoundness(qreal diameter);
+
+ // Margins & plotArea
+ qreal topMargin();
+ qreal bottomMargin();
+ qreal leftMargin();
+ qreal rightMargin();
+ DeclarativeMargins *minimumMargins() { return m_margins; }
+ Q_REVISION(2) DeclarativeMargins *margins() { return m_margins; }
+ QRectF plotArea() { return m_chart->plotArea(); }
+
+ // Axis handling
+ QAbstractAxis *defaultAxis(Qt::Orientation orientation, QAbstractSeries *series);
+ void initializeAxes(QAbstractSeries *series);
+ void doInitializeAxes(QAbstractSeries *series, DeclarativeAxes *axes);
+ QQmlListProperty<QAbstractAxis> axes();
+ static void axesAppendFunc(QQmlListProperty<QAbstractAxis> *list, QAbstractAxis *element);
+ static int axesCountFunc(QQmlListProperty<QAbstractAxis> *list);
+ static QAbstractAxis *axesAtFunc(QQmlListProperty<QAbstractAxis> *list, int index);
+ static void axesClearFunc(QQmlListProperty<QAbstractAxis> *list);
+
+public:
+ Q_INVOKABLE QAbstractSeries *series(int index);
+ Q_INVOKABLE QAbstractSeries *series(QString seriesName);
+ Q_INVOKABLE QAbstractSeries *createSeries(int type, QString name = "", QAbstractAxis *axisX = 0, QAbstractAxis *axisY = 0);
+ Q_INVOKABLE void removeSeries(QAbstractSeries *series);
+ Q_INVOKABLE void removeAllSeries() { m_chart->removeAllSeries(); }
+ Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0);
+ Q_INVOKABLE void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0);
+ Q_INVOKABLE void createDefaultAxes();
+ Q_INVOKABLE QAbstractAxis *axisX(QAbstractSeries *series = 0);
+ Q_INVOKABLE QAbstractAxis *axisY(QAbstractSeries *series = 0);
+ Q_INVOKABLE void zoom(qreal factor);
+ Q_INVOKABLE void scrollLeft(qreal pixels);
+ Q_INVOKABLE void scrollRight(qreal pixels);
+ Q_INVOKABLE void scrollUp(qreal pixels);
+ Q_INVOKABLE void scrollDown(qreal pixels);
+
+Q_SIGNALS:
+ void axisLabelsChanged();
+ void titleColorChanged(QColor color);
+ void backgroundColorChanged();
+ void dropShadowEnabledChanged(bool enabled);
+ void minimumMarginsChanged();
+ Q_REVISION(2) void marginsChanged();
+ void plotAreaChanged(QRectF plotArea);
+ void seriesAdded(QAbstractSeries *series);
+ void seriesRemoved(QAbstractSeries *series);
+ Q_REVISION(3) void plotAreaColorChanged();
+ Q_REVISION(3) void backgroundRoundnessChanged(qreal diameter);
+ Q_REVISION(4) void localizeNumbersChanged();
+ Q_REVISION(4) void localeChanged();
+
+private Q_SLOTS:
+ void changeMinimumMargins(int top, int bottom, int left, int right);
+ void handleAxisXSet(QAbstractAxis *axis);
+ void handleAxisYSet(QAbstractAxis *axis);
+ void handleAxisXTopSet(QAbstractAxis *axis);
+ void handleAxisYRightSet(QAbstractAxis *axis);
+ void handleSeriesAdded(QAbstractSeries *series);
+
+protected:
+ explicit DeclarativeChart(QChart::ChartType type, QQuickItem *parent);
+
+private:
+ void initChart(QChart::ChartType type);
+ // Extending QChart with DeclarativeChart is not possible because QObject does not support
+ // multi inheritance, so we now have a QChart as a member instead
+ QChart *m_chart;
+ QGraphicsScene *m_scene;
+ QPointF m_mousePressScenePoint;
+ QPoint m_mousePressScreenPoint;
+ QPointF m_lastMouseMoveScenePoint;
+ QPoint m_lastMouseMoveScreenPoint;
+ Qt::MouseButton m_mousePressButton;
+ Qt::MouseButtons m_mousePressButtons;
+ QMutex m_sceneImageLock;
+ QImage *m_currentSceneImage;
+ bool m_updatePending;
+ Qt::HANDLE m_paintThreadId;
+ Qt::HANDLE m_guiThreadId;
+ DeclarativeMargins *m_margins;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVECHART_H
diff --git a/src/chartsqml2/declarativelineseries.cpp b/src/chartsqml2/declarativelineseries.cpp
new file mode 100644
index 00000000..70914a91
--- /dev/null
+++ b/src/chartsqml2/declarativelineseries.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativelineseries.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) :
+ QLineSeries(parent),
+ m_axes(new DeclarativeAxes(this))
+{
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
+ connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
+ connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
+}
+
+void DeclarativeLineSeries::handleCountChanged(int index)
+{
+ Q_UNUSED(index)
+ emit countChanged(points().count());
+}
+
+qreal DeclarativeLineSeries::width() const
+{
+ return pen().widthF();
+}
+
+void DeclarativeLineSeries::setWidth(qreal width)
+{
+ if (width != pen().widthF()) {
+ QPen p = pen();
+ p.setWidthF(width);
+ setPen(p);
+ emit widthChanged(width);
+ }
+}
+
+Qt::PenStyle DeclarativeLineSeries::style() const
+{
+ return pen().style();
+}
+
+void DeclarativeLineSeries::setStyle(Qt::PenStyle style)
+{
+ if (style != pen().style()) {
+ QPen p = pen();
+ p.setStyle(style);
+ setPen(p);
+ emit styleChanged(style);
+ }
+}
+
+Qt::PenCapStyle DeclarativeLineSeries::capStyle() const
+{
+ return pen().capStyle();
+}
+
+void DeclarativeLineSeries::setCapStyle(Qt::PenCapStyle capStyle)
+{
+ if (capStyle != pen().capStyle()) {
+ QPen p = pen();
+ p.setCapStyle(capStyle);
+ setPen(p);
+ emit capStyleChanged(capStyle);
+ }
+}
+
+QQmlListProperty<QObject> DeclarativeLineSeries::declarativeChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &appendDeclarativeChildren ,0,0,0);
+}
+
+void DeclarativeLineSeries::appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element)
+{
+ Q_UNUSED(list)
+ Q_UNUSED(element)
+ // Empty implementation, children are parsed in componentComplete
+}
+
+#include "moc_declarativelineseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativelineseries.h b/src/chartsqml2/declarativelineseries.h
new file mode 100644
index 00000000..aab115c1
--- /dev/null
+++ b/src/chartsqml2/declarativelineseries.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVELINESERIES_H
+#define DECLARATIVELINESERIES_H
+
+#include "qlineseries.h"
+#include "declarativexyseries.h"
+#include "declarativeaxes.h"
+
+#include <QtQml/QQmlListProperty>
+#include <QtQml/QQmlParserStatus>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
+ Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
+ Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1)
+ Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1)
+ Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1)
+ Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
+ Q_CLASSINFO("DefaultProperty", "declarativeChildren")
+
+public:
+ explicit DeclarativeLineSeries(QObject *parent = 0);
+ QXYSeries *xySeries() { return this; }
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
+ Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
+ Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ qreal width() const;
+ void setWidth(qreal width);
+ Qt::PenStyle style() const;
+ void setStyle(Qt::PenStyle style);
+ Qt::PenCapStyle capStyle() const;
+ void setCapStyle(Qt::PenCapStyle capStyle);
+ QQmlListProperty<QObject> declarativeChildren();
+
+public: // from QDeclarativeParserStatus
+ void classBegin() { DeclarativeXySeries::classBegin(); }
+ void componentComplete() { DeclarativeXySeries::componentComplete(); }
+
+public:
+ Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
+ Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
+ Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); }
+ Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
+ Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); }
+ Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
+ Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
+ Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
+
+Q_SIGNALS:
+ void countChanged(int count);
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+ Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
+ Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void widthChanged(qreal width);
+ Q_REVISION(1) void styleChanged(Qt::PenStyle style);
+ Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle);
+
+public Q_SLOTS:
+ static void appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element);
+ void handleCountChanged(int index);
+
+public:
+ DeclarativeAxes *m_axes;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVELINESERIES_H
diff --git a/src/chartsqml2/declarativemargins.cpp b/src/chartsqml2/declarativemargins.cpp
new file mode 100644
index 00000000..f9a913c8
--- /dev/null
+++ b/src/chartsqml2/declarativemargins.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativemargins.h"
+#include <QDataStream>
+#include <QDebug>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Margins
+ \inqmlmodule QtCharts
+
+ Uncreatable type that is used to define top, bottom, left and right margins.
+*/
+
+/*!
+ \qmlproperty int Margins::top
+ The top margin.
+*/
+
+/*!
+ \qmlproperty int Margins::bottom
+ The bottom margin.
+*/
+
+/*!
+ \qmlproperty int Margins::left
+ The left margin.
+*/
+
+/*!
+ \qmlproperty int Margins::right
+ The right margin.
+*/
+
+DeclarativeMargins::DeclarativeMargins(QObject *parent) :
+ QObject(parent)
+{
+ QMargins::setTop(0);
+ QMargins::setBottom(0);
+ QMargins::setLeft(0);
+ QMargins::setRight(0);
+}
+
+void DeclarativeMargins::setTop(int top)
+{
+ if (top < 0) {
+ qWarning() << "Cannot set top margin to a negative value:" << top;
+ } else {
+ if (top != QMargins::top()) {
+ QMargins::setTop(top);
+ emit topChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right());
+ }
+ }
+}
+
+void DeclarativeMargins::setBottom(int bottom)
+{
+ if (bottom < 0) {
+ qWarning() << "Cannot set bottom margin to a negative value:" << bottom;
+ } else {
+ if (bottom != QMargins::bottom()) {
+ QMargins::setBottom(bottom);
+ emit bottomChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right());
+ }
+ }
+}
+
+void DeclarativeMargins::setLeft(int left)
+{
+ if (left < 0) {
+ qWarning() << "Cannot set left margin to a negative value:" << left;
+ } else {
+ if (left != QMargins::left()) {
+ QMargins::setLeft(left);
+ emit leftChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right());
+ }
+ }
+}
+
+void DeclarativeMargins::setRight(int right)
+{
+ if (right < 0) {
+ qWarning() << "Cannot set left margin to a negative value:" << right;
+ } else {
+ if (right != QMargins::right()) {
+ QMargins::setRight(right);
+ emit rightChanged(QMargins::top(), QMargins::bottom(), QMargins::left(), QMargins::right());
+ }
+ }
+}
+
+#include "moc_declarativemargins.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativemargins.h b/src/chartsqml2/declarativemargins.h
new file mode 100644
index 00000000..3a346ce7
--- /dev/null
+++ b/src/chartsqml2/declarativemargins.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVE_MARGINS_H
+#define DECLARATIVE_MARGINS_H
+
+#include "qchartglobal.h"
+#include <QObject>
+#include <QMargins>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativeMargins : public QObject, public QMargins
+{
+ Q_OBJECT
+ Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged)
+ Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
+ Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged)
+ Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightChanged)
+
+public:
+ explicit DeclarativeMargins(QObject *parent = 0);
+ void setTop(int top);
+ void setBottom(int bottom);
+ void setLeft(int left);
+ void setRight(int right);
+
+Q_SIGNALS:
+ void topChanged(int top, int bottom, int left, int right);
+ void bottomChanged(int top, int bottom, int left, int right);
+ void leftChanged(int top, int bottom, int left, int right);
+ void rightChanged(int top, int bottom, int left, int right);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVE_MARGINS_H
diff --git a/src/chartsqml2/declarativepieseries.cpp b/src/chartsqml2/declarativepieseries.cpp
new file mode 100644
index 00000000..619d7c32
--- /dev/null
+++ b/src/chartsqml2/declarativepieseries.cpp
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativepieseries.h"
+#include "qpieslice.h"
+#include "qvpiemodelmapper.h"
+#include "qhpiemodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+DeclarativePieSlice::DeclarativePieSlice(QObject *parent)
+ : QPieSlice(parent)
+{
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
+}
+
+QString DeclarativePieSlice::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativePieSlice::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QPieSlice::brush().textureImage() != brushImage) {
+ QBrush brush = QPieSlice::brush();
+ brush.setTextureImage(brushImage);
+ QPieSlice::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativePieSlice::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QPieSlice::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
+// Declarative pie series =========================================================================
+DeclarativePieSeries::DeclarativePieSeries(QQuickItem *parent) :
+ QPieSeries(parent)
+{
+ connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>)));
+ connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>)));
+}
+
+void DeclarativePieSeries::classBegin()
+{
+}
+
+void DeclarativePieSeries::componentComplete()
+{
+ foreach (QObject *child, children()) {
+ if (qobject_cast<QPieSlice *>(child)) {
+ QPieSeries::append(qobject_cast<QPieSlice *>(child));
+ } else if (qobject_cast<QVPieModelMapper *>(child)) {
+ QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child);
+ mapper->setSeries(this);
+ } else if (qobject_cast<QHPieModelMapper *>(child)) {
+ QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child);
+ mapper->setSeries(this);
+ }
+ }
+}
+
+QQmlListProperty<QObject> DeclarativePieSeries::seriesChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren ,0,0,0);
+}
+
+void DeclarativePieSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
+{
+ // Empty implementation; the children are parsed in componentComplete instead
+ Q_UNUSED(list);
+ Q_UNUSED(element);
+}
+
+QPieSlice *DeclarativePieSeries::at(int index)
+{
+ QList<QPieSlice *> sliceList = slices();
+ if (index >= 0 && index < sliceList.count())
+ return sliceList[index];
+
+ return 0;
+}
+
+QPieSlice *DeclarativePieSeries::find(QString label)
+{
+ foreach (QPieSlice *slice, slices()) {
+ if (slice->label() == label)
+ return slice;
+ }
+ return 0;
+}
+
+DeclarativePieSlice *DeclarativePieSeries::append(QString label, qreal value)
+{
+ DeclarativePieSlice *slice = new DeclarativePieSlice(this);
+ slice->setLabel(label);
+ slice->setValue(value);
+ if (QPieSeries::append(slice))
+ return slice;
+ delete slice;
+ return 0;
+}
+
+bool DeclarativePieSeries::remove(QPieSlice *slice)
+{
+ return QPieSeries::remove(slice);
+}
+
+void DeclarativePieSeries::clear()
+{
+ QPieSeries::clear();
+}
+
+void DeclarativePieSeries::handleAdded(QList<QPieSlice *> slices)
+{
+ foreach (QPieSlice *slice, slices)
+ emit sliceAdded(slice);
+}
+
+void DeclarativePieSeries::handleRemoved(QList<QPieSlice *> slices)
+{
+ foreach (QPieSlice *slice, slices)
+ emit sliceRemoved(slice);
+}
+
+#include "moc_declarativepieseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativepieseries.h b/src/chartsqml2/declarativepieseries.h
new file mode 100644
index 00000000..2fbddb67
--- /dev/null
+++ b/src/chartsqml2/declarativepieseries.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVEPIESERIES_H
+#define DECLARATIVEPIESERIES_H
+
+#include "qpieseries.h"
+#include "qpieslice.h"
+
+#include <QtQuick/QQuickItem>
+#include <QtQml/QQmlParserStatus>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativePieSlice : public QPieSlice
+{
+ Q_OBJECT
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged)
+
+public:
+ explicit DeclarativePieSlice(QObject *parent = 0);
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
+
+Q_SIGNALS:
+ void brushFilenameChanged(const QString &brushFilename);
+
+private Q_SLOTS:
+ void handleBrushChanged();
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
+};
+
+class DeclarativePieSeries : public QPieSeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+ Q_CLASSINFO("DefaultProperty", "seriesChildren")
+
+public:
+ explicit DeclarativePieSeries(QQuickItem *parent = 0);
+ QQmlListProperty<QObject> seriesChildren();
+ Q_INVOKABLE QPieSlice *at(int index);
+ Q_INVOKABLE QPieSlice *find(QString label);
+ Q_INVOKABLE DeclarativePieSlice *append(QString label, qreal value);
+ Q_INVOKABLE bool remove(QPieSlice *slice);
+ Q_INVOKABLE void clear();
+
+public:
+ void classBegin();
+ void componentComplete();
+
+Q_SIGNALS:
+ void sliceAdded(QPieSlice *slice);
+ void sliceRemoved(QPieSlice *slice);
+
+public Q_SLOTS:
+ static void appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element);
+ void handleAdded(QList<QPieSlice *> slices);
+ void handleRemoved(QList<QPieSlice *> slices);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVEPIESERIES_H
diff --git a/src/chartsqml2/declarativepolarchart.cpp b/src/chartsqml2/declarativepolarchart.cpp
new file mode 100644
index 00000000..0d5328cd
--- /dev/null
+++ b/src/chartsqml2/declarativepolarchart.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativepolarchart.h"
+#include "qchart.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \qmltype PolarChartView
+ \instantiates DeclarativePolarChart
+ \inqmlmodule QtCharts
+
+ PolarChartView element is the parent that is responsible for showing different chart series
+ types in a polar chart.
+
+ Polar charts support line, spline, area, and scatter series, and all axis types
+ supported by those series.
+
+ \note When setting ticks to an angular ValueAxis, keep in mind that the first and last tick
+ are co-located at 0/360 degree angle.
+
+ \note If the angular distance between two consecutive points in a series is more than 180
+ degrees, any line connecting the two points becomes meaningless, so choose the axis ranges
+ accordingly when displaying line, spline, or area series.
+
+ The following QML shows how to create a polar chart with two series:
+ \snippet qmlpolarchart/qml/qmlpolarchart/View1.qml 1
+
+ \beginfloatleft
+ \image examples_qmlpolarchart1.png
+ \endfloat
+ \clearfloat
+*/
+
+DeclarativePolarChart::DeclarativePolarChart(QQuickItem *parent)
+ : DeclarativeChart(QChart::ChartTypePolar, parent)
+{
+}
+
+DeclarativePolarChart::~DeclarativePolarChart()
+{
+}
+
+#include "moc_declarativepolarchart.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativepolarchart.h b/src/chartsqml2/declarativepolarchart.h
new file mode 100644
index 00000000..80b80b3e
--- /dev/null
+++ b/src/chartsqml2/declarativepolarchart.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVEPOLARCHART_H
+#define DECLARATIVEPOLARCHART_H
+
+#include <QtCore/QtGlobal>
+#include <QtQuick/QQuickItem>
+
+#include "declarativechart.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativePolarChart : public DeclarativeChart
+{
+ Q_OBJECT
+public:
+ DeclarativePolarChart(QQuickItem *parent = 0);
+ ~DeclarativePolarChart();
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVEPOLARCHART_H
diff --git a/src/chartsqml2/declarativescatterseries.cpp b/src/chartsqml2/declarativescatterseries.cpp
new file mode 100644
index 00000000..557d36ea
--- /dev/null
+++ b/src/chartsqml2/declarativescatterseries.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativescatterseries.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
+ QScatterSeries(parent),
+ m_axes(new DeclarativeAxes(this))
+{
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
+ connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
+ connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
+}
+
+void DeclarativeScatterSeries::handleCountChanged(int index)
+{
+ Q_UNUSED(index)
+ emit countChanged(QScatterSeries::count());
+}
+
+qreal DeclarativeScatterSeries::borderWidth() const
+{
+ return pen().widthF();
+}
+
+void DeclarativeScatterSeries::setBorderWidth(qreal width)
+{
+ if (width != pen().widthF()) {
+ QPen p = pen();
+ p.setWidthF(width);
+ setPen(p);
+ emit borderWidthChanged(width);
+ }
+}
+
+QQmlListProperty<QObject> DeclarativeScatterSeries::declarativeChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &appendDeclarativeChildren ,0,0,0);
+}
+
+void DeclarativeScatterSeries::appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element)
+{
+ Q_UNUSED(list)
+ Q_UNUSED(element)
+ // Empty implementation, children are parsed in componentComplete
+}
+
+QString DeclarativeScatterSeries::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeScatterSeries::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QScatterSeries::brush().textureImage() != brushImage) {
+ QBrush brush = QScatterSeries::brush();
+ brush.setTextureImage(brushImage);
+ QScatterSeries::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeScatterSeries::setBrush(const QBrush &brush)
+{
+ QScatterSeries::setBrush(brush);
+ emit brushChanged();
+}
+
+QBrush DeclarativeScatterSeries::brush() const
+{
+ return QScatterSeries::brush();
+}
+
+void DeclarativeScatterSeries::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QScatterSeries::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
+#include "moc_declarativescatterseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativescatterseries.h b/src/chartsqml2/declarativescatterseries.h
new file mode 100644
index 00000000..9745e06b
--- /dev/null
+++ b/src/chartsqml2/declarativescatterseries.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVESCATTERSERIES_H
+#define DECLARATIVESCATTERSERIES_H
+
+#include "qscatterseries.h"
+#include "declarativexyseries.h"
+#include "declarativeaxes.h"
+
+#include <QtQml/QQmlListProperty>
+#include <QtQml/QQmlParserStatus>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
+ Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
+ Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
+ Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4)
+ Q_CLASSINFO("DefaultProperty", "declarativeChildren")
+
+public:
+ explicit DeclarativeScatterSeries(QObject *parent = 0);
+ QXYSeries *xySeries() { return this; }
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
+ Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
+ Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ qreal borderWidth() const;
+ void setBorderWidth(qreal borderWidth);
+ QQmlListProperty<QObject> declarativeChildren();
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
+
+public: // from QDeclarativeParserStatus
+ void classBegin() { DeclarativeXySeries::classBegin(); }
+ void componentComplete() { DeclarativeXySeries::componentComplete(); }
+
+public:
+ Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
+ Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
+ Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); }
+ Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
+ Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); }
+ Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
+ Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
+ Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
+
+Q_SIGNALS:
+ void countChanged(int count);
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void borderWidthChanged(qreal width);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+ Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
+ Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
+ Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename);
+ Q_REVISION(4) void brushChanged();
+
+public Q_SLOTS:
+ static void appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element);
+ void handleCountChanged(int index);
+
+private Q_SLOTS:
+ void handleBrushChanged();
+
+public:
+ DeclarativeAxes *m_axes;
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVESCATTERSERIES_H
diff --git a/src/chartsqml2/declarativesplineseries.cpp b/src/chartsqml2/declarativesplineseries.cpp
new file mode 100644
index 00000000..8c882288
--- /dev/null
+++ b/src/chartsqml2/declarativesplineseries.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativesplineseries.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) :
+ QSplineSeries(parent),
+ m_axes(new DeclarativeAxes(this))
+{
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
+ connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
+ connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
+ connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
+}
+
+void DeclarativeSplineSeries::handleCountChanged(int index)
+{
+ Q_UNUSED(index)
+ emit countChanged(points().count());
+}
+
+qreal DeclarativeSplineSeries::width() const
+{
+ return pen().widthF();
+}
+
+void DeclarativeSplineSeries::setWidth(qreal width)
+{
+ if (width != pen().widthF()) {
+ QPen p = pen();
+ p.setWidthF(width);
+ setPen(p);
+ emit widthChanged(width);
+ }
+}
+
+Qt::PenStyle DeclarativeSplineSeries::style() const
+{
+ return pen().style();
+}
+
+void DeclarativeSplineSeries::setStyle(Qt::PenStyle style)
+{
+ if (style != pen().style()) {
+ QPen p = pen();
+ p.setStyle(style);
+ setPen(p);
+ emit styleChanged(style);
+ }
+}
+
+Qt::PenCapStyle DeclarativeSplineSeries::capStyle() const
+{
+ return pen().capStyle();
+}
+
+void DeclarativeSplineSeries::setCapStyle(Qt::PenCapStyle capStyle)
+{
+ if (capStyle != pen().capStyle()) {
+ QPen p = pen();
+ p.setCapStyle(capStyle);
+ setPen(p);
+ emit capStyleChanged(capStyle);
+ }
+}
+
+QQmlListProperty<QObject> DeclarativeSplineSeries::declarativeChildren()
+{
+ return QQmlListProperty<QObject>(this, 0, &appendDeclarativeChildren ,0,0,0);
+}
+
+void DeclarativeSplineSeries::appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element)
+{
+ Q_UNUSED(list)
+ Q_UNUSED(element)
+ // Empty implementation, children are parsed in componentComplete
+}
+
+#include "moc_declarativesplineseries.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativesplineseries.h b/src/chartsqml2/declarativesplineseries.h
new file mode 100644
index 00000000..369206f0
--- /dev/null
+++ b/src/chartsqml2/declarativesplineseries.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVESPLINESERIES_H
+#define DECLARATIVESPLINESERIES_H
+
+#include "qsplineseries.h"
+#include "declarativexyseries.h"
+#include "declarativeaxes.h"
+
+#include <QtQml/QQmlListProperty>
+#include <QtQml/QQmlParserStatus>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
+ Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+ Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
+ Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
+ Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1)
+ Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1)
+ Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1)
+ Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
+ Q_CLASSINFO("DefaultProperty", "declarativeChildren")
+
+public:
+ explicit DeclarativeSplineSeries(QObject *parent = 0);
+ QXYSeries *xySeries() { return this; }
+ QAbstractAxis *axisX() { return m_axes->axisX(); }
+ void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ QAbstractAxis *axisY() { return m_axes->axisY(); }
+ void setAxisY(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ Q_REVISION(2) QAbstractAxis *axisXTop() { return m_axes->axisXTop(); }
+ Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
+ Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
+ Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
+ Q_REVISION(3) QAbstractAxis *axisAngular() { return m_axes->axisX(); }
+ Q_REVISION(3) void setAxisAngular(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
+ Q_REVISION(3) QAbstractAxis *axisRadial() { return m_axes->axisY(); }
+ Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
+ qreal width() const;
+ void setWidth(qreal width);
+ Qt::PenStyle style() const;
+ void setStyle(Qt::PenStyle style);
+ Qt::PenCapStyle capStyle() const;
+ void setCapStyle(Qt::PenCapStyle capStyle);
+ QQmlListProperty<QObject> declarativeChildren();
+
+public: // from QDeclarativeParserStatus
+ void classBegin() { DeclarativeXySeries::classBegin(); }
+ void componentComplete() { DeclarativeXySeries::componentComplete(); }
+
+public:
+ Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); }
+ Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); }
+ Q_REVISION(3) Q_INVOKABLE void replace(int index, qreal newX, qreal newY) { DeclarativeXySeries::replace(index, newX, newY); }
+ Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); }
+ Q_REVISION(3) Q_INVOKABLE void remove(int index) { DeclarativeXySeries::remove(index); }
+ Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); }
+ Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); }
+ Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); }
+
+Q_SIGNALS:
+ void countChanged(int count);
+ Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void axisYChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisXTopChanged(QAbstractAxis *axis);
+ Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
+ Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
+ Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
+ Q_REVISION(1) void widthChanged(qreal width);
+ Q_REVISION(1) void styleChanged(Qt::PenStyle style);
+ Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle);
+
+public Q_SLOTS:
+ static void appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element);
+ void handleCountChanged(int index);
+
+public:
+ DeclarativeAxes *m_axes;
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVESPLINESERIES_H
diff --git a/src/chartsqml2/declarativexypoint.cpp b/src/chartsqml2/declarativexypoint.cpp
new file mode 100644
index 00000000..8df506e9
--- /dev/null
+++ b/src/chartsqml2/declarativexypoint.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "declarativexypoint.h"
+#include <QDataStream>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+/*!
+ \qmltype XYPoint
+ \inqmlmodule QtCharts
+
+ XYPoint is a convenience element for initializing XY-series with static coordinate data. To
+ manipulate an XY-series dynamically, use it's data manipulation functions instead.
+ \sa LineSeries, AreaSeries, ScatterSeries, SplineSeries
+*/
+
+/*!
+ \qmlproperty real XYPoint::x
+ The x-coordinate of the point.
+*/
+
+/*!
+ \qmlproperty real XYPoint::y
+ The y-coordinate of the point.
+*/
+
+DeclarativeXYPoint::DeclarativeXYPoint(QObject *parent) :
+ QObject(parent)
+{
+ setX(0.0);
+ setY(0.0);
+}
+
+#include "moc_declarativexypoint.cpp"
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativexypoint.h b/src/chartsqml2/declarativexypoint.h
new file mode 100644
index 00000000..578b4b99
--- /dev/null
+++ b/src/chartsqml2/declarativexypoint.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVE_XY_POINT_H
+#define DECLARATIVE_XY_POINT_H
+
+#include "qchartglobal.h"
+#include <QObject>
+#include <QPointF>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class DeclarativeXYPoint : public QObject, public QPointF
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal x READ x WRITE setX)
+ Q_PROPERTY(qreal y READ y WRITE setY)
+
+public:
+ explicit DeclarativeXYPoint(QObject *parent = 0);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVE_XY_POINT_H
diff --git a/src/chartsqml2/declarativexyseries.cpp b/src/chartsqml2/declarativexyseries.cpp
new file mode 100644
index 00000000..55fb31d9
--- /dev/null
+++ b/src/chartsqml2/declarativexyseries.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "declarativexyseries.h"
+#include "declarativexypoint.h"
+#include "qvxymodelmapper.h"
+#include "qhxymodelmapper.h"
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+DeclarativeXySeries::DeclarativeXySeries()
+{
+}
+
+DeclarativeXySeries::~DeclarativeXySeries()
+{
+}
+
+void DeclarativeXySeries::classBegin()
+{
+}
+
+void DeclarativeXySeries::componentComplete()
+{
+ QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
+ Q_ASSERT(series);
+
+ foreach (QObject *child, series->children()) {
+ if (qobject_cast<DeclarativeXYPoint *>(child)) {
+ DeclarativeXYPoint *point = qobject_cast<DeclarativeXYPoint *>(child);
+ series->append(point->x(), point->y());
+ } else if (qobject_cast<QVXYModelMapper *>(child)) {
+ QVXYModelMapper *mapper = qobject_cast<QVXYModelMapper *>(child);
+ mapper->setSeries(series);
+ } else if (qobject_cast<QHXYModelMapper *>(child)) {
+ QHXYModelMapper *mapper = qobject_cast<QHXYModelMapper *>(child);
+ mapper->setSeries(series);
+ }
+ }
+}
+
+void DeclarativeXySeries::append(qreal x, qreal y)
+{
+ QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
+ Q_ASSERT(series);
+ series->append(x, y);
+}
+
+void DeclarativeXySeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
+{
+ QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
+ Q_ASSERT(series);
+ series->replace(oldX, oldY, newX, newY);
+}
+
+void DeclarativeXySeries::replace(int index, qreal newX, qreal newY)
+{
+ QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
+ Q_ASSERT(series);
+ series->replace(index, newX, newY);
+}
+
+void DeclarativeXySeries::remove(qreal x, qreal y)
+{
+ QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
+ Q_ASSERT(series);
+ series->remove(x, y);
+}
+
+void DeclarativeXySeries::remove(int index)
+{
+ QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
+ Q_ASSERT(series);
+ series->remove(index);
+}
+
+void DeclarativeXySeries::insert(int index, qreal x, qreal y)
+{
+ QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
+ Q_ASSERT(series);
+ series->insert(index, QPointF(x, y));
+}
+
+void DeclarativeXySeries::clear()
+{
+ QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
+ Q_ASSERT(series);
+ series->clear();
+}
+
+QPointF DeclarativeXySeries::at(int index)
+{
+ QXYSeries *series = qobject_cast<QXYSeries *>(xySeries());
+ Q_ASSERT(series);
+ if (index >= 0 || index < series->count())
+ return series->points().at(index);
+ return QPointF(0, 0);
+}
+
+QT_CHARTS_END_NAMESPACE
diff --git a/src/chartsqml2/declarativexyseries.h b/src/chartsqml2/declarativexyseries.h
new file mode 100644
index 00000000..237080bb
--- /dev/null
+++ b/src/chartsqml2/declarativexyseries.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DECLARATIVE_XY_SERIES_H
+#define DECLARATIVE_XY_SERIES_H
+
+#include <QXYSeries>
+
+QT_CHARTS_BEGIN_NAMESPACE
+
+class QChart;
+class QAbstractSeries;
+
+class DeclarativeXySeries
+{
+public:
+ explicit DeclarativeXySeries();
+ ~DeclarativeXySeries();
+
+public:
+ void classBegin();
+ void componentComplete();
+ virtual QXYSeries *xySeries() = 0;
+
+ void append(qreal x, qreal y);
+ void replace(qreal oldX, qreal oldY, qreal newX, qreal newY);
+ void replace(int index, qreal newX, qreal newY);
+ void remove(qreal x, qreal y);
+ void remove(int index);
+ void insert(int index, qreal x, qreal y);
+ void clear();
+ QPointF at(int index);
+};
+
+QT_CHARTS_END_NAMESPACE
+
+#endif // DECLARATIVE_XY_SERIES_H
diff --git a/src/chartsqml2/plugins.qmltypes b/src/chartsqml2/plugins.qmltypes
new file mode 100644
index 00000000..ab15ac3d
--- /dev/null
+++ b/src/chartsqml2/plugins.qmltypes
@@ -0,0 +1,2305 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtCharts 2.0'
+
+Module {
+ Component {
+ name: "QGraphicsObject"
+ defaultProperty: "children"
+ prototype: "QObject"
+ Property { name: "parent"; type: "QGraphicsObject"; isPointer: true }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "pos"; type: "QPointF" }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOriginPoint"; type: "QPointF" }
+ Property { name: "effect"; type: "QGraphicsEffect"; isPointer: true }
+ Property {
+ name: "children"
+ type: "QDeclarativeListProperty<QGraphicsObject>"
+ isReadonly: true
+ }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ }
+ Component {
+ name: "QGraphicsWidget"
+ defaultProperty: "children"
+ prototype: "QGraphicsObject"
+ Property { name: "palette"; type: "QPalette" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
+ Property { name: "size"; type: "QSizeF" }
+ Property { name: "minimumSize"; type: "QSizeF" }
+ Property { name: "preferredSize"; type: "QSizeF" }
+ Property { name: "maximumSize"; type: "QSizeF" }
+ Property { name: "sizePolicy"; type: "QSizePolicy" }
+ Property { name: "focusPolicy"; type: "Qt::FocusPolicy" }
+ Property { name: "windowFlags"; type: "Qt::WindowFlags" }
+ Property { name: "windowTitle"; type: "string" }
+ Property { name: "geometry"; type: "QRectF" }
+ Property { name: "autoFillBackground"; type: "bool" }
+ Property { name: "layout"; type: "QGraphicsLayout"; isPointer: true }
+ Method { name: "close"; type: "bool" }
+ }
+ Component {
+ name: "QtCharts::DeclarativeAreaSeries"
+ prototype: "QtCharts::QAreaSeries"
+ exports: [
+ "QtCharts/AreaSeries 1.0",
+ "QtCharts/AreaSeries 1.1",
+ "QtCharts/AreaSeries 1.2",
+ "QtCharts/AreaSeries 1.3",
+ "QtCharts/AreaSeries 1.4",
+ "QtCharts/AreaSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4, 4]
+ Property { name: "upperSeries"; type: "DeclarativeLineSeries"; isPointer: true }
+ Property { name: "lowerSeries"; type: "DeclarativeLineSeries"; isPointer: true }
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "borderWidth"; revision: 1; type: "double" }
+ Property { name: "brushFilename"; revision: 4; type: "string" }
+ Property { name: "brush"; revision: 4; type: "QBrush" }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "borderWidthChanged"
+ revision: 1
+ Parameter { name: "width"; type: "double" }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisAngularChanged"
+ revision: 3
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisRadialChanged"
+ revision: 3
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal { name: "brushChanged"; revision: 4 }
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 4
+ Parameter { name: "brushFilename"; type: "string" }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativeAxes"
+ prototype: "QObject"
+ exports: [
+ "QtCharts/DeclarativeAxes 1.0",
+ "QtCharts/DeclarativeAxes 2.0"
+ ]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
+ Signal {
+ name: "axisXChanged"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativeBarSeries"
+ defaultProperty: "seriesChildren"
+ prototype: "QtCharts::QBarSeries"
+ exports: [
+ "QtCharts/BarSeries 1.0",
+ "QtCharts/BarSeries 1.1",
+ "QtCharts/BarSeries 1.2",
+ "QtCharts/BarSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2, 2]
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method {
+ name: "appendSeriesChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "at"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "insert"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "remove"
+ type: "bool"
+ Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QtCharts::DeclarativeBarSet"
+ prototype: "QtCharts::QBarSet"
+ exports: [
+ "QtCharts/BarSet 1.0",
+ "QtCharts/BarSet 1.1",
+ "QtCharts/BarSet 1.4",
+ "QtCharts/BarSet 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0, 2, 2]
+ Property { name: "values"; type: "QVariantList" }
+ Property { name: "borderWidth"; revision: 1; type: "double" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "brushFilename"; revision: 2; type: "string" }
+ Signal {
+ name: "countChanged"
+ Parameter { name: "count"; type: "int" }
+ }
+ Signal {
+ name: "borderWidthChanged"
+ revision: 1
+ Parameter { name: "width"; type: "double" }
+ }
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 2
+ Parameter { name: "brushFilename"; type: "string" }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "value"; type: "double" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "count"; type: "int" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "replace"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "value"; type: "double" }
+ }
+ Method {
+ name: "at"
+ type: "double"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativeBoxPlotSeries"
+ defaultProperty: "seriesChildren"
+ prototype: "QtCharts::QBoxPlotSeries"
+ exports: [
+ "QtCharts/BoxPlotSeries 1.3",
+ "QtCharts/BoxPlotSeries 1.4",
+ "QtCharts/BoxPlotSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 1]
+ Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "brushFilename"; revision: 1; type: "string" }
+ Signal {
+ name: "axisXChanged"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "status"; type: "bool" }
+ Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
+ }
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 1
+ Parameter { name: "brushFilename"; type: "string" }
+ }
+ Method {
+ name: "appendSeriesChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "onHovered"
+ Parameter { name: "status"; type: "bool" }
+ Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
+ }
+ Method {
+ name: "onClicked"
+ Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
+ }
+ Method {
+ name: "at"
+ type: "DeclarativeBoxSet*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ type: "DeclarativeBoxSet*"
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
+ }
+ Method {
+ name: "insert"
+ type: "DeclarativeBoxSet*"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "remove"
+ type: "bool"
+ Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QtCharts::DeclarativeBoxSet"
+ prototype: "QtCharts::QBoxSet"
+ exports: [
+ "QtCharts/BoxSet 1.3",
+ "QtCharts/BoxSet 1.4",
+ "QtCharts/BoxSet 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 1]
+ Enum {
+ name: "ValuePositions"
+ values: {
+ "LowerExtreme": 0,
+ "LowerQuartile": 1,
+ "Median": 2,
+ "UpperQuartile": 3,
+ "UpperExtreme": 4
+ }
+ }
+ Property { name: "values"; type: "QVariantList" }
+ Property { name: "label"; type: "string" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "brushFilename"; revision: 1; type: "string" }
+ Signal { name: "changedValues" }
+ Signal {
+ name: "changedValue"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 1
+ Parameter { name: "brushFilename"; type: "string" }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "value"; type: "double" }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "at"
+ type: "double"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "setValue"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "value"; type: "double" }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativeCategoryAxis"
+ defaultProperty: "axisChildren"
+ prototype: "QtCharts::QCategoryAxis"
+ exports: ["QtCharts/CategoryAxis 1.1", "QtCharts/CategoryAxis 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "axisChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Method {
+ name: "append"
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "categoryEndValue"; type: "double" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "label"; type: "string" }
+ }
+ Method {
+ name: "replace"
+ Parameter { name: "oldLabel"; type: "string" }
+ Parameter { name: "newLabel"; type: "string" }
+ }
+ Method {
+ name: "appendAxisChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativeCategoryRange"
+ prototype: "QObject"
+ exports: ["QtCharts/CategoryRange 1.1", "QtCharts/CategoryRange 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "endValue"; type: "double" }
+ Property { name: "label"; type: "string" }
+ }
+ Component {
+ name: "QtCharts::DeclarativeChart"
+ defaultProperty: "data"
+ prototype: "QQuickPaintedItem"
+ exports: [
+ "QtCharts/ChartView 1.0",
+ "QtCharts/ChartView 1.1",
+ "QtCharts/ChartView 1.2",
+ "QtCharts/ChartView 1.3",
+ "QtCharts/ChartView 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4]
+ Enum {
+ name: "Theme"
+ values: {
+ "ChartThemeLight": 0,
+ "ChartThemeBlueCerulean": 1,
+ "ChartThemeDark": 2,
+ "ChartThemeBrownSand": 3,
+ "ChartThemeBlueNcs": 4,
+ "ChartThemeHighContrast": 5,
+ "ChartThemeBlueIcy": 6,
+ "ChartThemeQt": 7
+ }
+ }
+ Enum {
+ name: "Animation"
+ values: {
+ "NoAnimation": 0,
+ "GridAxisAnimations": 1,
+ "SeriesAnimations": 2,
+ "AllAnimations": 3
+ }
+ }
+ Enum {
+ name: "SeriesType"
+ values: {
+ "SeriesTypeLine": 0,
+ "SeriesTypeArea": 1,
+ "SeriesTypeBar": 2,
+ "SeriesTypeStackedBar": 3,
+ "SeriesTypePercentBar": 4,
+ "SeriesTypeBoxPlot": 5,
+ "SeriesTypePie": 6,
+ "SeriesTypeScatter": 7,
+ "SeriesTypeSpline": 8,
+ "SeriesTypeHorizontalBar": 9,
+ "SeriesTypeHorizontalStackedBar": 10,
+ "SeriesTypeHorizontalPercentBar": 11
+ }
+ }
+ Property { name: "theme"; type: "Theme" }
+ Property { name: "animationOptions"; type: "Animation" }
+ Property { name: "title"; type: "string" }
+ Property { name: "titleFont"; type: "QFont" }
+ Property { name: "titleColor"; type: "QColor" }
+ Property { name: "legend"; type: "QLegend"; isReadonly: true; isPointer: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "backgroundColor"; type: "QColor" }
+ Property { name: "dropShadowEnabled"; type: "bool" }
+ Property { name: "backgroundRoundness"; revision: 3; type: "double" }
+ Property { name: "topMargin"; type: "double"; isReadonly: true }
+ Property { name: "bottomMargin"; type: "double"; isReadonly: true }
+ Property { name: "leftMargin"; type: "double"; isReadonly: true }
+ Property { name: "rightMargin"; type: "double"; isReadonly: true }
+ Property {
+ name: "minimumMargins"
+ revision: 1
+ type: "DeclarativeMargins"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "margins"
+ revision: 2
+ type: "DeclarativeMargins"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "plotArea"; revision: 1; type: "QRectF"; isReadonly: true }
+ Property { name: "plotAreaColor"; revision: 3; type: "QColor" }
+ Property { name: "axes"; revision: 2; type: "QAbstractAxis"; isList: true; isReadonly: true }
+ Property { name: "localizeNumbers"; revision: 4; type: "bool" }
+ Property { name: "locale"; revision: 4; type: "QLocale" }
+ Signal { name: "axisLabelsChanged" }
+ Signal {
+ name: "titleColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "dropShadowEnabledChanged"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Signal { name: "marginsChanged"; revision: 2 }
+ Signal {
+ name: "plotAreaChanged"
+ Parameter { name: "plotArea"; type: "QRectF" }
+ }
+ Signal {
+ name: "seriesAdded"
+ Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
+ }
+ Signal {
+ name: "seriesRemoved"
+ Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
+ }
+ Signal { name: "plotAreaColorChanged"; revision: 3 }
+ Signal {
+ name: "backgroundRoundnessChanged"
+ revision: 3
+ Parameter { name: "diameter"; type: "double" }
+ }
+ Signal { name: "localizeNumbersChanged"; revision: 4 }
+ Signal { name: "localeChanged"; revision: 4 }
+ Method {
+ name: "series"
+ type: "QAbstractSeries*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "series"
+ type: "QAbstractSeries*"
+ Parameter { name: "seriesName"; type: "string" }
+ }
+ Method {
+ name: "createSeries"
+ type: "QAbstractSeries*"
+ Parameter { name: "type"; type: "int" }
+ Parameter { name: "name"; type: "string" }
+ Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
+ Parameter { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method {
+ name: "createSeries"
+ type: "QAbstractSeries*"
+ Parameter { name: "type"; type: "int" }
+ Parameter { name: "name"; type: "string" }
+ Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method {
+ name: "createSeries"
+ type: "QAbstractSeries*"
+ Parameter { name: "type"; type: "int" }
+ Parameter { name: "name"; type: "string" }
+ }
+ Method {
+ name: "createSeries"
+ type: "QAbstractSeries*"
+ Parameter { name: "type"; type: "int" }
+ }
+ Method {
+ name: "removeSeries"
+ Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
+ }
+ Method { name: "removeAllSeries" }
+ Method {
+ name: "setAxisX"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
+ }
+ Method {
+ name: "setAxisX"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method {
+ name: "setAxisY"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
+ }
+ Method {
+ name: "setAxisY"
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method { name: "createDefaultAxes" }
+ Method {
+ name: "axisX"
+ type: "QAbstractAxis*"
+ Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
+ }
+ Method { name: "axisX"; type: "QAbstractAxis*" }
+ Method {
+ name: "axisY"
+ type: "QAbstractAxis*"
+ Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
+ }
+ Method { name: "axisY"; type: "QAbstractAxis*" }
+ Method {
+ name: "zoom"
+ Parameter { name: "factor"; type: "double" }
+ }
+ Method {
+ name: "scrollLeft"
+ Parameter { name: "pixels"; type: "double" }
+ }
+ Method {
+ name: "scrollRight"
+ Parameter { name: "pixels"; type: "double" }
+ }
+ Method {
+ name: "scrollUp"
+ Parameter { name: "pixels"; type: "double" }
+ }
+ Method {
+ name: "scrollDown"
+ Parameter { name: "pixels"; type: "double" }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativeHorizontalBarSeries"
+ defaultProperty: "seriesChildren"
+ prototype: "QtCharts::QHorizontalBarSeries"
+ exports: [
+ "QtCharts/HorizontalBarSeries 1.1",
+ "QtCharts/HorizontalBarSeries 1.2",
+ "QtCharts/HorizontalBarSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [1, 2, 2]
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method {
+ name: "appendSeriesChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "at"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "insert"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "remove"
+ type: "bool"
+ Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QtCharts::DeclarativeHorizontalPercentBarSeries"
+ defaultProperty: "seriesChildren"
+ prototype: "QtCharts::QHorizontalPercentBarSeries"
+ exports: [
+ "QtCharts/HorizontalPercentBarSeries 1.1",
+ "QtCharts/HorizontalPercentBarSeries 1.2",
+ "QtCharts/HorizontalPercentBarSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [1, 2, 2]
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method {
+ name: "appendSeriesChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "at"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "insert"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "remove"
+ type: "bool"
+ Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QtCharts::DeclarativeHorizontalStackedBarSeries"
+ defaultProperty: "seriesChildren"
+ prototype: "QtCharts::QHorizontalStackedBarSeries"
+ exports: [
+ "QtCharts/HorizontalStackedBarSeries 1.1",
+ "QtCharts/HorizontalStackedBarSeries 1.2",
+ "QtCharts/HorizontalStackedBarSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [1, 2, 2]
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method {
+ name: "appendSeriesChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "at"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "insert"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "remove"
+ type: "bool"
+ Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QtCharts::DeclarativeLineSeries"
+ defaultProperty: "declarativeChildren"
+ prototype: "QtCharts::QLineSeries"
+ exports: [
+ "QtCharts/LineSeries 1.0",
+ "QtCharts/LineSeries 1.1",
+ "QtCharts/LineSeries 1.2",
+ "QtCharts/LineSeries 1.3",
+ "QtCharts/LineSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 3]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "width"; revision: 1; type: "double" }
+ Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
+ Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
+ Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "countChanged"
+ Parameter { name: "count"; type: "int" }
+ }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisAngularChanged"
+ revision: 3
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisRadialChanged"
+ revision: 3
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "widthChanged"
+ revision: 1
+ Parameter { name: "width"; type: "double" }
+ }
+ Signal {
+ name: "styleChanged"
+ revision: 1
+ Parameter { name: "style"; type: "Qt::PenStyle" }
+ }
+ Signal {
+ name: "capStyleChanged"
+ revision: 1
+ Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
+ }
+ Method {
+ name: "appendDeclarativeChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "handleCountChanged"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "replace"
+ Parameter { name: "oldX"; type: "double" }
+ Parameter { name: "oldY"; type: "double" }
+ Parameter { name: "newX"; type: "double" }
+ Parameter { name: "newY"; type: "double" }
+ }
+ Method {
+ name: "replace"
+ revision: 3
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "newX"; type: "double" }
+ Parameter { name: "newY"; type: "double" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "remove"
+ revision: 3
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "insert"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "at"
+ type: "QPointF"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativeMargins"
+ prototype: "QObject"
+ exports: ["QtCharts/Margins 1.1", "QtCharts/Margins 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "top"; type: "int" }
+ Property { name: "bottom"; type: "int" }
+ Property { name: "left"; type: "int" }
+ Property { name: "right"; type: "int" }
+ Signal {
+ name: "topChanged"
+ Parameter { name: "top"; type: "int" }
+ Parameter { name: "bottom"; type: "int" }
+ Parameter { name: "left"; type: "int" }
+ Parameter { name: "right"; type: "int" }
+ }
+ Signal {
+ name: "bottomChanged"
+ Parameter { name: "top"; type: "int" }
+ Parameter { name: "bottom"; type: "int" }
+ Parameter { name: "left"; type: "int" }
+ Parameter { name: "right"; type: "int" }
+ }
+ Signal {
+ name: "leftChanged"
+ Parameter { name: "top"; type: "int" }
+ Parameter { name: "bottom"; type: "int" }
+ Parameter { name: "left"; type: "int" }
+ Parameter { name: "right"; type: "int" }
+ }
+ Signal {
+ name: "rightChanged"
+ Parameter { name: "top"; type: "int" }
+ Parameter { name: "bottom"; type: "int" }
+ Parameter { name: "left"; type: "int" }
+ Parameter { name: "right"; type: "int" }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativePercentBarSeries"
+ defaultProperty: "seriesChildren"
+ prototype: "QtCharts::QPercentBarSeries"
+ exports: [
+ "QtCharts/PercentBarSeries 1.0",
+ "QtCharts/PercentBarSeries 1.1",
+ "QtCharts/PercentBarSeries 1.2",
+ "QtCharts/PercentBarSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2, 2]
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method {
+ name: "appendSeriesChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "at"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "insert"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "remove"
+ type: "bool"
+ Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QtCharts::DeclarativePieSeries"
+ defaultProperty: "seriesChildren"
+ prototype: "QtCharts::QPieSeries"
+ exports: [
+ "QtCharts/PieSeries 1.0",
+ "QtCharts/PieSeries 1.1",
+ "QtCharts/PieSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0, 0]
+ Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "sliceAdded"
+ Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
+ }
+ Signal {
+ name: "sliceRemoved"
+ Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
+ }
+ Method {
+ name: "appendSeriesChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "handleAdded"
+ Parameter { name: "slices"; type: "QList<QPieSlice*>" }
+ }
+ Method {
+ name: "handleRemoved"
+ Parameter { name: "slices"; type: "QList<QPieSlice*>" }
+ }
+ Method {
+ name: "at"
+ type: "QPieSlice*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "find"
+ type: "QPieSlice*"
+ Parameter { name: "label"; type: "string" }
+ }
+ Method {
+ name: "append"
+ type: "DeclarativePieSlice*"
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "value"; type: "double" }
+ }
+ Method {
+ name: "remove"
+ type: "bool"
+ Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QtCharts::DeclarativePieSlice"
+ prototype: "QtCharts::QPieSlice"
+ exports: ["QtCharts/PieSlice 1.4", "QtCharts/PieSlice 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "brushFilename"; type: "string" }
+ Signal {
+ name: "brushFilenameChanged"
+ Parameter { name: "brushFilename"; type: "string" }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativePolarChart"
+ defaultProperty: "data"
+ prototype: "QtCharts::DeclarativeChart"
+ exports: [
+ "QtCharts/PolarChartView 1.3",
+ "QtCharts/PolarChartView 2.0"
+ ]
+ exportMetaObjectRevisions: [1, 1]
+ }
+ Component {
+ name: "QtCharts::DeclarativeScatterSeries"
+ defaultProperty: "declarativeChildren"
+ prototype: "QtCharts::QScatterSeries"
+ exports: [
+ "QtCharts/ScatterSeries 1.0",
+ "QtCharts/ScatterSeries 1.1",
+ "QtCharts/ScatterSeries 1.2",
+ "QtCharts/ScatterSeries 1.3",
+ "QtCharts/ScatterSeries 1.4",
+ "QtCharts/ScatterSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4, 4]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "borderWidth"; revision: 1; type: "double" }
+ Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "brushFilename"; revision: 4; type: "string" }
+ Property { name: "brush"; revision: 4; type: "QBrush" }
+ Signal {
+ name: "countChanged"
+ Parameter { name: "count"; type: "int" }
+ }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "borderWidthChanged"
+ revision: 1
+ Parameter { name: "width"; type: "double" }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisAngularChanged"
+ revision: 3
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisRadialChanged"
+ revision: 3
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 4
+ Parameter { name: "brushFilename"; type: "string" }
+ }
+ Signal { name: "brushChanged"; revision: 4 }
+ Method {
+ name: "appendDeclarativeChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "handleCountChanged"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "replace"
+ Parameter { name: "oldX"; type: "double" }
+ Parameter { name: "oldY"; type: "double" }
+ Parameter { name: "newX"; type: "double" }
+ Parameter { name: "newY"; type: "double" }
+ }
+ Method {
+ name: "replace"
+ revision: 3
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "newX"; type: "double" }
+ Parameter { name: "newY"; type: "double" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "remove"
+ revision: 3
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "insert"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "at"
+ type: "QPointF"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativeSplineSeries"
+ defaultProperty: "declarativeChildren"
+ prototype: "QtCharts::QSplineSeries"
+ exports: [
+ "QtCharts/SplineSeries 1.0",
+ "QtCharts/SplineSeries 1.1",
+ "QtCharts/SplineSeries 1.2",
+ "QtCharts/SplineSeries 1.3",
+ "QtCharts/SplineSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 3]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "width"; revision: 1; type: "double" }
+ Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
+ Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
+ Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "countChanged"
+ Parameter { name: "count"; type: "int" }
+ }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisAngularChanged"
+ revision: 3
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisRadialChanged"
+ revision: 3
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "widthChanged"
+ revision: 1
+ Parameter { name: "width"; type: "double" }
+ }
+ Signal {
+ name: "styleChanged"
+ revision: 1
+ Parameter { name: "style"; type: "Qt::PenStyle" }
+ }
+ Signal {
+ name: "capStyleChanged"
+ revision: 1
+ Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
+ }
+ Method {
+ name: "appendDeclarativeChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "handleCountChanged"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "replace"
+ Parameter { name: "oldX"; type: "double" }
+ Parameter { name: "oldY"; type: "double" }
+ Parameter { name: "newX"; type: "double" }
+ Parameter { name: "newY"; type: "double" }
+ }
+ Method {
+ name: "replace"
+ revision: 3
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "newX"; type: "double" }
+ Parameter { name: "newY"; type: "double" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "remove"
+ revision: 3
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "insert"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "at"
+ type: "QPointF"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QtCharts::DeclarativeStackedBarSeries"
+ defaultProperty: "seriesChildren"
+ prototype: "QtCharts::QStackedBarSeries"
+ exports: [
+ "QtCharts/StackedBarSeries 1.0",
+ "QtCharts/StackedBarSeries 1.1",
+ "QtCharts/StackedBarSeries 1.2",
+ "QtCharts/StackedBarSeries 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 1, 2, 2]
+ Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
+ Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Signal {
+ name: "axisXChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYChanged"
+ revision: 1
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisXTopChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Signal {
+ name: "axisYRightChanged"
+ revision: 2
+ Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
+ }
+ Method {
+ name: "appendSeriesChildren"
+ Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
+ Parameter { name: "element"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "at"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "append"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "insert"
+ type: "DeclarativeBarSet*"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "label"; type: "string" }
+ Parameter { name: "values"; type: "QVariantList" }
+ }
+ Method {
+ name: "remove"
+ type: "bool"
+ Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QtCharts::DeclarativeXYPoint"
+ prototype: "QObject"
+ exports: ["QtCharts/XYPoint 1.0", "QtCharts/XYPoint 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ }
+ Component {
+ name: "QtCharts::LegendScroller"
+ defaultProperty: "children"
+ prototype: "QtCharts::QLegend"
+ }
+ Component {
+ name: "QtCharts::QAbstractAxis"
+ prototype: "QObject"
+ exports: ["QtCharts/AbstractAxis 1.0", "QtCharts/AbstractAxis 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "visible"; type: "bool" }
+ Property { name: "lineVisible"; type: "bool" }
+ Property { name: "linePen"; type: "QPen" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "labelsVisible"; type: "bool" }
+ Property { name: "labelsPen"; type: "QPen" }
+ Property { name: "labelsBrush"; type: "QBrush" }
+ Property { name: "labelsAngle"; type: "int" }
+ Property { name: "labelsFont"; type: "QFont" }
+ Property { name: "labelsColor"; type: "QColor" }
+ Property { name: "gridVisible"; type: "bool" }
+ Property { name: "gridLinePen"; type: "QPen" }
+ Property { name: "shadesVisible"; type: "bool" }
+ Property { name: "shadesColor"; type: "QColor" }
+ Property { name: "shadesBorderColor"; type: "QColor" }
+ Property { name: "shadesPen"; type: "QPen" }
+ Property { name: "shadesBrush"; type: "QBrush" }
+ Property { name: "titleText"; type: "string" }
+ Property { name: "titlePen"; type: "QPen" }
+ Property { name: "titleBrush"; type: "QBrush" }
+ Property { name: "titleVisible"; type: "bool" }
+ Property { name: "titleFont"; type: "QFont" }
+ Property { name: "orientation"; type: "Qt::Orientation"; isReadonly: true }
+ Property { name: "alignment"; type: "Qt::Alignment"; isReadonly: true }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Signal {
+ name: "linePenChanged"
+ Parameter { name: "pen"; type: "QPen" }
+ }
+ Signal {
+ name: "lineVisibleChanged"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Signal {
+ name: "labelsVisibleChanged"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Signal {
+ name: "labelsPenChanged"
+ Parameter { name: "pen"; type: "QPen" }
+ }
+ Signal {
+ name: "labelsBrushChanged"
+ Parameter { name: "brush"; type: "QBrush" }
+ }
+ Signal {
+ name: "labelsFontChanged"
+ Parameter { name: "pen"; type: "QFont" }
+ }
+ Signal {
+ name: "labelsAngleChanged"
+ Parameter { name: "angle"; type: "int" }
+ }
+ Signal {
+ name: "gridLinePenChanged"
+ Parameter { name: "pen"; type: "QPen" }
+ }
+ Signal {
+ name: "gridVisibleChanged"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "labelsColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "titleTextChanged"
+ Parameter { name: "title"; type: "string" }
+ }
+ Signal {
+ name: "titlePenChanged"
+ Parameter { name: "pen"; type: "QPen" }
+ }
+ Signal {
+ name: "titleBrushChanged"
+ Parameter { name: "brush"; type: "QBrush" }
+ }
+ Signal {
+ name: "titleVisibleChanged"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Signal {
+ name: "titleFontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "shadesVisibleChanged"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Signal {
+ name: "shadesColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "shadesBorderColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "shadesPenChanged"
+ Parameter { name: "pen"; type: "QPen" }
+ }
+ Signal {
+ name: "shadesBrushChanged"
+ Parameter { name: "brush"; type: "QBrush" }
+ }
+ }
+ Component {
+ name: "QtCharts::QAbstractBarSeries"
+ prototype: "QtCharts::QAbstractSeries"
+ exports: [
+ "QtCharts/AbstractBarSeries 1.0",
+ "QtCharts/AbstractBarSeries 2.0"
+ ]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ Enum {
+ name: "LabelsPosition"
+ values: {
+ "LabelsCenter": 0,
+ "LabelsInsideEnd": 1,
+ "LabelsInsideBase": 2,
+ "LabelsOutsideEnd": 3
+ }
+ }
+ Property { name: "barWidth"; type: "double" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "labelsVisible"; type: "bool" }
+ Property { name: "labelsFormat"; type: "string" }
+ Property { name: "labelsPosition"; type: "LabelsPosition" }
+ Signal {
+ name: "clicked"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "status"; type: "bool" }
+ Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "status"; type: "bool" }
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
+ }
+ Signal {
+ name: "labelsFormatChanged"
+ Parameter { name: "format"; type: "string" }
+ }
+ Signal {
+ name: "labelsPositionChanged"
+ Parameter { name: "position"; type: "QAbstractBarSeries::LabelsPosition" }
+ }
+ Signal {
+ name: "barsetsAdded"
+ Parameter { name: "sets"; type: "QList<QBarSet*>" }
+ }
+ Signal {
+ name: "barsetsRemoved"
+ Parameter { name: "sets"; type: "QList<QBarSet*>" }
+ }
+ }
+ Component {
+ name: "QtCharts::QAbstractSeries"
+ prototype: "QObject"
+ exports: [
+ "QtCharts/AbstractSeries 1.0",
+ "QtCharts/AbstractSeries 2.0"
+ ]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ Enum {
+ name: "SeriesType"
+ values: {
+ "SeriesTypeLine": 0,
+ "SeriesTypeArea": 1,
+ "SeriesTypeBar": 2,
+ "SeriesTypeStackedBar": 3,
+ "SeriesTypePercentBar": 4,
+ "SeriesTypePie": 5,
+ "SeriesTypeScatter": 6,
+ "SeriesTypeSpline": 7,
+ "SeriesTypeHorizontalBar": 8,
+ "SeriesTypeHorizontalStackedBar": 9,
+ "SeriesTypeHorizontalPercentBar": 10,
+ "SeriesTypeBoxPlot": 11
+ }
+ }
+ Property { name: "name"; type: "string" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "type"; type: "SeriesType"; isReadonly: true }
+ }
+ Component {
+ name: "QtCharts::QAreaSeries"
+ prototype: "QtCharts::QAbstractSeries"
+ Property { name: "upperSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
+ Property { name: "lowerSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "borderColor"; type: "QColor" }
+ Property { name: "pointLabelsFormat"; type: "string" }
+ Property { name: "pointLabelsVisible"; type: "bool" }
+ Property { name: "pointLabelsFont"; type: "QFont" }
+ Property { name: "pointLabelsColor"; type: "QColor" }
+ Signal {
+ name: "clicked"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "point"; type: "QPointF" }
+ Parameter { name: "state"; type: "bool" }
+ }
+ Signal { name: "selected" }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "borderColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "pointLabelsFormatChanged"
+ Parameter { name: "format"; type: "string" }
+ }
+ Signal {
+ name: "pointLabelsVisibilityChanged"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Signal {
+ name: "pointLabelsFontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "pointLabelsColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ }
+ Component {
+ name: "QtCharts::QBarCategoryAxis"
+ prototype: "QtCharts::QAbstractAxis"
+ exports: [
+ "QtCharts/BarCategoriesAxis 1.0",
+ "QtCharts/BarCategoryAxis 1.1",
+ "QtCharts/BarCategoryAxis 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0, 0]
+ Property { name: "categories"; type: "QStringList" }
+ Property { name: "min"; type: "string" }
+ Property { name: "max"; type: "string" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Signal {
+ name: "minChanged"
+ Parameter { name: "min"; type: "string" }
+ }
+ Signal {
+ name: "maxChanged"
+ Parameter { name: "max"; type: "string" }
+ }
+ Signal {
+ name: "rangeChanged"
+ Parameter { name: "min"; type: "string" }
+ Parameter { name: "max"; type: "string" }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QtCharts::QBarModelMapper"
+ prototype: "QObject"
+ exports: [
+ "QtCharts/BarModelMapper 1.0",
+ "QtCharts/BarModelMapper 2.0"
+ ]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ }
+ Component { name: "QtCharts::QBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
+ Component {
+ name: "QtCharts::QBarSet"
+ prototype: "QObject"
+ exports: ["QtCharts/BarSetBase 1.0", "QtCharts/BarSetBase 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "label"; type: "string" }
+ Property { name: "pen"; type: "QPen" }
+ Property { name: "brush"; type: "QBrush" }
+ Property { name: "labelBrush"; type: "QBrush" }
+ Property { name: "labelFont"; type: "QFont" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "borderColor"; type: "QColor" }
+ Property { name: "labelColor"; type: "QColor" }
+ Signal {
+ name: "clicked"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "status"; type: "bool" }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "status"; type: "bool" }
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "borderColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "labelColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "valuesAdded"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "count"; type: "int" }
+ }
+ Signal {
+ name: "valuesRemoved"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "count"; type: "int" }
+ }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QtCharts::QBoxPlotModelMapper"
+ prototype: "QObject"
+ exports: ["QtCharts/BoxPlotModelMapper 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QtCharts::QBoxPlotSeries"
+ prototype: "QtCharts::QAbstractSeries"
+ Property { name: "boxOutlineVisible"; type: "bool" }
+ Property { name: "boxWidth"; type: "double" }
+ Property { name: "pen"; type: "QPen" }
+ Property { name: "brush"; type: "QBrush" }
+ Property { name: "count"; revision: 1; type: "int"; isReadonly: true }
+ Signal {
+ name: "clicked"
+ Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "status"; type: "bool" }
+ Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
+ }
+ Signal { name: "boxOutlineVisibilityChanged" }
+ Signal {
+ name: "boxsetsAdded"
+ Parameter { name: "sets"; type: "QList<QBoxSet*>" }
+ }
+ Signal {
+ name: "boxsetsRemoved"
+ Parameter { name: "sets"; type: "QList<QBoxSet*>" }
+ }
+ }
+ Component {
+ name: "QtCharts::QBoxSet"
+ prototype: "QObject"
+ Property { name: "pen"; type: "QPen" }
+ Property { name: "brush"; type: "QBrush" }
+ Signal { name: "clicked" }
+ Signal {
+ name: "hovered"
+ Parameter { name: "status"; type: "bool" }
+ }
+ Signal { name: "valuesChanged" }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal { name: "cleared" }
+ }
+ Component {
+ name: "QtCharts::QCategoryAxis"
+ prototype: "QtCharts::QValueAxis"
+ Property { name: "startValue"; type: "double" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "categoriesLabels"; type: "QStringList"; isReadonly: true }
+ Signal { name: "categoriesChanged" }
+ }
+ Component {
+ name: "QtCharts::QDateTimeAxis"
+ prototype: "QtCharts::QAbstractAxis"
+ exports: ["QtCharts/DateTimeAxis 1.1", "QtCharts/DateTimeAxis 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "tickCount"; type: "int" }
+ Property { name: "min"; type: "QDateTime" }
+ Property { name: "max"; type: "QDateTime" }
+ Property { name: "format"; type: "string" }
+ Signal {
+ name: "minChanged"
+ Parameter { name: "min"; type: "QDateTime" }
+ }
+ Signal {
+ name: "maxChanged"
+ Parameter { name: "max"; type: "QDateTime" }
+ }
+ Signal {
+ name: "rangeChanged"
+ Parameter { name: "min"; type: "QDateTime" }
+ Parameter { name: "max"; type: "QDateTime" }
+ }
+ Signal {
+ name: "formatChanged"
+ Parameter { name: "format"; type: "string" }
+ }
+ Signal {
+ name: "tickCountChanged"
+ Parameter { name: "tick"; type: "int" }
+ }
+ }
+ Component {
+ name: "QtCharts::QHBarModelMapper"
+ prototype: "QtCharts::QBarModelMapper"
+ exports: [
+ "QtCharts/HBarModelMapper 1.0",
+ "QtCharts/HBarModelMapper 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
+ Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
+ Property { name: "firstBarSetRow"; type: "int" }
+ Property { name: "lastBarSetRow"; type: "int" }
+ Property { name: "firstColumn"; type: "int" }
+ Property { name: "columnCount"; type: "int" }
+ Signal { name: "seriesReplaced" }
+ Signal { name: "modelReplaced" }
+ }
+ Component {
+ name: "QtCharts::QHPieModelMapper"
+ prototype: "QtCharts::QPieModelMapper"
+ exports: [
+ "QtCharts/HPieModelMapper 1.0",
+ "QtCharts/HPieModelMapper 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "series"; type: "QPieSeries"; isPointer: true }
+ Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
+ Property { name: "valuesRow"; type: "int" }
+ Property { name: "labelsRow"; type: "int" }
+ Property { name: "firstColumn"; type: "int" }
+ Property { name: "columnCount"; type: "int" }
+ Signal { name: "seriesReplaced" }
+ Signal { name: "modelReplaced" }
+ }
+ Component {
+ name: "QtCharts::QHXYModelMapper"
+ prototype: "QtCharts::QXYModelMapper"
+ exports: [
+ "QtCharts/HXYModelMapper 1.0",
+ "QtCharts/HXYModelMapper 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "series"; type: "QXYSeries"; isPointer: true }
+ Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
+ Property { name: "xRow"; type: "int" }
+ Property { name: "yRow"; type: "int" }
+ Property { name: "firstColumn"; type: "int" }
+ Property { name: "columnCount"; type: "int" }
+ Signal { name: "seriesReplaced" }
+ Signal { name: "modelReplaced" }
+ }
+ Component { name: "QtCharts::QHorizontalBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
+ Component {
+ name: "QtCharts::QHorizontalPercentBarSeries"
+ prototype: "QtCharts::QAbstractBarSeries"
+ }
+ Component {
+ name: "QtCharts::QHorizontalStackedBarSeries"
+ prototype: "QtCharts::QAbstractBarSeries"
+ }
+ Component {
+ name: "QtCharts::QLegend"
+ defaultProperty: "children"
+ prototype: "QGraphicsWidget"
+ exports: ["QtCharts/Legend 1.0", "QtCharts/Legend 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "alignment"; type: "Qt::Alignment" }
+ Property { name: "backgroundVisible"; type: "bool" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "borderColor"; type: "QColor" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "labelColor"; type: "QColor" }
+ Property { name: "reverseMarkers"; type: "bool" }
+ Signal {
+ name: "backgroundVisibleChanged"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "borderColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "labelColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "reverseMarkersChanged"
+ Parameter { name: "reverseMarkers"; type: "bool" }
+ }
+ }
+ Component { name: "QtCharts::QLineSeries"; prototype: "QtCharts::QXYSeries" }
+ Component {
+ name: "QtCharts::QLogValueAxis"
+ prototype: "QtCharts::QAbstractAxis"
+ exports: ["QtCharts/LogValueAxis 1.3", "QtCharts/LogValueAxis 2.0"]
+ exportMetaObjectRevisions: [0, 1]
+ Property { name: "min"; type: "double" }
+ Property { name: "max"; type: "double" }
+ Property { name: "labelFormat"; type: "string" }
+ Property { name: "base"; type: "double" }
+ Signal {
+ name: "minChanged"
+ Parameter { name: "min"; type: "double" }
+ }
+ Signal {
+ name: "maxChanged"
+ Parameter { name: "max"; type: "double" }
+ }
+ Signal {
+ name: "rangeChanged"
+ Parameter { name: "min"; type: "double" }
+ Parameter { name: "max"; type: "double" }
+ }
+ Signal {
+ name: "labelFormatChanged"
+ Parameter { name: "format"; type: "string" }
+ }
+ Signal {
+ name: "baseChanged"
+ Parameter { name: "base"; type: "double" }
+ }
+ }
+ Component { name: "QtCharts::QPercentBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
+ Component {
+ name: "QtCharts::QPieModelMapper"
+ prototype: "QObject"
+ exports: [
+ "QtCharts/PieModelMapper 1.0",
+ "QtCharts/PieModelMapper 2.0"
+ ]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ }
+ Component {
+ name: "QtCharts::QPieSeries"
+ prototype: "QtCharts::QAbstractSeries"
+ exports: ["QtCharts/QPieSeries 1.0", "QtCharts/QPieSeries 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "horizontalPosition"; type: "double" }
+ Property { name: "verticalPosition"; type: "double" }
+ Property { name: "size"; type: "double" }
+ Property { name: "startAngle"; type: "double" }
+ Property { name: "endAngle"; type: "double" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "sum"; type: "double"; isReadonly: true }
+ Property { name: "holeSize"; type: "double" }
+ Signal {
+ name: "added"
+ Parameter { name: "slices"; type: "QList<QPieSlice*>" }
+ }
+ Signal {
+ name: "removed"
+ Parameter { name: "slices"; type: "QList<QPieSlice*>" }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
+ Parameter { name: "state"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QtCharts::QPieSlice"
+ prototype: "QObject"
+ exports: ["QtCharts/PieSlice 1.0", "QtCharts/PieSlice 2.0"]
+ exportMetaObjectRevisions: [0, 0]
+ Enum {
+ name: "LabelPosition"
+ values: {
+ "LabelOutside": 0,
+ "LabelInsideHorizontal": 1,
+ "LabelInsideTangential": 2,
+ "LabelInsideNormal": 3
+ }
+ }
+ Property { name: "label"; type: "string" }
+ Property { name: "value"; type: "double" }
+ Property { name: "labelVisible"; type: "bool" }
+ Property { name: "labelPosition"; type: "LabelPosition" }
+ Property { name: "exploded"; type: "bool" }
+ Property { name: "pen"; type: "QPen" }
+ Property { name: "borderColor"; type: "QColor" }
+ Property { name: "borderWidth"; type: "int" }
+ Property { name: "brush"; type: "QBrush" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "labelBrush"; type: "QBrush" }
+ Property { name: "labelColor"; type: "QColor" }
+ Property { name: "labelFont"; type: "QFont" }
+ Property { name: "labelArmLengthFactor"; type: "double" }
+ Property { name: "explodeDistanceFactor"; type: "double" }
+ Property { name: "percentage"; type: "double"; isReadonly: true }
+ Property { name: "startAngle"; type: "double"; isReadonly: true }
+ Property { name: "angleSpan"; type: "double"; isReadonly: true }
+ Signal { name: "clicked" }
+ Signal {
+ name: "hovered"
+ Parameter { name: "state"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QtCharts::QScatterSeries"
+ prototype: "QtCharts::QXYSeries"
+ Enum {
+ name: "MarkerShape"
+ values: {
+ "MarkerShapeCircle": 0,
+ "MarkerShapeRectangle": 1
+ }
+ }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "borderColor"; type: "QColor" }
+ Property { name: "markerShape"; type: "MarkerShape" }
+ Property { name: "markerSize"; type: "double" }
+ Property { name: "brush"; type: "QBrush" }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "borderColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ }
+ Component { name: "QtCharts::QSplineSeries"; prototype: "QtCharts::QLineSeries" }
+ Component { name: "QtCharts::QStackedBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
+ Component {
+ name: "QtCharts::QVBarModelMapper"
+ prototype: "QtCharts::QBarModelMapper"
+ exports: [
+ "QtCharts/VBarModelMapper 1.0",
+ "QtCharts/VBarModelMapper 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
+ Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
+ Property { name: "firstBarSetColumn"; type: "int" }
+ Property { name: "lastBarSetColumn"; type: "int" }
+ Property { name: "firstRow"; type: "int" }
+ Property { name: "rowCount"; type: "int" }
+ Signal { name: "seriesReplaced" }
+ Signal { name: "modelReplaced" }
+ }
+ Component {
+ name: "QtCharts::QVBoxPlotModelMapper"
+ prototype: "QtCharts::QBoxPlotModelMapper"
+ exports: ["QtCharts/VBoxPlotModelMapper 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "series"; type: "QBoxPlotSeries"; isPointer: true }
+ Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
+ Property { name: "firstBoxSetColumn"; type: "int" }
+ Property { name: "lastBoxSetColumn"; type: "int" }
+ Property { name: "firstRow"; type: "int" }
+ Property { name: "rowCount"; type: "int" }
+ Signal { name: "seriesReplaced" }
+ Signal { name: "modelReplaced" }
+ }
+ Component {
+ name: "QtCharts::QVPieModelMapper"
+ prototype: "QtCharts::QPieModelMapper"
+ exports: [
+ "QtCharts/VPieModelMapper 1.0",
+ "QtCharts/VPieModelMapper 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "series"; type: "QPieSeries"; isPointer: true }
+ Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
+ Property { name: "valuesColumn"; type: "int" }
+ Property { name: "labelsColumn"; type: "int" }
+ Property { name: "firstRow"; type: "int" }
+ Property { name: "rowCount"; type: "int" }
+ Signal { name: "seriesReplaced" }
+ Signal { name: "modelReplaced" }
+ }
+ Component {
+ name: "QtCharts::QVXYModelMapper"
+ prototype: "QtCharts::QXYModelMapper"
+ exports: [
+ "QtCharts/VXYModelMapper 1.0",
+ "QtCharts/VXYModelMapper 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "series"; type: "QXYSeries"; isPointer: true }
+ Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
+ Property { name: "xColumn"; type: "int" }
+ Property { name: "yColumn"; type: "int" }
+ Property { name: "firstRow"; type: "int" }
+ Property { name: "rowCount"; type: "int" }
+ Signal { name: "seriesReplaced" }
+ Signal { name: "modelReplaced" }
+ }
+ Component {
+ name: "QtCharts::QValueAxis"
+ prototype: "QtCharts::QAbstractAxis"
+ exports: [
+ "QtCharts/ValueAxis 1.1",
+ "QtCharts/ValueAxis 2.0",
+ "QtCharts/ValuesAxis 1.0"
+ ]
+ exportMetaObjectRevisions: [0, 0, 0]
+ Property { name: "tickCount"; type: "int" }
+ Property { name: "niceNumbersEnabled"; type: "bool" }
+ Property { name: "min"; type: "double" }
+ Property { name: "max"; type: "double" }
+ Property { name: "labelFormat"; type: "string" }
+ Signal {
+ name: "minChanged"
+ Parameter { name: "min"; type: "double" }
+ }
+ Signal {
+ name: "maxChanged"
+ Parameter { name: "max"; type: "double" }
+ }
+ Signal {
+ name: "rangeChanged"
+ Parameter { name: "min"; type: "double" }
+ Parameter { name: "max"; type: "double" }
+ }
+ Signal {
+ name: "tickCountChanged"
+ Parameter { name: "tickCount"; type: "int" }
+ }
+ Signal {
+ name: "labelFormatChanged"
+ Parameter { name: "format"; type: "string" }
+ }
+ Method { name: "applyNiceNumbers" }
+ }
+ Component {
+ name: "QtCharts::QXYModelMapper"
+ prototype: "QObject"
+ exports: ["QtCharts/XYModelMapper 1.0", "QtCharts/XYModelMapper 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ }
+ Component {
+ name: "QtCharts::QXYSeries"
+ prototype: "QtCharts::QAbstractSeries"
+ exports: ["QtCharts/XYSeries 1.0", "QtCharts/XYSeries 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "pointsVisible"; type: "bool" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "pointLabelsFormat"; type: "string" }
+ Property { name: "pointLabelsVisible"; type: "bool" }
+ Property { name: "pointLabelsFont"; type: "QFont" }
+ Property { name: "pointLabelsColor"; type: "QColor" }
+ Signal {
+ name: "clicked"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "point"; type: "QPointF" }
+ Parameter { name: "state"; type: "bool" }
+ }
+ Signal {
+ name: "pointReplaced"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "pointRemoved"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "pointAdded"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal { name: "pointsReplaced" }
+ Signal {
+ name: "pointLabelsFormatChanged"
+ Parameter { name: "format"; type: "string" }
+ }
+ Signal {
+ name: "pointLabelsVisibilityChanged"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Signal {
+ name: "pointLabelsFontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "pointLabelsColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ }
+}
diff --git a/src/chartsqml2/qmldir b/src/chartsqml2/qmldir
new file mode 100644
index 00000000..10f4c598
--- /dev/null
+++ b/src/chartsqml2/qmldir
@@ -0,0 +1,4 @@
+module QtCharts
+plugin qtchartsqml2
+classname QtChartsQml2Plugin
+
diff --git a/src/chartthememanager.cpp b/src/chartthememanager.cpp
deleted file mode 100644
index b8cad94b..00000000
--- a/src/chartthememanager.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qabstractseries_p.h"
-#include "qabstractaxis_p.h"
-#include <QTime>
-//themes
-#include "chartthemesystem_p.h"
-#include "chartthemelight_p.h"
-#include "chartthemebluecerulean_p.h"
-#include "chartthemedark_p.h"
-#include "chartthemebrownsand_p.h"
-#include "chartthemebluencs_p.h"
-#include "chartthemehighcontrast_p.h"
-#include "chartthemeblueicy_p.h"
-#include "chartthemeqt_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartThemeManager::ChartThemeManager(QChart* chart) :
- m_chart(chart)
-{
- qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
-}
-
-
-void ChartThemeManager::setTheme(QChart::ChartTheme theme)
-{
- if (m_theme.isNull() || theme != m_theme->id()) {
- switch (theme) {
- case QChart::ChartThemeLight:
- m_theme.reset(new ChartThemeLight());
- break;
- case QChart::ChartThemeBlueCerulean:
- m_theme.reset(new ChartThemeBlueCerulean());
- break;
- case QChart::ChartThemeDark:
- m_theme.reset(new ChartThemeDark());
- break;
- case QChart::ChartThemeBrownSand:
- m_theme.reset(new ChartThemeBrownSand());
- break;
- case QChart::ChartThemeBlueNcs:
- m_theme.reset(new ChartThemeBlueNcs());
- break;
- case QChart::ChartThemeHighContrast:
- m_theme.reset(new ChartThemeHighContrast());
- break;
- case QChart::ChartThemeBlueIcy:
- m_theme.reset(new ChartThemeBlueIcy());
- break;
- case QChart::ChartThemeQt:
- m_theme.reset(new ChartThemeQt());
- break;
- default:
- m_theme.reset(new ChartThemeSystem());
- break;
- }
-
- if (!m_theme.isNull()) {
- decorateChart(m_chart,m_theme.data());
- decorateLegend(m_chart->legend(),m_theme.data());
- foreach (QAbstractAxis* axis, m_axisList)
- axis->d_ptr->initializeTheme(m_theme.data(), true);
- foreach (QAbstractSeries* series, m_seriesMap.keys())
- series->d_ptr->initializeTheme(m_seriesMap[series], m_theme.data(), true);
- }
- }
-}
-
-// decorateChart is only called when theme is forcibly initialized
-void ChartThemeManager::decorateChart(QChart *chart, ChartTheme *theme) const
-{
- chart->setBackgroundBrush(theme->chartBackgroundGradient());
-
- QPen pen(Qt::transparent);
- QBrush brush;
- chart->setPlotAreaBackgroundBrush(brush);
- chart->setPlotAreaBackgroundPen(pen);
- chart->setPlotAreaBackgroundVisible(false);
-
- chart->setTitleFont(theme->masterFont());
- chart->setTitleBrush(theme->labelBrush());
- chart->setDropShadowEnabled(theme->isBackgroundDropShadowEnabled());
-}
-
-// decorateLegend is only called when theme is forcibly initialized
-void ChartThemeManager::decorateLegend(QLegend *legend, ChartTheme *theme) const
-{
- legend->setPen(theme->axisLinePen());
- legend->setBrush(theme->chartBackgroundGradient());
- legend->setFont(theme->labelFont());
- legend->setLabelBrush(theme->labelBrush());
-}
-
-int ChartThemeManager::createIndexKey(QList<int> keys) const
-{
- qSort(keys);
-
- int key = 0;
- QList<int>::iterator i;
- i = keys.begin();
-
- while (i != keys.end()) {
- if (*i != key)
- break;
- key++;
- i++;
- }
-
- return key;
-}
-
-int ChartThemeManager::seriesCount(QAbstractSeries::SeriesType type) const
-{
- int count = 0;
- QList<QAbstractSeries *> series = m_seriesMap.keys();
- foreach(QAbstractSeries *s, series) {
- if (s->type() == type)
- count++;
- }
- return count;
-}
-
-void ChartThemeManager::handleSeriesAdded(QAbstractSeries *series)
-{
- int key = createIndexKey(m_seriesMap.values());
- m_seriesMap.insert(series,key);
- series->d_ptr->initializeTheme(key,m_theme.data(),false);
-}
-
-void ChartThemeManager::handleSeriesRemoved(QAbstractSeries *series)
-{
- m_seriesMap.remove(series);
-}
-
-void ChartThemeManager::handleAxisAdded(QAbstractAxis *axis)
-{
- m_axisList.append(axis);
- axis->d_ptr->initializeTheme(m_theme.data(),false);
-}
-
-void ChartThemeManager::handleAxisRemoved(QAbstractAxis *axis)
-{
- m_axisList.removeAll(axis);
-}
-
-void ChartThemeManager::updateSeries(QAbstractSeries *series)
-{
- if(m_seriesMap.contains(series)){
- series->d_ptr->initializeTheme(m_seriesMap[series],m_theme.data(),false);
- }
-}
-QList<QGradient> ChartThemeManager::generateSeriesGradients(const QList<QColor>& colors)
-{
- QList<QGradient> result;
- // Generate gradients in HSV color space
- foreach (const QColor &color, colors) {
- QLinearGradient g;
- qreal h = color.hsvHueF();
- qreal s = color.hsvSaturationF();
-
- QColor start = color;
- start.setHsvF(h, 0.0, 1.0);
- g.setColorAt(0.0, start);
-
- g.setColorAt(0.5, color);
-
- QColor end = color;
- end.setHsvF(h, s, 0.25);
- g.setColorAt(1.0, end);
-
- result << g;
- }
-
- return result;
-}
-
-
-QColor ChartThemeManager::colorAt(const QColor &start, const QColor &end, qreal pos)
-{
- Q_ASSERT(pos >= 0.0 && pos <= 1.0);
- qreal r = start.redF() + ((end.redF() - start.redF()) * pos);
- qreal g = start.greenF() + ((end.greenF() - start.greenF()) * pos);
- qreal b = start.blueF() + ((end.blueF() - start.blueF()) * pos);
- QColor c;
- c.setRgbF(r, g, b);
- return c;
-}
-
-QColor ChartThemeManager::colorAt(const QGradient &gradient, qreal pos)
-{
- Q_ASSERT(pos >= 0 && pos <= 1.0);
-
- QGradientStops stops = gradient.stops();
- int count = stops.count();
-
- // find previous stop relative to position
- QGradientStop prev = stops.first();
- for (int i = 0; i < count; i++) {
- QGradientStop stop = stops.at(i);
- if (pos > stop.first)
- prev = stop;
-
- // given position is actually a stop position?
- if (pos == stop.first) {
- //qDebug() << "stop color" << pos;
- return stop.second;
- }
- }
-
- // find next stop relative to position
- QGradientStop next = stops.last();
- for (int i = count - 1; i >= 0; i--) {
- QGradientStop stop = stops.at(i);
- if (pos < stop.first)
- next = stop;
- }
-
- //qDebug() << "prev" << prev.first << "pos" << pos << "next" << next.first;
-
- qreal range = next.first - prev.first;
- qreal posDelta = pos - prev.first;
- qreal relativePos = posDelta / range;
-
- //qDebug() << "range" << range << "posDelta" << posDelta << "relativePos" << relativePos;
-
- return colorAt(prev.second, next.second, relativePos);
-}
-
-#include "moc_chartthememanager_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/chartthememanager_p.h b/src/chartthememanager_p.h
deleted file mode 100644
index f8b79503..00000000
--- a/src/chartthememanager_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMEMANAGER_H
-#define CHARTTHEMEMANAGER_H
-
-#include "qchartglobal.h"
-#include "qchart.h"
-#include <QColor>
-#include <QGradientStops>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class ChartTheme;
-
-class ChartThemeManager: public QObject
-{
- Q_OBJECT
-public:
- enum BackgroundShadesMode {
- BackgroundShadesNone = 0,
- BackgroundShadesVertical,
- BackgroundShadesHorizontal,
- BackgroundShadesBoth
- };
-
-public:
- explicit ChartThemeManager(QChart* chart);
- void setTheme(QChart::ChartTheme theme);
- ChartTheme* theme() const { return m_theme.data(); }
- void decorateChart(QChart *chart, ChartTheme* theme) const;
- void decorateLegend(QLegend *legend, ChartTheme* theme) const;
- void updateSeries(QAbstractSeries *series);
-
-public:
- static QList<QGradient> generateSeriesGradients(const QList<QColor>& colors);
- static QColor colorAt(const QColor &start, const QColor &end, qreal pos);
- static QColor colorAt(const QGradient &gradient, qreal pos);
-
-private:
- int createIndexKey(QList<int> keys) const;
- int seriesCount(QAbstractSeries::SeriesType type) const;
-
-public Q_SLOTS:
- void handleSeriesAdded(QAbstractSeries *series);
- void handleSeriesRemoved(QAbstractSeries *series);
- void handleAxisAdded(QAbstractAxis *axis);
- void handleAxisRemoved(QAbstractAxis *axis);
-
-protected:
- QScopedPointer<ChartTheme> m_theme;
- QMap<QAbstractSeries *,int> m_seriesMap;
- QList<QAbstractAxis *> m_axisList;
- QChart* m_chart;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // CHARTTHEME_H
diff --git a/src/charttitle.cpp b/src/charttitle.cpp
deleted file mode 100644
index a7a958ee..00000000
--- a/src/charttitle.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "charttitle_p.h"
-#include "chartpresenter_p.h"
-#include <QFont>
-#include <QFontMetrics>
-#include <QDebug>
-#include <QTextDocument>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartTitle::ChartTitle(QGraphicsItem *parent)
- : QGraphicsTextItem(parent)
-{
- document()->setDocumentMargin(ChartPresenter::textMargin());
-}
-
-ChartTitle::~ChartTitle()
-{
-
-}
-
-void ChartTitle::setText(const QString &text)
-{
- m_text = text;
-}
-
-QString ChartTitle::text() const
-{
- return m_text;
-}
-
-void ChartTitle::setGeometry(const QRectF &rect)
-{
- QRectF truncatedRect;
- QGraphicsTextItem::setHtml(ChartPresenter::truncatedText(font(), m_text, qreal(0.0),
- rect.width(), rect.height(),
- truncatedRect));
- QGraphicsTextItem::setTextWidth(truncatedRect.width());
- setPos(rect.topLeft());
-}
-
-
-QSizeF ChartTitle::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint);
- QSizeF sh;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF titleRect = ChartPresenter::textBoundingRect(font(), "...");
- sh = QSizeF(titleRect.width(), titleRect.height());
- break;
- }
- case Qt::PreferredSize:
- case Qt::MaximumSize: {
- QRectF titleRect = ChartPresenter::textBoundingRect(font(), m_text);
- sh = QSizeF(titleRect.width(), titleRect.height());
- break;
- }
- case Qt::MinimumDescent: {
- QFontMetrics fn(font());
- sh = QSizeF(0, fn.descent());
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/charttitle_p.h b/src/charttitle_p.h
deleted file mode 100644
index d288b535..00000000
--- a/src/charttitle_p.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTITLE_P_H_
-#define CHARTTITLE_P_H_
-
-#include "qchartglobal.h"
-#include <QGraphicsTextItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartTitle : public QGraphicsTextItem
-{
-public:
- ChartTitle(QGraphicsItem *parent = 0);
- ~ChartTitle();
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
- void setText(const QString &text);
- QString text() const;
- void setGeometry(const QRectF &rect);
-private:
- QString m_text;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTTITLE_P_H_ */
diff --git a/src/domain/abstractdomain.cpp b/src/domain/abstractdomain.cpp
deleted file mode 100644
index 3a77a18b..00000000
--- a/src/domain/abstractdomain.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "abstractdomain_p.h"
-#include "qabstractaxis_p.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-AbstractDomain::AbstractDomain(QObject *parent)
- : QObject(parent),
- m_minX(0),
- m_maxX(0),
- m_minY(0),
- m_maxY(0),
- m_signalsBlocked(false),
- m_zoomed(false),
- m_zoomResetMinX(0),
- m_zoomResetMaxX(0),
- m_zoomResetMinY(0),
- m_zoomResetMaxY(0)
-
-{
-}
-
-AbstractDomain::~AbstractDomain()
-{
-}
-
-void AbstractDomain::setSize(const QSizeF &size)
-{
- if(m_size!=size)
- {
- m_size=size;
- emit updated();
- }
-}
-
-QSizeF AbstractDomain::size() const
-{
- return m_size;
-}
-
-void AbstractDomain::setRangeX(qreal min, qreal max)
-{
- setRange(min, max, m_minY, m_maxY);
-}
-
-void AbstractDomain::setRangeY(qreal min, qreal max)
-{
- setRange(m_minX, m_maxX, min, max);
-}
-
-void AbstractDomain::setMinX(qreal min)
-{
- setRange(min, m_maxX, m_minY, m_maxY);
-}
-
-void AbstractDomain::setMaxX(qreal max)
-{
- setRange(m_minX, max, m_minY, m_maxY);
-}
-
-void AbstractDomain::setMinY(qreal min)
-{
- setRange(m_minX, m_maxX, min, m_maxY);
-}
-
-void AbstractDomain::setMaxY(qreal max)
-{
- setRange(m_minX, m_maxX, m_minY, max);
-}
-
-qreal AbstractDomain::spanX() const
-{
- Q_ASSERT(m_maxX >= m_minX);
- return m_maxX - m_minX;
-}
-
-qreal AbstractDomain::spanY() const
-{
- Q_ASSERT(m_maxY >= m_minY);
- return m_maxY - m_minY;
-}
-
-bool AbstractDomain::isEmpty() const
-{
- return qFuzzyCompare(spanX(), 0) || qFuzzyCompare(spanY(), 0) || m_size.isEmpty();
-}
-
-QPointF AbstractDomain::calculateDomainPoint(const QPointF &point) const
-{
- const qreal deltaX = m_size.width() / (m_maxX - m_minX);
- const qreal deltaY = m_size.height() / (m_maxY - m_minY);
- qreal x = point.x() / deltaX + m_minX;
- qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY;
- return QPointF(x, y);
-}
-
-// handlers
-
-void AbstractDomain::handleVerticalAxisRangeChanged(qreal min, qreal max)
-{
- setRangeY(min, max);
-}
-
-void AbstractDomain::handleHorizontalAxisRangeChanged(qreal min, qreal max)
-{
- setRangeX(min, max);
-}
-
-void AbstractDomain::blockRangeSignals(bool block)
-{
- if (m_signalsBlocked!=block) {
- m_signalsBlocked=block;
- if (!block) {
- emit rangeHorizontalChanged(m_minX,m_maxX);
- emit rangeVerticalChanged(m_minY,m_maxY);
- }
- }
-}
-
-void AbstractDomain::zoomReset()
-{
- if (m_zoomed) {
- setRange(m_zoomResetMinX,
- m_zoomResetMaxX,
- m_zoomResetMinY,
- m_zoomResetMaxY);
- m_zoomed = false;
- }
-}
-
-void AbstractDomain::storeZoomReset()
-{
- if (!m_zoomed) {
- m_zoomed = true;
- m_zoomResetMinX = m_minX;
- m_zoomResetMaxX = m_maxX;
- m_zoomResetMinY = m_minY;
- m_zoomResetMaxY = m_maxY;
- }
-}
-
-//algorithm defined by Paul S.Heckbert GraphicalGems I
-
-void AbstractDomain::looseNiceNumbers(qreal &min, qreal &max, int &ticksCount)
-{
- qreal range = niceNumber(max - min, true); //range with ceiling
- qreal step = niceNumber(range / (ticksCount - 1), false);
- min = qFloor(min / step);
- max = qCeil(max / step);
- ticksCount = int(max - min) + 1;
- min *= step;
- max *= step;
-}
-
-//nice numbers can be expressed as form of 1*10^n, 2* 10^n or 5*10^n
-
-qreal AbstractDomain::niceNumber(qreal x, bool ceiling)
-{
- qreal z = qPow(10, qFloor(log10(x))); //find corresponding number of the form of 10^n than is smaller than x
- qreal q = x / z; //q<10 && q>=1;
-
- if (ceiling) {
- if (q <= 1.0) q = 1;
- else if (q <= 2.0) q = 2;
- else if (q <= 5.0) q = 5;
- else q = 10;
- } else {
- if (q < 1.5) q = 1;
- else if (q < 3.0) q = 2;
- else if (q < 7.0) q = 5;
- else q = 10;
- }
- return q * z;
-}
-
-bool AbstractDomain::attachAxis(QAbstractAxis *axis)
-{
- if (axis->orientation() == Qt::Vertical) {
- QObject::connect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), this, SLOT(handleVerticalAxisRangeChanged(qreal,qreal)));
- QObject::connect(this, SIGNAL(rangeVerticalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal)));
- }
-
- if (axis->orientation() == Qt::Horizontal) {
- QObject::connect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), this, SLOT(handleHorizontalAxisRangeChanged(qreal,qreal)));
- QObject::connect(this, SIGNAL(rangeHorizontalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal)));
- }
-
- return true;
-}
-
-bool AbstractDomain::detachAxis(QAbstractAxis *axis)
-{
- if (axis->orientation() == Qt::Vertical) {
- QObject::disconnect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), this, SLOT(handleVerticalAxisRangeChanged(qreal,qreal)));
- QObject::disconnect(this, SIGNAL(rangeVerticalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal)));
- }
-
- if (axis->orientation() == Qt::Horizontal) {
- QObject::disconnect(axis->d_ptr.data(), SIGNAL(rangeChanged(qreal,qreal)), this, SLOT(handleHorizontalAxisRangeChanged(qreal,qreal)));
- QObject::disconnect(this, SIGNAL(rangeHorizontalChanged(qreal,qreal)), axis->d_ptr.data(), SLOT(handleRangeChanged(qreal,qreal)));
- }
-
- return true;
-}
-
-// operators
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2)
-{
- return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
- && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
- && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
- && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
-}
-
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2)
-{
- return !(domain1 == domain2);
-}
-
-
-QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain)
-{
-#ifdef QT_NO_TEXTSTREAM
- Q_UNUSED(domain)
-#else
- dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
-#endif
- return dbg.maybeSpace();
-}
-
-// This function adjusts min/max ranges to failsafe values if negative/zero values are attempted.
-void AbstractDomain::adjustLogDomainRanges(qreal &min, qreal &max)
-{
- if (min <= 0) {
- min = 1.0;
- if (max <= min)
- max = min + 1.0;
- }
-}
-
-
-#include "moc_abstractdomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/abstractdomain_p.h b/src/domain/abstractdomain_p.h
deleted file mode 100644
index 2bdb3232..00000000
--- a/src/domain/abstractdomain_p.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef ABSTRACTDOMAIN_H
-#define ABSTRACTDOMAIN_H
-#include "qchartglobal.h"
-#include <QRectF>
-#include <QSizeF>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractAxis;
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT AbstractDomain: public QObject
-{
- Q_OBJECT
-public:
- enum DomainType { UndefinedDomain,
- XYDomain,
- XLogYDomain,
- LogXYDomain,
- LogXLogYDomain,
- XYPolarDomain,
- XLogYPolarDomain,
- LogXYPolarDomain,
- LogXLogYPolarDomain };
-public:
- explicit AbstractDomain(QObject *object = 0);
- virtual ~AbstractDomain();
-
- virtual void setSize(const QSizeF &size);
- QSizeF size() const;
-
- virtual DomainType type() = 0;
-
- virtual void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY) = 0;
- void setRangeX(qreal min, qreal max);
- void setRangeY(qreal min, qreal max);
- void setMinX(qreal min);
- void setMaxX(qreal max);
- void setMinY(qreal min);
- void setMaxY(qreal max);
-
- qreal minX() const { return m_minX; }
- qreal maxX() const { return m_maxX; }
- qreal minY() const { return m_minY; }
- qreal maxY() const { return m_maxY; }
-
- qreal spanX() const;
- qreal spanY() const;
- bool isEmpty() const;
-
- void blockRangeSignals(bool block);
- bool rangeSignalsBlocked() const { return m_signalsBlocked; }
-
- void zoomReset();
- void storeZoomReset();
- bool isZoomed() { return m_zoomed; }
-
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const AbstractDomain &domain1, const AbstractDomain &domain2);
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const AbstractDomain &domain1, const AbstractDomain &domain2);
- friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const AbstractDomain &domain);
-
- virtual void zoomIn(const QRectF &rect) = 0;
- virtual void zoomOut(const QRectF &rect) = 0;
- virtual void move(qreal dx, qreal dy) = 0;
-
- virtual QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const = 0;
- virtual QPointF calculateDomainPoint(const QPointF &point) const = 0;
- virtual QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const = 0;
-
- virtual bool attachAxis(QAbstractAxis *axis);
- virtual bool detachAxis(QAbstractAxis *axis);
-
- static void looseNiceNumbers(qreal &min, qreal &max, int &ticksCount);
- static qreal niceNumber(qreal x, bool ceiling);
-
-Q_SIGNALS:
- void updated();
- void rangeHorizontalChanged(qreal min, qreal max);
- void rangeVerticalChanged(qreal min, qreal max);
-
-public Q_SLOTS:
- void handleVerticalAxisRangeChanged(qreal min,qreal max);
- void handleHorizontalAxisRangeChanged(qreal min,qreal max);
-
-protected:
- void adjustLogDomainRanges(qreal &min, qreal &max);
-
- qreal m_minX;
- qreal m_maxX;
- qreal m_minY;
- qreal m_maxY;
- QSizeF m_size;
- bool m_signalsBlocked;
- bool m_zoomed;
- qreal m_zoomResetMinX;
- qreal m_zoomResetMaxX;
- qreal m_zoomResetMinY;
- qreal m_zoomResetMaxY;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // ABSTRACTDOMAIN_H
diff --git a/src/domain/logxlogydomain.cpp b/src/domain/logxlogydomain.cpp
deleted file mode 100644
index 71727215..00000000
--- a/src/domain/logxlogydomain.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "logxlogydomain_p.h"
-#include "qabstractaxis_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-LogXLogYDomain::LogXLogYDomain(QObject *parent)
- : AbstractDomain(parent),
- m_logLeftX(0),
- m_logRightX(1),
- m_logBaseX(10),
- m_logLeftY(0),
- m_logRightY(1),
- m_logBaseY(10)
-{
-}
-
-LogXLogYDomain::~LogXLogYDomain()
-{
-}
-
-void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
-{
- bool axisXChanged = false;
- bool axisYChanged = false;
-
- adjustLogDomainRanges(minX, maxX);
- adjustLogDomainRanges(minY, maxY);
-
- if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) {
- m_minX = minX;
- m_maxX = maxX;
- axisXChanged = true;
- qreal logMinX = log10(m_minX) / log10(m_logBaseX);
- qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
- m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
- m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
- if(!m_signalsBlocked)
- emit rangeHorizontalChanged(m_minX, m_maxX);
- }
-
- if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
- m_minY = minY;
- m_maxY = maxY;
- axisYChanged = true;
- qreal logMinY = log10(m_minY) / log10(m_logBaseY);
- qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
- m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
- m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
- if (!m_signalsBlocked)
- emit rangeVerticalChanged(m_minY, m_maxY);
- }
-
- if (axisXChanged || axisYChanged)
- emit updated();
-}
-
-void LogXLogYDomain::zoomIn(const QRectF &rect)
-{
- storeZoomReset();
- qreal logLeftX = rect.left() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
- qreal logRightX = rect.right() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
- qreal leftX = qPow(m_logBaseX, logLeftX);
- qreal rightX = qPow(m_logBaseX, logRightX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal logLeftY = m_logRightY - rect.bottom() * (m_logRightY - m_logLeftY) / m_size.height();
- qreal logRightY = m_logRightY - rect.top() * (m_logRightY - m_logLeftY) / m_size.height();
- qreal leftY = qPow(m_logBaseY, logLeftY);
- qreal rightY = qPow(m_logBaseY, logRightY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void LogXLogYDomain::zoomOut(const QRectF &rect)
-{
- storeZoomReset();
- const qreal factorX = m_size.width() / rect.width();
- const qreal factorY = m_size.height() / rect.height();
-
- qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 - factorX);
- qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 + factorX);
- qreal leftX = qPow(m_logBaseX, logLeftX);
- qreal rightX = qPow(m_logBaseX, logRIghtX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal newLogMinY = m_logLeftY + (m_logRightY - m_logLeftY) / 2 * (1 - factorY);
- qreal newLogMaxY = m_logLeftY + (m_logRightY - m_logLeftY) / 2 * (1 + factorY);
- qreal leftY = qPow(m_logBaseY, newLogMinY);
- qreal rightY = qPow(m_logBaseY, newLogMaxY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void LogXLogYDomain::move(qreal dx, qreal dy)
-{
- qreal stepX = dx * qAbs(m_logRightX - m_logLeftX) / m_size.width();
- qreal leftX = qPow(m_logBaseX, m_logLeftX + stepX);
- qreal rightX = qPow(m_logBaseX, m_logRightX + stepX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal stepY = dy * (m_logRightY - m_logLeftY) / m_size.height();
- qreal leftY = qPow(m_logBaseY, m_logLeftY + stepY);
- qreal rightY = qPow(m_logBaseY, m_logRightY + stepY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-QPointF LogXLogYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
-{
- const qreal deltaX = m_size.width() / qAbs(m_logRightX - m_logLeftX);
- const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
- qreal x(0);
- qreal y(0);
- if (point.x() > 0 && point.y() > 0) {
- x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
- y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
- ok = true;
- } else {
- qWarning() << "Logarithms of zero and negative values are undefined.";
- ok = false;
- if (point.x() > 0)
- x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
- else
- x = 0;
- if (point.y() > 0) {
- y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY
- + m_size.height();
- } else {
- y = m_size.height();
- }
- }
- return QPointF(x, y);
-}
-
-QVector<QPointF> LogXLogYDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
-{
- const qreal deltaX = m_size.width() / qAbs(m_logRightX - m_logLeftX);
- const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
-
- QVector<QPointF> result;
- result.resize(vector.count());
-
- for (int i = 0; i < vector.count(); ++i) {
- if (vector[i].x() > 0 && vector[i].y() > 0) {
- qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
- qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
- result[i].setX(x);
- result[i].setY(y);
- } else {
- qWarning() << "Logarithms of zero and negative values are undefined.";
- return QVector<QPointF>();
- }
- }
- return result;
-}
-
-QPointF LogXLogYDomain::calculateDomainPoint(const QPointF &point) const
-{
- const qreal deltaX = m_size.width() / qAbs(m_logRightX - m_logLeftX);
- const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
- qreal x = qPow(m_logBaseX, m_logLeftX + point.x() / deltaX);
- qreal y = qPow(m_logBaseY, m_logLeftY + (m_size.height() - point.y()) / deltaY);
- return QPointF(x, y);
-}
-
-bool LogXLogYDomain::attachAxis(QAbstractAxis *axis)
-{
- AbstractDomain::attachAxis(axis);
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Vertical) {
- QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
- handleVerticalAxisBaseChanged(logAxis->base());
- }
-
- if (logAxis && logAxis->orientation() == Qt::Horizontal) {
- QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
- handleHorizontalAxisBaseChanged(logAxis->base());
- }
-
- return true;
-}
-
-bool LogXLogYDomain::detachAxis(QAbstractAxis *axis)
-{
- AbstractDomain::detachAxis(axis);
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Vertical)
- QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
-
- if (logAxis && logAxis->orientation() == Qt::Horizontal)
- QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
-
- return true;
-}
-
-void LogXLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
-{
- m_logBaseY = baseY;
- qreal logMinY = log10(m_minY) / log10(m_logBaseY);
- qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
- m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
- m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
- emit updated();
-}
-
-void LogXLogYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
-{
- m_logBaseX = baseX;
- qreal logMinX = log10(m_minX) / log10(m_logBaseX);
- qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
- m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
- m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
- emit updated();
-}
-
-// operators
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2)
-{
- return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
- && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
- && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
- && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
-}
-
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2)
-{
- return !(domain1 == domain2);
-}
-
-
-QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYDomain &domain)
-{
-#ifdef QT_NO_TEXTSTREAM
- Q_UNUSED(domain)
-#else
- dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
-#endif
- return dbg.maybeSpace();
-}
-
-#include "moc_logxlogydomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/logxlogydomain_p.h b/src/domain/logxlogydomain_p.h
deleted file mode 100644
index 878a9353..00000000
--- a/src/domain/logxlogydomain_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef LOGXLOGYDOMAIN_H
-#define LOGXLOGYDOMAIN_H
-#include "abstractdomain_p.h"
-#include <QRectF>
-#include <QSizeF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT LogXLogYDomain: public AbstractDomain
-{
- Q_OBJECT
-public:
- explicit LogXLogYDomain(QObject *object = 0);
- virtual ~LogXLogYDomain();
-
- DomainType type(){ return AbstractDomain::LogXLogYDomain;}
-
- void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
-
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXLogYDomain &domain1, const LogXLogYDomain &domain2);
- friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYDomain &domain);
-
- void zoomIn(const QRectF &rect);
- void zoomOut(const QRectF &rect);
- void move(qreal dx, qreal dy);
-
- QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
- QPointF calculateDomainPoint(const QPointF &point) const;
- QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
-
- bool attachAxis(QAbstractAxis *axis);
- bool detachAxis(QAbstractAxis *axis);
-
-public Q_SLOTS:
- void handleVerticalAxisBaseChanged(qreal baseY);
- void handleHorizontalAxisBaseChanged(qreal baseX);
-
-private:
- qreal m_logLeftX;
- qreal m_logRightX;
- qreal m_logBaseX;
- qreal m_logLeftY;
- qreal m_logRightY;
- qreal m_logBaseY;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // LOGXLOGYDOMAIN_H
diff --git a/src/domain/logxlogypolardomain.cpp b/src/domain/logxlogypolardomain.cpp
deleted file mode 100644
index 3f7cc547..00000000
--- a/src/domain/logxlogypolardomain.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "logxlogypolardomain_p.h"
-#include "qabstractaxis_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-LogXLogYPolarDomain::LogXLogYPolarDomain(QObject *parent)
- : PolarDomain(parent),
- m_logLeftX(0),
- m_logRightX(1),
- m_logBaseX(10),
- m_logInnerY(0),
- m_logOuterY(1),
- m_logBaseY(10)
-{
-}
-
-LogXLogYPolarDomain::~LogXLogYPolarDomain()
-{
-}
-
-void LogXLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
-{
- bool axisXChanged = false;
- bool axisYChanged = false;
-
- adjustLogDomainRanges(minX, maxX);
- adjustLogDomainRanges(minY, maxY);
-
- if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
- m_minX = minX;
- m_maxX = maxX;
- axisXChanged = true;
- qreal logMinX = log10(m_minX) / log10(m_logBaseX);
- qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
- m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
- m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
- if (!m_signalsBlocked)
- emit rangeHorizontalChanged(m_minX, m_maxX);
- }
-
- if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
- m_minY = minY;
- m_maxY = maxY;
- axisYChanged = true;
- qreal logMinY = log10(m_minY) / log10(m_logBaseY);
- qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
- m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
- m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
- if (!m_signalsBlocked)
- emit rangeVerticalChanged(m_minY, m_maxY);
- }
-
- if (axisXChanged || axisYChanged)
- emit updated();
-}
-
-void LogXLogYPolarDomain::zoomIn(const QRectF &rect)
-{
- storeZoomReset();
- qreal logLeftX = rect.left() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
- qreal logRightX = rect.right() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
- qreal leftX = qPow(m_logBaseX, logLeftX);
- qreal rightX = qPow(m_logBaseX, logRightX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal logLeftY = m_logOuterY - rect.bottom() * (m_logOuterY - m_logInnerY) / m_size.height();
- qreal logRightY = m_logOuterY - rect.top() * (m_logOuterY - m_logInnerY) / m_size.height();
- qreal leftY = qPow(m_logBaseY, logLeftY);
- qreal rightY = qPow(m_logBaseY, logRightY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void LogXLogYPolarDomain::zoomOut(const QRectF &rect)
-{
- storeZoomReset();
- const qreal factorX = m_size.width() / rect.width();
-
- qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2.0 * (1.0 - factorX);
- qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2.0 * (1.0 + factorX);
- qreal leftX = qPow(m_logBaseX, logLeftX);
- qreal rightX = qPow(m_logBaseX, logRIghtX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- const qreal factorY = m_size.height() / rect.height();
- qreal newLogMinY = m_logInnerY + (m_logOuterY - m_logInnerY) / 2.0 * (1.0 - factorY);
- qreal newLogMaxY = m_logInnerY + (m_logOuterY - m_logInnerY) / 2.0 * (1.0 + factorY);
- qreal leftY = qPow(m_logBaseY, newLogMinY);
- qreal rightY = qPow(m_logBaseY, newLogMaxY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void LogXLogYPolarDomain::move(qreal dx, qreal dy)
-{
- qreal stepX = dx * (m_logRightX - m_logLeftX) / m_size.width();
- qreal leftX = qPow(m_logBaseX, m_logLeftX + stepX);
- qreal rightX = qPow(m_logBaseX, m_logRightX + stepX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal stepY = dy * (m_logOuterY - m_logInnerY) / m_radius;
- qreal leftY = qPow(m_logBaseY, m_logInnerY + stepY);
- qreal rightY = qPow(m_logBaseY, m_logOuterY + stepY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-qreal LogXLogYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
-{
- qreal retVal;
- if (value <= 0) {
- ok = false;
- retVal = 0.0;
- } else {
- ok = true;
- const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX);
- const qreal logValue = log10(value) / log10(m_logBaseX);
- const qreal valueDelta = logValue - m_logLeftX;
-
- retVal = valueDelta * tickSpan;
- }
- return retVal;
-}
-
-qreal LogXLogYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
-{
- qreal retVal;
- if (value <= 0) {
- ok = false;
- retVal = 0.0;
- } else {
- ok = true;
- const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY);
- const qreal logValue = log10(value) / log10(m_logBaseY);
- const qreal valueDelta = logValue - m_logInnerY;
-
- retVal = valueDelta * tickSpan;
-
- if (retVal < 0.0)
- retVal = 0.0;
- }
- return retVal;
-}
-
-QPointF LogXLogYPolarDomain::calculateDomainPoint(const QPointF &point) const
-{
- if (point == m_center)
- return QPointF(0.0, m_minY);
-
- QLineF line(m_center, point);
- qreal a = 90.0 - line.angle();
- if (a < 0.0)
- a += 360.0;
-
- const qreal deltaX = 360.0 / qAbs(m_logRightX - m_logLeftX);
- a = qPow(m_logBaseX, m_logLeftX + (a / deltaX));
-
- const qreal deltaY = m_radius / qAbs(m_logOuterY - m_logInnerY);
- qreal r = qPow(m_logBaseY, m_logInnerY + (line.length() / deltaY));
-
- return QPointF(a, r);
-}
-
-bool LogXLogYPolarDomain::attachAxis(QAbstractAxis *axis)
-{
- AbstractDomain::attachAxis(axis);
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Horizontal) {
- QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
- handleHorizontalAxisBaseChanged(logAxis->base());
- } else if (logAxis && logAxis->orientation() == Qt::Vertical){
- QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
- handleVerticalAxisBaseChanged(logAxis->base());
- }
-
- return true;
-}
-
-bool LogXLogYPolarDomain::detachAxis(QAbstractAxis *axis)
-{
- AbstractDomain::detachAxis(axis);
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Horizontal)
- QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
- else if (logAxis && logAxis->orientation() == Qt::Vertical)
- QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
-
- return true;
-}
-
-void LogXLogYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX)
-{
- m_logBaseX = baseX;
- qreal logMinX = log10(m_minX) / log10(m_logBaseX);
- qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
- m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
- m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
- emit updated();
-}
-
-void LogXLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY)
-{
- m_logBaseY = baseY;
- qreal logMinY = log10(m_minY) / log10(m_logBaseY);
- qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
- m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
- m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
- emit updated();
-}
-
-// operators
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2)
-{
- return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
- && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
- && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
- && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
-}
-
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2)
-{
- return !(domain1 == domain2);
-}
-
-
-QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYPolarDomain &domain)
-{
-#ifdef QT_NO_TEXTSTREAM
- Q_UNUSED(domain)
-#else
- dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
-#endif
- return dbg.maybeSpace();
-}
-
-#include "moc_logxlogypolardomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/logxlogypolardomain_p.h b/src/domain/logxlogypolardomain_p.h
deleted file mode 100644
index d6eb0dfe..00000000
--- a/src/domain/logxlogypolardomain_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef LOGXLOGYPOLARDOMAIN_H
-#define LOGXLOGYPOLARDOMAIN_H
-#include "polardomain_p.h"
-#include <QRectF>
-#include <QSizeF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT LogXLogYPolarDomain: public PolarDomain
-{
- Q_OBJECT
-public:
- explicit LogXLogYPolarDomain(QObject *object = 0);
- virtual ~LogXLogYPolarDomain();
-
- DomainType type() { return AbstractDomain::LogXLogYPolarDomain; }
-
- void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
-
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2);
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXLogYPolarDomain &domain1, const LogXLogYPolarDomain &domain2);
- friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXLogYPolarDomain &domain);
-
- void zoomIn(const QRectF &rect);
- void zoomOut(const QRectF &rect);
- void move(qreal dx, qreal dy);
-
- QPointF calculateDomainPoint(const QPointF &point) const;
-
- bool attachAxis(QAbstractAxis *axis);
- bool detachAxis(QAbstractAxis *axis);
-
-public Q_SLOTS:
- void handleVerticalAxisBaseChanged(qreal baseY);
- void handleHorizontalAxisBaseChanged(qreal baseX);
-
-protected:
- qreal toAngularCoordinate(qreal value, bool &ok) const;
- qreal toRadialCoordinate(qreal value, bool &ok) const;
-
-private:
- qreal m_logLeftX;
- qreal m_logRightX;
- qreal m_logBaseX;
- qreal m_logInnerY;
- qreal m_logOuterY;
- qreal m_logBaseY;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // LOGXLOGYPOLARDOMAIN_H
diff --git a/src/domain/logxydomain.cpp b/src/domain/logxydomain.cpp
deleted file mode 100644
index 0fb9e856..00000000
--- a/src/domain/logxydomain.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "logxydomain_p.h"
-#include "qabstractaxis_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-LogXYDomain::LogXYDomain(QObject *parent)
- : AbstractDomain(parent),
- m_logLeftX(0),
- m_logRightX(1),
- m_logBaseX(10)
-{
-}
-
-LogXYDomain::~LogXYDomain()
-{
-}
-
-void LogXYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
-{
- bool axisXChanged = false;
- bool axisYChanged = false;
-
- adjustLogDomainRanges(minX, maxX);
-
- if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
- m_minX = minX;
- m_maxX = maxX;
- axisXChanged = true;
- qreal logMinX = log10(m_minX) / log10(m_logBaseX);
- qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
- m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
- m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
- if(!m_signalsBlocked)
- emit rangeHorizontalChanged(m_minX, m_maxX);
- }
-
- if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
- m_minY = minY;
- m_maxY = maxY;
- axisYChanged = true;
- if (!m_signalsBlocked)
- emit rangeVerticalChanged(m_minY, m_maxY);
- }
-
- if (axisXChanged || axisYChanged)
- emit updated();
-}
-
-void LogXYDomain::zoomIn(const QRectF &rect)
-{
- storeZoomReset();
- qreal logLeftX = rect.left() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
- qreal logRightX = rect.right() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
- qreal leftX = qPow(m_logBaseX, logLeftX);
- qreal rightX = qPow(m_logBaseX, logRightX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal dy = spanY() / m_size.height();
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- minY = maxY - dy * rect.bottom();
- maxY = maxY - dy * rect.top();
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void LogXYDomain::zoomOut(const QRectF &rect)
-{
- storeZoomReset();
- const qreal factorX = m_size.width() / rect.width();
-
- qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 - factorX);
- qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2 * (1 + factorX);
- qreal leftX = qPow(m_logBaseX, logLeftX);
- qreal rightX = qPow(m_logBaseX, logRIghtX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal dy = spanY() / rect.height();
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- maxY = minY + dy * rect.bottom();
- minY = maxY - dy * m_size.height();
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void LogXYDomain::move(qreal dx, qreal dy)
-{
- qreal stepX = dx * (m_logRightX - m_logLeftX) / m_size.width();
- qreal leftX = qPow(m_logBaseX, m_logLeftX + stepX);
- qreal rightX = qPow(m_logBaseX, m_logRightX + stepX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal y = spanY() / m_size.height();
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- if (dy != 0) {
- minY = minY + y * dy;
- maxY = maxY + y * dy;
- }
- setRange(minX, maxX, minY, maxY);
-}
-
-QPointF LogXYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
-{
- const qreal deltaX = m_size.width() / (m_logRightX - m_logLeftX);
- const qreal deltaY = m_size.height() / (m_maxY - m_minY);
-
- qreal x(0);
- qreal y = (point.y() - m_minY) * -deltaY + m_size.height();
- if (point.x() > 0) {
- x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
- ok = true;
- } else {
- x = 0;
- qWarning() << "Logarithms of zero and negative values are undefined.";
- ok = false;
- }
- return QPointF(x, y);
-}
-
-QVector<QPointF> LogXYDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
-{
- const qreal deltaX = m_size.width() / (m_logRightX - m_logLeftX);
- const qreal deltaY = m_size.height() / (m_maxY - m_minY);
-
- QVector<QPointF> result;
- result.resize(vector.count());
-
- for (int i = 0; i < vector.count(); ++i) {
- if (vector[i].x() > 0) {
- qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
- qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height();
- result[i].setX(x);
- result[i].setY(y);
- } else {
- qWarning() << "Logarithms of zero and negative values are undefined.";
- return QVector<QPointF>();
- }
-
- }
- return result;
-}
-
-QPointF LogXYDomain::calculateDomainPoint(const QPointF &point) const
-{
- const qreal deltaX = m_size.width() / (m_logRightX - m_logLeftX);
- const qreal deltaY = m_size.height() / (m_maxY - m_minY);
- qreal x = qPow(m_logBaseX, m_logLeftX + point.x() / deltaX);
- qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY;
- return QPointF(x, y);
-}
-
-bool LogXYDomain::attachAxis(QAbstractAxis *axis)
-{
- AbstractDomain::attachAxis(axis);
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Horizontal) {
- QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
- handleHorizontalAxisBaseChanged(logAxis->base());
- }
-
- return true;
-}
-
-bool LogXYDomain::detachAxis(QAbstractAxis *axis)
-{
- AbstractDomain::detachAxis(axis);
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Horizontal)
- QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
-
- return true;
-}
-
-void LogXYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
-{
- m_logBaseX = baseX;
- qreal logMinX = log10(m_minX) / log10(m_logBaseX);
- qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
- m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
- m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
- emit updated();
-}
-
-// operators
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2)
-{
- return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
- && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
- && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
- && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
-}
-
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXYDomain &domain1, const LogXYDomain &domain2)
-{
- return !(domain1 == domain2);
-}
-
-
-QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYDomain &domain)
-{
-#ifdef QT_NO_TEXTSTREAM
- Q_UNUSED(domain)
-#else
- dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
-#endif
- return dbg.maybeSpace();
-}
-
-#include "moc_logxydomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/logxydomain_p.h b/src/domain/logxydomain_p.h
deleted file mode 100644
index 3569aa25..00000000
--- a/src/domain/logxydomain_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef LOGXYDOMAIN_H
-#define LOGXYDOMAIN_H
-#include "abstractdomain_p.h"
-#include <QRectF>
-#include <QSizeF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT LogXYDomain: public AbstractDomain
-{
- Q_OBJECT
-public:
- explicit LogXYDomain(QObject *object = 0);
- virtual ~LogXYDomain();
-
- DomainType type(){ return AbstractDomain::LogXYDomain;}
-
- void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
-
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXYDomain &domain1, const LogXYDomain &domain2);
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXYDomain &domain1, const LogXYDomain &domain2);
- friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYDomain &domain);
-
- void zoomIn(const QRectF &rect);
- void zoomOut(const QRectF &rect);
- void move(qreal dx, qreal dy);
-
- QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
- QPointF calculateDomainPoint(const QPointF &point) const;
- QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
-
- bool attachAxis(QAbstractAxis *axis);
- bool detachAxis(QAbstractAxis *axis);
-
-public Q_SLOTS:
- void handleHorizontalAxisBaseChanged(qreal baseX);
-
-private:
- qreal m_logLeftX;
- qreal m_logRightX;
- qreal m_logBaseX;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // LOGXYDOMAIN_H
diff --git a/src/domain/logxypolardomain.cpp b/src/domain/logxypolardomain.cpp
deleted file mode 100644
index 0f4d56d2..00000000
--- a/src/domain/logxypolardomain.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "logxypolardomain_p.h"
-#include "qabstractaxis_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-LogXYPolarDomain::LogXYPolarDomain(QObject *parent)
- : PolarDomain(parent),
- m_logLeftX(0),
- m_logRightX(1),
- m_logBaseX(10)
-{
-}
-
-LogXYPolarDomain::~LogXYPolarDomain()
-{
-}
-
-void LogXYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
-{
- bool axisXChanged = false;
- bool axisYChanged = false;
-
- adjustLogDomainRanges(minX, maxX);
-
- if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
- m_minX = minX;
- m_maxX = maxX;
- axisXChanged = true;
- qreal logMinX = log10(m_minX) / log10(m_logBaseX);
- qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
- m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
- m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
- if (!m_signalsBlocked)
- emit rangeHorizontalChanged(m_minX, m_maxX);
- }
-
- if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
- m_minY = minY;
- m_maxY = maxY;
- axisYChanged = true;
- if (!m_signalsBlocked)
- emit rangeVerticalChanged(m_minY, m_maxY);
- }
-
- if (axisXChanged || axisYChanged)
- emit updated();
-}
-
-void LogXYPolarDomain::zoomIn(const QRectF &rect)
-{
- storeZoomReset();
- qreal logLeftX = rect.left() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
- qreal logRightX = rect.right() * (m_logRightX - m_logLeftX) / m_size.width() + m_logLeftX;
- qreal leftX = qPow(m_logBaseX, logLeftX);
- qreal rightX = qPow(m_logBaseX, logRightX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal dy = spanY() / m_size.height();
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- minY = maxY - dy * rect.bottom();
- maxY = maxY - dy * rect.top();
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void LogXYPolarDomain::zoomOut(const QRectF &rect)
-{
- storeZoomReset();
- const qreal factorX = m_size.width() / rect.width();
-
- qreal logLeftX = m_logLeftX + (m_logRightX - m_logLeftX) / 2.0 * (1.0 - factorX);
- qreal logRIghtX = m_logLeftX + (m_logRightX - m_logLeftX) / 2.0 * (1.0 + factorX);
- qreal leftX = qPow(m_logBaseX, logLeftX);
- qreal rightX = qPow(m_logBaseX, logRIghtX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal dy = spanY() / rect.height();
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- maxY = minY + dy * rect.bottom();
- minY = maxY - dy * m_size.height();
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void LogXYPolarDomain::move(qreal dx, qreal dy)
-{
- qreal stepX = dx * (m_logRightX - m_logLeftX) / m_size.width();
- qreal leftX = qPow(m_logBaseX, m_logLeftX + stepX);
- qreal rightX = qPow(m_logBaseX, m_logRightX + stepX);
- qreal minX = leftX < rightX ? leftX : rightX;
- qreal maxX = leftX > rightX ? leftX : rightX;
-
- qreal y = spanY() / m_radius;
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- if (dy != 0) {
- minY = minY + y * dy;
- maxY = maxY + y * dy;
- }
- setRange(minX, maxX, minY, maxY);
-}
-
-qreal LogXYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
-{
- qreal retVal;
- if (value <= 0) {
- ok = false;
- retVal = 0.0;
- } else {
- ok = true;
- const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX);
- const qreal logValue = log10(value) / log10(m_logBaseX);
- const qreal valueDelta = logValue - m_logLeftX;
-
- retVal = valueDelta * tickSpan;
- }
- return retVal;
-}
-
-qreal LogXYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
-{
- ok = true;
- if (value < m_minY)
- value = m_minY;
-
- // Dont limit the max. The drawing should clip the stuff that goes out of the grid
- qreal f = (value - m_minY) / (m_maxY - m_minY);
-
- return f * m_radius;
-}
-
-QPointF LogXYPolarDomain::calculateDomainPoint(const QPointF &point) const
-{
- if (point == m_center)
- return QPointF(0.0, m_minY);
-
- QLineF line(m_center, point);
- qreal a = 90.0 - line.angle();
- if (a < 0.0)
- a += 360.0;
-
- const qreal deltaX = 360.0 / qAbs(m_logRightX - m_logLeftX);
- a = qPow(m_logBaseX, m_logLeftX + (a / deltaX));
-
- qreal r = m_minY + ((m_maxY - m_minY) * (line.length() / m_radius));
-
- return QPointF(a, r);
-}
-
-bool LogXYPolarDomain::attachAxis(QAbstractAxis *axis)
-{
- AbstractDomain::attachAxis(axis);
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Horizontal) {
- QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
- handleHorizontalAxisBaseChanged(logAxis->base());
- }
-
- return true;
-}
-
-bool LogXYPolarDomain::detachAxis(QAbstractAxis *axis)
-{
- AbstractDomain::detachAxis(axis);
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Horizontal)
- QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleHorizontalAxisBaseChanged(qreal)));
-
- return true;
-}
-
-void LogXYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX)
-{
- m_logBaseX = baseX;
- qreal logMinX = log10(m_minX) / log10(m_logBaseX);
- qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
- m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
- m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
- emit updated();
-}
-
-// operators
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2)
-{
- return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
- && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
- && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
- && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
-}
-
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2)
-{
- return !(domain1 == domain2);
-}
-
-
-QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYPolarDomain &domain)
-{
-#ifdef QT_NO_TEXTSTREAM
- Q_UNUSED(domain)
-#else
- dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
-#endif
- return dbg.maybeSpace();
-}
-
-#include "moc_logxypolardomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/logxypolardomain_p.h b/src/domain/logxypolardomain_p.h
deleted file mode 100644
index 4c4d5f25..00000000
--- a/src/domain/logxypolardomain_p.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef LOGXYPOLARDOMAIN_H
-#define LOGXYPOLARDOMAIN_H
-#include "polardomain_p.h"
-#include <QRectF>
-#include <QSizeF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT LogXYPolarDomain: public PolarDomain
-{
- Q_OBJECT
-public:
- explicit LogXYPolarDomain(QObject *object = 0);
- virtual ~LogXYPolarDomain();
-
- DomainType type() { return AbstractDomain::LogXYPolarDomain; }
-
- void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
-
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2);
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const LogXYPolarDomain &domain1, const LogXYPolarDomain &domain2);
- friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const LogXYPolarDomain &domain);
-
- void zoomIn(const QRectF &rect);
- void zoomOut(const QRectF &rect);
- void move(qreal dx, qreal dy);
-
- QPointF calculateDomainPoint(const QPointF &point) const;
-
- bool attachAxis(QAbstractAxis *axis);
- bool detachAxis(QAbstractAxis *axis);
-
-public Q_SLOTS:
- void handleHorizontalAxisBaseChanged(qreal baseX);
-
-protected:
- qreal toAngularCoordinate(qreal value, bool &ok) const;
- qreal toRadialCoordinate(qreal value, bool &ok) const;
-
-private:
- qreal m_logLeftX;
- qreal m_logRightX;
- qreal m_logBaseX;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // LOGXYPOLARDOMAIN_H
diff --git a/src/domain/polardomain.cpp b/src/domain/polardomain.cpp
deleted file mode 100644
index dbc85501..00000000
--- a/src/domain/polardomain.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polardomain_p.h"
-#include "qabstractaxis_p.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarDomain::PolarDomain(QObject *parent)
- : AbstractDomain(parent)
-{
-}
-
-PolarDomain::~PolarDomain()
-{
-}
-
-void PolarDomain::setSize(const QSizeF &size)
-{
- Q_ASSERT(size.width() == size.height());
- m_radius = size.height() / 2.0;
- m_center = QPointF(m_radius, m_radius);
- AbstractDomain::setSize(size);
-}
-
-QPointF PolarDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
-{
- qreal r = 0.0;
- qreal a = toAngularCoordinate(point.x(), ok);
- if (ok)
- r = toRadialCoordinate(point.y(), ok);
- if (ok) {
- return m_center + polarCoordinateToPoint(a, r);
- } else {
- qWarning() << "Logarithm of negative value is undefined. Empty layout returned.";
- return QPointF();
- }
-}
-
-QVector<QPointF> PolarDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
-{
- QVector<QPointF> result;
- result.resize(vector.count());
- bool ok;
- qreal r = 0.0;
- qreal a = 0.0;
-
- for (int i = 0; i < vector.count(); ++i) {
- a = toAngularCoordinate(vector[i].x(), ok);
- if (ok)
- r = toRadialCoordinate(vector[i].y(), ok);
- if (ok) {
- result[i] = m_center + polarCoordinateToPoint(a, r);
- } else {
- qWarning() << "Logarithm of negative value is undefined. Empty layout returned.";
- return QVector<QPointF>();
- }
- }
-
- return result;
-}
-
-QPointF PolarDomain::polarCoordinateToPoint(qreal angularCoordinate, qreal radialCoordinate) const
-{
- qreal dx = qSin(angularCoordinate * (M_PI / 180)) * radialCoordinate;
- qreal dy = qCos(angularCoordinate * (M_PI / 180)) * radialCoordinate;
-
- return QPointF(dx, -dy);
-}
-
-#include "moc_polardomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/polardomain_p.h b/src/domain/polardomain_p.h
deleted file mode 100644
index 870299ac..00000000
--- a/src/domain/polardomain_p.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARDOMAIN_H
-#define POLARDOMAIN_H
-#include "abstractdomain_p.h"
-#include <QRectF>
-#include <QSizeF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT PolarDomain: public AbstractDomain
-{
- Q_OBJECT
-public:
- explicit PolarDomain(QObject *object = 0);
- virtual ~PolarDomain();
-
- void setSize(const QSizeF &size);
-
- QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
- QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
-
- virtual qreal toAngularCoordinate(qreal value, bool &ok) const = 0;
- virtual qreal toRadialCoordinate(qreal value, bool &ok) const = 0;
-
-protected:
- QPointF polarCoordinateToPoint(qreal angularCoordinate, qreal radialCoordinate) const;
-
- QPointF m_center;
- qreal m_radius;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARDOMAIN_H
diff --git a/src/domain/xlogydomain.cpp b/src/domain/xlogydomain.cpp
deleted file mode 100644
index 30a18ced..00000000
--- a/src/domain/xlogydomain.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xlogydomain_p.h"
-#include "qabstractaxis_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-XLogYDomain::XLogYDomain(QObject *parent)
- : AbstractDomain(parent),
- m_logLeftY(0),
- m_logRightY(1),
- m_logBaseY(10)
-{
-}
-
-XLogYDomain::~XLogYDomain()
-{
-}
-
-void XLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
-{
- bool axisXChanged = false;
- bool axisYChanged = false;
-
- adjustLogDomainRanges(minY, maxY);
-
- if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) {
- m_minX = minX;
- m_maxX = maxX;
- axisXChanged = true;
- if(!m_signalsBlocked)
- emit rangeHorizontalChanged(m_minX, m_maxX);
- }
-
- if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
- m_minY = minY;
- m_maxY = maxY;
- axisYChanged = true;
- qreal logMinY = log10(m_minY) / log10(m_logBaseY);
- qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
- m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
- m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
- if (!m_signalsBlocked)
- emit rangeVerticalChanged(m_minY, m_maxY);
- }
-
- if (axisXChanged || axisYChanged)
- emit updated();
-}
-
-void XLogYDomain::zoomIn(const QRectF &rect)
-{
- storeZoomReset();
- qreal dx = spanX() / m_size.width();
- qreal maxX = m_maxX;
- qreal minX = m_minX;
-
- maxX = minX + dx * rect.right();
- minX = minX + dx * rect.left();
-
- qreal logLeftY = m_logRightY - rect.bottom() * (m_logRightY - m_logLeftY) / m_size.height();
- qreal logRightY = m_logRightY - rect.top() * (m_logRightY - m_logLeftY) / m_size.height();
- qreal leftY = qPow(m_logBaseY, logLeftY);
- qreal rightY = qPow(m_logBaseY, logRightY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void XLogYDomain::zoomOut(const QRectF &rect)
-{
- storeZoomReset();
- qreal dx = spanX() / rect.width();
- qreal maxX = m_maxX;
- qreal minX = m_minX;
-
- minX = maxX - dx * rect.right();
- maxX = minX + dx * m_size.width();
-
- const qreal factorY = m_size.height() / rect.height();
- qreal newLogMinY = m_logLeftY + (m_logRightY - m_logLeftY) / 2 * (1 - factorY);
- qreal newLogMaxY = m_logLeftY + (m_logRightY - m_logLeftY) / 2 * (1 + factorY);
- qreal leftY = qPow(m_logBaseY, newLogMinY);
- qreal rightY = qPow(m_logBaseY, newLogMaxY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void XLogYDomain::move(qreal dx, qreal dy)
-{
- qreal x = spanX() / m_size.width();
- qreal maxX = m_maxX;
- qreal minX = m_minX;
-
- if (dx != 0) {
- minX = minX + x * dx;
- maxX = maxX + x * dx;
- }
-
- qreal stepY = dy * (m_logRightY - m_logLeftY) / m_size.height();
- qreal leftY = qPow(m_logBaseY, m_logLeftY + stepY);
- qreal rightY = qPow(m_logBaseY, m_logRightY + stepY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-QPointF XLogYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
-{
- const qreal deltaX = m_size.width() / (m_maxX - m_minX);
- const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
-
- qreal x = (point.x() - m_minX) * deltaX;
- qreal y(0);
- if (point.y() > 0) {
- y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
- ok = true;
- } else {
- y = m_size.height();
- qWarning() << "Logarithms of zero and negative values are undefined.";
- ok = false;
- }
- return QPointF(x, y);
-}
-
-QVector<QPointF> XLogYDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
-{
- const qreal deltaX = m_size.width() / (m_maxX - m_minX);
- const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
-
- QVector<QPointF> result;
- result.resize(vector.count());
-
- for (int i = 0; i < vector.count(); ++i) {
- if (vector[i].y() > 0) {
- qreal x = (vector[i].x() - m_minX) * deltaX;
- qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
- result[i].setX(x);
- result[i].setY(y);
- } else {
- qWarning() << "Logarithms of zero and negative values are undefined.";
- return QVector<QPointF>();
- }
- }
- return result;
-}
-
-QPointF XLogYDomain::calculateDomainPoint(const QPointF &point) const
-{
- const qreal deltaX = m_size.width() / (m_maxX - m_minX);
- const qreal deltaY = m_size.height() / qAbs(m_logRightY - m_logLeftY);
- qreal x = point.x() / deltaX + m_minX;
- qreal y = qPow(m_logBaseY, m_logLeftY + (m_size.height() - point.y()) / deltaY);
- return QPointF(x, y);
-}
-
-bool XLogYDomain::attachAxis(QAbstractAxis *axis)
-{
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Vertical) {
- QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
- handleVerticalAxisBaseChanged(logAxis->base());
- }
- return AbstractDomain::attachAxis(axis);
-}
-
-bool XLogYDomain::detachAxis(QAbstractAxis *axis)
-{
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Vertical)
- QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
-
- return AbstractDomain::detachAxis(axis);
-}
-
-void XLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
-{
- m_logBaseY = baseY;
- qreal logMinY = log10(m_minY) / log10(m_logBaseY);
- qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
- m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
- m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
- emit updated();
-}
-
-// operators
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2)
-{
- return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
- && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
- && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
- && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
-}
-
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XLogYDomain &domain1, const XLogYDomain &domain2)
-{
- return !(domain1 == domain2);
-}
-
-
-QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYDomain &domain)
-{
-#ifdef QT_NO_TEXTSTREAM
- Q_UNUSED(domain)
-#else
- dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
-#endif
- return dbg.maybeSpace();
-}
-
-#include "moc_xlogydomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/xlogydomain_p.h b/src/domain/xlogydomain_p.h
deleted file mode 100644
index 5125e1fe..00000000
--- a/src/domain/xlogydomain_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef XLOGYDOMAIN_H
-#define XLOGYDOMAIN_H
-#include "abstractdomain_p.h"
-#include <QRectF>
-#include <QSizeF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT XLogYDomain: public AbstractDomain
-{
- Q_OBJECT
-public:
- explicit XLogYDomain(QObject *object = 0);
- virtual ~XLogYDomain();
-
- DomainType type(){ return AbstractDomain::XLogYDomain;};
-
- void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
-
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XLogYDomain &domain1, const XLogYDomain &domain2);
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XLogYDomain &domain1, const XLogYDomain &domain2);
- friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYDomain &domain);
-
- void zoomIn(const QRectF &rect);
- void zoomOut(const QRectF &rect);
- void move(qreal dx, qreal dy);
-
- QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
- QPointF calculateDomainPoint(const QPointF &point) const;
- QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
-
- bool attachAxis(QAbstractAxis *axis);
- bool detachAxis(QAbstractAxis *axis);
-
-public Q_SLOTS:
- void handleVerticalAxisBaseChanged(qreal baseY);
-
-private:
- qreal m_logLeftY;
- qreal m_logRightY;
- qreal m_logBaseY;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // XLOGYDOMAIN_H
diff --git a/src/domain/xlogypolardomain.cpp b/src/domain/xlogypolardomain.cpp
deleted file mode 100644
index 3ef0bea1..00000000
--- a/src/domain/xlogypolardomain.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xlogypolardomain_p.h"
-#include "qabstractaxis_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-XLogYPolarDomain::XLogYPolarDomain(QObject *parent)
- : PolarDomain(parent),
- m_logInnerY(0),
- m_logOuterY(1),
- m_logBaseY(10)
-{
-}
-
-XLogYPolarDomain::~XLogYPolarDomain()
-{
-}
-
-void XLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
-{
- bool axisXChanged = false;
- bool axisYChanged = false;
-
- adjustLogDomainRanges(minY, maxY);
-
- if (!qFuzzyIsNull(m_minX - minX) || !qFuzzyIsNull(m_maxX - maxX)) {
- m_minX = minX;
- m_maxX = maxX;
- axisXChanged = true;
- if (!m_signalsBlocked)
- emit rangeHorizontalChanged(m_minX, m_maxX);
- }
-
- if (!qFuzzyIsNull(m_minY - minY) || !qFuzzyIsNull(m_maxY - maxY)) {
- m_minY = minY;
- m_maxY = maxY;
- axisYChanged = true;
- qreal logMinY = log10(m_minY) / log10(m_logBaseY);
- qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
- m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
- m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
- if (!m_signalsBlocked)
- emit rangeVerticalChanged(m_minY, m_maxY);
- }
-
- if (axisXChanged || axisYChanged)
- emit updated();
-}
-
-void XLogYPolarDomain::zoomIn(const QRectF &rect)
-{
- storeZoomReset();
- qreal dx = spanX() / m_size.width();
- qreal maxX = m_maxX;
- qreal minX = m_minX;
-
- maxX = minX + dx * rect.right();
- minX = minX + dx * rect.left();
-
- qreal logLeftY = m_logOuterY - rect.bottom() * (m_logOuterY - m_logInnerY) / m_size.height();
- qreal logRightY = m_logOuterY - rect.top() * (m_logOuterY - m_logInnerY) / m_size.height();
- qreal leftY = qPow(m_logBaseY, logLeftY);
- qreal rightY = qPow(m_logBaseY, logRightY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void XLogYPolarDomain::zoomOut(const QRectF &rect)
-{
- storeZoomReset();
- qreal dx = spanX() / rect.width();
- qreal maxX = m_maxX;
- qreal minX = m_minX;
-
- minX = maxX - dx * rect.right();
- maxX = minX + dx * m_size.width();
-
- const qreal factorY = m_size.height() / rect.height();
- qreal newLogMinY = m_logInnerY + (m_logOuterY - m_logInnerY) / 2.0 * (1.0 - factorY);
- qreal newLogMaxY = m_logInnerY + (m_logOuterY - m_logInnerY) / 2.0 * (1.0 + factorY);
- qreal leftY = qPow(m_logBaseY, newLogMinY);
- qreal rightY = qPow(m_logBaseY, newLogMaxY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void XLogYPolarDomain::move(qreal dx, qreal dy)
-{
- qreal x = spanX() / 360.0;
-
- qreal maxX = m_maxX;
- qreal minX = m_minX;
-
- if (dx != 0) {
- minX = minX + x * dx;
- maxX = maxX + x * dx;
- }
-
- qreal stepY = dy * (m_logOuterY - m_logInnerY) / m_radius;
- qreal leftY = qPow(m_logBaseY, m_logInnerY + stepY);
- qreal rightY = qPow(m_logBaseY, m_logOuterY + stepY);
- qreal minY = leftY < rightY ? leftY : rightY;
- qreal maxY = leftY > rightY ? leftY : rightY;
-
- setRange(minX, maxX, minY, maxY);
-}
-
-qreal XLogYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
-{
- ok = true;
- qreal f = (value - m_minX) / (m_maxX - m_minX);
- return f * 360.0;
-}
-
-qreal XLogYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
-{
- qreal retVal;
- if (value <= 0) {
- ok = false;
- retVal = 0.0;
- } else {
- ok = true;
- const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY);
- const qreal logValue = log10(value) / log10(m_logBaseY);
- const qreal valueDelta = logValue - m_logInnerY;
-
- retVal = valueDelta * tickSpan;
-
- if (retVal < 0.0)
- retVal = 0.0;
- }
- return retVal;
-}
-
-QPointF XLogYPolarDomain::calculateDomainPoint(const QPointF &point) const
-{
- if (point == m_center)
- return QPointF(0.0, m_minY);
-
- QLineF line(m_center, point);
- qreal a = 90.0 - line.angle();
- if (a < 0.0)
- a += 360.0;
- a = ((a / 360.0) * (m_maxX - m_minX)) + m_minX;
-
- const qreal deltaY = m_radius / qAbs(m_logOuterY - m_logInnerY);
- qreal r = qPow(m_logBaseY, m_logInnerY + (line.length() / deltaY));
-
- return QPointF(a, r);
-}
-
-bool XLogYPolarDomain::attachAxis(QAbstractAxis *axis)
-{
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Vertical) {
- QObject::connect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
- handleVerticalAxisBaseChanged(logAxis->base());
- }
- return AbstractDomain::attachAxis(axis);
-}
-
-bool XLogYPolarDomain::detachAxis(QAbstractAxis *axis)
-{
- QLogValueAxis *logAxis = qobject_cast<QLogValueAxis *>(axis);
-
- if (logAxis && logAxis->orientation() == Qt::Vertical)
- QObject::disconnect(logAxis, SIGNAL(baseChanged(qreal)), this, SLOT(handleVerticalAxisBaseChanged(qreal)));
-
- return AbstractDomain::detachAxis(axis);
-}
-
-void XLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY)
-{
- m_logBaseY = baseY;
- qreal logMinY = log10(m_minY) / log10(m_logBaseY);
- qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
- m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
- m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
- emit updated();
-}
-
-// operators
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2)
-{
- return (qFuzzyIsNull(domain1.m_maxX - domain2.m_maxX)
- && qFuzzyIsNull(domain1.m_maxY - domain2.m_maxY)
- && qFuzzyIsNull(domain1.m_minX - domain2.m_minX)
- && qFuzzyIsNull(domain1.m_minY - domain2.m_minY));
-}
-
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2)
-{
- return !(domain1 == domain2);
-}
-
-
-QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYPolarDomain &domain)
-{
-#ifdef QT_NO_TEXTSTREAM
- Q_UNUSED(domain)
-#else
- dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
-#endif
- return dbg.maybeSpace();
-}
-
-#include "moc_xlogypolardomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/xlogypolardomain_p.h b/src/domain/xlogypolardomain_p.h
deleted file mode 100644
index 0c8eca16..00000000
--- a/src/domain/xlogypolardomain_p.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef XLOGYPOLARDOMAIN_H
-#define XLOGYPOLARDOMAIN_H
-#include "polardomain_p.h"
-#include <QRectF>
-#include <QSizeF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT XLogYPolarDomain: public PolarDomain
-{
- Q_OBJECT
-public:
- explicit XLogYPolarDomain(QObject *object = 0);
- virtual ~XLogYPolarDomain();
-
- DomainType type() { return AbstractDomain::XLogYPolarDomain; }
-
- void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
-
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2);
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XLogYPolarDomain &domain1, const XLogYPolarDomain &domain2);
- friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XLogYPolarDomain &domain);
-
- void zoomIn(const QRectF &rect);
- void zoomOut(const QRectF &rect);
- void move(qreal dx, qreal dy);
-
- QPointF calculateDomainPoint(const QPointF &point) const;
-
- bool attachAxis(QAbstractAxis *axis);
- bool detachAxis(QAbstractAxis *axis);
-
-public Q_SLOTS:
- void handleVerticalAxisBaseChanged(qreal baseY);
-
-protected:
- qreal toAngularCoordinate(qreal value, bool &ok) const;
- qreal toRadialCoordinate(qreal value, bool &ok) const;
-
-private:
- qreal m_logInnerY;
- qreal m_logOuterY;
- qreal m_logBaseY;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // XLOGYPOLARDOMAIN_H
diff --git a/src/domain/xydomain.cpp b/src/domain/xydomain.cpp
deleted file mode 100644
index 4553646b..00000000
--- a/src/domain/xydomain.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xydomain_p.h"
-#include "qabstractaxis_p.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-XYDomain::XYDomain(QObject *parent)
- : AbstractDomain(parent)
-{
-}
-
-XYDomain::~XYDomain()
-{
-}
-
-void XYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
-{
- bool axisXChanged = false;
- bool axisYChanged = false;
-
- if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
- m_minX = minX;
- m_maxX = maxX;
- axisXChanged = true;
- if(!m_signalsBlocked)
- emit rangeHorizontalChanged(m_minX, m_maxX);
- }
-
- if (!qFuzzyCompare(m_minY, minY) || !qFuzzyCompare(m_maxY, maxY)) {
- m_minY = minY;
- m_maxY = maxY;
- axisYChanged = true;
- if(!m_signalsBlocked)
- emit rangeVerticalChanged(m_minY, m_maxY);
- }
-
- if (axisXChanged || axisYChanged)
- emit updated();
-}
-
-
-void XYDomain::zoomIn(const QRectF &rect)
-{
- storeZoomReset();
- qreal dx = spanX() / m_size.width();
- qreal dy = spanY() / m_size.height();
-
- qreal maxX = m_maxX;
- qreal minX = m_minX;
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- maxX = minX + dx * rect.right();
- minX = minX + dx * rect.left();
- minY = maxY - dy * rect.bottom();
- maxY = maxY - dy * rect.top();
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void XYDomain::zoomOut(const QRectF &rect)
-{
- storeZoomReset();
- qreal dx = spanX() / rect.width();
- qreal dy = spanY() / rect.height();
-
- qreal maxX = m_maxX;
- qreal minX = m_minX;
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- minX = maxX - dx * rect.right();
- maxX = minX + dx * m_size.width();
- maxY = minY + dy * rect.bottom();
- minY = maxY - dy * m_size.height();
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void XYDomain::move(qreal dx, qreal dy)
-{
- qreal x = spanX() / m_size.width();
- qreal y = spanY() / m_size.height();
-
- qreal maxX = m_maxX;
- qreal minX = m_minX;
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- if (dx != 0) {
- minX = minX + x * dx;
- maxX = maxX + x * dx;
- }
- if (dy != 0) {
- minY = minY + y * dy;
- maxY = maxY + y * dy;
- }
- setRange(minX, maxX, minY, maxY);
-}
-
-QPointF XYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) const
-{
- const qreal deltaX = m_size.width() / (m_maxX - m_minX);
- const qreal deltaY = m_size.height() / (m_maxY - m_minY);
- qreal x = (point.x() - m_minX) * deltaX;
- qreal y = (point.y() - m_minY) * -deltaY + m_size.height();
- ok = true;
- return QPointF(x, y);
-}
-
-QVector<QPointF> XYDomain::calculateGeometryPoints(const QList<QPointF> &vector) const
-{
- const qreal deltaX = m_size.width() / (m_maxX - m_minX);
- const qreal deltaY = m_size.height() / (m_maxY - m_minY);
-
- QVector<QPointF> result;
- result.resize(vector.count());
-
- for (int i = 0; i < vector.count(); ++i) {
- qreal x = (vector[i].x() - m_minX) * deltaX;
- qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height();
- result[i].setX(x);
- result[i].setY(y);
- }
- return result;
-}
-
-QPointF XYDomain::calculateDomainPoint(const QPointF &point) const
-{
- const qreal deltaX = m_size.width() / (m_maxX - m_minX);
- const qreal deltaY = m_size.height() / (m_maxY - m_minY);
- qreal x = point.x() / deltaX + m_minX;
- qreal y = (point.y() - m_size.height()) / (-deltaY) + m_minY;
- return QPointF(x, y);
-}
-
-// operators
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XYDomain &domain1, const XYDomain &domain2)
-{
- return (qFuzzyCompare(domain1.m_maxX, domain2.m_maxX)
- && qFuzzyCompare(domain1.m_maxY, domain2.m_maxY)
- && qFuzzyCompare(domain1.m_minX, domain2.m_minX)
- && qFuzzyCompare(domain1.m_minY, domain2.m_minY));
-}
-
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XYDomain &domain1, const XYDomain &domain2)
-{
- return !(domain1 == domain2);
-}
-
-
-QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYDomain &domain)
-{
-#ifdef QT_NO_TEXTSTREAM
- Q_UNUSED(domain)
-#else
- dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
-#endif
- return dbg.maybeSpace();
-}
-
-#include "moc_xydomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/xydomain_p.h b/src/domain/xydomain_p.h
deleted file mode 100644
index 52433c36..00000000
--- a/src/domain/xydomain_p.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef XYDOMAIN_H
-#define XYDOMAIN_H
-#include "abstractdomain_p.h"
-#include <QRectF>
-#include <QSizeF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT XYDomain: public AbstractDomain
-{
- Q_OBJECT
-public:
- explicit XYDomain(QObject *object = 0);
- virtual ~XYDomain();
-
- DomainType type(){ return AbstractDomain::XYDomain;}
-
- void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
-
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XYDomain &Domain1, const XYDomain &Domain2);
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XYDomain &Domain1, const XYDomain &Domain2);
- friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYDomain &AbstractDomain);
-
- void zoomIn(const QRectF &rect);
- void zoomOut(const QRectF &rect);
- void move(qreal dx, qreal dy);
-
- QPointF calculateGeometryPoint(const QPointF &point, bool &ok) const;
- QPointF calculateDomainPoint(const QPointF &point) const;
- QVector<QPointF> calculateGeometryPoints(const QList<QPointF> &vector) const;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // XYDOMAIN_H
diff --git a/src/domain/xypolardomain.cpp b/src/domain/xypolardomain.cpp
deleted file mode 100644
index 6d857892..00000000
--- a/src/domain/xypolardomain.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "xypolardomain_p.h"
-#include "qabstractaxis_p.h"
-#include <qmath.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-XYPolarDomain::XYPolarDomain(QObject *parent)
- : PolarDomain(parent)
-{
-}
-
-XYPolarDomain::~XYPolarDomain()
-{
-}
-
-void XYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
-{
- bool axisXChanged = false;
- bool axisYChanged = false;
-
- if (!qFuzzyCompare(m_minX, minX) || !qFuzzyCompare(m_maxX, maxX)) {
- m_minX = minX;
- m_maxX = maxX;
- axisXChanged = true;
- if (!m_signalsBlocked)
- emit rangeHorizontalChanged(m_minX, m_maxX);
- }
-
- if (!qFuzzyCompare(m_minY, minY) || !qFuzzyCompare(m_maxY, maxY)) {
- m_minY = minY;
- m_maxY = maxY;
- axisYChanged = true;
- if (!m_signalsBlocked)
- emit rangeVerticalChanged(m_minY, m_maxY);
- }
-
- if (axisXChanged || axisYChanged)
- emit updated();
-}
-
-
-void XYPolarDomain::zoomIn(const QRectF &rect)
-{
- storeZoomReset();
- qreal dx = spanX() / m_size.width();
- qreal dy = spanY() / m_size.height();
-
- qreal maxX = m_maxX;
- qreal minX = m_minX;
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- maxX = minX + dx * rect.right();
- minX = minX + dx * rect.left();
- minY = maxY - dy * rect.bottom();
- maxY = maxY - dy * rect.top();
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void XYPolarDomain::zoomOut(const QRectF &rect)
-{
- storeZoomReset();
- qreal dx = spanX() / rect.width();
- qreal dy = spanY() / rect.height();
-
- qreal maxX = m_maxX;
- qreal minX = m_minX;
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- minX = maxX - dx * rect.right();
- maxX = minX + dx * m_size.width();
- maxY = minY + dy * rect.bottom();
- minY = maxY - dy * m_size.height();
-
- setRange(minX, maxX, minY, maxY);
-}
-
-void XYPolarDomain::move(qreal dx, qreal dy)
-{
- // One unit scrolls one degree angular and one pixel radial
- qreal x = spanX() / 360.0;
- qreal y = spanY() / m_radius;
-
- qreal maxX = m_maxX;
- qreal minX = m_minX;
- qreal minY = m_minY;
- qreal maxY = m_maxY;
-
- if (dx != 0) {
- minX = minX + x * dx;
- maxX = maxX + x * dx;
- }
- if (dy != 0) {
- minY = minY + y * dy;
- maxY = maxY + y * dy;
- }
- setRange(minX, maxX, minY, maxY);
-}
-
-QPointF XYPolarDomain::calculateDomainPoint(const QPointF &point) const
-{
- if (point == m_center)
- return QPointF(0.0, m_minX);
-
- QLineF line(m_center, point);
- qreal a = 90.0 - line.angle();
- if (a < 0.0)
- a += 360.0;
- a = ((a / 360.0) * (m_maxX - m_minX)) + m_minX;
- qreal r = m_minY + ((m_maxY - m_minY) * (line.length() / m_radius));
- return QPointF(a, r);
-}
-
-qreal XYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
-{
- ok = true;
- qreal f = (value - m_minX) / (m_maxX - m_minX);
- return f * 360.0;
-}
-
-qreal XYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
-{
- ok = true;
- if (value < m_minY)
- value = m_minY;
-
- // Dont limit the max. The drawing should clip the stuff that goes out of the grid
- qreal f = (value - m_minY) / (m_maxY - m_minY);
-
- return f * m_radius;
-}
-
-// operators
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XYPolarDomain &domain1, const XYPolarDomain &domain2)
-{
- return (qFuzzyCompare(domain1.m_maxX, domain2.m_maxX)
- && qFuzzyCompare(domain1.m_maxY, domain2.m_maxY)
- && qFuzzyCompare(domain1.m_minX, domain2.m_minX)
- && qFuzzyCompare(domain1.m_minY, domain2.m_minY));
-}
-
-
-bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XYPolarDomain &domain1, const XYPolarDomain &domain2)
-{
- return !(domain1 == domain2);
-}
-
-
-QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYPolarDomain &domain)
-{
-#ifdef QT_NO_TEXTSTREAM
- Q_UNUSED(domain)
-#else
- dbg.nospace() << "AbstractDomain(" << domain.m_minX << ',' << domain.m_maxX << ',' << domain.m_minY << ',' << domain.m_maxY << ')' << domain.m_size;
-#endif
- return dbg.maybeSpace();
-}
-
-#include "moc_xypolardomain_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/domain/xypolardomain_p.h b/src/domain/xypolardomain_p.h
deleted file mode 100644
index 5dfd908e..00000000
--- a/src/domain/xypolardomain_p.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef XYPOLARDOMAIN_H
-#define XYPOLARDOMAIN_H
-#include "polardomain_p.h"
-#include <QRectF>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_AUTOTEST_EXPORT XYPolarDomain: public PolarDomain
-{
- Q_OBJECT
-public:
- explicit XYPolarDomain(QObject *object = 0);
- virtual ~XYPolarDomain();
-
- DomainType type(){ return AbstractDomain::XYPolarDomain;}
-
- void setRange(qreal minX, qreal maxX, qreal minY, qreal maxY);
-
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator== (const XYPolarDomain &Domain1, const XYPolarDomain &Domain2);
- friend bool QTCOMMERCIALCHART_AUTOTEST_EXPORT operator!= (const XYPolarDomain &Domain1, const XYPolarDomain &Domain2);
- friend QDebug QTCOMMERCIALCHART_AUTOTEST_EXPORT operator<<(QDebug dbg, const XYPolarDomain &AbstractDomain);
-
- void zoomIn(const QRectF &rect);
- void zoomOut(const QRectF &rect);
- void move(qreal dx, qreal dy);
-
- QPointF calculateDomainPoint(const QPointF &point) const;
-
-protected:
- qreal toAngularCoordinate(qreal value, bool &ok) const;
- qreal toRadialCoordinate(qreal value, bool &ok) const;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // XYPOLARDOMAIN_H
diff --git a/src/layout/abstractchartlayout.cpp b/src/layout/abstractchartlayout.cpp
deleted file mode 100644
index 4efee721..00000000
--- a/src/layout/abstractchartlayout.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "abstractchartlayout_p.h"
-#include "chartpresenter_p.h"
-#include "qlegend_p.h"
-#include "chartaxiselement_p.h"
-#include "charttitle_p.h"
-#include "chartbackground_p.h"
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-static const qreal golden_ratio = 0.4;
-
-AbstractChartLayout::AbstractChartLayout(ChartPresenter *presenter)
- : m_presenter(presenter),
- m_margins(20, 20, 20, 20),
- m_minChartRect(0, 0, 200, 200)
-{
-}
-
-AbstractChartLayout::~AbstractChartLayout()
-{
-}
-
-void AbstractChartLayout::setGeometry(const QRectF &rect)
-{
- if (!rect.isValid())
- return;
-
- if (m_presenter->chart()->isVisible()) {
- QList<ChartAxisElement *> axes = m_presenter->axisItems();
- ChartTitle *title = m_presenter->titleElement();
- QLegend *legend = m_presenter->legend();
- ChartBackground *background = m_presenter->backgroundElement();
-
- QRectF contentGeometry = calculateBackgroundGeometry(rect, background);
-
- contentGeometry = calculateContentGeometry(contentGeometry);
-
- if (title && title->isVisible())
- contentGeometry = calculateTitleGeometry(contentGeometry, title);
-
- if (legend->isAttachedToChart() && legend->isVisible())
- contentGeometry = calculateLegendGeometry(contentGeometry, legend);
-
- contentGeometry = calculateAxisGeometry(contentGeometry, axes);
-
- m_presenter->setGeometry(contentGeometry);
- if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian)
- static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
- else
- static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry);
- }
-
- QGraphicsLayout::setGeometry(rect);
-}
-
-QRectF AbstractChartLayout::calculateContentGeometry(const QRectF &geometry) const
-{
- return geometry.adjusted(m_margins.left(), m_margins.top(), -m_margins.right(), -m_margins.bottom());
-}
-
-QRectF AbstractChartLayout::calculateContentMinimum(const QRectF &minimum) const
-{
- return minimum.adjusted(0, 0, m_margins.left() + m_margins.right(), m_margins.top() + m_margins.bottom());
-}
-
-
-QRectF AbstractChartLayout::calculateBackgroundGeometry(const QRectF &geometry, ChartBackground *background) const
-{
- qreal left;
- qreal top;
- qreal right;
- qreal bottom;
- getContentsMargins(&left, &top, &right, &bottom);
- QRectF backgroundGeometry = geometry.adjusted(left, top, -right, -bottom);
- if (background)
- background->setRect(backgroundGeometry);
- return backgroundGeometry;
-}
-
-QRectF AbstractChartLayout::calculateBackgroundMinimum(const QRectF &minimum) const
-{
- qreal left;
- qreal top;
- qreal right;
- qreal bottom;
- getContentsMargins(&left, &top, &right, &bottom);
- return minimum.adjusted(0, 0, left + right, top + bottom);
-}
-
-QRectF AbstractChartLayout::calculateLegendGeometry(const QRectF &geometry, QLegend *legend) const
-{
- QSizeF size = legend->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1));
- QRectF legendRect;
- QRectF result;
-
- switch (legend->alignment()) {
- case Qt::AlignTop: {
- legendRect = QRectF(geometry.topLeft(), QSizeF(geometry.width(), size.height()));
- result = geometry.adjusted(0, legendRect.height(), 0, 0);
- break;
- }
- case Qt::AlignBottom: {
- legendRect = QRectF(QPointF(geometry.left(), geometry.bottom() - size.height()), QSizeF(geometry.width(), size.height()));
- result = geometry.adjusted(0, 0, 0, -legendRect.height());
- break;
- }
- case Qt::AlignLeft: {
- qreal width = qMin(size.width(), geometry.width() * golden_ratio);
- legendRect = QRectF(geometry.topLeft(), QSizeF(width, geometry.height()));
- result = geometry.adjusted(width, 0, 0, 0);
- break;
- }
- case Qt::AlignRight: {
- qreal width = qMin(size.width(), geometry.width() * golden_ratio);
- legendRect = QRectF(QPointF(geometry.right() - width, geometry.top()), QSizeF(width, geometry.height()));
- result = geometry.adjusted(0, 0, -width, 0);
- break;
- }
- default: {
- legendRect = QRectF(0, 0, 0, 0);
- result = geometry;
- break;
- }
- }
-
- legend->setGeometry(legendRect);
-
- return result;
-}
-
-QRectF AbstractChartLayout::calculateLegendMinimum(const QRectF &geometry, QLegend *legend) const
-{
- QSizeF minSize = legend->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, -1));
- return geometry.adjusted(0, 0, minSize.width(), minSize.height());
-}
-
-QRectF AbstractChartLayout::calculateTitleGeometry(const QRectF &geometry, ChartTitle *title) const
-{
- title->setGeometry(geometry);
- QPointF center = geometry.center() - title->boundingRect().center();
- title->setPos(center.x(), title->pos().y());
- return geometry.adjusted(0, title->boundingRect().height()+1, 0, 0);
-}
-
-QRectF AbstractChartLayout::calculateTitleMinimum(const QRectF &minimum, ChartTitle *title) const
-{
- QSizeF min = title->sizeHint(Qt::MinimumSize);
- return minimum.adjusted(0, 0, min.width(), min.height());
-}
-
-QSizeF AbstractChartLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint);
- if (which == Qt::MinimumSize) {
- QList<ChartAxisElement *> axes = m_presenter->axisItems();
- ChartTitle *title = m_presenter->titleElement();
- QLegend *legend = m_presenter->legend();
- QRectF minimumRect(0, 0, 0, 0);
- minimumRect = calculateBackgroundMinimum(minimumRect);
- minimumRect = calculateContentMinimum(minimumRect);
- minimumRect = calculateTitleMinimum(minimumRect, title);
- minimumRect = calculateLegendMinimum(minimumRect, legend);
- minimumRect = calculateAxisMinimum(minimumRect, axes);
- return minimumRect.united(m_minChartRect).size().toSize();
- }
- return QSize(-1, -1);
-}
-
-void AbstractChartLayout::setMargins(const QMargins &margins)
-{
- if (m_margins != margins) {
- m_margins = margins;
- updateGeometry();
- }
-}
-
-QMargins AbstractChartLayout::margins() const
-{
- return m_margins;
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/layout/abstractchartlayout_p.h b/src/layout/abstractchartlayout_p.h
deleted file mode 100644
index ee323193..00000000
--- a/src/layout/abstractchartlayout_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef ABSTRACTCHARTLAYOUT_H
-#define ABSTRACTCHARTLAYOUT_H
-
-#include <QGraphicsLayout>
-#include <QMargins>
-#include "qchartglobal.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartTitle;
-class ChartAxisElement;
-class ChartPresenter;
-class QLegend;
-class ChartBackground;
-
-class AbstractChartLayout : public QGraphicsLayout
-{
-public:
- AbstractChartLayout(ChartPresenter *presenter);
- virtual ~AbstractChartLayout();
-
- virtual void setMargins(const QMargins &margins);
- virtual QMargins margins() const;
- virtual void setGeometry(const QRectF &rect);
-
-protected:
- virtual QRectF calculateBackgroundGeometry(const QRectF &geometry, ChartBackground *background) const;
- virtual QRectF calculateBackgroundMinimum(const QRectF &minimum) const;
- virtual QRectF calculateContentGeometry(const QRectF &geometry) const;
- virtual QRectF calculateContentMinimum(const QRectF &minimum) const;
- virtual QRectF calculateTitleGeometry(const QRectF &geometry, ChartTitle *title) const;
- virtual QRectF calculateTitleMinimum(const QRectF &minimum, ChartTitle *title) const;
- virtual QRectF calculateLegendGeometry(const QRectF &geometry, QLegend *legend) const;
- virtual QRectF calculateLegendMinimum(const QRectF &minimum, QLegend *legend) const;
-
- virtual QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *>& axes) const = 0;
- virtual QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *>& axes) const = 0;
-
- // from QGraphicsLayout
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
- int count() const { return 0; }
- QGraphicsLayoutItem *itemAt(int) const { return 0; };
- void removeAt(int) {};
-
- ChartPresenter *m_presenter;
- QMargins m_margins;
- QRectF m_minChartRect;
- QRectF m_minAxisRect;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // ABSTRACTCHARTLAYOUT_H
diff --git a/src/layout/cartesianchartlayout.cpp b/src/layout/cartesianchartlayout.cpp
deleted file mode 100644
index 118e8485..00000000
--- a/src/layout/cartesianchartlayout.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cartesianchartlayout_p.h"
-#include "chartpresenter_p.h"
-#include "chartaxiselement_p.h"
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-static const qreal maxAxisPortion = 0.4;
-
-CartesianChartLayout::CartesianChartLayout(ChartPresenter *presenter)
- : AbstractChartLayout(presenter)
-{
-}
-
-CartesianChartLayout::~CartesianChartLayout()
-{
-}
-
-QRectF CartesianChartLayout::calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const
-{
- QSizeF left(0,0);
- QSizeF minLeft(0,0);
- QSizeF right(0,0);
- QSizeF minRight(0,0);
- QSizeF bottom(0,0);
- QSizeF minBottom(0,0);
- QSizeF top(0,0);
- QSizeF minTop(0,0);
- QSizeF labelExtents(0,0);
- int leftCount = 0;
- int rightCount = 0;
- int topCount = 0;
- int bottomCount = 0;
-
- foreach (ChartAxisElement *axis , axes) {
-
- if (!axis->isVisible())
- continue;
-
-
- QSizeF size = axis->effectiveSizeHint(Qt::PreferredSize);
- //this is used to get single thick font size
- QSizeF minSize = axis->effectiveSizeHint(Qt::MinimumSize);
-
- switch (axis->axis()->alignment()) {
- case Qt::AlignLeft:
- left.setWidth(left.width()+size.width());
- left.setHeight(qMax(left.height(),size.height()));
- minLeft.setWidth(minLeft.width()+minSize.width());
- minLeft.setHeight(qMax(minLeft.height(),minSize.height()));
- labelExtents.setHeight(qMax(size.height(), labelExtents.height()));
- leftCount++;
- break;
- case Qt::AlignRight:
- right.setWidth(right.width()+size.width());
- right.setHeight(qMax(right.height(),size.height()));
- minRight.setWidth(minRight.width()+minSize.width());
- minRight.setHeight(qMax(minRight.height(),minSize.height()));
- labelExtents.setHeight(qMax(size.height(), labelExtents.height()));
- rightCount++;
- break;
- case Qt::AlignTop:
- top.setWidth(qMax(top.width(),size.width()));
- top.setHeight(top.height()+size.height());
- minTop.setWidth(qMax(minTop.width(),minSize.width()));
- minTop.setHeight(minTop.height()+minSize.height());
- labelExtents.setWidth(qMax(size.width(), labelExtents.width()));
- topCount++;
- break;
- case Qt::AlignBottom:
- bottom.setWidth(qMax(bottom.width(), size.width()));
- bottom.setHeight(bottom.height() + size.height());
- minBottom.setWidth(qMax(minBottom.width(),minSize.width()));
- minBottom.setHeight(minBottom.height() + minSize.height());
- labelExtents.setWidth(qMax(size.width(), labelExtents.width()));
- bottomCount++;
- break;
- default:
- qWarning()<<"Axis is without alignment !";
- break;
- }
- }
-
- qreal totalVerticalAxes = leftCount + rightCount;
- qreal leftSqueezeRatio = 1.0;
- qreal rightSqueezeRatio = 1.0;
- qreal vratio = 0;
-
- if (totalVerticalAxes > 0)
- vratio = (maxAxisPortion * geometry.width()) / totalVerticalAxes;
-
- if (leftCount > 0) {
- int maxWidth = vratio * leftCount;
- if (left.width() > maxWidth) {
- leftSqueezeRatio = maxWidth / left.width();
- left.setWidth(maxWidth);
- }
- }
- if (rightCount > 0) {
- int maxWidth = vratio * rightCount;
- if (right.width() > maxWidth) {
- rightSqueezeRatio = maxWidth / right.width();
- right.setWidth(maxWidth);
- }
- }
-
- qreal totalHorizontalAxes = topCount + bottomCount;
- qreal topSqueezeRatio = 1.0;
- qreal bottomSqueezeRatio = 1.0;
- qreal hratio = 0;
-
- if (totalHorizontalAxes > 0)
- hratio = (maxAxisPortion * geometry.height()) / totalHorizontalAxes;
-
- if (topCount > 0) {
- int maxHeight = hratio * topCount;
- if (top.height() > maxHeight) {
- topSqueezeRatio = maxHeight / top.height();
- top.setHeight(maxHeight);
- }
- }
- if (bottomCount > 0) {
- int maxHeight = hratio * bottomCount;
- if (bottom.height() > maxHeight) {
- bottomSqueezeRatio = maxHeight / bottom.height();
- bottom.setHeight(maxHeight);
- }
- }
-
- qreal minHeight = qMax(minLeft.height(),minRight.height()) + 1;
- qreal minWidth = qMax(minTop.width(),minBottom.width()) + 1;
-
- // Ensure that there is enough space for first and last tick labels.
- left.setWidth(qMax(labelExtents.width(), left.width()));
- right.setWidth(qMax(labelExtents.width(), right.width()));
- top.setHeight(qMax(labelExtents.height(), top.height()));
- bottom.setHeight(qMax(labelExtents.height(), bottom.height()));
-
- QRectF chartRect = geometry.adjusted(qMax(left.width(),minWidth/2), qMax(top.height(), minHeight/2),-qMax(right.width(),minWidth/2),-qMax(bottom.height(),minHeight/2));
-
- qreal leftOffset = 0;
- qreal rightOffset = 0;
- qreal topOffset = 0;
- qreal bottomOffset = 0;
-
- foreach (ChartAxisElement *axis , axes) {
-
- if (!axis->isVisible())
- continue;
-
- QSizeF size = axis->effectiveSizeHint(Qt::PreferredSize);
-
- switch (axis->axis()->alignment()){
- case Qt::AlignLeft:{
- qreal width = size.width();
- if (leftSqueezeRatio < 1.0)
- width *= leftSqueezeRatio;
- leftOffset+=width;
- axis->setGeometry(QRect(chartRect.left()-leftOffset, geometry.top(),width, geometry.bottom()),chartRect);
- break;
- }
- case Qt::AlignRight:{
- qreal width = size.width();
- if (rightSqueezeRatio < 1.0)
- width *= rightSqueezeRatio;
- axis->setGeometry(QRect(chartRect.right()+rightOffset,geometry.top(),width,geometry.bottom()),chartRect);
- rightOffset+=width;
- break;
- }
- case Qt::AlignTop: {
- qreal height = size.height();
- if (topSqueezeRatio < 1.0)
- height *= topSqueezeRatio;
- axis->setGeometry(QRect(geometry.left(), chartRect.top() - topOffset - height, geometry.width(), height), chartRect);
- topOffset += height;
- break;
- }
- case Qt::AlignBottom:
- qreal height = size.height();
- if (bottomSqueezeRatio < 1.0)
- height *= bottomSqueezeRatio;
- axis->setGeometry(QRect(geometry.left(), chartRect.bottom() + bottomOffset, geometry.width(), height), chartRect);
- bottomOffset += height;
- break;
- }
- }
-
- return chartRect;
-}
-
-QRectF CartesianChartLayout::calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const
-{
- QSizeF left;
- QSizeF right;
- QSizeF bottom;
- QSizeF top;
-
- foreach (ChartAxisElement *axis, axes) {
- QSizeF size = axis->effectiveSizeHint(Qt::MinimumSize);
-
- if (!axis->isVisible())
- continue;
-
- switch (axis->axis()->alignment()) {
- case Qt::AlignLeft:
- left.setWidth(left.width() + size.width());
- left.setHeight(qMax(left.height() * 2, size.height()));
- break;
- case Qt::AlignRight:
- right.setWidth(right.width() + size.width());
- right.setHeight(qMax(right.height() * 2, size.height()));
- break;
- case Qt::AlignTop:
- top.setWidth(qMax(top.width(), size.width()));
- top.setHeight(top.height() + size.height());
- break;
- case Qt::AlignBottom:
- bottom.setWidth(qMax(bottom.width(), size.width()));
- bottom.setHeight(bottom.height() + size.height());
- break;
- }
- }
- return minimum.adjusted(0, 0, left.width() + right.width() + qMax(top.width(), bottom.width()), top.height() + bottom.height() + qMax(left.height(), right.height()));
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/layout/cartesianchartlayout_p.h b/src/layout/cartesianchartlayout_p.h
deleted file mode 100644
index d0c58de3..00000000
--- a/src/layout/cartesianchartlayout_p.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CARTESIANCHARTLAYOUT_H
-#define CARTESIANCHARTLAYOUT_H
-
-#include "abstractchartlayout_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class CartesianChartLayout : public AbstractChartLayout
-{
-public:
- CartesianChartLayout(ChartPresenter *presenter);
- virtual ~CartesianChartLayout();
-
- // from AbstractChartLayout
- QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const;
- QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // CARTESIANCHARTLAYOUT_H
diff --git a/src/layout/polarchartlayout.cpp b/src/layout/polarchartlayout.cpp
deleted file mode 100644
index 2bcc60db..00000000
--- a/src/layout/polarchartlayout.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartlayout_p.h"
-#include "chartpresenter_p.h"
-#include "polarchartaxis_p.h"
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-static const qreal golden_ratio = 0.4;
-
-PolarChartLayout::PolarChartLayout(ChartPresenter *presenter)
- : AbstractChartLayout(presenter)
-{
-}
-
-PolarChartLayout::~PolarChartLayout()
-{
-}
-
-QRectF PolarChartLayout::calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const
-{
- // How to handle multiple angular/radial axes?
- qreal axisRadius = geometry.height() / 2.0;
- if (geometry.width() < geometry.height())
- axisRadius = geometry.width() / 2.0;
-
- int titleHeight = 0;
- foreach (ChartAxisElement *chartAxis, axes) {
- if (!chartAxis->isVisible())
- continue;
-
- PolarChartAxis *polarChartAxis = static_cast<PolarChartAxis *>(chartAxis);
- qreal radius = polarChartAxis->preferredAxisRadius(geometry.size());
- if (radius < axisRadius)
- axisRadius = radius;
-
- if (chartAxis->axis()->orientation() == Qt::Horizontal
- && chartAxis->axis()->isTitleVisible()
- && !chartAxis->axis()->titleText().isEmpty()) {
- // If axis has angular title, adjust geometry down by the space title takes
- QRectF dummyRect = ChartPresenter::textBoundingRect(chartAxis->axis()->titleFont(), chartAxis->axis()->titleText());
- titleHeight = (dummyRect.height() / 2.0) + chartAxis->titlePadding();
- }
- }
-
- QRectF axisRect;
- axisRect.setSize(QSizeF(axisRadius * 2.0, axisRadius * 2.0));
- axisRect.moveCenter(geometry.center());
- axisRect.adjust(0, titleHeight, 0, titleHeight);
-
- foreach (ChartAxisElement *chartAxis, axes)
- chartAxis->setGeometry(axisRect, QRectF());
-
- return axisRect;
-}
-
-QRectF PolarChartLayout::calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const
-{
- Q_UNUSED(axes);
- return minimum;
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/layout/polarchartlayout_p.h b/src/layout/polarchartlayout_p.h
deleted file mode 100644
index 3c9361fb..00000000
--- a/src/layout/polarchartlayout_p.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTLAYOUT_H
-#define POLARCHARTLAYOUT_H
-
-#include "abstractchartlayout_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class PolarChartLayout : public AbstractChartLayout
-{
-public:
- PolarChartLayout(ChartPresenter *presenter);
- virtual ~PolarChartLayout();
-
- // from AbstractChartLayout
- QRectF calculateAxisMinimum(const QRectF &minimum, const QList<ChartAxisElement *> &axes) const;
- QRectF calculateAxisGeometry(const QRectF &geometry, const QList<ChartAxisElement *> &axes) const;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTLAYOUT_H
diff --git a/src/legend/legendlayout.cpp b/src/legend/legendlayout.cpp
deleted file mode 100644
index f6feed1a..00000000
--- a/src/legend/legendlayout.cpp
+++ /dev/null
@@ -1,506 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "legendlayout_p.h"
-#include "chartpresenter_p.h"
-#include "qlegend_p.h"
-#include "abstractchartlayout_p.h"
-
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include "qlegendmarker.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-LegendLayout::LegendLayout(QLegend *legend)
- : m_legend(legend),
- m_offsetX(0),
- m_offsetY(0)
-{
-
-}
-
-LegendLayout::~LegendLayout()
-{
-
-}
-
-void LegendLayout::setOffset(qreal x, qreal y)
-{
- bool scrollHorizontal = true;
- switch (m_legend->alignment()) {
- case Qt::AlignTop:
- case Qt::AlignBottom:
- scrollHorizontal = true;
- break;
- case Qt::AlignLeft:
- case Qt::AlignRight:
- scrollHorizontal = false;
- break;
- }
-
- // If detached, the scrolling direction is vertical instead of horizontal and vice versa.
- if (!m_legend->isAttachedToChart())
- scrollHorizontal = !scrollHorizontal;
-
- QRectF boundingRect = geometry();
- qreal left, top, right, bottom;
- getContentsMargins(&left, &top, &right, &bottom);
- boundingRect.adjust(left, top, -right, -bottom);
-
- // Limit offset between m_minOffset and m_maxOffset
- if (scrollHorizontal) {
- if (m_width <= boundingRect.width())
- return;
-
- if (x != m_offsetX) {
- m_offsetX = qBound(m_minOffsetX, x, m_maxOffsetX);
- m_legend->d_ptr->items()->setPos(-m_offsetX, boundingRect.top());
- }
- } else {
- if (m_height <= boundingRect.height())
- return;
-
- if (y != m_offsetY) {
- m_offsetY = qBound(m_minOffsetY, y, m_maxOffsetY);
- m_legend->d_ptr->items()->setPos(boundingRect.left(), -m_offsetY);
- }
- }
-}
-
-QPointF LegendLayout::offset() const
-{
- return QPointF(m_offsetX, m_offsetY);
-}
-
-void LegendLayout::invalidate()
-{
- QGraphicsLayout::invalidate();
- if (m_legend->isAttachedToChart())
- m_legend->d_ptr->m_presenter->layout()->invalidate();
-}
-
-void LegendLayout::setGeometry(const QRectF &rect)
-{
- m_legend->d_ptr->items()->setVisible(m_legend->isVisible());
-
- QGraphicsLayout::setGeometry(rect);
-
- if (m_legend->isAttachedToChart())
- setAttachedGeometry(rect);
- else
- setDettachedGeometry(rect);
-}
-
-void LegendLayout::setAttachedGeometry(const QRectF &rect)
-{
- if (!rect.isValid())
- return;
-
- qreal oldOffsetX = m_offsetX;
- qreal oldOffsetY = m_offsetY;
- m_offsetX = 0;
- m_offsetY = 0;
-
- QSizeF size(0, 0);
-
- if (m_legend->d_ptr->markers().isEmpty()) {
- return;
- }
-
- m_width = 0;
- m_height = 0;
-
- qreal left, top, right, bottom;
- getContentsMargins(&left, &top, &right, &bottom);
-
- QRectF geometry = rect.adjusted(left, top, -right, -bottom);
-
- switch(m_legend->alignment()) {
- case Qt::AlignTop:
- case Qt::AlignBottom: {
- // Calculate the space required for items and add them to a sorted list.
- qreal markerItemsWidth = 0;
- qreal itemMargins = 0;
- QList<LegendWidthStruct *> legendWidthList;
- foreach (QLegendMarker *marker, m_legend->d_ptr->markers()) {
- LegendMarkerItem *item = marker->d_ptr->item();
- if (item->isVisible()) {
- QSizeF dummySize;
- qreal itemWidth = item->sizeHint(Qt::PreferredSize, dummySize).width();
- LegendWidthStruct *structItem = new LegendWidthStruct;
- structItem->item = item;
- structItem->width = itemWidth;
- legendWidthList.append(structItem);
- markerItemsWidth += itemWidth;
- itemMargins += marker->d_ptr->item()->m_margin;
- }
- }
- qSort(legendWidthList.begin(), legendWidthList.end(), widthLongerThan);
-
- // If the items would occupy more space than is available, start truncating them
- // from the longest one.
- qreal availableGeometry = geometry.width() - right - left * 2 - itemMargins;
- if (markerItemsWidth >= availableGeometry && legendWidthList.count() > 0) {
- bool truncated(false);
- int count = legendWidthList.count();
- for (int i = 1; i < count; i++) {
- int truncateIndex = i - 1;
-
- while (legendWidthList.at(truncateIndex)->width >= legendWidthList.at(i)->width
- && !truncated) {
- legendWidthList.at(truncateIndex)->width--;
- markerItemsWidth--;
- if (i > 1) {
- // Truncate the items that are before the truncated one in the list.
- for (int j = truncateIndex - 1; j >= 0; j--) {
- if (legendWidthList.at(truncateIndex)->width
- < legendWidthList.at(j)->width) {
- legendWidthList.at(j)->width--;
- markerItemsWidth--;
- }
- }
- }
- if (markerItemsWidth < availableGeometry)
- truncated = true;
- }
- // Truncate the last item if needed.
- if (i == count - 1) {
- if (legendWidthList.at(count - 1)->width
- > legendWidthList.at(truncateIndex)->width) {
- legendWidthList.at(count - 1)->width--;
- markerItemsWidth--;
- }
- }
-
- if (truncated)
- break;
- }
- // Items are of same width and all of them need to be truncated
- // or there is just one item that is truncated.
- while (markerItemsWidth >= availableGeometry) {
- for (int i = 0; i < count; i++) {
- legendWidthList.at(i)->width--;
- markerItemsWidth--;
- }
- }
- }
-
- QPointF point(0,0);
-
- int markerCount = m_legend->d_ptr->markers().count();
- for (int i = 0; i < markerCount; i++) {
- QLegendMarker *marker;
- if (m_legend->d_ptr->m_reverseMarkers)
- marker = m_legend->d_ptr->markers().at(markerCount - 1 - i);
- else
- marker = m_legend->d_ptr->markers().at(i);
- LegendMarkerItem *item = marker->d_ptr->item();
- if (item->isVisible()) {
- QRectF itemRect = geometry;
- qreal availableWidth = 0;
- for (int i = 0; i < legendWidthList.size(); ++i) {
- if (legendWidthList.at(i)->item == item) {
- availableWidth = legendWidthList.at(i)->width;
- break;
- }
- }
- itemRect.setWidth(availableWidth);
- item->setGeometry(itemRect);
- item->setPos(point.x(),geometry.height()/2 - item->boundingRect().height()/2);
- const QRectF &rect = item->boundingRect();
- size = size.expandedTo(rect.size());
- qreal w = rect.width();
- m_width = m_width + w - item->m_margin;
- point.setX(point.x() + w);
- }
- }
- // Delete structs from the container
- qDeleteAll(legendWidthList);
-
- if (m_width < geometry.width())
- m_legend->d_ptr->items()->setPos(geometry.width() / 2 - m_width / 2, geometry.top());
- else
- m_legend->d_ptr->items()->setPos(geometry.topLeft());
- m_height = size.height();
- }
- break;
- case Qt::AlignLeft:
- case Qt::AlignRight: {
- QPointF point(0,0);
- int markerCount = m_legend->d_ptr->markers().count();
- for (int i = 0; i < markerCount; i++) {
- QLegendMarker *marker;
- if (m_legend->d_ptr->m_reverseMarkers)
- marker = m_legend->d_ptr->markers().at(markerCount - 1 - i);
- else
- marker = m_legend->d_ptr->markers().at(i);
- LegendMarkerItem *item = marker->d_ptr->item();
- if (item->isVisible()) {
- item->setGeometry(geometry);
- item->setPos(point);
- const QRectF &rect = item->boundingRect();
- qreal h = rect.height();
- size = size.expandedTo(rect.size());
- m_height+=h;
- point.setY(point.y() + h);
- }
- }
-
- if (m_height < geometry.height())
- m_legend->d_ptr->items()->setPos(geometry.left(), geometry.height() / 2 - m_height / 2);
- else
- m_legend->d_ptr->items()->setPos(geometry.topLeft());
- m_width = size.width();
- break;
- }
- }
-
- m_minOffsetX = -left;
- m_minOffsetY = - top;
- m_maxOffsetX = m_width - geometry.width() - right;
- m_maxOffsetY = m_height - geometry.height() - bottom;
-
- setOffset(oldOffsetX, oldOffsetY);
-}
-
-void LegendLayout::setDettachedGeometry(const QRectF &rect)
-{
- if (!rect.isValid())
- return;
-
- // Detached layout is different.
- // In detached mode legend may have multiple rows and columns, so layout calculations
- // differ a log from attached mode.
- // Also the scrolling logic is bit different.
-
- qreal oldOffsetX = m_offsetX;
- qreal oldOffsetY = m_offsetY;
- m_offsetX = 0;
- m_offsetY = 0;
-
- qreal left, top, right, bottom;
- getContentsMargins(&left, &top, &right, &bottom);
- QRectF geometry = rect.adjusted(left, top, -right, -bottom);
-
- QSizeF size(0, 0);
-
- QList<QLegendMarker *> markers = m_legend->d_ptr->markers();
-
- if (markers.isEmpty())
- return;
-
- switch (m_legend->alignment()) {
- case Qt::AlignTop: {
- QPointF point(0, 0);
- m_width = 0;
- m_height = 0;
- for (int i = 0; i < markers.count(); i++) {
- LegendMarkerItem *item = markers.at(i)->d_ptr->item();
- if (item->isVisible()) {
- item->setGeometry(geometry);
- item->setPos(point.x(),point.y());
- const QRectF &boundingRect = item->boundingRect();
- qreal w = boundingRect.width();
- qreal h = boundingRect.height();
- m_width = qMax(m_width,w);
- m_height = qMax(m_height,h);
- point.setX(point.x() + w);
- if (point.x() + w > geometry.left() + geometry.width() - right) {
- // Next item would go off rect.
- point.setX(0);
- point.setY(point.y() + h);
- if (i+1 < markers.count()) {
- m_height += h;
- }
- }
- }
- }
- m_legend->d_ptr->items()->setPos(geometry.topLeft());
-
- m_minOffsetX = -left;
- m_minOffsetY = -top;
- m_maxOffsetX = m_width - geometry.width() - right;
- m_maxOffsetY = m_height - geometry.height() - bottom;
- }
- break;
- case Qt::AlignBottom: {
- QPointF point(0, geometry.height());
- m_width = 0;
- m_height = 0;
- for (int i = 0; i < markers.count(); i++) {
- LegendMarkerItem *item = markers.at(i)->d_ptr->item();
- if (item->isVisible()) {
- item->setGeometry(geometry);
- const QRectF &boundingRect = item->boundingRect();
- qreal w = boundingRect.width();
- qreal h = boundingRect.height();
- m_width = qMax(m_width,w);
- m_height = qMax(m_height,h);
- item->setPos(point.x(),point.y() - h);
- point.setX(point.x() + w);
- if (point.x() + w > geometry.left() + geometry.width() - right) {
- // Next item would go off rect.
- point.setX(0);
- point.setY(point.y() - h);
- if (i+1 < markers.count()) {
- m_height += h;
- }
- }
- }
- }
- m_legend->d_ptr->items()->setPos(geometry.topLeft());
-
- m_minOffsetX = -left;
- m_minOffsetY = -m_height + geometry.height() - top;
- m_maxOffsetX = m_width - geometry.width() - right;
- m_maxOffsetY = -bottom;
- }
- break;
- case Qt::AlignLeft: {
- QPointF point(0, 0);
- m_width = 0;
- m_height = 0;
- qreal maxWidth = 0;
- for (int i = 0; i < markers.count(); i++) {
- LegendMarkerItem *item = markers.at(i)->d_ptr->item();
- if (item->isVisible()) {
- item->setGeometry(geometry);
- const QRectF &boundingRect = item->boundingRect();
- qreal w = boundingRect.width();
- qreal h = boundingRect.height();
- m_height = qMax(m_height,h);
- maxWidth = qMax(maxWidth,w);
- item->setPos(point.x(),point.y());
- point.setY(point.y() + h);
- if (point.y() + h > geometry.bottom() - bottom) {
- // Next item would go off rect.
- point.setX(point.x() + maxWidth);
- point.setY(0);
- if (i+1 < markers.count()) {
- m_width += maxWidth;
- maxWidth = 0;
- }
- }
- }
- }
- m_width += maxWidth;
- m_legend->d_ptr->items()->setPos(geometry.topLeft());
-
- m_minOffsetX = -left;
- m_minOffsetY = -top;
- m_maxOffsetX = m_width - geometry.width() - right;
- m_maxOffsetY = m_height - geometry.height() - bottom;
- }
- break;
- case Qt::AlignRight: {
- QPointF point(geometry.width(), 0);
- m_width = 0;
- m_height = 0;
- qreal maxWidth = 0;
- for (int i = 0; i < markers.count(); i++) {
- LegendMarkerItem *item = markers.at(i)->d_ptr->item();
- if (item->isVisible()) {
- item->setGeometry(geometry);
- const QRectF &boundingRect = item->boundingRect();
- qreal w = boundingRect.width();
- qreal h = boundingRect.height();
- m_height = qMax(m_height,h);
- maxWidth = qMax(maxWidth,w);
- item->setPos(point.x() - w,point.y());
- point.setY(point.y() + h);
- if (point.y() + h > geometry.bottom()-bottom) {
- // Next item would go off rect.
- point.setX(point.x() - maxWidth);
- point.setY(0);
- if (i+1 < markers.count()) {
- m_width += maxWidth;
- maxWidth = 0;
- }
- }
- }
- }
- m_width += maxWidth;
- m_legend->d_ptr->items()->setPos(geometry.topLeft());
-
- m_minOffsetX = - m_width + geometry.width() - left;
- m_minOffsetY = -top;
- m_maxOffsetX = - right;
- m_maxOffsetY = m_height - geometry.height() - bottom;
- }
- break;
- default:
- break;
- }
-
- setOffset(oldOffsetX, oldOffsetY);
-}
-
-QSizeF LegendLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- QSizeF size(0, 0);
- qreal left, top, right, bottom;
- getContentsMargins(&left, &top, &right, &bottom);
-
- if(constraint.isValid()) {
- foreach(QLegendMarker *marker, m_legend->d_ptr->markers()) {
- LegendMarkerItem *item = marker->d_ptr->item();
- size = size.expandedTo(item->effectiveSizeHint(which));
- }
- size = size.boundedTo(constraint);
- }
- else if (constraint.width() >= 0) {
- qreal width = 0;
- qreal height = 0;
- foreach(QLegendMarker *marker, m_legend->d_ptr->markers()) {
- LegendMarkerItem *item = marker->d_ptr->item();
- width+=item->effectiveSizeHint(which).width();
- height=qMax(height,item->effectiveSizeHint(which).height());
- }
-
- size = QSizeF(qMin(constraint.width(),width), height);
- }
- else if (constraint.height() >= 0) {
- qreal width = 0;
- qreal height = 0;
- foreach(QLegendMarker *marker, m_legend->d_ptr->markers()) {
- LegendMarkerItem *item = marker->d_ptr->item();
- width=qMax(width,item->effectiveSizeHint(which).width());
- height+=height,item->effectiveSizeHint(which).height();
- }
- size = QSizeF(width,qMin(constraint.height(),height));
- }
- else {
- foreach(QLegendMarker *marker, m_legend->d_ptr->markers()) {
- LegendMarkerItem *item = marker->d_ptr->item();
- size = size.expandedTo(item->effectiveSizeHint(which));
- }
- }
- size += QSize(left + right, top + bottom);
- return size;
-}
-
-bool LegendLayout::widthLongerThan(const LegendWidthStruct *item1,
- const LegendWidthStruct *item2)
-{
- return item1->width > item2->width;
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/legend/legendlayout_p.h b/src/legend/legendlayout_p.h
deleted file mode 100644
index 94919b43..00000000
--- a/src/legend/legendlayout_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef LEGENDLAYOUT_H
-#define LEGENDLAYOUT_H
-#include <QGraphicsLayout>
-#include "qchartglobal.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLegend;
-class LegendMarkerItem;
-
-class LegendLayout : public QGraphicsLayout
-{
-public:
-
- LegendLayout(QLegend *legend);
- virtual ~LegendLayout();
-
- void setGeometry(const QRectF &rect);
-
- void setOffset(qreal x, qreal y);
- QPointF offset() const;
-
- void invalidate();
-protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
- int count() const { return 0; }
- QGraphicsLayoutItem *itemAt(int) const { return 0; };
- void removeAt(int) {};
-
-private:
- void setAttachedGeometry(const QRectF &rect);
- void setDettachedGeometry(const QRectF &rect);
-
- struct LegendWidthStruct {
- LegendMarkerItem *item;
- qreal width;
- };
- static bool widthLongerThan(const LegendWidthStruct *item1,
- const LegendWidthStruct *item2);
-
-private:
- QLegend *m_legend;
- qreal m_offsetX;
- qreal m_offsetY;
- qreal m_minOffsetX;
- qreal m_minOffsetY;
- qreal m_maxOffsetX;
- qreal m_maxOffsetY;
- qreal m_width;
- qreal m_height;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/legend/legendmarkeritem.cpp b/src/legend/legendmarkeritem.cpp
deleted file mode 100644
index 6fa53417..00000000
--- a/src/legend/legendmarkeritem.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include <QPainter>
-#include <QGraphicsSceneEvent>
-#include <QGraphicsTextItem>
-#include <QTextDocument>
-
-#include "qlegend.h"
-#include "qlegend_p.h"
-#include "qlegendmarker.h"
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include "chartpresenter_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-LegendMarkerItem::LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject *parent) :
- QGraphicsObject(parent),
- m_marker(marker),
- m_markerRect(0,0,10.0,10.0),
- m_boundingRect(0,0,0,0),
- m_textItem(new QGraphicsTextItem(this)),
- m_rectItem(new QGraphicsRectItem(this)),
- m_margin(3),
- m_space(4),
- m_hovering(false),
- m_pressPos(0, 0)
-{
- m_rectItem->setRect(m_markerRect);
- m_textItem->document()->setDocumentMargin(ChartPresenter::textMargin());
- setAcceptHoverEvents(true);
-}
-
-LegendMarkerItem::~LegendMarkerItem()
-{
- if (m_hovering) {
- emit m_marker->q_ptr->hovered(false);
- }
-}
-
-void LegendMarkerItem::setPen(const QPen &pen)
-{
- m_rectItem->setPen(pen);
-}
-
-QPen LegendMarkerItem::pen() const
-{
- return m_rectItem->pen();
-}
-
-void LegendMarkerItem::setBrush(const QBrush &brush)
-{
- m_rectItem->setBrush(brush);
-}
-
-QBrush LegendMarkerItem::brush() const
-{
- return m_rectItem->brush();
-}
-
-void LegendMarkerItem::setFont(const QFont &font)
-{
- m_textItem->setFont(font);
- QFontMetrics fn(font);
- m_markerRect = QRectF(0,0,fn.height()/2,fn.height()/2);
- updateGeometry();
-}
-
-QFont LegendMarkerItem::font() const
-{
- return m_textItem->font();
-}
-
-void LegendMarkerItem::setLabel(const QString label)
-{
- m_label = label;
- updateGeometry();
-}
-
-QString LegendMarkerItem::label() const
-{
- return m_label;
-}
-
-void LegendMarkerItem::setLabelBrush(const QBrush &brush)
-{
- m_textItem->setDefaultTextColor(brush.color());
-}
-
-QBrush LegendMarkerItem::labelBrush() const
-{
- return QBrush(m_textItem->defaultTextColor());
-}
-
-void LegendMarkerItem::setGeometry(const QRectF &rect)
-{
- qreal width = rect.width();
- qreal x = m_margin + m_markerRect.width() + m_space + m_margin;
- QRectF truncatedRect;
-
- m_textItem->setHtml(ChartPresenter::truncatedText(m_textItem->font(), m_label, qreal(0.0),
- width - x, rect.height(), truncatedRect));
- m_textItem->setTextWidth(truncatedRect.width());
-
- qreal y = qMax(m_markerRect.height() + 2 * m_margin, truncatedRect.height() + 2 * m_margin);
-
- const QRectF &textRect = m_textItem->boundingRect();
-
- m_textItem->setPos(x - m_margin, y / 2 - textRect.height() / 2);
- m_rectItem->setRect(m_markerRect);
- // The textMargin adjustments to position are done to make default case rects less blurry with anti-aliasing
- m_rectItem->setPos(m_margin - ChartPresenter::textMargin(), y / 2.0 - m_markerRect.height() / 2.0 + ChartPresenter::textMargin());
-
- prepareGeometryChange();
- m_boundingRect = QRectF(0, 0, x + textRect.width() + m_margin, y);
-}
-
-QRectF LegendMarkerItem::boundingRect() const
-{
- return m_boundingRect;
-}
-
-void LegendMarkerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option)
- Q_UNUSED(widget)
- Q_UNUSED(painter)
-}
-
-QSizeF LegendMarkerItem::sizeHint(Qt::SizeHint which, const QSizeF& constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF labelRect = ChartPresenter::textBoundingRect(m_textItem->font(), "...");
- sh = QSizeF(labelRect.width() + (2.0 * m_margin) + m_space + m_markerRect.width(),
- qMax(m_markerRect.height(), labelRect.height()) + (2.0 * m_margin));
- break;
- }
- case Qt::PreferredSize: {
- QRectF labelRect = ChartPresenter::textBoundingRect(m_textItem->font(), m_label);
- sh = QSizeF(labelRect.width() + (2.0 * m_margin) + m_space + m_markerRect.width(),
- qMax(m_markerRect.height(), labelRect.height()) + (2.0 * m_margin));
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-void LegendMarkerItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
-{
- Q_UNUSED(event)
- m_hovering = true;
- emit m_marker->q_ptr->hovered(true);
-}
-
-void LegendMarkerItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
-{
- Q_UNUSED(event)
- m_hovering = false;
- emit m_marker->q_ptr->hovered(false);
-}
-
-
-#include "moc_legendmarkeritem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/legend/legendmarkeritem_p.h b/src/legend/legendmarkeritem_p.h
deleted file mode 100644
index 690271a5..00000000
--- a/src/legend/legendmarkeritem_p.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef LEGENDMARKERITEM_P_H
-#define LEGENDMARKERITEM_P_H
-
-#include "qchartglobal.h"
-#include <QGraphicsObject>
-#include <QFont>
-#include <QBrush>
-#include <QPen>
-#include <QGraphicsTextItem>
-#include <QGraphicsLayoutItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLegendMarkerPrivate;
-
-class LegendMarkerItem : public QGraphicsObject, public QGraphicsLayoutItem
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsLayoutItem)
-public:
- explicit LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject *parent = 0);
- ~LegendMarkerItem();
-
- void setPen(const QPen &pen);
- QPen pen() const;
-
- void setBrush(const QBrush &brush);
- QBrush brush() const;
-
- void setFont(const QFont &font);
- QFont font() const;
-
- void setLabel(const QString label);
- QString label() const;
-
- void setLabelBrush(const QBrush &brush);
- QBrush labelBrush() const;
-
- void setGeometry(const QRectF &rect);
- QRectF boundingRect() const;
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
- QSizeF sizeHint (Qt::SizeHint which, const QSizeF &constraint) const;
-
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
-
-protected:
- QLegendMarkerPrivate *m_marker; // Knows
- QRectF m_markerRect;
- QRectF m_boundingRect;
- QGraphicsTextItem *m_textItem;
- QGraphicsRectItem *m_rectItem;
- qreal m_margin;
- qreal m_space;
- QString m_label;
-
- QBrush m_labelBrush;
- QPen m_pen;
- QBrush m_brush;
- bool m_hovering;
-
- QPointF m_pressPos;
-
- friend class QLegendMarker;
- friend class QLegendMarkerPrivate;
- friend class LegendLayout;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // LEGENDMARKERITEM_P_H
diff --git a/src/legend/legendscroller.cpp b/src/legend/legendscroller.cpp
deleted file mode 100644
index cde58e4c..00000000
--- a/src/legend/legendscroller.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-#include <QGraphicsSceneMouseEvent>
-#include <QGraphicsScene>
-#include <QLegendMarker>
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include "legendscroller_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-LegendScroller::LegendScroller(QChart *chart) : QLegend(chart)
-{
-}
-
-void LegendScroller::setOffset(const QPointF &point)
-{
- d_ptr->setOffset(point);
-}
-
-QPointF LegendScroller::offset() const
-{
- return d_ptr->offset();
-}
-
-void LegendScroller::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- Scroller::handleMousePressEvent(event);
-}
-
-void LegendScroller::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
-{
- Scroller::handleMouseMoveEvent(event);
-}
-
-void LegendScroller::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
- Scroller::handleMouseReleaseEvent(event);
-
- if (!event->isAccepted()) {
- QList<QGraphicsItem *> items = scene()->items(event->scenePos());
-
- foreach (QGraphicsItem *i, items) {
- if (d_ptr->m_markerHash.contains(i)) {
- QLegendMarker *marker = d_ptr->m_markerHash.value(i);
- emit marker->clicked();
- }
- }
- event->accept();
- }
-}
-
-
-#include "moc_legendscroller_p.cpp"
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/legend/legendscroller_p.h b/src/legend/legendscroller_p.h
deleted file mode 100644
index 15a7671c..00000000
--- a/src/legend/legendscroller_p.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-
-#ifndef LEGENDSCROLLER_P_H
-#define LEGENDSCROLLER_P_H
-
-#include "qlegend.h"
-#include "qlegend_p.h"
-#include "scroller_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class LegendScroller: public QLegend, public Scroller
-{
- Q_OBJECT
-
-public:
- LegendScroller(QChart *chart);
-
- void setOffset(const QPointF &point);
- QPointF offset() const;
-
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/legend/qarealegendmarker.cpp b/src/legend/qarealegendmarker.cpp
deleted file mode 100644
index 471f9832..00000000
--- a/src/legend/qarealegendmarker.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qarealegendmarker.h"
-#include "qarealegendmarker_p.h"
-#include "qareaseries_p.h"
-#include <QAreaSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QAreaLegendMarker
- \inmodule Qt Charts
- \brief QAreaLegendMarker object.
- \mainclass
-
- QAreaLegendMarker is related to QAreaSeries. One QAreaSeries results in one marker.
-
- \sa QLegend, QAreaSeries
-*/
-
-/*!
- \fn virtual LegendMarkerType QAreaLegendMarker::type()
- Returns QLegendMarker::LegendMarkerTypeArea
-*/
-
-/*!
- \internal
-*/
-QAreaLegendMarker::QAreaLegendMarker(QAreaSeries *series, QLegend *legend, QObject *parent) :
- QLegendMarker(*new QAreaLegendMarkerPrivate(this,series,legend), parent)
-{
- d_ptr->updated();
-}
-
-/*!
- Destructor
-*/
-QAreaLegendMarker::~QAreaLegendMarker()
-{
-}
-
-/*!
- \internal
-*/
-QAreaLegendMarker::QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *parent) :
- QLegendMarker(d, parent)
-{
-}
-
-/*!
- Returns related series of marker
-*/
-QAreaSeries* QAreaLegendMarker::series()
-{
- Q_D(QAreaLegendMarker);
- return d->m_series;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QAreaLegendMarkerPrivate::QAreaLegendMarkerPrivate(QAreaLegendMarker *q, QAreaSeries *series, QLegend *legend) :
- QLegendMarkerPrivate(q,legend),
- q_ptr(q),
- m_series(series)
-{
- QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(updated()));
- QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated()));
-}
-
-QAreaLegendMarkerPrivate::~QAreaLegendMarkerPrivate()
-{
-}
-
-QAreaSeries* QAreaLegendMarkerPrivate::series()
-{
- return m_series;
-}
-
-QObject* QAreaLegendMarkerPrivate::relatedObject()
-{
- return m_series;
-}
-
-void QAreaLegendMarkerPrivate::updated()
-{
- bool labelChanged = false;
- bool brushChanged = false;
-
- if (!m_customBrush && (m_item->brush() != m_series->brush())) {
- m_item->setBrush(m_series->brush());
- brushChanged = true;
- }
- if (!m_customLabel && (m_item->label() != m_series->name())) {
- m_item->setLabel(m_series->name());
- labelChanged = true;
- }
- invalidateLegend();
-
- if (labelChanged)
- emit q_ptr->labelChanged();
- if (brushChanged)
- emit q_ptr->brushChanged();
-}
-
-#include "moc_qarealegendmarker.cpp"
-#include "moc_qarealegendmarker_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/legend/qarealegendmarker.h b/src/legend/qarealegendmarker.h
deleted file mode 100644
index 3084d1d7..00000000
--- a/src/legend/qarealegendmarker.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAREALEGENDMARKER_H
-#define QAREALEGENDMARKER_H
-
-#include <QChartGlobal>
-#include <QLegendMarker>
-#include <QAreaSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAreaLegendMarkerPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QAreaLegendMarker : public QLegendMarker
-{
- Q_OBJECT
-
-public:
- explicit QAreaLegendMarker(QAreaSeries *series, QLegend *legend, QObject *parent = 0);
- virtual ~QAreaLegendMarker();
-
- virtual LegendMarkerType type() { return LegendMarkerTypeArea; }
-
- // Related series
- virtual QAreaSeries* series();
-
-protected:
- QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *parent = 0);
-
-private:
- Q_DECLARE_PRIVATE(QAreaLegendMarker)
- Q_DISABLE_COPY(QAreaLegendMarker)
-
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QAREALEGENDMARKER_H
diff --git a/src/legend/qarealegendmarker_p.h b/src/legend/qarealegendmarker_p.h
deleted file mode 100644
index afeba7e4..00000000
--- a/src/legend/qarealegendmarker_p.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QAREALEGENDMARKER_P_H
-#define QAREALEGENDMARKER_P_H
-
-#include "qchartglobal.h"
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include <QAreaSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAreaLegendMarker;
-
-class QAreaLegendMarkerPrivate : public QLegendMarkerPrivate
-{
- Q_OBJECT
-public:
- explicit QAreaLegendMarkerPrivate(QAreaLegendMarker *q, QAreaSeries *series, QLegend *legend);
- virtual ~QAreaLegendMarkerPrivate();
-
- virtual QAreaSeries* series();
- virtual QObject* relatedObject();
-
-public Q_SLOTS:
- virtual void updated();
-
-private:
- QAreaLegendMarker *q_ptr;
- QAreaSeries *m_series;
-
- Q_DECLARE_PUBLIC(QAreaLegendMarker)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QAREALEGENDMARKER_P_H
diff --git a/src/legend/qbarlegendmarker.cpp b/src/legend/qbarlegendmarker.cpp
deleted file mode 100644
index 756ac520..00000000
--- a/src/legend/qbarlegendmarker.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbarlegendmarker.h"
-#include "qbarlegendmarker_p.h"
-#include <QAbstractBarSeries>
-#include <QBarSet>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QBarLegendMarker
- \inmodule Qt Charts
- \brief QBarLegendMarker object.
- \mainclass
-
- QBarLegendMarker is related to QAbstractBarSeries derived classes. With bar series, each marker is related to one QBarSet.
-
- \sa QLegend, QAbstractBarSeries, QBarSet
-*/
-
-/*!
- \fn virtual LegendMarkerType QBarLegendMarker::type()
- Returns QLegendMarker::LegendMarkerTypeBar
-*/
-
-/*!
- \internal
- Constructor
-*/
-QBarLegendMarker::QBarLegendMarker(QAbstractBarSeries *series, QBarSet *barset, QLegend *legend, QObject *parent) :
- QLegendMarker(*new QBarLegendMarkerPrivate(this,series,barset,legend), parent)
-{
- d_ptr->updated();
-}
-
-/*!
- Desturctor
-*/
-QBarLegendMarker::~QBarLegendMarker()
-{
-}
-
-/*!
- \internal
-*/
-QBarLegendMarker::QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent) :
- QLegendMarker(d, parent)
-{
-}
-
-/*!
- Returns the related series of marker
-*/
-QAbstractBarSeries *QBarLegendMarker::series()
-{
- Q_D(QBarLegendMarker);
- return d->m_series;
-}
-
-/*!
- Returns the related barset of marker
-*/
-QBarSet* QBarLegendMarker::barset()
-{
- Q_D(QBarLegendMarker);
- return d->m_barset;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QBarLegendMarkerPrivate::QBarLegendMarkerPrivate(QBarLegendMarker *q, QAbstractBarSeries *series, QBarSet *barset, QLegend *legend) :
- QLegendMarkerPrivate(q,legend),
- q_ptr(q),
- m_series(series),
- m_barset(barset)
-{
- QObject::connect(m_barset, SIGNAL(penChanged()), this, SLOT(updated()));
- QObject::connect(m_barset, SIGNAL(labelChanged()), this, SLOT(updated()));
- QObject::connect(m_barset, SIGNAL(brushChanged()), this, SLOT(updated()));
-}
-
-QBarLegendMarkerPrivate::~QBarLegendMarkerPrivate()
-{
-}
-
-QAbstractBarSeries* QBarLegendMarkerPrivate::series()
-{
- return m_series;
-}
-
-QObject* QBarLegendMarkerPrivate::relatedObject()
-{
- return m_barset;
-}
-
-void QBarLegendMarkerPrivate::updated()
-{
- bool labelChanged = false;
- bool brushChanged = false;
- bool penChanged = false;
-
- if (!m_customPen && (m_item->pen() != m_barset->pen())) {
- m_item->setPen(m_barset->pen());
- penChanged = true;
- }
- if (!m_customBrush && (m_item->brush() != m_barset->brush())) {
- m_item->setBrush(m_barset->brush());
- brushChanged = true;
- }
- if (!m_customLabel && (m_item->label() != m_barset->label())) {
- m_item->setLabel(m_barset->label());
- labelChanged = true;
- }
- invalidateLegend();
-
- if (labelChanged)
- emit q_ptr->labelChanged();
- if (brushChanged)
- emit q_ptr->brushChanged();
- if (penChanged)
- emit q_ptr->penChanged();
-}
-
-#include "moc_qbarlegendmarker.cpp"
-#include "moc_qbarlegendmarker_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/legend/qbarlegendmarker.h b/src/legend/qbarlegendmarker.h
deleted file mode 100644
index b6807426..00000000
--- a/src/legend/qbarlegendmarker.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QBARLEGENDMARKER_H
-#define QBARLEGENDMARKER_H
-
-#include <QChartGlobal>
-#include <QLegendMarker>
-#include <QAbstractBarSeries>
-#include <QBarSet>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLegend;
-class QBarLegendMarkerPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QBarLegendMarker : public QLegendMarker
-{
- Q_OBJECT
-public:
- explicit QBarLegendMarker(QAbstractBarSeries *series, QBarSet *barset, QLegend *legend, QObject *parent = 0);
- virtual ~QBarLegendMarker();
-
- virtual LegendMarkerType type() { return LegendMarkerTypeBar; }
-
- // Related series and barset
- virtual QAbstractBarSeries* series();
- QBarSet* barset();
-
-protected:
- QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent = 0);
-
-private:
- Q_DECLARE_PRIVATE(QBarLegendMarker)
- Q_DISABLE_COPY(QBarLegendMarker)
-
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARLEGENDMARKER_H
diff --git a/src/legend/qbarlegendmarker_p.h b/src/legend/qbarlegendmarker_p.h
deleted file mode 100644
index a79a5ad8..00000000
--- a/src/legend/qbarlegendmarker_p.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QBARLEGENDMARKER_P_H
-#define QBARLEGENDMARKER_P_H
-
-#include "qchartglobal.h"
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include <QAbstractBarSeries>
-#include <QBarSet>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBarLegendMarker;
-
-class QBarLegendMarkerPrivate : public QLegendMarkerPrivate
-{
- Q_OBJECT
-public:
- explicit QBarLegendMarkerPrivate(QBarLegendMarker *q, QAbstractBarSeries *series, QBarSet *barset, QLegend *legend);
- virtual ~QBarLegendMarkerPrivate();
-
- virtual QAbstractBarSeries* series();
- virtual QObject* relatedObject();
-
-public Q_SLOTS:
- virtual void updated();
-
-private:
- QBarLegendMarker *q_ptr;
- QAbstractBarSeries *m_series;
- QBarSet *m_barset;
-
- Q_DECLARE_PUBLIC(QBarLegendMarker)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBARLEGENDMARKER_P_H
diff --git a/src/legend/qboxplotlegendmarker.cpp b/src/legend/qboxplotlegendmarker.cpp
deleted file mode 100644
index 4adbf19b..00000000
--- a/src/legend/qboxplotlegendmarker.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qboxplotlegendmarker.h"
-#include "qboxplotlegendmarker_p.h"
-#include "qboxplotseries.h"
-#include "qboxplotseries_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QBoxPlotLegendMarker
- \inmodule Qt Charts
- \brief QBoxPlotLegendMarker object
- \mainclass
-
- QBoxPlotLegendMarker is related to QBoxPlotSeries classes.
-
- \sa QLegend, QBoxPlotSeries
-*/
-
-/*!
- \fn virtual LegendMarkerType QBoxPlotLegendMarker::type()
- Returns QLegendMarker::LegendMarkerTypeBoxPlot
-*/
-
-/*!
- \internal
-*/
-QBoxPlotLegendMarker::QBoxPlotLegendMarker(QBoxPlotSeries *series, QLegend *legend, QObject *parent) :
- QLegendMarker(*new QBoxPlotLegendMarkerPrivate(this,series,legend), parent)
-{
- d_ptr->updated();
-}
-
-/*!
- Destructor
-*/
-QBoxPlotLegendMarker::~QBoxPlotLegendMarker()
-{
-}
-
-/*!
- \internal
-*/
-QBoxPlotLegendMarker::QBoxPlotLegendMarker(QBoxPlotLegendMarkerPrivate &d, QObject *parent) :
- QLegendMarker(d, parent)
-{
-}
-
-/*!
- Returns the related series
-*/
-QBoxPlotSeries* QBoxPlotLegendMarker::series()
-{
- Q_D(QBoxPlotLegendMarker);
- return d->m_series;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QBoxPlotLegendMarkerPrivate::QBoxPlotLegendMarkerPrivate(QBoxPlotLegendMarker *q, QBoxPlotSeries *series, QLegend *legend) :
- QLegendMarkerPrivate(q,legend),
- q_ptr(q),
- m_series(series)
-{
- QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated()));
- QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(updated()));
-}
-
-QBoxPlotLegendMarkerPrivate::~QBoxPlotLegendMarkerPrivate()
-{
-}
-
-QAbstractSeries* QBoxPlotLegendMarkerPrivate::series()
-{
- return m_series;
-}
-
-QObject* QBoxPlotLegendMarkerPrivate::relatedObject()
-{
- return m_series;
-}
-
-void QBoxPlotLegendMarkerPrivate::updated()
-{
- bool labelChanged = false;
- bool brushChanged = false;
-
- if (!m_customLabel && (m_item->label() != m_series->name())) {
- m_item->setLabel(m_series->name());
- labelChanged = true;
- }
- if (!m_customBrush && (m_item->brush() != m_series->brush())) {
- m_item->setBrush(m_series->brush());
- brushChanged = true;
- }
- invalidateLegend();
-
- if (labelChanged)
- emit q_ptr->labelChanged();
- if (brushChanged)
- emit q_ptr->brushChanged();
-}
-
-#include "moc_qboxplotlegendmarker.cpp"
-#include "moc_qboxplotlegendmarker_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/legend/qboxplotlegendmarker.h b/src/legend/qboxplotlegendmarker.h
deleted file mode 100644
index eb8e6d37..00000000
--- a/src/legend/qboxplotlegendmarker.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBOXPLOTLEGENDMARKER_H
-#define QBOXPLOTLEGENDMARKER_H
-
-#include <QChartGlobal>
-#include <QLegendMarker>
-#include <QBoxPlotSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBoxPlotLegendMarkerPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QBoxPlotLegendMarker : public QLegendMarker
-{
- Q_OBJECT
-
-public:
- explicit QBoxPlotLegendMarker(QBoxPlotSeries *series, QLegend *legend, QObject *parent = 0);
- virtual ~QBoxPlotLegendMarker();
-
- virtual LegendMarkerType type() { return LegendMarkerTypeBoxPlot; }
-
- // Related series
- virtual QBoxPlotSeries* series();
-
-protected:
- QBoxPlotLegendMarker(QBoxPlotLegendMarkerPrivate &d, QObject *parent = 0);
-
-private:
- Q_DECLARE_PRIVATE(QBoxPlotLegendMarker)
- Q_DISABLE_COPY(QBoxPlotLegendMarker)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBOXPLOTLEGENDMARKER_H
diff --git a/src/legend/qboxplotlegendmarker_p.h b/src/legend/qboxplotlegendmarker_p.h
deleted file mode 100644
index 499980eb..00000000
--- a/src/legend/qboxplotlegendmarker_p.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QBOXPLOTLEGENDMARKER_P_H
-#define QBOXPLOTLEGENDMARKER_P_H
-
-#include "qchartglobal.h"
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include <QBoxPlotSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QBoxPlotLegendMarker;
-
-class QBoxPlotLegendMarkerPrivate : public QLegendMarkerPrivate
-{
- Q_OBJECT
-public:
- explicit QBoxPlotLegendMarkerPrivate(QBoxPlotLegendMarker *q, QBoxPlotSeries *series, QLegend *legend);
- virtual ~QBoxPlotLegendMarkerPrivate();
-
- virtual QAbstractSeries *series();
- virtual QObject *relatedObject();
-
-public Q_SLOTS:
- virtual void updated();
-
-private:
- QBoxPlotLegendMarker *q_ptr;
- QBoxPlotSeries *m_series;
-
- Q_DECLARE_PUBLIC(QBoxPlotLegendMarker)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QBOXPLOTLEGENDMARKER_P_H
diff --git a/src/legend/qlegend.cpp b/src/legend/qlegend.cpp
deleted file mode 100644
index 310003f4..00000000
--- a/src/legend/qlegend.cpp
+++ /dev/null
@@ -1,623 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "qlegend.h"
-#include "qlegend_p.h"
-#include "qabstractseries.h"
-#include "qabstractseries_p.h"
-#include "qchart_p.h"
-#include "legendlayout_p.h"
-#include "chartpresenter_p.h"
-#include "abstractchartlayout_p.h"
-#include "qlegendmarker.h"
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include "chartdataset_p.h"
-#include <QPainter>
-#include <QPen>
-#include <QGraphicsItemGroup>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QLegend
- \inmodule Qt Charts
- \brief Legend object.
- \mainclass
-
- QLegend is a graphical object for displaying the legend of the chart. Legend state is updated by QChart, when
- series have been changed. By default, legend is drawn by QChart, but user can set a new parent to legend and
- handle the drawing manually.
- User isn't supposed to create or delete legend objects, but can reference it via QChart class.
-
- \image examples_percentbarchart_legend.png
-
- \sa QChart
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype Legend
- \instantiates QLegend
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/legend.qdocinc
-*/
-#else
-/*!
- \qmlclass Legend QLegend
-
- \include ../doc/src/legend.qdocinc
-*/
-#endif
-
-/*!
- \property QLegend::alignment
- \brief The alignment of the legend.
-
- Legend paints on the defined position in the chart. The following alignments are supported:
- Qt::AlignTop, Qt::AlignBottom, Qt::AlignLeft, Qt::AlignRight. If you set more than one flag the result is undefined.
-*/
-/*!
- \qmlproperty Qt.Alignment Legend::alignment
- \brief The alignment of the legend.
-
- Legend paints on the defined position in the chart. The following alignments are supported:
- Qt.AlignTop, Qt.AlignBottom, Qt.AlignLeft, Qt.AlignRight. If you set more than one flag the result is undefined.
-*/
-
-/*!
- \property QLegend::backgroundVisible
- Whether the legend background is visible or not.
-*/
-/*!
- \qmlproperty bool Legend::backgroundVisible
- Whether the legend background is visible or not.
-*/
-
-/*!
- \property QLegend::color
- The color of the legend, i.e. the background (brush) color. Note that if you change the color
- of the legend, the style of the legend brush is set to Qt::SolidPattern.
-*/
-/*!
- \qmlproperty color Legend::color
- The color of the legend, i.e. the background (brush) color.
-*/
-
-/*!
- \property QLegend::borderColor
- The border color of the legend, i.e. the line color.
-*/
-/*!
- \qmlproperty color Legend::borderColor
- The border color of the legend, i.e. the line color.
-*/
-
-/*!
- \property QLegend::font
- The font of markers used by legend.
-*/
-/*!
- \qmlproperty Font Legend::font
- The font of markers used by legend.
-*/
-
-/*!
- \property QLegend::labelColor
- The color of brush used to draw labels.
-*/
-/*!
- \qmlproperty color Legend::labelColor
- The color of brush used to draw labels.
-*/
-
-/*!
- \property QLegend::reverseMarkers
- Whether reverse order is used for the markers in legend or not. False by default.
-*/
-/*!
- \qmlproperty bool Legend::reverseMarkers
- Whether reverse order is used for the markers in legend or not. False by default.
-*/
-
-/*!
- \fn void QLegend::backgroundVisibleChanged(bool)
- The visibility of the legend background changed to \a visible.
-*/
-
-/*!
- \fn void QLegend::colorChanged(QColor)
- The color of the legend background changed to \a color.
-*/
-
-/*!
- \fn void QLegend::borderColorChanged(QColor)
- The border color of the legend background changed to \a color.
-*/
-
-/*!
- \fn void QLegend::fontChanged(QFont)
- The font of markers of the legend changed to \a font.
-*/
-
-/*!
- \fn void QLegend::labelColorChanged(QColor color)
- This signal is emitted when the color of brush used to draw labels has changed to \a color.
-*/
-
-/*!
- \fn void QLegend::reverseMarkersChanged(bool)
- The use of reverse order for the markers in legend is changed to \a reverseMarkers.
-*/
-
-QLegend::QLegend(QChart *chart): QGraphicsWidget(chart),
- d_ptr(new QLegendPrivate(chart->d_ptr->m_presenter, chart, this))
-{
- setZValue(ChartPresenter::LegendZValue);
- setFlags(QGraphicsItem::ItemClipsChildrenToShape);
- QObject::connect(chart->d_ptr->m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), d_ptr.data(), SLOT(handleSeriesAdded(QAbstractSeries*)));
- QObject::connect(chart->d_ptr->m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), d_ptr.data(), SLOT(handleSeriesRemoved(QAbstractSeries*)));
- setLayout(d_ptr->m_layout);
-}
-
-/*!
- Destroys the legend object. Legend is always owned by a QChart, so an application should never call this.
-*/
-QLegend::~QLegend()
-{
-}
-
-/*!
- \internal
- */
-void QLegend::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option)
- Q_UNUSED(widget)
-
- if (!d_ptr->m_backgroundVisible)
- return;
-
- painter->setOpacity(opacity());
- painter->setPen(d_ptr->m_pen);
- painter->setBrush(d_ptr->m_brush);
- painter->drawRoundRect(rect(), d_ptr->roundness(rect().width()), d_ptr->roundness(rect().height()));
-}
-
-
-/*!
- Sets the \a brush of legend. Brush affects the background of legend.
- */
-void QLegend::setBrush(const QBrush &brush)
-{
- if (d_ptr->m_brush != brush) {
- d_ptr->m_brush = brush;
- update();
- emit colorChanged(brush.color());
- }
-}
-
-/*!
- Returns the brush used by legend.
- */
-QBrush QLegend::brush() const
-{
- return d_ptr->m_brush;
-}
-
-void QLegend::setColor(QColor color)
-{
- QBrush b = d_ptr->m_brush;
- if (b.style() != Qt::SolidPattern || b.color() != color) {
- b.setStyle(Qt::SolidPattern);
- b.setColor(color);
- setBrush(b);
- }
-}
-
-QColor QLegend::color()
-{
- return d_ptr->m_brush.color();
-}
-
-/*!
- Sets the \a pen of legend. Pen affects the legend borders.
- */
-void QLegend::setPen(const QPen &pen)
-{
- if (d_ptr->m_pen != pen) {
- d_ptr->m_pen = pen;
- update();
- emit borderColorChanged(pen.color());
- }
-}
-
-/*!
- Returns the pen used by legend.
- */
-
-QPen QLegend::pen() const
-{
- return d_ptr->m_pen;
-}
-
-void QLegend::setFont(const QFont &font)
-{
- if (d_ptr->m_font != font) {
- // Hide items to avoid flickering
- d_ptr->items()->setVisible(false);
- d_ptr->m_font = font;
- foreach (QLegendMarker *marker, d_ptr->markers()) {
- marker->setFont(d_ptr->m_font);
- }
- layout()->invalidate();
- emit fontChanged(font);
- }
-}
-
-QFont QLegend::font() const
-{
- return d_ptr->m_font;
-}
-
-void QLegend::setBorderColor(QColor color)
-{
- QPen p = d_ptr->m_pen;
- if (p.color() != color) {
- p.setColor(color);
- setPen(p);
- }
-}
-
-QColor QLegend::borderColor()
-{
- return d_ptr->m_pen.color();
-}
-
-/*!
- Set brush used to draw labels to \a brush.
-*/
-void QLegend::setLabelBrush(const QBrush &brush)
-{
- if (d_ptr->m_labelBrush != brush) {
- d_ptr->m_labelBrush = brush;
- foreach (QLegendMarker *marker, d_ptr->markers()) {
- marker->setLabelBrush(d_ptr->m_labelBrush);
- // Note: The pen of the marker rectangle could be exposed in the public QLegend API
- // instead of mapping it from label brush color
- marker->setPen(brush.color());
- }
- emit labelColorChanged(brush.color());
- }
-}
-
-/*!
- Brush used to draw labels.
-*/
-QBrush QLegend::labelBrush() const
-{
- return d_ptr->m_labelBrush;
-}
-
-void QLegend::setLabelColor(QColor color)
-{
- QBrush b = d_ptr->m_labelBrush;
- if (b.style() != Qt::SolidPattern || b.color() != color) {
- b.setStyle(Qt::SolidPattern);
- b.setColor(color);
- setLabelBrush(b);
- }
-}
-
-QColor QLegend::labelColor() const
-{
- return d_ptr->m_labelBrush.color();
-}
-
-
-void QLegend::setAlignment(Qt::Alignment alignment)
-{
- if (d_ptr->m_alignment != alignment) {
- d_ptr->m_alignment = alignment;
- layout()->invalidate();
- }
-}
-
-Qt::Alignment QLegend::alignment() const
-{
- return d_ptr->m_alignment;
-}
-
-/*!
- Detaches the legend from chart. Chart won't change layout of the legend.
- */
-void QLegend::detachFromChart()
-{
- d_ptr->m_attachedToChart = false;
-// layout()->invalidate();
- d_ptr->m_chart->layout()->invalidate();
- setParent(0);
-
-}
-
-/*!
- Attaches the legend to chart. Chart may change layout of the legend.
- */
-void QLegend::attachToChart()
-{
- d_ptr->m_attachedToChart = true;
-// layout()->invalidate();
- d_ptr->m_chart->layout()->invalidate();
- setParent(d_ptr->m_chart);
-}
-
-/*!
- Returns true, if legend is attached to chart.
- */
-bool QLegend::isAttachedToChart()
-{
- return d_ptr->m_attachedToChart;
-}
-
-/*!
- Sets the visibility of legend background to \a visible
- */
-void QLegend::setBackgroundVisible(bool visible)
-{
- if (d_ptr->m_backgroundVisible != visible) {
- d_ptr->m_backgroundVisible = visible;
- update();
- emit backgroundVisibleChanged(visible);
- }
-}
-
-/*!
- Returns the visibility of legend background
- */
-bool QLegend::isBackgroundVisible() const
-{
- return d_ptr->m_backgroundVisible;
-}
-
-/*!
- Returns the list of markers in legend. The list can be filtered with \a series parameter.
- If \a series is given, only markers related to that series are returned.
-*/
-QList<QLegendMarker*> QLegend::markers(QAbstractSeries *series) const
-{
- return d_ptr->markers(series);
-}
-
-bool QLegend::reverseMarkers()
-{
- return d_ptr->m_reverseMarkers;
-}
-
-void QLegend::setReverseMarkers(bool reverseMarkers)
-{
- if (d_ptr->m_reverseMarkers != reverseMarkers) {
- d_ptr->m_reverseMarkers = reverseMarkers;
- layout()->invalidate();
- emit reverseMarkersChanged(reverseMarkers);
- }
-}
-
-/*!
- \internal \a event see QGraphicsWidget for details
- */
-void QLegend::hideEvent(QHideEvent *event)
-{
- if (isAttachedToChart())
- d_ptr->m_presenter->layout()->invalidate();
- QGraphicsWidget::hideEvent(event);
-}
-/*!
- \internal \a event see QGraphicsWidget for details
- */
-void QLegend::showEvent(QShowEvent *event)
-{
- if (isAttachedToChart())
- layout()->invalidate();
- QGraphicsWidget::showEvent(event);
- //layout activation will show the items
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QLegendPrivate::QLegendPrivate(ChartPresenter *presenter, QChart *chart, QLegend *q)
- : q_ptr(q),
- m_presenter(presenter),
- m_layout(new LegendLayout(q)),
- m_chart(chart),
- m_items(new QGraphicsItemGroup(q)),
- m_alignment(Qt::AlignTop),
- m_brush(QBrush()),
- m_pen(QPen()),
- m_labelBrush(QBrush()),
- m_diameter(5),
- m_attachedToChart(true),
- m_backgroundVisible(false),
- m_reverseMarkers(false)
-{
- m_items->setHandlesChildEvents(false);
-}
-
-QLegendPrivate::~QLegendPrivate()
-{
-
-}
-
-void QLegendPrivate::setOffset(const QPointF &offset)
-{
- m_layout->setOffset(offset.x(), offset.y());
-}
-
-QPointF QLegendPrivate::offset() const
-{
- return m_layout->offset();
-}
-
-int QLegendPrivate::roundness(qreal size)
-{
- return 100 * m_diameter / int(size);
-}
-
-QList<QLegendMarker*> QLegendPrivate::markers(QAbstractSeries *series)
-{
- // Return all markers
- if (!series) {
- return m_markers;
- }
-
- // Create filtered list
- QList<QLegendMarker *> markers;
- foreach (QLegendMarker *marker, m_markers) {
- if (marker->series() == series) {
- markers.append(marker);
- }
- }
- return markers;
-}
-
-void QLegendPrivate::handleSeriesAdded(QAbstractSeries *series)
-{
- if (m_series.contains(series)) {
- return;
- }
-
- QList<QLegendMarker*> newMarkers = series->d_ptr->createLegendMarkers(q_ptr);
- decorateMarkers(newMarkers);
- addMarkers(newMarkers);
-
- QObject::connect(series->d_ptr.data(), SIGNAL(countChanged()), this, SLOT(handleCountChanged()));
- QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
-
- m_series.append(series);
- m_items->setVisible(false);
- m_layout->invalidate();
-}
-
-void QLegendPrivate::handleSeriesRemoved(QAbstractSeries *series)
-{
- if (m_series.contains(series)) {
- m_series.removeOne(series);
- }
-
- // Find out, which markers to remove
- QList<QLegendMarker *> removed;
- foreach (QLegendMarker *m, m_markers) {
- if (m->series() == series) {
- removed << m;
- }
- }
- removeMarkers(removed);
-
- QObject::disconnect(series->d_ptr.data(), SIGNAL(countChanged()), this, SLOT(handleCountChanged()));
- QObject::disconnect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
-
- m_layout->invalidate();
-}
-
-void QLegendPrivate::handleSeriesVisibleChanged()
-{
- QAbstractSeries *series = qobject_cast<QAbstractSeries *> (sender());
- Q_ASSERT(series);
-
- foreach (QLegendMarker *marker, m_markers) {
- if (marker->series() == series) {
- marker->setVisible(series->isVisible());
- }
- }
-
- if (m_chart->isVisible())
- m_layout->invalidate();
-}
-
-void QLegendPrivate::handleCountChanged()
-{
- // Here we handle the changes in marker count.
- // Can happen for example when pieslice(s) have been added to or removed from pieseries.
-
- QAbstractSeriesPrivate *series = qobject_cast<QAbstractSeriesPrivate *> (sender());
- QList<QLegendMarker *> createdMarkers = series->createLegendMarkers(q_ptr);
-
- // Find out removed markers and created markers
- QList<QLegendMarker *> removedMarkers;
- foreach (QLegendMarker *oldMarker, m_markers) {
- // we have marker, which is related to sender.
- if (oldMarker->series() == series->q_ptr) {
- bool found = false;
- foreach(QLegendMarker *newMarker, createdMarkers) {
- // New marker considered existing if:
- // - d_ptr->relatedObject() is same for both markers.
- if (newMarker->d_ptr->relatedObject() == oldMarker->d_ptr->relatedObject()) {
- // Delete the new marker, since we already have existing marker, that might be connected on user side.
- found = true;
- createdMarkers.removeOne(newMarker);
- delete newMarker;
- }
- }
- if (!found) {
- // No related object found for marker, add to removedMarkers list
- removedMarkers << oldMarker;
- }
- }
- }
-
- removeMarkers(removedMarkers);
- decorateMarkers(createdMarkers);
- addMarkers(createdMarkers);
-
- q_ptr->layout()->invalidate();
-}
-
-void QLegendPrivate::addMarkers(QList<QLegendMarker *> markers)
-{
- foreach (QLegendMarker *marker, markers) {
- m_items->addToGroup(marker->d_ptr.data()->item());
- m_markers << marker;
- m_markerHash.insert(marker->d_ptr->item(), marker);
- }
-}
-
-void QLegendPrivate::removeMarkers(QList<QLegendMarker *> markers)
-{
- foreach (QLegendMarker *marker, markers) {
- marker->d_ptr->item()->setVisible(false);
- m_items->removeFromGroup(marker->d_ptr->item());
- m_markers.removeOne(marker);
- m_markerHash.remove(marker->d_ptr->item());
- delete marker;
- }
-}
-
-void QLegendPrivate::decorateMarkers(QList<QLegendMarker *> markers)
-{
- foreach (QLegendMarker *marker, markers) {
- marker->setFont(m_font);
- marker->setLabelBrush(m_labelBrush);
- }
-}
-
-
-#include "moc_qlegend.cpp"
-#include "moc_qlegend_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/legend/qlegend.h b/src/legend/qlegend.h
deleted file mode 100644
index ce125e03..00000000
--- a/src/legend/qlegend.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLEGEND_H
-#define QLEGEND_H
-
-#include <qchartglobal.h>
-#include <QGraphicsWidget>
-#include <QPen>
-#include <QBrush>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QChart;
-class QLegendPrivate;
-class QLegendMarker;
-class QAbstractSeries;
-
-class QTCOMMERCIALCHART_EXPORT QLegend : public QGraphicsWidget
-{
- Q_OBJECT
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
- Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
- Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
- Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
- Q_PROPERTY(bool reverseMarkers READ reverseMarkers WRITE setReverseMarkers NOTIFY reverseMarkersChanged)
-
-private:
- explicit QLegend(QChart *chart);
-
-public:
- ~QLegend();
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
-
- void setBrush(const QBrush &brush);
- QBrush brush() const;
- void setColor(QColor color);
- QColor color();
-
- void setPen(const QPen &pen);
- QPen pen() const;
- void setBorderColor(QColor color);
- QColor borderColor();
-
- void setFont(const QFont &font);
- QFont font() const;
- void setLabelBrush(const QBrush &brush);
- QBrush labelBrush() const;
-
- void setLabelColor(QColor color);
- QColor labelColor() const;
-
- void setAlignment(Qt::Alignment alignment);
- Qt::Alignment alignment() const;
-
- void detachFromChart();
- void attachToChart();
- bool isAttachedToChart();
-
- void setBackgroundVisible(bool visible = true);
- bool isBackgroundVisible() const;
-
- QList <QLegendMarker*> markers(QAbstractSeries *series = 0) const;
-
- bool reverseMarkers();
- void setReverseMarkers(bool reverseMarkers = true);
-
-protected:
- void hideEvent(QHideEvent *event);
- void showEvent(QShowEvent *event);
-
-Q_SIGNALS:
- void backgroundVisibleChanged(bool visible);
- void colorChanged(QColor color);
- void borderColorChanged(QColor color);
- void fontChanged(QFont font);
- void labelColorChanged(QColor color);
- void reverseMarkersChanged(bool reverseMarkers);
-
-private:
- QScopedPointer<QLegendPrivate> d_ptr;
- Q_DISABLE_COPY(QLegend)
- friend class LegendScroller;
- friend class LegendLayout;
- friend class ChartLayout;
- friend class LegendMarkerItem;
- friend class QLegendMarkerPrivate;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QLEGEND_H
diff --git a/src/legend/qlegend_p.h b/src/legend/qlegend_p.h
deleted file mode 100644
index bf286ba5..00000000
--- a/src/legend/qlegend_p.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QLEGEND_P_H
-#define QLEGEND_P_H
-
-#include "qlegend.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QChart;
-class ChartPresenter;
-class QAbstractSeries;
-class LegendLayout;
-class QLegendMarker;
-
-class QLegendPrivate : public QObject
-{
- Q_OBJECT
-public:
- QLegendPrivate(ChartPresenter *presenter, QChart *chart, QLegend *q);
- ~QLegendPrivate();
-
- void setOffset(const QPointF &offset);
- QPointF offset() const;
- int roundness(qreal size);
-
- QGraphicsItemGroup* items() { return m_items; }
-
- QList<QLegendMarker*> markers(QAbstractSeries *series = 0);
-
-public Q_SLOTS:
- void handleSeriesAdded(QAbstractSeries *series);
- void handleSeriesRemoved(QAbstractSeries *series);
- void handleSeriesVisibleChanged();
- void handleCountChanged();
-
-private:
- // Internal helpers
- void addMarkers(QList<QLegendMarker *> markers);
- void removeMarkers(QList<QLegendMarker *> markers);
- void decorateMarkers(QList<QLegendMarker *> markers);
-
-private:
- QLegend *q_ptr;
- ChartPresenter *m_presenter;
- LegendLayout *m_layout;
- QChart *m_chart;
- QGraphicsItemGroup *m_items;
- Qt::Alignment m_alignment;
- QBrush m_brush;
- QPen m_pen;
- QFont m_font;
- QBrush m_labelBrush;
-
- qreal m_diameter;
- bool m_attachedToChart;
- bool m_backgroundVisible;
- bool m_reverseMarkers;
-
- QList<QLegendMarker *> m_markers;
- QList<QAbstractSeries *> m_series;
-
- QHash<QGraphicsItem *, QLegendMarker *> m_markerHash;
-
- friend class QLegend;
- friend class LegendMarkerItem;
- friend class LegendLayout;
- friend class QLegendMarkerPrivate;
- friend class LegendScroller;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/legend/qlegendmarker.cpp b/src/legend/qlegendmarker.cpp
deleted file mode 100644
index 08bb496a..00000000
--- a/src/legend/qlegendmarker.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "qlegendmarker.h"
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include "qlegend.h"
-#include "qlegend_p.h"
-#include "legendlayout_p.h"
-#include <QFontMetrics>
-#include <QGraphicsSceneEvent>
-#include <QAbstractSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QLegendMarker
- \inmodule Qt Charts
- \brief LegendMarker object.
- \mainclass
-
- QLegendMarker is abstract object that can be used to access markers inside QLegend. Legend marker consists of two
- items: The colored box, which reflects the color of series and label, which is the name of series (or label of slice/barset
- in case of pie or bar series)
- The QLegendMarker is always related to one series.
-
- \image examples_percentbarchart_legend.png
-
- \sa QLegend
-*/
-/*!
- \enum QLegendMarker::LegendMarkerType
-
- The type of the legendmarker object.
-
- \value LegendMarkerTypeArea
- \value LegendMarkerTypeBar
- \value LegendMarkerTypePie
- \value LegendMarkerTypeXY
- \value LegendMarkerTypeBoxPlot
-*/
-
-/*!
- \fn virtual LegendMarkerType QLegendMarker::type() = 0;
- Returns the type of legendmarker. Type depends of the related series. LegendMarkerTypeXY is used for all QXYSeries derived
- classes.
-*/
-
-/*!
- \fn virtual QAbstractSeries* QLegendMarker::series() = 0;
- Returns pointer to series, which is related to this marker. Marker is always related to some series.
-*/
-
-/*!
- \fn void QLegendMarker::clicked();
- This signal is emitted, when marker is clicked with mouse.
-*/
-
-/*!
- \fn void QLegendMarker::hovered(bool status);
- This signal is emitted, when mouse is hovered over marker. \a status is true, when mouse enters the marker
- and false when it leaves the marker.
-*/
-
-/*!
- \fn void QLegendMarker::labelChanged()
- This signal is emitted when the label of the legend marker has changed.
-*/
-
-/*!
- \fn void QLegendMarker::labelBrushChanged()
- This signal is emitted when the label brush of the legend marker has changed.
-*/
-
-/*!
- \fn void QLegendMarker::fontChanged()
- This signal is emitted when the (label) font of the legend marker has changed.
-*/
-
-/*!
- \fn void QLegendMarker::penChanged()
- This signal is emitted when the pen of the legend marker has changed.
-*/
-
-/*!
- \fn void QLegendMarker::brushChanged()
- This signal is emitted when the brush of the legend marker has changed.
-*/
-
-/*!
- \fn void QLegendMarker::visibleChanged()
- This signal is emitted when the visibility of the legend marker has changed.
-*/
-
-/*!
- \property QLegendMarker::label
- Label of the marker. This is the text that is shown in legend.
-*/
-
-/*!
- \property QLegendMarker::labelBrush
- Brush of the label
-*/
-
-/*!
- \property QLegendMarker::font
- Font of the label
-*/
-
-/*!
- \property QLegendMarker::pen
- Pen of the marker. This is the outline of the colored square.
-*/
-
-/*!
- \property QLegendMarker::brush
- Brush of the marker. This is the inside of the colored square.
-*/
-
-/*!
- \property QLegendMarker::visible
- Visibility of the legend marker. Affects label and the colored square.
-*/
-
-
-/*!
- \internal
- */
-QLegendMarker::QLegendMarker(QLegendMarkerPrivate &d, QObject *parent) :
- QObject(parent),
- d_ptr(&d)
-{
- d_ptr->m_item->setVisible(d_ptr->series()->isVisible());
-}
-
-/*!
- Destructor of marker
-*/
-QLegendMarker::~QLegendMarker()
-{
-}
-
-/*!
- Returns the label of the marker.
-*/
-QString QLegendMarker::label() const
-{
- return d_ptr->m_item->label();
-}
-
-/*!
- Sets the \a label of marker. Note that changing name of series will also change label of its marker.
-*/
-void QLegendMarker::setLabel(const QString &label)
-{
- if (label.isEmpty()) {
- d_ptr->m_customLabel = false;
- } else {
- d_ptr->m_customLabel = true;
- d_ptr->m_item->setLabel(label);
- }
-}
-/*!
- Returns the brush which is used to draw label.
-*/
-QBrush QLegendMarker::labelBrush() const
-{
- return d_ptr->m_item->labelBrush();
-}
-
-/*!
- Sets the \a brush of label
-*/
-void QLegendMarker::setLabelBrush(const QBrush &brush)
-{
- d_ptr->m_item->setLabelBrush(brush);
-}
-
-/*!
- Retuns the font of label
-*/
-QFont QLegendMarker::font() const
-{
- return d_ptr->m_item->font();
-}
-
-/*!
- Sets the \a font of label
-*/
-void QLegendMarker::setFont(const QFont &font)
-{
- d_ptr->m_item->setFont(font);
-}
-
-/*!
- Returns the pen of marker item
-*/
-QPen QLegendMarker::pen() const
-{
- return d_ptr->m_item->pen();
-}
-
-/*!
- Sets the \a pen of marker item
-*/
-void QLegendMarker::setPen(const QPen &pen)
-{
- if (pen == QPen(Qt::NoPen)) {
- d_ptr->m_customPen = false;
- } else {
- d_ptr->m_customPen = true;
- d_ptr->m_item->setPen(pen);
- }
-}
-
-/*!
- Returns the brush of marker item
-*/
-QBrush QLegendMarker::brush() const
-{
- return d_ptr->m_item->brush();
-}
-
-/*!
- Sets the \a brush of marker item. Note that changing color of the series also changes this.
-*/
-void QLegendMarker::setBrush(const QBrush &brush)
-{
- if (brush == QBrush(Qt::NoBrush)) {
- d_ptr->m_customBrush = false;
- } else {
- d_ptr->m_customBrush = true;
- d_ptr->m_item->setBrush(brush);
- }
-}
-
-/*!
- Returns visibility of the marker
-*/
-bool QLegendMarker::isVisible() const
-{
- return d_ptr->m_item->isVisible();
-}
-
-/*!
- Sets markers visibility to \a visible
-*/
-void QLegendMarker::setVisible(bool visible)
-{
- d_ptr->m_item->setVisible(visible);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-QLegendMarkerPrivate::QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend) :
- m_legend(legend),
- m_customLabel(false),
- m_customBrush(false),
- m_customPen(false),
- q_ptr(q)
-{
- m_item = new LegendMarkerItem(this);
-}
-
-QLegendMarkerPrivate::~QLegendMarkerPrivate()
-{
- delete m_item;
-}
-
-void QLegendMarkerPrivate::invalidateLegend()
-{
- m_legend->d_ptr->m_layout->invalidate();
-}
-
-#include "moc_qlegendmarker.cpp"
-#include "moc_qlegendmarker_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/legend/qlegendmarker.h b/src/legend/qlegendmarker.h
deleted file mode 100644
index e89478ad..00000000
--- a/src/legend/qlegendmarker.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QLEGENDMARKER_H
-#define QLEGENDMARKER_H
-
-#include <QChartGlobal>
-#include <QObject>
-#include <QPen>
-#include <QBrush>
-#include <QFont>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLegendMarkerPrivate;
-class QAbstractSeries;
-class QLegend;
-
-class QTCOMMERCIALCHART_EXPORT QLegendMarker : public QObject
-{
- Q_OBJECT
-
-public:
- enum LegendMarkerType {
- LegendMarkerTypeArea,
- LegendMarkerTypeBar,
- LegendMarkerTypePie,
- LegendMarkerTypeXY,
- LegendMarkerTypeBoxPlot
- };
-
- Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
- Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged)
- Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
- Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
- Q_ENUMS(LegendMarkerType)
-
-public:
- virtual ~QLegendMarker();
- virtual LegendMarkerType type() = 0;
-
- QString label() const;
- void setLabel(const QString &label);
-
- QBrush labelBrush() const;
- void setLabelBrush(const QBrush &brush);
-
- QFont font() const;
- void setFont(const QFont &font);
-
- QPen pen() const;
- void setPen(const QPen &pen);
-
- QBrush brush() const;
- void setBrush(const QBrush &brush);
-
- bool isVisible() const;
- void setVisible(bool visible);
-
- virtual QAbstractSeries* series() = 0;
-
-Q_SIGNALS:
- void clicked();
- void hovered(bool status);
- void labelChanged();
- void labelBrushChanged();
- void fontChanged();
- void penChanged();
- void brushChanged();
- void visibleChanged();
-
-protected:
- explicit QLegendMarker(QLegendMarkerPrivate &d, QObject *parent = 0);
-
- QScopedPointer<QLegendMarkerPrivate> d_ptr;
- Q_DISABLE_COPY(QLegendMarker)
- friend class QLegendPrivate;
- friend class QLegendMarkerPrivate;
- friend class LegendMarkerItem;
- friend class LegendLayout;
- friend class LegendScroller;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QLEGENDMARKER_H
diff --git a/src/legend/qlegendmarker_p.h b/src/legend/qlegendmarker_p.h
deleted file mode 100644
index 999bc469..00000000
--- a/src/legend/qlegendmarker_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QLEGENDMARKERPRIVATE_H
-#define QLEGENDMARKERPRIVATE_H
-
-#include "qchartglobal.h"
-#include <QGraphicsObject>
-#include <QBrush>
-#include <QPen>
-#include <QGraphicsLayoutItem>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractSeries;
-class QLegend;
-
-class QLegendMarker;
-class LegendMarkerItem;
-
-class QLegendMarkerPrivate : public QObject
-{
- Q_OBJECT
-public:
- explicit QLegendMarkerPrivate(QLegendMarker *q, QLegend *legend);
- virtual ~QLegendMarkerPrivate();
-
- // Helper for now. (or declare LegendLayout as friend)
- LegendMarkerItem* item() const { return m_item; }
-
- virtual QAbstractSeries* series() = 0;
- virtual QObject* relatedObject() = 0;
-
- void invalidateLegend();
-
-public Q_SLOTS:
- virtual void updated() = 0;
-
-protected:
- LegendMarkerItem *m_item;
- QLegend *m_legend;
- bool m_customLabel;
- bool m_customBrush;
- bool m_customPen;
-
-private:
- QLegendMarker *q_ptr;
-
- friend class QLegendPrivate;
- friend class LegendMarkerItem;
- Q_DECLARE_PUBLIC(QLegendMarker)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QLEGENDMARKERPRIVATE_H
diff --git a/src/legend/qpielegendmarker.cpp b/src/legend/qpielegendmarker.cpp
deleted file mode 100644
index 3bb31020..00000000
--- a/src/legend/qpielegendmarker.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpielegendmarker.h"
-#include "qpielegendmarker_p.h"
-#include <QPieSeries>
-#include <QPieSlice>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QPieLegendMarker
- \inmodule Qt Charts
- \brief LegendMarker object.
- \mainclass
-
- QPieLegendMarker is related to QPieSeries. With QPieSeries, each slice of pie is related to one marker in QLegend.
-
- \sa QLegend, QPieSeries, QPieSlice
-*/
-
-/*!
- \fn virtual LegendMarkerType QPieLegendMarker::type()
- Returns QLegendMarker::LegendMarkerTypePie
-*/
-
-/*!
- \internal
-*/
-QPieLegendMarker::QPieLegendMarker(QPieSeries *series, QPieSlice *slice, QLegend *legend, QObject *parent) :
- QLegendMarker(*new QPieLegendMarkerPrivate(this,series,slice,legend), parent)
-{
- d_ptr->updated();
-}
-
-/*!
- Destructor
-*/
-QPieLegendMarker::~QPieLegendMarker()
-{
-}
-
-/*!
- \internal
-*/
-QPieLegendMarker::QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent) :
- QLegendMarker(d, parent)
-{
-}
-
-/*!
- Returns the related series of marker.
-*/
-QPieSeries* QPieLegendMarker::series()
-{
- Q_D(QPieLegendMarker);
- return d->m_series;
-}
-
-/*!
- Returns the related slice of marker.
-*/
-QPieSlice* QPieLegendMarker::slice()
-{
- Q_D(QPieLegendMarker);
- return d->m_slice;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QPieLegendMarkerPrivate::QPieLegendMarkerPrivate(QPieLegendMarker *q, QPieSeries *series, QPieSlice *slice, QLegend *legend) :
- QLegendMarkerPrivate(q,legend),
- q_ptr(q),
- m_series(series),
- m_slice(slice)
-{
- QObject::connect(m_slice, SIGNAL(labelChanged()), this, SLOT(updated()));
- QObject::connect(m_slice, SIGNAL(brushChanged()), this, SLOT(updated()));
- QObject::connect(m_slice, SIGNAL(penChanged()), this, SLOT(updated()));
-}
-
-QPieLegendMarkerPrivate::~QPieLegendMarkerPrivate()
-{
-}
-
-QPieSeries* QPieLegendMarkerPrivate::series()
-{
- return m_series;
-}
-
-QObject* QPieLegendMarkerPrivate::relatedObject()
-{
- return m_slice;
-}
-
-void QPieLegendMarkerPrivate::updated()
-{
- bool labelChanged = false;
- bool brushChanged = false;
- bool penChanged = false;
-
- if (!m_customPen && (m_item->pen() != m_slice->pen())) {
- m_item->setPen(m_slice->pen());
- penChanged = true;
- }
- if (!m_customBrush && (m_item->brush() != m_slice->brush())) {
- m_item->setBrush(m_slice->brush());
- brushChanged = true;
- }
- if (!m_customLabel && (m_item->label() != m_slice->label())) {
- m_item->setLabel(m_slice->label());
- labelChanged = true;
- }
- invalidateLegend();
-
- if (labelChanged)
- emit q_ptr->labelChanged();
- if (brushChanged)
- emit q_ptr->brushChanged();
- if (penChanged)
- emit q_ptr->penChanged();
-}
-
-#include "moc_qpielegendmarker.cpp"
-#include "moc_qpielegendmarker_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/legend/qpielegendmarker.h b/src/legend/qpielegendmarker.h
deleted file mode 100644
index 6e76b819..00000000
--- a/src/legend/qpielegendmarker.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPIELEGENDMARKER_H
-#define QPIELEGENDMARKER_H
-
-#include <QChartGlobal>
-#include <QLegendMarker>
-#include <QPieSeries>
-#include <QPieSlice>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QPieLegendMarkerPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QPieLegendMarker : public QLegendMarker
-{
- Q_OBJECT
-
-public:
- explicit QPieLegendMarker(QPieSeries *series, QPieSlice *slice, QLegend *legend, QObject *parent = 0);
- virtual ~QPieLegendMarker();
-
- virtual LegendMarkerType type() { return LegendMarkerTypePie; }
-
- // Related series and slice
- virtual QPieSeries* series();
- QPieSlice* slice();
-
-protected:
- QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent = 0);
-
-private:
- Q_DECLARE_PRIVATE(QPieLegendMarker)
- Q_DISABLE_COPY(QPieLegendMarker)
-
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-#endif // QPIELEGENDMARKER_H
diff --git a/src/legend/qpielegendmarker_p.h b/src/legend/qpielegendmarker_p.h
deleted file mode 100644
index e1a780b9..00000000
--- a/src/legend/qpielegendmarker_p.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QPIELEGENDMARKER_P_H
-#define QPIELEGENDMARKER_P_H
-
-#include "qchartglobal.h"
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include <QPieSeries>
-#include <QPieSlice>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QPieLegendMarker;
-
-class QPieLegendMarkerPrivate : public QLegendMarkerPrivate
-{
- Q_OBJECT
-public:
- explicit QPieLegendMarkerPrivate(QPieLegendMarker *q, QPieSeries *series, QPieSlice *slice, QLegend *legend);
- virtual ~QPieLegendMarkerPrivate();
-
- // internal
- virtual QPieSeries* series();
- virtual QObject* relatedObject();
-
-public Q_SLOTS:
- virtual void updated();
-
-private:
- QPieLegendMarker *q_ptr;
-
- QPieSeries *m_series;
- QPieSlice *m_slice;
-
- Q_DECLARE_PUBLIC(QPieLegendMarker)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QPIELEGENDMARKER_P_H
diff --git a/src/legend/qxylegendmarker.cpp b/src/legend/qxylegendmarker.cpp
deleted file mode 100644
index 4ebf8fdf..00000000
--- a/src/legend/qxylegendmarker.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qxylegendmarker.h"
-#include "qxylegendmarker_p.h"
-#include "qxyseries_p.h"
-#include <QXYSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QXYLegendMarker
- \inmodule Qt Charts
- \brief QXYLegendMarker object.
- \mainclass
-
- QXYLegendMarker is related to QXYSeries derived classes. Each marker is related to one series.
-
- \sa QLegend, QXYSeries, QSplineSeries, QScatterSeries, QLineSeries
-*/
-
-/*!
- \fn virtual LegendMarkerType QXYLegendMarker::type()
- Returns QLegendMarker::LegendMarkerTypeXY
-*/
-
-/*!
- \internal
-*/
-QXYLegendMarker::QXYLegendMarker(QXYSeries *series, QLegend *legend, QObject *parent) :
- QLegendMarker(*new QXYLegendMarkerPrivate(this,series,legend), parent)
-{
- d_ptr->updated();
-}
-
-/*!
- Destructor
-*/
-QXYLegendMarker::~QXYLegendMarker()
-{
-}
-
-/*!
- \internal
-*/
-QXYLegendMarker::QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent) :
- QLegendMarker(d, parent)
-{
-}
-
-/*!
- Returns the related series
-*/
-QXYSeries* QXYLegendMarker::series()
-{
- Q_D(QXYLegendMarker);
- return d->m_series;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QXYLegendMarkerPrivate::QXYLegendMarkerPrivate(QXYLegendMarker *q, QXYSeries *series, QLegend *legend) :
- QLegendMarkerPrivate(q,legend),
- q_ptr(q),
- m_series(series)
-{
- QObject::connect(m_series, SIGNAL(nameChanged()), this, SLOT(updated()));
- QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(updated()));
-}
-
-QXYLegendMarkerPrivate::~QXYLegendMarkerPrivate()
-{
-}
-
-QAbstractSeries* QXYLegendMarkerPrivate::series()
-{
- return m_series;
-}
-
-QObject* QXYLegendMarkerPrivate::relatedObject()
-{
- return m_series;
-}
-
-void QXYLegendMarkerPrivate::updated()
-{
- bool labelChanged = false;
- bool brushChanged = false;
-
- if (!m_customLabel && (m_item->label() != m_series->name())) {
- m_item->setLabel(m_series->name());
- labelChanged = true;
- }
-
- if (m_series->type()== QAbstractSeries::SeriesTypeScatter) {
- if (!m_customBrush && (m_item->brush() != m_series->brush())) {
- m_item->setBrush(m_series->brush());
- brushChanged = true;
- }
- } else {
- QBrush emptyBrush;
- if (!m_customBrush
- && (m_item->brush() == emptyBrush
- || m_item->brush().color() != m_series->pen().color())) {
- m_item->setBrush(QBrush(m_series->pen().color()));
- brushChanged = true;
- }
- }
- invalidateLegend();
-
- if (labelChanged)
- emit q_ptr->labelChanged();
- if (brushChanged)
- emit q_ptr->brushChanged();
-}
-
-#include "moc_qxylegendmarker.cpp"
-#include "moc_qxylegendmarker_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/legend/qxylegendmarker.h b/src/legend/qxylegendmarker.h
deleted file mode 100644
index bdc2f382..00000000
--- a/src/legend/qxylegendmarker.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QXYLEGENDMARKER_H
-#define QXYLEGENDMARKER_H
-
-#include <QChartGlobal>
-#include <QLegendMarker>
-#include <QXYSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QXYLegendMarkerPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QXYLegendMarker : public QLegendMarker
-{
- Q_OBJECT
-public:
- explicit QXYLegendMarker(QXYSeries *series, QLegend *legend, QObject *parent = 0);
- virtual ~QXYLegendMarker();
-
- virtual LegendMarkerType type() { return LegendMarkerTypeXY; }
-
- // Related series
- virtual QXYSeries* series();
-
-protected:
- QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent = 0);
-
-private:
- Q_DECLARE_PRIVATE(QXYLegendMarker)
- Q_DISABLE_COPY(QXYLegendMarker)
-
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QXYLEGENDMARKER_H
diff --git a/src/legend/qxylegendmarker_p.h b/src/legend/qxylegendmarker_p.h
deleted file mode 100644
index 9af97a42..00000000
--- a/src/legend/qxylegendmarker_p.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QXYLEGENDMARKER_P_H
-#define QXYLEGENDMARKER_P_H
-
-#include "qchartglobal.h"
-#include "qlegendmarker_p.h"
-#include "legendmarkeritem_p.h"
-#include <QXYSeries>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QXYLegendMarker;
-
-class QXYLegendMarkerPrivate : public QLegendMarkerPrivate
-{
- Q_OBJECT
-public:
- explicit QXYLegendMarkerPrivate(QXYLegendMarker *q, QXYSeries *series, QLegend *legend);
- virtual ~QXYLegendMarkerPrivate();
-
- virtual QAbstractSeries* series();
- virtual QObject* relatedObject();
-
-public Q_SLOTS:
- virtual void updated();
-
-private:
- QXYLegendMarker *q_ptr;
- QXYSeries *m_series;
-
- Q_DECLARE_PUBLIC(QXYLegendMarker)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QXYLEGENDMARKER_P_H
diff --git a/src/linechart/linechartitem.cpp b/src/linechart/linechartitem.cpp
deleted file mode 100644
index da7c0c50..00000000
--- a/src/linechart/linechartitem.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "linechartitem_p.h"
-#include "qlineseries.h"
-#include "qlineseries_p.h"
-#include "chartpresenter_p.h"
-#include "polardomain_p.h"
-#include "chartthememanager_p.h"
-#include "charttheme_p.h"
-#include <QPainter>
-#include <QGraphicsSceneMouseEvent>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-const qreal mouseEventMinWidth(12);
-
-LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item)
- : XYChart(series,item),
- m_series(series),
- m_pointsVisible(false),
- m_chartType(QChart::ChartTypeUndefined),
- m_pointLabelsVisible(false),
- m_pointLabelsFormat(series->pointLabelsFormat()),
- m_pointLabelsFont(series->pointLabelsFont()),
- m_pointLabelsColor(series->pointLabelsColor())
-{
- setAcceptHoverEvents(true);
- setZValue(ChartPresenter::LineChartZValue);
- QObject::connect(series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
- this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
- this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
- handleUpdated();
-}
-
-QRectF LineChartItem::boundingRect() const
-{
- return m_rect;
-}
-
-QPainterPath LineChartItem::shape() const
-{
- return m_shapePath;
-}
-
-void LineChartItem::updateGeometry()
-{
- m_points = geometryPoints();
- const QVector<QPointF> &points = m_points;
-
- if (points.size() == 0) {
- prepareGeometryChange();
- m_fullPath = QPainterPath();
- m_linePath = QPainterPath();
- m_rect = QRect();
- return;
- }
-
- QPainterPath linePath;
- QPainterPath fullPath;
- // Use worst case scenario to determine required margin.
- qreal margin = m_linePen.width() * 1.42;
-
- // Area series use component line series that aren't necessarily added to the chart themselves,
- // so check if chart type is forced before trying to obtain it from the chart.
- QChart::ChartType chartType = m_chartType;
- if (chartType == QChart::ChartTypeUndefined)
- chartType = m_series->chart()->chartType();
-
- // For polar charts, we need special handling for angular (horizontal)
- // points that are off-grid.
- if (chartType == QChart::ChartTypePolar) {
- QPainterPath linePathLeft;
- QPainterPath linePathRight;
- QPainterPath *currentSegmentPath = 0;
- QPainterPath *previousSegmentPath = 0;
- qreal minX = domain()->minX();
- qreal maxX = domain()->maxX();
- qreal minY = domain()->minY();
- QPointF currentSeriesPoint = m_series->at(0);
- QPointF currentGeometryPoint = points.at(0);
- QPointF previousGeometryPoint = points.at(0);
- int size = m_linePen.width();
- bool pointOffGrid = false;
- bool previousPointWasOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
-
- qreal domainRadius = domain()->size().height() / 2.0;
- const QPointF centerPoint(domainRadius, domainRadius);
-
- if (!previousPointWasOffGrid) {
- fullPath.moveTo(points.at(0));
- if (m_pointsVisible && currentSeriesPoint.y() >= minY) {
- // Do not draw ellipses for points below minimum Y.
- linePath.addEllipse(points.at(0), size, size);
- fullPath.addEllipse(points.at(0), size, size);
- linePath.moveTo(points.at(0));
- fullPath.moveTo(points.at(0));
- }
- }
-
- qreal leftMarginLine = centerPoint.x() - margin;
- qreal rightMarginLine = centerPoint.x() + margin;
- qreal horizontal = centerPoint.y();
-
- // See ScatterChartItem::updateGeometry() for explanation why seriesLastIndex is needed
- const int seriesLastIndex = m_series->count() - 1;
-
- for (int i = 1; i < points.size(); i++) {
- // Interpolating line fragments would be ugly when thick pen is used,
- // so we work around it by utilizing three separate
- // paths for line segments and clip those with custom regions at paint time.
- // "Right" path contains segments that cross the axis line with visible point on the
- // right side of the axis line, as well as segments that have one point within the margin
- // on the right side of the axis line and another point on the right side of the chart.
- // "Left" path contains points with similarly on the left side.
- // "Full" path contains rest of the points.
- // This doesn't yield perfect results always. E.g. when segment covers more than 90
- // degrees and both of the points are within the margin, one in the top half and one in the
- // bottom half of the chart, the bottom one gets clipped incorrectly.
- // However, this should be rare occurrence in any sensible chart.
- currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
- currentGeometryPoint = points.at(i);
- pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
-
- // Draw something unless both off-grid
- if (!pointOffGrid || !previousPointWasOffGrid) {
- QPointF intersectionPoint;
- qreal y;
- if (pointOffGrid != previousPointWasOffGrid) {
- if (currentGeometryPoint.x() == previousGeometryPoint.x()) {
- y = currentGeometryPoint.y() + (currentGeometryPoint.y() - previousGeometryPoint.y()) / 2.0;
- } else {
- qreal ratio = (centerPoint.x() - currentGeometryPoint.x()) / (currentGeometryPoint.x() - previousGeometryPoint.x());
- y = currentGeometryPoint.y() + (currentGeometryPoint.y() - previousGeometryPoint.y()) * ratio;
- }
- intersectionPoint = QPointF(centerPoint.x(), y);
- }
-
- bool dummyOk; // We know points are ok, but this is needed
- qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
- qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
-
- if ((qAbs(currentAngle - previousAngle) > 180.0)) {
- // If the angle between two points is over 180 degrees (half X range),
- // any direct segment between them becomes meaningless.
- // In this case two line segments are drawn instead, from previous
- // point to the center and from center to current point.
- if ((previousAngle < 0.0 || (previousAngle <= 180.0 && previousGeometryPoint.x() < rightMarginLine))
- && previousGeometryPoint.y() < horizontal) {
- currentSegmentPath = &linePathRight;
- } else if ((previousAngle > 360.0 || (previousAngle > 180.0 && previousGeometryPoint.x() > leftMarginLine))
- && previousGeometryPoint.y() < horizontal) {
- currentSegmentPath = &linePathLeft;
- } else if (previousAngle > 0.0 && previousAngle < 360.0) {
- currentSegmentPath = &linePath;
- } else {
- currentSegmentPath = 0;
- }
-
- if (currentSegmentPath) {
- if (previousSegmentPath != currentSegmentPath)
- currentSegmentPath->moveTo(previousGeometryPoint);
- if (previousPointWasOffGrid)
- fullPath.moveTo(intersectionPoint);
-
- currentSegmentPath->lineTo(centerPoint);
- fullPath.lineTo(centerPoint);
- }
-
- previousSegmentPath = currentSegmentPath;
-
- if ((currentAngle < 0.0 || (currentAngle <= 180.0 && currentGeometryPoint.x() < rightMarginLine))
- && currentGeometryPoint.y() < horizontal) {
- currentSegmentPath = &linePathRight;
- } else if ((currentAngle > 360.0 || (currentAngle > 180.0 &&currentGeometryPoint.x() > leftMarginLine))
- && currentGeometryPoint.y() < horizontal) {
- currentSegmentPath = &linePathLeft;
- } else if (currentAngle > 0.0 && currentAngle < 360.0) {
- currentSegmentPath = &linePath;
- } else {
- currentSegmentPath = 0;
- }
-
- if (currentSegmentPath) {
- if (previousSegmentPath != currentSegmentPath)
- currentSegmentPath->moveTo(centerPoint);
- if (!previousSegmentPath)
- fullPath.moveTo(centerPoint);
-
- currentSegmentPath->lineTo(currentGeometryPoint);
- if (pointOffGrid)
- fullPath.lineTo(intersectionPoint);
- else
- fullPath.lineTo(currentGeometryPoint);
- }
- } else {
- if (previousAngle < 0.0 || currentAngle < 0.0
- || ((previousAngle <= 180.0 && currentAngle <= 180.0)
- && ((previousGeometryPoint.x() < rightMarginLine && previousGeometryPoint.y() < horizontal)
- || (currentGeometryPoint.x() < rightMarginLine && currentGeometryPoint.y() < horizontal)))) {
- currentSegmentPath = &linePathRight;
- } else if (previousAngle > 360.0 || currentAngle > 360.0
- || ((previousAngle > 180.0 && currentAngle > 180.0)
- && ((previousGeometryPoint.x() > leftMarginLine && previousGeometryPoint.y() < horizontal)
- || (currentGeometryPoint.x() > leftMarginLine && currentGeometryPoint.y() < horizontal)))) {
- currentSegmentPath = &linePathLeft;
- } else {
- currentSegmentPath = &linePath;
- }
-
- if (currentSegmentPath != previousSegmentPath)
- currentSegmentPath->moveTo(previousGeometryPoint);
- if (previousPointWasOffGrid)
- fullPath.moveTo(intersectionPoint);
-
- if (pointOffGrid)
- fullPath.lineTo(intersectionPoint);
- else
- fullPath.lineTo(currentGeometryPoint);
- currentSegmentPath->lineTo(currentGeometryPoint);
- }
- } else {
- currentSegmentPath = 0;
- }
-
- previousPointWasOffGrid = pointOffGrid;
- if (m_pointsVisible && !pointOffGrid && currentSeriesPoint.y() >= minY) {
- linePath.addEllipse(points.at(i), size, size);
- fullPath.addEllipse(points.at(i), size, size);
- linePath.moveTo(points.at(i));
- fullPath.moveTo(points.at(i));
- }
- previousSegmentPath = currentSegmentPath;
- previousGeometryPoint = currentGeometryPoint;
- }
- m_linePathPolarRight = linePathRight;
- m_linePathPolarLeft = linePathLeft;
- // Note: This construction of m_fullpath is not perfect. The partial segments that are
- // outside left/right clip regions at axis boundary still generate hover/click events,
- // because shape doesn't get clipped. It doesn't seem possible to do sensibly.
- } else { // not polar
- linePath.moveTo(points.at(0));
- if (m_pointsVisible) {
- int size = m_linePen.width();
- linePath.addEllipse(points.at(0), size, size);
- linePath.moveTo(points.at(0));
- for (int i = 1; i < points.size(); i++) {
- linePath.lineTo(points.at(i));
- linePath.addEllipse(points.at(i), size, size);
- linePath.moveTo(points.at(i));
- }
- } else {
- for (int i = 1; i < points.size(); i++)
- linePath.lineTo(points.at(i));
- }
- fullPath = linePath;
- }
-
- QPainterPathStroker stroker;
- // QPainter::drawLine does not respect join styles, for example BevelJoin becomes MiterJoin.
- // This is why we are prepared for the "worst case" scenario, i.e. use always MiterJoin and
- // multiply line width with square root of two when defining shape and bounding rectangle.
- stroker.setWidth(margin);
- stroker.setJoinStyle(Qt::MiterJoin);
- stroker.setCapStyle(Qt::SquareCap);
- stroker.setMiterLimit(m_linePen.miterLimit());
-
- QPainterPath checkShapePath = stroker.createStroke(fullPath);
-
- // Only zoom in if the bounding rects of the paths fit inside int limits. QWidget::update() uses
- // a region that has to be compatible with QRect.
- if (checkShapePath.boundingRect().height() <= INT_MAX
- && checkShapePath.boundingRect().width() <= INT_MAX
- && linePath.boundingRect().height() <= INT_MAX
- && linePath.boundingRect().width() <= INT_MAX
- && fullPath.boundingRect().height() <= INT_MAX
- && fullPath.boundingRect().width() <= INT_MAX) {
- prepareGeometryChange();
-
- m_linePath = linePath;
- m_fullPath = fullPath;
- m_shapePath = checkShapePath;
-
- m_rect = m_shapePath.boundingRect();
- } else {
- update();
- }
-}
-
-void LineChartItem::handleUpdated()
-{
- // If points visibility has changed, a geometry update is needed.
- // Also, if pen changes when points are visible, geometry update is needed.
- bool doGeometryUpdate =
- (m_pointsVisible != m_series->pointsVisible())
- || (m_series->pointsVisible() && (m_linePen != m_series->pen()));
- setVisible(m_series->isVisible());
- setOpacity(m_series->opacity());
- m_pointsVisible = m_series->pointsVisible();
- m_linePen = m_series->pen();
- m_pointLabelsFormat = m_series->pointLabelsFormat();
- m_pointLabelsVisible = m_series->pointLabelsVisible();
- m_pointLabelsFont = m_series->pointLabelsFont();
- m_pointLabelsColor = m_series->pointLabelsColor();
- if (doGeometryUpdate)
- updateGeometry();
- update();
-}
-
-void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(widget)
- Q_UNUSED(option)
-
- QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
-
- painter->save();
- painter->setPen(m_linePen);
- bool alwaysUsePath = false;
-
- if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
- qreal halfWidth = domain()->size().width() / 2.0;
- QRectF clipRectLeft = QRectF(0, 0, halfWidth, domain()->size().height());
- QRectF clipRectRight = QRectF(halfWidth, 0, halfWidth, domain()->size().height());
- QRegion fullPolarClipRegion(clipRect.toRect(), QRegion::Ellipse);
- QRegion clipRegionLeft(fullPolarClipRegion.intersected(clipRectLeft.toRect()));
- QRegion clipRegionRight(fullPolarClipRegion.intersected(clipRectRight.toRect()));
- painter->setClipRegion(clipRegionLeft);
- painter->drawPath(m_linePathPolarLeft);
- painter->setClipRegion(clipRegionRight);
- painter->drawPath(m_linePathPolarRight);
- painter->setClipRegion(fullPolarClipRegion);
- alwaysUsePath = true; // required for proper clipping
- } else {
- painter->setClipRect(clipRect);
- }
-
- if (m_pointsVisible) {
- painter->setBrush(m_linePen.color());
- painter->drawPath(m_linePath);
- } else {
- painter->setBrush(QBrush(Qt::NoBrush));
- if (m_linePen.style() != Qt::SolidLine || alwaysUsePath) {
- // If pen style is not solid line, always fall back to path painting
- // to ensure proper continuity of the pattern
- painter->drawPath(m_linePath);
- } else {
- for (int i(1); i < m_points.size(); i++)
- painter->drawLine(m_points.at(i - 1), m_points.at(i));
- }
- }
-
- if (m_pointLabelsVisible)
- m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2);
-
- painter->restore();
-
-}
-
-void LineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- emit XYChart::clicked(domain()->calculateDomainPoint(event->pos()));
- QGraphicsItem::mousePressEvent(event);
-}
-
-void LineChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
-{
- emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), true);
-// event->accept();
- QGraphicsItem::hoverEnterEvent(event);
-}
-
-void LineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
-{
- emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), false);
-// event->accept();
- QGraphicsItem::hoverEnterEvent(event);
-}
-
-#include "moc_linechartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/linechart/linechartitem_p.h b/src/linechart/linechartitem_p.h
deleted file mode 100644
index f1272478..00000000
--- a/src/linechart/linechartitem_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef LINECHARTITEM_H
-#define LINECHARTITEM_H
-
-#include "qchartglobal.h"
-#include "xychart_p.h"
-#include "qchart.h"
-#include <QPen>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLineSeries;
-class ChartPresenter;
-
-class LineChartItem : public XYChart
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsItem)
-public:
- explicit LineChartItem(QLineSeries *series, QGraphicsItem *item = 0);
- ~LineChartItem() {}
-
- //from QGraphicsItem
- QRectF boundingRect() const;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
- QPainterPath shape() const;
-
- QPainterPath path() const { return m_fullPath; }
-
-public Q_SLOTS:
- void handleUpdated();
-
-protected:
- void updateGeometry();
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
- void suppressPoints() { m_pointsVisible = false; }
- void forceChartType(QChart::ChartType chartType) { m_chartType = chartType; }
-
-private:
- QLineSeries *m_series;
- QPainterPath m_linePath;
- QPainterPath m_linePathPolarRight;
- QPainterPath m_linePathPolarLeft;
- QPainterPath m_fullPath;
- QPainterPath m_shapePath;
-
- QVector<QPointF> m_points;
- QRectF m_rect;
- QPen m_linePen;
- bool m_pointsVisible;
- QChart::ChartType m_chartType;
-
- bool m_pointLabelsVisible;
- QString m_pointLabelsFormat;
- QFont m_pointLabelsFont;
- QColor m_pointLabelsColor;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/linechart/qlineseries.cpp b/src/linechart/qlineseries.cpp
deleted file mode 100644
index 6fe7719d..00000000
--- a/src/linechart/qlineseries.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlineseries.h"
-#include "qlineseries_p.h"
-#include "linechartitem_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "qchart_p.h"
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QLineSeries
- \inmodule Qt Charts
- \brief The QLineSeries class is used for making line charts.
-
- \mainclass
-
- A line chart is used to show information as a series of data points
- connected by straight lines.
-
- \image examples_linechart.png
-
- Creating basic line chart is simple:
- \code
- QLineSeries* series = new QLineSeries();
- series->append(0, 6);
- series->append(2, 4);
- ...
- chart->addSeries(series);
- \endcode
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype LineSeries
- \instantiates QLineSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/lineseries.qdocinc
-*/
-#else
-/*!
- \qmlclass LineSeries QLineSeries
-
- \include ../doc/src/lineseries.qdocinc
-*/
-#endif
-
-/*!
- \fn virtual SeriesType QLineSeries::type() const
- \brief Returns type of series.
- \sa QAbstractSeries, SeriesType
-*/
-
-/*!
- \qmlproperty real LineSeries::width
- The width of the line. By default the width is 2.0.
-*/
-
-/*!
- \qmlproperty Qt::PenStyle LineSeries::style
- Controls the style of the line. Set to one of Qt.NoPen, Qt.SolidLine, Qt.DashLine, Qt.DotLine,
- Qt.DashDotLine or Qt.DashDotDotLine. Using Qt.CustomDashLine is not supported in the QML API.
- By default the style is Qt.SolidLine.
-*/
-
-/*!
- \qmlproperty Qt::PenCapStyle LineSeries::capStyle
- Controls the cap style of the line. Set to one of Qt.FlatCap, Qt.SquareCap or Qt.RoundCap. By
- default the cap style is Qt.SquareCap.
-*/
-
-/*!
- Constructs empty series object which is a child of \a parent.
- When series object is added to QChartView or QChart instance ownerships is transferred.
-*/
-QLineSeries::QLineSeries(QObject *parent)
- : QXYSeries(*new QLineSeriesPrivate(this), parent)
-{
-
-}
-
-/*!
- \internal
-*/
-QLineSeries::QLineSeries(QLineSeriesPrivate &d, QObject *parent)
- : QXYSeries(d, parent)
-{
-
-}
-/*!
- Destroys the object. Series added to QChartView or QChart instances are owned by those,
- and are deleted when mentioned object are destroyed.
-*/
-QLineSeries::~QLineSeries()
-{
- Q_D(QLineSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-
-QAbstractSeries::SeriesType QLineSeries::type() const
-{
- return QAbstractSeries::SeriesTypeLine;
-}
-
-/*
-QDebug operator<< (QDebug debug, const QLineSeries series)
-{
- Q_ASSERT(series.d_func()->m_x.size() == series.d_func()->m_y.size());
- int size = series.d_func()->m_x.size();
- for (int i=0; i<size; i++) {
- debug.nospace() << "(" << series.d_func()->m_x.at(i) << ','<< series.d_func()->m_y.at(i) << ") ";
- }
- return debug.space();
-}
-*/
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QLineSeriesPrivate::QLineSeriesPrivate(QLineSeries *q)
- : QXYSeriesPrivate(q)
-{
-
-};
-
-void QLineSeriesPrivate::initializeGraphics(QGraphicsItem *parent)
-{
- Q_Q(QLineSeries);
- LineChartItem *line = new LineChartItem(q,parent);
- m_item.reset(line);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-void QLineSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
-{
- Q_Q(QLineSeries);
- const QList<QColor> colors = theme->seriesColors();
-
- if (forced || QChartPrivate::defaultPen() == m_pen) {
- QPen pen;
- pen.setColor(colors.at(index % colors.size()));
- pen.setWidthF(2);
- q->setPen(pen);
- }
-
- if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
- QColor color = theme->labelBrush().color();
- q->setPointLabelsColor(color);
- }
-}
-
-#include "moc_qlineseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/linechart/qlineseries.h b/src/linechart/qlineseries.h
deleted file mode 100644
index 04d6c689..00000000
--- a/src/linechart/qlineseries.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLINESERIES_H
-#define QLINESERIES_H
-
-#include <qchartglobal.h>
-#include <qxyseries.h>
-#include <QPen>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLineSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QLineSeries : public QXYSeries
-{
- Q_OBJECT
-
-public:
- explicit QLineSeries(QObject *parent = 0);
- ~QLineSeries();
- QAbstractSeries::SeriesType type() const;
-
-protected:
- QLineSeries(QLineSeriesPrivate &d, QObject *parent = 0);
-
-private:
- Q_DECLARE_PRIVATE(QLineSeries)
- Q_DISABLE_COPY(QLineSeries)
- friend class LineChartItem;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QLINESERIES_H
diff --git a/src/linechart/qlineseries_p.h b/src/linechart/qlineseries_p.h
deleted file mode 100644
index f6d3ce52..00000000
--- a/src/linechart/qlineseries_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QLINESERIES_P_H
-#define QLINESERIES_P_H
-
-#include "qxyseries_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-
-class QLineSeriesPrivate: public QXYSeriesPrivate
-{
-public:
- QLineSeriesPrivate(QLineSeries *q);
- void initializeGraphics(QGraphicsItem* parent);
- void initializeTheme(int index, ChartTheme* theme, bool forced = false);
-
-private:
- Q_DECLARE_PUBLIC(QLineSeries);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/piechart/piechartitem.cpp b/src/piechart/piechartitem.cpp
deleted file mode 100644
index 0ce390af..00000000
--- a/src/piechart/piechartitem.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "piechartitem_p.h"
-#include "piesliceitem_p.h"
-#include "qpieslice.h"
-#include "qpieslice_p.h"
-#include "qpieseries.h"
-#include "qpieseries_p.h"
-#include "chartpresenter_p.h"
-#include "chartdataset_p.h"
-#include "pieanimation_p.h"
-#include <QPainter>
-#include <QTimer>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PieChartItem::PieChartItem(QPieSeries *series, QGraphicsItem* item)
- : ChartItem(series->d_func(),item),
- m_series(series),
- m_animation(0)
-{
- Q_ASSERT(series);
-
- QPieSeriesPrivate *p = QPieSeriesPrivate::fromSeries(series);
- connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
- connect(series, SIGNAL(opacityChanged()), this, SLOT(handleOpacityChanged()));
- connect(series, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleSlicesAdded(QList<QPieSlice*>)));
- connect(series, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleSlicesRemoved(QList<QPieSlice*>)));
- connect(p, SIGNAL(horizontalPositionChanged()), this, SLOT(updateLayout()));
- connect(p, SIGNAL(verticalPositionChanged()), this, SLOT(updateLayout()));
- connect(p, SIGNAL(pieSizeChanged()), this, SLOT(updateLayout()));
- connect(p, SIGNAL(calculatedDataChanged()), this, SLOT(updateLayout()));
-
- // Note: the following does not affect as long as the item does not have anything to paint
- setZValue(ChartPresenter::PieSeriesZValue);
-
- // Note: will not create slice items until we have a proper rectangle to draw on.
-}
-
-PieChartItem::~PieChartItem()
-{
- // slices deleted automatically through QGraphicsItem
- if (m_series) {
- m_series->disconnect(this);
- QPieSeriesPrivate::fromSeries(m_series)->disconnect(this);
- }
- foreach (QPieSlice *slice, m_sliceItems.keys()) {
- slice->disconnect(this);
- QPieSlicePrivate::fromSlice(slice)->disconnect(this);
- }
-}
-
-void PieChartItem::setAnimation(PieAnimation *animation)
-{
- m_animation = animation;
-}
-
-ChartAnimation *PieChartItem::animation() const
-{
- return m_animation;
-}
-
-void PieChartItem::handleDomainUpdated()
-{
- QRectF rect(QPointF(0,0),domain()->size());
- if(m_rect!=rect){
- prepareGeometryChange();
- m_rect = rect;
- updateLayout();
-
- if (m_sliceItems.isEmpty())
- handleSlicesAdded(m_series->slices());
- }
-}
-
-void PieChartItem::updateLayout()
-{
- // find pie center coordinates
- m_pieCenter.setX(m_rect.left() + (m_rect.width() * m_series->horizontalPosition()));
- m_pieCenter.setY(m_rect.top() + (m_rect.height() * m_series->verticalPosition()));
-
- // find maximum radius for pie
- m_pieRadius = m_rect.height() / 2;
- if (m_rect.width() < m_rect.height())
- m_pieRadius = m_rect.width() / 2;
-
- m_holeSize = m_pieRadius;
- // apply size factor
- m_pieRadius *= m_series->pieSize();
- m_holeSize *= m_series->holeSize();
-
- // set layouts for existing slice items
- foreach (QPieSlice *slice, m_series->slices()) {
- PieSliceItem *sliceItem = m_sliceItems.value(slice);
- if (sliceItem) {
- PieSliceData sliceData = updateSliceGeometry(slice);
- if (m_animation)
- presenter()->startAnimation(m_animation->updateValue(sliceItem, sliceData));
- else
- sliceItem->setLayout(sliceData);
- }
- }
-
- update();
-}
-
-void PieChartItem::handleSlicesAdded(QList<QPieSlice *> slices)
-{
- // delay creating slice items until there is a proper rectangle
- if (!m_rect.isValid() && m_sliceItems.isEmpty())
- return;
-
- themeManager()->updateSeries(m_series);
-
- bool startupAnimation = m_sliceItems.isEmpty();
-
- foreach(QPieSlice * slice, slices) {
- PieSliceItem *sliceItem = new PieSliceItem(this);
- m_sliceItems.insert(slice, sliceItem);
-
- // Note: no need to connect to slice valueChanged() etc.
- // This is handled through calculatedDataChanged signal.
- connect(slice, SIGNAL(labelChanged()), this, SLOT(handleSliceChanged()));
- connect(slice, SIGNAL(labelVisibleChanged()), this, SLOT(handleSliceChanged()));
- connect(slice, SIGNAL(penChanged()), this, SLOT(handleSliceChanged()));
- connect(slice, SIGNAL(brushChanged()), this, SLOT(handleSliceChanged()));
- connect(slice, SIGNAL(labelBrushChanged()), this, SLOT(handleSliceChanged()));
- connect(slice, SIGNAL(labelFontChanged()), this, SLOT(handleSliceChanged()));
-
- QPieSlicePrivate *p = QPieSlicePrivate::fromSlice(slice);
- connect(p, SIGNAL(labelPositionChanged()), this, SLOT(handleSliceChanged()));
- connect(p, SIGNAL(explodedChanged()), this, SLOT(handleSliceChanged()));
- connect(p, SIGNAL(labelArmLengthFactorChanged()), this, SLOT(handleSliceChanged()));
- connect(p, SIGNAL(explodeDistanceFactorChanged()), this, SLOT(handleSliceChanged()));
-
- connect(sliceItem, SIGNAL(clicked(Qt::MouseButtons)), slice, SIGNAL(clicked()));
- connect(sliceItem, SIGNAL(hovered(bool)), slice, SIGNAL(hovered(bool)));
-
- PieSliceData sliceData = updateSliceGeometry(slice);
- if (m_animation)
- presenter()->startAnimation(m_animation->addSlice(sliceItem, sliceData, startupAnimation));
- else
- sliceItem->setLayout(sliceData);
- }
-}
-
-void PieChartItem::handleSlicesRemoved(QList<QPieSlice *> slices)
-{
- themeManager()->updateSeries(m_series);
-
- foreach (QPieSlice *slice, slices) {
-
- PieSliceItem *sliceItem = m_sliceItems.value(slice);
-
- // this can happen if you call append() & remove() in a row so that PieSliceItem is not even created
- if (!sliceItem)
- continue;
-
- m_sliceItems.remove(slice);
- slice->disconnect(this);
- QPieSlicePrivate::fromSlice(slice)->disconnect(this);
-
- if (m_animation)
- presenter()->startAnimation(m_animation->removeSlice(sliceItem)); // animator deletes the PieSliceItem
- else
- delete sliceItem;
- }
-}
-
-void PieChartItem::handleSliceChanged()
-{
- QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
- if (!slice) {
- QPieSlicePrivate *slicep = qobject_cast<QPieSlicePrivate *>(sender());
- slice = slicep->q_ptr;
- }
- Q_ASSERT(m_sliceItems.contains(slice));
-
- PieSliceItem *sliceItem = m_sliceItems.value(slice);
- PieSliceData sliceData = updateSliceGeometry(slice);
- if (m_animation)
- presenter()->startAnimation(m_animation->updateValue(sliceItem, sliceData));
- else
- sliceItem->setLayout(sliceData);
-
- update();
-}
-
-void PieChartItem::handleSeriesVisibleChanged()
-{
- setVisible(m_series->isVisible());
-}
-
-void PieChartItem::handleOpacityChanged()
-{
- setOpacity(m_series->opacity());
-}
-
-PieSliceData PieChartItem::updateSliceGeometry(QPieSlice *slice)
-{
- PieSliceData &sliceData = QPieSlicePrivate::fromSlice(slice)->m_data;
- sliceData.m_center = PieSliceItem::sliceCenter(m_pieCenter, m_pieRadius, slice);
- sliceData.m_radius = m_pieRadius;
- sliceData.m_holeRadius = m_holeSize;
- return sliceData;
-}
-
-#include "moc_piechartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/piechart/piechartitem_p.h b/src/piechart/piechartitem_p.h
deleted file mode 100644
index 907a017a..00000000
--- a/src/piechart/piechartitem_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef PIECHARTITEM_H
-#define PIECHARTITEM_H
-
-#include "qpieseries.h"
-#include "chartitem_p.h"
-#include "piesliceitem_p.h"
-#include <QPointer>
-
-class QGraphicsItem;
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QPieSlice;
-class ChartPresenter;
-class PieAnimation;
-
-class PieChartItem : public ChartItem
-{
- Q_OBJECT
-
-public:
- explicit PieChartItem(QPieSeries *series, QGraphicsItem* item = 0);
- ~PieChartItem();
-
- // from QGraphicsItem
- QRectF boundingRect() const { return m_rect; }
- void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {}
-
-public Q_SLOTS:
- // from Chart
- virtual void handleDomainUpdated();
-
- void updateLayout();
- void handleSlicesAdded(QList<QPieSlice *> slices);
- void handleSlicesRemoved(QList<QPieSlice *> slices);
- void handleSliceChanged();
- void handleSeriesVisibleChanged();
- void handleOpacityChanged();
-
- void setAnimation(PieAnimation *animation);
- ChartAnimation *animation() const;
-
-private:
- PieSliceData updateSliceGeometry(QPieSlice *slice);
-
-private:
- QHash<QPieSlice *, PieSliceItem *> m_sliceItems;
- QPointer<QPieSeries> m_series;
- QRectF m_rect;
- QPointF m_pieCenter;
- qreal m_pieRadius;
- qreal m_holeSize;
- PieAnimation *m_animation;
-
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // PIECHARTITEM_H
diff --git a/src/piechart/pieslicedata_p.h b/src/piechart/pieslicedata_p.h
deleted file mode 100644
index 39c0c615..00000000
--- a/src/piechart/pieslicedata_p.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef PIESLICEDATA_P_H
-#define PIESLICEDATA_P_H
-
-#include "qchartglobal.h"
-#include "qpieslice.h"
-#include <QPen>
-#include <QBrush>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-template <class T>
-class Themed : public T
-{
-public:
- Themed(): m_isThemed(true) {}
-
- inline T &operator=(const T &other) { return T::operator =(other); }
-
- inline bool operator!=(const T &other) const { return T::operator !=(other); }
- inline bool operator!=(const Themed &other) const
- {
- if (T::operator !=(other))
- return true;
-
- if (m_isThemed != other.m_isThemed)
- return true;
-
- return false;
- }
-
- inline void setThemed(bool state) { m_isThemed = state; }
- inline bool isThemed() const { return m_isThemed; }
-
-private:
- bool m_isThemed;
-};
-
-class PieSliceData
-{
-public:
- PieSliceData() :
- m_value(0),
- m_isExploded(false),
- m_explodeDistanceFactor(0.15),
- m_isLabelVisible(false),
- m_labelPosition(QPieSlice::LabelOutside),
- m_labelArmLengthFactor(0.15),
- m_percentage(0),
- m_radius(0),
- m_startAngle(0),
- m_angleSpan(0),
- m_holeRadius(0)
- {
- }
-
- bool operator!=(const PieSliceData &other) const {
- if (!qFuzzyIsNull(m_value - other.m_value))
- return true;
-
- if (m_slicePen != other.m_slicePen ||
- m_sliceBrush != other.m_sliceBrush)
- return true;
-
- if (m_isExploded != other.m_isExploded ||
- !qFuzzyIsNull(m_explodeDistanceFactor - other.m_explodeDistanceFactor))
- return true;
-
- if (m_isLabelVisible != other.m_isLabelVisible ||
- m_labelText != other.m_labelText ||
- m_labelFont != other.m_labelFont ||
- m_labelPosition != other.m_labelPosition ||
- !qFuzzyIsNull(m_labelArmLengthFactor - other.m_labelArmLengthFactor) ||
- m_labelBrush != other.m_labelBrush)
- return true;
-
- if (!qFuzzyIsNull(m_percentage - other.m_percentage) ||
- m_center != other.m_center ||
- !qFuzzyIsNull(m_radius - other.m_radius) ||
- !qFuzzyIsNull(m_startAngle - other.m_startAngle) ||
- !qFuzzyIsNull(m_angleSpan - other.m_angleSpan))
- return true;
-
- return false;
- }
-
- qreal m_value;
-
- Themed<QPen> m_slicePen;
- Themed<QBrush> m_sliceBrush;
-
- bool m_isExploded;
- qreal m_explodeDistanceFactor;
-
- bool m_isLabelVisible;
- QString m_labelText;
- Themed<QFont> m_labelFont;
- QPieSlice::LabelPosition m_labelPosition;
- qreal m_labelArmLengthFactor;
- Themed<QBrush> m_labelBrush;
-
- qreal m_percentage;
- QPointF m_center;
- qreal m_radius;
- qreal m_startAngle;
- qreal m_angleSpan;
-
- qreal m_holeRadius;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // PIESLICEDATA_P_H
diff --git a/src/piechart/piesliceitem.cpp b/src/piechart/piesliceitem.cpp
deleted file mode 100644
index 2f3728a8..00000000
--- a/src/piechart/piesliceitem.cpp
+++ /dev/null
@@ -1,319 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "piesliceitem_p.h"
-#include "piechartitem_p.h"
-#include "qpieseries.h"
-#include "qpieslice.h"
-#include "chartpresenter_p.h"
-#include <QPainter>
-#include <qmath.h>
-#include <QGraphicsSceneEvent>
-#include <QTime>
-#include <QTextDocument>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-QPointF offset(qreal angle, qreal length)
-{
- qreal dx = qSin(angle * (M_PI / 180)) * length;
- qreal dy = qCos(angle * (M_PI / 180)) * length;
- return QPointF(dx, -dy);
-}
-
-PieSliceItem::PieSliceItem(QGraphicsItem *parent)
- : QGraphicsObject(parent),
- m_hovered(false)
-{
- setAcceptHoverEvents(true);
- setAcceptedMouseButtons(Qt::MouseButtonMask);
- setZValue(ChartPresenter::PieSeriesZValue);
- m_labelItem = new QGraphicsTextItem(this);
- m_labelItem->document()->setDocumentMargin(1.0);
-}
-
-PieSliceItem::~PieSliceItem()
-{
- // If user is hovering over the slice and it gets destroyed we do
- // not get a hover leave event. So we must emit the signal here.
- if (m_hovered)
- emit hovered(false);
-}
-
-QRectF PieSliceItem::boundingRect() const
-{
- return m_boundingRect;
-}
-
-QPainterPath PieSliceItem::shape() const
-{
- // Don't include the label and label arm.
- // This is used to detect a mouse clicks. We do not want clicks from label.
- return m_slicePath;
-}
-
-void PieSliceItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
-{
- painter->save();
- painter->setClipRect(parentItem()->boundingRect());
- painter->setPen(m_data.m_slicePen);
- painter->setBrush(m_data.m_sliceBrush);
- painter->drawPath(m_slicePath);
- painter->restore();
-
- if (m_data.m_isLabelVisible) {
- painter->save();
-
- // Pen for label arm not defined in the QPieSeries api, let's use brush's color instead
- painter->setBrush(m_data.m_labelBrush);
-
- if (m_data.m_labelPosition == QPieSlice::LabelOutside) {
- painter->setClipRect(parentItem()->boundingRect());
- painter->strokePath(m_labelArmPath, m_data.m_labelBrush.color());
- }
-
- painter->restore();
- }
-}
-
-void PieSliceItem::hoverEnterEvent(QGraphicsSceneHoverEvent * /*event*/)
-{
- m_hovered = true;
- emit hovered(true);
-}
-
-void PieSliceItem::hoverLeaveEvent(QGraphicsSceneHoverEvent * /*event*/)
-{
- m_hovered = false;
- emit hovered(false);
-}
-
-void PieSliceItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- emit clicked(event->buttons());
-}
-
-void PieSliceItem::setLayout(const PieSliceData &sliceData)
-{
- m_data = sliceData;
- updateGeometry();
- update();
-}
-
-void PieSliceItem::updateGeometry()
-{
- if (m_data.m_radius <= 0)
- return;
-
- prepareGeometryChange();
-
- // slice path
- qreal centerAngle;
- QPointF armStart;
- m_slicePath = slicePath(m_data.m_center, m_data.m_radius, m_data.m_startAngle, m_data.m_angleSpan, &centerAngle, &armStart);
-
- m_labelItem->setVisible(m_data.m_isLabelVisible);
-
- if (m_data.m_isLabelVisible) {
- // text rect
- m_labelTextRect = ChartPresenter::textBoundingRect(m_data.m_labelFont,
- m_data.m_labelText,
- 0);
-
- QString label(m_data.m_labelText);
- m_labelItem->setDefaultTextColor(m_data.m_labelBrush.color());
- m_labelItem->setFont(m_data.m_labelFont);
-
- // text position
- if (m_data.m_labelPosition == QPieSlice::LabelOutside) {
- setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
-
- // label arm path
- QPointF labelTextStart;
- m_labelArmPath = labelArmPath(armStart, centerAngle,
- m_data.m_radius * m_data.m_labelArmLengthFactor,
- m_labelTextRect.width(), &labelTextStart);
-
- m_labelTextRect.moveBottomLeft(labelTextStart);
- if (m_labelTextRect.left() < 0)
- m_labelTextRect.setLeft(0);
- else if (m_labelTextRect.left() < parentItem()->boundingRect().left())
- m_labelTextRect.setLeft(parentItem()->boundingRect().left());
- if (m_labelTextRect.right() > parentItem()->boundingRect().right())
- m_labelTextRect.setRight(parentItem()->boundingRect().right());
-
- label = ChartPresenter::truncatedText(m_data.m_labelFont, m_data.m_labelText,
- qreal(0.0), m_labelTextRect.width(),
- m_labelTextRect.height(), m_labelTextRect);
- m_labelArmPath = labelArmPath(armStart, centerAngle,
- m_data.m_radius * m_data.m_labelArmLengthFactor,
- m_labelTextRect.width(), &labelTextStart);
- m_labelTextRect.moveBottomLeft(labelTextStart);
-
- m_labelItem->setTextWidth(m_labelTextRect.width()
- + m_labelItem->document()->documentMargin());
- m_labelItem->setHtml(label);
- m_labelItem->setRotation(0);
- m_labelItem->setPos(m_labelTextRect.x(), m_labelTextRect.y() + 1.0);
- } else {
- // label inside
- setFlag(QGraphicsItem::ItemClipsChildrenToShape);
- m_labelItem->setTextWidth(m_labelTextRect.width()
- + m_labelItem->document()->documentMargin());
- m_labelItem->setHtml(label);
-
- QPointF textCenter;
- if (m_data.m_holeRadius > 0) {
- textCenter = m_data.m_center + offset(centerAngle, m_data.m_holeRadius
- + (m_data.m_radius
- - m_data.m_holeRadius) / 2);
- } else {
- textCenter = m_data.m_center + offset(centerAngle, m_data.m_radius / 2);
- }
- m_labelItem->setPos(textCenter.x() - m_labelItem->boundingRect().width() / 2,
- textCenter.y() - m_labelTextRect.height() / 2);
-
- QPointF labelCenter = m_labelItem->boundingRect().center();
- m_labelItem->setTransformOriginPoint(labelCenter);
-
- if (m_data.m_labelPosition == QPieSlice::LabelInsideTangential) {
- m_labelItem->setRotation(m_data.m_startAngle + m_data.m_angleSpan / 2);
- } else if (m_data.m_labelPosition == QPieSlice::LabelInsideNormal) {
- if (m_data.m_startAngle + m_data.m_angleSpan / 2 < 180)
- m_labelItem->setRotation(m_data.m_startAngle + m_data.m_angleSpan / 2 - 90);
- else
- m_labelItem->setRotation(m_data.m_startAngle + m_data.m_angleSpan / 2 + 90);
- } else {
- m_labelItem->setRotation(0);
- }
- }
- // Hide label if it's outside the bounding rect of parent item
- QRectF labelRect(m_labelItem->boundingRect());
- labelRect.moveTopLeft(m_labelItem->pos());
- if ((parentItem()->boundingRect().left()
- < (labelRect.left() + m_labelItem->document()->documentMargin() + 1.0))
- && (parentItem()->boundingRect().right()
- > (labelRect.right() - m_labelItem->document()->documentMargin() - 1.0))
- && (parentItem()->boundingRect().top()
- < (labelRect.top() + m_labelItem->document()->documentMargin() + 1.0))
- && (parentItem()->boundingRect().bottom()
- > (labelRect.bottom() - m_labelItem->document()->documentMargin() - 1.0)))
- m_labelItem->show();
- else
- m_labelItem->hide();
- }
-
- // bounding rect
- if (m_data.m_isLabelVisible)
- m_boundingRect = m_slicePath.boundingRect().united(m_labelArmPath.boundingRect()).united(m_labelTextRect);
- else
- m_boundingRect = m_slicePath.boundingRect();
-
- // Inflate bounding rect by 2/3 pen width to make sure it encompasses whole slice also for thick pens
- // and miter joins.
- int penWidth = (m_data.m_slicePen.width() * 2) / 3;
- m_boundingRect = m_boundingRect.adjusted(-penWidth, -penWidth, penWidth, penWidth);
-}
-
-QPointF PieSliceItem::sliceCenter(QPointF point, qreal radius, QPieSlice *slice)
-{
- if (slice->isExploded()) {
- qreal centerAngle = slice->startAngle() + (slice->angleSpan() / 2);
- qreal len = radius * slice->explodeDistanceFactor();
- point += offset(centerAngle, len);
- }
- return point;
-}
-
-QPainterPath PieSliceItem::slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart)
-{
- // calculate center angle
- *centerAngle = startAngle + (angleSpan / 2);
-
- // calculate slice rectangle
- QRectF rect(center.x() - radius, center.y() - radius, radius * 2, radius * 2);
-
- // slice path
- QPainterPath path;
- if (m_data.m_holeRadius > 0) {
- QRectF insideRect(center.x() - m_data.m_holeRadius, center.y() - m_data.m_holeRadius, m_data.m_holeRadius * 2, m_data.m_holeRadius * 2);
- path.arcMoveTo(rect, -startAngle + 90);
- path.arcTo(rect, -startAngle + 90, -angleSpan);
- path.arcTo(insideRect, -startAngle + 90 - angleSpan, angleSpan);
- path.closeSubpath();
- } else {
- path.moveTo(rect.center());
- path.arcTo(rect, -startAngle + 90, -angleSpan);
- path.closeSubpath();
- }
-
- // calculate label arm start point
- *armStart = center;
- *armStart += offset(*centerAngle, radius + PIESLICE_LABEL_GAP);
-
- return path;
-}
-
-QPainterPath PieSliceItem::labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart)
-{
- // Normalize the angle to 0-360 range
- // NOTE: We are using int here on purpose. Depenging on platform and hardware
- // qreal can be a double, float or something the user gives to the Qt configure
- // (QT_COORD_TYPE). Compilers do not seem to support modulo for double or float
- // but there are fmod() and fmodf() functions for that. So instead of some #ifdef
- // that might break we just use int. Precision for this is just fine for our needs.
- int normalized = angle * 10.0;
- normalized = normalized % 3600;
- if (normalized < 0)
- normalized += 3600;
- angle = (qreal) normalized / 10.0;
-
- // prevent label arm pointing straight down because it will look bad
- if (angle < 180 && angle > 170)
- angle = 170;
- if (angle > 180 && angle < 190)
- angle = 190;
-
- // line from slice to label
- QPointF parm1 = start + offset(angle, length);
-
- // line to underline the label
- QPointF parm2 = parm1;
- if (angle < 180) { // arm swings the other way on the left side
- parm2 += QPointF(textWidth, 0);
- *textStart = parm1;
- } else {
- parm2 += QPointF(-textWidth, 0);
- *textStart = parm2;
- }
-
- QPainterPath path;
- path.moveTo(start);
- path.lineTo(parm1);
- path.lineTo(parm2);
-
- return path;
-}
-
-#include "moc_piesliceitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
diff --git a/src/piechart/piesliceitem_p.h b/src/piechart/piesliceitem_p.h
deleted file mode 100644
index fdca38a2..00000000
--- a/src/piechart/piesliceitem_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef PIESLICEITEM_H
-#define PIESLICEITEM_H
-
-#include "qchartglobal.h"
-#include "charttheme_p.h"
-#include "qpieseries.h"
-#include "pieslicedata_p.h"
-#include <QGraphicsItem>
-#include <QRectF>
-#include <QColor>
-#include <QPen>
-
-#define PIESLICE_LABEL_GAP 5
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class PieChartItem;
-class PieSliceLabel;
-class QPieSlice;
-
-class PieSliceItem : public QGraphicsObject
-{
- Q_OBJECT
-
-public:
- PieSliceItem(QGraphicsItem *parent = 0);
- ~PieSliceItem();
-
- // from QGraphicsItem
- QRectF boundingRect() const;
- QPainterPath shape() const;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
-
- void setLayout(const PieSliceData &sliceData);
- static QPointF sliceCenter(QPointF point, qreal radius, QPieSlice *slice);
-
-Q_SIGNALS:
- void clicked(Qt::MouseButtons buttons);
- void hovered(bool state);
-
-private:
- void updateGeometry();
- QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart);
- QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart);
-
-private:
- PieSliceData m_data;
- QRectF m_boundingRect;
- QPainterPath m_slicePath;
- QPainterPath m_labelArmPath;
- QRectF m_labelTextRect;
- bool m_hovered;
- QGraphicsTextItem *m_labelItem;
-
- friend class PieSliceAnimation;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // PIESLICEITEM_H
diff --git a/src/piechart/qhpiemodelmapper.cpp b/src/piechart/qhpiemodelmapper.cpp
deleted file mode 100644
index 5369991d..00000000
--- a/src/piechart/qhpiemodelmapper.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qhpiemodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QHPieModelMapper
- \inmodule Qt Charts
- \mainclass
-
- Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
- Horizontal model mapper is used to create a connection between QPieSeries and QAbstractItemModel derived model object that keeps the consecutive pie slices data in rows.
- It is possible to use both QAbstractItemModel and QPieSeries model API. QHPieModelMapper makes sure that Pie and the model are kept in sync.
- \note Used model has to support adding/removing rows/columns and modifying the data of the cells.
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype HPieModelMapper
- \instantiates QHPieModelMapper
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/hpiemodelmapper.qdocinc
-*/
-#else
-/*!
- \qmlclass HPieModelMapper QHPieModelMapper
-
- \include ../doc/src/hpiemodelmapper.qdocinc
-*/
-#endif
-
-/*!
- \property QHPieModelMapper::series
- \brief Defines the QPieSeries object that is used by the mapper.
-
- All the data in the series is discarded when it is set to the mapper.
- When new series is specified the old series is disconnected (it preserves its data)
-*/
-/*!
- \qmlproperty PieSeries HPieModelMapper::series
- Defines the PieSeries object that is used by the mapper. If you define the mapper element as a child for a
- PieSeries, leave this property undefined. All the data in the series is discarded when it is set to the mapper.
- When new series is specified the old series is disconnected (it preserves its data).
-*/
-
-/*!
- \property QHPieModelMapper::model
- \brief Defines the model that is used by the mapper.
-*/
-/*!
- \qmlproperty SomeModel HPieModelMapper::model
- The QAbstractItemModel based model that is used by the mapper. You need to implement the model
- and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
- the data of the cells.
-*/
-
-/*!
- \property QHPieModelMapper::valuesRow
- \brief Defines which row of the model is kept in sync with the values of the pie's slices.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int HPieModelMapper::valuesRow
- Defines which row of the model is kept in sync with the values of the pie's slices. Default value is: -1 (invalid
- mapping).
-*/
-
-/*!
- \property QHPieModelMapper::labelsRow
- \brief Defines which row of the model is kept in sync with the labels of the pie's slices.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int HPieModelMapper::labelsRow
- Defines which row of the model is kept in sync with the labels of the pie's slices
- Default value is: -1 (invalid mapping)
-*/
-
-/*!
- \property QHPieModelMapper::firstColumn
- \brief Defines which column of the model contains the first slice value.
-
- Minimal and default value is: 0
-*/
-/*!
- \qmlproperty int HPieModelMapper::firstColumn
- Defines which column of the model contains the first slice value.
- The default value is 0.
-*/
-
-/*!
- \property QHPieModelMapper::columnCount
- \brief Defines the number of columns of the model that are mapped as the data for QPieSeries.
-
- Minimal and default value is: -1 (count limited by the number of columns in the model)
-*/
-/*!
- \qmlproperty int HPieModelMapper::columnCount
- Defines the number of columns of the model that are mapped as the data for QPieSeries. The default value is
- -1 (count limited by the number of columns in the model)
-*/
-
-/*!
- \fn void QHPieModelMapper::seriesReplaced()
- Emitted when the series to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QHPieModelMapper::modelReplaced()
- Emitted when the model to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QHPieModelMapper::valuesRowChanged()
- Emitted when the valuesRow has changed.
-*/
-
-/*!
- \fn void QHPieModelMapper::labelsRowChanged()
- Emitted when the labelsRow has changed.
-*/
-
-/*!
- \fn void QHPieModelMapper::firstColumnChanged()
- Emitted when the firstColumn has changed.
-*/
-
-/*!
- \fn void QHPieModelMapper::columnCountChanged()
- Emitted when the columnCount has changed.
-*/
-
-/*!
- Constructs a mapper object which is a child of \a parent.
-*/
-QHPieModelMapper::QHPieModelMapper(QObject *parent) :
- QPieModelMapper(parent)
-{
- setOrientation(Qt::Horizontal);
-}
-
-QAbstractItemModel *QHPieModelMapper::model() const
-{
- return QPieModelMapper::model();
-}
-
-void QHPieModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model != QPieModelMapper::model()) {
- QPieModelMapper::setModel(model);
- emit modelReplaced();
- }
-}
-
-QPieSeries *QHPieModelMapper::series() const
-{
- return QPieModelMapper::series();
-}
-
-void QHPieModelMapper::setSeries(QPieSeries *series)
-{
- if (series != QPieModelMapper::series()) {
- QPieModelMapper::setSeries(series);
- emit seriesReplaced();
- }
-}
-
-/*!
- Returns which row of the model is kept in sync with the values of the pie's slices
-*/
-int QHPieModelMapper::valuesRow() const
-{
- return valuesSection();
-}
-
-/*!
- Sets the model row that is kept in sync with the pie slices values.
- Parameter \a valuesRow specifies the row of the model.
-*/
-void QHPieModelMapper::setValuesRow(int valuesRow)
-{
- if (valuesRow != valuesSection()) {
- setValuesSection(valuesRow);
- emit valuesRowChanged();
- }
-}
-
-/*!
- Returns which row of the model is kept in sync with the labels of the pie's slices
-*/
-int QHPieModelMapper::labelsRow() const
-{
- return labelsSection();
-}
-
-/*!
- Sets the model row that is kept in sync with the pie's slices labels.
- Parameter \a labelsRow specifies the row of the model.
-*/
-void QHPieModelMapper::setLabelsRow(int labelsRow)
-{
- if (labelsRow != labelsSection()) {
- setLabelsSection(labelsRow);
- emit labelsRowChanged();
- }
-}
-
-int QHPieModelMapper::firstColumn() const
-{
- return first();
-}
-
-void QHPieModelMapper::setFirstColumn(int firstColumn)
-{
- if (firstColumn != first()) {
- setFirst(firstColumn);
- emit firstColumnChanged();
- }
-}
-
-int QHPieModelMapper::columnCount() const
-{
- return count();
-}
-
-void QHPieModelMapper::setColumnCount(int columnCount)
-{
- if (columnCount != count()) {
- setCount(columnCount);
- emit columnCountChanged();
- }
-}
-
-#include "moc_qhpiemodelmapper.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/piechart/qhpiemodelmapper.h b/src/piechart/qhpiemodelmapper.h
deleted file mode 100644
index ccdf2be9..00000000
--- a/src/piechart/qhpiemodelmapper.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHPIEMODELMAPPER_H
-#define QHPIEMODELMAPPER_H
-
-#include "qpiemodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_EXPORT QHPieModelMapper : public QPieModelMapper
-{
- Q_OBJECT
- Q_PROPERTY(QPieSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
- Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
- Q_PROPERTY(int valuesRow READ valuesRow WRITE setValuesRow NOTIFY valuesRowChanged)
- Q_PROPERTY(int labelsRow READ labelsRow WRITE setLabelsRow NOTIFY labelsRowChanged)
- Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged)
- Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
-
-public:
- explicit QHPieModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QPieSeries *series() const;
- void setSeries(QPieSeries *series);
-
- int valuesRow() const;
- void setValuesRow(int valuesRow);
-
- int labelsRow() const;
- void setLabelsRow(int labelsRow);
-
- int firstColumn() const;
- void setFirstColumn(int firstColumn);
-
- int columnCount() const;
- void setColumnCount(int columnCount);
-
-Q_SIGNALS:
- void seriesReplaced();
- void modelReplaced();
- void valuesRowChanged();
- void labelsRowChanged();
- void firstColumnChanged();
- void columnCountChanged();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QHPIEMODELMAPPER_H
diff --git a/src/piechart/qpiemodelmapper.cpp b/src/piechart/qpiemodelmapper.cpp
deleted file mode 100644
index dc68ca97..00000000
--- a/src/piechart/qpiemodelmapper.cpp
+++ /dev/null
@@ -1,568 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpiemodelmapper.h"
-#include "qpiemodelmapper_p.h"
-#include "qpieseries.h"
-#include "qpieslice.h"
-#include <QAbstractItemModel>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-QPieModelMapper::QPieModelMapper(QObject *parent)
- : QObject(parent),
- d_ptr(new QPieModelMapperPrivate(this))
-{
-}
-
-QAbstractItemModel *QPieModelMapper::model() const
-{
- Q_D(const QPieModelMapper);
- return d->m_model;
-}
-
-void QPieModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model == 0)
- return;
-
- Q_D(QPieModelMapper);
- if (d->m_model) {
- disconnect(d->m_model, 0, d, 0);
- }
-
- d->m_model = model;
- d->initializePieFromModel();
- // connect signals from the model
- connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
- connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
-}
-
-QPieSeries *QPieModelMapper::series() const
-{
- Q_D(const QPieModelMapper);
- return d->m_series;
-}
-
-void QPieModelMapper::setSeries(QPieSeries *series)
-{
- Q_D(QPieModelMapper);
- if (d->m_series) {
- disconnect(d->m_series, 0, d, 0);
- }
-
- if (series == 0)
- return;
-
- d->m_series = series;
- d->initializePieFromModel();
- // connect the signals from the series
- connect(d->m_series, SIGNAL(added(QList<QPieSlice*>)), d, SLOT(slicesAdded(QList<QPieSlice*>)));
- connect(d->m_series, SIGNAL(removed(QList<QPieSlice*>)), d, SLOT(slicesRemoved(QList<QPieSlice*>)));
- connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
-}
-
-/*!
- Defines which row/column of the model contains the first slice value.
- Minimal and default value is: 0
-*/
-int QPieModelMapper::first() const
-{
- Q_D(const QPieModelMapper);
- return d->m_first;
-}
-
-/*!
- Sets which row/column of the model contains the \a first slice value.
- Minimal and default value is: 0
-*/
-void QPieModelMapper::setFirst(int first)
-{
- Q_D(QPieModelMapper);
- d->m_first = qMax(first, 0);
- d->initializePieFromModel();
-}
-
-/*!
- Defines the number of rows/columns of the model that are mapped as the data for QPieSeries
- Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
-*/
-int QPieModelMapper::count() const
-{
- Q_D(const QPieModelMapper);
- return d->m_count;
-}
-
-/*!
- Defines the \a count of rows/columns of the model that are mapped as the data for QPieSeries
- Minimal and default value is: -1 (count limited by the number of rows/columns in the model)
-*/
-void QPieModelMapper::setCount(int count)
-{
- Q_D(QPieModelMapper);
- d->m_count = qMax(count, -1);
- d->initializePieFromModel();
-}
-
-/*!
- Returns the orientation that is used when QPieModelMapper accesses the model.
- This mean whether the consecutive values/labels of the pie are read from row (Qt::Horizontal)
- or from columns (Qt::Vertical)
-*/
-Qt::Orientation QPieModelMapper::orientation() const
-{
- Q_D(const QPieModelMapper);
- return d->m_orientation;
-}
-
-/*!
- Returns the \a orientation that is used when QPieModelMapper accesses the model.
- This mean whether the consecutive values/labels of the pie are read from row (Qt::Horizontal)
- or from columns (Qt::Vertical)
-*/
-void QPieModelMapper::setOrientation(Qt::Orientation orientation)
-{
- Q_D(QPieModelMapper);
- d->m_orientation = orientation;
- d->initializePieFromModel();
-}
-
-/*!
- Returns which section of the model is kept in sync with the values of the pie's slices
-*/
-int QPieModelMapper::valuesSection() const
-{
- Q_D(const QPieModelMapper);
- return d->m_valuesSection;
-}
-
-/*!
- Sets the model section that is kept in sync with the pie slices values.
- Parameter \a valuesSection specifies the section of the model.
-*/
-void QPieModelMapper::setValuesSection(int valuesSection)
-{
- Q_D(QPieModelMapper);
- d->m_valuesSection = qMax(-1, valuesSection);
- d->initializePieFromModel();
-}
-
-/*!
- Returns which section of the model is kept in sync with the labels of the pie's slices
-*/
-int QPieModelMapper::labelsSection() const
-{
- Q_D(const QPieModelMapper);
- return d->m_labelsSection;
-}
-
-/*!
- Sets the model section that is kept in sync with the pie slices labels.
- Parameter \a labelsSection specifies the section of the model.
-*/
-void QPieModelMapper::setLabelsSection(int labelsSection)
-{
- Q_D(QPieModelMapper);
- d->m_labelsSection = qMax(-1, labelsSection);
- d->initializePieFromModel();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QPieModelMapperPrivate::QPieModelMapperPrivate(QPieModelMapper *q) :
- QObject(q),
- m_series(0),
- m_model(0),
- m_first(0),
- m_count(-1),
- m_orientation(Qt::Vertical),
- m_valuesSection(-1),
- m_labelsSection(-1),
- m_seriesSignalsBlock(false),
- m_modelSignalsBlock(false),
- q_ptr(q)
-{
-}
-
-void QPieModelMapperPrivate::blockModelSignals(bool block)
-{
- m_modelSignalsBlock = block;
-}
-
-void QPieModelMapperPrivate::blockSeriesSignals(bool block)
-{
- m_seriesSignalsBlock = block;
-}
-
-
-QPieSlice *QPieModelMapperPrivate::pieSlice(QModelIndex index) const
-{
- if (!index.isValid())
- return 0; // index is invalid
-
- if (m_orientation == Qt::Vertical && (index.column() == m_valuesSection || index.column() == m_labelsSection)) {
- if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) {
- if (m_model->index(index.row(), m_valuesSection).isValid() && m_model->index(index.row(), m_labelsSection).isValid())
- return m_series->slices().at(index.row() - m_first);
- else
- return 0;
- }
- } else if (m_orientation == Qt::Horizontal && (index.row() == m_valuesSection || index.row() == m_labelsSection)) {
- if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) {
- if (m_model->index(m_valuesSection, index.column()).isValid() && m_model->index(m_labelsSection, index.column()).isValid())
- return m_series->slices().at(index.column() - m_first);
- else
- return 0;
- }
- }
- return 0; // This part of model has not been mapped to any slice
-}
-
-QModelIndex QPieModelMapperPrivate::valueModelIndex(int slicePos)
-{
- if (m_count != -1 && slicePos >= m_count)
- return QModelIndex(); // invalid
-
- if (m_orientation == Qt::Vertical)
- return m_model->index(slicePos + m_first, m_valuesSection);
- else
- return m_model->index(m_valuesSection, slicePos + m_first);
-}
-
-QModelIndex QPieModelMapperPrivate::labelModelIndex(int slicePos)
-{
- if (m_count != -1 && slicePos >= m_count)
- return QModelIndex(); // invalid
-
- if (m_orientation == Qt::Vertical)
- return m_model->index(slicePos + m_first, m_labelsSection);
- else
- return m_model->index(m_labelsSection, slicePos + m_first);
-}
-
-bool QPieModelMapperPrivate::isLabelIndex(QModelIndex index) const
-{
- if (m_orientation == Qt::Vertical && index.column() == m_labelsSection)
- return true;
- else if (m_orientation == Qt::Horizontal && index.row() == m_labelsSection)
- return true;
-
- return false;
-}
-
-bool QPieModelMapperPrivate::isValueIndex(QModelIndex index) const
-{
- if (m_orientation == Qt::Vertical && index.column() == m_valuesSection)
- return true;
- else if (m_orientation == Qt::Horizontal && index.row() == m_valuesSection)
- return true;
-
- return false;
-}
-
-void QPieModelMapperPrivate::slicesAdded(QList<QPieSlice *> slices)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (slices.count() == 0)
- return;
-
- int firstIndex = m_series->slices().indexOf(slices.at(0));
- if (firstIndex == -1)
- return;
-
- if (m_count != -1)
- m_count += slices.count();
-
- for (int i = firstIndex; i < firstIndex + slices.count(); i++) {
- m_slices.insert(i, slices.at(i - firstIndex));
- connect(slices.at(i - firstIndex), SIGNAL(labelChanged()), this, SLOT(sliceLabelChanged()));
- connect(slices.at(i - firstIndex), SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
- }
-
- blockModelSignals();
- if (m_orientation == Qt::Vertical)
- m_model->insertRows(firstIndex + m_first, slices.count());
- else
- m_model->insertColumns(firstIndex + m_first, slices.count());
-
- for (int i = firstIndex; i < firstIndex + slices.count(); i++) {
- m_model->setData(valueModelIndex(i), slices.at(i - firstIndex)->value());
- m_model->setData(labelModelIndex(i), slices.at(i - firstIndex)->label());
- }
- blockModelSignals(false);
-}
-
-void QPieModelMapperPrivate::slicesRemoved(QList<QPieSlice *> slices)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (slices.count() == 0)
- return;
-
- int firstIndex = m_slices.indexOf(slices.at(0));
- if (firstIndex == -1)
- return;
-
- if (m_count != -1)
- m_count -= slices.count();
-
- for (int i = firstIndex + slices.count() - 1; i >= firstIndex; i--)
- m_slices.removeAt(i);
-
- blockModelSignals();
- if (m_orientation == Qt::Vertical)
- m_model->removeRows(firstIndex + m_first, slices.count());
- else
- m_model->removeColumns(firstIndex + m_first, slices.count());
- blockModelSignals(false);
-}
-
-void QPieModelMapperPrivate::sliceLabelChanged()
-{
- if (m_seriesSignalsBlock)
- return;
-
- blockModelSignals();
- QPieSlice *slice = qobject_cast<QPieSlice *>(QObject::sender());
- m_model->setData(labelModelIndex(m_series->slices().indexOf(slice)), slice->label());
- blockModelSignals(false);
-}
-
-void QPieModelMapperPrivate::sliceValueChanged()
-{
- if (m_seriesSignalsBlock)
- return;
-
- blockModelSignals();
- QPieSlice *slice = qobject_cast<QPieSlice *>(QObject::sender());
- m_model->setData(valueModelIndex(m_series->slices().indexOf(slice)), slice->value());
- blockModelSignals(false);
-}
-
-void QPieModelMapperPrivate::handleSeriesDestroyed()
-{
- m_series = 0;
-}
-
-void QPieModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- QModelIndex index;
- QPieSlice *slice;
- for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
- for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
- index = topLeft.sibling(row, column);
- slice = pieSlice(index);
- if (slice) {
- if (isValueIndex(index))
- slice->setValue(m_model->data(index, Qt::DisplayRole).toReal());
- if (isLabelIndex(index))
- slice->setLabel(m_model->data(index, Qt::DisplayRole).toString());
- }
- }
- }
- blockSeriesSignals(false);
-}
-
-
-void QPieModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent);
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Vertical)
- insertData(start, end);
- else if (start <= m_valuesSection || start <= m_labelsSection) // if the changes affect the map - reinitialize the pie
- initializePieFromModel();
- blockSeriesSignals(false);
-}
-
-void QPieModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent);
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Vertical)
- removeData(start, end);
- else if (start <= m_valuesSection || start <= m_labelsSection) // if the changes affect the map - reinitialize the pie
- initializePieFromModel();
- blockSeriesSignals(false);
-}
-
-void QPieModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent);
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Horizontal)
- insertData(start, end);
- else if (start <= m_valuesSection || start <= m_labelsSection) // if the changes affect the map - reinitialize the pie
- initializePieFromModel();
- blockSeriesSignals(false);
-}
-
-void QPieModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent);
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Horizontal)
- removeData(start, end);
- else if (start <= m_valuesSection || start <= m_labelsSection) // if the changes affect the map - reinitialize the pie
- initializePieFromModel();
- blockSeriesSignals(false);
-}
-
-void QPieModelMapperPrivate::handleModelDestroyed()
-{
- m_model = 0;
-}
-
-void QPieModelMapperPrivate::insertData(int start, int end)
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- if (m_count != -1 && start >= m_first + m_count) {
- return;
- } else {
- int addedCount = end - start + 1;
- if (m_count != -1 && addedCount > m_count)
- addedCount = m_count;
- int first = qMax(start, m_first);
- int last = qMin(first + addedCount - 1, m_orientation == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1);
- for (int i = first; i <= last; i++) {
- QModelIndex valueIndex = valueModelIndex(i - m_first);
- QModelIndex labelIndex = labelModelIndex(i - m_first);
- if (valueIndex.isValid() && labelIndex.isValid()) {
- QPieSlice *slice = new QPieSlice;
- slice->setValue(m_model->data(valueIndex, Qt::DisplayRole).toDouble());
- slice->setLabel(m_model->data(labelIndex, Qt::DisplayRole).toString());
- connect(slice, SIGNAL(labelChanged()), this, SLOT(sliceLabelChanged()));
- connect(slice, SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
- m_series->insert(i - m_first, slice);
- m_slices.insert(i - m_first, slice);
- }
- }
-
- // remove excess of slices (abouve m_count)
- if (m_count != -1 && m_series->slices().size() > m_count)
- for (int i = m_series->slices().size() - 1; i >= m_count; i--) {
- m_series->remove(m_series->slices().at(i));
- m_slices.removeAt(i);
- }
- }
-}
-
-void QPieModelMapperPrivate::removeData(int start, int end)
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- int removedCount = end - start + 1;
- if (m_count != -1 && start >= m_first + m_count) {
- return;
- } else {
- int toRemove = qMin(m_series->slices().size(), removedCount); // first find how many items can actually be removed
- int first = qMax(start, m_first); // get the index of the first item that will be removed.
- int last = qMin(first + toRemove - 1, m_series->slices().size() + m_first - 1); // get the index of the last item that will be removed.
- for (int i = last; i >= first; i--) {
- m_series->remove(m_series->slices().at(i - m_first));
- m_slices.removeAt(i - m_first);
- }
-
- if (m_count != -1) {
- int itemsAvailable; // check how many are available to be added
- if (m_orientation == Qt::Vertical)
- itemsAvailable = m_model->rowCount() - m_first - m_series->slices().size();
- else
- itemsAvailable = m_model->columnCount() - m_first - m_series->slices().size();
- int toBeAdded = qMin(itemsAvailable, m_count - m_series->slices().size()); // add not more items than there is space left to be filled.
- int currentSize = m_series->slices().size();
- if (toBeAdded > 0)
- for (int i = m_series->slices().size(); i < currentSize + toBeAdded; i++) {
- QModelIndex valueIndex = valueModelIndex(i - m_first);
- QModelIndex labelIndex = labelModelIndex(i - m_first);
- if (valueIndex.isValid() && labelIndex.isValid()) {
- QPieSlice *slice = new QPieSlice;
- slice->setValue(m_model->data(valueIndex, Qt::DisplayRole).toDouble());
- slice->setLabel(m_model->data(labelIndex, Qt::DisplayRole).toString());
- m_series->insert(i, slice);
- m_slices.insert(i, slice);
- }
- }
- }
- }
-}
-
-void QPieModelMapperPrivate::initializePieFromModel()
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- blockSeriesSignals();
- // clear current content
- m_series->clear();
- m_slices.clear();
-
- // create the initial slices set
- int slicePos = 0;
- QModelIndex valueIndex = valueModelIndex(slicePos);
- QModelIndex labelIndex = labelModelIndex(slicePos);
- while (valueIndex.isValid() && labelIndex.isValid()) {
- QPieSlice *slice = new QPieSlice;
- slice->setLabel(m_model->data(labelIndex, Qt::DisplayRole).toString());
- slice->setValue(m_model->data(valueIndex, Qt::DisplayRole).toDouble());
- connect(slice, SIGNAL(labelChanged()), this, SLOT(sliceLabelChanged()));
- connect(slice, SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
- m_series->append(slice);
- m_slices.append(slice);
- slicePos++;
- valueIndex = valueModelIndex(slicePos);
- labelIndex = labelModelIndex(slicePos);
- }
- blockSeriesSignals(false);
-}
-
-#include "moc_qpiemodelmapper_p.cpp"
-#include "moc_qpiemodelmapper.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/piechart/qpiemodelmapper.h b/src/piechart/qpiemodelmapper.h
deleted file mode 100644
index 3296f353..00000000
--- a/src/piechart/qpiemodelmapper.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPIEMODELMAPPER_H
-#define QPIEMODELMAPPER_H
-
-#include "qchartglobal.h"
-#include <QObject>
-
-class QAbstractItemModel;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QPieModelMapperPrivate;
-class QPieSeries;
-
-class QTCOMMERCIALCHART_EXPORT QPieModelMapper : public QObject
-{
- Q_OBJECT
-
-protected:
- explicit QPieModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QPieSeries *series() const;
- void setSeries(QPieSeries *series);
-
- int first() const;
- void setFirst(int first);
-
- int count() const;
- void setCount(int count);
-
- int valuesSection() const;
- void setValuesSection(int valuesSection);
-
- int labelsSection() const;
- void setLabelsSection(int labelsSection);
-
- Qt::Orientation orientation() const;
- void setOrientation(Qt::Orientation orientation);
-
-protected:
- QPieModelMapperPrivate * const d_ptr;
- Q_DECLARE_PRIVATE(QPieModelMapper)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QPIEMODELMAPPER_H
diff --git a/src/piechart/qpiemodelmapper_p.h b/src/piechart/qpiemodelmapper_p.h
deleted file mode 100644
index cb71a431..00000000
--- a/src/piechart/qpiemodelmapper_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QPIEMODELMAPPER_P_H
-#define QPIEMODELMAPPER_P_H
-
-#include <QObject>
-#include "qpiemodelmapper.h"
-
-class QModelIndex;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QPieSlice;
-
-class QPieModelMapperPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- explicit QPieModelMapperPrivate(QPieModelMapper *q);
-
-public Q_SLOTS:
- // for the model
- void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
- void modelRowsAdded(QModelIndex parent, int start, int end);
- void modelRowsRemoved(QModelIndex parent, int start, int end);
- void modelColumnsAdded(QModelIndex parent, int start, int end);
- void modelColumnsRemoved(QModelIndex parent, int start, int end);
- void handleModelDestroyed();
-
- // for the series
- void slicesAdded(QList<QPieSlice *> slices);
- void slicesRemoved(QList<QPieSlice *> slices);
- void sliceLabelChanged();
- void sliceValueChanged();
- void handleSeriesDestroyed();
-
- void initializePieFromModel();
-
-private:
- QPieSlice *pieSlice(QModelIndex index) const;
- bool isLabelIndex(QModelIndex index) const;
- bool isValueIndex(QModelIndex index) const;
- QModelIndex valueModelIndex(int slicePos);
- QModelIndex labelModelIndex(int slicePos);
- void insertData(int start, int end);
- void removeData(int start, int end);
-
- void blockModelSignals(bool block = true);
- void blockSeriesSignals(bool block = true);
-
-private:
- QPieSeries *m_series;
- QList<QPieSlice *> m_slices;
- QAbstractItemModel *m_model;
- int m_first;
- int m_count;
- Qt::Orientation m_orientation;
- int m_valuesSection;
- int m_labelsSection;
- bool m_seriesSignalsBlock;
- bool m_modelSignalsBlock;
-
-private:
-
- QPieModelMapper *q_ptr;
- Q_DECLARE_PUBLIC(QPieModelMapper)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QPIEMODELMAPPER_P_H
diff --git a/src/piechart/qpieseries.cpp b/src/piechart/qpieseries.cpp
deleted file mode 100644
index 253f0ab5..00000000
--- a/src/piechart/qpieseries.cpp
+++ /dev/null
@@ -1,944 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpieseries.h"
-#include "qpieseries_p.h"
-#include "qpieslice.h"
-#include "qpieslice_p.h"
-#include "pieslicedata_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "qabstractaxis.h"
-#include "pieanimation_p.h"
-#include "charthelpers_p.h"
-
-#include "qpielegendmarker.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QPieSeries
- \inmodule Qt Charts
- \brief Pie series API for Qt Charts.
-
- The pie series defines a pie chart which consists of pie slices which are defined as QPieSlice objects.
- The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices.
- The actual slice size is determined by that relative value.
-
- Pie size and position on the chart is controlled by using relative values which range from 0.0 to 1.0.
- These relate to the actual chart rectangle.
-
- By default the pie is defined as a full pie but it can also be a partial pie.
- This can be done by setting a starting angle and angle span to the series.
- Full pie is 360 degrees where 0 is at 12 a'clock.
-
- See the \l {PieChart Example} {pie chart example} or \l {DonutChart Example} {donut chart example} to learn how to use QPieSeries.
- \table 100%
- \row
- \li \image examples_piechart.png
- \li \image examples_donutchart.png
- \endtable
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype PieSeries
- \instantiates QPieSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/pieseries.qdocinc
-*/
-#else
-/*!
- \qmlclass PieSeries QPieSeries
-
- \include ../doc/src/pieseries.qdocinc
-*/
-#endif
-
-/*!
- \property QPieSeries::horizontalPosition
- \brief Defines the horizontal position of the pie.
-
- The value is a relative value to the chart rectangle where:
-
- \list
- \li 0.0 is the absolute left.
- \li 1.0 is the absolute right.
- \endlist
- Default value is 0.5 (center).
- \sa verticalPosition
-*/
-
-/*!
- \qmlproperty real PieSeries::horizontalPosition
-
- Defines the horizontal position of the pie.
-
- The value is a relative value to the chart rectangle where:
-
- \list
- \li 0.0 is the absolute left.
- \li 1.0 is the absolute right.
- \endlist
- Default value is 0.5 (center).
- \sa verticalPosition
-*/
-
-/*!
- \property QPieSeries::verticalPosition
- \brief Defines the vertical position of the pie.
-
- The value is a relative value to the chart rectangle where:
-
- \list
- \li 0.0 is the absolute top.
- \li 1.0 is the absolute bottom.
- \endlist
- Default value is 0.5 (center).
- \sa horizontalPosition
-*/
-
-/*!
- \qmlproperty real PieSeries::verticalPosition
-
- Defines the vertical position of the pie.
-
- The value is a relative value to the chart rectangle where:
-
- \list
- \li 0.0 is the absolute top.
- \li 1.0 is the absolute bottom.
- \endlist
- Default value is 0.5 (center).
- \sa horizontalPosition
-*/
-
-/*!
- \property QPieSeries::size
- \brief Defines the pie size.
-
- The value is a relative value to the chart rectangle where:
-
- \list
- \li 0.0 is the minimum size (pie not drawn).
- \li 1.0 is the maximum size that can fit the chart.
- \endlist
-
- When setting this property the holeSize property is adjusted if necessary, to ensure that the hole size is not greater than the outer size.
-
- Default value is 0.7.
-*/
-
-/*!
- \qmlproperty real PieSeries::size
-
- Defines the pie size.
-
- The value is a relative value to the chart rectangle where:
-
- \list
- \li 0.0 is the minimum size (pie not drawn).
- \li 1.0 is the maximum size that can fit the chart.
- \endlist
-
- Default value is 0.7.
-*/
-
-/*!
- \property QPieSeries::holeSize
- \brief Defines the donut hole size.
-
- The value is a relative value to the chart rectangle where:
-
- \list
- \li 0.0 is the minimum size (full pie drawn, without any hole inside).
- \li 1.0 is the maximum size that can fit the chart. (donut has no width)
- \endlist
-
- The value is never greater then size property.
- Default value is 0.0.
-*/
-
-/*!
- \qmlproperty real PieSeries::holeSize
-
- Defines the donut hole size.
-
- The value is a relative value to the chart rectangle where:
-
- \list
- \li 0.0 is the minimum size (full pie drawn, without any hole inside).
- \li 1.0 is the maximum size that can fit the chart. (donut has no width)
- \endlist
-
- When setting this property the size property is adjusted if necessary, to ensure that the inner size is not greater than the outer size.
-
- Default value is 0.0.
-*/
-
-/*!
- \property QPieSeries::startAngle
- \brief Defines the starting angle of the pie.
-
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
-
- Default is value is 0.
-*/
-
-/*!
- \qmlproperty real PieSeries::startAngle
-
- Defines the starting angle of the pie.
-
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
-
- Default is value is 0.
-*/
-
-/*!
- \property QPieSeries::endAngle
- \brief Defines the ending angle of the pie.
-
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
-
- Default is value is 360.
-*/
-
-/*!
- \qmlproperty real PieSeries::endAngle
-
- Defines the ending angle of the pie.
-
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
-
- Default is value is 360.
-*/
-
-/*!
- \property QPieSeries::count
-
- Number of slices in the series.
-*/
-
-/*!
- \qmlproperty int PieSeries::count
-
- Number of slices in the series.
-*/
-
-/*!
- \fn void QPieSeries::countChanged()
- Emitted when the slice count has changed.
- \sa count
-*/
-/*!
- \qmlsignal PieSeries::onCountChanged()
- Emitted when the slice count has changed.
-*/
-
-/*!
- \property QPieSeries::sum
-
- Sum of all slices.
-
- The series keeps track of the sum of all slices it holds.
-*/
-
-/*!
- \qmlproperty real PieSeries::sum
-
- Sum of all slices.
-
- The series keeps track of the sum of all slices it holds.
-*/
-
-/*!
- \fn void QPieSeries::sumChanged()
- Emitted when the sum of all slices has changed.
- \sa sum
-*/
-/*!
- \qmlsignal PieSeries::onSumChanged()
- Emitted when the sum of all slices has changed. This may happen for example if you add or remove slices, or if you
- change value of a slice.
-*/
-
-/*!
- \fn void QPieSeries::added(QList<QPieSlice*> slices)
-
- This signal is emitted when \a slices have been added to the series.
-
- \sa append(), insert()
-*/
-/*!
- \qmlsignal PieSeries::onAdded(PieSlice slice)
- Emitted when \a slice has been added to the series.
-*/
-
-/*!
- \fn void QPieSeries::removed(QList<QPieSlice*> slices)
- This signal is emitted when \a slices have been removed from the series.
- \sa remove()
-*/
-/*!
- \qmlsignal PieSeries::onRemoved(PieSlice slice)
- Emitted when \a slice has been removed from the series.
-*/
-
-/*!
- \fn void QPieSeries::clicked(QPieSlice* slice)
- This signal is emitted when a \a slice has been clicked.
- \sa QPieSlice::clicked()
-*/
-/*!
- \qmlsignal PieSeries::onClicked(PieSlice slice)
- This signal is emitted when a \a slice has been clicked.
-*/
-
-/*!
- \fn void QPieSeries::hovered(QPieSlice* slice, bool state)
- This signal is emitted when user has hovered over or away from the \a slice.
- \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
- \sa QPieSlice::hovered()
-*/
-/*!
- \qmlsignal PieSeries::onHovered(PieSlice slice, bool state)
- This signal is emitted when user has hovered over or away from the \a slice. \a state is true when user has hovered
- over the slice and false when hover has moved away from the slice.
-*/
-
-/*!
- \qmlmethod PieSlice PieSeries::at(int index)
- Returns slice at \a index. Returns null if the index is not valid.
-*/
-
-/*!
- \qmlmethod PieSlice PieSeries::find(string label)
- Returns the first slice with \a label. Returns null if the index is not valid.
-*/
-
-/*!
- \qmlmethod PieSlice PieSeries::append(string label, real value)
- Adds a new slice with \a label and \a value to the pie.
-*/
-
-/*!
- \qmlmethod bool PieSeries::remove(PieSlice slice)
- Removes the \a slice from the pie. Returns true if the removal was successful, false otherwise.
-*/
-
-/*!
- \qmlmethod PieSeries::clear()
- Removes all slices from the pie.
-*/
-
-/*!
- Constructs a series object which is a child of \a parent.
-*/
-QPieSeries::QPieSeries(QObject *parent)
- : QAbstractSeries(*new QPieSeriesPrivate(this), parent)
-{
- Q_D(QPieSeries);
- QObject::connect(this, SIGNAL(countChanged()), d, SIGNAL(countChanged()));
-}
-
-/*!
- Destroys the series and its slices.
-*/
-QPieSeries::~QPieSeries()
-{
- // NOTE: d_prt destroyed by QObject
- clear();
-}
-
-/*!
- Returns QAbstractSeries::SeriesTypePie.
-*/
-QAbstractSeries::SeriesType QPieSeries::type() const
-{
- return QAbstractSeries::SeriesTypePie;
-}
-
-/*!
- Appends a single \a slice to the series.
- Slice ownership is passed to the series.
-
- Returns true if append was succesfull.
-*/
-bool QPieSeries::append(QPieSlice *slice)
-{
- return append(QList<QPieSlice *>() << slice);
-}
-
-/*!
- Appends an array of \a slices to the series.
- Slice ownership is passed to the series.
-
- Returns true if append was successful.
-*/
-bool QPieSeries::append(QList<QPieSlice *> slices)
-{
- Q_D(QPieSeries);
-
- if (slices.count() == 0)
- return false;
-
- foreach (QPieSlice *s, slices) {
- if (!s || d->m_slices.contains(s))
- return false;
- if (s->series()) // already added to some series
- return false;
- if (!isValidValue(s->value()))
- return false;
- }
-
- foreach (QPieSlice *s, slices) {
- s->setParent(this);
- QPieSlicePrivate::fromSlice(s)->m_series = this;
- d->m_slices << s;
- }
-
- d->updateDerivativeData();
-
- foreach(QPieSlice * s, slices) {
- connect(s, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
- connect(s, SIGNAL(clicked()), d, SLOT(sliceClicked()));
- connect(s, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
- }
-
- emit added(slices);
- emit countChanged();
-
- return true;
-}
-
-/*!
- Appends a single \a slice to the series and returns a reference to the series.
- Slice ownership is passed to the series.
-*/
-QPieSeries &QPieSeries::operator << (QPieSlice *slice)
-{
- append(slice);
- return *this;
-}
-
-
-/*!
- Appends a single slice to the series with give \a value and \a label.
- Slice ownership is passed to the series.
- Returns NULL if value is NaN, Inf or -Inf and no slice is added to the series.
-*/
-QPieSlice *QPieSeries::append(QString label, qreal value)
-{
- if (isValidValue(value)) {
- QPieSlice *slice = new QPieSlice(label, value);
- append(slice);
- return slice;
- } else {
- return 0;
- }
-}
-
-/*!
- Inserts a single \a slice to the series before the slice at \a index position.
- Slice ownership is passed to the series.
-
- Returns true if insert was successful.
-*/
-bool QPieSeries::insert(int index, QPieSlice *slice)
-{
- Q_D(QPieSeries);
-
- if (index < 0 || index > d->m_slices.count())
- return false;
-
- if (!slice || d->m_slices.contains(slice))
- return false;
-
- if (slice->series()) // already added to some series
- return false;
-
- if (!isValidValue(slice->value()))
- return false;
-
- slice->setParent(this);
- QPieSlicePrivate::fromSlice(slice)->m_series = this;
- d->m_slices.insert(index, slice);
-
- d->updateDerivativeData();
-
- connect(slice, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
- connect(slice, SIGNAL(clicked()), d, SLOT(sliceClicked()));
- connect(slice, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
-
- emit added(QList<QPieSlice *>() << slice);
- emit countChanged();
-
- return true;
-}
-
-/*!
- Removes a single \a slice from the series and deletes the slice.
-
- Do not reference the pointer after this call.
-
- Returns true if remove was successful.
-*/
-bool QPieSeries::remove(QPieSlice *slice)
-{
- Q_D(QPieSeries);
-
- if (!d->m_slices.removeOne(slice))
- return false;
-
- d->updateDerivativeData();
-
- emit removed(QList<QPieSlice *>() << slice);
- emit countChanged();
-
- delete slice;
- slice = 0;
-
- return true;
-}
-
-/*!
- Takes a single \a slice from the series. Does not destroy the slice object.
-
- \note The series remains as the slice's parent object. You must set the
- parent object to take full ownership.
-
- Returns true if take was successful.
-*/
-bool QPieSeries::take(QPieSlice *slice)
-{
- Q_D(QPieSeries);
-
- if (!d->m_slices.removeOne(slice))
- return false;
-
- QPieSlicePrivate::fromSlice(slice)->m_series = 0;
- slice->disconnect(d);
-
- d->updateDerivativeData();
-
- emit removed(QList<QPieSlice *>() << slice);
- emit countChanged();
-
- return true;
-}
-
-/*!
- Clears all slices from the series.
-*/
-void QPieSeries::clear()
-{
- Q_D(QPieSeries);
- if (d->m_slices.count() == 0)
- return;
-
- QList<QPieSlice *> slices = d->m_slices;
- foreach (QPieSlice *s, d->m_slices)
- d->m_slices.removeOne(s);
-
- d->updateDerivativeData();
-
- emit removed(slices);
- emit countChanged();
-
- foreach (QPieSlice *s, slices)
- delete s;
-}
-
-/*!
- Returns a list of slices that belong to this series.
-*/
-QList<QPieSlice *> QPieSeries::slices() const
-{
- Q_D(const QPieSeries);
- return d->m_slices;
-}
-
-/*!
- returns the number of the slices in this series.
-*/
-int QPieSeries::count() const
-{
- Q_D(const QPieSeries);
- return d->m_slices.count();
-}
-
-/*!
- Returns true is the series is empty.
-*/
-bool QPieSeries::isEmpty() const
-{
- Q_D(const QPieSeries);
- return d->m_slices.isEmpty();
-}
-
-/*!
- Returns the sum of all slice values in this series.
-
- \sa QPieSlice::value(), QPieSlice::setValue(), QPieSlice::percentage()
-*/
-qreal QPieSeries::sum() const
-{
- Q_D(const QPieSeries);
- return d->m_sum;
-}
-
-void QPieSeries::setHoleSize(qreal holeSize)
-{
- Q_D(QPieSeries);
- holeSize = qBound((qreal)0.0, holeSize, (qreal)1.0);
- d->setSizes(holeSize, qMax(d->m_pieRelativeSize, holeSize));
-}
-
-qreal QPieSeries::holeSize() const
-{
- Q_D(const QPieSeries);
- return d->m_holeRelativeSize;
-}
-
-void QPieSeries::setHorizontalPosition(qreal relativePosition)
-{
- Q_D(QPieSeries);
-
- if (relativePosition < 0.0)
- relativePosition = 0.0;
- if (relativePosition > 1.0)
- relativePosition = 1.0;
-
- if (!qFuzzyCompare(d->m_pieRelativeHorPos, relativePosition)) {
- d->m_pieRelativeHorPos = relativePosition;
- emit d->horizontalPositionChanged();
- }
-}
-
-qreal QPieSeries::horizontalPosition() const
-{
- Q_D(const QPieSeries);
- return d->m_pieRelativeHorPos;
-}
-
-void QPieSeries::setVerticalPosition(qreal relativePosition)
-{
- Q_D(QPieSeries);
-
- if (relativePosition < 0.0)
- relativePosition = 0.0;
- if (relativePosition > 1.0)
- relativePosition = 1.0;
-
- if (!qFuzzyCompare(d->m_pieRelativeVerPos, relativePosition)) {
- d->m_pieRelativeVerPos = relativePosition;
- emit d->verticalPositionChanged();
- }
-}
-
-qreal QPieSeries::verticalPosition() const
-{
- Q_D(const QPieSeries);
- return d->m_pieRelativeVerPos;
-}
-
-void QPieSeries::setPieSize(qreal relativeSize)
-{
- Q_D(QPieSeries);
- relativeSize = qBound((qreal)0.0, relativeSize, (qreal)1.0);
- d->setSizes(qMin(d->m_holeRelativeSize, relativeSize), relativeSize);
-
-}
-
-qreal QPieSeries::pieSize() const
-{
- Q_D(const QPieSeries);
- return d->m_pieRelativeSize;
-}
-
-
-void QPieSeries::setPieStartAngle(qreal angle)
-{
- Q_D(QPieSeries);
- if (qFuzzyCompare(d->m_pieStartAngle, angle))
- return;
- d->m_pieStartAngle = angle;
- d->updateDerivativeData();
- emit d->pieStartAngleChanged();
-}
-
-qreal QPieSeries::pieStartAngle() const
-{
- Q_D(const QPieSeries);
- return d->m_pieStartAngle;
-}
-
-/*!
- Sets the end angle of the pie.
-
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
-
- \a angle must be greater than start angle.
-
- \sa pieEndAngle(), pieStartAngle(), setPieStartAngle()
-*/
-void QPieSeries::setPieEndAngle(qreal angle)
-{
- Q_D(QPieSeries);
- if (qFuzzyCompare(d->m_pieEndAngle, angle))
- return;
- d->m_pieEndAngle = angle;
- d->updateDerivativeData();
- emit d->pieEndAngleChanged();
-}
-
-/*!
- Returns the end angle of the pie.
-
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
-
- \sa setPieEndAngle(), pieStartAngle(), setPieStartAngle()
-*/
-qreal QPieSeries::pieEndAngle() const
-{
- Q_D(const QPieSeries);
- return d->m_pieEndAngle;
-}
-
-/*!
- Sets the all the slice labels \a visible or invisible.
-
- Note that this affects only the current slices in the series.
- If user adds a new slice the default label visibility is false.
-
- \sa QPieSlice::isLabelVisible(), QPieSlice::setLabelVisible()
-*/
-void QPieSeries::setLabelsVisible(bool visible)
-{
- Q_D(QPieSeries);
- foreach (QPieSlice *s, d->m_slices)
- s->setLabelVisible(visible);
-}
-
-/*!
- Sets the all the slice labels \a position
-
- Note that this affects only the current slices in the series.
- If user adds a new slice the default label position is LabelOutside
-
- \sa QPieSlice::labelPosition(), QPieSlice::setLabelPosition()
-*/
-void QPieSeries::setLabelsPosition(QPieSlice::LabelPosition position)
-{
- Q_D(QPieSeries);
- foreach (QPieSlice *s, d->m_slices)
- s->setLabelPosition(position);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent) :
- QAbstractSeriesPrivate(parent),
- m_pieRelativeHorPos(0.5),
- m_pieRelativeVerPos(0.5),
- m_pieRelativeSize(0.7),
- m_pieStartAngle(0),
- m_pieEndAngle(360),
- m_sum(0),
- m_holeRelativeSize(0.0)
-{
-}
-
-QPieSeriesPrivate::~QPieSeriesPrivate()
-{
-}
-
-void QPieSeriesPrivate::updateDerivativeData()
-{
- // calculate sum of all slices
- qreal sum = 0;
- foreach (QPieSlice *s, m_slices)
- sum += s->value();
-
- if (!qFuzzyCompare(m_sum, sum)) {
- m_sum = sum;
- emit q_func()->sumChanged();
- }
-
- // nothing to show..
- if (qFuzzyCompare(m_sum, 0))
- return;
-
- // update slice attributes
- qreal sliceAngle = m_pieStartAngle;
- qreal pieSpan = m_pieEndAngle - m_pieStartAngle;
- QVector<QPieSlice *> changed;
- foreach (QPieSlice *s, m_slices) {
- QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s);
- d->setPercentage(s->value() / m_sum);
- d->setStartAngle(sliceAngle);
- d->setAngleSpan(pieSpan * s->percentage());
- sliceAngle += s->angleSpan();
- }
-
-
- emit calculatedDataChanged();
-}
-
-void QPieSeriesPrivate::setSizes(qreal innerSize, qreal outerSize)
-{
- bool changed = false;
-
- if (!qFuzzyCompare(m_holeRelativeSize, innerSize)) {
- m_holeRelativeSize = innerSize;
- changed = true;
- }
-
- if (!qFuzzyCompare(m_pieRelativeSize, outerSize)) {
- m_pieRelativeSize = outerSize;
- changed = true;
- }
-
- if (changed)
- emit pieSizeChanged();
-}
-
-QPieSeriesPrivate *QPieSeriesPrivate::fromSeries(QPieSeries *series)
-{
- return series->d_func();
-}
-
-void QPieSeriesPrivate::sliceValueChanged()
-{
- Q_ASSERT(m_slices.contains(qobject_cast<QPieSlice *>(sender())));
- updateDerivativeData();
-}
-
-void QPieSeriesPrivate::sliceClicked()
-{
- QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
- Q_ASSERT(m_slices.contains(slice));
- Q_Q(QPieSeries);
- emit q->clicked(slice);
-}
-
-void QPieSeriesPrivate::sliceHovered(bool state)
-{
- QPieSlice *slice = qobject_cast<QPieSlice *>(sender());
- if (!m_slices.isEmpty()) {
- Q_ASSERT(m_slices.contains(slice));
- Q_Q(QPieSeries);
- emit q->hovered(slice, state);
- }
-}
-
-void QPieSeriesPrivate::initializeDomain()
-{
- // does not apply to pie
-}
-
-void QPieSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QPieSeries);
- PieChartItem *pie = new PieChartItem(q,parent);
- m_item.reset(pie);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-void QPieSeriesPrivate::initializeAnimations(QtCommercialChart::QChart::AnimationOptions options)
-{
- PieChartItem *item = static_cast<PieChartItem *>(m_item.data());
- Q_ASSERT(item);
- if (item->animation())
- item->animation()->stopAndDestroyLater();
-
- if (options.testFlag(QChart::SeriesAnimations))
- item->setAnimation(new PieAnimation(item));
- else
- item->setAnimation(0);
- QAbstractSeriesPrivate::initializeAnimations(options);
-}
-
-QList<QLegendMarker*> QPieSeriesPrivate::createLegendMarkers(QLegend* legend)
-{
- Q_Q(QPieSeries);
- QList<QLegendMarker*> markers;
- foreach(QPieSlice* slice, q->slices()) {
- QPieLegendMarker* marker = new QPieLegendMarker(q,slice,legend);
- markers << marker;
- }
- return markers;
-}
-
-void QPieSeriesPrivate::initializeAxes()
-{
-
-}
-
-QAbstractAxis::AxisType QPieSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
-{
- Q_UNUSED(orientation);
- return QAbstractAxis::AxisTypeNoAxis;
-}
-
-QAbstractAxis* QPieSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
-{
- Q_UNUSED(orientation);
- return 0;
-}
-
-void QPieSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
-{
- //Q_Q(QPieSeries);
- //const QList<QColor>& colors = theme->seriesColors();
- const QList<QGradient>& gradients = theme->seriesGradients();
-
- for (int i(0); i < m_slices.count(); i++) {
-
- QColor penColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0);
-
- // Get color for a slice from a gradient linearly, beginning from the start of the gradient
- qreal pos = (qreal)(i + 1) / (qreal) m_slices.count();
- QColor brushColor = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), pos);
-
- QPieSlice *s = m_slices.at(i);
- QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s);
-
- if (forced || d->m_data.m_slicePen.isThemed())
- d->setPen(penColor, true);
-
- if (forced || d->m_data.m_sliceBrush.isThemed())
- d->setBrush(brushColor, true);
-
- if (forced || d->m_data.m_labelBrush.isThemed())
- d->setLabelBrush(theme->labelBrush().color(), true);
-
- if (forced || d->m_data.m_labelFont.isThemed())
- d->setLabelFont(theme->labelFont(), true);
- }
-}
-
-
-#include "moc_qpieseries.cpp"
-#include "moc_qpieseries_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/piechart/qpieseries.h b/src/piechart/qpieseries.h
deleted file mode 100644
index 99c6868c..00000000
--- a/src/piechart/qpieseries.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPIESERIES_H
-#define QPIESERIES_H
-
-#include <qabstractseries.h>
-#include <QPieSlice>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QPieSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QPieSeries : public QAbstractSeries
-{
- Q_OBJECT
- Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition)
- Q_PROPERTY(qreal verticalPosition READ verticalPosition WRITE setVerticalPosition)
- Q_PROPERTY(qreal size READ pieSize WRITE setPieSize)
- Q_PROPERTY(qreal startAngle READ pieStartAngle WRITE setPieStartAngle)
- Q_PROPERTY(qreal endAngle READ pieEndAngle WRITE setPieEndAngle)
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(qreal sum READ sum NOTIFY sumChanged)
- Q_PROPERTY(qreal holeSize READ holeSize WRITE setHoleSize)
-
-public:
- explicit QPieSeries(QObject *parent = 0);
- virtual ~QPieSeries();
-
- QAbstractSeries::SeriesType type() const;
-
- bool append(QPieSlice *slice);
- bool append(QList<QPieSlice *> slices);
- QPieSeries &operator << (QPieSlice *slice);
- QPieSlice *append(QString label, qreal value);
-
- bool insert(int index, QPieSlice *slice);
-
- bool remove(QPieSlice *slice);
- bool take(QPieSlice *slice);
- void clear();
-
- QList<QPieSlice *> slices() const;
- int count() const;
-
- bool isEmpty() const;
-
- qreal sum() const;
-
- void setHoleSize(qreal holeSize);
- qreal holeSize() const;
-
- void setHorizontalPosition(qreal relativePosition);
- qreal horizontalPosition() const;
-
- void setVerticalPosition(qreal relativePosition);
- qreal verticalPosition() const;
-
- void setPieSize(qreal relativeSize);
- qreal pieSize() const;
-
- void setPieStartAngle(qreal startAngle);
- qreal pieStartAngle() const;
-
- void setPieEndAngle(qreal endAngle);
- qreal pieEndAngle() const;
-
- void setLabelsVisible(bool visible = true);
- void setLabelsPosition(QPieSlice::LabelPosition position);
-
-Q_SIGNALS:
- void added(QList<QPieSlice *> slices);
- void removed(QList<QPieSlice *> slices);
- void clicked(QPieSlice *slice);
- void hovered(QPieSlice *slice, bool state);
- void countChanged();
- void sumChanged();
-
-private:
- Q_DECLARE_PRIVATE(QPieSeries)
- Q_DISABLE_COPY(QPieSeries)
- friend class PieChartItem;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QPIESERIES_H
diff --git a/src/piechart/qpieseries_p.h b/src/piechart/qpieseries_p.h
deleted file mode 100644
index 8eb272e4..00000000
--- a/src/piechart/qpieseries_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QPIESERIES_P_H
-#define QPIESERIES_P_H
-
-#include "qpieseries.h"
-#include "qabstractseries_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QLegendPrivate;
-
-class QPieSeriesPrivate : public QAbstractSeriesPrivate
-{
- Q_OBJECT
-
-public:
- QPieSeriesPrivate(QPieSeries *parent);
- ~QPieSeriesPrivate();
-
- void initializeDomain();
- void initializeAxes();
- void initializeGraphics(QGraphicsItem* parent);
- void initializeAnimations(QtCommercialChart::QChart::AnimationOptions options);
- void initializeTheme(int index, ChartTheme* theme, bool forced = false);
-
- QList<QLegendMarker *> createLegendMarkers(QLegend *legend);
-
- QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
- QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
-
- void updateDerivativeData();
- void setSizes(qreal innerSize, qreal outerSize);
-
- static QPieSeriesPrivate *fromSeries(QPieSeries *series);
-
-signals:
- void calculatedDataChanged();
- void pieSizeChanged();
- void pieStartAngleChanged();
- void pieEndAngleChanged();
- void horizontalPositionChanged();
- void verticalPositionChanged();
-
-public Q_SLOTS:
- void sliceValueChanged();
- void sliceClicked();
- void sliceHovered(bool state);
-
-private:
- QList<QPieSlice *> m_slices;
- qreal m_pieRelativeHorPos;
- qreal m_pieRelativeVerPos;
- qreal m_pieRelativeSize;
- qreal m_pieStartAngle;
- qreal m_pieEndAngle;
- qreal m_sum;
- qreal m_holeRelativeSize;
-
-public:
- friend class QLegendPrivate;
- Q_DECLARE_PUBLIC(QPieSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QPIESERIES_P_H
diff --git a/src/piechart/qpieslice.cpp b/src/piechart/qpieslice.cpp
deleted file mode 100644
index dac41100..00000000
--- a/src/piechart/qpieslice.cpp
+++ /dev/null
@@ -1,789 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpieslice.h"
-#include "qpieslice_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QPieSlice
- \inmodule Qt Charts
- \brief Defines a slice in pie series.
-
- This object defines the properties of a single slice in a QPieSeries.
-
- In addition to the obvious value and label properties the user can also control
- the visual appearance of a slice. By modifying the visual appearance also means that
- the user is overriding the default appearance set by the theme.
-
- Note that if the user has customized slices and theme is changed all customizations will be lost.
-
- To enable user interaction with the pie some basic signals are provided about clicking and hovering.
-*/
-
-#ifdef QDOC_QT5
-/*!
- \qmltype PieSlice
- \instantiates QPieSlice
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/pieslice.qdocinc
-*/
-#else
-/*!
- \qmlclass PieSlice QPieSlice
-
- \include ../doc/src/pieslice.qdocinc
-*/
-#endif
-
-/*!
- \enum QPieSlice::LabelPosition
-
- This enum describes the position of the slice label.
-
- \value LabelOutside Label is outside the slice with an arm.
- \value LabelInsideHorizontal Label is centered inside the slice and laid out horizontally.
- \value LabelInsideTangential Label is centered inside the slice and rotated to be parallel to the tangential of the slice's arc.
- \value LabelInsideNormal Label is centered inside the slice rotated to be parallel to the normal of the slice's arc.
- */
-
-/*!
- \property QPieSlice::label
- Label of the slice.
- \sa labelVisible, labelBrush, labelFont, labelArmLengthFactor
-*/
-/*!
- \qmlproperty string PieSlice::label
- Label (text) of the slice.
-*/
-
-/*!
- \fn void QPieSlice::labelChanged()
- This signal emitted when the slice label has been changed.
- \sa label
-*/
-/*!
- \qmlsignal PieSlice::onLabelChanged()
- This signal emitted when the slice label has been changed.
- \sa label
-*/
-
-/*!
- \property QPieSlice::value
- Value of the slice.
- Note that if users sets a negative value it is converted to a positive value.
- \sa percentage(), QPieSeries::sum()
-*/
-/*!
- \qmlproperty real PieSlice::value
- Value of the slice. Note that if users sets a negative value it is converted to a positive value.
-*/
-
-/*!
- \fn void QPieSlice::valueChanged()
- This signal is emitted when the slice value changes.
- \sa value
-*/
-/*!
- \qmlsignal PieSlice::onValueChanged()
- This signal is emitted when the slice value changes.
- \sa value
-*/
-
-/*!
- \property QPieSlice::labelVisible
- Defines the visibility of slice label. By default the label is not visible.
- \sa label, labelBrush, labelFont, labelArmLengthFactor
-*/
-/*!
- \qmlproperty bool PieSlice::labelVisible
- Defines the visibility of slice label. By default the label is not visible.
-*/
-
-/*!
- \fn void QPieSlice::labelVisibleChanged()
- This signal emitted when visibility of the slice label has changed.
- \sa labelVisible
-*/
-/*!
- \qmlsignal PieSlice::onLabelVisibleChanged()
- This signal emitted when visibility of the slice label has changed.
- \sa labelVisible
-*/
-
-/*!
- \property QPieSlice::exploded
- If set to true the slice is "exploded" away from the pie.
- \sa explodeDistanceFactor
-*/
-/*!
- \qmlproperty bool PieSlice::exploded
- If set to true the slice is "exploded" away from the pie.
- \sa explodeDistanceFactor
-*/
-
-/*!
- \property QPieSlice::pen
- Pen used to draw the slice border.
-*/
-
-/*!
- \fn void QPieSlice::penChanged()
- This signal is emitted when the pen of the slice has changed.
- \sa pen
-*/
-
-/*!
- \property QPieSlice::borderColor
- Color used to draw the slice border.
- This is a convenience property for modifying the slice pen.
- \sa pen, borderWidth
-*/
-/*!
- \qmlproperty color PieSlice::borderColor
- Color used to draw the slice border (pen color).
- \sa borderWidth
-*/
-
-/*!
- \fn void QPieSlice::borderColorChanged()
- This signal is emitted when slice border color changes.
- \sa pen, borderColor
-*/
-/*!
- \qmlsignal PieSlice::onBorderColorChanged()
- This signal is emitted when slice border color changes.
- \sa borderColor
-*/
-
-/*!
- \property QPieSlice::borderWidth
- Width of the slice border.
- This is a convenience property for modifying the slice pen.
- \sa pen, borderColor
-*/
-/*!
- \qmlproperty int PieSlice::borderWidth
- Width of the slice border.
- This is a convenience property for modifying the slice pen.
- \sa borderColor
-*/
-
-/*!
- \fn void QPieSlice::borderWidthChanged()
- This signal is emitted when slice border width changes.
- \sa pen, borderWidth
-*/
-/*!
- \qmlsignal PieSlice::onBorderWidthChanged()
- This signal is emitted when slice border width changes.
- \sa borderWidth
-*/
-
-/*!
- \property QPieSlice::brush
- Brush used to draw the slice.
-*/
-
-/*!
- \fn void QPieSlice::brushChanged()
- This signal is emitted when the brush of the slice has changed.
- \sa brush
-*/
-
-/*!
- \qmlproperty QString PieSlice::brushFilename
- The name of the file used as a brush for the slice.
-*/
-
-/*!
- \property QPieSlice::color
- Fill (brush) color of the slice.
- This is a convenience property for modifying the slice brush.
- \sa brush
-*/
-/*!
- \qmlproperty color PieSlice::color
- Fill (brush) color of the slice.
-*/
-
-/*!
- \fn void QPieSlice::colorChanged()
- This signal is emitted when slice color changes.
- \sa brush
-*/
-/*!
- \qmlsignal PieSlice::onColorChanged()
- This signal is emitted when slice color changes.
-*/
-
-/*!
- \property QPieSlice::labelBrush
- Brush used to draw label and label arm of the slice.
- \sa label, labelVisible, labelFont, labelArmLengthFactor
-*/
-
-/*!
- \fn void QPieSlice::labelBrushChanged()
- This signal is emitted when the label brush of the slice has changed.
- \sa labelBrush
-*/
-
-/*!
- \property QPieSlice::labelColor
- Color used to draw the slice label.
- This is a convenience property for modifying the slice label brush.
- \sa labelBrush
-*/
-/*!
- \qmlproperty color PieSlice::labelColor
- Color used to draw the slice label.
-*/
-
-/*!
- \fn void QPieSlice::labelColorChanged()
- This signal is emitted when slice label color changes.
- \sa labelColor
-*/
-/*!
- \qmlsignal PieSlice::onLabelColorChanged()
- This signal is emitted when slice label color changes.
- \sa labelColor
-*/
-
-/*!
- \property QPieSlice::labelFont
- Font used for drawing label text.
- \sa label, labelVisible, labelArmLengthFactor
-*/
-
-/*!
- \fn void QPieSlice::labelFontChanged()
- This signal is emitted when the label font of the slice has changed.
- \sa labelFont
-*/
-
-/*!
- \qmlproperty Font PieSlice::labelFont
-
- Defines the font used for slice label.
-
- See the Qt documentation for more details of Font.
-
- \sa labelVisible, labelPosition
-*/
-
-/*!
- \property QPieSlice::labelPosition
- Position of the slice label.
- \sa label, labelVisible
-*/
-/*!
- \qmlproperty LabelPosition PieSlice::labelPosition
- Position of the slice label. One of PieSlice.LabelOutside, PieSlice.LabelInsideHorizontal,
- PieSlice.LabelInsideTangential or PieSlice.LabelInsideNormal. By default the position is
- PieSlice.LabelOutside.
- \sa labelVisible
-*/
-
-/*!
- \property QPieSlice::labelArmLengthFactor
- Defines the length of the label arm.
- The factor is relative to pie radius. For example:
- 1.0 means the length is the same as the radius.
- 0.5 means the length is half of the radius.
- By default the arm length is 0.15
- \sa label, labelVisible, labelBrush, labelFont
-*/
-/*!
- \qmlproperty real PieSlice::labelArmLengthFactor
- Defines the length of the label arm.
- The factor is relative to pie radius. For example:
- 1.0 means the length is the same as the radius.
- 0.5 means the length is half of the radius.
- By default the arm length is 0.15
- \sa labelVisible
-*/
-
-/*!
- \property QPieSlice::explodeDistanceFactor
- When the slice is exploded this factor defines how far the slice is exploded away from the pie.
- The factor is relative to pie radius. For example:
- 1.0 means the distance is the same as the radius.
- 0.5 means the distance is half of the radius.
- By default the distance is is 0.15
- \sa exploded
-*/
-/*!
- \qmlproperty real PieSlice::explodeDistanceFactor
- When the slice is exploded this factor defines how far the slice is exploded away from the pie.
- The factor is relative to pie radius. For example:
- 1.0 means the distance is the same as the radius.
- 0.5 means the distance is half of the radius.
- By default the distance is is 0.15
- \sa exploded
-*/
-
-/*!
- \property QPieSlice::percentage
- Percentage of the slice compared to the sum of all slices in the series.
- The actual value ranges from 0.0 to 1.0.
- Updated automatically once the slice is added to the series.
- \sa value, QPieSeries::sum
-*/
-/*!
- \qmlproperty real PieSlice::percentage
- Percentage of the slice compared to the sum of all slices in the series.
- The actual value ranges from 0.0 to 1.0.
- Updated automatically once the slice is added to the series.
-*/
-
-/*!
- \fn void QPieSlice::percentageChanged()
- This signal is emitted when the percentage of the slice has changed.
- \sa percentage
-*/
-/*!
- \qmlsignal void PieSlice::onPercentageChanged()
- This signal is emitted when the percentage of the slice has changed.
- \sa percentage
-*/
-
-/*!
- \property QPieSlice::startAngle
- Defines the starting angle of this slice in the series it belongs to.
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
- Updated automatically once the slice is added to the series.
-*/
-/*!
- \qmlproperty real PieSlice::startAngle
- Defines the starting angle of this slice in the series it belongs to.
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
- Updated automatically once the slice is added to the series.
-*/
-
-/*!
- \fn void QPieSlice::startAngleChanged()
- This signal is emitted when the starting angle f the slice has changed.
- \sa startAngle
-*/
-/*!
- \qmlsignal PieSlice::onStartAngleChanged()
- This signal is emitted when the starting angle f the slice has changed.
- \sa startAngle
-*/
-
-/*!
- \property QPieSlice::angleSpan
- Span of the slice in degrees.
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
- Updated automatically once the slice is added to the series.
-*/
-/*!
- \qmlproperty real PieSlice::angleSpan
- Span of the slice in degrees.
- Full pie is 360 degrees where 0 degrees is at 12 a'clock.
- Updated automatically once the slice is added to the series.
-*/
-
-/*!
- \fn void QPieSlice::angleSpanChanged()
- This signal is emitted when the angle span of the slice has changed.
- \sa angleSpan
-*/
-/*!
- \qmlsignal PieSlice::onAngleSpanChanged()
- This signal is emitted when the angle span of the slice has changed.
- \sa angleSpan
-*/
-
-/*!
- \fn void QPieSlice::clicked()
- This signal is emitted when user has clicked the slice.
- \sa QPieSeries::clicked()
-*/
-/*!
- \qmlsignal PieSlice::onClicked()
- This signal is emitted when user has clicked the slice.
-*/
-
-/*!
- \fn void QPieSlice::hovered(bool state)
- This signal is emitted when user has hovered over or away from the slice.
- \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
- \sa QPieSeries::hovered()
-*/
-/*!
- \qmlsignal PieSlice::onHovered(bool state)
- This signal is emitted when user has hovered over or away from the slice.
- \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
-*/
-
-/*!
- Constructs an empty slice with a \a parent.
- \sa QPieSeries::append(), QPieSeries::insert()
-*/
-QPieSlice::QPieSlice(QObject *parent)
- : QObject(parent),
- d_ptr(new QPieSlicePrivate(this))
-{
-
-}
-
-/*!
- Constructs an empty slice with given \a value, \a label and a \a parent.
- \sa QPieSeries::append(), QPieSeries::insert()
-*/
-QPieSlice::QPieSlice(QString label, qreal value, QObject *parent)
- : QObject(parent),
- d_ptr(new QPieSlicePrivate(this))
-{
- setValue(value);
- setLabel(label);
-}
-
-/*!
- Destroys the slice.
- User should not delete the slice if it has been added to the series.
-*/
-QPieSlice::~QPieSlice()
-{
-
-}
-
-void QPieSlice::setLabel(QString label)
-{
- if (d_ptr->m_data.m_labelText != label) {
- d_ptr->m_data.m_labelText = label;
- emit labelChanged();
- }
-}
-
-QString QPieSlice::label() const
-{
- return d_ptr->m_data.m_labelText;
-}
-
-void QPieSlice::setValue(qreal value)
-{
- value = qAbs(value); // negative values not allowed
- if (!qFuzzyCompare(d_ptr->m_data.m_value, value)) {
- d_ptr->m_data.m_value = value;
- emit valueChanged();
- }
-}
-
-qreal QPieSlice::value() const
-{
- return d_ptr->m_data.m_value;
-}
-
-void QPieSlice::setLabelVisible(bool visible)
-{
- if (d_ptr->m_data.m_isLabelVisible != visible) {
- d_ptr->m_data.m_isLabelVisible = visible;
- emit labelVisibleChanged();
- }
-}
-
-bool QPieSlice::isLabelVisible() const
-{
- return d_ptr->m_data.m_isLabelVisible;
-}
-
-void QPieSlice::setExploded(bool exploded)
-{
- if (d_ptr->m_data.m_isExploded != exploded) {
- d_ptr->m_data.m_isExploded = exploded;
- emit d_ptr->explodedChanged();
- }
-}
-
-QPieSlice::LabelPosition QPieSlice::labelPosition()
-{
- return d_ptr->m_data.m_labelPosition;
-}
-
-void QPieSlice::setLabelPosition(LabelPosition position)
-{
- if (d_ptr->m_data.m_labelPosition != position) {
- d_ptr->m_data.m_labelPosition = position;
- emit d_ptr->labelPositionChanged();
- }
-}
-
-bool QPieSlice::isExploded() const
-{
- return d_ptr->m_data.m_isExploded;
-}
-
-void QPieSlice::setPen(const QPen &pen)
-{
- d_ptr->setPen(pen, false);
-}
-
-QPen QPieSlice::pen() const
-{
- return d_ptr->m_data.m_slicePen;
-}
-
-QColor QPieSlice::borderColor()
-{
- return pen().color();
-}
-
-void QPieSlice::setBorderColor(QColor color)
-{
- QPen p = pen();
- if (color != p.color()) {
- p.setColor(color);
- setPen(p);
- }
-}
-
-int QPieSlice::borderWidth()
-{
- return pen().width();
-}
-
-void QPieSlice::setBorderWidth(int width)
-{
- QPen p = pen();
- if (width != p.width()) {
- p.setWidth(width);
- setPen(p);
- }
-}
-
-void QPieSlice::setBrush(const QBrush &brush)
-{
- d_ptr->setBrush(brush, false);
-}
-
-QBrush QPieSlice::brush() const
-{
- return d_ptr->m_data.m_sliceBrush;
-}
-
-QColor QPieSlice::color()
-{
- return brush().color();
-}
-
-void QPieSlice::setColor(QColor color)
-{
- QBrush b = brush();
-
- if (b == QBrush())
- b.setStyle(Qt::SolidPattern);
- b.setColor(color);
- setBrush(b);
-}
-
-void QPieSlice::setLabelBrush(const QBrush &brush)
-{
- d_ptr->setLabelBrush(brush, false);
-}
-
-QBrush QPieSlice::labelBrush() const
-{
- return d_ptr->m_data.m_labelBrush;
-}
-
-QColor QPieSlice::labelColor()
-{
- return labelBrush().color();
-}
-
-void QPieSlice::setLabelColor(QColor color)
-{
- QBrush b = labelBrush();
- if (color != b.color()) {
- b.setColor(color);
- setLabelBrush(b);
- }
-}
-
-void QPieSlice::setLabelFont(const QFont &font)
-{
- d_ptr->setLabelFont(font, false);
-}
-
-QFont QPieSlice::labelFont() const
-{
- return d_ptr->m_data.m_labelFont;
-}
-
-void QPieSlice::setLabelArmLengthFactor(qreal factor)
-{
- if (!qFuzzyCompare(d_ptr->m_data.m_labelArmLengthFactor, factor)) {
- d_ptr->m_data.m_labelArmLengthFactor = factor;
- emit d_ptr->labelArmLengthFactorChanged();
- }
-}
-
-qreal QPieSlice::labelArmLengthFactor() const
-{
- return d_ptr->m_data.m_labelArmLengthFactor;
-}
-
-void QPieSlice::setExplodeDistanceFactor(qreal factor)
-{
- if (!qFuzzyCompare(d_ptr->m_data.m_explodeDistanceFactor, factor)) {
- d_ptr->m_data.m_explodeDistanceFactor = factor;
- emit d_ptr->explodeDistanceFactorChanged();
- }
-}
-
-qreal QPieSlice::explodeDistanceFactor() const
-{
- return d_ptr->m_data.m_explodeDistanceFactor;
-}
-
-qreal QPieSlice::percentage() const
-{
- return d_ptr->m_data.m_percentage;
-}
-
-qreal QPieSlice::startAngle() const
-{
- return d_ptr->m_data.m_startAngle;
-}
-
-qreal QPieSlice::angleSpan() const
-{
- return d_ptr->m_data.m_angleSpan;
-}
-
-/*!
- Returns the series that this slice belongs to.
-
- \sa QPieSeries::append()
-*/
-QPieSeries *QPieSlice::series() const
-{
- return d_ptr->m_series;
-}
-
-QPieSlicePrivate::QPieSlicePrivate(QPieSlice *parent)
- : QObject(parent),
- q_ptr(parent),
- m_series(0)
-{
-
-}
-
-QPieSlicePrivate::~QPieSlicePrivate()
-{
-
-}
-
-QPieSlicePrivate *QPieSlicePrivate::fromSlice(QPieSlice *slice)
-{
- return slice->d_func();
-}
-
-void QPieSlicePrivate::setPen(const QPen &pen, bool themed)
-{
- if (m_data.m_slicePen != pen) {
-
- QPen oldPen = m_data.m_slicePen;
-
- m_data.m_slicePen = pen;
- m_data.m_slicePen.setThemed(themed);
-
- emit q_ptr->penChanged();
- if (oldPen.color() != pen.color())
- emit q_ptr->borderColorChanged();
- if (oldPen.width() != pen.width())
- emit q_ptr->borderWidthChanged();
- }
-}
-
-void QPieSlicePrivate::setBrush(const QBrush &brush, bool themed)
-{
- if (m_data.m_sliceBrush != brush) {
-
- QBrush oldBrush = m_data.m_sliceBrush;
-
- m_data.m_sliceBrush = brush;
- m_data.m_sliceBrush.setThemed(themed);
-
- emit q_ptr->brushChanged();
- if (oldBrush.color() != brush.color())
- emit q_ptr->colorChanged();
- }
-}
-
-void QPieSlicePrivate::setLabelBrush(const QBrush &brush, bool themed)
-{
- if (m_data.m_labelBrush != brush) {
-
- QBrush oldBrush = m_data.m_labelBrush;
-
- m_data.m_labelBrush = brush;
- m_data.m_labelBrush.setThemed(themed);
-
- emit q_ptr->labelBrushChanged();
- if (oldBrush.color() != brush.color())
- emit q_ptr->labelColorChanged();
- }
-}
-
-void QPieSlicePrivate::setLabelFont(const QFont &font, bool themed)
-{
- if (m_data.m_labelFont != font) {
- m_data.m_labelFont = font;
- m_data.m_labelFont.setThemed(themed);
- emit q_ptr->labelFontChanged();
- }
-}
-
-void QPieSlicePrivate::setPercentage(qreal percentage)
-{
- if (!qFuzzyCompare(m_data.m_percentage, percentage)) {
- m_data.m_percentage = percentage;
- emit q_ptr->percentageChanged();
- }
-}
-
-void QPieSlicePrivate::setStartAngle(qreal angle)
-{
- if (!qFuzzyCompare(m_data.m_startAngle, angle)) {
- m_data.m_startAngle = angle;
- emit q_ptr->startAngleChanged();
- }
-}
-
-void QPieSlicePrivate::setAngleSpan(qreal span)
-{
- if (!qFuzzyCompare(m_data.m_angleSpan, span)) {
- m_data.m_angleSpan = span;
- emit q_ptr->angleSpanChanged();
- }
-}
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-#include "moc_qpieslice.cpp"
-#include "moc_qpieslice_p.cpp"
diff --git a/src/piechart/qpieslice.h b/src/piechart/qpieslice.h
deleted file mode 100644
index 351ca3f1..00000000
--- a/src/piechart/qpieslice.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPIESLICE_H
-#define QPIESLICE_H
-
-#include <qchartglobal.h>
-#include <QObject>
-#include <QPen>
-#include <QBrush>
-#include <QFont>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QPieSlicePrivate;
-class QPieSeries;
-
-class QTCOMMERCIALCHART_EXPORT QPieSlice : public QObject
-{
- Q_OBJECT
- Q_ENUMS(LabelPosition)
- Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
- Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged)
- Q_PROPERTY(bool labelVisible READ isLabelVisible WRITE setLabelVisible NOTIFY labelVisibleChanged)
- Q_PROPERTY(LabelPosition labelPosition READ labelPosition WRITE setLabelPosition)
- Q_PROPERTY(bool exploded READ isExploded WRITE setExploded)
- Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged)
- Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
- Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged)
- Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
- Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged)
- Q_PROPERTY(qreal labelArmLengthFactor READ labelArmLengthFactor WRITE setLabelArmLengthFactor)
- Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor)
- Q_PROPERTY(qreal percentage READ percentage NOTIFY percentageChanged)
- Q_PROPERTY(qreal startAngle READ startAngle NOTIFY startAngleChanged)
- Q_PROPERTY(qreal angleSpan READ angleSpan NOTIFY angleSpanChanged)
-
-public:
- enum LabelPosition {
- LabelOutside,
- LabelInsideHorizontal,
- LabelInsideTangential,
- LabelInsideNormal
- };
-
-public:
- explicit QPieSlice(QObject *parent = 0);
- QPieSlice(QString label, qreal value, QObject *parent = 0);
- virtual ~QPieSlice();
-
- void setLabel(QString label);
- QString label() const;
-
- void setValue(qreal value);
- qreal value() const;
-
- void setLabelVisible(bool visible = true);
- bool isLabelVisible() const;
-
- LabelPosition labelPosition();
- void setLabelPosition(LabelPosition position);
-
- void setExploded(bool exploded = true);
- bool isExploded() const;
-
- void setPen(const QPen &pen);
- QPen pen() const;
-
- QColor borderColor();
- void setBorderColor(QColor color);
-
- int borderWidth();
- void setBorderWidth(int width);
-
- void setBrush(const QBrush &brush);
- QBrush brush() const;
-
- QColor color();
- void setColor(QColor color);
-
- void setLabelBrush(const QBrush &brush);
- QBrush labelBrush() const;
-
- QColor labelColor();
- void setLabelColor(QColor color);
-
- void setLabelFont(const QFont &font);
- QFont labelFont() const;
-
- void setLabelArmLengthFactor(qreal factor);
- qreal labelArmLengthFactor() const;
-
- void setExplodeDistanceFactor(qreal factor);
- qreal explodeDistanceFactor() const;
-
- qreal percentage() const;
- qreal startAngle() const;
- qreal angleSpan() const;
-
- QPieSeries *series() const;
-
-Q_SIGNALS:
- void clicked();
- void hovered(bool state);
- void labelChanged();
- void valueChanged();
- void labelVisibleChanged();
- void penChanged();
- void brushChanged();
- void labelBrushChanged();
- void labelFontChanged();
- void percentageChanged();
- void startAngleChanged();
- void angleSpanChanged();
- void colorChanged();
- void borderColorChanged();
- void borderWidthChanged();
- void labelColorChanged();
-
-private:
- QPieSlicePrivate * const d_ptr;
- Q_DECLARE_PRIVATE(QPieSlice)
- Q_DISABLE_COPY(QPieSlice)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QPIESLICE_H
diff --git a/src/piechart/qpieslice_p.h b/src/piechart/qpieslice_p.h
deleted file mode 100644
index 3be3a813..00000000
--- a/src/piechart/qpieslice_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QPIESLICE_P_H
-#define QPIESLICE_P_H
-
-#include <QObject>
-#include "qpieslice.h"
-#include "pieslicedata_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QPieSeries;
-
-class QPieSlicePrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QPieSlicePrivate(QPieSlice *parent);
- ~QPieSlicePrivate();
-
- static QPieSlicePrivate *fromSlice(QPieSlice *slice);
-
- void setPen(const QPen &pen, bool themed);
- void setBrush(const QBrush &brush, bool themed);
- void setLabelBrush(const QBrush &brush, bool themed);
- void setLabelFont(const QFont &font, bool themed);
-
- void setPercentage(qreal percentage);
- void setStartAngle(qreal angle);
- void setAngleSpan(qreal span);
-
-Q_SIGNALS:
- void labelPositionChanged();
- void explodedChanged();
- void labelArmLengthFactorChanged();
- void explodeDistanceFactorChanged();
-
-private:
- friend class QPieSeries;
- friend class QPieSeriesPrivate;
- friend class ChartThemeManager;
- friend class PieChartItem;
-
- QPieSlice * const q_ptr;
- Q_DECLARE_PUBLIC(QPieSlice)
-
- PieSliceData m_data;
- QPieSeries *m_series;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QPIESLICE_P_H
diff --git a/src/piechart/qvpiemodelmapper.cpp b/src/piechart/qvpiemodelmapper.cpp
deleted file mode 100644
index 144dd995..00000000
--- a/src/piechart/qvpiemodelmapper.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvpiemodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QVPieModelMapper
- \inmodule Qt Charts
- \mainclass
-
- Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
- Vertical model mapper is used to create a connection between QPieSeries and QAbstractItemModel derived model object that keeps the consecutive pie slices data in columns.
- It is possible to use both QAbstractItemModel and QPieSeries model API. QVPieModelMapper makes sure that Pie and the model are kept in sync.
- \note Used model has to support adding/removing rows/columns and modifying the data of the cells.
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype VPieModelMapper
- \instantiates QVPieModelMapper
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/vpiemodelmapper.qdocinc
-*/
-#else
-/*!
- \qmlclass VPieModelMapper QVPieModelMapper
-
- \include ../doc/src/vpiemodelmapper.qdocinc
-*/
-#endif
-
-/*!
- \property QVPieModelMapper::series
- \brief Defines the QPieSeries object that is used by the mapper.
- All the data in the series is discarded when it is set to the mapper.
- When new series is specified the old series is disconnected (it preserves its data)
-*/
-/*!
- \qmlproperty PieSeries VPieModelMapper::series
- Defines the PieSeries object that is used by the mapper. If you define the mapper element as a child for a
- PieSeries, leave this property undefined. All the data in the series is discarded when it is set to the mapper.
- When new series is specified the old series is disconnected (it preserves its data).
-*/
-
-/*!
- \property QVPieModelMapper::model
- \brief Defines the model that is used by the mapper.
-*/
-/*!
- \qmlproperty SomeModel VPieModelMapper::model
- The QAbstractItemModel based model that is used by the mapper. You need to implement the model
- and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
- the data of the cells.
-*/
-
-/*!
- \property QVPieModelMapper::valuesColumn
- \brief Defines which column of the model is kept in sync with the values of the pie's slices.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int VPieModelMapper::valuesColumn
- Defines which column of the model is kept in sync with the values of the pie's slices. Default value is -1 (invalid
- mapping).
-*/
-
-/*!
- \property QVPieModelMapper::labelsColumn
- \brief Defines which column of the model is kept in sync with the labels of the pie's slices.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int VPieModelMapper::labelsColumn
- Defines which column of the model is kept in sync with the labels of the pie's slices. Default value is -1 (invalid
- mapping).
-*/
-
-/*!
- \property QVPieModelMapper::firstRow
- \brief Defines which row of the model contains the first slice value.
-
- Minimal and default value is: 0
-*/
-/*!
- \qmlproperty int VPieModelMapper::firstRow
- Defines which row of the model contains the first slice value.
- The default value is 0.
-*/
-
-/*!
- \property QVPieModelMapper::rowCount
- \brief Defines the number of rows of the model that are mapped as the data for QPieSeries.
-
- Minimal and default value is: -1 (count limited by the number of rows in the model)
-*/
-/*!
- \qmlproperty int VPieModelMapper::columnCount
- Defines the number of rows of the model that are mapped as the data for QPieSeries. The default value is
- -1 (count limited by the number of rows in the model)
-*/
-
-/*!
- \fn void QVPieModelMapper::seriesReplaced()
-
- Emitted when the series to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QVPieModelMapper::modelReplaced()
-
- Emitted when the model to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QVPieModelMapper::valuesColumnChanged()
-
- Emitted when the valuesColumn has changed.
-*/
-
-/*!
- \fn void QVPieModelMapper::labelsColumnChanged()
-
- Emitted when the labelsColumn has changed.
-*/
-
-/*!
- \fn void QVPieModelMapper::firstRowChanged()
- Emitted when the firstRow has changed.
-*/
-
-/*!
- \fn void QVPieModelMapper::rowCountChanged()
- Emitted when the rowCount has changed.
-*/
-
-/*!
- Constructs a mapper object which is a child of \a parent.
-*/
-QVPieModelMapper::QVPieModelMapper(QObject *parent) :
- QPieModelMapper(parent)
-{
- QPieModelMapper::setOrientation(Qt::Vertical);
-}
-
-QAbstractItemModel *QVPieModelMapper::model() const
-{
- return QPieModelMapper::model();
-}
-
-void QVPieModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model != QPieModelMapper::model()) {
- QPieModelMapper::setModel(model);
- emit modelReplaced();
- }
-}
-
-QPieSeries *QVPieModelMapper::series() const
-{
- return QPieModelMapper::series();
-}
-
-void QVPieModelMapper::setSeries(QPieSeries *series)
-{
- if (series != QPieModelMapper::series()) {
- QPieModelMapper::setSeries(series);
- emit seriesReplaced();
- }
-}
-
-/*!
- Returns which column of the model is kept in sync with the values of the pie's slices
-*/
-int QVPieModelMapper::valuesColumn() const
-{
- return QPieModelMapper::valuesSection();
-}
-
-/*!
- Sets the model column that is kept in sync with the pie slices values.
- Parameter \a valuesColumn specifies the row of the model.
-*/
-void QVPieModelMapper::setValuesColumn(int valuesColumn)
-{
- if (valuesColumn != valuesSection()) {
- QPieModelMapper::setValuesSection(valuesColumn);
- emit valuesColumnChanged();
- }
-}
-
-/*!
- Returns which column of the model is kept in sync with the labels of the pie's slices
-*/
-int QVPieModelMapper::labelsColumn() const
-{
- return QPieModelMapper::labelsSection();
-}
-
-/*!
- Sets the model column that is kept in sync with the pie's slices labels.
- Parameter \a labelsColumn specifies the row of the model.
-*/
-void QVPieModelMapper::setLabelsColumn(int labelsColumn)
-{
- if (labelsColumn != labelsSection()) {
- QPieModelMapper::setLabelsSection(labelsColumn);
- emit labelsColumnChanged();
- }
-}
-
-int QVPieModelMapper::firstRow() const
-{
- return first();
-}
-
-void QVPieModelMapper::setFirstRow(int firstRow)
-{
- if (firstRow != first()) {
- setFirst(firstRow);
- emit firstRowChanged();
- }
-}
-
-int QVPieModelMapper::rowCount() const
-{
- return count();
-}
-
-void QVPieModelMapper::setRowCount(int rowCount)
-{
- if (rowCount != count()) {
- setCount(rowCount);
- emit rowCountChanged();
- }
-}
-
-#include "moc_qvpiemodelmapper.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/piechart/qvpiemodelmapper.h b/src/piechart/qvpiemodelmapper.h
deleted file mode 100644
index 095ba270..00000000
--- a/src/piechart/qvpiemodelmapper.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVPIEMODELMAPPER_H
-#define QVPIEMODELMAPPER_H
-
-#include "qpiemodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_EXPORT QVPieModelMapper : public QPieModelMapper
-{
- Q_OBJECT
- Q_PROPERTY(QPieSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
- Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
- Q_PROPERTY(int valuesColumn READ valuesColumn WRITE setValuesColumn NOTIFY valuesColumnChanged)
- Q_PROPERTY(int labelsColumn READ labelsColumn WRITE setLabelsColumn NOTIFY labelsColumnChanged)
- Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
- Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
-
-public:
- explicit QVPieModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QPieSeries *series() const;
- void setSeries(QPieSeries *series);
-
- int valuesColumn() const;
- void setValuesColumn(int valuesColumn);
-
- int labelsColumn() const;
- void setLabelsColumn(int labelsColumn);
-
- int firstRow() const;
- void setFirstRow(int firstRow);
-
- int rowCount() const;
- void setRowCount(int rowCount);
-
-Q_SIGNALS:
- void seriesReplaced();
- void modelReplaced();
- void valuesColumnChanged();
- void labelsColumnChanged();
- void firstRowChanged();
- void rowCountChanged();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QVPIEMODELMAPPER_H
diff --git a/src/qabstractseries.cpp b/src/qabstractseries.cpp
deleted file mode 100644
index f88d2cfc..00000000
--- a/src/qabstractseries.cpp
+++ /dev/null
@@ -1,333 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractseries.h"
-#include "qabstractseries_p.h"
-#include "chartdataset_p.h"
-#include "qchart.h"
-#include "qchart_p.h"
-#include "chartitem_p.h"
-#include "xydomain_p.h"
-#include "xlogydomain_p.h"
-#include "logxydomain_p.h"
-#include "logxlogydomain_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QAbstractSeries
- \inmodule Qt Charts
- \brief Base class for all Qt Chart series.
- \mainclass
-
- Usually you use the series type specific inherited classes instead of the base class.
- \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries,
- QPercentBarSeries, QPieSeries
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype AbstractSeries
- \instantiates QAbstractSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/abstractseries.qdocinc
-*/
-#else
-/*!
- \qmlclass AbstractSeries QAbstractSeries
-
- \include ../doc/src/abstractseries.qdocinc
-*/
-#endif
-
-/*!
- \enum QAbstractSeries::SeriesType
-
- The type of the series object.
-
- \value SeriesTypeLine
- \value SeriesTypeArea
- \value SeriesTypeBar
- \value SeriesTypeStackedBar
- \value SeriesTypePercentBar
- \value SeriesTypePie
- \value SeriesTypeScatter
- \value SeriesTypeSpline
- \value SeriesTypeHorizontalBar
- \value SeriesTypeHorizontalStackedBar
- \value SeriesTypeHorizontalPercentBar
- \value SeriesTypeBoxPlot
-*/
-
-/*!
- \property QAbstractSeries::type
- The type of the series.
-*/
-/*!
- \qmlproperty ChartView.SeriesType AbstractSeries::type
- The type of the series.
-*/
-
-/*!
- \property QAbstractSeries::name
- \brief name of the series property. The name is shown in legend for series and supports html formatting.
-*/
-/*!
- \qmlproperty string AbstractSeries::name
- Name of the series. The name is shown in legend for series and supports html formatting.
-*/
-
-/*!
- \fn void QAbstractSeries::nameChanged()
- This signal is emitted when the series name changes.
-*/
-/*!
- \qmlsignal AbstractSeries::onNameChanged()
- This signal is emitted when the series name changes.
-*/
-
-/*!
- \property QAbstractSeries::visible
- \brief whether the series is visible or not; true by default.
-*/
-/*!
- \qmlproperty bool AbstractSeries::visible
- Visibility of the series. True by default.
-*/
-
-/*!
- \fn void QAbstractSeries::visibleChanged()
- Emitted when the series visibility changes.
-*/
-/*!
- \qmlsignal AbstractSeries::onVisibleChanged()
- Emitted when the series visibility changes.
-*/
-
-/*!
- \property QAbstractSeries::opacity
- \brief The opacity of the series.
-
- By default the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque).
-*/
-/*!
- \qmlproperty real AbstractSeries::opacity
- The opacity of the series. By default the opacity is 1.0.
- The valid values range from 0.0 (transparent) to 1.0 (opaque).
-*/
-
-/*!
- \fn void QAbstractSeries::opacityChanged()
- Emitted when the opacity of the series changes.
-*/
-/*!
- \qmlsignal AbstractSeries::onOpacityChanged()
- Emitted when the opacity of the series changes.
-*/
-
-/*!
- \internal
- \brief Constructs QAbstractSeries object with \a parent.
-*/
-QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) :
- QObject(parent),
- d_ptr(&d)
-{
-}
-
-/*!
- \brief Virtual destructor for the chart series.
-*/
-QAbstractSeries::~QAbstractSeries()
-{
- if (d_ptr->m_chart)
- qFatal("Series still bound to a chart when destroyed!");
-}
-
-void QAbstractSeries::setName(const QString &name)
-{
- if (name != d_ptr->m_name) {
- d_ptr->m_name = name;
- emit nameChanged();
- }
-}
-
-QString QAbstractSeries::name() const
-{
- return d_ptr->m_name;
-}
-
-void QAbstractSeries::setVisible(bool visible)
-{
- if (visible != d_ptr->m_visible) {
- d_ptr->m_visible = visible;
- emit visibleChanged();
- }
-}
-
-bool QAbstractSeries::isVisible() const
-{
- return d_ptr->m_visible;
-}
-
-qreal QAbstractSeries::opacity() const
-{
- return d_ptr->m_opacity;
-}
-
-void QAbstractSeries::setOpacity(qreal opacity)
-{
- if (opacity != d_ptr->m_opacity) {
- d_ptr->m_opacity = opacity;
- emit opacityChanged();
- }
-}
-
-/*!
- \brief Returns the chart where series belongs to.
-
- Set automatically when the series is added to the chart
- and unset when the series is removed from the chart.
-*/
-QChart *QAbstractSeries::chart() const
-{
- return d_ptr->m_chart;
-}
-
-/*!
- \brief Sets the visibility of the series to true.
-
- \sa setVisible(), isVisible()
-*/
-void QAbstractSeries::show()
-{
- setVisible(true);
-}
-
-/*!
- \brief Sets the visibility of the series to false.
-
- \sa setVisible(), isVisible()
-*/
-void QAbstractSeries::hide()
-{
- setVisible(false);
-}
-
-/*!
- Attach \a axis to the series.
- \return true if the axis was attached successfully, false otherwise.
- \note If multiple axes of same orientation are attached to same series,
- they will have same min/max ranges.
- \sa QChart::addAxis(), QChart::createDefaultAxes()
- */
-bool QAbstractSeries::attachAxis(QAbstractAxis* axis)
-{
- if(d_ptr->m_chart) {
- return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this, axis);
- } else {
- qWarning()<<"Series not in the chart. Please addSeries to chart first.";
- return false;
- }
-}
-
-/*!
- Detach \a axis from the series.
- \return true if the axis was detached successfully, false otherwise.
- \sa QChart::removeAxis()
- */
-bool QAbstractSeries::detachAxis(QAbstractAxis* axis)
-{
- if(d_ptr->m_chart) {
- return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this, axis);
- }
- else {
- qWarning()<<"Series not in the chart. Please addSeries to chart first.";
- return false;
- }
-}
-
-/*!
- Returns the list of axes attached to the series. Usually there is an x-axis and a y-axis attached to a series, except
- in case of a QPieSeries, which does not have any axes attached.
- \sa attachAxis(), detachAxis()
- */
-QList<QAbstractAxis*> QAbstractSeries::attachedAxes()
-{
- return d_ptr->m_axes;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q)
- : q_ptr(q),
- m_chart(0),
- m_item(0),
- m_domain(new XYDomain()),
- m_visible(true),
- m_opacity(1.0)
-{
-}
-
-QAbstractSeriesPrivate::~QAbstractSeriesPrivate()
-{
-}
-
-void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain)
-{
- Q_ASSERT(domain);
- if(m_domain.data()!=domain) {
- if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated()));
- m_domain.reset(domain);
- if(!m_item.isNull()) {
- QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
- m_item->handleDomainUpdated();
- }
- }
-}
-
-void QAbstractSeriesPrivate::setPresenter(ChartPresenter *presenter)
-{
- m_presenter = presenter;
-}
-
-ChartPresenter *QAbstractSeriesPrivate::presenter() const
-{
- return m_presenter;
-}
-
-void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_ASSERT(!m_item.isNull());
- Q_UNUSED(parent);
- QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
-}
-
-void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
-{
- Q_UNUSED(options);
-}
-
-#include "moc_qabstractseries.cpp"
-#include "moc_qabstractseries_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-
diff --git a/src/qabstractseries.h b/src/qabstractseries.h
deleted file mode 100644
index 7e698a51..00000000
--- a/src/qabstractseries.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTSERIES_H
-#define QABSTRACTSERIES_H
-
-#include <qchartglobal.h>
-#include <qabstractaxis.h>
-#include <QObject>
-#include <QPen>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractSeriesPrivate;
-class QChart;
-
-class QTCOMMERCIALCHART_EXPORT QAbstractSeries : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
- Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
- Q_PROPERTY(SeriesType type READ type)
- Q_ENUMS(SeriesType)
-
-public:
- enum SeriesType {
- SeriesTypeLine,
- SeriesTypeArea,
- SeriesTypeBar,
- SeriesTypeStackedBar,
- SeriesTypePercentBar,
- SeriesTypePie,
- SeriesTypeScatter,
- SeriesTypeSpline,
- SeriesTypeHorizontalBar,
- SeriesTypeHorizontalStackedBar,
- SeriesTypeHorizontalPercentBar,
- SeriesTypeBoxPlot
- };
-
-protected:
- QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent = 0);
-
-public:
- ~QAbstractSeries();
- virtual SeriesType type() const = 0;
-
- void setName(const QString &name);
- QString name() const;
- void setVisible(bool visible = true);
- bool isVisible() const;
- qreal opacity() const;
- void setOpacity(qreal opacity);
-
- QChart *chart() const;
-
- bool attachAxis(QAbstractAxis *axis);
- bool detachAxis(QAbstractAxis *axis);
- QList<QAbstractAxis*> attachedAxes();
-
- void show();
- void hide();
-
-Q_SIGNALS:
- void nameChanged();
- void visibleChanged();
- void opacityChanged();
-
-protected:
- QScopedPointer<QAbstractSeriesPrivate> d_ptr;
- friend class ChartDataSet;
- friend class ChartPresenter;
- friend class ChartThemeManager;
- friend class QLegendPrivate;
- friend class DeclarativeChart;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QABSTRACTSERIES_H
diff --git a/src/qabstractseries_p.h b/src/qabstractseries_p.h
deleted file mode 100644
index 2838fea8..00000000
--- a/src/qabstractseries_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QABSTRACTSERIES_P_H
-#define QABSTRACTSERIES_P_H
-
-#include "qabstractseries.h"
-#include "qchart.h"
-#include "abstractdomain_p.h"
-
-class QGraphicsItem;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartPresenter;
-class ChartElement;
-class LegendMarker;
-class QLegend;
-class ChartDataSet;
-class QAbstractAxis;
-class QLegendMarker;
-class ChartTheme;
-class ChartAnimation;
-class ChartItem;
-class BoxPlotChartItem;
-
-class QAbstractSeriesPrivate : public QObject
-{
- Q_OBJECT
-public:
- QAbstractSeriesPrivate(QAbstractSeries *q);
- ~QAbstractSeriesPrivate();
-
- virtual void initializeDomain() = 0;
- virtual void initializeAxes() = 0;
- virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0;
- virtual void initializeGraphics(QGraphicsItem* parent) = 0;
- virtual void initializeAnimations(QChart::AnimationOptions options) = 0;
-
- virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0;
-
- virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0;
- virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0;
-
- ChartItem* chartItem() { return m_item.data(); }
-
- virtual void setDomain(AbstractDomain* domain);
- AbstractDomain* domain() { return m_domain.data(); }
-
- virtual void setPresenter(ChartPresenter *presenter);
- ChartPresenter *presenter() const;
-
- QChart* chart() { return m_chart; }
-
-Q_SIGNALS:
- void countChanged();
-
-protected:
- QAbstractSeries *q_ptr;
- QChart *m_chart;
- QScopedPointer<ChartItem> m_item;
- QList<QAbstractAxis*> m_axes;
-private:
- QScopedPointer<AbstractDomain> m_domain;
- QString m_name;
- bool m_visible;
- qreal m_opacity;
- ChartPresenter *m_presenter;
-
- friend class QAbstractSeries;
- friend class ChartDataSet;
- friend class ChartPresenter;
- friend class QLegendPrivate;
- friend class BoxPlotChartItem;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/qchart.cpp b/src/qchart.cpp
deleted file mode 100644
index 16391b9a..00000000
--- a/src/qchart.cpp
+++ /dev/null
@@ -1,872 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qchart.h"
-#include "qchart_p.h"
-#include "legendscroller_p.h"
-#include "qlegend_p.h"
-#include "chartbackground_p.h"
-#include "qabstractaxis.h"
-#include "abstractchartlayout_p.h"
-#include "charttheme_p.h"
-#include "chartpresenter_p.h"
-#include "chartdataset_p.h"
-#include <QGraphicsScene>
-#include <QGraphicsSceneResizeEvent>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \enum QChart::ChartTheme
-
- This enum describes the theme used by the chart.
-
- \value ChartThemeLight The default theme
- \value ChartThemeBlueCerulean
- \value ChartThemeDark
- \value ChartThemeBrownSand
- \value ChartThemeBlueNcs
- \value ChartThemeHighContrast
- \value ChartThemeBlueIcy
- \value ChartThemeQt
- */
-
-/*!
- \enum QChart::AnimationOption
-
- For enabling/disabling animations. Defaults to NoAnimation.
-
- \value NoAnimation
- \value GridAxisAnimations
- \value SeriesAnimations
- \value AllAnimations
- */
-
-/*!
- \enum QChart::ChartType
-
- This enum describes the chart type.
-
- \value ChartTypeUndefined
- \value ChartTypeCartesian
- \value ChartTypePolar
- */
-
-/*!
- \class QChart
- \inmodule Qt Charts
- \brief Main chart API for Qt Charts.
-
- QChart is a QGraphicsWidget that you can show in a QGraphicsScene. It manages the graphical
- representation of different types of series and other chart related objects like legend and
- axes. If you simply want to show a chart in a layout, you can use the
- convenience class QChartView instead of QChart.
- \sa QChartView, QPolarChart
- */
-
-/*!
- \property QChart::animationOptions
- The animation \a options for the chart. Animations are enabled/disabled based on this setting.
- */
-
-/*!
- \property QChart::backgroundVisible
- Specifies whether the chart background is visible or not.
- \sa setBackgroundBrush(), setBackgroundPen(), plotAreaBackgroundVisible
- */
-
-/*!
- \property QChart::dropShadowEnabled
- If set to true, the background drop shadow effect is enabled. If set to false, it is disabled. Note that the drop
- shadow effect depends on theme, which means the setting may be changed if you switch to another theme.
- */
-
-/*!
- \property QChart::backgroundRoundness
- The diameter of the rounding cirle at the corners of the chart background.
- */
-
-/*!
- \property QChart::minimumMargins
- Minimum margins between the plot area (axes) and the edge of the chart widget.
- This property is deprecated; use margins property instead.
-
- \sa margins
- */
-
-/*!
- \property QChart::margins
- Margins between the plot area (axes) and the edge of the chart widget.
- */
-
-/*!
- \property QChart::theme
- Theme is a built-in collection of UI style related settings applied for all visual elements of a chart, like colors,
- pens, brushes, and fonts of series, axes, title, and legend. \l {Chart themes demo} shows an example with a few
- different themes.
- \note Changing the theme will overwrite all customizations previously applied to the series.
- */
-
-/*!
- \property QChart::title
- Title is the name (label) of a chart. It is shown as a headline on top of the chart. Chart title supports html formatting.
- */
-
-/*!
- \property QChart::chartType
- Chart type indicates if the chart is a cartesian chart or a polar chart.
- This property is set internally and it is read only.
- \sa QPolarChart
- */
-
-/*!
- \property QChart::plotAreaBackgroundVisible
- Specifies whether the chart plot area background is visible or not.
- \note By default the plot area background is not visible and the plot area uses
- the general chart background.
- \sa setPlotAreaBackgroundBrush(), setPlotAreaBackgroundPen(), backgroundVisible
- */
-
-/*!
- \property QChart::localizeNumbers
- \since QtCharts 2.0
- When \c{true}, all generated numbers appearing in various series and axis labels will be
- localized using the QLocale set with the locale property.
- When \c{false}, the "C" locale is always used.
- Defaults to \c{false}.
- \note This property doesn't affect QDateTimeAxis labels, which always use the QLocale set with
- the locale property.
-
- \sa locale
-*/
-
-/*!
- \property QChart::locale
- \since QtCharts 2.0
- Sets the locale used to format various chart labels when localizeNumbers is \c{true}.
- This also determines the locale used to format QDateTimeAxis labels regardless of
- localizeNumbers property.
- Defaults to application default locale at the time the chart is constructed.
-
- \sa localizeNumbers
-*/
-
-/*!
- \internal
- Constructs a chart object of \a type which is a child of a \a parent.
- Parameter \a wFlags is passed to the QGraphicsWidget constructor.
- This constructor is called only by subclasses.
-*/
-QChart::QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QGraphicsWidget(parent, wFlags),
- d_ptr(new QChartPrivate(this, type))
-{
- d_ptr->init();
-}
-
-/*!
- Constructs a chart object which is a child of a \a parent.
- Parameter \a wFlags is passed to the QGraphicsWidget constructor.
- */
-QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QGraphicsWidget(parent, wFlags),
- d_ptr(new QChartPrivate(this, ChartTypeCartesian))
-{
- d_ptr->init();
-}
-
-/*!
- Destroys the chart object and its children, like series and axis objects added to it.
- */
-QChart::~QChart()
-{
- //start by deleting dataset, it will remove all series and axes
- delete d_ptr->m_dataset;
- d_ptr->m_dataset = 0;
-}
-
-/*!
- Adds the \a series onto the chart and takes the ownership of it.
-
- \note A newly added series is attached to no axes by default, including any axes that were created for the chart
- using createDefaultAxes() before the series was added to the chart. If no axes are attached to
- the newly added series before the chart is shown, the series will get drawn as if it had axes with ranges
- that exactly fit the series to the plot area of the chart. This can be confusing if the same chart also displays other
- series that have properly attached axes, so always make sure you either call createDefaultAxes() after
- a series has been added or explicitly attach axes for the series.
-
- \sa removeSeries(), removeAllSeries(), createDefaultAxes(), QAbstractSeries::attachAxis()
- */
-void QChart::addSeries(QAbstractSeries *series)
-{
- Q_ASSERT(series);
- d_ptr->m_dataset->addSeries(series);
-}
-
-/*!
- Removes the \a series from the chart.
- The chart releases its ownership of the specified \a series object.
-
- \sa addSeries(), removeAllSeries()
- */
-void QChart::removeSeries(QAbstractSeries *series)
-{
- Q_ASSERT(series);
- d_ptr->m_dataset->removeSeries(series);
-}
-
-/*!
- Removes and deletes all series objects that have been added to the chart.
-
- \sa addSeries(), removeSeries()
- */
-void QChart::removeAllSeries()
-{
- foreach (QAbstractSeries *s , d_ptr->m_dataset->series()){
- removeSeries(s);
- delete s;
- }
-}
-
-/*!
- Sets the \a brush that is used for painting the background of the chart area.
- */
-void QChart::setBackgroundBrush(const QBrush &brush)
-{
- d_ptr->m_presenter->setBackgroundBrush(brush);
-}
-
-/*!
- Gets the brush that is used for painting the background of the chart area.
- */
-QBrush QChart::backgroundBrush() const
-{
- return d_ptr->m_presenter->backgroundBrush();
-}
-
-/*!
- Sets the \a pen that is used for painting the background of the chart area.
- */
-void QChart::setBackgroundPen(const QPen &pen)
-{
- d_ptr->m_presenter->setBackgroundPen(pen);
-}
-
-/*!
- Gets the pen that is used for painting the background of the chart area.
- */
-QPen QChart::backgroundPen() const
-{
- return d_ptr->m_presenter->backgroundPen();
-}
-
-void QChart::setTitle(const QString &title)
-{
- d_ptr->m_presenter->setTitle(title);
-}
-
-QString QChart::title() const
-{
- return d_ptr->m_presenter->title();
-}
-
-/*!
- Sets the \a font that is used for drawing the chart title.
- */
-void QChart::setTitleFont(const QFont &font)
-{
- d_ptr->m_presenter->setTitleFont(font);
-}
-
-/*!
- Gets the font that is used for drawing the chart title.
- */
-QFont QChart::titleFont() const
-{
- return d_ptr->m_presenter->titleFont();
-}
-
-/*!
- Sets the \a brush used for drawing the title text.
- */
-void QChart::setTitleBrush(const QBrush &brush)
-{
- d_ptr->m_presenter->setTitleBrush(brush);
-}
-
-/*!
- Returns the brush used for drawing the title text.
- */
-QBrush QChart::titleBrush() const
-{
- return d_ptr->m_presenter->titleBrush();
-}
-
-void QChart::setTheme(QChart::ChartTheme theme)
-{
- d_ptr->m_themeManager->setTheme(theme);
-}
-
-QChart::ChartTheme QChart::theme() const
-{
- return d_ptr->m_themeManager->theme()->id();
-}
-
-/*!
- Zooms in the view by a factor of two.
- */
-void QChart::zoomIn()
-{
- d_ptr->zoomIn(2.0);
-}
-
-/*!
- Zooms in the view to a maximum level at which \a rect is still fully visible.
- \note This is not supported for polar charts.
- */
-void QChart::zoomIn(const QRectF &rect)
-{
- if (d_ptr->m_type == QChart::ChartTypePolar)
- return;
- d_ptr->zoomIn(rect);
-}
-
-/*!
- Zooms out the view by a factor of two.
- */
-void QChart::zoomOut()
-{
- d_ptr->zoomOut(2.0);
-}
-
-/*!
- Zooms in the view by a custom \a factor.
-
- A factor over 1.0 zooms the view in and factor between 0.0 and 1.0 zooms out.
- */
-void QChart::zoom(qreal factor)
-{
- if (qFuzzyCompare(factor, 0))
- return;
-
- if (qFuzzyCompare(factor, (qreal)1.0))
- return;
-
- if (factor < 0)
- return;
-
- if (factor > 1.0)
- d_ptr->zoomIn(factor);
- else
- d_ptr->zoomOut(1.0 / factor);
-}
-
-
-/*!
- Resets the series domains to what they were before any zoom method was called.
- Note that this will also reset any scrolls and explicit axis range settings done between
- the first zoom operation and calling this method. If no zoom operation has been
- done, this method does nothing.
- */
-void QChart::zoomReset()
-{
- d_ptr->zoomReset();
-}
-
-/*!
- Returns true if any series has a zoomed domain.
- */
-bool QChart::isZoomed()
-{
- return d_ptr->isZoomed();
-}
-
-/*!
- Returns a pointer to the horizontal axis attached to the specified \a series.
- If no \a series is specified, the first horizontal axis added to the chart is returned.
-
- \sa addAxis(), QAbstractSeries::attachAxis()
- */
-QAbstractAxis *QChart::axisX(QAbstractSeries *series) const
-{
- QList<QAbstractAxis *> axisList = axes(Qt::Horizontal, series);
- if (axisList.count())
- return axisList[0];
- return 0;
-}
-
-/*!
- Returns a pointer to the vertical axis attached to the specified \a series.
- If no \a series is specified, the first vertical axis added to the chart is returned.
-
- \sa addAxis(), QAbstractSeries::attachAxis()
- */
-QAbstractAxis *QChart::axisY(QAbstractSeries *series) const
-{
- QList<QAbstractAxis *> axisList = axes(Qt::Vertical, series);
- if (axisList.count())
- return axisList[0];
- return 0;
-}
-
-/*!
- Returns the axes attached to the \a series with \a orientation. If no \a series is provided,
- then all axes added to the chart with the specified orientation are returned.
- \sa addAxis(), createDefaultAxes()
- */
-QList<QAbstractAxis *> QChart::axes(Qt::Orientations orientation, QAbstractSeries *series) const
-{
- QList<QAbstractAxis *> result ;
-
- if (series) {
- foreach (QAbstractAxis *axis, series->attachedAxes()){
- if (orientation.testFlag(axis->orientation()))
- result << axis;
- }
- } else {
- foreach (QAbstractAxis *axis, d_ptr->m_dataset->axes()){
- if (orientation.testFlag(axis->orientation()) && !result.contains(axis))
- result << axis;
- }
- }
-
- return result;
-}
-
-/*!
- Creates axes for the chart based on the series that have already been added to the chart. Any axes previously added to
- the chart will be deleted.
-
- \note This function has to be called after all series have been added to the chart. The axes created by this function
- will NOT get automatically attached to any series added to the chart after this function has been called.
- A series with no axes attached will by default scale to utilize the entire plot area of the chart, which can be confusing
- if there are other series with properly attached axes also present.
-
- \table
- \header
- \li Series type
- \li X-axis
- \li Y-axis
- \row
- \li QXYSeries
- \li QValueAxis
- \li QValueAxis
- \row
- \li QBarSeries
- \li QBarCategoryAxis
- \li QValueAxis
- \row
- \li QPieSeries
- \li None
- \li None
- \endtable
-
- If there are several QXYSeries derived series added to the chart and no series of other types have been added, then only one pair of axes is created.
- If there are several series of different types added to the chart, then each series gets its own axes pair.
-
- The axes specific to the series can be later obtained from the chart by providing the series as the parameter for axes() function call.
- QPieSeries does not create any axes.
-
- \sa axisX(), axisY(), axes(), setAxisX(), setAxisY(), QAbstractSeries::attachAxis()
- */
-void QChart::createDefaultAxes()
-{
- d_ptr->m_dataset->createDefaultAxes();
-}
-
-/*!
- Returns the legend object of the chart. Ownership stays with the chart.
- */
-QLegend *QChart::legend() const
-{
- return d_ptr->m_legend;
-}
-
-void QChart::setMinimumMargins(const QMargins &margins)
-{
- qWarning() << "QChart::setMinimumMargins is deprecated. Use QChart::setMargins instead.";
- d_ptr->m_presenter->layout()->setMargins(margins);
-}
-
-QMargins QChart::minimumMargins() const
-{
- qWarning() << "QChart::minimumMargins is deprecated. Use QChart::margins instead.";
- return d_ptr->m_presenter->layout()->margins();
-}
-
-void QChart::setMargins(const QMargins &margins)
-{
- d_ptr->m_presenter->layout()->setMargins(margins);
-}
-
-QMargins QChart::margins() const
-{
- return d_ptr->m_presenter->layout()->margins();
-}
-
-QChart::ChartType QChart::chartType() const
-{
- return d_ptr->m_type;
-}
-
-/*!
- Returns the the rectangle within which the drawing of the chart is done.
- It does not include the area defined by margins.
- */
-QRectF QChart::plotArea() const
-{
- return d_ptr->m_presenter->geometry();
-}
-
-/*!
- Sets the \a brush for the background of the plot area of the chart.
-
- \sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundPen(), plotAreaBackgroundBrush()
- */
-void QChart::setPlotAreaBackgroundBrush(const QBrush &brush)
-{
- d_ptr->m_presenter->setPlotAreaBackgroundBrush(brush);
-}
-
-/*!
- Returns the brush for the background of the plot area of the chart.
-
- \sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundPen(), setPlotAreaBackgroundBrush()
- */
-QBrush QChart::plotAreaBackgroundBrush() const
-{
- return d_ptr->m_presenter->plotAreaBackgroundBrush();
-}
-
-/*!
- Sets the \a pen for the background of the plot area of the chart.
-
- \sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundBrush(), plotAreaBackgroundPen()
- */
-void QChart::setPlotAreaBackgroundPen(const QPen &pen)
-{
- d_ptr->m_presenter->setPlotAreaBackgroundPen(pen);
-}
-
-/*!
- Returns the pen for the background of the plot area of the chart.
-
- \sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundBrush(), setPlotAreaBackgroundPen()
- */
-QPen QChart::plotAreaBackgroundPen() const
-{
- return d_ptr->m_presenter->plotAreaBackgroundPen();
-}
-
-void QChart::setPlotAreaBackgroundVisible(bool visible)
-{
- d_ptr->m_presenter->setPlotAreaBackgroundVisible(visible);
-}
-
-bool QChart::isPlotAreaBackgroundVisible() const
-{
- return d_ptr->m_presenter->isPlotAreaBackgroundVisible();
-}
-
-void QChart::setLocalizeNumbers(bool localize)
-{
- d_ptr->m_presenter->setLocalizeNumbers(localize);
-}
-
-bool QChart::localizeNumbers() const
-{
- return d_ptr->m_presenter->localizeNumbers();
-}
-
-void QChart::setLocale(const QLocale &locale)
-{
- d_ptr->m_presenter->setLocale(locale);
-}
-
-QLocale QChart::locale() const
-{
- return d_ptr->m_presenter->locale();
-}
-
-void QChart::setAnimationOptions(AnimationOptions options)
-{
- d_ptr->m_presenter->setAnimationOptions(options);
-}
-
-QChart::AnimationOptions QChart::animationOptions() const
-{
- return d_ptr->m_presenter->animationOptions();
-}
-
-/*!
- Scrolls the visible area of the chart by the distance defined in the \a dx and \a dy.
-
- For polar charts, \a dx indicates the angle along angular axis instead of distance.
- */
-void QChart::scroll(qreal dx, qreal dy)
-{
- d_ptr->scroll(dx,dy);
-}
-
-void QChart::setBackgroundVisible(bool visible)
-{
- d_ptr->m_presenter->setBackgroundVisible(visible);
-}
-
-bool QChart::isBackgroundVisible() const
-{
- return d_ptr->m_presenter->isBackgroundVisible();
-}
-
-void QChart::setDropShadowEnabled(bool enabled)
-{
- d_ptr->m_presenter->setBackgroundDropShadowEnabled(enabled);
-}
-
-bool QChart::isDropShadowEnabled() const
-{
- return d_ptr->m_presenter->isBackgroundDropShadowEnabled();
-}
-
-void QChart::setBackgroundRoundness(qreal diameter)
-{
- d_ptr->m_presenter->setBackgroundRoundness(diameter);
-}
-
-qreal QChart::backgroundRoundness() const
-{
- return d_ptr->m_presenter->backgroundRoundness();
-}
-
-/*!
- Returns all series that are added to the chart.
-
- \sa addSeries(), removeSeries(), removeAllSeries()
-*/
-QList<QAbstractSeries *> QChart::series() const
-{
- return d_ptr->m_dataset->series();
-}
-
-/*!
- Adds the \a axis to the chart and attaches it to the \a series as a bottom-aligned horizontal axis.
- The chart takes ownership of both the \a axis and the \a series.
- Any horizontal axes previously attached to the \a series are deleted.
-
- \sa axisX(), axisY(), setAxisY(), createDefaultAxes(), QAbstractSeries::attachAxis()
-*/
-void QChart::setAxisX(QAbstractAxis *axis ,QAbstractSeries *series)
-{
- QList<QAbstractAxis*> list = axes(Qt::Horizontal, series);
-
- foreach (QAbstractAxis* a, list) {
- d_ptr->m_dataset->removeAxis(a);
- delete a;
- }
-
- if (!d_ptr->m_dataset->axes().contains(axis))
- d_ptr->m_dataset->addAxis(axis, Qt::AlignBottom);
- d_ptr->m_dataset->attachAxis(series, axis);
-}
-
-/*!
- Adds the \a axis to the chart and attaches it to the \a series as a left-aligned vertical axis.
- The chart takes ownership of both the \a axis and the \a series.
- Any vertical axes previously attached to the \a series are deleted.
-
- \sa axisX(), axisY(), setAxisX(), createDefaultAxes(), QAbstractSeries::attachAxis()
-*/
-void QChart::setAxisY(QAbstractAxis *axis ,QAbstractSeries *series)
-{
- QList<QAbstractAxis*> list = axes(Qt::Vertical, series);
-
- foreach (QAbstractAxis* a, list) {
- d_ptr->m_dataset->removeAxis(a);
- delete a;
- }
-
- if (!d_ptr->m_dataset->axes().contains(axis))
- d_ptr->m_dataset->addAxis(axis, Qt::AlignLeft);
- d_ptr->m_dataset->attachAxis(series, axis);
-}
-
-/*!
- Adds the \a axis to the chart with \a alignment. The chart takes the ownership of the axis.
-
- \sa removeAxis(), createDefaultAxes(), QAbstractSeries::attachAxis()
-*/
-void QChart::addAxis(QAbstractAxis *axis, Qt::Alignment alignment)
-{
- d_ptr->m_dataset->addAxis(axis, alignment);
-}
-
-/*!
- Removes the \a axis from the chart.
- The chart releases its ownership of the specified \a axis object.
-
- \sa addAxis(), createDefaultAxes(), QAbstractSeries::detachAxis()
-*/
-void QChart::removeAxis(QAbstractAxis *axis)
-{
- d_ptr->m_dataset->removeAxis(axis);
-}
-
-/*!
- Returns the value in the \a series domain that corresponds to the \a position relative to chart widget.
-*/
-QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series)
-{
- return d_ptr->m_dataset->mapToValue(position, series);
-}
-
-/*!
- Returns the position on the chart widget that corresponds to the \a value in the \a series domain.
-*/
-QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series)
-{
- return d_ptr->m_dataset->mapToPosition(value, series);
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QChartPrivate::QChartPrivate(QChart *q, QChart::ChartType type):
- q_ptr(q),
- m_legend(0),
- m_dataset(new ChartDataSet(q)),
- m_presenter(new ChartPresenter(q, type)),
- m_themeManager(new ChartThemeManager(q)),
- m_type(type)
-{
- QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_presenter, SLOT(handleSeriesAdded(QAbstractSeries*)));
- QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_presenter, SLOT(handleSeriesRemoved(QAbstractSeries*)));
- QObject::connect(m_dataset, SIGNAL(axisAdded(QAbstractAxis*)), m_presenter, SLOT(handleAxisAdded(QAbstractAxis*)));
- QObject::connect(m_dataset, SIGNAL(axisRemoved(QAbstractAxis*)), m_presenter, SLOT(handleAxisRemoved(QAbstractAxis*)));
- QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_themeManager, SLOT(handleSeriesAdded(QAbstractSeries*)));
- QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_themeManager, SLOT(handleSeriesRemoved(QAbstractSeries*)));
- QObject::connect(m_dataset, SIGNAL(axisAdded(QAbstractAxis*)), m_themeManager, SLOT(handleAxisAdded(QAbstractAxis*)));
- QObject::connect(m_dataset, SIGNAL(axisRemoved(QAbstractAxis*)), m_themeManager, SLOT(handleAxisRemoved(QAbstractAxis*)));
-}
-
-QChartPrivate::~QChartPrivate()
-{
-}
-
-// Hackish solution to the problem of explicitly assigning the default pen/brush/font
-// to a series or axis and having theme override it:
-// Initialize pens, brushes, and fonts to something nobody is likely to ever use,
-// so that default theme initialization will always set these properly.
-QPen &QChartPrivate::defaultPen()
-{
- static QPen defaultPen(QColor(1, 2, 0), 0.93247536);
- return defaultPen;
-}
-
-QBrush &QChartPrivate::defaultBrush()
-{
- static QBrush defaultBrush(QColor(1, 2, 0), Qt::Dense7Pattern);
- return defaultBrush;
-}
-
-QFont &QChartPrivate::defaultFont()
-{
- static bool defaultFontInitialized(false);
- static QFont defaultFont;
- if (!defaultFontInitialized) {
- defaultFont.setPointSizeF(8.34563465);
- defaultFontInitialized = true;
- }
- return defaultFont;
-}
-
-void QChartPrivate::init()
-{
- m_legend = new LegendScroller(q_ptr);
- q_ptr->setTheme(QChart::ChartThemeLight);
- q_ptr->setLayout(m_presenter->layout());
-}
-
-void QChartPrivate::zoomIn(qreal factor)
-{
- QRectF rect = m_presenter->geometry();
- rect.setWidth(rect.width() / factor);
- rect.setHeight(rect.height() / factor);
- rect.moveCenter(m_presenter->geometry().center());
- zoomIn(rect);
-}
-
-void QChartPrivate::zoomIn(const QRectF &rect)
-{
- if (!rect.isValid())
- return;
-
- QRectF r = rect.normalized();
- const QRectF geometry = m_presenter->geometry();
- r.translate(-geometry.topLeft());
-
- if (!r.isValid())
- return;
-
- QPointF zoomPoint(r.center().x() / geometry.width(), r.center().y() / geometry.height());
- m_presenter->setState(ChartPresenter::ZoomInState,zoomPoint);
- m_dataset->zoomInDomain(r);
- m_presenter->setState(ChartPresenter::ShowState,QPointF());
-
-}
-
-void QChartPrivate::zoomReset()
-{
- m_dataset->zoomResetDomain();
-}
-
-bool QChartPrivate::isZoomed()
-{
- return m_dataset->isZoomedDomain();
-}
-
-void QChartPrivate::zoomOut(qreal factor)
-{
- const QRectF geometry = m_presenter->geometry();
-
- QRectF r;
- r.setSize(geometry.size() / factor);
- r.moveCenter(QPointF(geometry.size().width()/2 ,geometry.size().height()/2));
- if (!r.isValid())
- return;
-
- QPointF zoomPoint(r.center().x() / geometry.width(), r.center().y() / geometry.height());
- m_presenter->setState(ChartPresenter::ZoomOutState,zoomPoint);
- m_dataset->zoomOutDomain(r);
- m_presenter->setState(ChartPresenter::ShowState,QPointF());
-}
-
-void QChartPrivate::scroll(qreal dx, qreal dy)
-{
- if (dx < 0) m_presenter->setState(ChartPresenter::ScrollLeftState,QPointF());
- if (dx > 0) m_presenter->setState(ChartPresenter::ScrollRightState,QPointF());
- if (dy < 0) m_presenter->setState(ChartPresenter::ScrollUpState,QPointF());
- if (dy > 0) m_presenter->setState(ChartPresenter::ScrollDownState,QPointF());
-
- m_dataset->scrollDomain(dx, dy);
- m_presenter->setState(ChartPresenter::ShowState,QPointF());
-}
-
-#include "moc_qchart.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/qchart.h b/src/qchart.h
deleted file mode 100644
index 337ad33a..00000000
--- a/src/qchart.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCHART_H
-#define QCHART_H
-
-#include <QAbstractSeries>
-#include <QLegend>
-#include <QGraphicsWidget>
-#include <QMargins>
-
-class QGraphicsSceneResizeEvent;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractSeries;
-class QAbstractAxis;
-class QLegend;
-class QChartPrivate;
-class QBoxPlotSeries;
-
-class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget
-{
- Q_OBJECT
- Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme)
- Q_PROPERTY(QString title READ title WRITE setTitle)
- Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible)
- Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled)
- Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness)
- Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions)
- Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)
- Q_PROPERTY(QMargins margins READ margins WRITE setMargins)
- Q_PROPERTY(QChart::ChartType chartType READ chartType)
- Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible)
- Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers)
- Q_PROPERTY(QLocale locale READ locale WRITE setLocale)
- Q_ENUMS(ChartTheme)
- Q_ENUMS(AnimationOption)
- Q_ENUMS(ChartType)
-
-public:
- enum ChartType {
- ChartTypeUndefined = 0,
- ChartTypeCartesian,
- ChartTypePolar
- };
-
- enum ChartTheme {
- ChartThemeLight = 0,
- ChartThemeBlueCerulean,
- ChartThemeDark,
- ChartThemeBrownSand,
- ChartThemeBlueNcs,
- ChartThemeHighContrast,
- ChartThemeBlueIcy,
- ChartThemeQt
- };
-
- enum AnimationOption {
- NoAnimation = 0x0,
- GridAxisAnimations = 0x1,
- SeriesAnimations = 0x2,
- AllAnimations = 0x3
- };
-
- Q_DECLARE_FLAGS(AnimationOptions, AnimationOption)
-
-public:
- explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
- ~QChart();
-
- void addSeries(QAbstractSeries *series);
- void removeSeries(QAbstractSeries *series);
- void removeAllSeries();
- QList<QAbstractSeries *> series() const;
-
- // *** deprecated ***
- void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0);
- void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0);
- QAbstractAxis *axisX(QAbstractSeries *series = 0) const;
- QAbstractAxis *axisY(QAbstractSeries *series = 0) const;
- // ******************
-
- void addAxis(QAbstractAxis *axis, Qt::Alignment alignment);
- void removeAxis(QAbstractAxis *axis);
- QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const;
-
- void createDefaultAxes();
-
- void setTheme(QChart::ChartTheme theme);
- QChart::ChartTheme theme() const;
-
- void setTitle(const QString &title);
- QString title() const;
- void setTitleFont(const QFont &font);
- QFont titleFont() const;
- void setTitleBrush(const QBrush &brush);
- QBrush titleBrush() const;
-
- void setBackgroundBrush(const QBrush &brush);
- QBrush backgroundBrush() const;
- void setBackgroundPen(const QPen &pen);
- QPen backgroundPen() const;
- void setBackgroundVisible(bool visible = true);
- bool isBackgroundVisible() const;
-
- void setDropShadowEnabled(bool enabled = true);
- bool isDropShadowEnabled() const;
- void setBackgroundRoundness(qreal diameter);
- qreal backgroundRoundness() const;
- void setAnimationOptions(AnimationOptions options);
- AnimationOptions animationOptions() const;
-
- void zoomIn();
- void zoomOut();
-
- void zoomIn(const QRectF &rect);
- void zoom(qreal factor);
- void zoomReset();
- bool isZoomed();
-
- void scroll(qreal dx, qreal dy);
-
- QLegend *legend() const;
-
- void setMinimumMargins(const QMargins& margins);
- QMargins minimumMargins() const;
-
- void setMargins(const QMargins &margins);
- QMargins margins() const;
-
- QRectF plotArea() const;
- void setPlotAreaBackgroundBrush(const QBrush &brush);
- QBrush plotAreaBackgroundBrush() const;
- void setPlotAreaBackgroundPen(const QPen &pen);
- QPen plotAreaBackgroundPen() const;
- void setPlotAreaBackgroundVisible(bool visible = true);
- bool isPlotAreaBackgroundVisible() const;
- void setLocalizeNumbers(bool localize);
- bool localizeNumbers() const;
- void setLocale(const QLocale &locale);
- QLocale locale() const;
-
- QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0);
- QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0);
-
- ChartType chartType() const;
-
-protected:
- explicit QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags);
- QScopedPointer<QChartPrivate> d_ptr;
- friend class QLegend;
- friend class DeclarativeChart;
- friend class ChartDataSet;
- friend class ChartPresenter;
- friend class ChartThemeManager;
- friend class QAbstractSeries;
- friend class QBoxPlotSeriesPrivate;
- Q_DISABLE_COPY(QChart)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QTCOMMERCIALCHART_NAMESPACE::QChart::AnimationOptions)
-
-#endif // QCHART_H
diff --git a/src/qchart_p.h b/src/qchart_p.h
deleted file mode 100644
index 07445593..00000000
--- a/src/qchart_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QCHART_P_H
-#define QCHART_P_H
-
-#include "qchartglobal.h"
-#include "qchart.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeManager;
-class ChartPresenter;
-class QLegend;
-class ChartDataSet;
-
-class QChartPrivate
-{
-
-public:
- QChartPrivate(QChart *q, QChart::ChartType type);
- ~QChartPrivate();
- QChart *q_ptr;
- QLegend *m_legend;
- ChartDataSet *m_dataset;
- ChartPresenter *m_presenter;
- ChartThemeManager *m_themeManager;
- QChart::ChartType m_type;
-
- static QPen &defaultPen();
- static QBrush &defaultBrush();
- static QFont &defaultFont();
-
- void init();
- void zoomIn(qreal factor);
- void zoomOut(qreal factor);
- void zoomIn(const QRectF &rect);
- void zoomReset();
- bool isZoomed();
- void scroll(qreal dx, qreal dy);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-#endif
diff --git a/src/qchartglobal.h b/src/qchartglobal.h
deleted file mode 100644
index 33f09784..00000000
--- a/src/qchartglobal.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCHARTGLOBAL_H
-#define QCHARTGLOBAL_H
-
-#include <qglobal.h>
-
-#define QTCOMMERCIALCHART_VERSION_STR "1.4.0"
-/*
- QTCOMMERCIALCHART_VERSION is (major << 16) + (minor << 8) + patch.
-*/
-#define QTCOMMERCIALCHART_VERSION 0x010400
-/*
- can be used like #if (QTCOMMERCIALCHART_VERSION >= QTCOMMERCIALCHART_VERSION_CHECK(1, 1, 0))
-*/
-#define QTCOMMERCIALCHART_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
-
-#if defined(QTCOMMERCIALCHART_LIBRARY)
-# define QTCOMMERCIALCHART_EXPORT Q_DECL_EXPORT
-#else
-# define QTCOMMERCIALCHART_EXPORT Q_DECL_IMPORT
-#endif
-
-#if defined(BUILD_PRIVATE_UNIT_TESTS) && defined(QTCOMMERCIALCHART_LIBRARY)
-# define QTCOMMERCIALCHART_AUTOTEST_EXPORT Q_DECL_EXPORT
-#elif defined(BUILD_PRIVATE_UNIT_TESTS) && !defined(QTCOMMERCIALCHART_LIBRARY)
-# define QTCOMMERCIALCHART_AUTOTEST_EXPORT Q_DECL_IMPORT
-#else
-# define QTCOMMERCIALCHART_AUTOTEST_EXPORT
-#endif
-
-#ifdef QTCOMMERCIALCHART_STATICLIB
-# undef QTCOMMERCIALCHART_EXPORT
-# undef QTCOMMERCIALCHART_AUTOTEST_EXPORT
-# define QTCOMMERCIALCHART_EXPORT
-# define QTCOMMERCIALCHART_AUTOTEST_EXPORT
-#endif
-
-#define QTCOMMERCIALCHART_NAMESPACE QtCommercialChart
-
-#ifdef QTCOMMERCIALCHART_NAMESPACE
-# define QTCOMMERCIALCHART_BEGIN_NAMESPACE namespace QTCOMMERCIALCHART_NAMESPACE {
-# define QTCOMMERCIALCHART_END_NAMESPACE }
-# define QTCOMMERCIALCHART_USE_NAMESPACE using namespace QTCOMMERCIALCHART_NAMESPACE;
-#else
-# define QTCOMMERCIALCHART_BEGIN_NAMESPACE
-# define QTCOMMERCIALCHART_END_NAMESPACE
-# define QTCOMMERCIALCHART_USE_NAMESPACE
-#endif
-
-#if defined(DEVELOPMENT_BUILD) && !defined(QT_NO_DEBUG)
-#include <stdarg.h>
-#include <QDebug>
-
-#define CHART_DEBUG chartDebug(3,__LINE__,__FILE__,__FUNCTION__)
-
-static inline QDebug chartDebug(int numargs,...)
-{
- va_list valist;
- va_start(valist, numargs);
- //for( int i = 0 ; i < numargs; i++ )
- int line = va_arg(valist, int);
- char *file = va_arg(valist, char *);
- char *function = va_arg(valist, char *);
- va_end(valist);
- return qDebug() << QString().append(function).append("(").append(file).append(":%1)").arg(line);
-}
-#endif
-
-/*
- On Windows min and max conflict with standard macros
-*/
-#ifdef Q_OS_WIN
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-#endif
-
-#endif // QCHARTGLOBAL_H
diff --git a/src/qchartview.cpp b/src/qchartview.cpp
deleted file mode 100644
index 34d20da2..00000000
--- a/src/qchartview.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qchartview.h"
-#include "qchartview_p.h"
-#include "qchart_p.h"
-#include <QGraphicsScene>
-#include <QRubberBand>
-
-/*!
- \enum QChartView::RubberBand
-
- This enum describes the different types of rubber bands that can be used for zoom rect selection
-
- \value NoRubberBand
- \value VerticalRubberBand
- \value HorizonalRubberBand
- \value RectangleRubberBand
-*/
-
-/*!
- \class QChartView
- \inmodule Qt Charts
- \brief Standalone charting widget.
-
- QChartView is a standalone widget that can display charts. It does not require separate
- QGraphicsScene to work. If you want to display a chart in your existing QGraphicsScene,
- you need to use the QChart (or QPolarChart) class instead.
-
- \sa QChart, QPolarChart
-*/
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- Constructs a chartView object with parent \a parent.
-*/
-
-QChartView::QChartView(QWidget *parent)
- : QGraphicsView(parent),
- d_ptr(new QChartViewPrivate(this))
-{
-
-}
-
-/*!
- Constructs a chartview object with parent \a parent to display a \a chart.
- Ownership of the \a chart is passed to chartview.
-*/
-
-QChartView::QChartView(QChart *chart, QWidget *parent)
- : QGraphicsView(parent),
- d_ptr(new QChartViewPrivate(this, chart))
-{
-
-}
-
-
-/*!
- Destroys the chartview object and the associated chart.
-*/
-QChartView::~QChartView()
-{
-}
-
-/*!
- Returns the pointer to the associated chart.
-*/
-QChart *QChartView::chart() const
-{
- return d_ptr->m_chart;
-}
-
-/*!
- Sets the current chart to \a chart. Ownership of the new chart is passed to chartview
- and ownership of the previous chart is released.
-
- To avoid memory leaks users need to make sure the previous chart is deleted.
-*/
-
-void QChartView::setChart(QChart *chart)
-{
- d_ptr->setChart(chart);
-}
-
-/*!
- Sets the rubber band flags to \a rubberBand.
- Selected flags determine the way zooming is performed.
-
- \note Rubber band zooming is not supported for polar charts.
-*/
-void QChartView::setRubberBand(const RubberBands &rubberBand)
-{
-#ifndef QT_NO_RUBBERBAND
- d_ptr->m_rubberBandFlags = rubberBand;
-
- if (!d_ptr->m_rubberBandFlags) {
- delete d_ptr->m_rubberBand;
- d_ptr->m_rubberBand = 0;
- return;
- }
-
- if (!d_ptr->m_rubberBand) {
- d_ptr->m_rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
- d_ptr->m_rubberBand->setEnabled(true);
- }
-#else
- Q_UNUSED(rubberBand);
- qWarning("Unable to set rubber band because Qt is configured without it.");
-#endif
-}
-
-/*!
- Returns the rubber band flags that are currently being used by the widget.
-*/
-QChartView::RubberBands QChartView::rubberBand() const
-{
- return d_ptr->m_rubberBandFlags;
-}
-
-/*!
- If Left mouse button is pressed and the rubber band is enabled the \a event is accepted and the rubber band is displayed on the screen allowing the user to select the zoom area.
- If different mouse button is pressed and/or the rubber band is disabled then the \a event is passed to QGraphicsView::mousePressEvent() implementation.
-*/
-void QChartView::mousePressEvent(QMouseEvent *event)
-{
-#ifndef QT_NO_RUBBERBAND
- QRectF plotArea = d_ptr->m_chart->plotArea();
- if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isEnabled()
- && event->button() == Qt::LeftButton && plotArea.contains(event->pos())) {
- d_ptr->m_rubberBandOrigin = event->pos();
- d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin, QSize()));
- d_ptr->m_rubberBand->show();
- event->accept();
- } else {
-#endif
- QGraphicsView::mousePressEvent(event);
-#ifndef QT_NO_RUBBERBAND
- }
-#endif
-}
-
-/*!
- If the rubber band rectange has been displayed in pressEvent then \a event data is used to update the rubber band geometry.
- Otherwise the default QGraphicsView::mouseMoveEvent implementation is called.
-*/
-void QChartView::mouseMoveEvent(QMouseEvent *event)
-{
-#ifndef QT_NO_RUBBERBAND
- if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
- QRect rect = d_ptr->m_chart->plotArea().toRect();
- int width = event->pos().x() - d_ptr->m_rubberBandOrigin.x();
- int height = event->pos().y() - d_ptr->m_rubberBandOrigin.y();
- if (!d_ptr->m_rubberBandFlags.testFlag(VerticalRubberBand)) {
- d_ptr->m_rubberBandOrigin.setY(rect.top());
- height = rect.height();
- }
- if (!d_ptr->m_rubberBandFlags.testFlag(HorizonalRubberBand)) {
- d_ptr->m_rubberBandOrigin.setX(rect.left());
- width = rect.width();
- }
- d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin.x(), d_ptr->m_rubberBandOrigin.y(), width, height).normalized());
- } else {
-#endif
- QGraphicsView::mouseMoveEvent(event);
-#ifndef QT_NO_RUBBERBAND
- }
-#endif
-}
-
-/*!
- If left mouse button is released and the rubber band is enabled then \a event is accepted and
- the view is zoomed into the rect specified by the rubber band.
- If it is a right mouse button \a event then the view is zoomed out.
-*/
-void QChartView::mouseReleaseEvent(QMouseEvent *event)
-{
-#ifndef QT_NO_RUBBERBAND
- if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
- if (event->button() == Qt::LeftButton) {
- d_ptr->m_rubberBand->hide();
- QRectF rect = d_ptr->m_rubberBand->geometry();
- // Since plotArea uses QRectF and rubberband uses QRect, we can't just blindly use
- // rubberband's dimensions for vertical and horizontal rubberbands, where one
- // dimension must match the corresponding plotArea dimension exactly.
- if (d_ptr->m_rubberBandFlags == VerticalRubberBand) {
- rect.setX(d_ptr->m_chart->plotArea().x());
- rect.setWidth(d_ptr->m_chart->plotArea().width());
- } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
- rect.setY(d_ptr->m_chart->plotArea().y());
- rect.setHeight(d_ptr->m_chart->plotArea().height());
- }
- d_ptr->m_chart->zoomIn(rect);
- event->accept();
- }
-
- } else if (d_ptr->m_rubberBand && event->button() == Qt::RightButton) {
- // If vertical or horizontal rubberband mode, restrict zoom out to specified axis.
- // Since there is no suitable API for that, use zoomIn with rect bigger than the
- // plot area.
- if (d_ptr->m_rubberBandFlags == VerticalRubberBand
- || d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
- QRectF rect = d_ptr->m_chart->plotArea();
- if (d_ptr->m_rubberBandFlags == VerticalRubberBand) {
- qreal adjustment = rect.height() / 2;
- rect.adjust(0, -adjustment, 0, adjustment);
- } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
- qreal adjustment = rect.width() / 2;
- rect.adjust(-adjustment, 0, adjustment, 0);
- }
- d_ptr->m_chart->zoomIn(rect);
- } else {
- d_ptr->m_chart->zoomOut();
- }
- event->accept();
- } else {
-#endif
- QGraphicsView::mouseReleaseEvent(event);
-#ifndef QT_NO_RUBBERBAND
- }
-#endif
-}
-
-/*!
- Resizes and updates the chart area using the \a event data
-*/
-void QChartView::resizeEvent(QResizeEvent *event)
-{
- QGraphicsView::resizeEvent(event);
- d_ptr->resize();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QChartViewPrivate::QChartViewPrivate(QChartView *q, QChart *chart)
- : q_ptr(q),
- m_scene(new QGraphicsScene(q)),
- m_chart(chart),
-#ifndef QT_NO_RUBBERBAND
- m_rubberBand(0),
-#endif
- m_rubberBandFlags(QChartView::NoRubberBand)
-{
- q_ptr->setFrameShape(QFrame::NoFrame);
- q_ptr->setBackgroundRole(QPalette::Window);
- q_ptr->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- q_ptr->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- q_ptr->setScene(m_scene);
- q_ptr->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- if (!m_chart)
- m_chart = new QChart();
- m_scene->addItem(m_chart);
-}
-
-QChartViewPrivate::~QChartViewPrivate()
-{
-}
-
-void QChartViewPrivate::setChart(QChart *chart)
-{
- Q_ASSERT(chart);
-
- if (m_chart == chart)
- return;
-
- if (m_chart)
- m_scene->removeItem(m_chart);
-
- m_chart = chart;
- m_scene->addItem(m_chart);
-
- resize();
-}
-
-void QChartViewPrivate::resize()
-{
- // Fit the chart into view if it has been rotated
- qreal sinA = qAbs(q_ptr->transform().m21());
- qreal cosA = qAbs(q_ptr->transform().m11());
- QSize chartSize = q_ptr->size();
-
- if (sinA == 1.0) {
- chartSize.setHeight(q_ptr->size().width());
- chartSize.setWidth(q_ptr->size().height());
- } else if (sinA != 0.0) {
- // Non-90 degree rotation, find largest square chart that can fit into the view.
- qreal minDimension = qMin(q_ptr->size().width(), q_ptr->size().height());
- qreal h = (minDimension - (minDimension / ((sinA / cosA) + 1.0))) / sinA;
- chartSize.setHeight(h);
- chartSize.setWidth(h);
- }
-
- m_chart->resize(chartSize);
- q_ptr->setMinimumSize(m_chart->minimumSize().toSize());
- q_ptr->setSceneRect(m_chart->geometry());
-}
-
-#include "moc_qchartview.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/qchartview.h b/src/qchartview.h
deleted file mode 100644
index b3d68fa3..00000000
--- a/src/qchartview.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCHARTVIEW_H
-#define QCHARTVIEW_H
-
-#include <QAbstractAxis>
-#include <QAbstractSeries>
-#include <QChart>
-#include <QGraphicsView>
-
-class QGraphicsScene;
-class QRubberBand;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QChartViewPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QChartView : public QGraphicsView
-{
- Q_OBJECT
- Q_ENUMS(RubberBand)
-public:
-
- enum RubberBand {
- NoRubberBand = 0x0,
- VerticalRubberBand = 0x1,
- HorizonalRubberBand = 0x2,
- RectangleRubberBand = 0x3
- };
-
- Q_DECLARE_FLAGS(RubberBands, RubberBand)
-
- explicit QChartView(QWidget *parent = 0);
- explicit QChartView(QChart *chart, QWidget *parent = 0);
- ~QChartView();
-
- void setRubberBand(const RubberBands &rubberBands);
- RubberBands rubberBand() const;
-
- QChart *chart() const;
- void setChart(QChart *chart);
-
-protected:
- void resizeEvent(QResizeEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
-
-protected:
- QScopedPointer<QChartViewPrivate> d_ptr;
- Q_DISABLE_COPY(QChartView)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QCHARTVIEW_H
diff --git a/src/qchartview_p.h b/src/qchartview_p.h
deleted file mode 100644
index a0eeb294..00000000
--- a/src/qchartview_p.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QCHARTVIEW_P_H
-#define QCHARTVIEW_P_H
-
-#include "qchartview.h"
-
-class QGraphicsScene;
-class ChartPresenter;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QChart;
-class QChartView;
-
-class QChartViewPrivate
-{
-public:
- explicit QChartViewPrivate(QChartView *q, QChart *chart = 0);
- ~QChartViewPrivate();
- void setChart(QChart *chart);
- void resize();
-
-protected:
- QChartView *q_ptr;
-
-public:
- QGraphicsScene *m_scene;
- QChart *m_chart;
- QPoint m_rubberBandOrigin;
-#ifndef QT_NO_RUBBERBAND
- QRubberBand *m_rubberBand;
-#endif
- QChartView::RubberBands m_rubberBandFlags;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-#endif
diff --git a/src/qpolarchart.cpp b/src/qpolarchart.cpp
deleted file mode 100644
index 2b85c7d8..00000000
--- a/src/qpolarchart.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpolarchart.h"
-#include "qabstractaxis.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \enum QPolarChart::PolarOrientation
-
- This type is used to specify the polar orientation of an axis.
-
- \value PolarOrientationRadial
- \value PolarOrientationAngular
-*/
-
-/*!
- \class QPolarChart
- \inmodule Qt Charts
- \brief Polar chart API for Qt Charts.
-
- QPolarChart is a specialization of QChart to show a polar chart.
-
- Polar charts support line, spline, area, and scatter series, and all axis types
- supported by those series.
-
- \note When setting ticks to an angular QValueAxis, keep in mind that the first and last tick
- are co-located at 0/360 degree angle.
-
- \note If the angular distance between two consecutive points in a series is more than 180 degrees,
- any line connecting the two points becomes meaningless, so choose the axis ranges accordingly
- when displaying line, spline, or area series. In such case series don't draw a direct line between
- the two points, but instead draw a line to and from the center of the chart.
-
- \note Polar charts draw all axes of same orientation in the same position, so using multiple
- axes of same orientation can be confusing, unless the extra axes are only used to customize the
- grid (e.g. you can display a highlighted range with a secondary shaded QCategoryAxis or provide
- unlabeled subticks with a secondary QValueAxis that has its labels hidden).
-
- \sa QChart
- */
-
-/*!
- Constructs a polar chart as a child of the \a parent.
- Parameter \a wFlags is passed to the QChart constructor.
- */
-QPolarChart::QPolarChart(QGraphicsItem *parent, Qt::WindowFlags wFlags)
- : QChart(QChart::ChartTypePolar, parent, wFlags)
-{
-}
-
-/*!
- Destroys the polar chart object and its children, like series and axis objects added to it.
- */
-QPolarChart::~QPolarChart()
-{
-}
-
-/*!
- Returns the axes added for the \a series with \a polarOrientation. If no series is provided, then any axis with the
- specified polar orientation is returned.
-
- \sa addAxis()
- */
-QList<QAbstractAxis *> QPolarChart::axes(PolarOrientations polarOrientation, QAbstractSeries *series) const
-{
- Qt::Orientations orientation(0);
- if (polarOrientation.testFlag(PolarOrientationAngular))
- orientation |= Qt::Horizontal;
- if (polarOrientation.testFlag(PolarOrientationRadial))
- orientation |= Qt::Vertical;
-
- return QChart::axes(orientation, series);
-}
-
-/*!
- This convenience method adds \a axis to the polar chart with \a polarOrientation.
- The chart takes the ownership of the axis.
-
- \note Axes can be added to a polar chart also with QChart::addAxis() instead of this method.
- The specified alignment determines the polar orientation: horizontal alignments indicate angular
- axis and vertical alignments indicate radial axis.
-
- \sa QChart::removeAxis(), QChart::createDefaultAxes(), QAbstractSeries::attachAxis(), QChart::addAxis()
-*/
-void QPolarChart::addAxis(QAbstractAxis *axis, PolarOrientation polarOrientation)
-{
- if (!axis || axis->type() == QAbstractAxis::AxisTypeBarCategory) {
- qWarning("QAbstractAxis::AxisTypeBarCategory is not a supported axis type for polar charts.");
- } else {
- Qt::Alignment alignment = Qt::AlignLeft;
- if (polarOrientation == PolarOrientationAngular)
- alignment = Qt::AlignBottom;
- QChart::addAxis(axis, alignment);
- }
-}
-
-/*!
- Angular axes of a polar chart report horizontal orientation and radial axes report
- vertical orientation.
- This function is a convenience function for converting the orientation of an \a axis to
- corresponding polar orientation. If the \a axis is NULL or not added to a polar chart,
- the return value is meaningless.
-*/
-QPolarChart::PolarOrientation QPolarChart::axisPolarOrientation(QAbstractAxis *axis)
-{
- if (axis && axis->orientation() == Qt::Horizontal)
- return PolarOrientationAngular;
- else
- return PolarOrientationRadial;
-}
-
-#include "moc_qpolarchart.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/qpolarchart.h b/src/qpolarchart.h
deleted file mode 100644
index 87a53b66..00000000
--- a/src/qpolarchart.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPOLARCHART_H
-#define QPOLARCHART_H
-
-#include "qchart.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QAbstractSeries;
-class QAbstractAxis;
-
-class QTCOMMERCIALCHART_EXPORT QPolarChart : public QChart
-{
- Q_OBJECT
- Q_ENUMS(PolarOrientation)
- Q_FLAGS(PolarOrientations)
-
-public:
- enum PolarOrientation {
- PolarOrientationRadial = 0x1,
- PolarOrientationAngular = 0x2
- };
- Q_DECLARE_FLAGS(PolarOrientations, PolarOrientation)
-
-public:
- explicit QPolarChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
- ~QPolarChart();
-
- void addAxis(QAbstractAxis *axis, PolarOrientation polarOrientation);
-
- QList<QAbstractAxis*> axes(PolarOrientations polarOrientation = PolarOrientations(PolarOrientationRadial | PolarOrientationAngular), QAbstractSeries *series = 0) const;
-
- static PolarOrientation axisPolarOrientation(QAbstractAxis *axis);
-
-protected:
- Q_DISABLE_COPY(QPolarChart)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QCHART_H
diff --git a/src/scatterchart/qscatterseries.cpp b/src/scatterchart/qscatterseries.cpp
deleted file mode 100644
index f5805e22..00000000
--- a/src/scatterchart/qscatterseries.cpp
+++ /dev/null
@@ -1,334 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscatterseries.h"
-#include "qscatterseries_p.h"
-#include "scatterchartitem_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "scatteranimation_p.h"
-#include "qchart_p.h"
-
-/*!
- \class QScatterSeries
- \inmodule Qt Charts
- \brief The QScatterSeries class is used for making scatter charts.
-
- \mainclass
-
- The scatter data is displayed as a collection of points on the chart. Each point determines the position on the horizontal axis
- and the vertical axis.
-
- \image examples_scatterchart.png
-
- Creating basic scatter chart is simple:
- \code
- QScatterSeries* series = new QScatterSeries();
- series->append(0, 6);
- series->append(2, 4);
- ...
- chart->addSeries(series);
- \endcode
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype ScatterSeries
- \instantiates QScatterSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/scatterseries.qdocinc
-*/
-#else
-/*!
- \qmlclass ScatterSeries QScatterSeries
-
- \include ../doc/src/scatterseries.qdocinc
-*/
-#endif
-
-/*!
- \enum QScatterSeries::MarkerShape
-
- This enum describes the shape used when rendering marker items.
-
- \value MarkerShapeCircle
- \value MarkerShapeRectangle
-*/
-
-/*!
- \property QScatterSeries::brush
- Brush used to draw the series.
-*/
-
-/*!
- \property QScatterSeries::color
- Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
- \sa QScatterSeries::brush()
-*/
-
-/*!
- \property QScatterSeries::borderColor
- Line (pen) color of the series. This is a convenience property for modifying the color of pen.
- \sa QScatterSeries::pen()
-*/
-/*!
- \qmlproperty color ScatterSeries::borderColor
- Border (pen) color of the series.
-*/
-
-/*!
- \qmlproperty real ScatterSeries::borderWidth
- The width of the border line. By default the width is 2.0.
-*/
-
-/*!
- \property QScatterSeries::markerShape
- Defines the shape of the marker used to draw the points in the series. The default shape is MarkerShapeCircle.
-*/
-/*!
- \qmlproperty MarkerShape ScatterSeries::markerShape
- Defines the shape of the marker used to draw the points in the series. One of ScatterSeries
- ScatterSeries.MarkerShapeCircle or ScatterSeries.MarkerShapeRectangle.
- The default shape is ScatterSeries.MarkerShapeCircle.
-*/
-
-/*!
- \property QScatterSeries::markerSize
- Defines the size of the marker used to draw the points in the series. The default size is 15.0.
-*/
-/*!
- \qmlproperty real ScatterSeries::markerSize
- Defines the size of the marker used to draw the points in the series. The default size is 15.0.
-*/
-
-/*!
- \qmlproperty QString ScatterSeries::brushFilename
- The name of the file used as a brush for the series.
-*/
-
-/*!
- \fn void QScatterSeries::colorChanged(QColor color)
- Signal is emitted when the fill (brush) color has changed to \a color.
-*/
-
-/*!
- \fn void QScatterSeries::borderColorChanged(QColor color)
- Signal is emitted when the line (pen) color has changed to \a color.
-*/
-/*!
- \qmlsignal ScatterSeries::borderColorChanged(color color)
- Signal is emitted when the line (pen) color has changed to \a color.
-*/
-
-/*!
- \fn QAbstractSeries::SeriesType QScatterSeries::type() const
- Returns QAbstractSeries::SeriesTypeScatter.
- \sa QAbstractSeries, SeriesType
-*/
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- Constructs a series object which is a child of \a parent.
-*/
-QScatterSeries::QScatterSeries(QObject *parent)
- : QXYSeries(*new QScatterSeriesPrivate(this), parent)
-{
-}
-
-/*!
- Destroys the object. Note that adding series to QChart transfers the ownership to the chart.
-*/
-QScatterSeries::~QScatterSeries()
-{
- Q_D(QScatterSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-
-QAbstractSeries::SeriesType QScatterSeries::type() const
-{
- return QAbstractSeries::SeriesTypeScatter;
-}
-
-/*!
- Sets \a pen used for drawing points' border on the chart. If the pen is not defined, the
- pen from chart theme is used.
- \sa QChart::setTheme()
-*/
-void QScatterSeries::setPen(const QPen &pen)
-{
- Q_D(QXYSeries);
- if (d->m_pen != pen) {
- bool emitColorChanged = d->m_pen.color() != pen.color();
- d->m_pen = pen;
- emit d->updated();
- if (emitColorChanged)
- emit borderColorChanged(pen.color());
- }
-}
-
-/*!
- Sets \a brush used for drawing points on the chart. If the brush is not defined, brush
- from chart theme setting is used.
- \sa QChart::setTheme()
-*/
-void QScatterSeries::setBrush(const QBrush &brush)
-{
- Q_D(QScatterSeries);
- if (d->m_brush != brush) {
- bool emitColorChanged = d->m_brush.color() != brush.color();
- d->m_brush = brush;
- emit d->updated();
- if (emitColorChanged)
- emit colorChanged(brush.color());
- }
-}
-
-QBrush QScatterSeries::brush() const
-{
- Q_D(const QScatterSeries);
- if (d->m_brush == QChartPrivate::defaultBrush())
- return QBrush();
- else
- return d->m_brush;
-}
-
-void QScatterSeries::setColor(const QColor &color)
-{
- QBrush b = brush();
- if (b == QChartPrivate::defaultBrush())
- b = QBrush();
- if (b == QBrush())
- b.setStyle(Qt::SolidPattern);
- b.setColor(color);
- setBrush(b);
-}
-
-QColor QScatterSeries::color() const
-{
- return brush().color();
-}
-
-void QScatterSeries::setBorderColor(const QColor &color)
-{
- QPen p = pen();
- if (p == QChartPrivate::defaultPen())
- p = QPen();
- p.setColor(color);
- setPen(p);
-}
-
-QColor QScatterSeries::borderColor() const
-{
- return pen().color();
-}
-
-QScatterSeries::MarkerShape QScatterSeries::markerShape() const
-{
- Q_D(const QScatterSeries);
- return d->m_shape;
-}
-
-void QScatterSeries::setMarkerShape(MarkerShape shape)
-{
- Q_D(QScatterSeries);
- if (d->m_shape != shape) {
- d->m_shape = shape;
- emit d->updated();
- }
-}
-
-qreal QScatterSeries::markerSize() const
-{
- Q_D(const QScatterSeries);
- return d->m_size;
-}
-
-void QScatterSeries::setMarkerSize(qreal size)
-{
- Q_D(QScatterSeries);
-
- if (!qFuzzyCompare(d->m_size, size)) {
- d->m_size = size;
- emit d->updated();
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QScatterSeriesPrivate::QScatterSeriesPrivate(QScatterSeries *q)
- : QXYSeriesPrivate(q),
- m_shape(QScatterSeries::MarkerShapeCircle),
- m_size(15.0)
-{
-}
-
-void QScatterSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QScatterSeries);
- ScatterChartItem *scatter = new ScatterChartItem(q,parent);
- m_item.reset(scatter);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-void QScatterSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
-{
- Q_Q(QScatterSeries);
- const QList<QColor> colors = theme->seriesColors();
- const QList<QGradient> gradients = theme->seriesGradients();
-
- if (forced || QChartPrivate::defaultPen() == m_pen) {
- QPen pen;
- pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
- pen.setWidthF(2);
- q->setPen(pen);
- }
-
- if (forced || QChartPrivate::defaultBrush() == m_brush) {
- QBrush brush(colors.at(index % colors.size()));
- q->setBrush(brush);
- }
-
- if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
- QColor color = theme->labelBrush().color();
- q->setPointLabelsColor(color);
- }
-}
-
-void QScatterSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
-{
- ScatterChartItem *item = static_cast<ScatterChartItem *>(m_item.data());
- Q_ASSERT(item);
-
- if (item->animation())
- item->animation()->stopAndDestroyLater();
-
- if (options.testFlag(QChart::SeriesAnimations))
- item->setAnimation(new ScatterAnimation(item));
- else
- item->setAnimation(0);
-
- QAbstractSeriesPrivate::initializeAnimations(options);
-}
-
-#include "moc_qscatterseries.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/scatterchart/qscatterseries.h b/src/scatterchart/qscatterseries.h
deleted file mode 100644
index 92e62749..00000000
--- a/src/scatterchart/qscatterseries.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCATTERSERIES_H
-#define QSCATTERSERIES_H
-
-#include <qchartglobal.h>
-#include <qxyseries.h>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QScatterSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QScatterSeries : public QXYSeries
-{
- Q_OBJECT
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged)
- Q_PROPERTY(MarkerShape markerShape READ markerShape WRITE setMarkerShape)
- Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize)
- Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
- Q_ENUMS(MarkerShape)
-
-public:
- enum MarkerShape {
- MarkerShapeCircle,
- MarkerShapeRectangle
- };
-
-public:
- explicit QScatterSeries(QObject *parent = 0);
- ~QScatterSeries();
- QAbstractSeries::SeriesType type() const;
- void setPen(const QPen &pen);
- void setBrush(const QBrush &brush);
- QBrush brush() const;
- void setColor(const QColor &color);
- QColor color() const;
- void setBorderColor(const QColor &color);
- QColor borderColor() const;
- MarkerShape markerShape() const;
- void setMarkerShape(MarkerShape shape);
- qreal markerSize() const;
- void setMarkerSize(qreal size);
-
-Q_SIGNALS:
- void colorChanged(QColor color);
- void borderColorChanged(QColor color);
-
-private:
- Q_DECLARE_PRIVATE(QScatterSeries)
- Q_DISABLE_COPY(QScatterSeries)
- friend class ScatterChartItem;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QSCATTERSERIES_H
diff --git a/src/scatterchart/qscatterseries_p.h b/src/scatterchart/qscatterseries_p.h
deleted file mode 100644
index e70c2545..00000000
--- a/src/scatterchart/qscatterseries_p.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QSCATTERSERIES_P_H
-#define QSCATTERSERIES_P_H
-
-#include "qxyseries_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QScatterSeriesPrivate: public QXYSeriesPrivate
-{
-public:
- QScatterSeriesPrivate(QScatterSeries *q);
- void initializeGraphics(QGraphicsItem* parent);
- void initializeTheme(int index, ChartTheme* theme, bool forced = false);
- void initializeAnimations(QtCommercialChart::QChart::AnimationOptions options);
-
-private:
- QScatterSeries::MarkerShape m_shape;
- qreal m_size;
- Q_DECLARE_PUBLIC(QScatterSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/scatterchart/scatterchartitem.cpp b/src/scatterchart/scatterchartitem.cpp
deleted file mode 100644
index dda32e55..00000000
--- a/src/scatterchart/scatterchartitem.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "scatterchartitem_p.h"
-#include "qscatterseries.h"
-#include "qscatterseries_p.h"
-#include "chartpresenter_p.h"
-#include "abstractdomain_p.h"
-#include "qchart.h"
-#include <QPainter>
-#include <QGraphicsScene>
-#include <QDebug>
-#include <QGraphicsSceneMouseEvent>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item)
- : XYChart(series,item),
- m_series(series),
- m_items(this),
- m_visible(true),
- m_shape(QScatterSeries::MarkerShapeRectangle),
- m_size(15),
- m_pointLabelsVisible(false),
- m_pointLabelsFormat(series->pointLabelsFormat()),
- m_pointLabelsFont(series->pointLabelsFont()),
- m_pointLabelsColor(series->pointLabelsColor())
-{
- QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
- QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
- QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
- this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
- this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
-
- setZValue(ChartPresenter::ScatterSeriesZValue);
- setFlags(QGraphicsItem::ItemClipsChildrenToShape);
-
- handleUpdated();
-
- m_items.setHandlesChildEvents(false);
-}
-
-QRectF ScatterChartItem::boundingRect() const
-{
- return m_rect;
-}
-
-void ScatterChartItem::createPoints(int count)
-{
- for (int i = 0; i < count; ++i) {
-
- QGraphicsItem *item = 0;
-
- switch (m_shape) {
- case QScatterSeries::MarkerShapeCircle: {
- item = new CircleMarker(0, 0, m_size, m_size, this);
- const QRectF &rect = item->boundingRect();
- item->setPos(-rect.width() / 2, -rect.height() / 2);
- break;
- }
- case QScatterSeries::MarkerShapeRectangle:
- item = new RectangleMarker(0, 0, m_size, m_size, this);
- item->setPos(-m_size / 2, -m_size / 2);
- break;
- default:
- qWarning() << "Unsupported marker type";
- break;
- }
- m_items.addToGroup(item);
- }
-}
-
-void ScatterChartItem::deletePoints(int count)
-{
- QList<QGraphicsItem *> items = m_items.childItems();
-
- for (int i = 0; i < count; ++i) {
- QGraphicsItem *item = items.takeLast();
- m_markerMap.remove(item);
- delete(item);
- }
-}
-
-void ScatterChartItem::markerSelected(QGraphicsItem *marker)
-{
- emit XYChart::clicked(m_markerMap[marker]);
-}
-
-void ScatterChartItem::markerHovered(QGraphicsItem *marker, bool state)
-{
- emit XYChart::hovered(m_markerMap[marker], state);
-}
-
-void ScatterChartItem::updateGeometry()
-{
-
- const QVector<QPointF>& points = geometryPoints();
-
- if (points.size() == 0) {
- deletePoints(m_items.childItems().count());
- return;
- }
-
- int diff = m_items.childItems().size() - points.size();
-
- if (diff > 0)
- deletePoints(diff);
- else if (diff < 0)
- createPoints(-diff);
-
- if (diff != 0)
- handleUpdated();
-
- QList<QGraphicsItem *> items = m_items.childItems();
-
- QRectF clipRect(QPointF(0,0),domain()->size());
-
- // Only zoom in if the clipRect fits inside int limits. QWidget::update() uses
- // a region that has to be compatible with QRect.
- if (clipRect.height() <= INT_MAX
- && clipRect.width() <= INT_MAX) {
- QVector<bool> offGridStatus = offGridStatusVector();
- const int seriesLastIndex = m_series->count() - 1;
-
- for (int i = 0; i < points.size(); i++) {
- QGraphicsItem *item = items.at(i);
- const QPointF &point = points.at(i);
- const QRectF &rect = item->boundingRect();
- // During remove animation series may have different number of points,
- // so ensure we don't go over the index. Animation handling itself ensures that
- // if there is actually no points in the series, then it won't generate a fake point,
- // so we can be assured there is always at least one point in m_series here.
- // Note that marker map values can be technically incorrect during the animation,
- // if it was caused by an insert, but this shouldn't be a problem as the points are
- // fake anyway. After remove animation stops, geometry is updated to correct one.
- m_markerMap[item] = m_series->at(qMin(seriesLastIndex, i));
- item->setPos(point.x() - rect.width() / 2, point.y() - rect.height() / 2);
-
- if (!m_visible || offGridStatus.at(i))
- item->setVisible(false);
- else
- item->setVisible(true);
- }
-
- prepareGeometryChange();
- m_rect = clipRect;
- }
-}
-
-void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option)
- Q_UNUSED(widget)
-
- QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
-
- painter->save();
- painter->setClipRect(clipRect);
-
- if (m_pointLabelsVisible) {
- m_series->d_func()->drawSeriesPointLabels(painter, m_points,
- m_series->markerSize() / 2
- + m_series->pen().width());
- }
-
- painter->restore();
-}
-
-void ScatterChartItem::setPen(const QPen &pen)
-{
- foreach (QGraphicsItem *item , m_items.childItems())
- static_cast<QAbstractGraphicsShapeItem*>(item)->setPen(pen);
-}
-
-void ScatterChartItem::setBrush(const QBrush &brush)
-{
- foreach (QGraphicsItem *item , m_items.childItems())
- static_cast<QAbstractGraphicsShapeItem*>(item)->setBrush(brush);
-}
-
-void ScatterChartItem::handleUpdated()
-{
- int count = m_items.childItems().count();
-
- if (count == 0)
- return;
-
- bool recreate = m_visible != m_series->isVisible()
- || m_size != m_series->markerSize()
- || m_shape != m_series->markerShape();
-
- m_visible = m_series->isVisible();
- m_size = m_series->markerSize();
- m_shape = m_series->markerShape();
- setOpacity(m_series->opacity());
- m_pointLabelsFormat = m_series->pointLabelsFormat();
- m_pointLabelsVisible = m_series->pointLabelsVisible();
- m_pointLabelsFont = m_series->pointLabelsFont();
- m_pointLabelsColor = m_series->pointLabelsColor();
-
- if (recreate) {
- deletePoints(count);
- createPoints(count);
-
- // Updating geometry is now safe, because it won't call handleUpdated unless it creates/deletes points
- updateGeometry();
- }
-
- setPen(m_series->pen());
- setBrush(m_series->brush());
- update();
-}
-
-#include "moc_scatterchartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/scatterchart/scatterchartitem_p.h b/src/scatterchart/scatterchartitem_p.h
deleted file mode 100644
index 4c5e9f2f..00000000
--- a/src/scatterchart/scatterchartitem_p.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef SCATTERCHARTITEM_H
-#define SCATTERCHARTITEM_H
-
-#include "qchartglobal.h"
-#include "xychart_p.h"
-#include <QGraphicsEllipseItem>
-#include <QPen>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QScatterSeries;
-
-class ScatterChartItem : public XYChart
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsItem)
-public:
- explicit ScatterChartItem(QScatterSeries *series, QGraphicsItem *item = 0);
-
-public:
- //from QGraphicsItem
- QRectF boundingRect() const;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
-
- void setPen(const QPen &pen);
- void setBrush(const QBrush &brush);
-
- void markerSelected(QGraphicsItem *item);
- void markerHovered(QGraphicsItem *item, bool state);
-
-public Q_SLOTS:
- void handleUpdated();
-
-private:
- void createPoints(int count);
- void deletePoints(int count);
-
-protected:
- void updateGeometry();
-
-private:
- QScatterSeries *m_series;
- QGraphicsItemGroup m_items;
- bool m_visible;
- int m_shape;
- int m_size;
- QRectF m_rect;
- QMap<QGraphicsItem *, QPointF> m_markerMap;
-
- bool m_pointLabelsVisible;
- QString m_pointLabelsFormat;
- QFont m_pointLabelsFont;
- QColor m_pointLabelsColor;
-};
-
-class CircleMarker: public QGraphicsEllipseItem
-{
-
-public:
- CircleMarker(qreal x, qreal y, qreal w, qreal h, ScatterChartItem *parent)
- : QGraphicsEllipseItem(x, y, w, h, parent),
- m_parent(parent)
- {
- setAcceptHoverEvents(true);
- }
-
-protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *event)
- {
- QGraphicsEllipseItem::mousePressEvent(event);
- m_parent->markerSelected(this);
- }
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
- {
- QGraphicsEllipseItem::hoverEnterEvent(event);
- m_parent->markerHovered(this, true);
- }
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
- {
- QGraphicsEllipseItem::hoverLeaveEvent(event);
- m_parent->markerHovered(this, false);
- }
-
-private:
- ScatterChartItem *m_parent;
-};
-
-class RectangleMarker: public QGraphicsRectItem
-{
-
-public:
- RectangleMarker(qreal x, qreal y, qreal w, qreal h, ScatterChartItem *parent)
- : QGraphicsRectItem(x, y, w, h, parent),
- m_parent(parent)
- {
- setAcceptHoverEvents(true);
- }
-
-protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *event)
- {
- QGraphicsRectItem::mousePressEvent(event);
- m_parent->markerSelected(this);
- }
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
- {
- QGraphicsRectItem::hoverEnterEvent(event);
- m_parent->markerHovered(this, true);
- }
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
- {
- QGraphicsRectItem::hoverLeaveEvent(event);
- m_parent->markerHovered(this, false);
- }
-
-private:
- ScatterChartItem *m_parent;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // SCATTERPRESENTER_H
diff --git a/src/scroller.cpp b/src/scroller.cpp
deleted file mode 100644
index 4f215674..00000000
--- a/src/scroller.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "scroller_p.h"
-#include "qlegend.h"
-#include <QGraphicsSceneMouseEvent>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-Scroller::Scroller()
- : m_ticker(this),
- m_timeTresholdMin(50),
- m_timeTresholdMax(300),
- m_state(Idle),
- m_treshold(10)
-{
-
-}
-
-Scroller::~Scroller()
-{
-}
-
-void Scroller::move(const QPointF &delta)
-{
- switch (m_state) {
- case Pressed:
- m_timeStamp = QTime::currentTime();
- break;
- case Scroll:
- stopTicker();
- m_timeStamp = QTime::currentTime();
- break;
- default:
- break;
- }
- setOffset(offset() - delta);
-}
-
-void Scroller::scrollTo(const QPointF &delta)
-{
- // Starts scrolling, if at least m_timeTresholdMin msecs has gone since timestamp
- // current time is no more than m_timeTresholdMax from timestamp
-
- if ((m_timeStamp.elapsed() > m_timeTresholdMin) && (m_timeStamp.msecsTo(QTime::currentTime()) < m_timeTresholdMax)) {
- // Release was quick enough. Start scrolling.
- qreal interval = 25;
- qreal time = m_timeStamp.msecsTo(QTime::currentTime());
- if (qFuzzyCompare(time, 0)) {
- m_speed = delta / 5;
- } else {
- m_speed = delta * interval / time;
- }
-
- qreal fraction = qMax(qAbs(m_speed.x()), qAbs(m_speed.y()));
-
- if (!qFuzzyCompare(fraction, 0)) {
- m_fraction.setX(qAbs(m_speed.x() / fraction));
- m_fraction.setY(qAbs(m_speed.y() / fraction));
- } else {
- m_fraction.setX(1);
- m_fraction.setY(1);
- }
- startTicker(interval);
- } else {
- stopTicker(); // Stop ticker, if one is running.
- }
-}
-
-void Scroller::handleMousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- stopTicker();
- m_pressPos = event->screenPos();
- m_lastPos = m_pressPos;
- m_state = Pressed;
- event->accept();
-}
-
-void Scroller::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
-{
- QPointF delta = event->screenPos() - m_lastPos;
-
- switch (m_state) {
- case Pressed: {
- // calculate treshold. If enough, change to move state and send out move deltas.
- if (qAbs(delta.x()) > m_treshold || qAbs(delta.y()) > m_treshold) {
- m_lastPos = event->screenPos();
- move(delta);
- m_state = Move;
- }
- event->accept();
- break;
- }
- case Move: {
- m_lastPos = event->screenPos();
- move(delta);
- event->accept();
- break;
- }
- case Idle:
- default: {
- event->ignore();
- break;
- }
- }
-}
-
-void Scroller::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
- switch (m_state) {
- case Move:
- {
- scrollTo(m_lastPos - m_pressPos);
- event->accept();
- break;
- }
- default:
- {
- m_state = Idle;
- event->ignore();
- break;
- }
- }
-}
-
-void Scroller::startTicker(int interval)
-{
- m_state = Scroll;
- m_ticker.start(interval);
-}
-
-void Scroller::stopTicker()
-{
- m_state = Idle;
- m_ticker.stop();
-}
-
-void Scroller::scrollTick()
-{
- switch (m_state) {
- case Scroll:
- lowerSpeed(m_speed);
- setOffset(offset() - m_speed);
- if (m_speed == QPointF(0, 0)) {
- m_state = Idle;
- m_ticker.stop();
- }
- break;
- default:
- qWarning() << __FUNCTION__ << "Scroller unexpected state" << m_state;
- m_ticker.stop();
- m_state = Idle;
- break;
- }
-}
-
-void Scroller::lowerSpeed(QPointF &speed, qreal maxSpeed)
-{
- qreal x = qBound(-maxSpeed, speed.x(), maxSpeed);
- qreal y = qBound(-maxSpeed, speed.y(), maxSpeed);
-
- x = (x == 0) ? x :
- (x > 0) ? qMax(qreal(0), x - m_fraction.x()) : qMin(qreal(0), x + m_fraction.x());
- y = (y == 0) ? y :
- (y > 0) ? qMax(qreal(0), y - m_fraction.y()) : qMin(qreal(0), y + m_fraction.y());
- speed.setX(x);
- speed.setY(y);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ScrollTicker::ScrollTicker(Scroller *scroller, QObject *parent)
- : QObject(parent),
- m_scroller(scroller)
-{
-
-}
-
-void ScrollTicker::start(int interval)
-{
- if (!m_timer.isActive())
- m_timer.start(interval, this);
-}
-
-void ScrollTicker::stop()
-{
- m_timer.stop();
-}
-
-void ScrollTicker::timerEvent(QTimerEvent *event)
-{
- Q_UNUSED(event);
- m_scroller->scrollTick();
-}
-
-#include "moc_scroller_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/scroller_p.h b/src/scroller_p.h
deleted file mode 100644
index 05d93db7..00000000
--- a/src/scroller_p.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef SCROLLER_P_H
-#define SCROLLER_P_H
-
-#include "qchartglobal.h"
-#include <QBasicTimer>
-#include <QTime>
-#include <QPointF>
-
-class QGraphicsSceneMouseEvent;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class Scroller;
-class QLegend;
-
-class ScrollTicker : public QObject
-{
- Q_OBJECT
-public:
- explicit ScrollTicker(Scroller *scroller, QObject *parent = 0);
- void start(int interval);
- void stop();
-protected:
- void timerEvent(QTimerEvent *event);
-
-private:
- QBasicTimer m_timer;
- Scroller *m_scroller;
-};
-
-class Scroller
-{
-public:
- enum State {
- Idle,
- Pressed,
- Move,
- Scroll
- };
-
- Scroller();
- virtual ~Scroller();
-
- virtual void setOffset(const QPointF &point) = 0;
- virtual QPointF offset() const = 0;
-
- void move(const QPointF &delta);
- void scrollTo(const QPointF &delta);
-
- void handleMousePressEvent(QGraphicsSceneMouseEvent *event);
- void handleMouseMoveEvent(QGraphicsSceneMouseEvent *event);
- void handleMouseReleaseEvent(QGraphicsSceneMouseEvent *event);
-
- void scrollTick();
-
-private:
- void startTicker(int interval);
- void stopTicker();
-
-private:
- void calculateSpeed(const QPointF &position);
- void lowerSpeed(QPointF &speed, qreal maxSpeed = 100);
-
-private:
- ScrollTicker m_ticker;
- QTime m_timeStamp;
- QPointF m_speed;
- QPointF m_fraction;
- int m_timeTresholdMin;
- int m_timeTresholdMax;
-
- State m_state;
- QPointF m_pressPos;
- QPointF m_lastPos;
- qreal m_treshold;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* SCROLLER_P_H */
diff --git a/src/splinechart/qsplineseries.cpp b/src/splinechart/qsplineseries.cpp
deleted file mode 100644
index b8c9d584..00000000
--- a/src/splinechart/qsplineseries.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsplineseries.h"
-#include "qsplineseries_p.h"
-#include "splinechartitem_p.h"
-#include "chartdataset_p.h"
-#include "charttheme_p.h"
-#include "splineanimation_p.h"
-#include "qchart_p.h"
-
-/*!
- \class QSplineSeries
- \inmodule Qt Charts
- \brief Series type used to store data needed to draw a spline.
-
- QSplineSeries stores the data points along with the segment control points needed by QPainterPath to draw spline
- Control points are automatically calculated when data changes. The algorithm computes the points so that the normal spline can be drawn.
-
- \image examples_splinechart.png
-
- Creating basic spline chart is simple:
- \code
- QSplineSeries* series = new QSplineSeries();
- series->append(0, 6);
- series->append(2, 4);
- ...
- chart->addSeries(series);
- \endcode
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype SplineSeries
- \instantiates QSplineSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/splineseries.qdocinc
-*/
-#else
-/*!
- \qmlclass SplineSeries QSplineSeries
-
- \include ../doc/src/splineseries.qdocinc
-*/
-#endif
-
-/*!
- \fn QSeriesType QSplineSeries::type() const
- Returns the type of the series
-*/
-
-/*!
- \qmlproperty real SplineSeries::width
- The width of the line. By default the width is 2.0.
-*/
-
-/*!
- \qmlproperty Qt::PenStyle SplineSeries::style
- Controls the style of the line. Set to one of Qt.NoPen, Qt.SolidLine, Qt.DashLine, Qt.DotLine,
- Qt.DashDotLine or Qt.DashDotDotLine. Using Qt.CustomDashLine is not supported in the QML API.
- By default the style is Qt.SolidLine.
-*/
-
-/*!
- \qmlproperty Qt::PenCapStyle SplineSeries::capStyle
- Controls the cap style of the line. Set to one of Qt.FlatCap, Qt.SquareCap or Qt.RoundCap. By
- default the cap style is Qt.SquareCap.
-*/
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- Constructs empty series object which is a child of \a parent.
- When series object is added to a QChart instance then the ownerships is transferred.
- */
-
-QSplineSeries::QSplineSeries(QObject *parent)
- : QLineSeries(*new QSplineSeriesPrivate(this), parent)
-{
-}
-
-/*!
- Destroys the object.
-*/
-QSplineSeries::~QSplineSeries()
-{
- Q_D(QSplineSeries);
- if (d->m_chart)
- d->m_chart->removeSeries(this);
-}
-
-QAbstractSeries::SeriesType QSplineSeries::type() const
-{
- return QAbstractSeries::SeriesTypeSpline;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QSplineSeriesPrivate::QSplineSeriesPrivate(QSplineSeries *q)
- : QLineSeriesPrivate(q)
-{
-}
-
-void QSplineSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
-{
- Q_Q(QSplineSeries);
- SplineChartItem *spline = new SplineChartItem(q,parent);
- m_item.reset(spline);
- QAbstractSeriesPrivate::initializeGraphics(parent);
-}
-
-void QSplineSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
-{
- Q_Q(QSplineSeries);
- const QList<QColor> colors = theme->seriesColors();
-
- if (forced || QChartPrivate::defaultPen() == m_pen) {
- QPen pen;
- pen.setColor(colors.at(index % colors.size()));
- pen.setWidthF(2);
- q->setPen(pen);
- }
-
- if (forced || QChartPrivate::defaultPen().color() == m_pointLabelsColor) {
- QColor color = theme->labelBrush().color();
- q->setPointLabelsColor(color);
- }
-}
-
-void QSplineSeriesPrivate::initializeAnimations(QtCommercialChart::QChart::AnimationOptions options)
-{
- SplineChartItem *item = static_cast<SplineChartItem *>(m_item.data());
- Q_ASSERT(item);
- if (item->animation())
- item->animation()->stopAndDestroyLater();
-
- if (options.testFlag(QChart::SeriesAnimations))
- item->setAnimation(new SplineAnimation(item));
- else
- item->setAnimation(0);
- QAbstractSeriesPrivate::initializeAnimations(options);
-}
-
-#include "moc_qsplineseries.cpp"
-#include "moc_qsplineseries_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/splinechart/qsplineseries.h b/src/splinechart/qsplineseries.h
deleted file mode 100644
index 61b57ea5..00000000
--- a/src/splinechart/qsplineseries.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSPLINESERIES_H
-#define QSPLINESERIES_H
-
-#include <qchartglobal.h>
-#include <qlineseries.h>
-#include <QList>
-#include <QPointF>
-#include <QtGlobal>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QSplineSeriesPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QSplineSeries : public QLineSeries
-{
- Q_OBJECT
-
-public:
- explicit QSplineSeries(QObject *parent = 0);
- ~QSplineSeries();
- QAbstractSeries::SeriesType type() const;
-
-private:
- Q_DECLARE_PRIVATE(QSplineSeries)
- Q_DISABLE_COPY(QSplineSeries)
- friend class SplineChartItem;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QSPLINESERIES_H
diff --git a/src/splinechart/qsplineseries_p.h b/src/splinechart/qsplineseries_p.h
deleted file mode 100644
index ba24d06b..00000000
--- a/src/splinechart/qsplineseries_p.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QSPLINESERIES_P_H
-#define QSPLINESERIES_P_H
-
-#include "qlineseries_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-
-class QSplineSeriesPrivate: public QLineSeriesPrivate
-{
- Q_OBJECT
-public:
- QSplineSeriesPrivate(QSplineSeries *q);
-
- void initializeTheme(int index, ChartTheme* theme, bool forced = false);
- void initializeGraphics(QGraphicsItem* parent);
- void initializeAnimations(QtCommercialChart::QChart::AnimationOptions options);
-
-private:
- Q_DECLARE_PUBLIC(QSplineSeries)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/splinechart/splinechartitem.cpp b/src/splinechart/splinechartitem.cpp
deleted file mode 100644
index 2b14686f..00000000
--- a/src/splinechart/splinechartitem.cpp
+++ /dev/null
@@ -1,485 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "splinechartitem_p.h"
-#include "qsplineseries_p.h"
-#include "chartpresenter_p.h"
-#include "splineanimation_p.h"
-#include "polardomain_p.h"
-#include <QPainter>
-#include <QGraphicsSceneMouseEvent>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item)
- : XYChart(series,item),
- m_series(series),
- m_pointsVisible(false),
- m_animation(0),
- m_pointLabelsVisible(false),
- m_pointLabelsFormat(series->pointLabelsFormat()),
- m_pointLabelsFont(series->pointLabelsFont()),
- m_pointLabelsColor(series->pointLabelsColor())
-{
- setAcceptHoverEvents(true);
- setZValue(ChartPresenter::SplineChartZValue);
- QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
- this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
- this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
- QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
- handleUpdated();
-}
-
-QRectF SplineChartItem::boundingRect() const
-{
- return m_rect;
-}
-
-QPainterPath SplineChartItem::shape() const
-{
- return m_fullPath;
-}
-
-void SplineChartItem::setAnimation(SplineAnimation *animation)
-{
- m_animation = animation;
- XYChart::setAnimation(animation);
-}
-
-ChartAnimation *SplineChartItem::animation() const
-{
- return m_animation;
-}
-
-void SplineChartItem::setControlGeometryPoints(QVector<QPointF>& points)
-{
- m_controlPoints = points;
-}
-
-QVector<QPointF> SplineChartItem::controlGeometryPoints() const
-{
- return m_controlPoints;
-}
-
-void SplineChartItem::updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index)
-{
- QVector<QPointF> controlPoints;
- if (newPoints.count() >= 2)
- controlPoints = calculateControlPoints(newPoints);
-
- if (m_animation)
- m_animation->setup(oldPoints, newPoints, m_controlPoints, controlPoints, index);
-
- m_points = newPoints;
- m_controlPoints = controlPoints;
- setDirty(false);
-
- if (m_animation)
- presenter()->startAnimation(m_animation);
- else
- updateGeometry();
-}
-
-void SplineChartItem::updateGeometry()
-{
- const QVector<QPointF> &points = m_points;
- const QVector<QPointF> &controlPoints = m_controlPoints;
-
- if ((points.size() < 2) || (controlPoints.size() < 2)) {
- prepareGeometryChange();
- m_path = QPainterPath();
- m_rect = QRect();
- return;
- }
-
- Q_ASSERT(points.count() * 2 - 2 == controlPoints.count());
-
- QPainterPath splinePath;
- QPainterPath fullPath;
- // Use worst case scenario to determine required margin.
- qreal margin = m_linePen.width() * 1.42;
-
- if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
- QPainterPath splinePathLeft;
- QPainterPath splinePathRight;
- QPainterPath *currentSegmentPath = 0;
- QPainterPath *previousSegmentPath = 0;
- qreal minX = domain()->minX();
- qreal maxX = domain()->maxX();
- qreal minY = domain()->minY();
- QPointF currentSeriesPoint = m_series->at(0);
- QPointF currentGeometryPoint = points.at(0);
- QPointF previousGeometryPoint = points.at(0);
- bool pointOffGrid = false;
- bool previousPointWasOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
- m_visiblePoints.clear();
- m_visiblePoints.reserve(points.size());
-
- qreal domainRadius = domain()->size().height() / 2.0;
- const QPointF centerPoint(domainRadius, domainRadius);
-
- if (!previousPointWasOffGrid) {
- fullPath.moveTo(points.at(0));
- // Do not draw points for points below minimum Y.
- if (m_pointsVisible && currentSeriesPoint.y() >= minY)
- m_visiblePoints.append(currentGeometryPoint);
- }
-
- qreal leftMarginLine = centerPoint.x() - margin;
- qreal rightMarginLine = centerPoint.x() + margin;
- qreal horizontal = centerPoint.y();
-
- // See ScatterChartItem::updateGeometry() for explanation why seriesLastIndex is needed
- const int seriesLastIndex = m_series->count() - 1;
-
- for (int i = 1; i < points.size(); i++) {
- // Interpolating spline fragments accurately is not trivial, and would anyway be ugly
- // when thick pen is used, so we work around it by utilizing three separate
- // paths for spline segments and clip those with custom regions at paint time.
- // "Right" path contains segments that cross the axis line with visible point on the
- // right side of the axis line, as well as segments that have one point within the margin
- // on the right side of the axis line and another point on the right side of the chart.
- // "Left" path contains points with similarly on the left side.
- // "Full" path contains rest of the points.
- // This doesn't yield perfect results always. E.g. when segment covers more than 90
- // degrees and both of the points are within the margin, one in the top half and one in the
- // bottom half of the chart, the bottom one gets clipped incorrectly.
- // However, this should be rare occurrence in any sensible chart.
- currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
- currentGeometryPoint = points.at(i);
- pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
-
- // Draw something unless both off-grid
- if (!pointOffGrid || !previousPointWasOffGrid) {
- bool dummyOk; // We know points are ok, but this is needed
- qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
- qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
-
- if ((qAbs(currentAngle - previousAngle) > 180.0)) {
- // If the angle between two points is over 180 degrees (half X range),
- // any direct segment between them becomes meaningless.
- // In this case two line segments are drawn instead, from previous
- // point to the center and from center to current point.
- if ((previousAngle < 0.0 || (previousAngle <= 180.0 && previousGeometryPoint.x() < rightMarginLine))
- && previousGeometryPoint.y() < horizontal) {
- currentSegmentPath = &splinePathRight;
- } else if ((previousAngle > 360.0 || (previousAngle > 180.0 && previousGeometryPoint.x() > leftMarginLine))
- && previousGeometryPoint.y() < horizontal) {
- currentSegmentPath = &splinePathLeft;
- } else if (previousAngle > 0.0 && previousAngle < 360.0) {
- currentSegmentPath = &splinePath;
- } else {
- currentSegmentPath = 0;
- }
-
- if (currentSegmentPath) {
- if (previousSegmentPath != currentSegmentPath)
- currentSegmentPath->moveTo(previousGeometryPoint);
- if (!previousSegmentPath)
- fullPath.moveTo(previousGeometryPoint);
-
- currentSegmentPath->lineTo(centerPoint);
- fullPath.lineTo(centerPoint);
- }
-
- previousSegmentPath = currentSegmentPath;
-
- if ((currentAngle < 0.0 || (currentAngle <= 180.0 && currentGeometryPoint.x() < rightMarginLine))
- && currentGeometryPoint.y() < horizontal) {
- currentSegmentPath = &splinePathRight;
- } else if ((currentAngle > 360.0 || (currentAngle > 180.0 &&currentGeometryPoint.x() > leftMarginLine))
- && currentGeometryPoint.y() < horizontal) {
- currentSegmentPath = &splinePathLeft;
- } else if (currentAngle > 0.0 && currentAngle < 360.0) {
- currentSegmentPath = &splinePath;
- } else {
- currentSegmentPath = 0;
- }
-
- if (currentSegmentPath) {
- if (previousSegmentPath != currentSegmentPath)
- currentSegmentPath->moveTo(centerPoint);
- if (!previousSegmentPath)
- fullPath.moveTo(centerPoint);
-
- currentSegmentPath->lineTo(currentGeometryPoint);
- fullPath.lineTo(currentGeometryPoint);
- }
- } else {
- QPointF cp1 = controlPoints[2 * (i - 1)];
- QPointF cp2 = controlPoints[(2 * i) - 1];
-
- if (previousAngle < 0.0 || currentAngle < 0.0
- || ((previousAngle <= 180.0 && currentAngle <= 180.0)
- && ((previousGeometryPoint.x() < rightMarginLine && previousGeometryPoint.y() < horizontal)
- || (currentGeometryPoint.x() < rightMarginLine && currentGeometryPoint.y() < horizontal)))) {
- currentSegmentPath = &splinePathRight;
- } else if (previousAngle > 360.0 || currentAngle > 360.0
- || ((previousAngle > 180.0 && currentAngle > 180.0)
- && ((previousGeometryPoint.x() > leftMarginLine && previousGeometryPoint.y() < horizontal)
- || (currentGeometryPoint.x() > leftMarginLine && currentGeometryPoint.y() < horizontal)))) {
- currentSegmentPath = &splinePathLeft;
- } else {
- currentSegmentPath = &splinePath;
- }
-
- if (currentSegmentPath != previousSegmentPath)
- currentSegmentPath->moveTo(previousGeometryPoint);
- if (!previousSegmentPath)
- fullPath.moveTo(previousGeometryPoint);
-
- fullPath.cubicTo(cp1, cp2, currentGeometryPoint);
- currentSegmentPath->cubicTo(cp1, cp2, currentGeometryPoint);
- }
- } else {
- currentSegmentPath = 0;
- }
-
- previousPointWasOffGrid = pointOffGrid;
- if (!pointOffGrid && m_pointsVisible && currentSeriesPoint.y() >= minY)
- m_visiblePoints.append(currentGeometryPoint);
- previousSegmentPath = currentSegmentPath;
- previousGeometryPoint = currentGeometryPoint;
- }
-
- m_pathPolarRight = splinePathRight;
- m_pathPolarLeft = splinePathLeft;
- // Note: This construction of m_fullpath is not perfect. The partial segments that are
- // outside left/right clip regions at axis boundary still generate hover/click events,
- // because shape doesn't get clipped. It doesn't seem possible to do sensibly.
- } else { // not polar
- splinePath.moveTo(points.at(0));
- for (int i = 0; i < points.size() - 1; i++) {
- const QPointF &point = points.at(i + 1);
- splinePath.cubicTo(controlPoints[2 * i], controlPoints[2 * i + 1], point);
- }
- fullPath = splinePath;
- }
-
- QPainterPathStroker stroker;
- // The full path is comprised of three separate paths.
- // This is why we are prepared for the "worst case" scenario, i.e. use always MiterJoin and
- // multiply line width with square root of two when defining shape and bounding rectangle.
- stroker.setWidth(margin);
- stroker.setJoinStyle(Qt::MiterJoin);
- stroker.setCapStyle(Qt::SquareCap);
- stroker.setMiterLimit(m_linePen.miterLimit());
-
- // Only zoom in if the bounding rects of the path fit inside int limits. QWidget::update() uses
- // a region that has to be compatible with QRect.
- QPainterPath checkShapePath = stroker.createStroke(fullPath);
- if (checkShapePath.boundingRect().height() <= INT_MAX
- && checkShapePath.boundingRect().width() <= INT_MAX
- && splinePath.boundingRect().height() <= INT_MAX
- && splinePath.boundingRect().width() <= INT_MAX) {
- m_path = splinePath;
-
- prepareGeometryChange();
-
- m_fullPath = checkShapePath;
- m_rect = m_fullPath.boundingRect();
- }
-}
-
-/*!
- Calculates control points which are needed by QPainterPath.cubicTo function to draw the cubic Bezier cureve between two points.
- */
-QVector<QPointF> SplineChartItem::calculateControlPoints(const QVector<QPointF> &points)
-{
- QVector<QPointF> controlPoints;
- controlPoints.resize(points.count() * 2 - 2);
-
- int n = points.count() - 1;
-
- if (n == 1) {
- //for n==1
- controlPoints[0].setX((2 * points[0].x() + points[1].x()) / 3);
- controlPoints[0].setY((2 * points[0].y() + points[1].y()) / 3);
- controlPoints[1].setX(2 * controlPoints[0].x() - points[0].x());
- controlPoints[1].setY(2 * controlPoints[0].y() - points[0].y());
- return controlPoints;
- }
-
- // Calculate first Bezier control points
- // Set of equations for P0 to Pn points.
- //
- // | 2 1 0 0 ... 0 0 0 ... 0 0 0 | | P1_1 | | P0 + 2 * P1 |
- // | 1 4 1 0 ... 0 0 0 ... 0 0 0 | | P1_2 | | 4 * P1 + 2 * P2 |
- // | 0 1 4 1 ... 0 0 0 ... 0 0 0 | | P1_3 | | 4 * P2 + 2 * P3 |
- // | . . . . . . . . . . . . | | ... | | ... |
- // | 0 0 0 0 ... 1 4 1 ... 0 0 0 | * | P1_i | = | 4 * P(i-1) + 2 * Pi |
- // | . . . . . . . . . . . . | | ... | | ... |
- // | 0 0 0 0 0 0 0 0 ... 1 4 1 | | P1_(n-1)| | 4 * P(n-2) + 2 * P(n-1) |
- // | 0 0 0 0 0 0 0 0 ... 0 2 7 | | P1_n | | 8 * P(n-1) + Pn |
- //
- QVector<qreal> vector;
- vector.resize(n);
-
- vector[0] = points[0].x() + 2 * points[1].x();
-
-
- for (int i = 1; i < n - 1; ++i)
- vector[i] = 4 * points[i].x() + 2 * points[i + 1].x();
-
- vector[n - 1] = (8 * points[n - 1].x() + points[n].x()) / 2.0;
-
- QVector<qreal> xControl = firstControlPoints(vector);
-
- vector[0] = points[0].y() + 2 * points[1].y();
-
- for (int i = 1; i < n - 1; ++i)
- vector[i] = 4 * points[i].y() + 2 * points[i + 1].y();
-
- vector[n - 1] = (8 * points[n - 1].y() + points[n].y()) / 2.0;
-
- QVector<qreal> yControl = firstControlPoints(vector);
-
- for (int i = 0, j = 0; i < n; ++i, ++j) {
-
- controlPoints[j].setX(xControl[i]);
- controlPoints[j].setY(yControl[i]);
-
- j++;
-
- if (i < n - 1) {
- controlPoints[j].setX(2 * points[i + 1].x() - xControl[i + 1]);
- controlPoints[j].setY(2 * points[i + 1].y() - yControl[i + 1]);
- } else {
- controlPoints[j].setX((points[n].x() + xControl[n - 1]) / 2);
- controlPoints[j].setY((points[n].y() + yControl[n - 1]) / 2);
- }
- }
- return controlPoints;
-}
-
-QVector<qreal> SplineChartItem::firstControlPoints(const QVector<qreal>& vector)
-{
- QVector<qreal> result;
-
- int count = vector.count();
- result.resize(count);
- result[0] = vector[0] / 2.0;
-
- QVector<qreal> temp;
- temp.resize(count);
- temp[0] = 0;
-
- qreal b = 2.0;
-
- for (int i = 1; i < count; i++) {
- temp[i] = 1 / b;
- b = (i < count - 1 ? 4.0 : 3.5) - temp[i];
- result[i] = (vector[i] - result[i - 1]) / b;
- }
-
- for (int i = 1; i < count; i++)
- result[count - i - 1] -= temp[count - i] * result[count - i];
-
- return result;
-}
-
-//handlers
-
-void SplineChartItem::handleUpdated()
-{
- setVisible(m_series->isVisible());
- setOpacity(m_series->opacity());
- m_pointsVisible = m_series->pointsVisible();
- m_linePen = m_series->pen();
- m_pointPen = m_series->pen();
- m_pointPen.setWidthF(2 * m_pointPen.width());
- m_pointLabelsFormat = m_series->pointLabelsFormat();
- m_pointLabelsVisible = m_series->pointLabelsVisible();
- m_pointLabelsFont = m_series->pointLabelsFont();
- m_pointLabelsColor = m_series->pointLabelsColor();
- update();
-}
-
-//painter
-
-void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(widget)
- Q_UNUSED(option)
-
- QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
-
- painter->save();
- painter->setPen(m_linePen);
- painter->setBrush(Qt::NoBrush);
-
- if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
- qreal halfWidth = domain()->size().width() / 2.0;
- QRectF clipRectLeft = QRectF(0, 0, halfWidth, domain()->size().height());
- QRectF clipRectRight = QRectF(halfWidth, 0, halfWidth, domain()->size().height());
- QRegion fullPolarClipRegion(clipRect.toRect(), QRegion::Ellipse);
- QRegion clipRegionLeft(fullPolarClipRegion.intersected(clipRectLeft.toRect()));
- QRegion clipRegionRight(fullPolarClipRegion.intersected(clipRectRight.toRect()));
- painter->setClipRegion(clipRegionLeft);
- painter->drawPath(m_pathPolarLeft);
- painter->setClipRegion(clipRegionRight);
- painter->drawPath(m_pathPolarRight);
- painter->setClipRegion(fullPolarClipRegion);
- } else {
- painter->setClipRect(clipRect);
- }
-
- painter->drawPath(m_path);
-
- if (m_pointsVisible) {
- painter->setPen(m_pointPen);
- if (m_series->chart()->chartType() == QChart::ChartTypePolar)
- painter->drawPoints(m_visiblePoints);
- else
- painter->drawPoints(geometryPoints());
- }
-
- if (m_pointLabelsVisible)
- m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2);
-
- painter->restore();
-}
-
-void SplineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- emit XYChart::clicked(domain()->calculateDomainPoint(event->pos()));
- QGraphicsItem::mousePressEvent(event);
-}
-
-void SplineChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
-{
- emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), true);
- QGraphicsItem::hoverEnterEvent(event);
-}
-
-void SplineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
-{
- emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), false);
- QGraphicsItem::hoverLeaveEvent(event);
-}
-
-#include "moc_splinechartitem_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/splinechart/splinechartitem_p.h b/src/splinechart/splinechartitem_p.h
deleted file mode 100644
index e171f26d..00000000
--- a/src/splinechart/splinechartitem_p.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef SPLINECHARTITEM_P_H
-#define SPLINECHARTITEM_P_H
-
-#include "qsplineseries.h"
-#include "xychart_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class SplineAnimation;
-
-class SplineChartItem : public XYChart
-{
- Q_OBJECT
- Q_INTERFACES(QGraphicsItem)
-public:
- SplineChartItem(QSplineSeries *series, QGraphicsItem *item = 0);
-
- //from QGraphicsItem
- QRectF boundingRect() const;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
- QPainterPath shape() const;
-
- void setControlGeometryPoints(QVector<QPointF>& points);
- QVector<QPointF> controlGeometryPoints() const;
-
- void setAnimation(SplineAnimation *animation);
- ChartAnimation *animation() const;
-
-public Q_SLOTS:
- void handleUpdated();
-
-protected:
- void updateGeometry();
- QVector<QPointF> calculateControlPoints(const QVector<QPointF> &points);
- QVector<qreal> firstControlPoints(const QVector<qreal>& vector);
- void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index);
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
-
-private:
- QSplineSeries *m_series;
- QPainterPath m_path;
- QPainterPath m_pathPolarRight;
- QPainterPath m_pathPolarLeft;
- QPainterPath m_fullPath;
- QRectF m_rect;
- QPen m_linePen;
- QPen m_pointPen;
- bool m_pointsVisible;
- QVector<QPointF> m_controlPoints;
- QVector<QPointF> m_visiblePoints;
- SplineAnimation *m_animation;
-
- bool m_pointLabelsVisible;
- QString m_pointLabelsFormat;
- QFont m_pointLabelsFont;
- QColor m_pointLabelsColor;
-
- friend class SplineAnimation;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // SPLINECHARTITEM_P_H
diff --git a/src/src.pro b/src/src.pro
index d4386d1e..d25e0e6f 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,266 +1,4 @@
-!include( ../config.pri ):error( "Couldn't find the config.pri file!" )
-
-############################# BUILD CONFIG ######################################
-
-TARGET = $$LIBRARY_NAME
-DESTDIR = $$CHART_BUILD_LIB_DIR
-TEMPLATE = lib
-QT = core gui
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-DEFINES += QTCOMMERCIALCHART_LIBRARY
-win32:CONFIG += create_prl
-# treat warnings as errors
-win32-msvc*: {
- QMAKE_CXXFLAGS += /WX
-} else {
-# QMAKE_CXXFLAGS += -Werror
-}
-
-unix:!qnx:!android {
- QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
-}
-
-############################# DEPEDENCES ########################################
-
-win32-msvc*: LIBS += User32.lib
-LIBS -= -l$$LIBRARY_NAME
-INCLUDEPATH += ../include .
-
-############################# SOURCES ##########################################
-
-SOURCES += \
- $$PWD/chartdataset.cpp \
- $$PWD/chartpresenter.cpp \
- $$PWD/chartthememanager.cpp \
- $$PWD/qchart.cpp \
- $$PWD/qchartview.cpp \
- $$PWD/qabstractseries.cpp \
- $$PWD/chartbackground.cpp \
- $$PWD/chartelement.cpp \
- $$PWD/chartitem.cpp \
- $$PWD/scroller.cpp \
- $$PWD/charttitle.cpp \
- $$PWD/qpolarchart.cpp
-PRIVATE_HEADERS += \
- $$PWD/chartdataset_p.h \
- $$PWD/chartitem_p.h \
- $$PWD/chartpresenter_p.h \
- $$PWD/chartthememanager_p.h \
- $$PWD/chartbackground_p.h \
- $$PWD/chartelement_p.h \
- $$PWD/chartconfig_p.h \
- $$PWD/qchart_p.h \
- $$PWD/qchartview_p.h \
- $$PWD/scroller_p.h \
- $$PWD/qabstractseries_p.h \
- $$PWD/charttitle_p.h \
- $$PWD/charthelpers_p.h
-PUBLIC_HEADERS += \
- $$PWD/qchart.h \
- $$PWD/qchartglobal.h \
- $$PWD/qabstractseries.h \
- $$PWD/qchartview.h \
- $$PWD/chartsnamespace.h \
- $$PWD/qpolarchart.h
-
-include(animations/animations.pri)
-include(areachart/areachart.pri)
-include(axis/axis.pri)
-include(domain/domain.pri)
-include(barchart/barchart.pri)
-include(legend/legend.pri)
-include(linechart/linechart.pri)
-include(piechart/piechart.pri)
-include(scatterchart/scatter.pri)
-include(splinechart/splinechart.pri)
-include(themes/themes.pri)
-include(xychart/xychart.pri)
-include(layout/layout.pri)
-include(boxplotchart/boxplotchart.pri)
-
-HEADERS += $$PUBLIC_HEADERS
-HEADERS += $$PRIVATE_HEADERS
-HEADERS += $$THEMES
-
-############################# BUILD PATH ##########################################
-
-OBJECTS_DIR = $$CHART_BUILD_DIR/lib
-MOC_DIR = $$CHART_BUILD_DIR/lib
-UI_DIR = $$CHART_BUILD_DIR/lib
-RCC_DIR = $$CHART_BUILD_DIR/lib
-
-############################# PUBLIC HEADERS GENERATOR ##########################################
-
-!exists($$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal)
-{
- system($$QMAKE_MKDIR $$CHART_BUILD_PUBLIC_HEADER_DIR)
- contains(QMAKE_HOST.os, Windows) {
- command = "echo $${LITERAL_HASH}include \"qchartglobal.h\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal"
- }else{
- command = "echo \"$${LITERAL_HASH}include \\\"qchartglobal.h\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal"
- }
- PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal
- system($$command)
-}
-
-for(file, PUBLIC_HEADERS) {
- name = $$split(file,'/')
- last_name = $$last(name)
- class = "$$cat($$file)"
- found_class = $$find(class,class)
- !isEmpty(found_class){
- split_class = $$split(found_class,QTCOMMERCIALCHART_EXPORT)
- member_class = $$member(split_class,1)
- member_split_class = $$split(member_class,' ')
- modified_class = $$replace(member_split_class,' ','')
- final_class = $$member(modified_class,0)
- contains(QMAKE_HOST.os, Windows) {
- command = "echo $${LITERAL_HASH}include \"$$last_name\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$final_class"
- }else{
- command = "echo \"$${LITERAL_HASH}include \\\"$$last_name\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$final_class"
- }
- PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/$$final_class
- system($$command)
- }
- unset(name)
- unset(last_name)
- unset(class)
- unset(found_class)
- unset(split_class)
- unset(member_class)
- unset(member_split_class)
- unset(modified_class)
- unset(final_class)
-}
-
-############################# INSTALLERS ##########################################
-
-public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart
-public_headers.files = $$PUBLIC_HEADERS $$PUBLIC_QT_HEADERS
-INSTALLS += public_headers
-
-install_build_public_headers.name = build_public_headers
-install_build_public_headers.output = $$CHART_BUILD_PUBLIC_HEADER_DIR/${QMAKE_FILE_BASE}.h
-install_build_public_headers.input = PUBLIC_HEADERS
-install_build_public_headers.commands = $$QMAKE_COPY \
- ${QMAKE_FILE_NAME} \
- $$CHART_BUILD_PUBLIC_HEADER_DIR
-install_build_public_headers.CONFIG += target_predeps \
- no_link
-
-install_build_private_headers.name = build_private_headers
-install_build_private_headers.output = $$CHART_BUILD_PRIVATE_HEADER_DIR/${QMAKE_FILE_BASE}.h
-install_build_private_headers.input = PRIVATE_HEADERS
-install_build_private_headers.commands = $$QMAKE_COPY \
- ${QMAKE_FILE_NAME} \
- $$CHART_BUILD_PRIVATE_HEADER_DIR
-install_build_private_headers.CONFIG += target_predeps \
- no_link
-
-QMAKE_EXTRA_COMPILERS += install_build_public_headers \
- install_build_private_headers \
-
-win32:{
- bintarget.CONFIG += no_check_exist
- !staticlib: {
- bintarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.dll
- }
- win32-msvc*:CONFIG(debug, debug|release): {
- bintarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.pdb
- }
- bintarget.path = $$[QT_INSTALL_BINS]
-
- libtarget.CONFIG += no_check_exist
- libtarget.files = $$CHART_BUILD_LIB_DIR\\$${TARGET}.prl
- win32-msvc*: {
- libtarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.lib
- } else {
- libtarget.files += $$CHART_BUILD_LIB_DIR\\lib$${TARGET}.a
- }
- libtarget.path = $$[QT_INSTALL_LIBS]
-
- DLLDESTDIR = $$CHART_BUILD_BIN_DIR
- INSTALLS += bintarget libtarget
-}else{
- target.path=$$[QT_INSTALL_LIBS]
- INSTALLS += target
-}
-
-mac: !static:!staticlib {
- # Update the name (id) of the library on OSX to point to the lib path
- MAC_CHARTS_LIB_NAME = "lib"$$LIBRARY_NAME".1.dylib"
- QMAKE_POST_LINK += "install_name_tool -id $$CHART_BUILD_LIB_DIR"/"$$MAC_CHARTS_LIB_NAME $$CHART_BUILD_LIB_DIR"/"$$MAC_CHARTS_LIB_NAME"
-
- # Update the name (id) of the installed library on OSX to point to the installation path
- postinstall.path = $$[QT_INSTALL_LIBS]
- postinstall.extra = "install_name_tool -id $(INSTALL_ROOT)"/"$$[QT_INSTALL_LIBS]"/"$$MAC_CHARTS_LIB_NAME $(INSTALL_ROOT)"/"$$[QT_INSTALL_LIBS]"/"$$MAC_CHARTS_LIB_NAME"
- INSTALLS += postinstall
-}
-
-################################ DEVELOPMENT BUILD ##########################################
-# There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly.
-# This is the case at least with shadow builds.
-# http://qt-project.org/wiki/jom
-
-development_build:!win32-msvc*:{
- chartversion.target = $$PWD/qchartversion_p.h
-
- unix:{
- chartversion.commands = @echo \
- \" $${LITERAL_HASH}ifndef QCHARTVERSION_P_H\\n\
- $${LITERAL_HASH}define QCHARTVERSION_P_H\\n\
- const char *buildTime = \\\"`date +'%y%m%d%H%M'`\\\" ; \\n\
- const char *gitHead = \\\"`git rev-parse HEAD`\\\" ; \\n \
- $${LITERAL_HASH}endif \" \
- > \
- $$chartversion.target;
- }else{
- chartversion.commands = @echo \
- "const char *buildTime = \"%date%_%time%\" ; \
- const char *gitHead = \"unknown\" ; " \
- > \
- $$chartversion.target
- }
-
- chartversion.depends = $$HEADERS \
- $$SOURCES
-
- PRE_TARGETDEPS += $$chartversion.target
- QMAKE_CLEAN += $$PWD/qchartversion_p.h
- QMAKE_EXTRA_TARGETS += chartversion
-}
-
-############################### CLEAN ###########################################
-
-unix:QMAKE_DISTCLEAN += -r \
- $$CHART_BUILD_HEADER_DIR \
- $$CHART_BUILD_LIB_DIR
-win32:QMAKE_DISTCLEAN += /Q \
- $$CHART_BUILD_HEADER_DIR \
- $$CHART_BUILD_LIB_DIR
-
-############################## COVERAGE #########################################
-
-unix:coverage:{
-
-QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
-QMAKE_LDFLAGS += -fprofile-arcs -ftest-coverage
-
-LIBS += -lgcov
-
-QMAKE_CLEAN += $$OBJECTS_DIR/*.gcda $$OBJECTS_DIR/*.gcno $$PWD/*.gcov ../coverage/*.info
-QMAKE_EXTRA_TARGETS += preparecoverage gencoverage
-
-preparecoverage.target = prepare_coverage
-preparecoverage.depends = all
-preparecoverage.commands = lcov --directory $$OBJECTS_DIR --zerocounters ;\
- lcov -i -d $$OBJECTS_DIR -c -o ../coverage/base.info -b $$PWD;
-
-gencoverage.target = gen_coverage
-gencoverage.depends = all
-gencoverage.commands = lcov -d $$OBJECTS_DIR -c -o ../coverage/src.info -b $$PWD;\
- lcov -e ../coverage/base.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/base.info;\
- lcov -e ../coverage/src.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/src.info;\
- lcov -a ../coverage/base.info -a ../coverage/src.info -o ../coverage/coverage.info;
-}
-
+TEMPLATE = subdirs
+CONFIG += ordered
+SUBDIRS += charts \
+ chartsqml2
diff --git a/src/themes/charttheme_p.h b/src/themes/charttheme_p.h
deleted file mode 100644
index 6161e37c..00000000
--- a/src/themes/charttheme_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEME_H
-#define CHARTTHEME_H
-
-#include "chartthememanager_p.h"
-#include <QColor>
-#include <QGradientStops>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartTheme
-{
-
-public:
- enum BackgroundShadesMode {
- BackgroundShadesNone = 0,
- BackgroundShadesVertical,
- BackgroundShadesHorizontal,
- BackgroundShadesBoth
- };
-
-protected:
- explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id),
- m_backgroundShadesBrush(Qt::SolidPattern),
- m_backgroundShades(BackgroundShadesNone),
- m_backgroundDropShadowEnabled(false)
- {};
-public:
- QChart::ChartTheme id() const { return m_id; }
- QList<QGradient> seriesGradients() const { return m_seriesGradients; }
- QList<QColor> seriesColors() const { return m_seriesColors; }
- QLinearGradient chartBackgroundGradient() const { return m_chartBackgroundGradient; }
- QFont masterFont() const { return m_masterFont; }
- QFont labelFont() const { return m_labelFont; }
- QBrush labelBrush() const { return m_labelBrush; }
- QPen axisLinePen() const { return m_axisLinePen; }
- QPen backgroundShadesPen() const { return m_backgroundShadesPen; }
- QPen outlinePen() const { return m_outlinePen; }
- QBrush backgroundShadesBrush() const { return m_backgroundShadesBrush; }
- BackgroundShadesMode backgroundShades() const { return m_backgroundShades; }
- bool isBackgroundDropShadowEnabled() const { return m_backgroundDropShadowEnabled; }
- QPen girdLinePen() const { return m_gridLinePen; }
-
-protected:
- QChart::ChartTheme m_id;
- QList<QColor> m_seriesColors;
- QList<QGradient> m_seriesGradients;
- QLinearGradient m_chartBackgroundGradient;
-
- QFont m_masterFont;
- QFont m_labelFont;
- QBrush m_labelBrush;
- QPen m_axisLinePen;
- QPen m_backgroundShadesPen;
- QPen m_outlinePen;
- QBrush m_backgroundShadesBrush;
- BackgroundShadesMode m_backgroundShades;
- bool m_backgroundDropShadowEnabled;
- QPen m_gridLinePen;
-
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // CHARTTHEME_H
diff --git a/src/themes/chartthemebluecerulean_p.h b/src/themes/chartthemebluecerulean_p.h
deleted file mode 100644
index 788d6161..00000000
--- a/src/themes/chartthemebluecerulean_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMEBLUECERULEAN_P_H
-#define CHARTTHEMEBLUECERULEAN_P_H
-
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeBlueCerulean: public ChartTheme
-{
-public:
- ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) {
- // Series colors
- m_seriesColors << QRgb(0xc7e85b);
- m_seriesColors << QRgb(0x1cb54f);
- m_seriesColors << QRgb(0x5cbf9b);
- m_seriesColors << QRgb(0x009fbf);
- m_seriesColors << QRgb(0xee7392);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
- backgroundGradient.setColorAt(0.0, QRgb(0x056189));
- backgroundGradient.setColorAt(1.0, QRgb(0x101a31));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
-
- // Axes and other
- m_labelBrush = QBrush(QRgb(0xffffff));
- m_axisLinePen = QPen(QRgb(0xd6d6d6));
- m_axisLinePen.setWidth(2);
- m_gridLinePen = QPen(QRgb(0x84a2b0));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
- m_outlinePen = QPen(QRgb(0xebebeb));
- m_outlinePen.setWidthF(2.0);
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/themes/chartthemeblueicy_p.h b/src/themes/chartthemeblueicy_p.h
deleted file mode 100644
index 3ab15214..00000000
--- a/src/themes/chartthemeblueicy_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMEBLUEICY_P_H
-#define CHARTTHEMEBLUEICY_P_H
-
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeBlueIcy: public ChartTheme
-{
-public:
- ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy)
- {
- // Series colors
- m_seriesColors << QRgb(0x3daeda);
- m_seriesColors << QRgb(0x2685bf);
- m_seriesColors << QRgb(0x0c2673);
- m_seriesColors << QRgb(0x5f3dba);
- m_seriesColors << QRgb(0x2fa3b4);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
- backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
- backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
- m_backgroundDropShadowEnabled = true;
-
- // Axes and other
- m_labelBrush = QBrush(QRgb(0x404044));
- m_axisLinePen = QPen(QRgb(0xd6d6d6));
- m_axisLinePen.setWidth(2);
- m_gridLinePen = QPen(QRgb(0xe2e2e2));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
- m_outlinePen = QPen(QRgb(0x474747));
- m_outlinePen.setWidthF(2.0);
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/themes/chartthemebluencs_p.h b/src/themes/chartthemebluencs_p.h
deleted file mode 100644
index 310e7f08..00000000
--- a/src/themes/chartthemebluencs_p.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMEBLUENCS_P_H
-#define CHARTTHEMEBLUENCS_P_H
-
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeBlueNcs: public ChartTheme
-{
-public:
- ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs)
- {
- // Series colors
- m_seriesColors << QRgb(0x1db0da);
- m_seriesColors << QRgb(0x1341a6);
- m_seriesColors << QRgb(0x88d41e);
- m_seriesColors << QRgb(0xff8e1a);
- m_seriesColors << QRgb(0x398ca3);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient;
- backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
- backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
-
- // Axes and other
- m_labelBrush = QBrush(QRgb(0x404044));
- m_axisLinePen = QPen(QRgb(0xd6d6d6));
- m_axisLinePen.setWidth(2);
- m_gridLinePen = QPen(QRgb(0xe2e2e2));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
- m_outlinePen = QPen(QRgb(0x474747));
- m_outlinePen.setWidthF(2.0);
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/themes/chartthemebrownsand_p.h b/src/themes/chartthemebrownsand_p.h
deleted file mode 100644
index fd717e31..00000000
--- a/src/themes/chartthemebrownsand_p.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMEBROWNSAND_P_H
-#define CHARTTHEMEBROWNSAND_P_H
-
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeBrownSand: public ChartTheme
-{
-public:
- ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand)
- {
- // Series colors
- m_seriesColors << QRgb(0xb39b72);
- m_seriesColors << QRgb(0xb3b376);
- m_seriesColors << QRgb(0xc35660);
- m_seriesColors << QRgb(0x536780);
- m_seriesColors << QRgb(0x494345);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient;
- backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0));
- backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
-
- // Axes and other
- m_labelBrush = QBrush(QRgb(0x404044));
- m_axisLinePen = QPen(QRgb(0xb5b0a7));
- m_axisLinePen.setWidth(2);
- m_gridLinePen = QPen(QRgb(0xd4cec3));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
- m_outlinePen = QPen(QRgb(0x222222));
- m_outlinePen.setWidthF(2.0);
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/themes/chartthemedark_p.h b/src/themes/chartthemedark_p.h
deleted file mode 100644
index 714ced39..00000000
--- a/src/themes/chartthemedark_p.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMEDARK_P_H
-#define CHARTTHEMEDARK_P_H
-
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeDark : public ChartTheme
-{
-public:
- ChartThemeDark() : ChartTheme(QChart::ChartThemeDark)
- {
- // Series colors
- m_seriesColors << QRgb(0x38ad6b);
- m_seriesColors << QRgb(0x3c84a7);
- m_seriesColors << QRgb(0xeb8817);
- m_seriesColors << QRgb(0x7b7f8c);
- m_seriesColors << QRgb(0xbf593e);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
- backgroundGradient.setColorAt(0.0, QRgb(0x2e303a));
- backgroundGradient.setColorAt(1.0, QRgb(0x121218));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
-
- // Axes and other
- m_labelBrush = QBrush(QRgb(0xffffff));
- m_axisLinePen = QPen(QRgb(0x86878c));
- m_axisLinePen.setWidth(2);
- m_gridLinePen = QPen(QRgb(0x86878c));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
- m_outlinePen = QPen(QRgb(0xd6d6d6));
- m_outlinePen.setWidthF(2.0);
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/themes/chartthemehighcontrast_p.h b/src/themes/chartthemehighcontrast_p.h
deleted file mode 100644
index 57e6a050..00000000
--- a/src/themes/chartthemehighcontrast_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMEHIGHCONTRAST_P_H
-#define CHARTTHEMEHIGHCONTRAST_P_H
-
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeHighContrast : public ChartTheme
-{
-public:
- ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast)
- {
- // Series colors
- m_seriesColors << QRgb(0x202020);
- m_seriesColors << QRgb(0x596a74);
- m_seriesColors << QRgb(0xffab03);
- m_seriesColors << QRgb(0x038e9b);
- m_seriesColors << QRgb(0xff4a41);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
- backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
- backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
- m_backgroundDropShadowEnabled = true;
-
- // Axes and other
- m_labelBrush = QBrush(QRgb(0x181818));
- m_axisLinePen = QPen(QRgb(0x8c8c8c));
- m_axisLinePen.setWidth(2);
- m_gridLinePen = QPen(QRgb(0x8c8c8c));
- m_gridLinePen.setWidth(1);
- m_backgroundShadesBrush = QBrush(QRgb(0xffeecd));
- m_backgroundShades = BackgroundShadesHorizontal;
- m_outlinePen = QPen(QColor(Qt::black));
- m_outlinePen.setWidthF(2.0);
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/themes/chartthemelight_p.h b/src/themes/chartthemelight_p.h
deleted file mode 100644
index 72d9e02e..00000000
--- a/src/themes/chartthemelight_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMELIGHT_P_H
-#define CHARTTHEMELIGHT_P_H
-
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeLight: public ChartTheme
-{
-public:
- ChartThemeLight() : ChartTheme(QChart::ChartThemeLight)
- {
- // Series colors
- m_seriesColors << QRgb(0x209fdf);
- m_seriesColors << QRgb(0x99ca53);
- m_seriesColors << QRgb(0xf6a625);
- m_seriesColors << QRgb(0x6d5fd5);
- m_seriesColors << QRgb(0xbf593e);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient;
- backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
- backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
- // There is a performance issue in the drop shadow implementation, so disabled for now
-// m_backgroundDropShadowEnabled = true;
-
- // Axes and other
- m_axisLinePen = QPen(0xd6d6d6);
- m_axisLinePen.setWidth(1);
- m_labelBrush = QBrush(QRgb(0x404044));
- m_gridLinePen = QPen(QRgb(0xe2e2e2));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
- m_outlinePen = QPen(0x4d4d4d);
- m_outlinePen.setWidthF(2.0);
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/themes/chartthemeqt_p.h b/src/themes/chartthemeqt_p.h
deleted file mode 100644
index bc92d5fb..00000000
--- a/src/themes/chartthemeqt_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMEQT_P_H
-#define CHARTTHEMEQT_P_H
-
-#include "charttheme_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeQt : public ChartTheme
-{
-public:
- ChartThemeQt() : ChartTheme(QChart::ChartThemeQt)
- {
- // Series colors
- m_seriesColors << QRgb(0x80c342);
- m_seriesColors << QRgb(0x328930);
- m_seriesColors << QRgb(0x006325);
- m_seriesColors << QRgb(0x35322f);
- m_seriesColors << QRgb(0x5d5b59);
- m_seriesColors << QRgb(0x868482);
- m_seriesColors << QRgb(0xaeadac);
- m_seriesColors << QRgb(0xd7d6d5);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
- backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
- backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
-
- // Axes and other
- m_labelBrush = QBrush(QRgb(0x35322f));
- m_axisLinePen = QPen(QRgb(0xd7d6d5));
- m_axisLinePen.setWidth(1);
- m_gridLinePen = QPen(QRgb(0xd7d6d5));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
- m_outlinePen = QPen(QRgb(0x35322f));
- m_outlinePen.setWidthF(2.0);
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/themes/chartthemesystem_p.h b/src/themes/chartthemesystem_p.h
deleted file mode 100644
index e0d21efe..00000000
--- a/src/themes/chartthemesystem_p.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTTHEMESYSTEM_P_H
-#define CHARTTHEMESYSTEM_P_H
-
-#include "charttheme_p.h"
-#ifdef Q_OS_WIN
-#include <windows.h>
-#include <stdio.h>
-#endif
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartThemeSystem: public ChartTheme
-{
-public:
- // System theme not used at the moment (the user is not able to select this theme)
- ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/)
- {
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
- // We could also use theme specific window frame color as a series base color (it would give more
- // variation to the base colors in addition to the blue and black used now)
-
- // First series base color from COLOR_HIGHLIGHT
- DWORD colorHighlight;
- colorHighlight = GetSysColor(COLOR_HIGHLIGHT);
- m_seriesColors.append(QColor(GetRValue(colorHighlight),
- GetGValue(colorHighlight),
- GetBValue(colorHighlight)));
-
- // Second series base color from COLOR_WINDOWFRAME
- DWORD colorWindowFrame;
- colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME);
- m_seriesColors.append(QColor(GetRValue(colorWindowFrame),
- GetGValue(colorWindowFrame),
- GetBValue(colorWindowFrame)));
-
- // Third series base color from the middle of the COLOR_ACTIVECAPTION /
- // COLOR_GRADIENTACTIVECAPTION gradient
- DWORD colorGradientActiveCaptionLeft;
- colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION);
- DWORD colorGradientActiveCaptionRight;
- colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION);
- QLinearGradient g;
- QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft),
- GetGValue(colorGradientActiveCaptionLeft),
- GetBValue(colorGradientActiveCaptionLeft));
- g.setColorAt(0.0, start);
- QColor end = QColor(GetRValue(colorGradientActiveCaptionRight),
- GetGValue(colorGradientActiveCaptionRight),
- GetBValue(colorGradientActiveCaptionRight));
- g.setColorAt(1.0, end);
- m_seriesColors.append(ChartThemeManager::colorAt(g, 0.5));
-
- // Generate gradients from the base colors
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background fill color from COLOR_WINDOW
- QLinearGradient backgroundGradient;
- DWORD colorWindow;
- colorWindow = GetSysColor(COLOR_WINDOW);
- backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow),
- GetGValue(colorWindow),
- GetBValue(colorWindow)));
- backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow),
- GetGValue(colorWindow),
- GetBValue(colorWindow)));
- // Axes and other
- m_axisLinePen = QPen(0xd6d6d6);
- m_axisLinePen.setWidth(1);
- m_labelBrush = QBrush(QRgb(0x404044));
- m_gridLinePen = QPen(QRgb(0xe2e2e2));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
-
-#elif defined(Q_OS_LINUX)
- // Using a hard coded theme for Linux system theme
- m_seriesColors << QRgb(0x60a6e6);
- m_seriesColors << QRgb(0x92ca66);
- m_seriesColors << QRgb(0xeba85f);
- m_seriesColors << QRgb(0xfc5751);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient;
- backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
- backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
-
- // Axes and other
- m_axisLinePen = QPen(0xd6d6d6);
- m_axisLinePen.setWidth(1);
- m_labelBrush = QBrush(QRgb(0x404044));
- m_gridLinePen = QPen(QRgb(0xe2e2e2));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
-
-#elif defined(Q_OS_MAC)
- // Using a hard coded theme for OSX system theme; the colors match the OSX 10.7 colors
- m_seriesColors << QRgb(0x60a6e6);
- m_seriesColors << QRgb(0x92ca66);
- m_seriesColors << QRgb(0xeba85f);
- m_seriesColors << QRgb(0xfc5751);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient;
- backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
- backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
-
- // Axes and other
- m_axisLinePen = QPen(0xd6d6d6);
- m_axisLinePen.setWidth(1);
- m_labelBrush = QBrush(QRgb(0x404044));
- m_gridLinePen = QPen(QRgb(0xe2e2e2));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
-
-#else
- // Hard coded theme
- m_seriesColors << QRgb(0x60a6e6);
- m_seriesColors << QRgb(0x92ca66);
- m_seriesColors << QRgb(0xeba85f);
- m_seriesColors << QRgb(0xfc5751);
- m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
-
- // Background
- QLinearGradient backgroundGradient;
- backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
- backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
- backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
- m_chartBackgroundGradient = backgroundGradient;
-
- // Axes and other
- m_axisLinePen = QPen(0xd6d6d6);
- m_axisLinePen.setWidth(1);
- m_labelBrush = QBrush(QRgb(0x404044));
- m_gridLinePen = QPen(QRgb(0xe2e2e2));
- m_gridLinePen.setWidth(1);
- m_backgroundShades = BackgroundShadesNone;
-#endif
- }
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // CHARTTHEMESYSTEM_P_H
diff --git a/src/xychart/qhxymodelmapper.cpp b/src/xychart/qhxymodelmapper.cpp
deleted file mode 100644
index fbb6192b..00000000
--- a/src/xychart/qhxymodelmapper.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qhxymodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QHXYModelMapper
- \inmodule Qt Charts
- \mainclass
-
- Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
- Horizontal model mapper is used to create a connection between QXYSeries and QAbstractItemModel derived model object.
- It is possible to use both QAbstractItemModel and QXYSeries model API. QXYModelMapper makes sure that QXYSeries and the model are kept in sync.
- Note: used model has to support adding/removing rows/columns and modifying the data of the cells.
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype HXYModelMapper
- \instantiates QHXYModelMapper
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/hxymodelmapper.qdocinc
-*/
-#else
-/*!
- \qmlclass HXYModelMapper QHXYModelMapper
-
- \include ../doc/src/hxymodelmapper.qdocinc
-*/
-#endif
-
-/*!
- \property QHXYModelMapper::series
- \brief Defines the QXYSeries object that is used by the mapper.
-
- All the data in the series is discarded when it is set to the mapper.
- When new series is specified the old series is disconnected (it preserves its data)
-*/
-/*!
- \qmlproperty XYSeries HXYModelMapper::series
- Defines the XYSeries object that is used by the mapper. All the data in the series is discarded when it is set to
- the mapper. When new series is specified the old series is disconnected (it preserves its data).
-*/
-
-/*!
- \property QHXYModelMapper::model
- \brief Defines the model that is used by the mapper.
-*/
-/*!
- \qmlproperty SomeModel HXYModelMapper::model
- The QAbstractItemModel based model that is used by the mapper. You need to implement the model
- and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
- the data of the cells.
-*/
-
-/*!
- \property QHXYModelMapper::xRow
- \brief Defines which row of the model is kept in sync with the x values of the QXYSeries.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int HXYModelMapper::xRow
- Defines which row of the model is kept in sync with the x values of the series. Default value is -1 (invalid
- mapping).
-*/
-
-/*!
- \property QHXYModelMapper::yRow
- \brief Defines which row of the model is kept in sync with the y values of the QXYSeries.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int HXYModelMapper::yRow
- Defines which row of the model is kept in sync with the y values of the series. Default value is -1
- (invalid mapping).
-*/
-
-/*!
- \property QHXYModelMapper::firstColumn
- \brief Defines which column of the model contains the data for the first point of the series.
-
- Minimal and default value is: 0
-*/
-/*!
- \qmlproperty int HXYModelMapper::firstColumn
- Defines which column of the model contains the data for the first point of the series.
- The default value is 0.
-*/
-
-/*!
- \property QHXYModelMapper::columnCount
- \brief Defines the number of columns of the model that are mapped as the data for series.
-
- Minimal and default value is: -1 (count limited by the number of columns in the model)
-*/
-/*!
- \qmlproperty int HXYModelMapper::columnCount
- Defines the number of columns of the model that are mapped as the data for series. The default value is
- -1 (count limited by the number of columns in the model)
-*/
-
-/*!
- \fn void QHXYModelMapper::seriesReplaced()
-
- Emitted when the series to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QHXYModelMapper::modelReplaced()
-
- Emitted when the model to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QHXYModelMapper::xRowChanged()
-
- Emitted when the xRow has changed.
-*/
-
-/*!
- \fn void QHXYModelMapper::yRowChanged()
-
- Emitted when the yRow has changed.
-*/
-
-/*!
- \fn void QHXYModelMapper::firstColumnChanged()
- Emitted when the firstColumn has changed.
-*/
-
-/*!
- \fn void QHXYModelMapper::columnCountChanged()
- Emitted when the columnCount has changed.
-*/
-
-/*!
- Constructs a mapper object which is a child of \a parent.
-*/
-QHXYModelMapper::QHXYModelMapper(QObject *parent) :
- QXYModelMapper(parent)
-{
- QXYModelMapper::setOrientation(Qt::Horizontal);
-}
-
-QAbstractItemModel *QHXYModelMapper::model() const
-{
- return QXYModelMapper::model();
-}
-
-void QHXYModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model != QXYModelMapper::model()) {
- QXYModelMapper::setModel(model);
- emit modelReplaced();
- }
-}
-
-QXYSeries *QHXYModelMapper::series() const
-{
- return QXYModelMapper::series();
-}
-
-void QHXYModelMapper::setSeries(QXYSeries *series)
-{
- if (series != QXYModelMapper::series()) {
- QXYModelMapper::setSeries(series);
- emit seriesReplaced();
- }
-}
-
-int QHXYModelMapper::xRow() const
-{
- return QXYModelMapper::xSection();
-}
-
-void QHXYModelMapper::setXRow(int xRow)
-{
- if (xRow != xSection()) {
- QXYModelMapper::setXSection(xRow);
- emit xRowChanged();
- }
-}
-
-int QHXYModelMapper::yRow() const
-{
- return QXYModelMapper::ySection();
-}
-
-void QHXYModelMapper::setYRow(int yRow)
-{
- if (yRow != ySection()) {
- QXYModelMapper::setYSection(yRow);
- emit yRowChanged();
- }
-}
-
-int QHXYModelMapper::firstColumn() const
-{
- return first();
-}
-
-void QHXYModelMapper::setFirstColumn(int firstColumn)
-{
- if (firstColumn != first()) {
- setFirst(firstColumn);
- emit firstColumnChanged();
- }
-}
-
-int QHXYModelMapper::columnCount() const
-{
- return count();
-}
-
-void QHXYModelMapper::setColumnCount(int columnCount)
-{
- if (columnCount != count()) {
- setCount(columnCount);
- emit columnCountChanged();
- }
-}
-
-#include "moc_qhxymodelmapper.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/xychart/qhxymodelmapper.h b/src/xychart/qhxymodelmapper.h
deleted file mode 100644
index 1fb25e9d..00000000
--- a/src/xychart/qhxymodelmapper.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHXYMODELMAPPER_H
-#define QHXYMODELMAPPER_H
-
-#include <QXYModelMapper>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_EXPORT QHXYModelMapper : public QXYModelMapper
-{
- Q_OBJECT
- Q_PROPERTY(QXYSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
- Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
- Q_PROPERTY(int xRow READ xRow WRITE setXRow NOTIFY xRowChanged)
- Q_PROPERTY(int yRow READ yRow WRITE setYRow NOTIFY yRowChanged)
- Q_PROPERTY(int firstColumn READ firstColumn WRITE setFirstColumn NOTIFY firstColumnChanged)
- Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
-
-public:
- explicit QHXYModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QXYSeries *series() const;
- void setSeries(QXYSeries *series);
-
- int xRow() const;
- void setXRow(int xRow);
-
- int yRow() const;
- void setYRow(int yRow);
-
- int firstColumn() const;
- void setFirstColumn(int firstColumn);
-
- int columnCount() const;
- void setColumnCount(int columnCount);
-
-Q_SIGNALS:
- void seriesReplaced();
- void modelReplaced();
- void xRowChanged();
- void yRowChanged();
- void firstColumnChanged();
- void columnCountChanged();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QHXYMODELMAPPER_H
diff --git a/src/xychart/qvxymodelmapper.cpp b/src/xychart/qvxymodelmapper.cpp
deleted file mode 100644
index 6446c112..00000000
--- a/src/xychart/qvxymodelmapper.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvxymodelmapper.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QVXYModelMapper
- \inmodule Qt Charts
- \mainclass
-
- Model mappers allow you to use QAbstractItemModel derived models as a data source for a chart series.
- Vertical model mapper is used to create a connection between QXYSeries and QAbstractItemModel derived model object.
- It is possible to use both QAbstractItemModel and QXYSeries model API. QXYModelMapper makes sure that QXYSeries and the model are kept in sync.
- Note: used model has to support adding/removing rows/columns and modifying the data of the cells.
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype VXYModelMapper
- \instantiates QVXYModelMapper
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/vxymodelmapper.qdocinc
-*/
-#else
-/*!
- \qmlclass VXYModelMapper QVXYModelMapper
-
- \include ../doc/src/vxymodelmapper.qdocinc
-*/
-#endif
-
-/*!
- \property QVXYModelMapper::series
- \brief Defines the QXYSeries object that is used by the mapper.
-
- All the data in the series is discarded when it is set to the mapper.
- When new series is specified the old series is disconnected (it preserves its data)
-*/
-/*!
- \qmlproperty XYSeries VXYModelMapper::series
- Defines the XYSeries object that is used by the mapper. All the data in the series is discarded when it is set to
- the mapper. When new series is specified the old series is disconnected (it preserves its data).
-*/
-
-/*!
- \property QVXYModelMapper::model
- \brief Defines the model that is used by the mapper.
-*/
-/*!
- \qmlproperty SomeModel VXYModelMapper::model
- The QAbstractItemModel based model that is used by the mapper. You need to implement the model
- and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying
- the data of the cells.
-*/
-
-/*!
- \property QVXYModelMapper::xColumn
- \brief Defines which column of the model is kept in sync with the x values of QXYSeries.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int VXYModelMapper::xColumn
- Defines which column of the model is kept in sync with the x values of the series. Default value is -1 (invalid
- mapping).
-*/
-
-/*!
- \property QVXYModelMapper::yColumn
- \brief Defines which column of the model is kept in sync with the y values of QXYSeries.
-
- Default value is: -1 (invalid mapping)
-*/
-/*!
- \qmlproperty int VXYModelMapper::yColumn
- Defines which column of the model is kept in sync with the y values of the series. Default value is -1 (invalid
- mapping).
-*/
-
-/*!
- \property QVXYModelMapper::firstRow
- \brief Defines which row of the model contains the data for the first point of the series.
-
- Minimal and default value is: 0
-*/
-/*!
- \qmlproperty int VXYModelMapper::firstRow
- Defines which row of the model contains the data for the first point of the series.
- The default value is 0.
-*/
-
-/*!
- \property QVXYModelMapper::rowCount
- \brief Defines the number of rows of the model that are mapped as the data for series.
-
- Minimal and default value is: -1 (count limited by the number of rows in the model)
-*/
-/*!
- \qmlproperty int VXYModelMapper::columnCount
- Defines the number of rows of the model that are mapped as the data for series. The default value is
- -1 (count limited by the number of rows in the model).
-*/
-
-/*!
- \fn void QVXYModelMapper::seriesReplaced()
-
- Emitted when the series to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QVXYModelMapper::modelReplaced()
-
- Emitted when the model to which mapper is connected to has changed.
-*/
-
-/*!
- \fn void QVXYModelMapper::xColumnChanged()
-
- Emitted when the xColumn has changed.
-*/
-
-/*!
- \fn void QVXYModelMapper::yColumnChanged()
-
- Emitted when the yColumn has changed.
-*/
-
-/*!
- \fn void QVXYModelMapper::firstRowChanged()
- Emitted when the firstRow has changed.
-*/
-
-/*!
- \fn void QVXYModelMapper::rowCountChanged()
- Emitted when the rowCount has changed.
-*/
-
-/*!
- Constructs a mapper object which is a child of \a parent.
-*/
-QVXYModelMapper::QVXYModelMapper(QObject *parent) :
- QXYModelMapper(parent)
-{
- QXYModelMapper::setOrientation(Qt::Vertical);
-}
-
-QAbstractItemModel *QVXYModelMapper::model() const
-{
- return QXYModelMapper::model();
-}
-
-void QVXYModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model != QXYModelMapper::model()) {
- QXYModelMapper::setModel(model);
- emit modelReplaced();
- }
-}
-
-QXYSeries *QVXYModelMapper::series() const
-{
- return QXYModelMapper::series();
-}
-
-void QVXYModelMapper::setSeries(QXYSeries *series)
-{
- if (series != QXYModelMapper::series()) {
- QXYModelMapper::setSeries(series);
- emit seriesReplaced();
- }
-}
-
-int QVXYModelMapper::xColumn() const
-{
- return QXYModelMapper::xSection();
-}
-
-void QVXYModelMapper::setXColumn(int xColumn)
-{
- if (xColumn != xSection()) {
- QXYModelMapper::setXSection(xColumn);
- emit xColumnChanged();
- }
-}
-
-int QVXYModelMapper::yColumn() const
-{
- return QXYModelMapper::ySection();
-}
-
-void QVXYModelMapper::setYColumn(int yColumn)
-{
- if (yColumn != ySection()) {
- QXYModelMapper::setYSection(yColumn);
- emit yColumnChanged();
- }
-}
-
-int QVXYModelMapper::firstRow() const
-{
- return first();
-}
-
-void QVXYModelMapper::setFirstRow(int firstRow)
-{
- if (firstRow != first()) {
- setFirst(firstRow);
- emit firstRowChanged();
- }
-}
-
-int QVXYModelMapper::rowCount() const
-{
- return count();
-}
-
-void QVXYModelMapper::setRowCount(int rowCount)
-{
- if (rowCount != count()) {
- setCount(rowCount);
- emit rowCountChanged();
- }
-}
-
-#include "moc_qvxymodelmapper.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/xychart/qvxymodelmapper.h b/src/xychart/qvxymodelmapper.h
deleted file mode 100644
index be6b3b8f..00000000
--- a/src/xychart/qvxymodelmapper.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVXYMODELMAPPER_H
-#define QVXYMODELMAPPER_H
-
-#include <QXYModelMapper>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QTCOMMERCIALCHART_EXPORT QVXYModelMapper : public QXYModelMapper
-{
- Q_OBJECT
- Q_PROPERTY(QXYSeries *series READ series WRITE setSeries NOTIFY seriesReplaced)
- Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelReplaced)
- Q_PROPERTY(int xColumn READ xColumn WRITE setXColumn NOTIFY xColumnChanged)
- Q_PROPERTY(int yColumn READ yColumn WRITE setYColumn NOTIFY yColumnChanged)
- Q_PROPERTY(int firstRow READ firstRow WRITE setFirstRow NOTIFY firstRowChanged)
- Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
-
-public:
- explicit QVXYModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QXYSeries *series() const;
- void setSeries(QXYSeries *series);
-
- int xColumn() const;
- void setXColumn(int xColumn);
-
- int yColumn() const;
- void setYColumn(int yColumn);
-
- int firstRow() const;
- void setFirstRow(int firstRow);
-
- int rowCount() const;
- void setRowCount(int rowCount);
-
-Q_SIGNALS:
- void seriesReplaced();
- void modelReplaced();
- void xColumnChanged();
- void yColumnChanged();
- void firstRowChanged();
- void rowCountChanged();
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QVXYMODELMAPPER_H
diff --git a/src/xychart/qxymodelmapper.cpp b/src/xychart/qxymodelmapper.cpp
deleted file mode 100644
index 44cc2370..00000000
--- a/src/xychart/qxymodelmapper.cpp
+++ /dev/null
@@ -1,533 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qxymodelmapper.h"
-#include "qxymodelmapper_p.h"
-#include "qxyseries.h"
-#include <QAbstractItemModel>
-#include <QDateTime>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- Constructs a mapper object which is a child of \a parent.
-*/
-QXYModelMapper::QXYModelMapper(QObject *parent)
- : QObject(parent),
- d_ptr(new QXYModelMapperPrivate(this))
-{
-}
-
-/*!
- \internal
-*/
-QAbstractItemModel *QXYModelMapper::model() const
-{
- Q_D(const QXYModelMapper);
- return d->m_model;
-}
-
-/*!
- \internal
-*/
-void QXYModelMapper::setModel(QAbstractItemModel *model)
-{
- if (model == 0)
- return;
-
- Q_D(QXYModelMapper);
- if (d->m_model)
- disconnect(d->m_model, 0, d, 0);
-
- d->m_model = model;
- d->initializeXYFromModel();
- // connect signals from the model
- connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
- connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), d, SLOT(modelColumnsAdded(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), d, SLOT(modelColumnsRemoved(QModelIndex,int,int)));
- connect(d->m_model, SIGNAL(destroyed()), d, SLOT(handleModelDestroyed()));
-}
-
-/*!
- \internal
-*/
-QXYSeries *QXYModelMapper::series() const
-{
- Q_D(const QXYModelMapper);
- return d->m_series;
-}
-
-/*!
- \internal
-*/
-void QXYModelMapper::setSeries(QXYSeries *series)
-{
- Q_D(QXYModelMapper);
- if (d->m_series)
- disconnect(d->m_series, 0, d, 0);
-
- if (series == 0)
- return;
-
- d->m_series = series;
- d->initializeXYFromModel();
- // connect the signals from the series
- connect(d->m_series, SIGNAL(pointAdded(int)), d, SLOT(handlePointAdded(int)));
- connect(d->m_series, SIGNAL(pointRemoved(int)), d, SLOT(handlePointRemoved(int)));
- connect(d->m_series, SIGNAL(pointReplaced(int)), d, SLOT(handlePointReplaced(int)));
- connect(d->m_series, SIGNAL(destroyed()), d, SLOT(handleSeriesDestroyed()));
-}
-
-/*!
- \internal
-*/
-int QXYModelMapper::first() const
-{
- Q_D(const QXYModelMapper);
- return d->m_first;
-}
-
-/*!
- \internal
-*/
-void QXYModelMapper::setFirst(int first)
-{
- Q_D(QXYModelMapper);
- d->m_first = qMax(first, 0);
- d->initializeXYFromModel();
-}
-
-/*!
- \internal
-*/
-int QXYModelMapper::count() const
-{
- Q_D(const QXYModelMapper);
- return d->m_count;
-}
-
-/*!
- \internal
-*/
-void QXYModelMapper::setCount(int count)
-{
- Q_D(QXYModelMapper);
- d->m_count = qMax(count, -1);
- d->initializeXYFromModel();
-}
-
-/*!
- Returns the orientation that is used when QXYModelMapper accesses the model.
- This mean whether the consecutive x/y values of the QXYSeries are read from rows (Qt::Horizontal)
- or from columns (Qt::Vertical)
-*/
-Qt::Orientation QXYModelMapper::orientation() const
-{
- Q_D(const QXYModelMapper);
- return d->m_orientation;
-}
-
-/*!
- Returns the \a orientation that is used when QXYModelMapper accesses the model.
- This mean whether the consecutive x/y values of the QXYSeries are read from rows (Qt::Horizontal)
- or from columns (Qt::Vertical)
-*/
-void QXYModelMapper::setOrientation(Qt::Orientation orientation)
-{
- Q_D(QXYModelMapper);
- d->m_orientation = orientation;
- d->initializeXYFromModel();
-}
-
-/*!
- Returns which section of the model is kept in sync with the x values of the QXYSeries
-*/
-int QXYModelMapper::xSection() const
-{
- Q_D(const QXYModelMapper);
- return d->m_xSection;
-}
-
-/*!
- Sets the model section that is kept in sync with the x values of the QXYSeries.
- Parameter \a xSection specifies the section of the model.
-*/
-void QXYModelMapper::setXSection(int xSection)
-{
- Q_D(QXYModelMapper);
- d->m_xSection = qMax(-1, xSection);
- d->initializeXYFromModel();
-}
-
-/*!
- Returns which section of the model is kept in sync with the y values of the QXYSeries
-*/
-int QXYModelMapper::ySection() const
-{
- Q_D(const QXYModelMapper);
- return d->m_ySection;
-}
-
-/*!
- Sets the model section that is kept in sync with the y values of the QXYSeries.
- Parameter \a ySection specifies the section of the model.
-*/
-void QXYModelMapper::setYSection(int ySection)
-{
- Q_D(QXYModelMapper);
- d->m_ySection = qMax(-1, ySection);
- d->initializeXYFromModel();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QXYModelMapperPrivate::QXYModelMapperPrivate(QXYModelMapper *q) :
- QObject(q),
- m_series(0),
- m_model(0),
- m_first(0),
- m_count(-1),
- m_orientation(Qt::Vertical),
- m_xSection(-1),
- m_ySection(-1),
- m_seriesSignalsBlock(false),
- m_modelSignalsBlock(false),
- q_ptr(q)
-{
-}
-
-void QXYModelMapperPrivate::blockModelSignals(bool block)
-{
- m_modelSignalsBlock = block;
-}
-
-void QXYModelMapperPrivate::blockSeriesSignals(bool block)
-{
- m_seriesSignalsBlock = block;
-}
-
-QModelIndex QXYModelMapperPrivate::xModelIndex(int xPos)
-{
- if (m_count != -1 && xPos >= m_count)
- return QModelIndex(); // invalid
-
- if (m_orientation == Qt::Vertical)
- return m_model->index(xPos + m_first, m_xSection);
- else
- return m_model->index(m_xSection, xPos + m_first);
-}
-
-QModelIndex QXYModelMapperPrivate::yModelIndex(int yPos)
-{
- if (m_count != -1 && yPos >= m_count)
- return QModelIndex(); // invalid
-
- if (m_orientation == Qt::Vertical)
- return m_model->index(yPos + m_first, m_ySection);
- else
- return m_model->index(m_ySection, yPos + m_first);
-}
-
-qreal QXYModelMapperPrivate::valueFromModel(QModelIndex index)
-{
- QVariant value = m_model->data(index, Qt::DisplayRole);
- switch (value.type()) {
- case QVariant::DateTime:
- return value.toDateTime().toMSecsSinceEpoch();
- case QVariant::Date:
- return QDateTime(value.toDate()).toMSecsSinceEpoch();
- default:
- return value.toReal();
- }
-}
-
-void QXYModelMapperPrivate::setValueToModel(QModelIndex index, qreal value)
-{
- QVariant oldValue = m_model->data(index, Qt::DisplayRole);
- switch (oldValue.type()) {
- case QVariant::DateTime:
- m_model->setData(index, QDateTime::fromMSecsSinceEpoch(value));
- break;
- case QVariant::Date:
- m_model->setData(index, QDateTime::fromMSecsSinceEpoch(value).date());
- break;
- default:
- m_model->setData(index, value);
- }
-}
-
-void QXYModelMapperPrivate::handlePointAdded(int pointPos)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (m_count != -1)
- m_count += 1;
-
- blockModelSignals();
- if (m_orientation == Qt::Vertical)
- m_model->insertRows(pointPos + m_first, 1);
- else
- m_model->insertColumns(pointPos + m_first, 1);
-
- setValueToModel(xModelIndex(pointPos), m_series->points().at(pointPos).x());
- setValueToModel(yModelIndex(pointPos), m_series->points().at(pointPos).y());
- blockModelSignals(false);
-}
-
-void QXYModelMapperPrivate::handlePointRemoved(int pointPos)
-{
- if (m_seriesSignalsBlock)
- return;
-
- if (m_count != -1)
- m_count -= 1;
-
- blockModelSignals();
- if (m_orientation == Qt::Vertical)
- m_model->removeRow(pointPos + m_first);
- else
- m_model->removeColumn(pointPos + m_first);
- blockModelSignals(false);
-}
-
-void QXYModelMapperPrivate::handlePointReplaced(int pointPos)
-{
- if (m_seriesSignalsBlock)
- return;
-
- blockModelSignals();
- setValueToModel(xModelIndex(pointPos), m_series->points().at(pointPos).x());
- setValueToModel(yModelIndex(pointPos), m_series->points().at(pointPos).y());
- blockModelSignals(false);
-}
-
-void QXYModelMapperPrivate::handleSeriesDestroyed()
-{
- m_series = 0;
-}
-
-void QXYModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight)
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- QModelIndex index;
- QPointF oldPoint;
- QPointF newPoint;
- for (int row = topLeft.row(); row <= bottomRight.row(); row++) {
- for (int column = topLeft.column(); column <= bottomRight.column(); column++) {
- index = topLeft.sibling(row, column);
- if (m_orientation == Qt::Vertical && (index.column() == m_xSection || index.column() == m_ySection)) {
- if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) {
- QModelIndex xIndex = xModelIndex(index.row() - m_first);
- QModelIndex yIndex = yModelIndex(index.row() - m_first);
- if (xIndex.isValid() && yIndex.isValid()) {
- oldPoint = m_series->points().at(index.row() - m_first);
- newPoint.setX(valueFromModel(xIndex));
- newPoint.setY(valueFromModel(yIndex));
- }
- }
- } else if (m_orientation == Qt::Horizontal && (index.row() == m_xSection || index.row() == m_ySection)) {
- if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) {
- QModelIndex xIndex = xModelIndex(index.column() - m_first);
- QModelIndex yIndex = yModelIndex(index.column() - m_first);
- if (xIndex.isValid() && yIndex.isValid()) {
- oldPoint = m_series->points().at(index.column() - m_first);
- newPoint.setX(valueFromModel(xIndex));
- newPoint.setY(valueFromModel(yIndex));
- }
- }
- } else {
- continue;
- }
- m_series->replace(oldPoint, newPoint);
- }
- }
- blockSeriesSignals(false);
-}
-
-void QXYModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent);
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Vertical)
- insertData(start, end);
- else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy
- initializeXYFromModel();
- blockSeriesSignals(false);
-}
-
-void QXYModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent);
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Vertical)
- removeData(start, end);
- else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy
- initializeXYFromModel();
- blockSeriesSignals(false);
-}
-
-void QXYModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent);
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Horizontal)
- insertData(start, end);
- else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy
- initializeXYFromModel();
- blockSeriesSignals(false);
-}
-
-void QXYModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
-{
- Q_UNUSED(parent);
- if (m_modelSignalsBlock)
- return;
-
- blockSeriesSignals();
- if (m_orientation == Qt::Horizontal)
- removeData(start, end);
- else if (start <= m_xSection || start <= m_ySection) // if the changes affect the map - reinitialize the xy
- initializeXYFromModel();
- blockSeriesSignals(false);
-}
-
-void QXYModelMapperPrivate::handleModelDestroyed()
-{
- m_model = 0;
-}
-
-void QXYModelMapperPrivate::insertData(int start, int end)
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- if (m_count != -1 && start >= m_first + m_count) {
- return;
- } else {
- int addedCount = end - start + 1;
- if (m_count != -1 && addedCount > m_count)
- addedCount = m_count;
- int first = qMax(start, m_first);
- int last = qMin(first + addedCount - 1, m_orientation == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1);
- for (int i = first; i <= last; i++) {
- QPointF point;
- QModelIndex xIndex = xModelIndex(i - m_first);
- QModelIndex yIndex = yModelIndex(i - m_first);
- if (xIndex.isValid() && yIndex.isValid()) {
- point.setX(valueFromModel(xIndex));
- point.setY(valueFromModel(yIndex));
- m_series->insert(i - m_first, point);
- }
- }
-
- // remove excess of points (above m_count)
- if (m_count != -1 && m_series->points().size() > m_count)
- for (int i = m_series->points().size() - 1; i >= m_count; i--) {
- m_series->remove(m_series->points().at(i));
- }
- }
-}
-
-void QXYModelMapperPrivate::removeData(int start, int end)
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- int removedCount = end - start + 1;
- if (m_count != -1 && start >= m_first + m_count) {
- return;
- } else {
- int toRemove = qMin(m_series->count(), removedCount); // first find how many items can actually be removed
- int first = qMax(start, m_first); // get the index of the first item that will be removed.
- int last = qMin(first + toRemove - 1, m_series->count() + m_first - 1); // get the index of the last item that will be removed.
- for (int i = last; i >= first; i--) {
- m_series->remove(m_series->points().at(i - m_first));
- }
-
- if (m_count != -1) {
- int itemsAvailable; // check how many are available to be added
- if (m_orientation == Qt::Vertical)
- itemsAvailable = m_model->rowCount() - m_first - m_series->count();
- else
- itemsAvailable = m_model->columnCount() - m_first - m_series->count();
- int toBeAdded = qMin(itemsAvailable, m_count - m_series->count()); // add not more items than there is space left to be filled.
- int currentSize = m_series->count();
- if (toBeAdded > 0)
- for (int i = m_series->count(); i < currentSize + toBeAdded; i++) {
- QPointF point;
- QModelIndex xIndex = xModelIndex(i);
- QModelIndex yIndex = yModelIndex(i);
- if (xIndex.isValid() && yIndex.isValid()) {
- point.setX(valueFromModel(xIndex));
- point.setY(valueFromModel(yIndex));
- m_series->insert(i, point);
- }
- }
- }
- }
-}
-
-void QXYModelMapperPrivate::initializeXYFromModel()
-{
- if (m_model == 0 || m_series == 0)
- return;
-
- blockSeriesSignals();
- // clear current content
- m_series->clear();
-
- // create the initial points set
- int pointPos = 0;
- QModelIndex xIndex = xModelIndex(pointPos);
- QModelIndex yIndex = yModelIndex(pointPos);
- while (xIndex.isValid() && yIndex.isValid()) {
- QPointF point;
- point.setX(valueFromModel(xIndex));
- point.setY(valueFromModel(yIndex));
- m_series->append(point);
- pointPos++;
- xIndex = xModelIndex(pointPos);
- yIndex = yModelIndex(pointPos);
- }
- blockSeriesSignals(false);
-}
-
-#include "moc_qxymodelmapper.cpp"
-#include "moc_qxymodelmapper_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/xychart/qxymodelmapper.h b/src/xychart/qxymodelmapper.h
deleted file mode 100644
index 3c98aa0c..00000000
--- a/src/xychart/qxymodelmapper.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QXYMODELMAPPER_H
-#define QXYMODELMAPPER_H
-
-#include "qchartglobal.h"
-#include <QObject>
-
-class QAbstractItemModel;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QXYModelMapperPrivate;
-class QXYSeries;
-
-class QTCOMMERCIALCHART_EXPORT QXYModelMapper : public QObject
-{
- Q_OBJECT
-
-protected:
- explicit QXYModelMapper(QObject *parent = 0);
-
- QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
-
- QXYSeries *series() const;
- void setSeries(QXYSeries *series);
-
- int first() const;
- void setFirst(int first);
-
- int count() const;
- void setCount(int count);
-
- Qt::Orientation orientation() const;
- void setOrientation(Qt::Orientation orientation);
-
- int xSection() const;
- void setXSection(int xSection);
-
- int ySection() const;
- void setYSection(int ySection);
-
-protected:
- QXYModelMapperPrivate *const d_ptr;
- Q_DECLARE_PRIVATE(QXYModelMapper)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QXYMODELMAPPER_H
diff --git a/src/xychart/qxymodelmapper_p.h b/src/xychart/qxymodelmapper_p.h
deleted file mode 100644
index 363d848f..00000000
--- a/src/xychart/qxymodelmapper_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QXYMODELMAPPER_P_H
-#define QXYMODELMAPPER_P_H
-
-#include "qxymodelmapper.h"
-#include <QObject>
-
-class QModelIndex;
-class QAbstractItemModel;
-class QPointF;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QXYModelMapper;
-class QXYSeries;
-
-class QXYModelMapperPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QXYModelMapperPrivate(QXYModelMapper *q);
-
-public Q_SLOTS:
- // for the model
- void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight);
- void modelRowsAdded(QModelIndex parent, int start, int end);
- void modelRowsRemoved(QModelIndex parent, int start, int end);
- void modelColumnsAdded(QModelIndex parent, int start, int end);
- void modelColumnsRemoved(QModelIndex parent, int start, int end);
- void handleModelDestroyed();
-
- // for the series
- void handlePointAdded(int pointPos);
- void handlePointRemoved(int pointPos);
- void handlePointReplaced(int pointPos);
- void handleSeriesDestroyed();
-
- void initializeXYFromModel();
-
-private:
- QModelIndex xModelIndex(int xPos);
- QModelIndex yModelIndex(int yPos);
- void insertData(int start, int end);
- void removeData(int start, int end);
- void blockModelSignals(bool block = true);
- void blockSeriesSignals(bool block = true);
- qreal valueFromModel(QModelIndex index);
- void setValueToModel(QModelIndex index, qreal value);
-
-private:
- QXYSeries *m_series;
- QAbstractItemModel *m_model;
- int m_first;
- int m_count;
- Qt::Orientation m_orientation;
- int m_xSection;
- int m_ySection;
- bool m_seriesSignalsBlock;
- bool m_modelSignalsBlock;
-
-private:
- QXYModelMapper *q_ptr;
- Q_DECLARE_PUBLIC(QXYModelMapper)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QXYMODELMAPPER_P_H
diff --git a/src/xychart/qxyseries.cpp b/src/xychart/qxyseries.cpp
deleted file mode 100644
index b573d7a0..00000000
--- a/src/xychart/qxyseries.cpp
+++ /dev/null
@@ -1,804 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qxyseries.h"
-#include "qxyseries_p.h"
-#include "abstractdomain_p.h"
-#include "qvalueaxis.h"
-#include "xychart_p.h"
-#include "qxylegendmarker.h"
-#include "charthelpers_p.h"
-#include "qchart_p.h"
-#include <QPainter>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-/*!
- \class QXYSeries
- \inmodule Qt Charts
- \brief The QXYSeries class is a base class for line, spline and scatter series.
-*/
-#ifdef QDOC_QT5
-/*!
- \qmltype XYSeries
- \instantiates QXYSeries
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/xyseries.qdocinc
-*/
-#else
-/*!
- \qmlclass XYSeries QXYSeries
-
- \include ../doc/src/xyseries.qdocinc
-*/
-#endif
-
-/*!
- \qmlproperty AbstractAxis XYSeries::axisX
- The x axis used for the series. If you leave both axisX and axisXTop undefined, a ValueAxis is created for
- the series.
- \sa axisXTop
-*/
-
-/*!
- \qmlproperty AbstractAxis XYSeries::axisY
- The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
- the series.
- \sa axisYRight
-*/
-
-/*!
- \qmlproperty AbstractAxis XYSeries::axisXTop
- The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
- axisXTop, but not both.
- \sa axisX
-*/
-
-/*!
- \qmlproperty AbstractAxis XYSeries::axisYRight
- The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
- or axisYRight, but not both.
- \sa axisY
-*/
-
-/*!
- \qmlproperty AbstractAxis XYSeries::axisAngular
- The angular axis used for the series, drawn around the polar chart view.
- \sa axisX
-*/
-
-/*!
- \qmlproperty AbstractAxis XYSeries::axisRadial
- The radial axis used for the series, drawn inside the polar chart view.
- \sa axisY
-*/
-
-/*!
- \property QXYSeries::pointsVisible
- Controls if the data points are visible and should be drawn.
-*/
-/*!
- \qmlproperty bool XYSeries::pointsVisible
- Controls if the data points are visible and should be drawn.
-*/
-
-/*!
- \fn QPen QXYSeries::pen() const
- \brief Returns pen used to draw points for series.
- \sa setPen()
-*/
-
-/*!
- \fn QBrush QXYSeries::brush() const
- \brief Returns brush used to draw points for series.
- \sa setBrush()
-*/
-
-/*!
- \property QXYSeries::color
- The color of the series. This is line (pen) color in case of QLineSeries or QSplineSeries and
- fill (brush) color in case of QScatterSeries or QAreaSeries.
- \sa QXYSeries::pen(), QXYSeries::brush()
-*/
-/*!
- \qmlproperty color XYSeries::color
- The color of the series. This is line (pen) color in case of LineSeries or SplineSeries and
- fill (brush) color in case of ScatterSeries or AreaSeries.
-*/
-
-/*!
- \property QXYSeries::pointLabelsFormat
- The \a format used for showing labels with series points.
-
- QXYSeries supports the following format tags:
- \table
- \row
- \li @xPoint \li The x value of the data point
- \row
- \li @yPoint \li The y value of the data point
- \endtable
-
- For example, the following usage of the format tags would produce labels that have the data
- point (x, y) shown inside brackets separated by a comma:
- \code
- series->setPointLabelsFormat("(@xPoint, @yPoint)");
- \endcode
-
- By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot
- area, labels on the edge of the plot area are cut. If the points are close to each other the
- labels may overlap.
-
- \sa QXYSeries::pointLabelsVisible, QXYSeries::pointLabelsFont, QXYSeries::pointLabelsColor
-*/
-/*!
- \qmlproperty string XYSeries::pointLabelsFormat
- The \a format used for showing labels with series points.
-
- \sa QXYSeries::pointLabelsFormat, pointLabelsVisible, pointLabelsFont, pointLabelsColor
-*/
-/*!
- \fn void QXYSeries::pointLabelsFormatChanged(const QString &format)
- Signal is emitted when the \a format of data point labels is changed.
-*/
-/*!
- \qmlsignal XYSeries::onPointLabelsFormatChanged(string format)
- Signal is emitted when the \a format of data point labels is changed.
-*/
-
-/*!
- \property QXYSeries::pointLabelsVisible
- Defines the visibility for data point labels. False by default.
-
- \sa QXYSeries::pointLabelsFormat
-*/
-/*!
- \qmlproperty bool XYSeries::pointLabelsVisible
- Defines the visibility for data point labels.
-
- \sa pointLabelsFormat
-*/
-/*!
- \fn void QXYSeries::pointLabelsVisibilityChanged(bool visible)
- The visibility of the data point labels is changed to \a visible.
-*/
-/*!
- \qmlsignal XYSeries::onPointLabelsVisibilityChanged(bool visible)
- The visibility of the data point labels is changed to \a visible.
-*/
-
-/*!
- \property QXYSeries::pointLabelsFont
- Defines the font used for data point labels.
-
- \sa QXYSeries::pointLabelsFormat
-*/
-/*!
- \qmlproperty font XYSeries::pointLabelsFont
- Defines the font used for data point labels.
-
- \sa pointLabelsFormat
-*/
-/*!
- \fn void QXYSeries::pointLabelsFontChanged(const QFont &font);
- The font used for data point labels is changed to \a font.
-*/
-/*!
- \qmlsignal XYSeries::onPointLabelsFontChanged(Font font)
- The font used for data point labels is changed to \a font.
-*/
-
-/*!
- \property QXYSeries::pointLabelsColor
- Defines the color used for data point labels. By default, the color is the color of the brush
- defined in theme for labels.
-
- \sa QXYSeries::pointLabelsFormat
-*/
-/*!
- \qmlproperty font XYSeries::pointLabelsColor
- Defines the color used for data point labels. By default, the color is the color of the brush
- defined in theme for labels.
-
- \sa pointLabelsFormat
-*/
-/*!
- \fn void QXYSeries::pointLabelsColorChanged(const QColor &color);
- The color used for data point labels is changed to \a color.
-*/
-/*!
- \qmlsignal XYSeries::onPointLabelsColorChanged(Color color)
- The color used for data point labels is changed to \a color.
-*/
-
-/*!
- \fn void QXYSeries::clicked(const QPointF& point)
- \brief Signal is emitted when user clicks the \a point on chart.
-*/
-/*!
- \qmlsignal XYSeries::onClicked(QPointF point)
- Signal is emitted when user clicks the \a point on chart. For example:
- \code
- LineSeries {
- XYPoint { x: 0; y: 0 }
- XYPoint { x: 1.1; y: 2.1 }
- onClicked: console.log("onClicked: " + point.x + ", " + point.y);
- }
- \endcode
-*/
-
-/*!
- \fn void QXYSeries::hovered(const QPointF &point, bool state)
- This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
- of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
- the series.
-*/
-/*!
- \qmlsignal XYSeries::onHovered(point point, bool state)
- This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
- of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
- the series.
-*/
-
-/*!
- \fn void QXYSeries::pointReplaced(int index)
- Signal is emitted when a point has been replaced at \a index.
- \sa replace()
-*/
-/*!
- \qmlsignal XYSeries::onPointReplaced(int index)
- Signal is emitted when a point has been replaced at \a index.
-*/
-
-/*!
- \fn void QXYSeries::pointsReplaced()
- Signal is emitted when all points have been replaced with other points.
- \sa replace()
-*/
-/*!
- \qmlsignal XYSeries::onPointsReplaced()
-*/
-
-/*!
- \fn void QXYSeries::pointAdded(int index)
- Signal is emitted when a point has been added at \a index.
- \sa append(), insert()
-*/
-/*!
- \qmlsignal XYSeries::onPointAdded(int index)
- Signal is emitted when a point has been added at \a index.
-*/
-
-/*!
- \fn void QXYSeries::pointRemoved(int index)
- Signal is emitted when a point has been removed from \a index.
- \sa remove()
-*/
-/*!
- \qmlsignal XYSeries::onPointRemoved(int index)
- Signal is emitted when a point has been removed from \a index.
-*/
-
-/*!
- \fn void QXYSeries::colorChanged(QColor color)
- \brief Signal is emitted when the line (pen) color has changed to \a color.
-*/
-/*!
- \qmlsignal XYSeries::onColorChanged(color color)
- Signal is emitted when the line (pen) color has changed to \a color.
-*/
-
-/*!
- \fn void QXYSeriesPrivate::updated()
- \brief \internal
-*/
-
-/*!
- \qmlmethod XYSeries::append(real x, real y)
- Append point (\a x, \a y) to the series
-*/
-
-/*!
- \qmlmethod XYSeries::replace(real oldX, real oldY, real newX, real newY)
- Replaces point (\a oldX, \a oldY) with point (\a newX, \a newY). Does nothing, if point (oldX, oldY) does not
- exist.
-*/
-
-/*!
- \qmlmethod XYSeries::remove(real x, real y)
- Removes point (\a x, \a y) from the series. Does nothing, if point (x, y) does not exist.
-*/
-
-/*!
- \qmlmethod XYSeries::insert(int index, real x, real y)
- Inserts point (\a x, \a y) to the \a index. If index is 0 or smaller than 0 the point is prepended to the list of
- points. If index is the same as or bigger than count, the point is appended to the list of points.
-*/
-
-/*!
- \qmlmethod QPointF XYSeries::at(int index)
- Returns point at \a index. Returns (0, 0) if the index is not valid.
-*/
-
-/*!
- \internal
-
- Constructs empty series object which is a child of \a parent.
- When series object is added to QChart instance ownerships is transferred.
-*/
-QXYSeries::QXYSeries(QXYSeriesPrivate &d, QObject *parent)
- : QAbstractSeries(d, parent)
-{
-}
-
-/*!
- Destroys the object. Series added to QChart instances are owned by those,
- and are destroyed when QChart instances are destroyed.
-*/
-QXYSeries::~QXYSeries()
-{
-}
-
-/*!
- Adds data point (\a x, \a y) to the series.
- */
-void QXYSeries::append(qreal x, qreal y)
-{
- append(QPointF(x, y));
-}
-
-/*!
- This is an overloaded function.
- Adds data \a point to the series.
- */
-void QXYSeries::append(const QPointF &point)
-{
- Q_D(QXYSeries);
-
- if (isValidValue(point)) {
- d->m_points << point;
- emit pointAdded(d->m_points.count() - 1);
- }
-}
-
-/*!
- This is an overloaded function.
- Adds list of data \a points to the series.
- */
-void QXYSeries::append(const QList<QPointF> &points)
-{
- foreach (const QPointF &point , points)
- append(point);
-}
-
-/*!
- Replaces data point (\a oldX, \a oldY) with data point (\a newX, \a newY).
- \sa QXYSeries::pointReplaced()
-*/
-void QXYSeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
-{
- replace(QPointF(oldX, oldY), QPointF(newX, newY));
-}
-
-/*!
- Replaces \a oldPoint with \a newPoint.
- \sa QXYSeries::pointReplaced()
-*/
-void QXYSeries::replace(const QPointF &oldPoint, const QPointF &newPoint)
-{
- Q_D(QXYSeries);
- int index = d->m_points.indexOf(oldPoint);
- if (index == -1)
- return;
- replace(index, newPoint);
-}
-
-/*!
- Replaces the point at \a index with data point (\a newX, \a newY).
- \sa QXYSeries::pointReplaced()
-*/
-void QXYSeries::replace(int index, qreal newX, qreal newY)
-{
- replace(index, QPointF(newX, newY));
-}
-
-/*!
- Replaces the point at \a index with \a newPoint.
- \sa QXYSeries::pointReplaced()
-*/
-void QXYSeries::replace(int index, const QPointF &newPoint)
-{
- Q_D(QXYSeries);
- if (isValidValue(newPoint)) {
- d->m_points[index] = newPoint;
- emit pointReplaced(index);
- }
-}
-
-/*!
- Replaces the current points with \a points.
- \note This is much faster than replacing data points one by one,
- or first clearing all data, and then appending the new data. Emits QXYSeries::pointsReplaced()
- when the points have been replaced.
- \sa QXYSeries::pointsReplaced()
-*/
-void QXYSeries::replace(QList<QPointF> points)
-{
- Q_D(QXYSeries);
- d->m_points = points.toVector();
- emit pointsReplaced();
-}
-
-/*!
- Removes the point (\a x, \a y) from the series.
-*/
-void QXYSeries::remove(qreal x, qreal y)
-{
- remove(QPointF(x, y));
-}
-
-/*!
- Removes the \a point from the series.
-*/
-void QXYSeries::remove(const QPointF &point)
-{
- Q_D(QXYSeries);
- int index = d->m_points.indexOf(point);
- if (index == -1)
- return;
- remove(index);
-}
-
-/*!
- Removes the point at \a index from the series.
-*/
-void QXYSeries::remove(int index)
-{
- Q_D(QXYSeries);
- d->m_points.remove(index);
- emit pointRemoved(index);
-}
-
-/*!
- Inserts a \a point in the series at \a index position.
-*/
-void QXYSeries::insert(int index, const QPointF &point)
-{
- Q_D(QXYSeries);
- if (isValidValue(point)) {
- d->m_points.insert(index, point);
- emit pointAdded(index);
- }
-}
-
-/*!
- Removes all points from the series.
-*/
-void QXYSeries::clear()
-{
- Q_D(QXYSeries);
- for (int i = d->m_points.size() - 1; i >= 0; i--)
- remove(d->m_points.at(i));
-}
-
-/*!
- Returns list of points in the series.
-*/
-QList<QPointF> QXYSeries::points() const
-{
- Q_D(const QXYSeries);
- return d->m_points.toList();
-}
-
-/*!
- Returns point at \a index in internal points vector.
-*/
-const QPointF &QXYSeries::at(int index) const
-{
- Q_D(const QXYSeries);
- return d->m_points.at(index);
-}
-
-/*!
- Returns number of data points within series.
-*/
-int QXYSeries::count() const
-{
- Q_D(const QXYSeries);
- return d->m_points.count();
-}
-
-
-/*!
- Sets \a pen used for drawing points on the chart. If the pen is not defined, the
- pen from chart theme is used.
- \sa QChart::setTheme()
-*/
-void QXYSeries::setPen(const QPen &pen)
-{
- Q_D(QXYSeries);
- if (d->m_pen != pen) {
- bool emitColorChanged = d->m_pen.color() != pen.color();
- d->m_pen = pen;
- emit d->updated();
- if (emitColorChanged)
- emit colorChanged(pen.color());
- }
-}
-
-QPen QXYSeries::pen() const
-{
- Q_D(const QXYSeries);
- if (d->m_pen == QChartPrivate::defaultPen())
- return QPen();
- else
- return d->m_pen;
-}
-
-/*!
- Sets \a brush used for drawing points on the chart. If the brush is not defined, brush
- from chart theme setting is used.
- \sa QChart::setTheme()
-*/
-void QXYSeries::setBrush(const QBrush &brush)
-{
- Q_D(QXYSeries);
- if (d->m_brush != brush) {
- d->m_brush = brush;
- emit d->updated();
- }
-}
-
-QBrush QXYSeries::brush() const
-{
- Q_D(const QXYSeries);
- if (d->m_brush == QChartPrivate::defaultBrush())
- return QBrush();
- else
- return d->m_brush;
-}
-
-void QXYSeries::setColor(const QColor &color)
-{
- QPen p = pen();
- if (p.color() != color) {
- p.setColor(color);
- setPen(p);
- }
-}
-
-QColor QXYSeries::color() const
-{
- return pen().color();
-}
-
-void QXYSeries::setPointsVisible(bool visible)
-{
- Q_D(QXYSeries);
- if (d->m_pointsVisible != visible) {
- d->m_pointsVisible = visible;
- emit d->updated();
- }
-}
-
-bool QXYSeries::pointsVisible() const
-{
- Q_D(const QXYSeries);
- return d->m_pointsVisible;
-}
-
-void QXYSeries::setPointLabelsFormat(const QString &format)
-{
- Q_D(QXYSeries);
- if (d->m_pointLabelsFormat != format) {
- d->m_pointLabelsFormat = format;
- emit pointLabelsFormatChanged(format);
- }
-}
-
-QString QXYSeries::pointLabelsFormat() const
-{
- Q_D(const QXYSeries);
- return d->m_pointLabelsFormat;
-}
-
-void QXYSeries::setPointLabelsVisible(bool visible)
-{
- Q_D(QXYSeries);
- if (d->m_pointLabelsVisible != visible) {
- d->m_pointLabelsVisible = visible;
- emit pointLabelsVisibilityChanged(visible);
- }
-}
-
-bool QXYSeries::pointLabelsVisible() const
-{
- Q_D(const QXYSeries);
- return d->m_pointLabelsVisible;
-}
-
-void QXYSeries::setPointLabelsFont(const QFont &font)
-{
- Q_D(QXYSeries);
- if (d->m_pointLabelsFont != font) {
- d->m_pointLabelsFont = font;
- emit pointLabelsFontChanged(font);
- }
-}
-
-QFont QXYSeries::pointLabelsFont() const
-{
- Q_D(const QXYSeries);
- return d->m_pointLabelsFont;
-}
-
-void QXYSeries::setPointLabelsColor(const QColor &color)
-{
- Q_D(QXYSeries);
- if (d->m_pointLabelsColor != color) {
- d->m_pointLabelsColor = color;
- emit pointLabelsColorChanged(color);
- }
-}
-
-QColor QXYSeries::pointLabelsColor() const
-{
- Q_D(const QXYSeries);
- if (d->m_pointLabelsColor == QChartPrivate::defaultPen().color())
- return QPen().color();
- else
- return d->m_pointLabelsColor;
-}
-
-/*!
- Stream operator for adding a data \a point to the series.
- \sa append()
-*/
-QXYSeries &QXYSeries::operator<< (const QPointF &point)
-{
- append(point);
- return *this;
-}
-
-
-/*!
- Stream operator for adding a list of \a points to the series.
- \sa append()
-*/
-
-QXYSeries &QXYSeries::operator<< (const QList<QPointF>& points)
-{
- append(points);
- return *this;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q)
- : QAbstractSeriesPrivate(q),
- m_pen(QChartPrivate::defaultPen()),
- m_brush(QChartPrivate::defaultBrush()),
- m_pointsVisible(false),
- m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")),
- m_pointLabelsVisible(false),
- m_pointLabelsFont(QChartPrivate::defaultFont()),
- m_pointLabelsColor(QChartPrivate::defaultPen().color())
-{
-}
-
-void QXYSeriesPrivate::initializeDomain()
-{
- qreal minX(0);
- qreal minY(0);
- qreal maxX(1);
- qreal maxY(1);
-
- Q_Q(QXYSeries);
-
- const QList<QPointF>& points = q->points();
-
- if (!points.isEmpty()) {
- minX = points[0].x();
- minY = points[0].y();
- maxX = minX;
- maxY = minY;
-
- for (int i = 0; i < points.count(); i++) {
- qreal x = points[i].x();
- qreal y = points[i].y();
- minX = qMin(minX, x);
- minY = qMin(minY, y);
- maxX = qMax(maxX, x);
- maxY = qMax(maxY, y);
- }
- }
-
- domain()->setRange(minX, maxX, minY, maxY);
-}
-
-QList<QLegendMarker*> QXYSeriesPrivate::createLegendMarkers(QLegend* legend)
-{
- Q_Q(QXYSeries);
- QList<QLegendMarker*> list;
- return list << new QXYLegendMarker(q,legend);
-}
-
-void QXYSeriesPrivate::initializeAxes()
-{
-
-}
-
-QAbstractAxis::AxisType QXYSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
-{
- Q_UNUSED(orientation);
- return QAbstractAxis::AxisTypeValue;
-}
-
-QAbstractAxis* QXYSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
-{
- Q_UNUSED(orientation);
- return new QValueAxis;
-}
-
-void QXYSeriesPrivate::initializeAnimations(QtCommercialChart::QChart::AnimationOptions options)
-{
- XYChart *item = static_cast<XYChart *>(m_item.data());
- Q_ASSERT(item);
- if (item->animation())
- item->animation()->stopAndDestroyLater();
-
- if (options.testFlag(QChart::SeriesAnimations))
- item->setAnimation(new XYAnimation(item));
- else
- item->setAnimation(0);
- QAbstractSeriesPrivate::initializeAnimations(options);
-}
-
-void QXYSeriesPrivate::drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points,
- const int offset)
-{
- static const QString xPointTag(QLatin1String("@xPoint"));
- static const QString yPointTag(QLatin1String("@yPoint"));
- const int labelOffset = offset + 2;
-
- painter->setFont(m_pointLabelsFont);
- painter->setPen(QPen(m_pointLabelsColor));
- QFontMetrics fm(painter->font());
-
- for (int i(0); i < m_points.size(); i++) {
- QString pointLabel = m_pointLabelsFormat;
- pointLabel.replace(xPointTag, presenter()->numberToString(m_points.at(i).x()));
- pointLabel.replace(yPointTag, presenter()->numberToString(m_points.at(i).y()));
-
- // Position text in relation to the point
- int pointLabelWidth = fm.width(pointLabel);
- QPointF position(points.at(i));
- position.setX(position.x() - pointLabelWidth / 2);
- position.setY(position.y() - labelOffset);
-
- painter->drawText(position, pointLabel);
- }
-}
-
-#include "moc_qxyseries.cpp"
-#include "moc_qxyseries_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/xychart/qxyseries.h b/src/xychart/qxyseries.h
deleted file mode 100644
index 02c08eb0..00000000
--- a/src/xychart/qxyseries.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QXYSERIES_H
-#define QXYSERIES_H
-
-#include <qchartglobal.h>
-#include <qabstractseries.h>
-#include <QPen>
-#include <QBrush>
-
-class QModelIndex;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QXYSeriesPrivate;
-class QXYModelMapper;
-
-class QTCOMMERCIALCHART_EXPORT QXYSeries : public QAbstractSeries
-{
- Q_OBJECT
- Q_PROPERTY(bool pointsVisible READ pointsVisible WRITE setPointsVisible)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(QString pointLabelsFormat READ pointLabelsFormat WRITE setPointLabelsFormat NOTIFY pointLabelsFormatChanged)
- Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged)
- Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged)
- Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged)
-
-protected:
- explicit QXYSeries(QXYSeriesPrivate &d, QObject *parent = 0);
-
-public:
- ~QXYSeries();
- void append(qreal x, qreal y);
- void append(const QPointF &point);
- void append(const QList<QPointF> &points);
- void replace(qreal oldX, qreal oldY, qreal newX, qreal newY);
- void replace(const QPointF &oldPoint, const QPointF &newPoint);
- void replace(int index, qreal newX, qreal newY);
- void replace(int index, const QPointF &newPoint);
- void remove(qreal x, qreal y);
- void remove(const QPointF &point);
- void remove(int index);
- void insert(int index, const QPointF &point);
- void clear();
-
- int count() const;
- QList<QPointF> points() const;
- const QPointF &at(int index) const;
-
- QXYSeries &operator << (const QPointF &point);
- QXYSeries &operator << (const QList<QPointF> &points);
-
- virtual void setPen(const QPen &pen);
- QPen pen() const;
-
- virtual void setBrush(const QBrush &brush);
- QBrush brush() const;
-
- virtual void setColor(const QColor &color);
- virtual QColor color() const;
-
- void setPointsVisible(bool visible = true);
- bool pointsVisible() const;
-
- void setPointLabelsFormat(const QString &format);
- QString pointLabelsFormat() const;
-
- void setPointLabelsVisible(bool visible = true);
- bool pointLabelsVisible() const;
-
- void setPointLabelsFont(const QFont &font);
- QFont pointLabelsFont() const;
-
- void setPointLabelsColor(const QColor &color);
- QColor pointLabelsColor() const;
-
- void replace(QList<QPointF> points);
-
-Q_SIGNALS:
- void clicked(const QPointF &point);
- void hovered(const QPointF &point, bool state);
- void pointReplaced(int index);
- void pointRemoved(int index);
- void pointAdded(int index);
- void colorChanged(QColor color);
- void pointsReplaced();
- void pointLabelsFormatChanged(const QString &format);
- void pointLabelsVisibilityChanged(bool visible);
- void pointLabelsFontChanged(const QFont &font);
- void pointLabelsColorChanged(const QColor &color);
-
-private:
- Q_DECLARE_PRIVATE(QXYSeries)
- Q_DISABLE_COPY(QXYSeries)
- friend class QXYLegendMarkerPrivate;
- friend class XYLegendMarker;
- friend class XYChart;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QXYSERIES_H
diff --git a/src/xychart/qxyseries_p.h b/src/xychart/qxyseries_p.h
deleted file mode 100644
index 996f0f0d..00000000
--- a/src/xychart/qxyseries_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QXYSERIES_P_H
-#define QXYSERIES_P_H
-
-#include "qabstractseries_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QXYSeries;
-class QAbstractAxis;
-
-class QXYSeriesPrivate: public QAbstractSeriesPrivate
-{
- Q_OBJECT
-
-public:
- QXYSeriesPrivate(QXYSeries *q);
-
- void initializeDomain();
- void initializeAxes();
- void initializeAnimations(QtCommercialChart::QChart::AnimationOptions options);
-
- QList<QLegendMarker*> createLegendMarkers(QLegend* legend);
-
- QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
- QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const;
-
- void drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points,
- const int offset = 0);
-
-Q_SIGNALS:
- void updated();
-
-protected:
- QVector<QPointF> m_points;
- QPen m_pen;
- QBrush m_brush;
- bool m_pointsVisible;
- QString m_pointLabelsFormat;
- bool m_pointLabelsVisible;
- QFont m_pointLabelsFont;
- QColor m_pointLabelsColor;
-
-private:
- Q_DECLARE_PUBLIC(QXYSeries)
- friend class QScatterSeries;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/src/xychart/xychart.cpp b/src/xychart/xychart.cpp
deleted file mode 100644
index 85247ff9..00000000
--- a/src/xychart/xychart.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2014 Digia Plc
- ** All rights reserved.
- ** For any questions to Digia, please use contact form at http://qt.digia.com
- **
- ** This file is part of the Qt Enterprise Charts Add-on.
- **
- ** $QT_BEGIN_LICENSE$
- ** Licensees holding valid Qt Enterprise licenses may use this file in
- ** accordance with the Qt Enterprise License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.
- **
- ** If you have questions regarding the use of this file, please use
- ** contact form at http://qt.digia.com
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "xychart_p.h"
-#include "qxyseries.h"
-#include "qxyseries_p.h"
-#include "chartpresenter_p.h"
-#include "abstractdomain_p.h"
-#include "qxymodelmapper.h"
-#include "qabstractaxis_p.h"
-#include <QPainter>
-#include <QAbstractItemModel>
-
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-XYChart::XYChart(QXYSeries *series, QGraphicsItem *item):
- ChartItem(series->d_func(),item),
- m_series(series),
- m_animation(0),
- m_dirty(true)
-{
- QObject::connect(series, SIGNAL(pointReplaced(int)), this, SLOT(handlePointReplaced(int)));
- QObject::connect(series, SIGNAL(pointsReplaced()), this, SLOT(handlePointsReplaced()));
- QObject::connect(series, SIGNAL(pointAdded(int)), this, SLOT(handlePointAdded(int)));
- QObject::connect(series, SIGNAL(pointRemoved(int)), this, SLOT(handlePointRemoved(int)));
- QObject::connect(this, SIGNAL(clicked(QPointF)), series, SIGNAL(clicked(QPointF)));
- QObject::connect(this, SIGNAL(hovered(QPointF,bool)), series, SIGNAL(hovered(QPointF,bool)));
-}
-
-void XYChart::setGeometryPoints(const QVector<QPointF> &points)
-{
- m_points = points;
-}
-
-void XYChart::setAnimation(XYAnimation *animation)
-{
- m_animation = animation;
-}
-
-void XYChart::setDirty(bool dirty)
-{
- m_dirty = dirty;
-}
-
-// Returns a vector with same size as geometryPoints vector, indicating
-// the off grid status of points.
-QVector<bool> XYChart::offGridStatusVector()
-{
- qreal minX = domain()->minX();
- qreal maxX = domain()->maxX();
- qreal minY = domain()->minY();
- qreal maxY = domain()->maxY();
-
- QVector<bool> returnVector;
- returnVector.resize(m_points.size());
- // During remove animation series may have different number of points,
- // so ensure we don't go over the index. No need to check for zero points, this
- // will not be called in such a situation.
- const int seriesLastIndex = m_series->count() - 1;
-
- for (int i = 0; i < m_points.size(); i++) {
- const QPointF &seriesPoint = m_series->at(qMin(seriesLastIndex, i));
- if (seriesPoint.x() < minX
- || seriesPoint.x() > maxX
- || seriesPoint.y() < minY
- || seriesPoint.y() > maxY) {
- returnVector[i] = true;
- } else {
- returnVector[i] = false;
- }
- }
- return returnVector;
-}
-
-void XYChart::updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index)
-{
-
- if (m_animation) {
- m_animation->setup(oldPoints, newPoints, index);
- m_points = newPoints;
- setDirty(false);
- presenter()->startAnimation(m_animation);
- } else {
- m_points = newPoints;
- updateGeometry();
- }
-}
-
-//handlers
-
-void XYChart::handlePointAdded(int index)
-{
- Q_ASSERT(index < m_series->count());
- Q_ASSERT(index >= 0);
-
- QVector<QPointF> points;
-
- if (m_dirty || m_points.isEmpty()) {
- points = domain()->calculateGeometryPoints(m_series->points());
- } else {
- points = m_points;
- QPointF point = domain()->calculateGeometryPoint(m_series->points()[index], m_validData);
- if (!m_validData)
- m_points.clear();
- else
- points.insert(index, point);
- }
-
- updateChart(m_points, points, index);
-}
-
-void XYChart::handlePointRemoved(int index)
-{
- Q_ASSERT(index <= m_series->count());
- Q_ASSERT(index >= 0);
-
- QVector<QPointF> points;
-
- if (m_dirty || m_points.isEmpty()) {
- points = domain()->calculateGeometryPoints(m_series->points());
- } else {
- points = m_points;
- points.remove(index);
- }
-
- updateChart(m_points, points, index);
-}
-
-void XYChart::handlePointReplaced(int index)
-{
- Q_ASSERT(index < m_series->count());
- Q_ASSERT(index >= 0);
-
- QVector<QPointF> points;
-
- if (m_dirty || m_points.isEmpty()) {
- points = domain()->calculateGeometryPoints(m_series->points());
- } else {
- QPointF point = domain()->calculateGeometryPoint(m_series->points()[index], m_validData);
- if (!m_validData)
- m_points.clear();
- points = m_points;
- if (m_validData)
- points.replace(index, point);
- }
-
- updateChart(m_points, points, index);
-}
-
-void XYChart::handlePointsReplaced()
-{
- // All the points were replaced -> recalculate
- QVector<QPointF> points = domain()->calculateGeometryPoints(m_series->points());
- updateChart(m_points, points, -1);
-}
-
-void XYChart::handleDomainUpdated()
-{
- if (isEmpty()) return;
- QVector<QPointF> points = domain()->calculateGeometryPoints(m_series->points());
- updateChart(m_points, points);
-}
-
-bool XYChart::isEmpty()
-{
- return domain()->isEmpty() || m_series->points().isEmpty();
-}
-
-#include "moc_xychart_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/xychart/xychart.pri b/src/xychart/xychart.pri
deleted file mode 100644
index d43fc8d0..00000000
--- a/src/xychart/xychart.pri
+++ /dev/null
@@ -1,21 +0,0 @@
-INCLUDEPATH += $$PWD
-DEPENDPATH += $$PWD
-
-SOURCES += \
- $$PWD/xychart.cpp \
- $$PWD/qxyseries.cpp \
- $$PWD/qxymodelmapper.cpp \
- $$PWD/qvxymodelmapper.cpp \
- $$PWD/qhxymodelmapper.cpp
-
-PRIVATE_HEADERS += \
- $$PWD/xychart_p.h \
- $$PWD/qxyseries_p.h \
- $$PWD/qxymodelmapper_p.h
-
-
-PUBLIC_HEADERS += \
- $$PWD/qxyseries.h \
- $$PWD/qxymodelmapper.h \
- $$PWD/qvxymodelmapper.h \
- $$PWD/qhxymodelmapper.h
diff --git a/src/xychart/xychart_p.h b/src/xychart/xychart_p.h
deleted file mode 100644
index d45e55fd..00000000
--- a/src/xychart/xychart_p.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef XYCHART_H
-#define XYCHART_H
-
-#include "qchartglobal.h"
-#include "chartitem_p.h"
-#include "xyanimation_p.h"
-#include "qvalueaxis.h"
-#include <QPen>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class ChartPresenter;
-class QXYSeries;
-
-class XYChart : public ChartItem
-{
- Q_OBJECT
-public:
- explicit XYChart(QXYSeries *series,QGraphicsItem *item = 0);
- ~XYChart() {}
-
- void setGeometryPoints(const QVector<QPointF> &points);
- QVector<QPointF> geometryPoints() const { return m_points; }
-
- void setAnimation(XYAnimation *animation);
- ChartAnimation *animation() const { return m_animation; }
- virtual void updateGeometry() = 0;
-
- bool isDirty() const { return m_dirty; }
- void setDirty(bool dirty);
-
- void getSeriesRanges(qreal &minX, qreal &maxX, qreal &minY, qreal &maxY);
- QVector<bool> offGridStatusVector();
-
-public Q_SLOTS:
- void handlePointAdded(int index);
- void handlePointRemoved(int index);
- void handlePointReplaced(int index);
- void handlePointsReplaced();
- void handleDomainUpdated();
-
-Q_SIGNALS:
- void clicked(const QPointF &point);
- void hovered(const QPointF &point, bool state);
-
-protected:
- virtual void updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index = -1);
-
-private:
- inline bool isEmpty();
-
-protected:
- QXYSeries *m_series;
- QVector<QPointF> m_points;
- XYAnimation *m_animation;
- bool m_dirty;
-
- friend class AreaChartItem;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif
diff --git a/sync.profile b/sync.profile
new file mode 100644
index 00000000..32b85c7e
--- /dev/null
+++ b/sync.profile
@@ -0,0 +1,19 @@
+%modules = ( # path to module name map
+ "QtCharts" => "$basedir/src/charts",
+);
+%moduleheaders = ( # restrict the module headers to those found in relative path
+);
+%classnames = (
+ "qchartglobal.h" => "QChartGlobal"
+);
+# Module dependencies.
+# Every module that is required to build this module should have one entry.
+# Each of the module version specifiers can take one of the following values:
+# - A specific Git revision.
+# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
+#
+%dependencies = (
+ "qtbase" => "refs/heads/stable",
+ "qtquick1" => "refs/heads/stable",
+ "qtdeclarative" => "refs/heads/stable",
+);
diff --git a/tests/auto/auto.pri b/tests/auto/auto.pri
index c528b34a..a0915009 100644
--- a/tests/auto/auto.pri
+++ b/tests/auto/auto.pri
@@ -2,26 +2,14 @@
error( "Couldn't find the tests.pri file!" )
}
-greaterThan(QT_MAJOR_VERSION, 4) {
QT += testlib widgets
-} else {
- CONFIG += qtestlib
-}
-!contains(TARGET, ^tst_.*):TARGET = $$join(TARGET,,"tst_")
-android {
- # Workaround to fix android deployment, which seems to always look for target in
- # OUT_PWD instead of DESTDIR. Need to override the QMAKE_POST_LINK setting done
- # in tests.pri, as "tst_" was prepended to the target.
- COPY_PARAMETERS = "$$CHART_BUILD_BIN_DIR/lib$${TARGET}.so $$OUT_PWD/lib$${TARGET}.so"
- contains(QMAKE_HOST.os, Windows): COPY_PARAMETERS = $$replace(COPY_PARAMETERS, "/","\\")
- QMAKE_POST_LINK += $$QMAKE_COPY $$COPY_PARAMETERS
-}
+!contains(TARGET, ^tst_.*):TARGET = $$join(TARGET,,"tst_")
INCLUDEPATH += ../inc
HEADERS += ../inc/tst_definitions.h
-OBJECTS_DIR = $$CHART_BUILD_DIR/tests/auto/$$TARGET
-MOC_DIR = $$CHART_BUILD_DIR/tests/auto/$$TARGET
-UI_DIR = $$CHART_BUILD_DIR/tests/auto/$$TARGET
-RCC_DIR = $$CHART_BUILD_DIR/tests/auto/$$TARGET
+#Define for unit tests
+CONFIG(debug, debug|release) {
+ DEFINES += BUILD_PRIVATE_UNIT_TESTS
+}
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 416b2372..32d49fa4 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,7 +1,3 @@
-!include( ../tests.pri ) {
- error( "Couldn't find the tests.pri file!" )
-}
-
TEMPLATE = subdirs
SUBDIRS += \
qchartview \
@@ -28,27 +24,12 @@ SUBDIRS += \
chartdataset \
qlegend
-contains(QT_VERSION, ^4\\.[0-7]\\.[0-3]\\s*$) | contains(QT_VERSION, ^4\\.[0-6]\\..*) {
- warning("QtCommercial.Charts QML API requires at least Qt 4.7.4. You are using $${QT_VERSION} so the QML API is disabled.")
-} else {
- !contains(QT_VERSION, ^5\\..*\\..*$)|qtHaveModule(declarative): SUBDIRS += qml
-
- # Check if QtQuickTest is installed
- exists($$(QTDIR)/mkspecs/features/qmltestcase.prf){
- SUBDIRS += qml-qtquicktest
- } else {
- warning("QtQuickTest not found; cannot build QML api unit tests")
- }
-}
-
!linux-arm*: {
SUBDIRS += \
qdatetimeaxis
}
-contains(QT_VERSION, ^5\\..*\\..*$):qtHaveModule(quick) {
- SUBDIRS += quick2
+qtHaveModule(quick) {
+ SUBDIRS += qml \
+ qml-qtquicktest
}
-
-
-
diff --git a/tests/auto/chartdataset/chartdataset.pro b/tests/auto/chartdataset/chartdataset.pro
index 9a7880de..994532ae 100644
--- a/tests/auto/chartdataset/chartdataset.pro
+++ b/tests/auto/chartdataset/chartdataset.pro
@@ -2,4 +2,6 @@
error( "Couldn't find the auto.pri file!" )
}
+QT += charts-private
+
SOURCES += tst_chartdataset.cpp
diff --git a/tests/auto/chartdataset/tst_chartdataset.cpp b/tests/auto/chartdataset/tst_chartdataset.cpp
index 4bd1441e..2a0f9637 100644
--- a/tests/auto/chartdataset/tst_chartdataset.cpp
+++ b/tests/auto/chartdataset/tst_chartdataset.cpp
@@ -31,11 +31,7 @@ private Q_SLOTS:
void tst_ChartDataSet::skip()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("This test requires the debug version of library");
-#else
- QSKIP("This test requires the debug version of library", SkipAll);
-#endif
}
QTEST_MAIN(tst_ChartDataSet)
@@ -63,7 +59,7 @@ QTEST_MAIN(tst_ChartDataSet)
#include <private/abstractdomain_p.h>
#include <tst_definitions.h>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(AbstractDomain *)
Q_DECLARE_METATYPE(QAbstractAxis *)
diff --git a/tests/auto/domain/domain.pro b/tests/auto/domain/domain.pro
index 8c9af3d7..f0e90136 100644
--- a/tests/auto/domain/domain.pro
+++ b/tests/auto/domain/domain.pro
@@ -2,4 +2,6 @@
error( "Couldn't find the auto.pri file!" )
}
+QT += charts-private
+
SOURCES += tst_domain.cpp
diff --git a/tests/auto/domain/tst_domain.cpp b/tests/auto/domain/tst_domain.cpp
index d9c853b4..33b68a10 100644
--- a/tests/auto/domain/tst_domain.cpp
+++ b/tests/auto/domain/tst_domain.cpp
@@ -32,11 +32,7 @@ private Q_SLOTS:
void tst_Domain::skip()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("This test requires the debug version of library");
-#else
- QSKIP("This test requires the debug version of library", SkipAll);
-#endif
}
QTEST_MAIN(tst_Domain)
@@ -49,7 +45,7 @@ QTEST_MAIN(tst_Domain)
#include <private/qabstractaxis_p.h>
#include <tst_definitions.h>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(XYDomain*)
Q_DECLARE_METATYPE(QSizeF)
diff --git a/tests/auto/inc/tst_definitions.h b/tests/auto/inc/tst_definitions.h
index 12963e78..6dd4a837 100644
--- a/tests/auto/inc/tst_definitions.h
+++ b/tests/auto/inc/tst_definitions.h
@@ -21,11 +21,10 @@
#ifndef TST_DEFINITIONS_H
#define TST_DEFINITIONS_H
-#include "qpolarchart.h"
+#include <QtCharts/qpolarchart.h>
#include <QtTest/QtTest>
#include <QPushButton>
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
namespace QTest
{
// This was deprecated in Qt5. This is a small hack for the sake of compatibility.
@@ -34,7 +33,6 @@ namespace QTest
return QTest::qWaitForWindowExposed(window);
}
}
-#endif
#define TRY_COMPARE(actual, expected) { \
do { \
@@ -51,7 +49,6 @@ namespace QTest
// Some bamboo clients have trouble passing mouse events to the test application.
// This can be used to skip those tests so that they don't show up as a failure
// in the test report.
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#define SKIP_IF_CANNOT_TEST_MOUSE_EVENTS() { \
do { \
QPushButton b; \
@@ -74,30 +71,6 @@ namespace QTest
if (!isPolarTest()) \
QSKIP("Test not supported by cartesian chart"); \
}
-#else
- #define SKIP_IF_CANNOT_TEST_MOUSE_EVENTS() { \
- do { \
- QPushButton b; \
- b.resize(100, 100); \
- b.show(); \
- QTest::qWaitForWindowShown(&b); \
- QSignalSpy spy(&b, SIGNAL(clicked())); \
- QTest::mouseClick(&b, Qt::LeftButton, 0, b.rect().center()); \
- if (spy.count() == 0) \
- QSKIP("Cannot test mouse events in this environment", SkipAll); \
- } while (0); \
- }
-
- #define SKIP_ON_POLAR() { \
- if (isPolarTest()) \
- QSKIP("Test not supported by polar chart", SkipAll); \
- }
-
- #define SKIP_ON_CARTESIAN() { \
- if (!isPolarTest()) \
- QSKIP("Test not supported by cartesian chart", SkipAll); \
- }
-#endif
static inline bool isPolarTest()
{
@@ -112,12 +85,12 @@ static inline bool isPolarTest()
return isPolar;
}
-static inline QtCommercialChart::QChart *newQChartOrQPolarChart()
+static inline QtCharts::QChart *newQChartOrQPolarChart()
{
if (isPolarTest())
- return new QtCommercialChart::QPolarChart();
+ return new QtCharts::QPolarChart();
else
- return new QtCommercialChart::QChart();
+ return new QtCharts::QChart();
}
diff --git a/tests/auto/qabstractaxis/tst_qabstractaxis.cpp b/tests/auto/qabstractaxis/tst_qabstractaxis.cpp
index d9cbebd4..4df20372 100644
--- a/tests/auto/qabstractaxis/tst_qabstractaxis.cpp
+++ b/tests/auto/qabstractaxis/tst_qabstractaxis.cpp
@@ -135,11 +135,7 @@ void tst_QAbstractAxis::axisPenColor_data()
void tst_QAbstractAxis::axisPenColor()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("Test is not implemented. This is deprecated function");
-#else
- QSKIP("Test is not implemented. This is deprecated function", SkipAll);
-#endif
}
void tst_QAbstractAxis::gridLinePen_data()
@@ -404,11 +400,7 @@ void tst_QAbstractAxis::labelsColor_data()
void tst_QAbstractAxis::labelsColor()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("Test is not implemented. This is deprecated function");
-#else
- QSKIP("Test is not implemented. This is deprecated function", SkipAll);
-#endif
}
void tst_QAbstractAxis::labelsFont_data()
@@ -633,11 +625,7 @@ void tst_QAbstractAxis::shadesBorderColor_data()
void tst_QAbstractAxis::shadesBorderColor()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("Test is not implemented. This is deprecated function");
-#else
- QSKIP("Test is not implemented. This is deprecated function", SkipAll);
-#endif
}
void tst_QAbstractAxis::shadesBrush_data()
@@ -687,11 +675,7 @@ void tst_QAbstractAxis::shadesColor_data()
// public QColor shadesColor() const
void tst_QAbstractAxis::shadesColor()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("Test is not implemented. This is deprecated function");
-#else
- QSKIP("Test is not implemented. This is deprecated function", SkipAll);
-#endif
}
void tst_QAbstractAxis::shadesPen_data()
diff --git a/tests/auto/qabstractaxis/tst_qabstractaxis.h b/tests/auto/qabstractaxis/tst_qabstractaxis.h
index 8e9d1b27..2ca5107a 100644
--- a/tests/auto/qabstractaxis/tst_qabstractaxis.h
+++ b/tests/auto/qabstractaxis/tst_qabstractaxis.h
@@ -26,7 +26,7 @@
#include <qabstractaxis.h>
#include <qchartview.h>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class tst_QAbstractAxis : public QObject
{
diff --git a/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp b/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp
index 3fc51f8f..0e9fef5a 100644
--- a/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp
+++ b/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp
@@ -29,7 +29,7 @@
#include <qhbarmodelmapper.h>
#include <QStandardItemModel>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class tst_qbarmodelmapper : public QObject
{
diff --git a/tests/auto/qbarseries/tst_qbarseries.cpp b/tests/auto/qbarseries/tst_qbarseries.cpp
index f2c056a0..c9265e38 100644
--- a/tests/auto/qbarseries/tst_qbarseries.cpp
+++ b/tests/auto/qbarseries/tst_qbarseries.cpp
@@ -25,7 +25,7 @@
#include <qchart.h>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
Q_DECLARE_METATYPE(QList<QBarSet*>)
diff --git a/tests/auto/qbarset/tst_qbarset.cpp b/tests/auto/qbarset/tst_qbarset.cpp
index 74db42f0..4c937dce 100644
--- a/tests/auto/qbarset/tst_qbarset.cpp
+++ b/tests/auto/qbarset/tst_qbarset.cpp
@@ -24,7 +24,7 @@
#include <qchartview.h>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class tst_QBarSet : public QObject
{
diff --git a/tests/auto/qchart/tst_qchart.cpp b/tests/auto/qchart/tst_qchart.cpp
index 54cd5621..18ae868c 100644
--- a/tests/auto/qchart/tst_qchart.cpp
+++ b/tests/auto/qchart/tst_qchart.cpp
@@ -33,7 +33,7 @@
#include <qbarcategoryaxis.h>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(QAbstractAxis *)
Q_DECLARE_METATYPE(QValueAxis *)
diff --git a/tests/auto/qchartview/tst_qchartview.cpp b/tests/auto/qchartview/tst_qchartview.cpp
index ab404370..f8264bad 100644
--- a/tests/auto/qchartview/tst_qchartview.cpp
+++ b/tests/auto/qchartview/tst_qchartview.cpp
@@ -19,13 +19,13 @@
****************************************************************************/
#include <QtTest/QtTest>
-#include <qchartview.h>
-#include <qlineseries.h>
+#include <QtCharts/qchartview.h>
+#include <QtCharts/qlineseries.h>
#include <cmath>
#include <tst_definitions.h>
-#include <qvalueaxis.h>
+#include <QtCharts/qvalueaxis.h>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(QChart*)
diff --git a/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp b/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp
index de5b868f..5294ff2c 100644
--- a/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp
+++ b/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp
@@ -25,7 +25,7 @@
#include <qchart.h>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
diff --git a/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp b/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp
index e03f0d0e..63afbb2a 100644
--- a/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp
+++ b/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp
@@ -25,7 +25,7 @@
#include <qchart.h>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
diff --git a/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp b/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp
index b25df764..df4f0837 100644
--- a/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp
+++ b/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp
@@ -25,7 +25,7 @@
#include <qchart.h>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
diff --git a/tests/auto/qlegend/tst_qlegend.cpp b/tests/auto/qlegend/tst_qlegend.cpp
index a4899a5e..7f14a43a 100644
--- a/tests/auto/qlegend/tst_qlegend.cpp
+++ b/tests/auto/qlegend/tst_qlegend.cpp
@@ -33,7 +33,7 @@
#include <qbarlegendmarker.h>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class tst_QLegend : public QObject
{
diff --git a/tests/auto/qml-qtquicktest/qml-qtquicktest.pro b/tests/auto/qml-qtquicktest/qml-qtquicktest.pro
index 94062270..d9a1e74f 100644
--- a/tests/auto/qml-qtquicktest/qml-qtquicktest.pro
+++ b/tests/auto/qml-qtquicktest/qml-qtquicktest.pro
@@ -2,12 +2,8 @@
error( "Couldn't find the auto.pri file!" )
}
-greaterThan(QT_MAJOR_VERSION, 4) {
- TEMPLATE = app
- CONFIG += warn_on qmltestcase
- SOURCES += main.cpp
- OTHER_FILES += tst_*.qml
- DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\"
-} else {
- error("These auto tests are designed for Qt5 / QtQuick 2.0")
-}
+TEMPLATE = app
+CONFIG += warn_on qmltestcase
+SOURCES += main.cpp
+OTHER_FILES += tst_*.qml
+DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\"
diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml
index eae2364a..f936237c 100644
--- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml
+++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
@@ -87,7 +87,7 @@ Rectangle {
id: axisX
categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ]
}
- axisY: ValuesAxis {
+ axisY: ValueAxis {
id: axisY
min: 0
max: 10
diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml
index 6e21b990..e3f55b13 100644
--- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml
+++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.1
+import QtCharts 1.1
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml
index d40c407c..61b35443 100644
--- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml
+++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.2
+import QtCharts 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml
index 7b714ad5..aced30ac 100644
--- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_4.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_4.qml
new file mode 100644
index 00000000..96d23b34
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_4.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest BarCategoryAxis 1.4"
+ when: windowShown
+
+ function test_minMax() {
+ compare(barSeries1.axisX.min, "Jan", "AxisX min");
+ compare(barSeries1.axisX.max, "Jun", "AxisX max");
+ compare(barSeries1.axisY.min, 0, "AxisY min");
+ compare(barSeries1.axisY.max, 10, "AxisY max");
+ }
+
+ function test_categories() {
+ compare(barSeries1.axisX.count, 6, "AxisX count");
+ categoriesCountChangedSpy.clear();
+ categoriesChangedSpy.clear();
+
+ // Replace categories
+ barSeries1.axisX.categories = ["Tam", "Hel", "Maa", "Huh"];
+ compare(barSeries1.axisX.count, 4, "AxisX count");
+ compare(categoriesCountChangedSpy.count, 1, "onCountChanged");
+ compare(categoriesChangedSpy.count, 1, "onCategoriesChanged");
+
+ // Reset the original categories
+ barSeries1.axisX.categories = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
+ compare(barSeries1.axisX.count, 6, "AxisX count");
+ compare(categoriesCountChangedSpy.count, 2, "onCountChanged");
+ compare(categoriesChangedSpy.count, 2, "onCategoriesChanged");
+ }
+
+ function test_minMaxChanged() {
+ axisY.min = -1;
+ compare(minChangedSpy.count, 1, "onMinChanged");
+ compare(maxChangedSpy.count, 0, "onMaxChanged");
+ axisY.max = 12;
+ compare(minChangedSpy.count, 1, "onMinChanged");
+ compare(maxChangedSpy.count, 1, "onMaxChanged");
+ }
+
+ function test_seriesAxisClear() {
+ verify(barSeries1.axisX.min !== "", "barSeries1.axisX.min");
+ verify(barSeries1.axisX.max !== "", "barSeries1.axisX.max");
+ verify(barSeries1.axisX.count !== 0, "barSeries1.axisX.count"); // category count
+ barSeries1.axisX.clear();
+ verify(barSeries1.axisX.min === "", "barSeries1.axisX.min");
+ verify(barSeries1.axisX.max === "", "barSeries1.axisX.max");
+ verify(barSeries1.axisX.count === 0);
+ }
+
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ BarSeries {
+ id: barSeries1
+ axisX: BarCategoryAxis {
+ id: axisX
+ categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ]
+ }
+ axisY: ValueAxis {
+ id: axisY
+ min: 0
+ max: 10
+ }
+ }
+
+ SignalSpy {
+ id: categoriesCountChangedSpy
+ target: axisX
+ signalName: "countChanged"
+ }
+ SignalSpy {
+ id: categoriesChangedSpy
+ target: axisX
+ signalName: "categoriesChanged"
+ }
+ SignalSpy {
+ id: minChangedSpy
+ target: axisY
+ signalName: "minChanged"
+ }
+ SignalSpy {
+ id: maxChangedSpy
+ target: axisY
+ signalName: "maxChanged"
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_barseries.qml b/tests/auto/qml-qtquicktest/tst_barseries.qml
index c5a5cfb7..fb80a744 100644
--- a/tests/auto/qml-qtquicktest/tst_barseries.qml
+++ b/tests/auto/qml-qtquicktest/tst_barseries.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml b/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml
index 5253019c..b2d1c199 100644
--- a/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml
+++ b/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.1
+import QtCharts 1.1
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml b/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml
index d4c2d878..8c859596 100644
--- a/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml
+++ b/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.2
+import QtCharts 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml b/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml
index bcc7ac15..4f9ae5fc 100644
--- a/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_4.qml b/tests/auto/qml-qtquicktest/tst_barseries_1_4.qml
new file mode 100644
index 00000000..0a2607dd
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_barseries_1_4.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest BarSeries 1.4"
+ when: windowShown
+
+ function test_properties() {
+ compare(barSeries.barWidth, 0.5);
+ compare(barSeries.labelsVisible, false);
+ compare(barSeries.labelsPosition, BarSeries.LabelsCenter);
+ }
+
+ function test_setproperties() {
+ var set = barSeries.append("property", [1, 2, 3])
+ compare(set.brushFilename, "");
+ }
+
+ function test_axes() {
+ verify(chartView.axisX() == barSeries.axisX);
+ verify(chartView.axisY() == barSeries.axisY);
+
+ compare(barSeries.axisX, stackedBarSeries.axisX);
+ compare(barSeries.axisY, stackedBarSeries.axisY);
+
+ compare(barSeries.axisX, percentBarSeries.axisX);
+ compare(barSeries.axisY, percentBarSeries.axisY);
+ }
+
+ function test_append() {
+ var setCount = 5;
+ var valueCount = 50;
+ addedSpy.clear();
+ append(setCount, valueCount);
+
+ compare(barSeries.count, setCount);
+ for (var k = 0; k < setCount; k++) {
+ compare(barSeries.at(k).count, valueCount);
+ compare(barSeries.at(k).label, "barset" + k);
+ }
+ compare(addedSpy.count, setCount);
+
+ barSeries.clear();
+ compare(barSeries.count, 0);
+ }
+
+ function test_insert() {
+ var setCount = 5;
+ var valueCount = 50;
+ addedSpy.clear();
+ append(setCount, valueCount);
+
+ for (var i = 0; i < setCount; i++) {
+ var values = [];
+ for (var j = 0; j < valueCount; j++)
+ values[j] = Math.random() * 10;
+ var set = barSeries.insert(i, "barset" + i, values);
+ compare(set.label, "barset" + i);
+ }
+
+ compare(barSeries.count, setCount * 2);
+ for (var k = 0; k < setCount * 2; k++)
+ compare(barSeries.at(k).count, valueCount);
+ compare(addedSpy.count, 2 * setCount);
+
+ barSeries.clear();
+ compare(barSeries.count, 0);
+ }
+
+ function test_signals() {
+ labelsPositionSpy.clear();
+ barSeries.labelsPosition = BarSeries.LabelsOutsideEnd;
+ compare(labelsPositionSpy.count, 1, "onLabelsPositionChanged")
+ }
+
+ function test_remove() {
+ var setCount = 5;
+ var valueCount = 50;
+ removedSpy.clear();
+ append(setCount, valueCount);
+
+ for (var k = 0; k < setCount; k++)
+ barSeries.remove(barSeries.at(0));
+
+ compare(barSeries.count, 0);
+ compare(removedSpy.count, setCount);
+ }
+
+ // Not a test function, used by one or more test functions
+ function append(setCount, valueCount) {
+ for (var i = 0; i < setCount; i++) {
+ var values = [];
+ for (var j = 0; j < valueCount; j++)
+ values[j] = Math.random() * 10;
+ barSeries.append("barset" + i, values);
+ }
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ BarSeries {
+ id: barSeries
+ name: "bar"
+ axisX: BarCategoryAxis {}
+ axisY: ValueAxis { min: 0; max: 10 }
+
+ SignalSpy {
+ id: addedSpy
+ target: barSeries
+ signalName: "barsetsAdded"
+ }
+ SignalSpy {
+ id: removedSpy
+ target: barSeries
+ signalName: "barsetsRemoved"
+ }
+ SignalSpy {
+ id: labelsPositionSpy
+ target: barSeries
+ signalName: "labelsPositionChanged"
+ }
+ }
+
+ StackedBarSeries {
+ id: stackedBarSeries
+ name: "stackedBar"
+ }
+
+ PercentBarSeries {
+ id: percentBarSeries
+ name: "percentBar"
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries.qml b/tests/auto/qml-qtquicktest/tst_boxplotseries.qml
index 22a6e1bf..860f3a80 100644
--- a/tests/auto/qml-qtquicktest/tst_boxplotseries.qml
+++ b/tests/auto/qml-qtquicktest/tst_boxplotseries.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml
index 78c187eb..84ca79b2 100644
--- a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_4.qml b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_4.qml
new file mode 100644
index 00000000..bd4adc20
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_4.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest BoxPlotSeries 1.4"
+ when: windowShown
+
+ function test_properties() {
+ compare(boxPlotSeries.boxWidth, 0.5);
+ compare(boxPlotSeries.brushFilename, "");
+ }
+
+ function test_setproperties() {
+ var set = boxPlotSeries.append("boxplot", [1, 2, 5, 6, 8]);
+ compare(set.label, "boxplot");
+ compare(set.count, 5);
+ compare(set.brushFilename, "");
+ }
+
+ function test_append() {
+ boxPlotSeries.clear();
+ addedSpy.clear();
+ countChangedSpy.clear();
+ var count = 50;
+ for (var i = 0; i < count; i++)
+ boxPlotSeries.append("boxplot" + i, Math.random());
+ compare(addedSpy.count, count);
+ compare(countChangedSpy.count, count);
+ compare(boxPlotSeries.count, count)
+ boxPlotSeries.clear();
+ }
+
+ function test_remove() {
+ boxPlotSeries.clear();
+ removedSpy.clear();
+ countChangedSpy.clear();
+ var count = 50;
+ for (var i = 0; i < count; i++)
+ boxPlotSeries.append("boxplot" + i, Math.random());
+ for (var j = 0; j < count; j++)
+ boxPlotSeries.remove(boxPlotSeries.at(0));
+ compare(removedSpy.count, count);
+ compare(countChangedSpy.count, 2 * count);
+ compare(boxPlotSeries.count, 0)
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ BoxPlotSeries {
+ id: boxPlotSeries
+ name: "boxplot"
+ BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] }
+
+ SignalSpy {
+ id: addedSpy
+ target: boxPlotSeries
+ signalName: "boxsetsAdded"
+ }
+ SignalSpy {
+ id: removedSpy
+ target: boxPlotSeries
+ signalName: "boxsetsRemoved"
+ }
+ SignalSpy {
+ id: countChangedSpy
+ target: boxPlotSeries
+ signalName: "countChanged"
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis.qml
index 5248eeb6..a19c59ae 100644
--- a/tests/auto/qml-qtquicktest/tst_categoryaxis.qml
+++ b/tests/auto/qml-qtquicktest/tst_categoryaxis.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
@@ -53,7 +53,7 @@ Rectangle {
LineSeries {
id: lineSeries1
- axisX: ValuesAxis {
+ axisX: ValueAxis {
id: axisX
min: 0
max: 10
diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml
index 8b10ad9b..1e865fb3 100644
--- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml
+++ b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.1
+import QtCharts 1.1
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml
index f29b04b2..019fa667 100644
--- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml
+++ b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.2
+import QtCharts 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml
index 9fbb0b2a..a3899285 100644
--- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_4.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_4.qml
new file mode 100644
index 00000000..196aec9d
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_4.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest CategoryAxis 1.4"
+ when: windowShown
+
+ function test_minMax() {
+ compare(lineSeries1.axisX.min, 0, "AxisX min");
+ compare(lineSeries1.axisX.max, 10, "AxisX max");
+ compare(lineSeries1.axisY.min, 0, "AxisY min");
+ compare(lineSeries1.axisY.max, 10, "AxisY max");
+ }
+
+ function test_categories() {
+ compare(lineSeries1.axisY.startValue, 0, "AxisY start value");
+ compare(lineSeries1.axisY.count, 3, "AxisY count");
+ compare(lineSeries1.axisY.categoriesLabels[0], "label0", "AxisY categories labels");
+ compare(lineSeries1.axisY.categoriesLabels[1], "label1", "AxisY categories labels");
+ compare(lineSeries1.axisY.categoriesLabels[2], "label2", "AxisY categories labels");
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ LineSeries {
+ id: lineSeries1
+ axisX: ValueAxis {
+ id: axisX
+ min: 0
+ max: 10
+ }
+ axisY: CategoryAxis {
+ id: axisY
+ min: 0
+ max: 10
+ startValue: 0
+ CategoryRange {
+ label: "label0"
+ endValue: 1
+ }
+ CategoryRange {
+ label: "label1"
+ endValue: 3
+ }
+ CategoryRange {
+ label: "label2"
+ endValue: 10
+ }
+ }
+ XYPoint { x: -1; y: -1 }
+ XYPoint { x: 0; y: 0 }
+ XYPoint { x: 5; y: 5 }
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_chartview.qml b/tests/auto/qml-qtquicktest/tst_chartview.qml
index 5b530e73..31e6775b 100644
--- a/tests/auto/qml-qtquicktest/tst_chartview.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartview.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml b/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml
index a31372be..67e0732f 100644
--- a/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.1
+import QtCharts 1.1
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml b/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml
index 8a44a58e..3d9dcb5f 100644
--- a/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.2
+import QtCharts 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml b/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml
index e2378999..1ed2c6a2 100644
--- a/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_4.qml b/tests/auto/qml-qtquicktest/tst_chartview_1_4.qml
new file mode 100644
index 00000000..d3e032f3
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_chartview_1_4.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest ChartView Properties 1.4"
+ when: windowShown
+
+ function test_chartViewProperties() {
+ compare(chartView.animationOptions, ChartView.NoAnimation, "ChartView.animationOptions");
+ verify(chartView.backgroundColor != undefined);
+ verify(chartView.margins.bottom > 0, "ChartView.margins.bottom");
+ verify(chartView.margins.top > 0, "ChartView.margins.top");
+ verify(chartView.margins.left > 0, "ChartView.margins.left");
+ verify(chartView.margins.right > 0, "ChartView.margins.right");
+ compare(chartView.count, 0, "ChartView.count");
+ compare(chartView.dropShadowEnabled, false, "ChartView.dropShadowEnabled");
+ verify(chartView.plotArea.height > 0, "ChartView.plotArea.height");
+ verify(chartView.plotArea.width > 0, "ChartView.plotArea.width");
+ verify(chartView.plotArea.x > 0, "ChartView.plotArea.x");
+ verify(chartView.plotArea.y > 0, "ChartView.plotArea.y");
+ compare(chartView.theme, ChartView.ChartThemeLight, "ChartView.theme");
+ compare(chartView.title, "", "ChartView.title");
+ compare(chartView.title, "", "ChartView.title");
+ verify(chartView.titleColor != undefined, "ChartView.titleColor");
+ compare(chartView.titleFont.bold, false, "ChartView.titleFont.bold");
+ // Legend
+ compare(chartView.legend.visible, true, "ChartView.legend.visible");
+ compare(chartView.legend.alignment, Qt.AlignTop, "ChartView.legend.alignment");
+ compare(chartView.legend.backgroundVisible, false, "ChartView.legend.backgroundVisible");
+ verify(chartView.legend.borderColor != undefined, "ChartView.legend.borderColor");
+ verify(chartView.legend.color != undefined, "ChartView.legend.color");
+ compare(chartView.legend.reverseMarkers, false, "ChartView.legend.reverseMarkers");
+ // Legend font
+ compare(chartView.legend.font.bold, false, "ChartView.legend.font.bold");
+ compare(chartView.legend.font.capitalization, Font.MixedCase, "ChartView.legend.font.capitalization");
+ verify(chartView.legend.font.family != "", "ChartView.legend.font.family");
+ compare(chartView.legend.font.italic, false, "ChartView.legend.font.italic");
+ compare(chartView.legend.font.letterSpacing, 0.0, "ChartView.legend.font.letterSpacing");
+ verify(chartView.legend.font.pixelSize > 0
+ && chartView.legend.font.pixelSize < 50, "ChartView.legend.font.pixelSize");
+ verify(chartView.legend.font.pointSize > 0
+ && chartView.legend.font.pointSize < 50, "ChartView.legend.font.pointSize");
+ compare(chartView.legend.font.strikeout, false, "ChartView.legend.font.strikeout");
+ compare(chartView.legend.font.underline, false, "ChartView.legend.font.underline");
+ compare(chartView.legend.font.weight, Font.Normal, "ChartView.legend.font.weight");
+ compare(chartView.legend.font.wordSpacing, 0.0, "ChartView.legend.font.wordSpacing");
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml
index 6c694bd5..2fca5639 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml
index 5f26d7d7..d25d8b73 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.1
+import QtCharts 1.1
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml
index 7e7c1115..9e1e8fda 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.2
+import QtCharts 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml
index b56ec21d..a259d2b4 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_4.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_4.qml
new file mode 100644
index 00000000..36745a73
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_4.qml
@@ -0,0 +1,160 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest ChartView Functions 1.4"
+ when: windowShown
+
+ function test_chartViewSeriesAndAxes() {
+ // Create XY series
+ var line = chartView.createSeries(ChartView.SeriesTypeLine, "line");
+ verify(line != null && line != undefined);
+ var spline = chartView.createSeries(ChartView.SeriesTypeSpline, "spline");
+ verify(spline != null && spline != undefined);
+ var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter");
+ verify(scatter != null && scatter != undefined);
+
+ // Create a series with specific axes
+ var line2 = chartView.createSeries(ChartView.SeriesTypeLine, "line2", chartView.axisX(line), chartView.axisY(line));
+
+ // Check that all the XY series use the same axes
+ verify(chartView.axisX(line) != null);
+ verify(chartView.axisY(line) != null);
+ compare(chartView.axisX(line), chartView.axisX(line2));
+ compare(chartView.axisY(line), chartView.axisY(line2));
+ compare(chartView.axisX(line), chartView.axisX(spline));
+ compare(chartView.axisY(line), chartView.axisY(spline));
+ compare(chartView.axisX(line), chartView.axisX(scatter));
+ compare(chartView.axisY(line), chartView.axisY(scatter));
+
+ var bar = chartView.createSeries(ChartView.SeriesTypeBar, "bar");
+ verify(bar != null && bar != undefined);
+ var stackedbar = chartView.createSeries(ChartView.SeriesTypeStackedBar, "stackedbar");
+ verify(stackedbar != null && stackedbar != undefined);
+ var percentbar = chartView.createSeries(ChartView.SeriesTypePercentBar, "percentbar");
+ verify(percentbar != null && percentbar != undefined);
+ var horizontalbar = chartView.createSeries(ChartView.SeriesTypeHorizontalBar, "horizontalbar");
+ verify(horizontalbar != null && horizontalbar != undefined);
+ var horizontalstackedbar = chartView.createSeries(ChartView.SeriesTypeHorizontalStackedBar, "horizontalstackedbar");
+ verify(horizontalstackedbar != null && horizontalstackedbar != undefined);
+ var horizontalpercentbar = chartView.createSeries(ChartView.SeriesTypeHorizontalPercentBar, "horizontalpercentbar");
+ verify(horizontalpercentbar != null && horizontalpercentbar != undefined);
+ var area = chartView.createSeries(ChartView.SeriesTypeArea, "area");
+ verify(area != null && area != undefined);
+
+ // Remove all series
+ chartView.removeAllSeries();
+ compare(chartView.count, 0);
+ }
+
+ function test_chartViewRange() {
+ // Set initial values
+ chartView.createSeries(ChartView.SeriesTypeLine, "line");
+ verify(chartView.axisX() != null);
+ verify(chartView.axisY() != null);
+ chartView.axisX().min = 1.0;
+ chartView.axisX().max = 2.0;
+ chartView.axisY().min = 1.0;
+ chartView.axisY().max = 2.0;
+
+ var xMax = chartView.axisX().max;
+ var xMin = chartView.axisX().min;
+ var yMax = chartView.axisY().max;
+ var yMin = chartView.axisY().min;
+
+ // zoom x 2.5
+ chartView.zoom(1.5);
+ verify(chartView.axisX().max < xMax);
+ verify(chartView.axisX().min > xMin);
+ verify(chartView.axisY().max < yMax);
+ verify(chartView.axisY().min > yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ // zoom x 0.5
+ chartView.zoom(0.5);
+ verify(chartView.axisX().max > xMax);
+ verify(chartView.axisX().min < xMin);
+ verify(chartView.axisY().max > yMax);
+ verify(chartView.axisY().min < yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ // Scroll up
+ chartView.scrollUp(10);
+ compare(chartView.axisX().max, xMax);
+ compare(chartView.axisX().min, xMin);
+ verify(chartView.axisY().max > yMax);
+ verify(chartView.axisY().min > yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ // Scroll down
+ chartView.scrollDown(10);
+ compare(chartView.axisX().max, xMax);
+ compare(chartView.axisX().min, xMin);
+ verify(chartView.axisY().max < yMax);
+ verify(chartView.axisY().min < yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ // Scroll left
+ chartView.scrollLeft(10);
+ verify(chartView.axisX().max < xMax);
+ verify(chartView.axisX().min < xMin);
+ compare(chartView.axisY().max, yMax);
+ compare(chartView.axisY().min, yMin);
+ xMax = chartView.axisX().max;
+ xMin = chartView.axisX().min;
+ yMax = chartView.axisY().max;
+ yMin = chartView.axisY().min;
+
+ // Scroll right
+ chartView.scrollRight(10);
+ verify(chartView.axisX().max > xMax);
+ verify(chartView.axisX().min > xMin);
+ compare(chartView.axisY().max, yMax);
+ compare(chartView.axisY().min, yMin);
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+ title: "Chart"
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml
index db9df5c0..8085bef2 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml
index a6bab95d..0dcefeb4 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.1
+import QtCharts 1.1
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml
index 46c0adcb..954740cf 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.2
+import QtCharts 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml
index 66261b39..a4f01c32 100644
--- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_4.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_4.qml
new file mode 100644
index 00000000..db93c519
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_4.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest ChartView Signals 1.4"
+ when: windowShown
+
+ // Verify onSeriesAdded and onSeriesRemoved signals
+ function test_chartView() {
+ var series = chartView.createSeries(ChartView.SeriesTypeLine, "line");
+ seriesAddedSpy.wait();
+ compare(seriesAddedSpy.count, 1, "ChartView.onSeriesAdded");
+
+ // Modifying layout triggers more than one plotAreaChanged signal
+ chartView.titleFont.pixelSize = 50;
+ verify(plotAreaChangedSpy.count > 0, "ChartView.onPlotAreaChanged");
+
+ chartView.removeSeries(series);
+ seriesRemovedSpy.wait();
+ compare(seriesRemovedSpy.count, 1, "ChartView.onSeriesAdded");
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+ title: "Chart"
+
+ SignalSpy {
+ id: plotAreaChangedSpy
+ target: chartView
+ signalName: "plotAreaChanged"
+ }
+
+ SignalSpy {
+ id: seriesAddedSpy
+ target: chartView
+ signalName: "seriesAdded"
+ }
+
+ SignalSpy {
+ id: seriesRemovedSpy
+ target: chartView
+ signalName: "seriesRemoved"
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_pieseries.qml b/tests/auto/qml-qtquicktest/tst_pieseries.qml
index 0a888ee4..5aa83047 100644
--- a/tests/auto/qml-qtquicktest/tst_pieseries.qml
+++ b/tests/auto/qml-qtquicktest/tst_pieseries.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml b/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml
index b23ab504..c777779f 100644
--- a/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml
+++ b/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.1
+import QtCharts 1.1
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml b/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml
index 0b528d69..09c3d450 100644
--- a/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml
+++ b/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.2
+import QtCharts 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml b/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml
index 21b29c07..1a50cf85 100644
--- a/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_4.qml b/tests/auto/qml-qtquicktest/tst_pieseries_1_4.qml
new file mode 100644
index 00000000..5cfab8c9
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_pieseries_1_4.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest PieSeries 1.4"
+ when: windowShown
+
+ function test_properties() {
+ compare(pieSeries.endAngle, 360);
+ compare(pieSeries.holeSize, 0);
+ compare(pieSeries.horizontalPosition, 0.5);
+ compare(pieSeries.size, 0.7);
+ compare(pieSeries.startAngle, 0);
+ compare(pieSeries.sum, 0);
+ compare(pieSeries.verticalPosition, 0.5);
+ }
+
+ function test_sliceproperties() {
+ var slice = pieSeries.append("slice", 10);
+ compare(slice.angleSpan, 360.0);
+ verify(slice.borderColor != undefined);
+ compare(slice.borderWidth, 1);
+ verify(slice.color != undefined);
+ compare(slice.explodeDistanceFactor, 0.15);
+ compare(slice.exploded, false);
+ compare(slice.label, "slice");
+ compare(slice.labelArmLengthFactor, 0.15);
+ verify(slice.labelColor != undefined);
+ compare(slice.labelFont.bold, false);
+ compare(slice.labelPosition, PieSlice.LabelOutside);
+ compare(slice.labelVisible, false);
+ compare(slice.percentage, 1.0);
+ compare(slice.startAngle, 0.0);
+ compare(slice.value, 10.0);
+ compare(slice.brushFilename, "");
+ }
+
+ function test_append() {
+ addedSpy.clear();
+ countChangedSpy.clear();
+ sumChangedSpy.clear();
+ var count = 50;
+ for (var i = 0; i < count; i++)
+ pieSeries.append("slice" + i, Math.random());
+ compare(addedSpy.count, count);
+ compare(countChangedSpy.count, count);
+ compare(sumChangedSpy.count, count);
+ pieSeries.clear();
+ }
+
+ function test_remove() {
+ removedSpy.clear();
+ countChangedSpy.clear();
+ sumChangedSpy.clear();
+ var count = 50;
+ for (var i = 0; i < count; i++)
+ pieSeries.append("slice" + i, Math.random());
+ for (var j = 0; j < count; j++)
+ pieSeries.remove(pieSeries.at(0));
+ compare(removedSpy.count, count);
+ compare(countChangedSpy.count, 2 * count);
+ compare(sumChangedSpy.count, 2 * count);
+ compare(pieSeries.count, 0);
+ }
+
+ function test_find_and_at() {
+ var count = 50;
+ for (var i = 0; i < count; i++)
+ pieSeries.append("slice" + i, Math.random());
+ for (var j = 0; j < count; j++) {
+ compare(pieSeries.find("slice" + j).label, "slice" + j);
+ compare(pieSeries.find("slice" + j).brushFilename, "");
+ }
+ compare(pieSeries.at(3).brushFilename,"");
+ pieSeries.clear();
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ PieSeries {
+ id: pieSeries
+ name: "pie"
+
+ SignalSpy {
+ id: addedSpy
+ target: pieSeries
+ signalName: "added"
+ }
+ SignalSpy {
+ id: removedSpy
+ target: pieSeries
+ signalName: "removed"
+ }
+ SignalSpy {
+ id: sumChangedSpy
+ target: pieSeries
+ signalName: "sumChanged"
+ }
+ SignalSpy {
+ id: countChangedSpy
+ target: pieSeries
+ signalName: "countChanged"
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis.qml b/tests/auto/qml-qtquicktest/tst_valueaxis.qml
index 24f61cad..add8ff6c 100644
--- a/tests/auto/qml-qtquicktest/tst_valueaxis.qml
+++ b/tests/auto/qml-qtquicktest/tst_valueaxis.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml b/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml
index 481e9494..e54a81d7 100644
--- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml
+++ b/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.1
+import QtCharts 1.1
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml b/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml
index 24ca3d51..80075ee0 100644
--- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml
+++ b/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.2
+import QtCharts 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml b/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml
index 5bc1acb8..2e9528d2 100644
--- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_4.qml b/tests/auto/qml-qtquicktest/tst_valueaxis_1_4.qml
new file mode 100644
index 00000000..b8bb0da5
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_valueaxis_1_4.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest ValueAxis 1.4"
+ when: windowShown
+
+ // test functions are run in alphabetical order, the name has 'a' so that it
+ // will be the first function to execute.
+ function test_a_properties() {
+ // Default properties
+ verify(axisX.min < 0, "AxisX min");
+ verify(axisX.max > 0, "AxisX max");
+ verify(axisY.min < 0, "AxisY min");
+ verify(axisY.max > 0, "AxisY max");
+ verify(axisX.tickCount == 5, "AxisX tick count");
+ verify(axisY.tickCount == 5, "AxisY tick count");
+ verify(axisX.labelFormat == "", "label format");
+
+ // Modify properties
+ axisX.tickCount = 3;
+ verify(axisX.tickCount == 3, "set tick count");
+ }
+
+ function test_functions() {
+ // Set the axis ranges to not "nice" ones...
+ var min = 0.032456456;
+ var max = 10.67845634;
+ axisX.min = min;
+ axisX.max = max;
+ axisY.min = min;
+ axisY.max = max;
+
+ // ...And then apply nice numbers and verify the range was changed
+ axisX.applyNiceNumbers();
+ axisY.applyNiceNumbers();
+ verify(axisX.min != min);
+ verify(axisX.max != max);
+ verify(axisY.min != min);
+ verify(axisY.max != max);
+ }
+
+ function test_signals() {
+ minChangedSpy.clear();
+ maxChangedSpy.clear();
+ axisX.min = 2;
+ compare(minChangedSpy.count, 1, "onMinChanged");
+ compare(maxChangedSpy.count, 0, "onMaxChanged");
+
+ axisX.max = 8;
+ compare(minChangedSpy.count, 1, "onMinChanged");
+ compare(maxChangedSpy.count, 1, "onMaxChanged");
+
+ // restore original values
+ axisX.min = 0;
+ axisX.max = 10;
+ compare(minChangedSpy.count, 2, "onMinChanged");
+ compare(maxChangedSpy.count, 2, "onMaxChanged");
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ LineSeries {
+ id: lineSeries1
+ axisX: ValueAxis {
+ id: axisX
+ }
+ axisY: ValueAxis {
+ id: axisY
+ }
+ XYPoint { x: -1; y: -1 }
+ XYPoint { x: 0; y: 0 }
+ XYPoint { x: 5; y: 5 }
+ }
+
+ SignalSpy {
+ id: minChangedSpy
+ target: axisX
+ signalName: "minChanged"
+ }
+ SignalSpy {
+ id: maxChangedSpy
+ target: axisX
+ signalName: "maxChanged"
+ }
+ }
+}
diff --git a/tests/auto/qml-qtquicktest/tst_xyseries.qml b/tests/auto/qml-qtquicktest/tst_xyseries.qml
index 383dcc8b..4a2db2e4 100644
--- a/tests/auto/qml-qtquicktest/tst_xyseries.qml
+++ b/tests/auto/qml-qtquicktest/tst_xyseries.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.4
+import QtCharts 2.0
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml b/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml
index dca20ca2..2c9f7024 100644
--- a/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml
+++ b/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.1
+import QtCharts 1.1
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml b/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml
index 5c1390fc..d20d2898 100644
--- a/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml
+++ b/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.2
+import QtCharts 1.2
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml b/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml
index 56130d94..0105dda9 100644
--- a/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml
+++ b/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml
@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtCommercial.Chart 1.3
+import QtCharts 1.3
Rectangle {
width: 400
diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_4.qml b/tests/auto/qml-qtquicktest/tst_xyseries_1_4.qml
new file mode 100644
index 00000000..1da8080b
--- /dev/null
+++ b/tests/auto/qml-qtquicktest/tst_xyseries_1_4.qml
@@ -0,0 +1,262 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Enterprise Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtCharts 1.4
+
+Rectangle {
+ width: 400
+ height: 300
+
+ TestCase {
+ id: tc1
+ name: "tst_qml-qtquicktest XY Series 1.4"
+ when: windowShown
+
+ function test_properties() {
+ verify(lineSeries.color != undefined);
+ compare(lineSeries.pointsVisible, false);
+ compare(lineSeries.capStyle, Qt.SquareCap);
+ compare(lineSeries.style, Qt.SolidLine);
+ compare(lineSeries.width, 2.0);
+
+ verify(splineSeries.color != undefined);
+ compare(splineSeries.pointsVisible, false);
+ compare(splineSeries.capStyle, Qt.SquareCap);
+ compare(splineSeries.style, Qt.SolidLine);
+ compare(splineSeries.width, 2.0);
+
+ verify(scatterSeries.color != undefined);
+ verify(scatterSeries.borderColor != undefined);
+ compare(scatterSeries.borderWidth, 2.0);
+ compare(scatterSeries.markerShape, ScatterSeries.MarkerShapeCircle);
+ compare(scatterSeries.markerSize, 15.0);
+ compare(scatterSeries.brushFilename, "");
+
+ verify(areaSeries.color != undefined);
+ verify(areaSeries.borderColor != undefined);
+ compare(areaSeries.borderWidth, 2.0);
+ compare(areaSeries.brushFilename, "");
+ }
+
+ function test_axes() {
+ // Axis initialization
+ compare(chartView.axisX(), lineSeries.axisX);
+ compare(chartView.axisY(), lineSeries.axisY);
+ compare(lineSeries.axisX, splineSeries.axisX);
+ compare(lineSeries.axisY, splineSeries.axisY);
+ compare(lineSeries.axisX, areaSeries.axisX);
+ compare(lineSeries.axisY, areaSeries.axisY);
+ }
+
+ function test_append() {
+ lineSeriesPointAddedSpy.clear();
+ splineSeriesPointAddedSpy.clear();
+ scatterSeriesPointAddedSpy.clear();
+ var count = append();
+ compare(lineSeries.count, count);
+ compare(splineSeries.count, count);
+ compare(scatterSeries.count, count);
+ compare(lineSeriesPointAddedSpy.count, count);
+ compare(splineSeriesPointAddedSpy.count, count);
+ compare(scatterSeriesPointAddedSpy.count, count);
+ clear();
+ compare(lineSeries.count, 0);
+ compare(splineSeries.count, 0);
+ compare(scatterSeries.count, 0);
+ }
+
+ function test_replace() {
+ var count = append();
+ for (var i = 0; i < count; i++) {
+ lineSeries.replace(lineSeries.at(i).x, lineSeries.at(i).y, i, Math.random());
+ splineSeries.replace(splineSeries.at(i).x, splineSeries.at(i).y, i, Math.random());
+ scatterSeries.replace(scatterSeries.at(i).x, scatterSeries.at(i).y, i, Math.random());
+ }
+ compare(lineSeries.count, count);
+ compare(splineSeries.count, count);
+ compare(scatterSeries.count, count);
+ compare(lineSeriesPointReplacedSpy.count, count);
+ compare(splineSeriesPointReplacedSpy.count, count);
+ compare(scatterSeriesPointReplacedSpy.count, count);
+ clear();
+ }
+
+ function test_insert() {
+ var count = append();
+ lineSeriesPointAddedSpy.clear();
+ splineSeriesPointAddedSpy.clear();
+ scatterSeriesPointAddedSpy.clear();
+ for (var i = 0; i < count; i++) {
+ lineSeries.insert(i * 2, i, Math.random());
+ splineSeries.insert(i * 2, i, Math.random());
+ scatterSeries.insert(i * 2, i, Math.random());
+ }
+ compare(lineSeries.count, count * 2);
+ compare(splineSeries.count, count * 2);
+ compare(scatterSeries.count, count * 2);
+ compare(lineSeriesPointAddedSpy.count, count);
+ compare(splineSeriesPointAddedSpy.count, count);
+ compare(scatterSeriesPointAddedSpy.count, count);
+ clear();
+ }
+
+ function test_remove() {
+ lineSeriesPointRemovedSpy.clear();
+ splineSeriesPointRemovedSpy.clear();
+ scatterSeriesPointRemovedSpy.clear();
+ var count = append();
+ for (var i = 0; i < count; i++) {
+ lineSeries.remove(lineSeries.at(0).x, lineSeries.at(0).y);
+ splineSeries.remove(splineSeries.at(0).x, splineSeries.at(0).y);
+ scatterSeries.remove(scatterSeries.at(0).x, scatterSeries.at(0).y);
+ }
+ compare(lineSeries.count, 0);
+ compare(splineSeries.count, 0);
+ compare(scatterSeries.count, 0);
+ compare(lineSeriesPointRemovedSpy.count, count);
+ compare(splineSeriesPointRemovedSpy.count, count);
+ compare(scatterSeriesPointRemovedSpy.count, count);
+ }
+
+ // Not a test function, called from test functions
+ function append() {
+ var count = 100;
+ chartView.axisX().min = 0;
+ chartView.axisX().max = 100;
+ chartView.axisY().min = 0;
+ chartView.axisY().max = 1;
+
+ for (var i = 0; i < count; i++) {
+ lineSeries.append(i, Math.random());
+ splineSeries.append(i, Math.random());
+ scatterSeries.append(i, Math.random());
+ }
+
+ return count;
+ }
+
+ // Not a test function, called from test functions
+ function clear() {
+ lineSeries.clear();
+ splineSeries.clear();
+ scatterSeries.clear();
+ }
+ }
+
+ ChartView {
+ id: chartView
+ anchors.fill: parent
+
+ LineSeries {
+ id: lineSeries
+ name: "line"
+
+ SignalSpy {
+ id: lineSeriesPointAddedSpy
+ target: lineSeries
+ signalName: "pointAdded"
+ }
+
+ SignalSpy {
+ id: lineSeriesPointReplacedSpy
+ target: lineSeries
+ signalName: "pointReplaced"
+ }
+
+ SignalSpy {
+ id: lineSeriesPointsReplacedSpy
+ target: lineSeries
+ signalName: "pointsReplaced"
+ }
+
+ SignalSpy {
+ id: lineSeriesPointRemovedSpy
+ target: lineSeries
+ signalName: "pointRemoved"
+ }
+ }
+
+ AreaSeries {
+ id: areaSeries
+ name: "area"
+ upperSeries: lineSeries
+ }
+
+ SplineSeries {
+ id: splineSeries
+ name: "spline"
+
+ SignalSpy {
+ id: splineSeriesPointAddedSpy
+ target: splineSeries
+ signalName: "pointAdded"
+ }
+
+ SignalSpy {
+ id: splineSeriesPointReplacedSpy
+ target: splineSeries
+ signalName: "pointReplaced"
+ }
+
+ SignalSpy {
+ id: splineSeriesPointsReplacedSpy
+ target: splineSeries
+ signalName: "pointsReplaced"
+ }
+
+ SignalSpy {
+ id: splineSeriesPointRemovedSpy
+ target: splineSeries
+ signalName: "pointRemoved"
+ }
+ }
+
+ ScatterSeries {
+ id: scatterSeries
+ name: "scatter"
+
+ SignalSpy {
+ id: scatterSeriesPointAddedSpy
+ target: scatterSeries
+ signalName: "pointAdded"
+ }
+
+ SignalSpy {
+ id: scatterSeriesPointReplacedSpy
+ target: scatterSeries
+ signalName: "pointReplaced"
+ }
+
+ SignalSpy {
+ id: scatterSeriesPointsReplacedSpy
+ target: scatterSeries
+ signalName: "pointsReplaced"
+ }
+
+ SignalSpy {
+ id: scatterSeriesPointRemovedSpy
+ target: scatterSeries
+ signalName: "pointRemoved"
+ }
+ }
+ }
+}
diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro
index 144e5db3..f116195d 100644
--- a/tests/auto/qml/qml.pro
+++ b/tests/auto/qml/qml.pro
@@ -2,4 +2,4 @@
error( "Couldn't find the auto.pri file!" )
}
SOURCES += tst_qml.cpp
-QT += declarative
+QT += qml quick
diff --git a/tests/auto/qml/tst_qml.cpp b/tests/auto/qml/tst_qml.cpp
index f33f820b..1078129b 100644
--- a/tests/auto/qml/tst_qml.cpp
+++ b/tests/auto/qml/tst_qml.cpp
@@ -18,12 +18,11 @@
**
****************************************************************************/
#include <QtTest/QtTest>
-#include <QDeclarativeEngine>
-#include <QDeclarativeComponent>
-#include <QDir>
+#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlComponent>
#include "tst_definitions.h"
-class tst_QML : public QObject
+class tst_qml : public QObject
{
Q_OBJECT
@@ -36,57 +35,70 @@ private slots:
void checkPlugin_data();
void checkPlugin();
private:
- QString componentErrors(const QDeclarativeComponent* component) const;
+ QString componentErrors(const QQmlComponent* component) const;
QString imports_1_1();
QString imports_1_3();
+ QString imports_1_4();
+ QString imports_2_0();
};
-QString tst_QML::componentErrors(const QDeclarativeComponent* component) const
+QString tst_qml::componentErrors(const QQmlComponent* component) const
{
Q_ASSERT(component);
QStringList errors;
- foreach (QDeclarativeError const& error, component->errors()) {
+ foreach (QQmlError const& error, component->errors()) {
errors << error.toString();
}
return errors.join("\n");
}
-QString tst_QML::imports_1_1()
+QString tst_qml::imports_1_1()
{
- return "import QtQuick 1.0 \n"
- "import QtCommercial.Chart 1.1 \n";
+ return "import QtQuick 2.0 \n"
+ "import QtCharts 1.1 \n";
}
-QString tst_QML::imports_1_3()
+QString tst_qml::imports_1_3()
{
- return "import QtQuick 1.0 \n"
- "import QtCommercial.Chart 1.3 \n";
+ return "import QtQuick 2.0 \n"
+ "import QtCharts 1.3 \n";
}
+QString tst_qml::imports_1_4()
+{
+ return "import QtQuick 2.0 \n"
+ "import QtCharts 1.4 \n";
+}
+
+QString tst_qml::imports_2_0()
+{
+ return "import QtQuick 2.0 \n"
+ "import QtCharts 2.0 \n";
+}
-void tst_QML::initTestCase()
+void tst_qml::initTestCase()
{
}
-void tst_QML::cleanupTestCase()
+void tst_qml::cleanupTestCase()
{
}
-void tst_QML::init()
+void tst_qml::init()
{
}
-void tst_QML::cleanup()
+void tst_qml::cleanup()
{
}
-void tst_QML::checkPlugin_data()
+void tst_qml::checkPlugin_data()
{
QTest::addColumn<QString>("source");
@@ -121,33 +133,60 @@ void tst_QML::checkPlugin_data()
QTest::newRow("createPolarChartView") << imports_1_3() + "PolarChartView{}";
QTest::newRow("LogValueAxis") << imports_1_3() + "LogValueAxis{}";
+ QTest::newRow("BoxPlotSeries") << imports_1_3() + "BoxPlotSeries{}";
+ QTest::newRow("BoxSet") << imports_1_3() + "BoxSet{}";
+
+ QTest::newRow("createChartView_2_0") << imports_2_0() + "ChartView{}";
+ QTest::newRow("XYPoint_2_0") << imports_2_0() + "XYPoint{}";
+ QTest::newRow("scatterSeries_2_0") << imports_2_0() + "ScatterSeries{}";
+ QTest::newRow("lineSeries_2_0") << imports_2_0() + "LineSeries{}";
+ QTest::newRow("splineSeries_2_0") << imports_2_0() + "SplineSeries{}";
+ QTest::newRow("areaSeries_2_0") << imports_2_0() + "AreaSeries{}";
+ QTest::newRow("barSeries_2_0") << imports_2_0() + "BarSeries{}";
+ QTest::newRow("stackedBarSeries_2_0") << imports_2_0() + "StackedBarSeries{}";
+ QTest::newRow("precentBarSeries_2_0") << imports_2_0() + "PercentBarSeries{}";
+ QTest::newRow("horizonatlBarSeries_2_0") << imports_2_0() + "HorizontalBarSeries{}";
+ QTest::newRow("horizonatlStackedBarSeries_2_0")
+ << imports_2_0() + "HorizontalStackedBarSeries{}";
+ QTest::newRow("horizonatlstackedBarSeries_2_0")
+ << imports_2_0() + "HorizontalPercentBarSeries{}";
+ QTest::newRow("pieSeries_2_0") << imports_2_0() + "PieSeries{}";
+ QTest::newRow("PieSlice_2_0") << imports_2_0() + "PieSlice{}";
+ QTest::newRow("BarSet_2_0") << imports_2_0() + "BarSet{}";
+ QTest::newRow("HXYModelMapper_2_0") << imports_2_0() + "HXYModelMapper{}";
+ QTest::newRow("VXYModelMapper_2_0") << imports_2_0() + "VXYModelMapper{}";
+ QTest::newRow("HPieModelMapper_2_0") << imports_2_0() + "HPieModelMapper{}";
+ QTest::newRow("HPieModelMapper_2_0") << imports_2_0() + "HPieModelMapper{}";
+ QTest::newRow("HBarModelMapper_2_0") << imports_2_0() + "HBarModelMapper{}";
+ QTest::newRow("VBarModelMapper_2_0") << imports_2_0() + "VBarModelMapper{}";
+ QTest::newRow("ValueAxis_2_0") << imports_2_0() + "ValueAxis{}";
+#ifndef QT_ON_ARM
+ QTest::newRow("DateTimeAxis_2_0") << imports_2_0() + "DateTimeAxis{}";
+#endif
+ QTest::newRow("CategoryAxis_2_0") << imports_2_0() + "CategoryAxis{}";
+ QTest::newRow("CategoryRange_2_0") << imports_2_0() + "CategoryRange{}";
+ QTest::newRow("BarCategoryAxis_2_0") << imports_2_0() + "BarCategoryAxis{}";
+ QTest::newRow("createPolarChartView_2_0") << imports_2_0() + "PolarChartView{}";
+ QTest::newRow("LogValueAxis_2_0") << imports_2_0() + "LogValueAxis{}";
+ QTest::newRow("BoxPlotSeries_2_0") << imports_2_0() + "BoxPlotSeries{}";
+ QTest::newRow("BoxSet_2_0") << imports_2_0() + "BoxSet{}";
}
-void tst_QML::checkPlugin()
+void tst_qml::checkPlugin()
{
QFETCH(QString, source);
- QDeclarativeEngine engine;
-#ifdef Q_OS_ANDROID
- engine.addImportPath(QString::fromLatin1("assets:/imports"));
- engine.addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
-#endif
- QDeclarativeComponent component(&engine);
+ QQmlEngine engine;
+ engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("qml")));
+ QQmlComponent component(&engine);
component.setData(source.toLatin1(), QUrl());
QVERIFY2(!component.isError(), qPrintable(componentErrors(&component)));
- TRY_COMPARE(component.status(), QDeclarativeComponent::Ready);
+ TRY_COMPARE(component.status(), QQmlComponent::Ready);
QObject *obj = component.create();
QVERIFY(obj != 0);
-
- //
- //TODO:
- // QCOMPARE(obj->property("something").toInt(), 0);
-
delete obj;
}
-QTEST_MAIN(tst_QML)
+QTEST_MAIN(tst_qml)
#include "tst_qml.moc"
diff --git a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp
index caf3eaba..dbe768e9 100644
--- a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp
+++ b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp
@@ -25,7 +25,7 @@
#include <qchart.h>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
diff --git a/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp b/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp
index 0b672e40..28cf4a29 100644
--- a/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp
+++ b/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp
@@ -29,7 +29,7 @@
#include <qhpiemodelmapper.h>
#include <QStandardItemModel>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class tst_qpiemodelmapper : public QObject
{
diff --git a/tests/auto/qpieseries/tst_qpieseries.cpp b/tests/auto/qpieseries/tst_qpieseries.cpp
index 06e7022b..3b8f2adb 100644
--- a/tests/auto/qpieseries/tst_qpieseries.cpp
+++ b/tests/auto/qpieseries/tst_qpieseries.cpp
@@ -27,7 +27,7 @@
#include <QStandardItemModel>
#include <tst_definitions.h>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(QPieSlice*)
Q_DECLARE_METATYPE(QList<QPieSlice*>)
diff --git a/tests/auto/qpieslice/tst_qpieslice.cpp b/tests/auto/qpieslice/tst_qpieslice.cpp
index 678bf911..3ad5c47d 100644
--- a/tests/auto/qpieslice/tst_qpieslice.cpp
+++ b/tests/auto/qpieslice/tst_qpieslice.cpp
@@ -25,7 +25,7 @@
#include <qpieslice.h>
#include <qpieseries.h>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class tst_qpieslice : public QObject
{
diff --git a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp
index 6285aaa1..868a61a1 100644
--- a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp
+++ b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp
@@ -25,7 +25,7 @@
#include <qchart.h>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
Q_DECLARE_METATYPE(QBarSet*)
Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition)
diff --git a/tests/auto/quick2/quick2.pro b/tests/auto/quick2/quick2.pro
deleted file mode 100644
index 93f8fdfe..00000000
--- a/tests/auto/quick2/quick2.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-!include( ../auto.pri ) {
- error( "Couldn't find the auto.pri file!" )
-}
-SOURCES += tst_quick2.cpp
-QT += qml quick
diff --git a/tests/auto/quick2/tst_quick2.cpp b/tests/auto/quick2/tst_quick2.cpp
deleted file mode 100644
index 67b1b2da..00000000
--- a/tests/auto/quick2/tst_quick2.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtTest/QtTest>
-#include <QtQml/QQmlEngine>
-#include <QtQml/QQmlComponent>
-#include "tst_definitions.h"
-
-class tst_quick2 : public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-private slots:
- void checkPlugin_data();
- void checkPlugin();
-private:
- QString componentErrors(const QQmlComponent* component) const;
- QString imports_1_1();
- QString imports_1_3();
-
-};
-
-QString tst_quick2::componentErrors(const QQmlComponent* component) const
-{
- Q_ASSERT(component);
-
- QStringList errors;
-
- foreach (QQmlError const& error, component->errors()) {
- errors << error.toString();
- }
-
- return errors.join("\n");
-}
-
-QString tst_quick2::imports_1_1()
-{
- return "import QtQuick 2.0 \n"
- "import QtCommercial.Chart 1.1 \n";
-}
-
-QString tst_quick2::imports_1_3()
-{
- return "import QtQuick 2.0 \n"
- "import QtCommercial.Chart 1.3 \n";
-}
-
-
-void tst_quick2::initTestCase()
-{
-}
-
-void tst_quick2::cleanupTestCase()
-{
-}
-
-void tst_quick2::init()
-{
-
-}
-
-void tst_quick2::cleanup()
-{
-
-}
-
-void tst_quick2::checkPlugin_data()
-{
- QTest::addColumn<QString>("source");
-
- QTest::newRow("createChartView") << imports_1_1() + "ChartView{}";
- QTest::newRow("XYPoint") << imports_1_1() + "XYPoint{}";
- QTest::newRow("scatterSeries") << imports_1_1() + "ScatterSeries{}";
- QTest::newRow("lineSeries") << imports_1_1() + "LineSeries{}";
- QTest::newRow("splineSeries") << imports_1_1() + "SplineSeries{}";
- QTest::newRow("areaSeries") << imports_1_1() + "AreaSeries{}";
- QTest::newRow("barSeries") << imports_1_1() + "BarSeries{}";
- QTest::newRow("stackedBarSeries") << imports_1_1() + "StackedBarSeries{}";
- QTest::newRow("precentBarSeries") << imports_1_1() + "PercentBarSeries{}";
- QTest::newRow("horizonatlBarSeries") << imports_1_1() + "HorizontalBarSeries{}";
- QTest::newRow("horizonatlStackedBarSeries") << imports_1_1() + "HorizontalStackedBarSeries{}";
- QTest::newRow("horizonatlstackedBarSeries") << imports_1_1() + "HorizontalPercentBarSeries{}";
- QTest::newRow("pieSeries") << imports_1_1() + "PieSeries{}";
- QTest::newRow("PieSlice") << imports_1_1() + "PieSlice{}";
- QTest::newRow("BarSet") << imports_1_1() + "BarSet{}";
- QTest::newRow("HXYModelMapper") << imports_1_1() + "HXYModelMapper{}";
- QTest::newRow("VXYModelMapper") << imports_1_1() + "VXYModelMapper{}";
- QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}";
- QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}";
- QTest::newRow("HBarModelMapper") << imports_1_1() + "HBarModelMapper{}";
- QTest::newRow("VBarModelMapper") << imports_1_1() + "VBarModelMapper{}";
- QTest::newRow("ValueAxis") << imports_1_1() + "ValueAxis{}";
-#ifndef QT_ON_ARM
- QTest::newRow("DateTimeAxis") << imports_1_1() + "DateTimeAxis{}";
-#endif
- QTest::newRow("CategoryAxis") << imports_1_1() + "CategoryAxis{}";
- QTest::newRow("CategoryRange") << imports_1_1() + "CategoryRange{}";
- QTest::newRow("BarCategoryAxis") << imports_1_1() + "BarCategoryAxis{}";
-
- QTest::newRow("createPolarChartView") << imports_1_3() + "PolarChartView{}";
- QTest::newRow("LogValueAxis") << imports_1_3() + "LogValueAxis{}";
-}
-
-void tst_quick2::checkPlugin()
-{
- QFETCH(QString, source);
- QQmlEngine engine;
- engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("qml")));
- QQmlComponent component(&engine);
- component.setData(source.toLatin1(), QUrl());
- QVERIFY2(!component.isError(), qPrintable(componentErrors(&component)));
- TRY_COMPARE(component.status(), QQmlComponent::Ready);
- QObject *obj = component.create();
- QVERIFY(obj != 0);
- delete obj;
-}
-
-QTEST_MAIN(tst_quick2)
-
-#include "tst_quick2.moc"
-
diff --git a/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp b/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp
index e0b17f29..5431d5cf 100644
--- a/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp
+++ b/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp
@@ -30,7 +30,7 @@
#include <QStandardItemModel>
#include "tst_definitions.h"
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class tst_qxymodelmapper : public QObject
{
diff --git a/tests/auto/qxyseries/tst_qxyseries.h b/tests/auto/qxyseries/tst_qxyseries.h
index 0fad782c..58d6a5c6 100644
--- a/tests/auto/qxyseries/tst_qxyseries.h
+++ b/tests/auto/qxyseries/tst_qxyseries.h
@@ -27,7 +27,7 @@
#include <QStandardItemModel>
#include <tst_definitions.h>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class tst_QXYSeries : public QObject
{
diff --git a/tests/boxplottester/main.cpp b/tests/boxplottester/main.cpp
index cb2fd866..6d136669 100644
--- a/tests/boxplottester/main.cpp
+++ b/tests/boxplottester/main.cpp
@@ -19,11 +19,7 @@
****************************************************************************/
#include <QtCore/QtGlobal>
-#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
-#include <QApplication>
-#else
#include <QtWidgets/QApplication>
-#endif
#include "mainwidget.h"
int main(int argc, char *argv[])
diff --git a/tests/boxplottester/mainwidget.cpp b/tests/boxplottester/mainwidget.cpp
index fb68a296..3421de05 100644
--- a/tests/boxplottester/mainwidget.cpp
+++ b/tests/boxplottester/mainwidget.cpp
@@ -46,7 +46,7 @@
#include <QBarCategoryAxis>
#include <QLogValueAxis>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
static const QString allCategories[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
static const int maxCategories = 12;
@@ -129,13 +129,8 @@ MainWidget::MainWidget(QWidget *parent) :
tableView->setModel(m_model);
tableView->setMaximumWidth(200);
grid->addWidget(tableView, m_rowPos++, 0, 3, 2, Qt::AlignLeft);
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
-#else
- tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
- tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
-#endif
// add row with empty label to make all the other rows static
grid->addWidget(new QLabel(""), grid->rowCount(), 0);
diff --git a/tests/boxplottester/mainwidget.h b/tests/boxplottester/mainwidget.h
index 2c9ab5b3..3c78ffd2 100644
--- a/tests/boxplottester/mainwidget.h
+++ b/tests/boxplottester/mainwidget.h
@@ -35,7 +35,7 @@
class QGridLayout;
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class MainWidget : public QWidget
{
diff --git a/tests/chartdesigner/engine.cpp b/tests/chartdesigner/engine.cpp
index d8b8b70b..ac113ed5 100644
--- a/tests/chartdesigner/engine.cpp
+++ b/tests/chartdesigner/engine.cpp
@@ -163,7 +163,7 @@ void Engine::removeSeries(QAbstractSeries* series)
m_chart->removeSeries(series);
foreach (const QModelIndex& index, m_seriesModelIndex.value(series)) {
- m_model->setData(index, Qt::white, Qt::BackgroundRole);
+ m_model->setData(index, QColor(Qt::white), Qt::BackgroundRole);
}
}
diff --git a/tests/chartdesigner/engine.h b/tests/chartdesigner/engine.h
index 29e85955..96323592 100644
--- a/tests/chartdesigner/engine.h
+++ b/tests/chartdesigner/engine.h
@@ -29,15 +29,15 @@ class QStandardItemModel;
class QItemSelectionModel;
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
+QT_CHARTS_BEGIN_NAMESPACE
class QChart;
class QXYSeries;
class QAbstractBarSeries;
class QPieSeries;
class QAreaSeries;
-QTCOMMERCIALCHART_END_NAMESPACE
+QT_CHARTS_END_NAMESPACE
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class Engine : public QObject
{
diff --git a/tests/chartdesigner/mainwindow.cpp b/tests/chartdesigner/mainwindow.cpp
index e84c0d43..0527bdd1 100644
--- a/tests/chartdesigner/mainwindow.cpp
+++ b/tests/chartdesigner/mainwindow.cpp
@@ -203,7 +203,7 @@ void MainWindow::createDockWidgets()
void MainWindow::createLayout()
{
- m_table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
+ m_table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
int rowHeight = m_table->rowHeight(0);
int tableHeight = (m_engine->modelCount() * rowHeight) + m_table->horizontalHeader()->height() + 2 * m_table->frameWidth();
diff --git a/tests/chartdesigner/mainwindow.h b/tests/chartdesigner/mainwindow.h
index da03b2b4..6f21b166 100644
--- a/tests/chartdesigner/mainwindow.h
+++ b/tests/chartdesigner/mainwindow.h
@@ -26,10 +26,10 @@
#include <QMap>
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
+QT_CHARTS_BEGIN_NAMESPACE
class QChartView;
class QAbstractSeries;
-QTCOMMERCIALCHART_END_NAMESPACE
+QT_CHARTS_END_NAMESPACE
class QGraphicsScene;
class InspectorWidget;
@@ -38,7 +38,7 @@ class PenWidget;
class QTableView;
class Engine;
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class MainWindow : public QMainWindow
{
diff --git a/tests/chartviewer/charts.h b/tests/chartviewer/charts.h
index 9bc20ef1..ab25467f 100644
--- a/tests/chartviewer/charts.h
+++ b/tests/chartviewer/charts.h
@@ -26,11 +26,11 @@
#include <QString>
#include <qchartglobal.h>
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
+QT_CHARTS_BEGIN_NAMESPACE
class QChart;
-QTCOMMERCIALCHART_END_NAMESPACE
+QT_CHARTS_END_NAMESPACE
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class Chart
{
diff --git a/tests/chartviewer/chartviewer.pro b/tests/chartviewer/chartviewer.pro
index 3ab604c8..c306252a 100644
--- a/tests/chartviewer/chartviewer.pro
+++ b/tests/chartviewer/chartviewer.pro
@@ -1,4 +1,4 @@
-!include( ../tests.pri ):error( "Couldn't find the demos.pri file!" )
+!include( ../tests.pri ):error( "Couldn't find the tests.pri file!" )
include(charts/charts.pri)
TARGET = chartviewer
QT += opengl
diff --git a/tests/chartviewer/grid.h b/tests/chartviewer/grid.h
index 56d5f065..276fcceb 100644
--- a/tests/chartviewer/grid.h
+++ b/tests/chartviewer/grid.h
@@ -28,11 +28,11 @@
class QGraphicsGridLayout;
class Chart;
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
+QT_CHARTS_BEGIN_NAMESPACE
class QChart;
-QTCOMMERCIALCHART_END_NAMESPACE
+QT_CHARTS_END_NAMESPACE
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class Grid : public QGraphicsWidget
{
diff --git a/tests/chartviewer/window.h b/tests/chartviewer/window.h
index 02d5a39e..53fa7171 100644
--- a/tests/chartviewer/window.h
+++ b/tests/chartviewer/window.h
@@ -35,11 +35,11 @@ class Chart;
class Grid;
class QPushButton;
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
+QT_CHARTS_BEGIN_NAMESPACE
class QChart;
-QTCOMMERCIALCHART_END_NAMESPACE
+QT_CHARTS_END_NAMESPACE
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class Window: public QMainWindow
diff --git a/tests/chartwidgettest/main.cpp b/tests/chartwidgettest/main.cpp
index cb2fd866..6d136669 100644
--- a/tests/chartwidgettest/main.cpp
+++ b/tests/chartwidgettest/main.cpp
@@ -19,11 +19,7 @@
****************************************************************************/
#include <QtCore/QtGlobal>
-#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
-#include <QApplication>
-#else
#include <QtWidgets/QApplication>
-#endif
#include "mainwidget.h"
int main(int argc, char *argv[])
diff --git a/tests/chartwidgettest/mainwidget.cpp b/tests/chartwidgettest/mainwidget.cpp
index 72c98b60..76676a93 100644
--- a/tests/chartwidgettest/mainwidget.cpp
+++ b/tests/chartwidgettest/mainwidget.cpp
@@ -45,7 +45,7 @@
#include <QBarCategoryAxis>
#include <QGLWidget>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent),
@@ -322,6 +322,7 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
for (int j(0); j < data.count(); j ++) {
QList<qreal> column = data.at(j);
QSplineSeries *series = new QSplineSeries();
+ series->setName("spline" + QString::number(j));
for (int i(0); i < column.count(); i++)
series->append(i, column.at(i));
m_chart->addSeries(series);
diff --git a/tests/chartwidgettest/mainwidget.h b/tests/chartwidgettest/mainwidget.h
index 381add28..49d36518 100644
--- a/tests/chartwidgettest/mainwidget.h
+++ b/tests/chartwidgettest/mainwidget.h
@@ -30,7 +30,7 @@ class QSpinBox;
class QCheckBox;
class QGridLayout;
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
#define RealList QList<qreal>
class DataSerieDialog;
diff --git a/tests/polarcharttest/chartview.cpp b/tests/polarcharttest/chartview.cpp
index 558ae3c1..f0d72994 100644
--- a/tests/polarcharttest/chartview.cpp
+++ b/tests/polarcharttest/chartview.cpp
@@ -23,7 +23,7 @@
#include <QDebug>
#include <QAbstractAxis>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
ChartView::ChartView(QWidget *parent) :
QChartView(parent)
diff --git a/tests/polarcharttest/chartview.h b/tests/polarcharttest/chartview.h
index 58fcf9fc..550e8d83 100644
--- a/tests/polarcharttest/chartview.h
+++ b/tests/polarcharttest/chartview.h
@@ -24,7 +24,7 @@
#include <QChartView>
#include <QPolarChart>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class ChartView : public QChartView
{
diff --git a/tests/polarcharttest/mainwindow.cpp b/tests/polarcharttest/mainwindow.cpp
index 0307ec1a..e1dddcc9 100644
--- a/tests/polarcharttest/mainwindow.cpp
+++ b/tests/polarcharttest/mainwindow.cpp
@@ -35,7 +35,7 @@
#include <qmath.h>
#include <QDateTime>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
diff --git a/tests/polarcharttest/mainwindow.h b/tests/polarcharttest/mainwindow.h
index cff0bbf7..c16a292e 100644
--- a/tests/polarcharttest/mainwindow.h
+++ b/tests/polarcharttest/mainwindow.h
@@ -34,7 +34,7 @@ namespace Ui {
class MainWindow;
}
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class QBrush;
class QPen;
diff --git a/tests/presenterchart/chartview.h b/tests/presenterchart/chartview.h
index 5b0b20fd..8753a11b 100644
--- a/tests/presenterchart/chartview.h
+++ b/tests/presenterchart/chartview.h
@@ -24,7 +24,7 @@
#include <QChartView>
#include <QTimer>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
//![1]
class ChartView: public QChartView
diff --git a/tests/qmlchartaxis/main.cpp b/tests/qmlchartaxis/main.cpp
index 01aad92d..fb4d56f8 100644
--- a/tests/qmlchartaxis/main.cpp
+++ b/tests/qmlchartaxis/main.cpp
@@ -19,24 +19,30 @@
****************************************************************************/
#include <QApplication>
-#include <QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
+#include <QtCore/QDir>
+#include <QtQuick/QQuickView>
+#include <QtQml/QQmlEngine>
-Q_DECL_EXPORT int main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
- // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmlchartaxis/main.qml"));
- viewer->showExpanded();
+ viewer.setSource(QUrl("qrc:/qml/qmlchartaxis/main.qml"));
+ viewer.show();
- return app->exec();
+ return app.exec();
}
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/Button.qml b/tests/qmlchartaxis/qml/qmlchartaxis/Button.qml
index 0c8b2017..61df081d 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/Button.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/Button.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Rectangle {
id: button
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxes.qml b/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxes.qml
index 9ca03542..69250a39 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxes.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxes.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
id: chartView
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxesRevert.qml b/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxesRevert.qml
index d33232fe..524e3314 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxesRevert.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxesRevert.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
id: chartView
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/ConfiguringDynamically.qml b/tests/qmlchartaxis/qml/qmlchartaxis/ConfiguringDynamically.qml
index 92b0fd19..9e24b47b 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/ConfiguringDynamically.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/ConfiguringDynamically.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "configuring dynamically"
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/CreatingDynamically.qml b/tests/qmlchartaxis/qml/qmlchartaxis/CreatingDynamically.qml
index 430862f1..209ef372 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/CreatingDynamically.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/CreatingDynamically.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
id: chartView
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAndUserDefined.qml b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAndUserDefined.qml
index aee18c00..2cab44fd 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAndUserDefined.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAndUserDefined.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "default + user defined"
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxes.qml b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxes.qml
index 06ba224a..f06dd7cf 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxes.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxes.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
id: chartView
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxesRevert.qml b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxesRevert.qml
index 273db92e..67685082 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxesRevert.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxesRevert.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
id: chartView
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/Legacy.qml b/tests/qmlchartaxis/qml/qmlchartaxis/Legacy.qml
index 74e62f2d..caafabb7 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/Legacy.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/Legacy.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
id: chartView
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/SeriesSpecificDynamic.qml b/tests/qmlchartaxis/qml/qmlchartaxis/SeriesSpecificDynamic.qml
index 91d562e0..c9ac5d92 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/SeriesSpecificDynamic.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/SeriesSpecificDynamic.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "series specific dynamic axes"
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/SwitchingDynamically.qml b/tests/qmlchartaxis/qml/qmlchartaxis/SwitchingDynamically.qml
index ef08fe51..db11c9ee 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/SwitchingDynamically.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/SwitchingDynamically.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
id: chartView
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/UserDefined.qml b/tests/qmlchartaxis/qml/qmlchartaxis/UserDefined.qml
index 1e42017f..f87c18cb 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/UserDefined.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/UserDefined.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "user defined"
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/UserDefinedRevert.qml b/tests/qmlchartaxis/qml/qmlchartaxis/UserDefinedRevert.qml
index d1b3fce1..ea625c22 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/UserDefinedRevert.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/UserDefinedRevert.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "user defined reverted"
diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/main.qml b/tests/qmlchartaxis/qml/qmlchartaxis/main.qml
index fa718a46..f973bf7a 100644
--- a/tests/qmlchartaxis/qml/qmlchartaxis/main.qml
+++ b/tests/qmlchartaxis/qml/qmlchartaxis/main.qml
@@ -18,12 +18,12 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Rectangle {
id: main
- width: 400
- height: 300
+ width: 500
+ height: 400
property string viewName: "DefaultAxes"
Row {
diff --git a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.pri b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/tests/qmlchartaxis/qmlchartaxis.pro b/tests/qmlchartaxis/qmlchartaxis.pro
index 73a305c9..0abc1d4a 100644
--- a/tests/qmlchartaxis/qmlchartaxis.pro
+++ b/tests/qmlchartaxis/qmlchartaxis.pro
@@ -6,4 +6,3 @@ RESOURCES += resources.qrc
SOURCES += main.cpp
OTHER_FILES += qml/qmlchartaxis/*
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/tests/qmlchartproperties/main.cpp b/tests/qmlchartproperties/main.cpp
index 85f99adb..6eb3c801 100644
--- a/tests/qmlchartproperties/main.cpp
+++ b/tests/qmlchartproperties/main.cpp
@@ -19,25 +19,31 @@
****************************************************************************/
#include <QApplication>
-#include <QDeclarativeEngine>
-#include <QDir>
-#include "qmlapplicationviewer.h"
+#include <QtCore/QDir>
+#include <QtQuick/QQuickView>
+#include <QtQml/QQmlEngine>
-Q_DECL_EXPORT int main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
- QScopedPointer<QApplication> app(createApplication(argc, argv));
- QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
-#ifdef Q_OS_ANDROID
- viewer->addImportPath(QString::fromLatin1("assets:/imports"));
- viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
+ // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used.
+ QApplication app(argc, argv);
+
+ QQuickView viewer;
+
+ // The following are needed to make examples run without having to install the module
+ // in desktop environments.
+#ifdef Q_OS_WIN
+ QString extraImportPath(QStringLiteral("%1/../../../../%2"));
#else
- viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports")));
+ QString extraImportPath(QStringLiteral("%1/../../../%2"));
#endif
+ viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(),
+ QString::fromLatin1("qml")));
+ QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close);
- // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer->setSource(QUrl("qrc:/qml/qmlchartproperties/loader.qml"));
- viewer->setRenderHint(QPainter::Antialiasing, true);
- viewer->showExpanded();
+ viewer.setSource(QUrl("qrc:/qml/qmlchartproperties/main.qml"));
+ viewer.setResizeMode(QQuickView::SizeRootObjectToView);
+ viewer.show();
- return app->exec();
+ return app.exec();
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml
index 46959f7d..069e17de 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "area series"
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml
index 69b2761a..168dc957 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Flow {
id: flow
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml
index d0e34326..ad088646 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "Bar series"
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml
index 439d7f9e..cdd847a5 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Row {
anchors.fill: parent
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/Button.qml b/tests/qmlchartproperties/qml/qmlchartproperties/Button.qml
index 0c8b2017..61df081d 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/Button.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/Button.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Rectangle {
id: button
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml
index 57d7407e..3f30ea44 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.3
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
id: chartView
@@ -78,7 +78,7 @@ ChartView {
onMinChanged: console.log("axisX.onMinChanged: " + min);
onMaxChanged: console.log("axisX.onMaxChanged: " + max);
}
-
+
ValueAxis{
onColorChanged: console.log("axisY.onColorChanged: " + color);
onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml
index f31b6a4c..87139f35 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Item {
id: chartEditor
@@ -84,7 +84,7 @@ Item {
onClicked: {
selectButton(axisXButton);
loader.source = "ChartEditorAxis.qml";
- loader.item.axis = chart.axisX;
+ loader.item.axis = chart.axisX();
}
}
Button {
@@ -94,7 +94,7 @@ Item {
onClicked: {
selectButton(axisYButton);
loader.source = "ChartEditorAxis.qml";
- loader.item.axis = chart.axisY;
+ loader.item.axis = chart.axisY();
}
}
Button {
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml
index ecd8d0a7..0c6d8dce 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Row {
anchors.fill: parent
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml
index 0c5ecd5b..24ffd9ef 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Row {
anchors.fill: parent
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml
index 5c8db45f..d172e4d8 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Flow {
anchors.fill: parent
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorSeries.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorSeries.qml
index 32c88a49..e7efc222 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorSeries.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorSeries.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
Flow {
anchors.fill: parent
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml
index 42babc29..61b4365f 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Flow {
property variant chart
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml
index 0ce70d95..3531597f 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Flow {
flow: Flow.TopToBottom
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml
index 7d24d2e6..aedb26cb 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "Bar series"
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml
index 70324888..c0d1b443 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "Percent bar series"
@@ -33,6 +33,7 @@ ChartView {
HorizontalPercentBarSeries {
id: mySeries
name: "bar"
+ labelsFormat: "@value";
axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
onClicked: console.log("barset.onClicked: " + index);
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml
index 0367037b..3b94e89d 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "Stacked bar series"
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml
index dedeebcb..de3134a8 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
property variant series: lineSeries
@@ -73,5 +73,6 @@ ChartView {
XYPoint { x: 3.4; y: 2.0 }
XYPoint { x: 4.1; y: 2.3 }
onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
+ onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
}
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
index f49dddcc..7960b4a1 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Flow {
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml
index a9879c59..74c9b88f 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "Percent bar series"
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml
index 37da01ce..37a321ae 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
id: chart
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml
index 60f3a659..91eb0343 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.1
+import QtQuick 2.0
+import QtCharts 2.0
Row {
anchors.fill: parent
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml
index cd898914..d531ac32 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "scatter series"
@@ -43,6 +43,7 @@ ChartView {
onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
+ onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
onPointReplaced: console.log("scatterSeries.onPointReplaced: " + index);
onPointRemoved: console.log("scatterSeries.onPointRemoved: " + index);
onPointAdded: console.log("scatterSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y);
@@ -69,5 +70,6 @@ ChartView {
XYPoint { x: 2.4; y: 2.7 }
XYPoint { x: 2.67; y: 2.65 }
onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
+ onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
}
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
index 753ab197..23afdb75 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml
@@ -18,7 +18,7 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Flow {
id: flow
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml
index 5f534b97..3a182d19 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "spline series"
@@ -44,6 +44,7 @@ ChartView {
onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible);
onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
+ onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
onPointReplaced: console.log("splineSeries.onPointReplaced: " + index);
onPointRemoved: console.log("splineSeries.onPointRemoved: " + index);
onPointAdded: console.log("splineSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y);
@@ -71,5 +72,6 @@ ChartView {
XYPoint { x: 3.4; y: 2.0 }
XYPoint { x: 4.1; y: 2.3 }
onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
+ onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
}
}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml
index 5757a95c..a59f0e12 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml
@@ -18,8 +18,8 @@
**
****************************************************************************/
-import QtQuick 1.0
-import QtCommercial.Chart 1.4
+import QtQuick 2.0
+import QtCharts 2.0
ChartView {
title: "Stacked bar series"
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/loader.qml b/tests/qmlchartproperties/qml/qmlchartproperties/loader.qml
deleted file mode 100644
index c04db7ff..00000000
--- a/tests/qmlchartproperties/qml/qmlchartproperties/loader.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-
-Item {
- id: container
- width: 640
- height: 500
- Component.onCompleted: {
- var co = Qt.createComponent("main.qml")
- if (co.status == Component.Ready) {
- var o = co.createObject(container)
- } else {
- console.log(co.errorString())
- console.log("QtCommercial.Chart 1.1 not available")
- console.log("Please use correct QML_IMPORT_PATH export")
- }
- }
-}
diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/main.qml b/tests/qmlchartproperties/qml/qmlchartproperties/main.qml
index 9d5334f6..8265e1ae 100644
--- a/tests/qmlchartproperties/qml/qmlchartproperties/main.qml
+++ b/tests/qmlchartproperties/qml/qmlchartproperties/main.qml
@@ -18,12 +18,12 @@
**
****************************************************************************/
-import QtQuick 1.0
+import QtQuick 2.0
Rectangle {
id: main
- width: parent.width
- height: parent.height
+ width: 800
+ height: 600
property int viewCount: 9
property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"]
property int colorIndex: 0
diff --git a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index cb227056..00000000
--- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xaa72 version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qmlapplicationviewer.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QApplication>
-#include <QDeclarativeComponent>
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-
-#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
-
-#ifdef HARMATTAN_BOOSTER
-#include <MDeclarativeCache>
-#endif
-
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-
-#include <qt_private/qdeclarativedebughelper_p.h>
-
-#if !defined(NO_JSDEBUGGER)
-#include <jsdebuggeragent.h>
-#endif
-#if !defined(NO_QMLOBSERVER)
-#include <qdeclarativeviewobserver.h>
-#endif
-
-// Enable debugging before any QDeclarativeEngine is created
-struct QmlJsDebuggingEnabler
-{
- QmlJsDebuggingEnabler()
- {
- QDeclarativeDebugHelper::enableDebugging();
- }
-};
-
-// Execute code in constructor before first QDeclarativeEngine is instantiated
-static QmlJsDebuggingEnabler enableDebuggingHelper;
-
-#endif // QMLJSDEBUGGER
-
-class QmlApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QmlApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#ifdef Q_OS_MAC
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#endif
- return path;
-}
-
-QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
- : QDeclarativeView(parent)
- , d(new QmlApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QDeclarativeView::SizeRootObjectToView);
-
- // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
-#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
-#if !defined(NO_JSDEBUGGER)
- new QmlJSDebugger::JSDebuggerAgent(engine());
-#endif
-#if !defined(NO_QMLOBSERVER)
- new QmlJSDebugger::QDeclarativeViewObserver(this, this);
-#endif
-#endif
-}
-
-QmlApplicationViewer::~QmlApplicationViewer()
-{
- delete d;
-}
-
-QmlApplicationViewer *QmlApplicationViewer::create()
-{
- return new QmlApplicationViewer();
-}
-
-void QmlApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
-#ifdef Q_OS_ANDROID
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QmlApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
-}
-
-void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
-{
-#if QT_VERSION < 0x050000
- Qt::WidgetAttribute attribute;
- switch (orientation) {
-#if QT_VERSION < 0x040702
- // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
- case ScreenOrientationLockPortrait:
- attribute = static_cast<Qt::WidgetAttribute>(128);
- break;
- case ScreenOrientationLockLandscape:
- attribute = static_cast<Qt::WidgetAttribute>(129);
- break;
- default:
- case ScreenOrientationAuto:
- attribute = static_cast<Qt::WidgetAttribute>(130);
- break;
-#else // QT_VERSION < 0x040702
- case ScreenOrientationLockPortrait:
- attribute = Qt::WA_LockPortraitOrientation;
- break;
- case ScreenOrientationLockLandscape:
- attribute = Qt::WA_LockLandscapeOrientation;
- break;
- default:
- case ScreenOrientationAuto:
- attribute = Qt::WA_AutoOrientation;
- break;
-#endif // QT_VERSION < 0x040702
- };
- setAttribute(attribute, true);
-#else // QT_VERSION < 0x050000
- Q_UNUSED(orientation)
-#endif // QT_VERSION < 0x050000
-}
-
-void QmlApplicationViewer::showExpanded()
-{
-#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
- showFullScreen();
-#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
- showMaximized();
-#else
- show();
-#endif
-}
-
-QApplication *createApplication(int &argc, char **argv)
-{
-#ifdef HARMATTAN_BOOSTER
- return MDeclarativeCache::qApplication(argc, argv);
-#else
- return new QApplication(argc, argv);
-#endif
-}
diff --git a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index adcb232f..00000000
--- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x90018
-/*
- This file was generated by the Qt Quick Application wizard of Qt Creator.
- QmlApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QMLAPPLICATIONVIEWER_H
-#define QMLAPPLICATIONVIEWER_H
-
-#include <QDeclarativeView>
-
-class QmlApplicationViewer : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- enum ScreenOrientation {
- ScreenOrientationLockPortrait,
- ScreenOrientationLockLandscape,
- ScreenOrientationAuto
- };
-
- explicit QmlApplicationViewer(QWidget *parent = 0);
- virtual ~QmlApplicationViewer();
-
- static QmlApplicationViewer *create();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- // Note that this will only have an effect on Fremantle.
- void setOrientation(ScreenOrientation orientation);
-
- void showExpanded();
-
-private:
- class QmlApplicationViewerPrivate *d;
-};
-
-QApplication *createApplication(int &argc, char **argv);
-
-#endif // QMLAPPLICATIONVIEWER_H
diff --git a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.pri b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,13 +0,0 @@
-QT += declarative
-
-SOURCES += $$PWD/qmlapplicationviewer.cpp
-HEADERS += $$PWD/qmlapplicationviewer.h
-INCLUDEPATH += $$PWD
-
-# Include JS debugger library if QMLJSDEBUGGER_PATH is set
-!isEmpty(QMLJSDEBUGGER_PATH) {
- include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-} else {
- DEFINES -= QMLJSDEBUGGER
-}
-
diff --git a/tests/qmlchartproperties/qmlchartproperties.pro b/tests/qmlchartproperties/qmlchartproperties.pro
index 8f2369c9..6d148e8b 100644
--- a/tests/qmlchartproperties/qmlchartproperties.pro
+++ b/tests/qmlchartproperties/qmlchartproperties.pro
@@ -6,4 +6,3 @@ RESOURCES += resources.qrc
SOURCES += main.cpp
OTHER_FILES += qml/qmlchartproperties/*
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/tests/qmlchartproperties/resources.qrc b/tests/qmlchartproperties/resources.qrc
index a95923d8..e93f369e 100644
--- a/tests/qmlchartproperties/resources.qrc
+++ b/tests/qmlchartproperties/resources.qrc
@@ -1,6 +1,5 @@
<RCC>
<qresource prefix="/">
- <file>qml/qmlchartproperties/loader.qml</file>
<file>qml/qmlchartproperties/main.qml</file>
<file>qml/qmlchartproperties/Button.qml</file>
<file>qml/qmlchartproperties/PieChart.qml</file>
diff --git a/tests/quick2chartproperties/main.cpp b/tests/quick2chartproperties/main.cpp
deleted file mode 100644
index 950076e3..00000000
--- a/tests/quick2chartproperties/main.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets/QApplication>
-#include <QtQuick/QQuickItem>
-#include <QDir>
-#include <QtQml/QQmlEngine>
-#include "qtquick2applicationviewer.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QtQuick2ApplicationViewer viewer;
-#ifdef Q_OS_ANDROID
- viewer.addImportPath(QString::fromLatin1("assets:/qml"));
- viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib")));
-#else
- viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
-#endif
- viewer.setSource(QUrl("qrc:/qml/quick2chartproperties/main.qml"));
- viewer.showExpanded();
-
- return app.exec();
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml
deleted file mode 100644
index c942b288..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- title: "area series"
- anchors.fill: parent
- animationOptions: ChartView.SeriesAnimations
-
- property variant series: areaSeries
-
- AreaSeries {
- id: areaSeries
- name: "area 1"
-
- upperSeries: LineSeries {
- XYPoint { x: 0; y: 1 }
- XYPoint { x: 1; y: 1 }
- XYPoint { x: 2; y: 3 }
- XYPoint { x: 3; y: 3 }
- XYPoint { x: 4; y: 2 }
- XYPoint { x: 5; y: 0 }
- XYPoint { x: 6; y: 2 }
- XYPoint { x: 7; y: 1 }
- XYPoint { x: 8; y: 2 }
- XYPoint { x: 9; y: 1 }
- XYPoint { x: 10; y: 3 }
- XYPoint { x: 11; y: 3 }
- }
- lowerSeries: LineSeries {
- XYPoint { x: 0; y: 0 }
- XYPoint { x: 1; y: 0 }
- XYPoint { x: 2; y: 0 }
- XYPoint { x: 3; y: 0 }
- XYPoint { x: 4; y: 0 }
- XYPoint { x: 5; y: 0 }
- XYPoint { x: 6; y: 0 }
- XYPoint { x: 7; y: 0 }
- XYPoint { x: 8; y: 0 }
- XYPoint { x: 9; y: 0 }
- XYPoint { x: 10; y: 0 }
- XYPoint { x: 11; y: 0 }
- }
-
- pointLabelsFormat: "@xPoint, @yPoint";
-
- onNameChanged: console.log(name + ".onNameChanged: " + name);
- onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
- onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
- onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
- onSelected: console.log(name + ".onSelected");
- onColorChanged: console.log(name + ".onColorChanged: " + color);
- onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
- onBorderWidthChanged: console.log(name + ".onBorderChanged: " + borderWidth);
-// onCountChanged: console.log(name + ".onCountChanged: " + count);
- onHovered: console.log("lineSeries.onHovered:" + point.x + "," + point.y + " " + state);
- onPointLabelsVisibilityChanged: console.log(name + ".onPointLabelsVisibilityChanged: "
- + visible);
- onPointLabelsFormatChanged: console.log(name + ".onPointLabelsFormatChanged: "
- + format);
- onPointLabelsFontChanged: console.log(name + ".onPointLabelsFontChanged: "
- + font.family);
- onPointLabelsColorChanged: console.log(name + ".onPointLabelsColorChanged: "
- + color);
- }
-
- AreaSeries {
- name: "area 2"
-
- upperSeries: LineSeries {
- XYPoint { x: 0; y: 0.5 }
- XYPoint { x: 1; y: 1.5 }
- XYPoint { x: 2; y: 0.3 }
- XYPoint { x: 3; y: 1.5 }
- XYPoint { x: 4; y: 0.1 }
- XYPoint { x: 5; y: 0.3 }
- XYPoint { x: 6; y: 1.2 }
- XYPoint { x: 7; y: 1.3 }
- XYPoint { x: 8; y: 0.2 }
- XYPoint { x: 9; y: 0.1 }
- XYPoint { x: 10; y: 3.2 }
- XYPoint { x: 11; y: 4.6 }
- }
-
- onNameChanged: console.log(name + ".onNameChanged: " + name);
- onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
- onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
- onSelected: console.log(name + ".onSelected");
- onColorChanged: console.log(name + ".onColorChanged: " + color);
- onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml
deleted file mode 100644
index 168dc957..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Flow {
- id: flow
- spacing: 5
- flow: Flow.TopToBottom
- property variant series
-
- Button {
- text: "visible"
- onClicked: series.visible = !series.visible;
- }
- Button {
- text: "opacity +"
- onClicked: series.opacity += 0.1;
- }
- Button {
- text: "opacity -"
- onClicked: series.opacity -= 0.1;
- }
- Button {
- text: "color"
- onClicked: series.color = main.nextColor();
- }
- Button {
- text: "borderColor"
- onClicked: series.borderColor = main.nextColor();
- }
- Button {
- text: series != undefined ? "borderWidth + (" + series.borderWidth + ")" : ""
- onClicked: series.borderWidth += 0.5;
- }
- Button {
- text: series != undefined ? "borderWidth - (" + series.borderWidth + ")" : ""
- onClicked: series.borderWidth -= 0.5;
- }
- Button {
- text: "point labels visible"
- onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
- }
- Button {
- text: "point labels format"
- onClicked: {
- if (series.pointLabelsFormat === "@xPoint, @yPoint")
- series.pointLabelsFormat = "(@xPoint)"
- else
- series.pointLabelsFormat = "@xPoint, @yPoint"
- }
- }
- Button {
- text: "point labels font"
- onClicked: {
- if (series.pointLabelsFont.family === "Times")
- series.pointLabelsFont.family = "Courier";
- else
- series.pointLabelsFont.family = "Times";
- }
- }
- Button {
- text: "point labels color"
- onClicked: series.pointLabelsColor = main.nextColor();
- }
- Button {
- id: upperButton
- text: "upper series"
- unpressedColor: "#79bd8f"
- onClicked: {
- lineEditor.visible = true;
- color = "#00a388";
- lowerButton.color = "#79bd8f";
- lineEditor.series = series.upperSeries;
- }
- }
- Button {
- id: lowerButton
- text: "lower series"
- unpressedColor: "#79bd8f"
- onClicked: {
- lineEditor.visible = true;
- color = "#00a388";
- upperButton.color = "#79bd8f";
- lineEditor.series = series.lowerSeries;
- }
- }
- LineEditor {
- id: lineEditor
- visible: false
- }
-
- onSeriesChanged: lineEditor.series = series.upperSeries;
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml
deleted file mode 100644
index 8a91cdb8..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- title: "Bar series"
- anchors.fill: parent
- theme: ChartView.ChartThemeLight
- legend.alignment: Qt.AlignBottom
- animationOptions: ChartView.SeriesAnimations
-
- property variant series: mySeries
-
-
- BarSeries {
- id: mySeries
- name: "bar"
- labelsFormat: "@value";
- axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
- onClicked: console.log("barset.onClicked: " + index);
- onHovered: console.log("barset.onHovered: " + status + " " + index);
- onPenChanged: console.log("barset.onPenChanged: " + pen);
- onBrushChanged: console.log("barset.onBrushChanged: " + brush);
- onLabelChanged: console.log("barset.onLabelChanged: " + label);
- onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush);
- onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont);
- onColorChanged: console.log("barset.onColorChanged: " + color);
- onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
- onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
- onCountChanged: console.log("barset.onCountChanged: " + count);
- onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count);
- onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count);
- onValueChanged: console.log("barset.onValuesChanged: " + index);
- }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
-
- onNameChanged: console.log("barSeries.onNameChanged: " + series.name);
- onVisibleChanged: console.log("barSeries.onVisibleChanged: " + series.visible);
- onOpacityChanged: console.log("barSeries.onOpacityChanged: " + opacity);
- onClicked: console.log("barSeries.onClicked: " + barset + " " + index);
- onHovered: console.log("barSeries.onHovered: " + barset + " " + status
- + " " + index);
- onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible);
- onCountChanged: console.log("barSeries.onCountChanged: " + count);
- onLabelsFormatChanged: console.log("barSeries.onLabelsFormatChanged: " + format);
- onLabelsPositionChanged: console.log("barSeries.onLabelsPositionChanged: " + series.labelsPosition);
-
- function changeLabelsPosition() {
- if (labelsPosition === BarSeries.LabelsCenter)
- labelsPosition = BarSeries.LabelsInsideEnd;
- else
- labelsPosition = BarSeries.LabelsCenter;
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml
deleted file mode 100644
index cdd847a5..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml
+++ /dev/null
@@ -1,199 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Row {
- anchors.fill: parent
- spacing: 5
- property variant series
-
- // buttons for selecting the edited object: series, barset or label
- Flow {
- spacing: 5
- flow: Flow.TopToBottom
- Button {
- id: seriesButton
- text: "series"
- unpressedColor: "#79bd8f"
- onClicked: {
- seriesFlow.visible = true;
- setFlow.visible = false;
- labelsFlow.visible = false;
- color = "#00a388";
- setButton.color = "#79bd8f";
- labelButton.color = "#79bd8f";
- }
- }
- Button {
- id: setButton
- text: "BarSet"
- unpressedColor: "#79bd8f"
- onClicked: {
- seriesFlow.visible = false;
- setFlow.visible = true;
- labelsFlow.visible = false;
- color = "#00a388";
- seriesButton.color = "#79bd8f";
- labelButton.color = "#79bd8f";
- }
- }
- Button {
- id: labelButton
- text: "label"
- unpressedColor: "#79bd8f"
- onClicked: {
- seriesFlow.visible = false;
- setFlow.visible = false;
- labelsFlow.visible = true;
- color = "#00a388";
- seriesButton.color = "#79bd8f";
- setButton.color = "#79bd8f";
- }
- }
- }
-
- // Buttons for editing series
- Flow {
- id: seriesFlow
- spacing: 5
- flow: Flow.TopToBottom
- visible: false
-
- Button {
- text: "visible"
- onClicked: series.visible = !series.visible;
- }
- Button {
- text: "opacity +"
- onClicked: series.opacity += 0.1;
- }
- Button {
- text: "opacity -"
- onClicked: series.opacity -= 0.1;
- }
- Button {
- text: "bar width +"
- onClicked: series.barWidth += 0.1;
- }
- Button {
- text: "bar width -"
- onClicked: series.barWidth -= 0.1;
- }
- }
-
- // Buttons for editing sets
- Flow {
- id: setFlow
- spacing: 5
- flow: Flow.TopToBottom
- visible: false
-
- Button {
- text: "append set"
- onClicked: {
- var count = series.count;
- series.append("set" + count, [0, 0.1 * count, 0.2 * count, 0.3 * count, 0.4 * count, 0.5 * count, 0.6 * count]);
- }
- }
- Button {
- text: "insert set"
- onClicked: {
- var count = series.count;
- series.insert(count - 1, "set" + count, [0, 0.1 * count, 0.2 * count, 0.3 * count, 0.4 * count, 0.5 * count, 0.6 * count]);
- }
- }
- Button {
- text: "remove set"
- onClicked: series.remove(series.at(series.count - 1));
- }
- Button {
- text: "clear sets"
- onClicked: series.clear();
- }
-
- Button {
- text: "set 1 append"
- onClicked: series.at(0).append(series.at(0).count + 1);
- }
- Button {
- text: "set 1 replace"
- onClicked: series.at(0).replace(series.at(0).count - 1, series.at(0).at(series.at(0).count - 1) + 1.5);
- }
- Button {
- text: "set 1 remove"
- onClicked: series.at(0).remove(series.at(0).count - 1);
- }
-
- Button {
- text: "set 1 color"
- onClicked: series.at(0).color = main.nextColor();
- }
- Button {
- text: "set 1 border color"
- onClicked: series.at(0).borderColor = main.nextColor();
- }
- Button {
- text: "set 1 borderWidth +"
- onClicked: series.at(0).borderWidth += 0.5;
- }
- Button {
- text: "set 1 borderWidth -"
- onClicked: series.at(0).borderWidth -= 0.5;
- }
- }
-
-
- Flow {
- id: labelsFlow
- spacing: 5
- flow: Flow.TopToBottom
- visible: false
-
- Button {
- text: "labels visible"
- onClicked: series.labelsVisible = !series.labelsVisible;
- }
- Button {
- text: "labels format"
- onClicked: {
- if (series.labelsFormat === "@value")
- series.labelsFormat = "@value%"
- else
- series.labelsFormat = "@value"
- }
- }
- Button {
- text: "labels position"
- onClicked: series.changeLabelsPosition();
- }
- Button {
- text: "set 1 label color"
- onClicked: series.at(0).labelColor = main.nextColor();
- }
- FontEditor {
- id: fontEditor
- fontDescription: "label"
- function editedFont() {
- return series.at(0).labelFont;
- }
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/Button.qml b/tests/quick2chartproperties/qml/quick2chartproperties/Button.qml
deleted file mode 100644
index 61df081d..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/Button.qml
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Rectangle {
- id: button
- height: 25
- width: 140
- color: unpressedColor
- radius: 5
- property color unpressedColor: "#afafaf"
-
- property string text: "button"
- signal clicked
-
- Text {
- id: buttonText
- anchors.centerIn: parent
- text: button.text
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- button.clicked();
- }
- onPressedChanged: {
- if (pressed) {
- button.color = "#efefef";
- } else {
- button.color = unpressedColor;
- }
- }
- onPressAndHold: {
- repeatTimer.start();
- }
- onReleased: {
- repeatTimer.stop();
- }
- }
-
- Timer {
- id: repeatTimer
- interval: 140
- repeat: true
- triggeredOnStart: false
- running: false
- onTriggered: {
- button.clicked();
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml
deleted file mode 100644
index 3183c57f..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.3
-
-ChartView {
- id: chartView
- title: "Chart Title"
- anchors.fill: parent
- property variant chart: chartView
-
- LineSeries {
- name: "line"
- XYPoint { x: 0; y: 0 }
- XYPoint { x: 1.1; y: 2.1 }
- XYPoint { x: 1.9; y: 3.3 }
- XYPoint { x: 2.1; y: 2.1 }
- XYPoint { x: 2.9; y: 4.9 }
- XYPoint { x: 3.4; y: 3.0 }
- XYPoint { x: 4.1; y: 3.3 }
- }
-
- onVisibleChanged: console.log("chart.onVisibleChanged: " + visible);
- onTitleColorChanged: console.log("chart.onTitleColorChanged: " + color);
- onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + chart.backgroundColor);
- onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled);
- onBackgroundRoundnessChanged: console.log("chart.onBackgroundRoundnessChanged: " + diameter);
- onSeriesAdded: console.log("chart.onSeriesAdded: " + series.name);
- onSeriesRemoved: console.log("chart.onSeriesRemoved: " + series.name);
- onPlotAreaColorChanged: console.log("chart.plotAreaColorChanged: " + chart.plotAreaColor);
-
- legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + chart.legend.visible);
- legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible);
- legend.onColorChanged: console.log("legend.onColorChanged: " + color);
- legend.onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color);
- legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color);
- legend.onReverseMarkersChanged: console.log("legend.onReverseMarkersChanged: "
- + chart.legend.reverseMarkers)
- margins.onTopChanged: console.log("chart.margins.onTopChanged: " + top );
- margins.onBottomChanged: console.log("chart.margins.onBottomChanged: " + bottom);
- margins.onLeftChanged: console.log("chart.margins.onLeftChanged: " + left);
- margins.onRightChanged: console.log("chart.margins.onRightChanged: " + right);
- onPlotAreaChanged: {
- console.log("chart.onPlotAreaChanged, width: " + chartView.plotArea.width
- + " height: " + chartView.plotArea.height
- + " y: " + chartView.plotArea.y
- + " x: " + chartView.plotArea.x);
- marginVisualizer.opacity = 1.0;
- }
-
- ValueAxis{
- onColorChanged: console.log("axisX.onColorChanged: " + color);
- onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
- onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
- onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
- onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
- onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
- onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
- onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
- onMinChanged: console.log("axisX.onMinChanged: " + min);
- onMaxChanged: console.log("axisX.onMaxChanged: " + max);
- }
-
- ValueAxis{
- onColorChanged: console.log("axisY.onColorChanged: " + color);
- onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
- onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
- onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
- onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
- onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
- onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
- onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
- onMinChanged: console.log("axisY.onMinChanged: " + min);
- onMaxChanged: console.log("axisY.onMaxChanged: " + max);
- }
-
- Rectangle {
- id: marginVisualizer
- color: "transparent"
- border.color: "red"
- anchors.fill: parent
- anchors.topMargin: chartView.minimumMargins.top
- anchors.bottomMargin: chartView.minimumMargins.bottom
- anchors.leftMargin: chartView.minimumMargins.left
- anchors.rightMargin: chartView.minimumMargins.right
- opacity: 0.0
- onOpacityChanged: if (opacity > 0.9) opacity = 0.0;
- Behavior on opacity {
- NumberAnimation { duration: 800 }
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditor.qml
deleted file mode 100644
index 87139f35..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditor.qml
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Item {
- id: chartEditor
- property variant chart
- onChartChanged: {
- if (loader.item != undefined)
- loader.item.chart = chart;
- }
-
- function selectButton(button) {
- chartButton.color = "#79bd8f";
- titleButton.color = "#79bd8f";
- legendButton.color = "#79bd8f";
- axisXButton.color = "#79bd8f";
- axisYButton.color = "#79bd8f";
- seriesButton.color = "#79bd8f";
- button.color = "#00a388";
- }
-
- Flow {
- id: selectorFlow
- anchors.top: parent.top
- height: 90
- anchors.left: parent.left
- anchors.right: parent.right
- spacing: 5
- flow: Flow.TopToBottom
-
- Button {
- id: chartButton
- text: "Chart properties"
- unpressedColor: "#79bd8f"
- onClicked: {
- selectButton(chartButton);
- loader.source = "ChartEditorProperties.qml";
- loader.item.chart = chart;
- }
- }
- Button {
- id: titleButton
- text: "Title properties"
- unpressedColor: "#79bd8f"
- onClicked: {
- selectButton(titleButton);
- loader.source = "ChartEditorTitle.qml";
- loader.item.chart = chart;
- }
- }
- Button {
- id: legendButton
- text: "Legend properties"
- unpressedColor: "#79bd8f"
- onClicked: {
- selectButton(legendButton);
- loader.source = "ChartEditorLegend.qml";
- loader.item.chartLegend = chart.legend;
- }
- }
- Button {
- id: axisXButton
- text: "Axis X properties"
- unpressedColor: "#79bd8f"
- onClicked: {
- selectButton(axisXButton);
- loader.source = "ChartEditorAxis.qml";
- loader.item.axis = chart.axisX();
- }
- }
- Button {
- id: axisYButton
- text: "Axis Y properties"
- unpressedColor: "#79bd8f"
- onClicked: {
- selectButton(axisYButton);
- loader.source = "ChartEditorAxis.qml";
- loader.item.axis = chart.axisY();
- }
- }
- Button {
- id: seriesButton
- text: "Series"
- unpressedColor: "#79bd8f"
- onClicked: {
- selectButton(seriesButton);
- loader.source = "ChartEditorSeries.qml";
- loader.item.chart = chart;
- }
- }
- }
-
- Loader {
- id: loader
- anchors.top: selectorFlow.bottom
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorAxis.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorAxis.qml
deleted file mode 100644
index 0c6d8dce..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorAxis.qml
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Row {
- anchors.fill: parent
- spacing: 5
- property variant axis
-
- Flow {
- spacing: 5
- flow: Flow.TopToBottom
- height: parent.height
-
- Button {
- text: "axis visible"
- onClicked: axis.visible = !axis.visible;
- }
- Button {
- text: "axis line visible"
- onClicked: axis.lineVisible = !axis.lineVisible;
- }
- Button {
- text: "axis color"
- onClicked: axis.color = main.nextColor();
- }
- Button {
- text: "axis labels visible"
- onClicked: axis.labelsVisible = !axis.labelsVisible;
- }
- Button {
- text: "axis labels angle +"
- onClicked: axis.labelsAngle += 5;
- }
- Button {
- text: "axis labels angle -"
- onClicked: axis.labelsAngle -= 5;
- }
- Button {
- text: "axis labels color"
- onClicked: axis.labelsColor = main.nextColor();
- }
- Button {
- text: "axis grid visible"
- onClicked: axis.gridVisible = !axis.gridVisible;
- }
- Button {
- text: "axis shades visible"
- onClicked: axis.shadesVisible = !axis.shadesVisible;
- }
- Button {
- text: "axis shades color"
- onClicked: axis.shadesColor = main.nextColor();
- }
- Button {
- text: "axis shades bcolor"
- onClicked: axis.shadesBorderColor = main.nextColor();
- }
- Button {
- text: "axis title text"
- onClicked: axis.titleText = axis.titleText + "X";
- }
- Button {
- text: "axis title visible"
- onClicked: axis.titleVisible = !axis.titleVisible;
- }
- Button {
- text: "axis max +"
- onClicked: axis.max += 0.1;
- }
- Button {
- text: "axis max -"
- onClicked: axis.max -= 0.1;
- }
- Button {
- text: "axis min +"
- onClicked: axis.min += 0.1;
- }
- Button {
- text: "axis min -"
- onClicked: axis.min -= 0.1;
- }
- Button {
- text: "axis tick count +"
- onClicked: axis.tickCount++;
- }
- Button {
- text: "axis tick count -"
-
- onClicked: axis.tickCount--;
- }
- Button {
- text: "axis nice nmb"
- onClicked: axis.niceNumbersEnabled = !axis.niceNumbersEnabled;
- }
-
- FontEditor {
- id: fontEditor
- fontDescription: "axis"
- function editedFont() {
- return axis.labelsFont;
- }
- }
-
- FontEditor {
- id: titleFontEditor
- fontDescription: "title"
- function editedFont() {
- return axis.titleFont;
- }
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorLegend.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorLegend.qml
deleted file mode 100644
index 24ffd9ef..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorLegend.qml
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Row {
- anchors.fill: parent
- spacing: 5
- property variant chartLegend
-
- Flow {
- spacing: 5
- flow: Flow.TopToBottom
-
- Button {
- text: "legend visible"
- onClicked: chartLegend.visible = !chartLegend.visible;
- }
- Button {
- text: "legend bckgrd visible"
- onClicked: chartLegend.backgroundVisible = !chartLegend.backgroundVisible;
- }
- Button {
- text: "legend color"
- onClicked: chartLegend.color = main.nextColor();
- }
- Button {
- text: "legend border color"
- onClicked: chartLegend.borderColor = main.nextColor();
- }
- Button {
- text: "legend label color"
- onClicked: chartLegend.labelColor = main.nextColor();
- }
- Button {
- text: "legend top"
- onClicked: chartLegend.alignment = Qt.AlignTop;
- }
- Button {
- text: "legend bottom"
- onClicked: chartLegend.alignment = Qt.AlignBottom;
- }
- Button {
- text: "legend left"
- onClicked: chartLegend.alignment = Qt.AlignLeft;
- }
- Button {
- text: "legend right"
- onClicked: chartLegend.alignment = Qt.AlignRight;
- }
- Button {
- text: "legend use reverse order"
- onClicked: chartLegend.reverseMarkers = !chartLegend.reverseMarkers;
- }
- }
-
- FontEditor {
- fontDescription: "legend"
- function editedFont() {
- return chartLegend.font;
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml
deleted file mode 100644
index d172e4d8..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Flow {
- anchors.fill: parent
- property variant chart
- flow: Flow.TopToBottom
- spacing: 5
- Button {
- text: "visible"
- onClicked: chart.visible = !chart.visible;
- }
- Button {
- text: "theme +"
- onClicked: chart.theme++;
- }
- Button {
- text: "theme -"
- onClicked: chart.theme--;
- }
- Button {
- text: "animation opt +"
- onClicked: chart.animationOptions++;
- }
- Button {
- text: "animation opt -"
- onClicked: chart.animationOptions--;
- }
- Button {
- text: "background color"
- onClicked: chart.backgroundColor = main.nextColor();
- }
- Button {
- text: "plot area color"
- onClicked: chart.plotAreaColor = main.nextColor();
- }
- Button {
- text: "drop shadow enabled"
- onClicked: chart.dropShadowEnabled = !chart.dropShadowEnabled;
- }
- Button {
- text: "roundness"
- onClicked: chart.backgroundRoundness++;
- }
- Button {
- text: "zoom +"
- onClicked: chart.zoom(2);
- }
- Button {
- text: "zoom -"
- onClicked: chart.zoom(0.5);
- }
- Button {
- text: "scroll left"
- onClicked: chart.scrollLeft(10);
- }
- Button {
- text: "scroll right"
- onClicked: chart.scrollRight(10);
- }
- Button {
- text: "scroll up"
- onClicked: chart.scrollUp(10);
- }
- Button {
- text: "scroll down"
- onClicked: chart.scrollDown(10);
- }
- Button {
- text: "title color"
- onClicked: chart.titleColor = main.nextColor();
- }
- Button {
- text: "top margin +"
- onClicked: chart.margins.top += 5;
- }
- Button {
- text: "top margin -"
- onClicked: chart.margins.top -= 5;
- }
- Button {
- text: "bottom margin +"
- onClicked: chart.margins.bottom += 5;
- }
- Button {
- text: "bottom margin -"
- onClicked: chart.margins.bottom -= 5;
- }
- Button {
- text: "left margin +"
- onClicked: chart.margins.left += 5;
- }
- Button {
- text: "left margin -"
- onClicked: chart.margins.left -= 5;
- }
- Button {
- text: "right margin +"
- onClicked: chart.margins.right += 5;
- }
- Button {
- text: "right margin -"
- onClicked: chart.margins.right -= 5;
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorSeries.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorSeries.qml
deleted file mode 100644
index 06b8618b..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorSeries.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Flow {
- anchors.fill: parent
- property variant chart
- flow: Flow.TopToBottom
- spacing: 5
-
- Button {
- text: "add line"
- onClicked: addXYSeries(ChartView.SeriesTypeLine, "line");
- }
- Button {
- text: "add spline"
- onClicked: addXYSeries(ChartView.SeriesTypeSpline, "spline");
- }
- Button {
- text: "add scatter"
- onClicked: addXYSeries(ChartView.SeriesTypeScatter, "scatter");
- }
- Button {
- text: "remove last"
- onClicked: {
- if (chart.count > 0)
- chart.removeSeries(chart.series(chart.count - 1));
- else
- chart.removeSeries(0);
- }
- }
- Button {
- text: "remove all"
- onClicked: chart.removeAllSeries();
- }
-
- function addXYSeries(type, name) {
- var series = chart.createSeries(type, name + " " + chart.count);
- for (var i = chart.axisX().min; i < chart.axisX().max; i++) {
- var y = Math.random() * (chart.axisY().max - chart.axisY().min) + chart.axisY().min;
- var x = Math.random() + i;
- series.append(x, y);
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorTitle.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorTitle.qml
deleted file mode 100644
index 61b4365f..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorTitle.qml
+++ /dev/null
@@ -1,35 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Flow {
- property variant chart
- anchors.fill: parent
- flow: Flow.TopToBottom
- spacing: 5
-
- FontEditor {
- fontDescription: "title"
- function editedFont() {
- return chart.titleFont;
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/FontEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/FontEditor.qml
deleted file mode 100644
index 3531597f..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/FontEditor.qml
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Flow {
- flow: Flow.TopToBottom
- spacing: 5
- property string fontDescription: ""
-
- Button {
- text: fontDescription + " bold"
- onClicked: editedFont().bold = !editedFont().bold;
- }
- Button {
- text: fontDescription + " capitalization"
- onClicked: editedFont().capitalization++;
- }
- Button {
- text: fontDescription + " font family"
- onClicked: editedFont().family = "courier";
- }
- Button {
- text: fontDescription + " font italic"
- onClicked: editedFont().italic = !editedFont().italic;
- }
- Button {
- text: fontDescription + " letterSpacing +"
- onClicked: editedFont().letterSpacing++;
- }
- Button {
- text: fontDescription + " letterSpacing -"
- onClicked: editedFont().letterSpacing--;
- }
- Button {
- text: fontDescription + " pixelSize +"
- onClicked: editedFont().pixelSize++;
- }
- Button {
- text: fontDescription + " pixelSize -"
- onClicked: editedFont().pixelSize--;
- }
- Button {
- text: fontDescription + " pointSize +"
- onClicked: editedFont().pointSize++;
- }
- Button {
- text: fontDescription + " pointSize -"
- onClicked: editedFont().pointSize--;
- }
- Button {
- text: fontDescription + " strikeout"
- onClicked: editedFont().strikeout = !editedFont().strikeout;
- }
- Button {
- text: fontDescription + " underline"
- onClicked: editedFont().underline = !editedFont().underline;
- }
- Button {
- text: fontDescription + " weight +"
- onClicked: editedFont().weight++;
- }
- Button {
- text: fontDescription + " weight -"
- onClicked: editedFont().weight--;
- }
- Button {
- text: fontDescription + " wordSpacing +"
- onClicked: editedFont().wordSpacing++;
- }
- Button {
- text: fontDescription + " wordSpacing -"
- onClicked: editedFont().wordSpacing--;
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml
deleted file mode 100644
index 342995cf..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- title: "Bar series"
- anchors.fill: parent
- theme: ChartView.ChartThemeLight
- legend.alignment: Qt.AlignBottom
- animationOptions: ChartView.SeriesAnimations
-
- property variant series: mySeries
-
- HorizontalBarSeries {
- id: mySeries
- name: "bar"
- labelsFormat: "@value";
- axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
- onClicked: console.log("barset.onClicked: " + index);
- onHovered: console.log("barset.onHovered: " + status + " " + index);
- onPenChanged: console.log("barset.onPenChanged: " + pen);
- onBrushChanged: console.log("barset.onBrushChanged: " + brush);
- onLabelChanged: console.log("barset.onLabelChanged: " + label);
- onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush);
- onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont);
- onColorChanged: console.log("barset.onColorChanged: " + color);
- onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
- onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
- onCountChanged: console.log("barset.onCountChanged: " + count);
- onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count);
- onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count);
- onValueChanged: console.log("barset.onValuesChanged: " + index);
- }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
-
- onNameChanged: console.log("horizontalBarSeries.onNameChanged: " + series.name);
- onVisibleChanged: console.log("horizontalBarSeries.onVisibleChanged: " + series.visible);
- onOpacityChanged: console.log("horizontalBarSeries.onOpacityChanged: " + opacity);
- onClicked: console.log("horizontalBarSeries.onClicked: " + barset + " " + index);
- onHovered: console.log("horizontalBarSeries.onHovered: " + barset + " "
- + status + " " + index);
- onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
- onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count);
- onLabelsFormatChanged: console.log("horizontalBarSeries.onLabelsFormatChanged: "
- + format);
- onLabelsPositionChanged: console.log("horizontalBarSeries.onLabelsPositionChanged: "
- + series.labelsPosition);
-
- function changeLabelsPosition() {
- if (labelsPosition === BarSeries.LabelsCenter)
- labelsPosition = BarSeries.LabelsInsideEnd;
- else
- labelsPosition = BarSeries.LabelsCenter;
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml
deleted file mode 100644
index 0ef7e17a..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- title: "Percent bar series"
- anchors.fill: parent
- theme: ChartView.ChartThemeLight
- legend.alignment: Qt.AlignBottom
- animationOptions: ChartView.SeriesAnimations
-
- property variant series: mySeries
-
- HorizontalPercentBarSeries {
- id: mySeries
- name: "bar"
- labelsFormat: "@value";
- axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
- onClicked: console.log("barset.onClicked: " + index);
- onHovered: console.log("barset.onHovered: " + status + " " + index);
- onPenChanged: console.log("barset.onPenChanged: " + pen);
- onBrushChanged: console.log("barset.onBrushChanged: " + brush);
- onLabelChanged: console.log("barset.onLabelChanged: " + label);
- onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush);
- onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont);
- onColorChanged: console.log("barset.onColorChanged: " + color);
- onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
- onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
- onCountChanged: console.log("barset.onCountChanged: " + count);
- onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count);
- onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count);
- onValueChanged: console.log("barset.onValuesChanged: " + index);
- }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
-
- onNameChanged: console.log("horizontalPercentBarSeries.onNameChanged: " + series.name);
- onVisibleChanged: console.log("horizontalPercentBarSeries.onVisibleChanged: " + series.visible);
- onOpacityChanged: console.log("horizontalPercentBarSeries.onOpacityChanged: " + opacity);
- onClicked: console.log("horizontalPercentBarSeries.onClicked: " + barset + " " + index);
- onHovered: console.log("horizontalPercentBarSeries.onHovered: " + barset
- + " " + status + " " + index);
- onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
- onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count);
- onLabelsFormatChanged: console.log(
- "horizontalPercentBarSeries.onLabelsFormatChanged: "
- + format);
- onLabelsPositionChanged: console.log(
- "horizontalPercentBarSeries.onLabelsPositionChanged: "
- + series.labelsPosition);
-
- function changeLabelsPosition() {
- if (labelsPosition === BarSeries.LabelsCenter)
- labelsPosition = BarSeries.LabelsInsideEnd;
- else
- labelsPosition = BarSeries.LabelsCenter;
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml
deleted file mode 100644
index c1ef51b8..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- title: "Stacked bar series"
- anchors.fill: parent
- theme: ChartView.ChartThemeLight
- legend.alignment: Qt.AlignBottom
- animationOptions: ChartView.SeriesAnimations
-
- property variant series: mySeries
-
- HorizontalStackedBarSeries {
- id: mySeries
- name: "bar"
- labelsFormat: "@value";
- axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
- onClicked: console.log("barset.onClicked: " + index);
- onHovered: console.log("barset.onHovered: " + status + " " + index);
- onPenChanged: console.log("barset.onPenChanged: " + pen);
- onBrushChanged: console.log("barset.onBrushChanged: " + brush);
- onLabelChanged: console.log("barset.onLabelChanged: " + label);
- onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush);
- onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont);
- onColorChanged: console.log("barset.onColorChanged: " + color);
- onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
- onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
- onCountChanged: console.log("barset.onCountChanged: " + count);
- onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count);
- onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count);
- onValueChanged: console.log("barset.onValuesChanged: " + index);
- }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
-
- onNameChanged: console.log("horizontalStackedBarSeries.onNameChanged: " + series.name);
- onVisibleChanged: console.log("horizontalStackedBarSeries.onVisibleChanged: " + series.visible);
- onOpacityChanged: console.log("horizontalStackedBarSeries.onOpacityChanged: " + opacity);
- onClicked: console.log("horizontalStackedBarSeries.onClicked: " + barset + " " + index);
- onHovered: console.log("horizontalStackedBarSeries.onHovered: " + barset
- + " " + status + " " + index);
- onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
- onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count);
- onLabelsFormatChanged: console.log(
- "horizontalStackedBarSeries.onLabelsFormatChanged: "
- + format);
- onLabelsPositionChanged: console.log(
- "horizontalStackedBarSeries.onLabelsPositionChanged: "
- + series.labelsPosition);
-
- function changeLabelsPosition() {
- if (labelsPosition === BarSeries.LabelsCenter)
- labelsPosition = BarSeries.LabelsInsideEnd;
- else
- labelsPosition = BarSeries.LabelsCenter;
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml
deleted file mode 100644
index 3190ac35..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- property variant series: lineSeries
-
- title: "line series"
- anchors.fill: parent
- animationOptions: ChartView.SeriesAnimations
-
- LineSeries {
- id: lineSeries
- name: "line 1"
- XYPoint { x: 0; y: 0 }
- XYPoint { x: 1.1; y: 2.1 }
- XYPoint { x: 1.9; y: 3.3 }
- XYPoint { x: 2.1; y: 2.1 }
- XYPoint { x: 2.9; y: 4.9 }
- XYPoint { x: 3.4; y: 3.0 }
- XYPoint { x: 4.1; y: 3.3 }
-
- pointLabelsFormat: "@xPoint, @yPoint";
-
- onNameChanged: console.log("lineSeries.onNameChanged: " + name);
- onVisibleChanged: console.log("lineSeries.onVisibleChanged: " + visible);
- onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
- onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
- onPointReplaced: console.log("lineSeries.onPointReplaced: " + index);
- onPointRemoved: console.log("lineSeries.onPointRemoved: " + index);
- onPointAdded: console.log("lineSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y);
- onColorChanged: console.log("lineSeries.onColorChanged: " + color);
- onWidthChanged: console.log("lineSeries.onWidthChanged: " + width);
- onStyleChanged: console.log("lineSeries.onStyleChanged: " + style);
- onCapStyleChanged: console.log("lineSeries.onCapStyleChanged: " + capStyle);
- onCountChanged: console.log("lineSeries.onCountChanged: " + count);
- onHovered: console.log("lineSeries.onHovered:" + point.x + "," + point.y + " " + state);
- onPointLabelsVisibilityChanged: console.log("lineSeries.onPointLabelsVisibilityChanged: "
- + visible);
- onPointLabelsFormatChanged: console.log("lineSeries.onPointLabelsFormatChanged: "
- + format);
- onPointLabelsFontChanged: console.log("lineSeries.onPointLabelsFontChanged: "
- + font.family);
- onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: "
- + color);
- }
-
- LineSeries {
- name: "line 2"
- XYPoint { x: 1.1; y: 1.1 }
- XYPoint { x: 1.9; y: 2.3 }
- XYPoint { x: 2.1; y: 1.1 }
- XYPoint { x: 2.9; y: 3.9 }
- XYPoint { x: 3.4; y: 2.0 }
- XYPoint { x: 4.1; y: 2.3 }
- onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
- onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml
deleted file mode 100644
index 7960b4a1..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-
-Flow {
- id: flow
- spacing: 5
- flow: Flow.TopToBottom
- property variant series
-
- Button {
- text: "visible"
- onClicked: series.visible = !series.visible;
- }
- Button {
- text: "opacity +"
- onClicked: series.opacity += 0.1;
- }
- Button {
- text: "opacity -"
- onClicked: series.opacity -= 0.1;
- }
- Button {
- text: "color"
- onClicked: series.color = main.nextColor();
- }
- Button {
- text: series != undefined ? "width + (" + series.width + ")" : ""
- onClicked: series.width += 0.5;
- }
- Button {
- text: series != undefined ? "width - (" + series.width + ")" : ""
- onClicked: series.width -= 0.5;
- }
- Button {
- text: series != undefined ? "style + (" + series.style + ")" : ""
- onClicked: series.style++;
- }
- Button {
- text: series != undefined ? "style - (" + series.style + ")" : ""
- onClicked: series.style--;
- }
- Button {
- text: series != undefined ? "cap style + (" + series.capStyle + ")" : ""
- onClicked: series.capStyle++;
- }
- Button {
- text: series != undefined ? "cap style - (" +series.capStyle + ")" : ""
- onClicked: series.capStyle--;
- }
- Button {
- text: "points visible"
- onClicked: series.pointsVisible = !series.pointsVisible;
- }
- Button {
- text: "point labels visible"
- onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
- }
- Button {
- text: "point labels format"
- onClicked: {
- if (series.pointLabelsFormat === "@xPoint, @yPoint")
- series.pointLabelsFormat = "(@xPoint)"
- else
- series.pointLabelsFormat = "@xPoint, @yPoint"
- }
- }
- Button {
- text: "point labels font"
- onClicked: {
- if (series.pointLabelsFont.family === "Times")
- series.pointLabelsFont.family = "Courier";
- else
- series.pointLabelsFont.family = "Times";
- }
- }
- Button {
- text: "point labels color"
- onClicked: series.pointLabelsColor = main.nextColor();
- }
- Button {
- text: "append point"
- onClicked: series.append(series.count - 1, series.count - 1);
- }
- Button {
- text: "replace point"
- onClicked: {
- var xyPoint = series.at(series.count - 1);
- series.replace(series.count - 1, xyPoint.x, xyPoint.y + 0.1);
- }
- }
- Button {
- text: "remove point"
- onClicked: series.remove(series.count - 1);
- }
- Button {
- text: "insert point"
- onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2);
- }
- Button {
- text: "clear"
- onClicked: series.clear();
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml
deleted file mode 100644
index 822a1839..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- title: "Percent bar series"
- anchors.fill: parent
- theme: ChartView.ChartThemeLight
- legend.alignment: Qt.AlignBottom
- animationOptions: ChartView.SeriesAnimations
-
- property variant series: mySeries
-
- PercentBarSeries {
- id: mySeries
- name: "bar"
- labelsFormat: "@value";
- axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
-
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
- onClicked: console.log("barset.onClicked: " + index);
- onHovered: console.log("barset.onHovered: " + status + " " + index);
- onPenChanged: console.log("barset.onPenChanged: " + pen);
- onBrushChanged: console.log("barset.onBrushChanged: " + brush);
- onLabelChanged: console.log("barset.onLabelChanged: " + label);
- onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush);
- onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont);
- onColorChanged: console.log("barset.onColorChanged: " + color);
- onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
- onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
- onCountChanged: console.log("barset.onCountChanged: " + count);
- onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count);
- onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count);
- onValueChanged: console.log("barset.onValuesChanged: " + index);
- }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
-
- onNameChanged: console.log("percentBarSeries.onNameChanged: " + series.name);
- onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible);
- onOpacityChanged: console.log("percentBarSeries.onOpacityChanged: " + opacity);
- onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index);
- onHovered: console.log("percentBarSeries.onHovered: " + barset
- + " " + status + " " + index);
- onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
- onCountChanged: console.log("percentBarSeries.onCountChanged: " + count);
- onLabelsFormatChanged: console.log("percentBarSeries.onLabelsFormatChanged: "
- + format);
- onLabelsPositionChanged: console.log("percentBarSeries.onLabelsPositionChanged: "
- + series.labelsPosition);
-
- function changeLabelsPosition() {
- if (labelsPosition === BarSeries.LabelsCenter)
- labelsPosition = BarSeries.LabelsInsideEnd;
- else
- labelsPosition = BarSeries.LabelsCenter;
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml
deleted file mode 100644
index 6ee1ac91..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-ChartView {
- id: chart
- title: "pie series"
- animationOptions: ChartView.SeriesAnimations
-
- property variant series: pieSeries
-
- PieSeries {
- id: pieSeries
- name: "pie"
- PieSlice { label: "slice1"; value: 11;
- onValueChanged: console.log("slice.onValueChanged: " + value);
- onLabelVisibleChanged: console.log("slice.onLabelVisibleChanged: " + labelVisible);
- onPenChanged: console.log("slice.onPenChanged: " + pen);
- onBorderColorChanged: console.log("slice.onBorderColorChanged: " + borderColor);
- onBorderWidthChanged: console.log("slice.onBorderWidthChanged: " + borderWidth);
- onBrushChanged: console.log("slice.onBrushChanged: " + brush);
- onColorChanged: console.log("slice.onColorChanged: " + color);
- onLabelColorChanged: console.log("slice.onLabelColorChanged: " + labelColor);
- onLabelBrushChanged: console.log("slice.onLabelBrushChanged: " + labelBrush);
- onLabelFontChanged: console.log("slice.onLabelFontChanged: " + labelFont);
- onPercentageChanged: console.log("slice.onPercentageChanged: " + percentage);
- onStartAngleChanged: console.log("slice.onStartAngleChanged: " + startAngle);
- onAngleSpanChanged: console.log("slice.onAngleSpanChanged: " + angleSpan);
- onClicked: console.log("slice.onClicked: " + label);
- onHovered: console.log("slice.onHovered: " + state);
- }
- PieSlice { label: "slice2"; value: 22 }
- PieSlice { label: "slice3"; value: 33 }
- PieSlice { label: "slice4"; value: 44 }
-
- onNameChanged: console.log("pieSeries.onNameChanged: " + name);
- onVisibleChanged: console.log("pieSeries.onVisibleChanged: " + series.visible);
- onOpacityChanged: console.log("pieSeries.onOpacityChanged: " + opacity);
- onClicked: console.log("pieSeries.onClicked: " + slice.label);
- onHovered: console.log("pieSeries.onHovered: " + slice.label);
- onAdded: console.log("pieSeries.onAdded: " + slices);
- onSliceAdded: console.log("pieSeries.onSliceAdded: " + slice.label);
- onRemoved: console.log("pieSeries.onRemoved: " + slices);
- onSliceRemoved: console.log("pieSeries.onSliceRemoved: " + slice.label);
- onCountChanged: console.log("pieSeries.onCountChanged: " + count);
- onSumChanged: console.log("pieSeries.onSumChanged: " + sum);
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/PieEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/PieEditor.qml
deleted file mode 100644
index 09464e0f..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/PieEditor.qml
+++ /dev/null
@@ -1,228 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.1
-
-Row {
- anchors.fill: parent
- spacing: 5
- property variant series
- property int sliceIndex: 0
-
- // buttons for selecting the edited object: series, slice or label
- Flow {
- spacing: 5
- flow: Flow.TopToBottom
- Button {
- id: seriesButton
- text: "series"
- unpressedColor: "#79bd8f"
- onClicked: {
- seriesFlow.visible = true;
- slicesFlow.visible = false;
- labelsFlow.visible = false;
- color = "#00a388";
- sliceButton.color = "#79bd8f";
- labelButton.color = "#79bd8f";
- }
- }
- Button {
- id: sliceButton
- text: "slice"
- unpressedColor: "#79bd8f"
- onClicked: {
- seriesFlow.visible = false;
- slicesFlow.visible = true;
- labelsFlow.visible = false;
- color = "#00a388";
- seriesButton.color = "#79bd8f";
- labelButton.color = "#79bd8f";
- }
- }
- Button {
- id: labelButton
- text: "label"
- unpressedColor: "#79bd8f"
- onClicked: {
- seriesFlow.visible = false;
- slicesFlow.visible = false;
- labelsFlow.visible = true;
- color = "#00a388";
- seriesButton.color = "#79bd8f";
- sliceButton.color = "#79bd8f";
- }
- }
- }
-
- // Buttons for editing series
- Flow {
- id: seriesFlow
- spacing: 5
- flow: Flow.TopToBottom
- visible: false
- Button {
- text: "visible"
- onClicked: series.visible = !series.visible;
- }
- Button {
- text: "series opacity +"
- onClicked: series.opacity += 0.1;
- }
- Button {
- text: "series opacity -"
- onClicked: series.opacity -= 0.1;
- }
- Button {
- text: "series hpos +"
- onClicked: series.horizontalPosition += 0.1;
- }
- Button {
- text: "series hpos -"
- onClicked: series.horizontalPosition -= 0.1;
- }
- Button {
- text: "series vpos +"
- onClicked: series.verticalPosition += 0.1;
- }
- Button {
- text: "series vpos -"
- onClicked: series.verticalPosition -= 0.1;
- }
- Button {
- text: "series size +"
- onClicked: series.size += 0.1;
- }
- Button {
- text: "series size -"
- onClicked: series.size -= 0.1;
- }
- Button {
- text: "series start angle +"
- onClicked: series.startAngle += 1.1;
- }
- Button {
- text: "series start angle -"
- onClicked: series.startAngle -= 1.1;
- }
- Button {
- text: "series end angle +"
- onClicked: series.endAngle += 1.1;
- }
- Button {
- text: "series end angle -"
- onClicked: series.endAngle -= 1.1;
- }
- }
-
- // Buttons for editing slices
- Flow {
- id: slicesFlow
- spacing: 5
- flow: Flow.TopToBottom
- visible: false
-
- Button {
- text: "append slice"
- onClicked: series.append("slice" + (series.count + 1), 3.0);
- }
- Button {
- text: "remove slice"
- onClicked: series.remove(series.at(series.count - 1));
- }
- Button {
- text: "slice color"
- onClicked: series.at(sliceIndex).color = main.nextColor();
- }
- Button {
- text: "slice border color"
- onClicked: series.at(sliceIndex).borderColor = main.nextColor();
- }
- Button {
- text: "slice border width +"
- onClicked: series.at(sliceIndex).borderWidth++;
- }
- Button {
- text: "slice border width -"
- onClicked: series.at(sliceIndex).borderWidth--;
- }
- Button {
- text: "slice exploded"
- onClicked: series.at(sliceIndex).exploded = !series.at(sliceIndex).exploded;
- }
- Button {
- text: "slice explode dist +"
- onClicked: series.at(sliceIndex).explodeDistanceFactor += 0.1;
- }
- Button {
- text: "slice explode dist -"
- onClicked: series.at(sliceIndex).explodeDistanceFactor -= 0.1;
- }
- }
-
- // Buttons for editing labels
- Flow {
- id: labelsFlow
- spacing: 5
- flow: Flow.TopToBottom
- visible: false
-
- Button {
- text: "label visible"
- onClicked: series.at(sliceIndex).labelVisible = !series.at(sliceIndex).labelVisible;
- }
- Button {
- text: "LabelInsideNormal"
- onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelInsideNormal;
- }
- Button {
- text: "LabelInsideHorizontal"
- onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelInsideHorizontal;
- }
- Button {
- text: "LabelInsideTangential"
- onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelInsideTangential;
- }
- Button {
- text: "LabelOutside"
- onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelOutside;
- }
- Button {
- text: "label arm len +"
- onClicked: series.at(sliceIndex).labelArmLengthFactor += 0.1;
- }
- Button {
- text: "label arm len -"
- onClicked: series.at(sliceIndex).labelArmLengthFactor -= 0.1;
- }
- Button {
- text: "slice label color"
- onClicked: series.at(sliceIndex).labelColor = main.nextColor();
- }
-
- FontEditor {
- id: fontEditor
- fontDescription: "label"
- function editedFont() {
- return series.at(sliceIndex).labelFont;
- }
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml
deleted file mode 100644
index 64785d2b..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- title: "scatter series"
- property variant series: scatterSeries
- animationOptions: ChartView.SeriesAnimations
-
- ScatterSeries {
- id: scatterSeries
- name: "scatter 1"
- XYPoint { x: 1.5; y: 1.5 }
- XYPoint { x: 1.5; y: 1.6 }
- XYPoint { x: 1.57; y: 1.55 }
- XYPoint { x: 1.8; y: 1.8 }
- XYPoint { x: 1.9; y: 1.6 }
- XYPoint { x: 2.1; y: 1.3 }
- XYPoint { x: 2.5; y: 2.1 }
-
- pointLabelsFormat: "@xPoint, @yPoint";
-
- onNameChanged: console.log("scatterSeries.onNameChanged: " + name);
- onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible);
- onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
- onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
- onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
- onPointReplaced: console.log("scatterSeries.onPointReplaced: " + index);
- onPointRemoved: console.log("scatterSeries.onPointRemoved: " + index);
- onPointAdded: console.log("scatterSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y);
- onColorChanged: console.log("scatterSeries.onColorChanged: " + color);
- onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor);
- onBorderWidthChanged: console.log("scatterSeries.onBorderChanged: " + borderWidth);
- onCountChanged: console.log("scatterSeries.onCountChanged: " + count);
- onPointLabelsVisibilityChanged: console.log("lineSeries.onPointLabelsVisibilityChanged: "
- + visible);
- onPointLabelsFormatChanged: console.log("lineSeries.onPointLabelsFormatChanged: "
- + format);
- onPointLabelsFontChanged: console.log("lineSeries.onPointLabelsFontChanged: "
- + font.family);
- onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: "
- + color);
- }
-
- ScatterSeries {
- name: "scatter2"
- XYPoint { x: 2.0; y: 2.0 }
- XYPoint { x: 2.0; y: 2.1 }
- XYPoint { x: 2.07; y: 2.05 }
- XYPoint { x: 2.2; y: 2.9 }
- XYPoint { x: 2.4; y: 2.7 }
- XYPoint { x: 2.67; y: 2.65 }
- onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
- onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml
deleted file mode 100644
index 23afdb75..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Flow {
- id: flow
- spacing: 5
- flow: Flow.TopToBottom
- property variant series
-
- Button {
- text: "visible"
- onClicked: series.visible = !series.visible;
- }
- Button {
- text: "opacity +"
- onClicked: series.opacity += 0.1;
- }
- Button {
- text: "opacity -"
- onClicked: series.opacity -= 0.1;
- }
- Button {
- text: "color"
- onClicked: series.color = main.nextColor();
- }
- Button {
- text: "borderColor"
- onClicked: series.borderColor = main.nextColor();
- }
- Button {
- text: series != undefined ? "borderWidth + (" + series.borderWidth + ")" : ""
- onClicked: series.borderWidth += 0.5;
- }
- Button {
- text: series != undefined ? "borderWidth - (" + series.borderWidth + ")" : ""
- onClicked: series.borderWidth -= 0.5;
- }
- Button {
- text: "markerSize +"
- onClicked: series.markerSize += 1.0;
- }
- Button {
- text: "markerSize -"
- onClicked: series.markerSize -= 1.0;
- }
- Button {
- text: "markerShape"
- onClicked: series.markerShape = ((series.markerShape + 1) % 2);
- }
- Button {
- text: "point labels visible"
- onClicked: series.pointLabelsVisible = !series.pointLabelsVisible;
- }
- Button {
- text: "point labels format"
- onClicked: {
- if (series.pointLabelsFormat === "@xPoint, @yPoint")
- series.pointLabelsFormat = "(@xPoint)"
- else
- series.pointLabelsFormat = "@xPoint, @yPoint"
- }
- }
- Button {
- text: "point labels font"
- onClicked: {
- if (series.pointLabelsFont.family === "Times")
- series.pointLabelsFont.family = "Courier";
- else
- series.pointLabelsFont.family = "Times";
- }
- }
- Button {
- text: "point labels color"
- onClicked: series.pointLabelsColor = main.nextColor();
- }
- Button {
- text: "append point"
- onClicked: series.append(series.count - 1, series.count - 1);
- }
- Button {
- text: "replace point"
- onClicked: {
- var xyPoint = series.at(series.count - 1);
- series.replace(series.count - 1, xyPoint.x, xyPoint.y + 0.1);
- }
- }
- Button {
- text: "remove point"
- onClicked: series.remove(series.count - 1);
- }
- Button {
- text: "insert point"
- onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2);
- }
- Button {
- text: "clear"
- onClicked: series.clear();
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml
deleted file mode 100644
index e7c8793d..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- title: "spline series"
- anchors.fill: parent
- property variant series: splineSeries
- animationOptions: ChartView.SeriesAnimations
-
- SplineSeries {
- id: splineSeries
- name: "spline 1"
- XYPoint { x: 0; y: 0 }
- XYPoint { x: 1.1; y: 2.1 }
- XYPoint { x: 1.9; y: 3.3 }
- XYPoint { x: 2.1; y: 2.1 }
- XYPoint { x: 2.9; y: 4.9 }
- XYPoint { x: 3.4; y: 3.0 }
- XYPoint { x: 4.1; y: 3.3 }
-
- pointLabelsFormat: "@xPoint, @yPoint";
-
- onNameChanged: console.log("splineSeries.onNameChanged: " + name);
- onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible);
- onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
- onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
- onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
- onPointReplaced: console.log("splineSeries.onPointReplaced: " + index);
- onPointRemoved: console.log("splineSeries.onPointRemoved: " + index);
- onPointAdded: console.log("splineSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y);
- onColorChanged: console.log("splineSeries.onColorChanged: " + color);
- onWidthChanged: console.log("splineSeries.onWidthChanged: " + width);
- onStyleChanged: console.log("splineSeries.onStyleChanged: " + style);
- onCapStyleChanged: console.log("splineSeries.onCapStyleChanged: " + capStyle);
- onCountChanged: console.log("splineSeries.onCountChanged: " + count);
- onPointLabelsVisibilityChanged: console.log("splineSeries.onPointLabelsVisibilityChanged: "
- + visible);
- onPointLabelsFormatChanged: console.log("splineSeries.onPointLabelsFormatChanged: "
- + format);
- onPointLabelsFontChanged: console.log("splineSeries.onPointLabelsFontChanged: "
- + font.family);
- onPointLabelsColorChanged: console.log("splineSeries.onPointLabelsColorChanged: "
- + color);
- }
-
- SplineSeries {
- name: "spline 2"
- XYPoint { x: 1.1; y: 1.1 }
- XYPoint { x: 1.9; y: 2.3 }
- XYPoint { x: 2.1; y: 1.1 }
- XYPoint { x: 2.9; y: 3.9 }
- XYPoint { x: 3.4; y: 2.0 }
- XYPoint { x: 4.1; y: 2.3 }
- onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
- onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y);
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml
deleted file mode 100644
index 0890884c..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtCommercial.Chart 1.4
-
-ChartView {
- title: "Stacked bar series"
- anchors.fill: parent
- theme: ChartView.ChartThemeLight
- legend.alignment: Qt.AlignBottom
- animationOptions: ChartView.SeriesAnimations
-
- property variant series: mySeries
-
- StackedBarSeries {
- id: mySeries
- name: "bar"
- labelsFormat: "@value";
- axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
- BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
- onClicked: console.log("barset.onClicked: " + index);
- onHovered: console.log("barset.onHovered: " + status + " " + index);
- onPenChanged: console.log("barset.onPenChanged: " + pen);
- onBrushChanged: console.log("barset.onBrushChanged: " + brush);
- onLabelChanged: console.log("barset.onLabelChanged: " + label);
- onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush);
- onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont);
- onColorChanged: console.log("barset.onColorChanged: " + color);
- onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
- onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
- onCountChanged: console.log("barset.onCountChanged: " + count);
- onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count);
- onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count);
- onValueChanged: console.log("barset.onValuesChanged: " + index);
- }
- BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
- BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
-
- onNameChanged: console.log("stackedBarSeries.onNameChanged: " + series.name);
- onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible);
- onOpacityChanged: console.log("stackedBarSeries.onOpacityChanged: " + opacity);
- onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index);
- onHovered: console.log("stackedBarSeries.onHovered: " + barset
- + " " + status + " " + index);
- onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
- onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count);
- onLabelsFormatChanged: console.log("stackedBarSeries.onLabelsFormatChanged: "
- + format);
- onLabelsPositionChanged: console.log("stackedBarSeries.onLabelsPositionChanged: "
- + series.labelsPosition);
-
- function changeLabelsPosition() {
- if (labelsPosition === BarSeries.LabelsCenter)
- labelsPosition = BarSeries.LabelsInsideEnd;
- else
- labelsPosition = BarSeries.LabelsCenter;
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/loader.qml b/tests/quick2chartproperties/qml/quick2chartproperties/loader.qml
deleted file mode 100644
index 2b24d01c..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/loader.qml
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Item {
- id: container
- width: 640
- height: 500
- Component.onCompleted: {
- var co = Qt.createComponent("main.qml")
- if (co.status == Component.Ready) {
- var o = co.createObject(container)
- } else {
- console.log(co.errorString())
- console.log("QtCommercial.Chart 1.1 not available")
- console.log("Please use correct QML_IMPORT_PATH export")
- }
- }
-}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/main.qml b/tests/quick2chartproperties/qml/quick2chartproperties/main.qml
deleted file mode 100644
index 8265e1ae..00000000
--- a/tests/quick2chartproperties/qml/quick2chartproperties/main.qml
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Rectangle {
- id: main
- width: 800
- height: 600
- property int viewCount: 9
- property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"]
- property int colorIndex: 0
- property int buttonWidth: 42
-
- function nextColor() {
- colorIndex++;
- return colors[colorIndex % colors.length];
- }
-
- Row {
- anchors.top: parent.top
- anchors.bottom: buttonRow.top
- anchors.bottomMargin: 10
- anchors.left: parent.left
- anchors.right: parent.right
-
- Loader {
- id: chartLoader
- width: main.width - editorLoader.width
- height: parent.height
- source: "Chart.qml"
- onStatusChanged: {
- if (status == Loader.Ready && editorLoader.status == Loader.Ready && chartLoader.item) {
- if (source.toString().search("/Chart.qml") > 0)
- editorLoader.item.chart = chartLoader.item.chart;
- else
- editorLoader.item.series = chartLoader.item.series;
- }
- }
- }
-
- Loader {
- id: editorLoader
- width: 280
- height: parent.height
- source: "ChartEditor.qml"
- onStatusChanged: {
- if (status == Loader.Ready && chartLoader.status == Loader.Ready && chartLoader.item) {
- if (source.toString().search("/ChartEditor.qml") > 0)
- editorLoader.item.chart = chartLoader.item.chart;
- else
- editorLoader.item.series = chartLoader.item.series;
- }
- }
- }
- }
-
- Row {
- id: buttonRow
- height: 40
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- spacing: 10
-
- Button {
- text: "chart"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "Chart.qml";
- editorLoader.source = "ChartEditor.qml";
- }
- }
- Button {
- text: "pie"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "PieChart.qml";
- editorLoader.source = "PieEditor.qml";
- }
- }
- Button {
- text: "line"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "LineChart.qml";
- editorLoader.source = "LineEditor.qml";
- }
- }
- Button {
- text: "spline"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "SplineChart.qml";
- editorLoader.source = "LineEditor.qml";
- }
- }
- Button {
- text: "scatter"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "ScatterChart.qml";
- editorLoader.source = "ScatterEditor.qml";
- }
- }
- Button {
- text: "area"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "AreaChart.qml";
- editorLoader.source = "AreaEditor.qml";
- }
- }
- Button {
- text: "bar"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "BarChart.qml";
- editorLoader.source = "BarEditor.qml";
- }
- }
- Button {
- text: "sbar"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "StackedBarChart.qml";
- editorLoader.source = "BarEditor.qml";
- }
- }
- Button {
- text: "pbar"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "PercentBarChart.qml";
- editorLoader.source = "BarEditor.qml";
- }
- }
- Button {
- text: "hbar"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "HorizontalBarChart.qml";
- editorLoader.source = "BarEditor.qml";
- }
- }
- Button {
- text: "hsbar"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "HorizontalStackedBarChart.qml";
- editorLoader.source = "BarEditor.qml";
- }
- }
- Button {
- text: "hpbar"
- width: buttonWidth
- onClicked: {
- chartLoader.source = "HorizontalPercentBarChart.qml";
- editorLoader.source = "BarEditor.qml";
- }
- }
- }
-}
diff --git a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.cpp
deleted file mode 100644
index b58190f6..00000000
--- a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-// checksum 0xc01f version 0x90005
-/*
- This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
- QtQuick2ApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#include "qtquick2applicationviewer.h"
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QDir>
-#include <QtQml/QQmlEngine>
-
-class QtQuick2ApplicationViewerPrivate
-{
- QString mainQmlFile;
- friend class QtQuick2ApplicationViewer;
- static QString adjustPath(const QString &path);
-};
-
-QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
-{
-#if defined(Q_OS_IOS)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_MAC)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("%1/../Resources/%2")
- .arg(QCoreApplication::applicationDirPath(), path);
-#elif defined(Q_OS_BLACKBERRY)
- if (!QDir::isAbsolutePath(path))
- return QString::fromLatin1("app/native/%1").arg(path);
-#elif !defined(Q_OS_ANDROID)
- QString pathInInstallDir =
- QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
- pathInInstallDir =
- QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
- if (QFileInfo(pathInInstallDir).exists())
- return pathInInstallDir;
-#elif defined(Q_OS_ANDROID_NO_SDK)
- return QLatin1String("/data/user/qt/") + path;
-#endif
- return path;
-}
-
-QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
- : QQuickView(parent)
- , d(new QtQuick2ApplicationViewerPrivate())
-{
- connect(engine(), SIGNAL(quit()), SLOT(close()));
- setResizeMode(QQuickView::SizeRootObjectToView);
-}
-
-QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
-{
- delete d;
-}
-
-void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
-{
- d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
-#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
- setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
-#else
- setSource(QUrl::fromLocalFile(d->mainQmlFile));
-#endif
-}
-
-void QtQuick2ApplicationViewer::addImportPath(const QString &path)
-{
- engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
-}
-
-void QtQuick2ApplicationViewer::showExpanded()
-{
-#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
- showFullScreen();
-#else
- show();
-#endif
-}
diff --git a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.h b/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.h
deleted file mode 100644
index cf66f140..00000000
--- a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// checksum 0xfde6 version 0x90005
-/*
- This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
- QtQuick2ApplicationViewer is a convenience class containing mobile device specific
- code such as screen orientation handling. Also QML paths and debugging are
- handled here.
- It is recommended not to modify this file, since newer versions of Qt Creator
- may offer an updated version of it.
-*/
-
-#ifndef QTQUICK2APPLICATIONVIEWER_H
-#define QTQUICK2APPLICATIONVIEWER_H
-
-#include <QtQuick/QQuickView>
-
-class QtQuick2ApplicationViewer : public QQuickView
-{
- Q_OBJECT
-
-public:
- explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
- virtual ~QtQuick2ApplicationViewer();
-
- void setMainQmlFile(const QString &file);
- void addImportPath(const QString &path);
-
- void showExpanded();
-
-private:
- class QtQuick2ApplicationViewerPrivate *d;
-};
-
-#endif // QTQUICK2APPLICATIONVIEWER_H
diff --git a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.pri b/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.pri
deleted file mode 100644
index b2d0f51d..00000000
--- a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.pri
+++ /dev/null
@@ -1,6 +0,0 @@
-QT += qml quick widgets
-
-SOURCES += $$PWD/qtquick2applicationviewer.cpp
-HEADERS += $$PWD/qtquick2applicationviewer.h
-INCLUDEPATH += $$PWD
-
diff --git a/tests/quick2chartproperties/quick2chartproperties.pro b/tests/quick2chartproperties/quick2chartproperties.pro
deleted file mode 100644
index e665f9c5..00000000
--- a/tests/quick2chartproperties/quick2chartproperties.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../tests.pri ) {
- error( "Couldn't find the test.pri file!" )
-}
-
-RESOURCES += resources.qrc
-SOURCES += main.cpp
-OTHER_FILES += qml/quick2chartproperties/*
-
-include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
diff --git a/tests/quick2chartproperties/resources.qrc b/tests/quick2chartproperties/resources.qrc
deleted file mode 100644
index 181ff6c0..00000000
--- a/tests/quick2chartproperties/resources.qrc
+++ /dev/null
@@ -1,31 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/quick2chartproperties/loader.qml</file>
- <file>qml/quick2chartproperties/main.qml</file>
- <file>qml/quick2chartproperties/Button.qml</file>
- <file>qml/quick2chartproperties/PieChart.qml</file>
- <file>qml/quick2chartproperties/PieEditor.qml</file>
- <file>qml/quick2chartproperties/LineChart.qml</file>
- <file>qml/quick2chartproperties/LineEditor.qml</file>
- <file>qml/quick2chartproperties/SplineChart.qml</file>
- <file>qml/quick2chartproperties/ScatterChart.qml</file>
- <file>qml/quick2chartproperties/AreaChart.qml</file>
- <file>qml/quick2chartproperties/BarChart.qml</file>
- <file>qml/quick2chartproperties/BarEditor.qml</file>
- <file>qml/quick2chartproperties/ScatterEditor.qml</file>
- <file>qml/quick2chartproperties/AreaEditor.qml</file>
- <file>qml/quick2chartproperties/StackedBarChart.qml</file>
- <file>qml/quick2chartproperties/PercentBarChart.qml</file>
- <file>qml/quick2chartproperties/Chart.qml</file>
- <file>qml/quick2chartproperties/ChartEditor.qml</file>
- <file>qml/quick2chartproperties/FontEditor.qml</file>
- <file>qml/quick2chartproperties/HorizontalBarChart.qml</file>
- <file>qml/quick2chartproperties/HorizontalPercentBarChart.qml</file>
- <file>qml/quick2chartproperties/HorizontalStackedBarChart.qml</file>
- <file>qml/quick2chartproperties/ChartEditorAxis.qml</file>
- <file>qml/quick2chartproperties/ChartEditorLegend.qml</file>
- <file>qml/quick2chartproperties/ChartEditorProperties.qml</file>
- <file>qml/quick2chartproperties/ChartEditorTitle.qml</file>
- <file>qml/quick2chartproperties/ChartEditorSeries.qml</file>
- </qresource>
-</RCC>
diff --git a/tests/tests.pri b/tests/tests.pri
index ec0cd754..1a723c59 100644
--- a/tests/tests.pri
+++ b/tests/tests.pri
@@ -1,36 +1,13 @@
-!include( ../config.pri ) {
- error( "Couldn't find the config.pri file!" )
-}
+INCLUDEPATH += ../../include
+LIBS += -L$$OUT_PWD/../../lib
TEMPLATE = app
-DESTDIR = $$CHART_BUILD_BIN_DIR
-OBJECTS_DIR = $$CHART_BUILD_DIR/tests/$$TARGET
-MOC_DIR = $$CHART_BUILD_DIR/tests/$$TARGET
-UI_DIR = $$CHART_BUILD_DIR/tests/$$TARGET
-RCC_DIR = $$CHART_BUILD_DIR/tests/$$TARGET
-
-# staticlib config causes problems when building executables
-staticlib: CONFIG-=staticlib
+QT += charts
-android {
- # Workaround to fix android deployment, which seems to always look for target in
- # OUT_PWD instead of DESTDIR.
- COPY_PARAMETERS = "$$CHART_BUILD_BIN_DIR/lib$${TARGET}.so $$OUT_PWD/lib$${TARGET}.so"
- contains(QMAKE_HOST.os, Windows): COPY_PARAMETERS = $$replace(COPY_PARAMETERS, "/","\\")
- QMAKE_POST_LINK += $$QMAKE_COPY $$COPY_PARAMETERS
-
- contains(TARGET, qml.*) {
- charts_qmldir.files = $$CHART_BUILD_QML_PLUGIN_DIR/qmldir
- charts_qmldir.path = /assets/imports/QtCommercial/Chart
- charts_qmlplugin.files = $$CHART_BUILD_QML_PLUGIN_DIR/libqtcommercialchartqml.so
- charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
- INSTALLS += charts_qmldir charts_qmlplugin
- } else:contains(TARGET, quick2.*) {
- charts_qmldir.files = $$CHART_BUILD_QML2_PLUGIN_DIR/qmldir
- charts_qmldir.path = /assets/qml/QtCommercial/Chart
- charts_qmlplugin.files = $$CHART_BUILD_QML2_PLUGIN_DIR/libqtcommercialchartqml2.so
- charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH
- INSTALLS += charts_qmldir charts_qmlplugin
- }
+contains(TARGET, qml.*) {
+ QT += qml quick
}
+
+target.path = $$[QT_INSTALL_TESTS]/charts/$$TARGET
+INSTALLS += target
diff --git a/tests/tests.pro b/tests/tests.pro
index 79686122..e6aa3561 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -1,7 +1,3 @@
-!include( ../config.pri ) {
- error( "Couldn't find the config.pri file!" )
-}
-
TEMPLATE = subdirs
SUBDIRS += \
auto \
@@ -9,11 +5,6 @@ SUBDIRS += \
polarcharttest \
boxplottester
-!contains(QT_VERSION, ^5\\..*\\..*$)|qtHaveModule(declarative) {
- SUBDIRS += qmlchartproperties \
- qmlchartaxis
-}
-
contains(QT_CONFIG, opengl) {
SUBDIRS += chartwidgettest \
wavechart \
@@ -22,6 +13,7 @@ contains(QT_CONFIG, opengl) {
message("OpenGL not available. Some test apps are disabled")
}
-contains(QT_VERSION, ^5\\..*\\..*$):qtHaveModule(quick) {
- SUBDIRS += quick2chartproperties
+qtHaveModule(quick) {
+ SUBDIRS += qmlchartproperties \
+ qmlchartaxis
}
diff --git a/tests/wavechart/wavechart.cpp b/tests/wavechart/wavechart.cpp
index 82eaf125..dc05d073 100644
--- a/tests/wavechart/wavechart.cpp
+++ b/tests/wavechart/wavechart.cpp
@@ -21,7 +21,7 @@
#include "wavechart.h"
#include <cmath>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
#define PI 3.14159265358979
static const int numPoints =100;
diff --git a/tests/wavechart/wavechart.h b/tests/wavechart/wavechart.h
index 0bb3a904..336fa151 100644
--- a/tests/wavechart/wavechart.h
+++ b/tests/wavechart/wavechart.h
@@ -27,7 +27,7 @@
#include <QLineSeries>
#include <QChartView>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
class WaveChart: public QChartView
{
diff --git a/tools/demoLauncher/demoLauncher.pro b/tools/demoLauncher/demoLauncher.pro
index a8b8b122..bfee99da 100644
--- a/tools/demoLauncher/demoLauncher.pro
+++ b/tools/demoLauncher/demoLauncher.pro
@@ -1,5 +1,3 @@
-!include( ../../demos/demos.pri ):error( "Couldn't find the demos.pri file!" )
-
TARGET = demoLauncher
SOURCES += main.cpp\
widget.cpp \
diff --git a/tools/demoLauncher/widget.cpp b/tools/demoLauncher/widget.cpp
index b474c7fb..f8ac5daa 100644
--- a/tools/demoLauncher/widget.cpp
+++ b/tools/demoLauncher/widget.cpp
@@ -46,16 +46,16 @@ Widget::Widget(QWidget *parent)
// Create push buttons for starting the executables
QGridLayout* demosLayout = new QGridLayout;
- GraphicsButton *button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() + "demos_audio.png", m_appFolder, "audio", this);
+ GraphicsButton *button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() + "examples_audio.png", m_appFolder, "audio", this);
demosLayout->addWidget(button, 0, 0);
- button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demos_callout.png", m_appFolder, "callout", this);
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_callout.png", m_appFolder, "callout", this);
demosLayout->addWidget(button, 0, 1);
button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demo_chartthemes_blue_cerulean.png", m_appFolder, "chartthemes", this);
demosLayout->addWidget(button, 0, 2);
- button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"demos_nesteddonuts.png", m_appFolder, "nesteddonuts", this);
+ button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_nesteddonuts.png", m_appFolder, "nesteddonuts", this);
demosLayout->addWidget(button, 1, 0);
button = new GraphicsButton(imageFolder.absolutePath() + QDir::separator() +"examples_zoomlinechart1.png", m_appFolder, "zoomlinechart", this);