Open
Description
Hello i have big problem with kivy, i want to plot 10 point, my values range from -100000 to 100000
the problem, when i change ymin=-100000 and ymax=100000, kivy is very very slow but if i define ymin=-1 and ymax=1 i have good performance
in this example i denife ymin=-1000 and ymax=1000 and i have already slow performance, if you try with -100000 to 100000 my window make five minute to load...
but i have only 10 point to print....
from math import sin
from kivy.garden.graph import Graph, MeshLinePlot
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import NumericProperty
class RootWidget(BoxLayout):
_touch_count = NumericProperty(0)
def __init__(self, **kwargs):
super(RootWidget, self).__init__(**kwargs)
self.graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5,
x_ticks_major=25, y_ticks_major=1,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-0, xmax=100, ymin=-1000, ymax=1000)
plot = MeshLinePlot(color=[1, 0, 0, 1])
plot.points = [(x*100, sin(x)*100000) for x in range(0, 10)]
self.graph.add_plot(plot)
self.add_widget(self.graph)
class GraphDemo(App):
def build(self):
return RootWidget()
if __name__ == "__main__":
GraphDemo().run()
i solved my problem, i must to hide y grid for have good performance but i found new error with memory :
from math import sin
from kivy.garden.graph import Graph, MeshLinePlot
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import NumericProperty
class RootWidget(BoxLayout):
_touch_count = NumericProperty(0)
def __init__(self, **kwargs):
super(RootWidget, self).__init__(**kwargs)
self.graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5,
x_ticks_major=25, y_ticks_major=1,
y_grid_label=False, x_grid_label=True, padding=5,
x_grid=True, y_grid=False, xmin=-0, xmax=100, ymin=-10000, ymax=30000)
plot = MeshLinePlot(color=[1, 0, 0, 1])
plot.points = [(x*1000, sin(x)*100000) for x in range(0, 10)]
self.graph.add_plot(plot)
self.add_widget(self.graph)
class GraphDemo(App):
def build(self):
return RootWidget()
if __name__ == "__main__":
GraphDemo().run()
if i have a interval > 32767 i have this error :
File "kivy\graphics\memory.pxi", line 72, in kivy.graphics.vertex_instruction
s._ensure_ushort_view (kivy\graphics\vertex_instructions.c:6404)
OverflowError: value too large to convert to unsigned short
Metadata
Assignees
Labels
No labels
Activity