How to plot graph with delay in every point using kivy garden graph?

182 views
Skip to first unread message

Shruti Chandra

unread,
Jul 2, 2015, 8:31:06 AM7/2/15
to kivy-...@googlegroups.com

    Is it possible to plot graph point by point, so that it looks like someone is drawing instead of displaying all points together? if someone knows, plz do reply!

Shruti Chandra

unread,
Jul 3, 2015, 5:44:09 AM7/3/15
to kivy-...@googlegroups.com

Hi, for providing delay to plot points one by one, I am using kivy;s call back function. But I am somehow blocking the kivy thread. I put the code here, Can anyone tell me what i am doing wrong?

Thanks in advance!




def __init__(self, **kwargs):
        super(MistakeCorrect, self).__init__(**kwargs)
        self.plot   = LinePlot(color=[1, 1, 0, 1], line_width = 2)
        self.graph  = Graph(padding = 20, xmin = 500, xmax = 800, ymin = 180, ymax = 30, draw_border = True)          
        self.graph.pos = 30,120
        self.graph.size = 400,400
       
    def draw(self, curr_data):       
        for stroke in curr_data:
            for pix in stroke:
                Clock.schedule_interval(partial(self.plot_points, pix, self.graph, self.plot), .5)
       
    def plot_points(self, dt, pix, graph, plot, *largs):
      
        self.plot.points = pix
        self.graph.add_plot(self.plot) 
        self.add_widget(self.graph)
Reply all
Reply to author
Forward
0 new messages