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. Apply rubberband in more than one data series
Forum Updated to NodeBB v4.3 + New Features

Apply rubberband in more than one data series

Scheduled Pinned Locked Moved Unsolved General and Desktop
rubber bandqcandlesticklineseriechart
3 Posts 2 Posters 569 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.
  • M Offline
    M Offline
    M.Maric
    wrote on last edited by
    #1

    Hi! I'm doing a graph that shows two data series like this

    Before.png

    First I draw the candle graph and I set the rubber band option :

    chartview=QChartView(self.candlechart)
    chartview.setRubberBand(QChartView.HorizontalRubberBand)
    

    After that I draw the lines over the candle graph without problems but when I zoom the graph using the rubber band...

    After.png

    ...the candle graph are zoomed but the lines doesn' t.

    Is something that I missing out? Are lines compatible with the rubber band option or I should configure some event?

    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      How are you painting these lines ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        M.Maric
        wrote on last edited by
        #3

        Hi SGaist , thanks for your welcome... I'm drawing these lines like this

                chartview=QChartView(self.__candlechart)
                chartview.setRubberBand(QChartView.HorizontalRubberBand)
                chartview.setRenderHint(QPainter.Antialiasing)
        
                lineserie1=QLineSeries()
                for i in self.times:
                    lineserie1.append(QPointF(i,random.random()))
                pen = lineserie1.pen()
                pen.setWidth(3)
                pen.setBrush(QBrush(QColor(255,0,0)))
                lineserie1.setPen(pen)
        
                lineserie2=QLineSeries()
                for i in self.times:
                    lineserie2.append(QPointF(i,random.random()))
                pen = lineserie2.pen()
                pen.setWidth(3)
                pen.setBrush(QBrush(QColor(0,0,255)))
                lineserie2.setPen(pen)
        
                self.__candlechart.addSeries(lineserie1)
                self.__candlechart.addSeries(lineserie2)
        

        If I change the order (I mean add the lines before set rubber band option I got the same result.

        Thanks!

        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