Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtChart, QLineSeries. Change the Line style
Qt 6.11 is out! See what's new in the release blog

QtChart, QLineSeries. Change the Line style

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aliks-os
    wrote on last edited by aliks-os
    #1

    Please advise, is a possbile to change the style of line for QLineSeries? I would like to have dotline style. I am doing as below but line still straight

        QRgb color1 = qRgb(255, 0, 0);
        QPen pen1(color1);
        pen1.setStyle(Qt::DotLine);
        pen1.setWidth(1);
    
        auto s1 = new QLineSeries(this);
        s1->setUseOpenGL(true);
        s1->setPen(pen1);
        s1->append(0, 0);
        s1->append(1, 1);
        chart->addSeries(s1);
    
    mzimmersM 1 Reply Last reply
    0
    • A aliks-os

      Please advise, is a possbile to change the style of line for QLineSeries? I would like to have dotline style. I am doing as below but line still straight

          QRgb color1 = qRgb(255, 0, 0);
          QPen pen1(color1);
          pen1.setStyle(Qt::DotLine);
          pen1.setWidth(1);
      
          auto s1 = new QLineSeries(this);
          s1->setUseOpenGL(true);
          s1->setPen(pen1);
          s1->append(0, 0);
          s1->append(1, 1);
          chart->addSeries(s1);
      
      mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #2

      @aliks-os I just tried your example. When I removed this line:

      s1->setUseOpenGL(true);
      

      It works.

      I'm not an OpenGL expert, but perhaps it's not picking up your pen properties.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aliks-os
        wrote on last edited by
        #3

        Wow, it was unexpected reason! Thank you very much!

        mzimmersM 1 Reply Last reply
        0
        • A aliks-os

          Wow, it was unexpected reason! Thank you very much!

          mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #4

          @aliks-os my pleasure. If you think this satisfies your question, you may want to mark the topic as solved.

          A 1 Reply Last reply
          0
          • mzimmersM mzimmers

            @aliks-os my pleasure. If you think this satisfies your question, you may want to mark the topic as solved.

            A Offline
            A Offline
            aliks-os
            wrote on last edited by
            #5

            @mzimmers said in SOLVED, QtChart, QLineSeries. Change the Line style:

            Sure

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved