Commit 91e17095 authored by Adriaan de Groot's avatar Adriaan de Groot 💬
Browse files

Use nice formatting of values

For the "usual" use of bar graphs, say for percentages, this
doesn't matter because the range 0-100 is readable anyway.
But for silly graphs like free memory you want
to have a formatted value rather than 'g' style floats
(2.1+e07 vs 21000000 -- neither is readable as 21M but
for that we would need to have a formatter option
"whatever metric prefix fits")
parent d424f3ea
......@@ -27,6 +27,7 @@
#include <QPainter>
#include <kiconloader.h>
#include <formatter/Formatter.h> // from libksysguard
#include "StyleEngine.h"
......@@ -160,7 +161,7 @@ void BarGraph::paintEvent( QPaintEvent* )
footers[ b ] );
p.drawText( b * barWidth + 3, h - fm.lineSpacing() - 2,
barWidth - 2 * 3, fm.lineSpacing(), Qt::AlignCenter,
QStringLiteral( "%1" ).arg( samples[ b ] ) );
KSysGuard::Formatter::formatValue( samples[b], KSysGuard::UnitNone ) );
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment