chaco - Python: takes exactly 1 argument (0 given) Error -
i created method called create_plot pass x, y1, x_axis_name, y_axis_name values create python chaco graph.
def create_plot(self, x, y1, x_axis_name, y_axis_name): self.x = x self.y1 = y1 self.x_axis_name = x_axis_name self.y_axis_name = y_axis_name plotdata = arrayplotdata(x, y1) plot = plot(plotdata) plot.x_axis.title = x_axis_name #string example "(s)" plot.y_axis.title = y_axis_name #string example "(m)" renderer = plot.plot(("x", "y1"), type="line", color="blue", width=2.0)[0] renderer.overlays.append(lineinspector(renderer, axis='value',write_metadata=true, is_listener=true)) plot.overlays.append(zoomtool(plot, tool_mode="range")) plot.tools.append(pantool(plot)) container = hplotcontainer(background="lightgray") container.add(plot) return container def _create_plot_component(self): self.wind_speed_graph = self.create_plot(time_list, data_list, "(s)", "(m)") wind_speed_graph = instance(component) def _wind_speed_graph_default(self): return _create_plot_component()
when compile error "_create_plot_component() takes 1 argument (0 given)". "create_plot" right method created? how can fix error?
you need call method class instance (non-static) class method.
solution similar this. can't tell certain, because fair amount of code seems missing.
def _wind_speed_graph_default(self): # note my_instance return my_instance._create_plot_component()
Comments
Post a Comment