mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 08:08:42 +00:00
User Chart - Fix leyends and labels on Pie chart
Reported by Marcen at the users forum: - Only % was displayed and at the wrong legend - Slice labels were not scaled
This commit is contained in:
@@ -303,9 +303,10 @@ GenericPlot::setSeriesVisible(QString name, bool visible)
|
|||||||
void
|
void
|
||||||
GenericPlot::pieHover(QPieSlice *slice, bool state)
|
GenericPlot::pieHover(QPieSlice *slice, bool state)
|
||||||
{
|
{
|
||||||
if (havelegend.count() == 0) return;
|
foreach (QString l, havelegend) {
|
||||||
if (state == true) legend->setValue(GPointF(0, round(slice->percentage()*1000)/10, -1), havelegend.first());
|
if (state) legend->setValue(GPointF(0, l.endsWith(" %") ? round(slice->percentage()*1000)/10 : slice->value(), -1), l);
|
||||||
else legend->unhover(havelegend.first());
|
else legend->unhover(l);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle hover on barset
|
// handle hover on barset
|
||||||
@@ -881,6 +882,7 @@ GenericPlot::addCurve(QString name, QVector<double> xseries, QVector<double> yse
|
|||||||
slice->setLabelVisible();
|
slice->setLabelVisible();
|
||||||
slice->setLabelBrush(QBrush(GColor(CPLOTMARKER)));
|
slice->setLabelBrush(QBrush(GColor(CPLOTMARKER)));
|
||||||
slice->setPen(Qt::NoPen);
|
slice->setPen(Qt::NoPen);
|
||||||
|
slice->setLabelFont(labelsfont);
|
||||||
if (i <colors.size()) slice->setBrush(QColor(colors.at(i)));
|
if (i <colors.size()) slice->setBrush(QColor(colors.at(i)));
|
||||||
else slice->setBrush(Qt::red);
|
else slice->setBrush(Qt::red);
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
Reference in New Issue
Block a user