Results 1 to 3 of 3

Thread: Multiple colors QLineSeries in QtCharts

  1. #1
    Join Date
    Mar 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Multiple colors QLineSeries in QtCharts

    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

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,023
    Thanks
    280
    Thanked 818 Times in 807 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Multiple colors QLineSeries in QtCharts

    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.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Mar 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Multiple colors QLineSeries in QtCharts

    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

Similar Threads

  1. qwt vs qtcharts
    By hassinoss in forum Qwt
    Replies: 1
    Last Post: 13th January 2017, 06:50
  2. Qt Creator Unreadable colours for Documentation
    By Ram-Z in forum Qt Tools
    Replies: 10
    Last Post: 11th March 2014, 14:29
  3. Replies: 1
    Last Post: 13th March 2008, 07:19
  4. QLabel colours
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 14th May 2007, 16:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.