QtCharts is it posible to have gradient lines?
Could I achieve this kind of spline chart with QTCharts, where color changes according to y chart value?
Maybe you can use
and draw the gradient as background and let graph be transparent on the actual
Ok, I will try to do that, thanks
How to make line be transparent like in that picture? Because if I set it like this:
QPen green(QColor(0, 0, 0, 0x00));
line just becomes invisible. If I set chart background like this:
QBrush brush (QImage(":image/image.png"));
whole chart area then has that image and line is still invisible. if I setPlotAreaBackgroundVisible(false) background disappears, but line is still invisible. How to have, that only chart line shows that background?
So it means it's impossible to achieve this with QT charts?
Starting from the aforementioned example, replace
// Customize series QPen pen(QRgb(0xfdb157)); pen.setWidth(5); series->setPen(pen);
QLinearGradient lineGradient; lineGradient.setStart(QPointF(0, 1)); lineGradient.setFinalStop(QPointF(1, 0)); lineGradient.setColorAt(0.0, Qt::blue); lineGradient.setColorAt(1.0, Qt::red); lineGradient.setCoordinateMode(QGradient::StretchToDeviceMode); series->setPen(QPen(QBrush(lineGradient),5));
Thank you a lot, that works perfectly!!!