我创建了一个名为create_plot的方法来传递x,y1,x_axis_name,y_axis_name值来创建Python chaco图。
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()
当我编译时,我得到这个错误" _create_plot_component()只取1个参数(0给定)"。是" create_plot"我创建的正确方法?我该如何解决这个错误?
答案 0 :(得分:1)
您需要使用类实例调用此方法,因为它是(非静态)类方法。
解决方案与此类似。我无法确定,因为似乎缺少相当数量的代码。
<div class="row"><label for="title" class="col-md-1">Title:</label><input class="col-md-8" type="text" name="title" id="title"></div>
<div class="row" style="padding-top: 1em"><textarea class="form-control" rows="12" id="content" name="content"></textarea>
</div>
<div class="row">
<div class="col-md-12" id="editor-result" ></div>
</div>
</div>