PDA

View Full Version : Multiple colors QLineSeries in QtCharts



cmartinezdemorentin
22nd March 2017, 20:19
Hi everybody!

I'd like to plot a custom QLineSeries in a QtChart. I need to split a QLineSeries in multiple sections, each one with a different color. I have tried to change the QPen, the QBrush and the QColor of the series, but it affects all the plotted data, and that's not what i want.

What I am looking for is to call a QLineSeries method which changes the color of the plotted data, but maintaining old data with the color it was painted. Is it posible to do it?

Thank you in advance!

Cristian

d_stranz
23rd March 2017, 15:35
Is it posible to do it?

Nope. QtCharts is the most brain-dead, inflexible library ever released as part of Qt. You can't customize anything, because everything is hidden away in private base classes, there are no virtual methods, and so you can't derive a custom class from anything. You are stuck with what you get, and if you don't like what you get, you're stuck.

The only way to get different colors for any QSeries is to break the QSeries into multiple series, with one color for each series.

cmartinezdemorentin
23rd March 2017, 16:04
Hi d_stranz,

thank you for your answer. That is exactly what I thought, but I was hoping to be wrong.

I will have to think in another way of doing it...

Thank you!

Cristian