diff options
Diffstat (limited to 'src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp')
-rw-r--r-- | src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp b/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp index 62400865..62db806a 100644 --- a/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp +++ b/src/charts/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp @@ -116,12 +116,17 @@ void HorizontalPercentBarChartItem::handleUpdatedBars() 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; + if (p == 0) { + label->setVisible(false); } else { - valueLabel = m_series->labelsFormat(); - valueLabel.replace(valueTag, vString); + label->setVisible(true); + 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); |