| 1 | // Copyright (C) 2016 The Qt Company Ltd.cxx . . $ `<file>/src/charts/barchart/vertical/percent/percentbarchartitem.cpp`/ |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include <private/percentbarchartitem_p.h>cxx . . $ `<file>/build/include/QtCharts/6.10.2/QtCharts/private/percentbarchartitem_p.h`/ |
| 5 | #include <private/bar_p.h>cxx . . $ `<file>/build/include/QtCharts/6.10.2/QtCharts/private/bar_p.h`/ |
| 6 | #include <private/qabstractbarseries_p.h>cxx . . $ `<file>/build/include/QtCharts/6.10.2/QtCharts/private/qabstractbarseries_p.h`/ |
| 7 | #include <QtCharts/QBarSet>cxx . . $ `<file>/build/include/QtCharts/QBarSet`/ |
| 8 | #include <private/qbarset_p.h>cxx . . $ `<file>/build/include/QtCharts/6.10.2/QtCharts/private/qbarset_p.h`/ |
| 9 | |
| 10 | QT_BEGIN_NAMESPACEcxx . . $ `<external>/7770798561591309169/qtconfigmacros.h:103:10`! |
| 11 | |
| 12 | PercentBarChartItemcxx . . $ PercentBarChartItem#::PercentBarChartItemcxx . . $ PercentBarChartItem#PercentBarChartItem(6830fdae55339244).(QAbstractBarSeriescxx . . $ QAbstractBarSeries# *series, QGraphicsItemcxx . . $ QGraphicsItem#* item) : |
| 13 | AbstractBarChartItemcxx . . $ AbstractBarChartItem#AbstractBarChartItem(6830fdae55339244).(series, item) |
| 14 | { |
| 15 | m_orientationcxx . . $ AbstractBarChartItem#m_orientation. = Qtcxx . . $ Qt/::Verticalcxx . . $ Qt/Vertical.; |
| 16 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(series, SIGNALcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:59:11`!(labelsPositionChanged(QAbstractBarSeries::LabelsPosition)), |
| 17 | this, SLOTcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:58:11`!(handleLabelsPositionChanged())); |
| 18 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(series, SIGNALcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:59:11`!(labelsFormatChanged(QString)), this, SLOTcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:58:11`!(positionLabels())); |
| 19 | } |
| 20 | |
| 21 | QStringcxx . . $ QString# PercentBarChartItemcxx . . $ PercentBarChartItem#::generateLabelTextcxx . . $ PercentBarChartItem#generateLabelText(db890b177bd0b123).(int set, int category, qrealcxx . . $ qreal# value) |
| 22 | { |
| 23 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(value); |
| 24 | |
| 25 | static const QStringcxx . . $ QString# valueTagcxx . . $ QString#QString(4641beeb24e75d60).(QLatin1Stringcxx . . $ QLatin1String#QLatin1String(aac1607cfe1c1740).("@value")); |
| 26 | qrealcxx . . $ qreal# p = m_seriescxx . . $ AbstractBarChartItem#m_series.->d_funccxx . . $ QAbstractBarSeries#d_func(297e9aa7906a47f0).()->percentageAtcxx . . $ QAbstractBarSeriesPrivate#percentageAt(242e37eefae635ba).(set, category) * 100.0; |
| 27 | QStringcxx . . $ QString# vString(presentercxx . . $ ChartElement#presenter(5d8bc989560ce152).()->numberToStringcxx . . $ ChartPresenter#numberToString(ac5d358e2e30f7ea).(p, 'f', 0)); |
| 28 | QStringcxx . . $ QString# valueLabelcxx . . $ QString#QString(ced63f7c635d850d).; |
| 29 | if (m_seriescxx . . $ AbstractBarChartItem#m_series.->labelsFormatcxx . . $ QAbstractBarSeries#labelsFormat(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 30 | vString.appendcxx . . $ QString#append(6a89d0b7f4d2681c).(QStringLiteralcxx . . $ `<external>/13954984326995544643/qstring.h:1789:9`!("%")); |
| 31 | valueLabel =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). vString; |
| 32 | } else { |
| 33 | valueLabel =cxx . . $ QString#`operator=`(4f35bf974e7f8568). m_seriescxx . . $ AbstractBarChartItem#m_series.->labelsFormatcxx . . $ QAbstractBarSeries#labelsFormat(6ef7b6c27b00b43d).(); |
| 34 | valueLabel.replacecxx . . $ QString#replace(192e628656427d1c).(valueTag, vString); |
| 35 | } |
| 36 | |
| 37 | return valueLabelcxx . . $ QString#QString(28715ad661ad3cec).; |
| 38 | } |
| 39 | |
| 40 | void PercentBarChartItemcxx . . $ PercentBarChartItem#::initializeLayoutcxx . . $ PercentBarChartItem#initializeLayout(cb82e25e9f99304e).(int set, int category, |
| 41 | int layoutIndex, bool resetAnimation) |
| 42 | { |
| 43 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(set); |
| 44 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(resetAnimation); |
| 45 | |
| 46 | QRectFcxx . . $ QRectF# rectcxx . . $ QRectF#QRectF(ced63f7c635d850d).; |
| 47 | |
| 48 | if (set > 0) { |
| 49 | QBarSetcxx . . $ QBarSet# *barSet = m_seriescxx . . $ AbstractBarChartItem#m_series.->barSetscxx . . $ QAbstractBarSeries#barSets(f70c8585470d460d).().atcxx . . $ QList#at(c7965f769b39929).(set - 1); |
| 50 | Barcxx . . $ Bar# *bar = m_indexForBarMapcxx . . $ AbstractBarChartItem#m_indexForBarMap..valuecxx . . $ QMap#value(6f0b2e7f225a8193).(barSet).valuecxx . . $ QHash#value(5f65a9ee2c9899ff).(category); |
| 51 | rect =cxx . . $ QRectF#`operator=`(3f67a4dd264143d7). m_layoutcxx . . $ AbstractBarChartItem#m_layout..atcxx . . $ QList#at(c7965f769b39929).(bar->layoutIndexcxx . . $ Bar#layoutIndex(455f465bc33b4cdf).()); |
| 52 | rect.setBottomcxx . . $ QRectF#setBottom(4cbbf9c7388e6885).(rect.topcxx . . $ QRectF#top(d8440c0a87ad7443).()); |
| 53 | } else { |
| 54 | QPointFcxx . . $ QPointF# topLeftcxx . . $ QPointF#QPointF(ced63f7c635d850d).; |
| 55 | QPointFcxx . . $ QPointF# bottomRightcxx . . $ QPointF#QPointF(ced63f7c635d850d).; |
| 56 | const qrealcxx . . $ qreal# barWidth = m_seriescxx . . $ AbstractBarChartItem#m_series.->d_funccxx . . $ QAbstractBarSeries#d_func(297e9aa7906a47f0).()->barWidthcxx . . $ QAbstractBarSeriesPrivate#barWidth(21b6c25e127938e2).() * m_seriesWidthcxx . . $ AbstractBarChartItem#m_seriesWidth.; |
| 57 | if (domaincxx . . $ ChartItem#domain(5cac03e8cc8efe20).()->typecxx . . $ AbstractDomain#type(2e74b825728e010c).() == AbstractDomaincxx . . $ AbstractDomain#::XLogYDomaincxx . . $ AbstractDomain#XLogYDomain. |
| 58 | || domaincxx . . $ ChartItem#domain(5cac03e8cc8efe20).()->typecxx . . $ AbstractDomain#type(2e74b825728e010c).() == AbstractDomaincxx . . $ AbstractDomain#::LogXLogYDomaincxx . . $ AbstractDomain#LogXLogYDomain.) { |
| 59 | topLeft =cxx . . $ QPointF#`operator=`(6b56849cfae83b80). topLeftPointcxx . . $ PercentBarChartItem#topLeftPoint(81fed4753d81c395).(category, barWidth, domaincxx . . $ ChartItem#domain(5cac03e8cc8efe20).()->minYcxx . . $ AbstractDomain#minY(21b6c25e127938e2).()); |
| 60 | bottomRight =cxx . . $ QPointF#`operator=`(6b56849cfae83b80). bottomRightPointcxx . . $ PercentBarChartItem#bottomRightPoint(81fed4753d81c395).(category, barWidth, domaincxx . . $ ChartItem#domain(5cac03e8cc8efe20).()->minYcxx . . $ AbstractDomain#minY(21b6c25e127938e2).()); |
| 61 | } else { |
| 62 | topLeft =cxx . . $ QPointF#`operator=`(6b56849cfae83b80). topLeftPointcxx . . $ PercentBarChartItem#topLeftPoint(81fed4753d81c395).(category, barWidth, 0.0); |
| 63 | bottomRight =cxx . . $ QPointF#`operator=`(6b56849cfae83b80). bottomRightPointcxx . . $ PercentBarChartItem#bottomRightPoint(81fed4753d81c395).(category, barWidth, 0.0); |
| 64 | } |
| 65 | if (m_validDatacxx . . $ ChartItem#m_validData.) { |
| 66 | rect.setTopLeftcxx . . $ QRectF#setTopLeft(ab630782559f0e6a).(topLeft); |
| 67 | rect.setBottomRightcxx . . $ QRectF#setBottomRight(ab630782559f0e6a).(bottomRight); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | m_layoutcxx . . $ AbstractBarChartItem#m_layout.[cxx . . $ QList#`operator[]`(f5945173c490e616).layoutIndex] =cxx . . $ QRectF#`operator=`(de76e1d1054206f9). rect.normalizedcxx . . $ QRectF#normalized(d933aaadbc70ad5c).(); |
| 72 | } |
| 73 | |
| 74 | void PercentBarChartItemcxx . . $ PercentBarChartItem#::markLabelsDirtycxx . . $ PercentBarChartItem#markLabelsDirty(43b55071fb153102).(QBarSetcxx . . $ QBarSet# *barset, int index, int count) |
| 75 | { |
| 76 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(barset); |
| 77 | // Percent series need to dirty all labels of the stack |
| 78 | QListcxx . . $ QList#<QBarSetcxx . . $ QBarSet# *> sets = m_barMapcxx . . $ AbstractBarChartItem#m_barMap..keyscxx . . $ QMap#keys(bf6c511543d55010).(); |
| 79 | for (int set = 0; set < sets.sizecxx . . $ QList#size(6b0412d51016192f).(); set++) |
| 80 | AbstractBarChartItemcxx . . $ AbstractBarChartItem#::markLabelsDirtycxx . . $ AbstractBarChartItem#markLabelsDirty(43b55071fb153102).(sets.atcxx . . $ QList#at(c7965f769b39929).(set), index, count); |
| 81 | } |
| 82 | |
| 83 | QPointFcxx . . $ QPointF# PercentBarChartItemcxx . . $ PercentBarChartItem#::topLeftPointcxx . . $ PercentBarChartItem#topLeftPoint(81fed4753d81c395).(int category, qrealcxx . . $ qreal# barWidth, qrealcxx . . $ qreal# value) |
| 84 | { |
| 85 | return domaincxx . . $ ChartItem#domain(5cac03e8cc8efe20).()->calculateGeometryPointcxx . . $ AbstractDomain#calculateGeometryPoint(bebd8eb4dc97543b).( |
| 86 | QPointFcxx . . $ QPointF#QPointF(acbf2dbd75fdf3c4).(m_seriesPosAdjustmentcxx . . $ AbstractBarChartItem#m_seriesPosAdjustment. + category - (barWidth / 2.0), value), m_validDatacxx . . $ ChartItem#m_validData.); |
| 87 | } |
| 88 | |
| 89 | QPointFcxx . . $ QPointF# PercentBarChartItemcxx . . $ PercentBarChartItem#::bottomRightPointcxx . . $ PercentBarChartItem#bottomRightPoint(81fed4753d81c395).(int category, qrealcxx . . $ qreal# barWidth, qrealcxx . . $ qreal# value) |
| 90 | { |
| 91 | return domaincxx . . $ ChartItem#domain(5cac03e8cc8efe20).()->calculateGeometryPointcxx . . $ AbstractDomain#calculateGeometryPoint(bebd8eb4dc97543b).( |
| 92 | QPointFcxx . . $ QPointF#QPointF(acbf2dbd75fdf3c4).(m_seriesPosAdjustmentcxx . . $ AbstractBarChartItem#m_seriesPosAdjustment. + category + (barWidth / 2.0), value), m_validDatacxx . . $ ChartItem#m_validData.); |
| 93 | } |
| 94 | |
| 95 | QListcxx . . $ QList#<QRectFcxx . . $ QRectF#> PercentBarChartItemcxx . . $ PercentBarChartItem#::calculateLayoutcxx . . $ PercentBarChartItem#calculateLayout(a1cbdfdfd91c620f).() |
| 96 | { |
| 97 | QListcxx . . $ QList#<QRectFcxx . . $ QRectF#> layoutcxx . . $ QList#QList(ced63f7c635d850d).; |
| 98 | layout.resizecxx . . $ QList#resize(35cb52607f6af42f).(m_layoutcxx . . $ AbstractBarChartItem#m_layout..sizecxx . . $ QList#size(6b0412d51016192f).()); |
| 99 | |
| 100 | const int setCount = m_seriescxx . . $ AbstractBarChartItem#m_series.->countcxx . . $ QAbstractBarSeries#count(455f465bc33b4cdf).(); |
| 101 | const qrealcxx . . $ qreal# barWidth = m_seriescxx . . $ AbstractBarChartItem#m_series.->d_funccxx . . $ QAbstractBarSeries#d_func(297e9aa7906a47f0).()->barWidthcxx . . $ QAbstractBarSeriesPrivate#barWidth(21b6c25e127938e2).() * m_seriesWidthcxx . . $ AbstractBarChartItem#m_seriesWidth.; |
| 102 | |
| 103 | QListcxx . . $ QList#<qrealcxx . . $ qreal#> categorySumscxx . . $ QList#QList(35cb52607f6af42f).(m_categoryCountcxx . . $ AbstractBarChartItem#m_categoryCount.); |
| 104 | QListcxx . . $ QList#<qrealcxx . . $ qreal#> tempSumscxx . . $ QList#QList(e310bc9e913cb8b1).(m_categoryCountcxx . . $ AbstractBarChartItem#m_categoryCount., 0.0); |
| 105 | |
| 106 | for (int category = 0; category < m_categoryCountcxx . . $ AbstractBarChartItem#m_categoryCount.; category++) |
| 107 | categorySums[cxx . . $ QList#`operator[]`(f5945173c490e616).category] = m_seriescxx . . $ AbstractBarChartItem#m_series.->d_funccxx . . $ QAbstractBarSeries#d_func(297e9aa7906a47f0).()->categorySumcxx . . $ QAbstractBarSeriesPrivate#categorySum(4badf5dbac1308a7).(category + m_firstCategorycxx . . $ AbstractBarChartItem#m_firstCategory.); |
| 108 | |
| 109 | for (int set = 0; set < setCount; set++) { |
| 110 | QBarSetcxx . . $ QBarSet# *barSet = m_seriescxx . . $ AbstractBarChartItem#m_series.->barSetscxx . . $ QAbstractBarSeries#barSets(f70c8585470d460d).().atcxx . . $ QList#at(c7965f769b39929).(set); |
| 111 | const QListcxx . . $ QList#<Barcxx . . $ Bar# *> bars = m_barMapcxx . . $ AbstractBarChartItem#m_barMap..valuecxx . . $ QMap#value(6f0b2e7f225a8193).(barSet); |
| 112 | for (int i = 0; i < m_categoryCountcxx . . $ AbstractBarChartItem#m_categoryCount.; i++) { |
| 113 | Barcxx . . $ Bar# *bar = bars.atcxx . . $ QList#at(c7965f769b39929).(i); |
| 114 | const int category = bar->indexcxx . . $ Bar#index(455f465bc33b4cdf).(); |
| 115 | qrealcxx . . $ qreal# &sum = tempSums[cxx . . $ QList#`operator[]`(f5945173c490e616).category - m_firstCategorycxx . . $ AbstractBarChartItem#m_firstCategory.]; |
| 116 | const qrealcxx . . $ qreal# &categorySum = categorySums.atcxx . . $ QList#at(c7965f769b39929).(category - m_firstCategorycxx . . $ AbstractBarChartItem#m_firstCategory.); |
| 117 | qrealcxx . . $ qreal# value = barSet->atcxx . . $ QBarSet#at(8bbae5fb2e9ef7ac).(category); |
| 118 | QRectFcxx . . $ QRectF# rectcxx . . $ QRectF#QRectF(ced63f7c635d850d).; |
| 119 | qrealcxx . . $ qreal# topY = 0.0; |
| 120 | qrealcxx . . $ qreal# newSum = value + sum; |
| 121 | qrealcxx . . $ qreal# bottomY = 0.0; |
| 122 | if (categorySum != 0.0) { |
| 123 | if (newSum > 0.0) |
| 124 | topY = 100.0 * newSum / categorySum; |
| 125 | if (sum > 0.0) |
| 126 | bottomY = 100.0 * sum / categorySum; |
| 127 | } |
| 128 | QPointFcxx . . $ QPointF# topLeft = topLeftPointcxx . . $ PercentBarChartItem#topLeftPoint(81fed4753d81c395).(category, barWidth, topY); |
| 129 | QPointFcxx . . $ QPointF# bottomRightcxx . . $ QPointF#QPointF(ced63f7c635d850d).; |
| 130 | if (domaincxx . . $ ChartItem#domain(5cac03e8cc8efe20).()->typecxx . . $ AbstractDomain#type(2e74b825728e010c).() == AbstractDomaincxx . . $ AbstractDomain#::XLogYDomaincxx . . $ AbstractDomain#XLogYDomain. |
| 131 | || domaincxx . . $ ChartItem#domain(5cac03e8cc8efe20).()->typecxx . . $ AbstractDomain#type(2e74b825728e010c).() == AbstractDomaincxx . . $ AbstractDomain#::LogXLogYDomaincxx . . $ AbstractDomain#LogXLogYDomain.) { |
| 132 | bottomRight =cxx . . $ QPointF#`operator=`(6b56849cfae83b80). bottomRightPointcxx . . $ PercentBarChartItem#bottomRightPoint(81fed4753d81c395).(category, barWidth, |
| 133 | set ? bottomY : domaincxx . . $ ChartItem#domain(5cac03e8cc8efe20).()->minYcxx . . $ AbstractDomain#minY(21b6c25e127938e2).()); |
| 134 | } else { |
| 135 | bottomRight =cxx . . $ QPointF#`operator=`(6b56849cfae83b80). bottomRightPointcxx . . $ PercentBarChartItem#bottomRightPoint(81fed4753d81c395).(category, barWidth, bottomY); |
| 136 | } |
| 137 | |
| 138 | rect.setTopLeftcxx . . $ QRectF#setTopLeft(ab630782559f0e6a).(topLeft); |
| 139 | rect.setBottomRightcxx . . $ QRectF#setBottomRight(ab630782559f0e6a).(bottomRight); |
| 140 | layout[cxx . . $ QList#`operator[]`(f5945173c490e616).bar->layoutIndexcxx . . $ Bar#layoutIndex(455f465bc33b4cdf).()] =cxx . . $ QRectF#`operator=`(de76e1d1054206f9). rect.normalizedcxx . . $ QRectF#normalized(d933aaadbc70ad5c).(); |
| 141 | sum = newSum; |
| 142 | } |
| 143 | } |
| 144 | return layout; |
| 145 | } |
| 146 | |
| 147 | void PercentBarChartItemcxx . . $ PercentBarChartItem#::handleLabelsPositionChangedcxx . . $ PercentBarChartItem#handleLabelsPositionChanged(49f6e7a06ebc5aa8).() |
| 148 | { |
| 149 | positionLabelscxx . . $ PercentBarChartItem#positionLabels(49f6e7a06ebc5aa8).(); |
| 150 | } |
| 151 | |
| 152 | void PercentBarChartItemcxx . . $ PercentBarChartItem#::positionLabelscxx . . $ PercentBarChartItem#positionLabels(49f6e7a06ebc5aa8).() |
| 153 | { |
| 154 | positionLabelsVerticalcxx . . $ AbstractBarChartItem#positionLabelsVertical(49f6e7a06ebc5aa8).(); |
| 155 | } |
| 156 | |
| 157 | QT_END_NAMESPACEcxx . . $ `<external>/7770798561591309169/qtconfigmacros.h:104:10`! |
| 158 | |
| 159 | #include "moc_percentbarchartitem_p.cpp"cxx . . $ `<file>/build/src/charts/Charts_autogen/include/moc_percentbarchartitem_p.cpp`/ |