summaryrefslogtreecommitdiffstats
path: root/src/charts/axis/chartaxiselement.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Update commercial license headers"Tarja Sundqvist2022-11-241-12/+12
| | | | | | | | | | | This reverts commit ce7fdf434cf040849a69008be5f0f091204c9f2e. Revert of commercial license headers is required for the Qt 6.2.x opensource releases, Qt 6.2.5 onwards. Task-number: QTBUG-107760 Change-Id: I2107f31650eb46a3a8dd563a5269b6bdeb78c0ff Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Fix axis vanishing with specific valuesJere Tuliniemi2022-06-141-1/+1
| | | | | | | | | | | Charting values 1000000000000 and 1000000000001 with QValueAxis would not work since qFuzzyCompare fails with those values. Fixes: QTBUG-102392 Change-Id: I06dd9b1a86da97d7cc5a59c7fd3696a8165c6205 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> (cherry picked from commit 14688ccb30d28273c1d4f2c245e9fa07442151ed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update commercial license headersTarja Sundqvist2022-05-271-12/+12
| | | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qtcharts.. Examples, tests, or documentation files are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the the line count causes failures in tests. Task-number: QTQAINFRA-4929 Change-Id: I52db4ff0f86002ff7a8421cff95337f9868fd9ba Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Antti Kokko <antti.kokko@qt.io>
* Add colorBy method to QXYSeries and QColorAxisLukas Kosinski2021-06-031-0/+77
| | | | | | | | | | | | | | This feature adds the availability to pass list of values that will be used to colorize points using points configuration feature according to the gradient. Gradient can be either set when calling the colorBy method or can be taken from attached QColorAxis. QColorAxis displays color scale widget with ticks and range based on data passed as colorBy method's parameter. Task-number: QTBUG-89447 Change-Id: I611048fac0e787e0a1eeaf181c5d8e8a8354fac5 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Add optional labels truncation to QAbstractAxisLukas Kosinski2021-06-021-0/+8
| | | | | | | | | | | | | | | | | This is a feature that allows users to switch off labels truncation that is by default performed if there is too little space for the label. By default truncateLabels is true, so it doesn't change previous behavior. If user doesn't want to have truncated labels, he can switch them off explicitly. There is also a labelsTruncated method added that returns true if there is at least one truncated label and false otherwise. The reason for this is to be able to programmatically check if labels are truncated. Task-number: QTBUG-89444 Change-Id: I8ab18a8d0335ddf31baf443a2046fee89ce58b38 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Rename ChartAxisElement::isEmpty to not collide with QGraphicsLayoutItemKeith Kyzivat2021-06-011-2/+2
| | | | | | | | | | | Rename ChartAxisElement::isEmpty so it no longer collides with QGraphicsLayoutItem::isEmpty, which was introduced in Qt 6.0. Task-number: QTBUG-92586 Change-Id: I14f062e7a0cb090d7da435edfa22d1c447cc1a13 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Remove unnecessary cast int(qFloor())Dimitrios Apostolou2021-05-211-2/+2
| | | | | | | | qFloor() already returns int. Change-Id: I62f13a5f270f0881b8de289147550ef901274939 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Replace code with simpler but equivalent codeDimitrios Apostolou2021-05-211-10/+6
| | | | | | | | | | | | The if-branching is unnecessary because ceil(a-b) == -floor(b-a) Also add comments to clarify subtle differences in seemingly identical code snippets. Change-Id: Idfd72e4aecf53805183f5b2741336d805fbfbb6a Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Fix assert crash when zooming too muchDimitrios Apostolou2021-05-211-2/+2
| | | | | | | | | | | | | | | Remove usage of qFuzzyCompare() when zooming in/out on the cartesian axis charts. Floating point comparisons work fine after the previous patch removed qCeil() and int() so that no conversions to integral types happen any longer. Now one can zoom in/out as much as he likes without any crashes or hangs. Task-number: QTBUG-93672 Change-Id: I72eae8ae2151f41efda0e37a26a8f66a3d93d26b Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Avoid infinite allocating loop when zooming in too muchDimitrios Apostolou2021-05-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use standard library ceil() and floor() instead of qCeil() and int(), because the latter return int, and in-between converting to/from floating-point math, the integer arithmetic causes wrap-arounds. To be more specific, the following part qCeil((minValue - value) / interval) returns a negative number because of int overflow, when the values are: minValue = 29.999999972060323 value = 0.0 interval = 9.3132257461547852e-09 As a result of this fix, the infinite allocating loop is avoided, but the program terminates with the following Q_ASSERT() when zooming in towards the limits of floating point precision. ASSERT: "labels.size() == labelList.size()" in file ../qt5/qtcharts/src/charts/axis/horizontalaxis.cpp, line 91 Task-number: QTBUG-93672 Change-Id: I5db17a55c3b10cfcb4e093f0ab78edb49f040a8c Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
* Add comments and clarify some codeDimitrios Apostolou2021-05-121-1/+5
| | | | | | Pick-to: 6.1 5.15 Change-Id: Ib0280e18d8e788631ae3c11674398c2725cbafa6 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Remove charts namespace for Qt6Michal Klocek2020-11-061-4/+4
| | | | | | | | | This auto refactor to remove charts namespace, just use qt one. [ChangeLog] Use QT_NAMESPACE as other modules. Change-Id: I7722ed2ff5cd84c594ea96db15e5df50a24f06b4 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Use QList instead of QVectorJarek Kobus2020-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notice the following API changes: -void QXYSeries::replace(QVector<QPointF> points); +void QXYSeries::replace(const QList<QPointF> &points); -bool QAbstractBarSeries::append(QVector<QBarSet *> sets); +bool QAbstractBarSeries::append(const QList<QBarSet *> &sets); -void QAbstractBarSeries::barsetsAdded(QVector<QBarSet *> sets); +void QAbstractBarSeries::barsetsAdded(const QList<QBarSet *> &sets); -void QAbstractBarSeries::barsetsRemoved(QVector<QBarSet *> sets); +void QAbstractBarSeries::barsetsRemoved(const QList<QBarSet *> &sets); -bool QBoxPlotSeries::append(QVector<QBoxSet *> boxes); +bool QBoxPlotSeries::append(const QList<QBoxSet *> &boxes); -bool QBoxPlotSeries::append(QVector<QBoxSet *> boxes); +bool QBoxPlotSeries::append(const QList<QBoxSet *> &boxes); -void QBoxPlotSeries::boxsetsAdded(QVector<QBoxSet *> sets); +void QBoxPlotSeries::boxsetsAdded(const QList<QBoxSet *> &sets); -void QBoxPlotSeries::boxsetsRemoved(QVector<QBoxSet *> sets); +void QBoxPlotSeries::boxsetsRemoved(const QList<QBoxSet *> &sets); -bool QPieSeries::append(QVector<QPieSlice *> slices); +bool QPieSeries::append(const QList<QPieSlice *> &slices); -QPieSlice *QPieSeries::append(QString label, qreal value); +QPieSlice *QPieSeries::append(const QString &label, qreal value); -void QPieSeries::added(QVector<QPieSlice *> slices); +void QPieSeries::added(const QList<QPieSlice *> &slices); -void QPieSeries::removed(QVector<QPieSlice *> slices); +void QPieSeries::removed(const QList<QPieSlice *> &slices); These should be source compatible changes. Task-number: QTBUG-84469 Change-Id: I153796e9d8244c8e22819993ef26aa91e7b71f99 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix deprecation warningsFriedemann Kleint2019-05-271-3/+3
| | | | | | | | | | | Fix warnings: animations/axisanimation.cpp:117:51: warning: 'QVariant qVariantFromValue(const T&) [with T = QVector<double>]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] ... axis/chartaxiselement.cpp:385:64: warning: 'QString& QString::sprintf(const char*, ...)' is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations] ... Change-Id: Ib36d7e09b737110323b816442b36ca2b2e79d6a5 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Implement label editing feature in the QDateTimeAxisMiklós Márton2018-11-061-7/+48
| | | | | | | | | | | Implement the labelsEditable property handling in the QDateTimeAxis. If this property set to true the user will be able to manipulate the axis labels by double clicking on it and entering a new date in the same format as it is displayed. After finishing the edit the axis range will be adjusted according to the entered date. Change-Id: Ide45982875924c8bb4e937b47511dfa3c9237750 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Add label editing feature to the QValueAxisMiklós Márton2018-10-301-0/+41
| | | | | | | | | | | | | Add a new property (labelsEditable) to the QAbstractAxis. If this property set to true the user will be able to manipulate the axis labels by double clicking on it and entering a new value. After finishing the edit the axis range will adjusted according to the entered value. At the moment only the QValueAxis is supported, but I am planning to add support for QLogValueAxis, and QDateTimeAxis after the basic implementation details got reviewed. Change-Id: Id87ebfbfb37ed00f09cf7b651395cf3caead1dbb Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Fix namespaced buildLiang Qi2018-10-041-2/+2
| | | | | | | | | | | It is not allowed to include files within Qt namespace. This amends a93849d0. See 5b99f3a3 in qtbase dev. Task-number: QTBUG-70907 Change-Id: I37f0924429313f2251f656bcd5b6b248a22ccfbb Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* ChartAxisElement: cleanup unused codeSamuel Gaist2018-08-271-2/+0
| | | | | | | | This patch removes an unused variable from createDateTimeLabels. Task-number: QTBUG-70179 Change-Id: Iafabb474890913c33d95d3766f243e8145f0935b Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-06-231-22/+27
|\ | | | | | | Change-Id: Ib0ce93137bb1ddc61de77d82c28e25a238f544a0
| * Migrate ChartAxisElement to QRegularExpressionSamuel Gaist2018-06-191-22/+27
| | | | | | | | | | | | | | | | This patch updates the ChartAxisElement to use QRegularExpression in place of QRegExp which is to be considered deprecated. Change-Id: I9f028e69c8337e5aad59351c9cccf222169df849 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* | Implement dynamic tick handling for ValueAxisMika Salmela2018-03-081-6/+52
|/ | | | | | | Adds properties to define dynamic tick positioning for ValueAxis. Change-Id: Ife2ff3032492e063604adba9bd63eed72c0e0a16 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* When passing empty QStrings as label format should revert to the defaultAndy Shaw2017-12-011-2/+2
| | | | | | | | | | This ensures that the QML and widgets side both behave in the same way as the QML side handled an empty string as reverting back to the default. Whereas the widget side did not, now it will ensure that it is consistent. Change-Id: Ibc3f149f1761586e5fa04420e3b78bed169304d1 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Ensure axis geometry is correct when axis is shownMiikka Heikkinen2016-09-191-2/+9
| | | | | | | | | | | | Axis geometry calculations are not done for hidden axes for optimization reasons, so we need to explicitly do them when axes are shown, if necessary. Task-number: QTBUG-56037 Change-Id: Idf216dfe2c2437ca8a23ead46504edb8769f4c2d Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Mika Salmela <mika.salmela@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* Updated licenseMiikka Heikkinen2016-01-131-9/+17
| | | | | | Change-Id: I7ad9838039b56b9e3a7fe2c42a2d8ff818f393fb Reviewed-by: Titta Heikkala <titta.heikkala@theqtcompany.com> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Updated license headersTitta Heikkala2015-10-201-11/+14
| | | | | Change-Id: Ic72ee3c9723c2b3f3368c79219b7468f5d95aa84 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Added grid color property for value axisTitta Heikkala2015-09-151-0/+4
| | | | | | | | | Added possibility to set the color of the grid lines for value axes. Change-Id: I38b634410e7f1cb996d80f5ac1650a1be844ca01 Task-number: QTRD-3319 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Make category axis label positioning at value work for polar chartsMiikka Heikkinen2015-09-091-0/+14
| | | | | | Task-number: QTRD-3515 Change-Id: Icd38469386c7fc923047533f2a25b726f2f6caa5 Reviewed-by: Titta Heikkala <titta.heikkala@theqtcompany.com>
* Added minor ticks to value axisTitta Heikkala2015-09-071-0/+27
| | | | | | | | | | Added possibility to set minor tick for value axis. By default the count of minor ticks is zero. The arrow of minor ticks follows the color and pen of the arrows of the major ticks as it's part of axis. Change-Id: I8a422caaeedcd18ee6144e8636e3903d16f0632c Task-number: QTRD-3294 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Add possibility to set reverse values to axesTitta Heikkala2015-07-031-0/+9
| | | | | | | | | Added support for reverse axis. This works with line, spline, scatter and area series with cartesian chart. QBarCategoryAxis is not supported, nor different bar series. Change-Id: I60f21372ea9cee7b49918d7d99de24671bdc42c3 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Copyright header changesTitta Heikkala2015-04-231-3/+3
| | | | | | | Copyright header changes for Qt 5.5. Change-Id: I2b8e9356997de2c87a7436bcefd4d0948d566259 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Fix QNX build issueTitta Heikkala2015-04-231-5/+6
| | | | | | | Use qmath and cmath methods instead of math.h methods. Change-Id: I7c853f2e1218a1d3cde15a089192c24a6b0b1395 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Remove deprecated elements from APIs.Miikka Heikkinen2014-11-121-12/+0
| | | | | | | Task-number: QTRD-2098 Change-Id: Ib658c8a51af0b73ded5d6b13c8fa58762f859961 Reviewed-by: Mika Salmela <mika.salmela@theqtcompany.com> Reviewed-by: Titta Heikkala <titta.heikkala@theqtcompany.com>
* Updated license headersTitta Heikkala2014-11-121-9/+7
| | | | | | | Updated new license headers and added missing ones to qdoc files. Change-Id: I9f2af2a8b44c3ebf19fd494628dfaa8775a47b06 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Fix chart axis label formatTitta Heikkala2014-10-211-1/+1
| | | | | | | | | The label format for axis can now be set so that there's a separator for thousands, for example, with setLabelFormat("%'5.2f") Change-Id: Ic159776039d04a91a7ccf648800bd9720c41246e Task-number: QTRD-3347 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Fix include syntaxTitta Heikkala2014-10-201-7/+7
| | | | | | | | | The includes for the whole project are changed to syntax: '#include <module/class> Change-Id: If32f8b6c3f47516ad6bc30ed40789ea9042d5664 Task-number: QTRD-3373 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>
* Qt Charts project file structure changeTitta Heikkala2014-10-141-0/+404
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>