You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem Description
Clicking on an empty chaco plot results in a crash. In our usage, an empty chaco plot is created first, and later data is added. Reproduction Steps:
classLinePlot(HasTraits):
plot=Instance(Plot)
x= []
y= []
traits_view=View(
Item('plot', editor=ComponentEditor(),
show_label=False),
width=500, height=500,
resizable=True,
title="Chaco Plot")
def_plot_default(self):
# Create the data and the PlotData object# Create a Plot and associate it with the PlotDataplot=Plot(ArrayPlotData(x=self.x, y=self.y))
# Create a line plot in the Plotplot.plot(("x", "y"), type="line", color="blue")
# Set the title and label the x-axisplot.title="sin(x) * x^3"plot.x_axis.title="x-axis label"plot.tools.append(PanTool(plot))
plot.overlays.append(ZoomTool(plot, zoom_fator=1.1))
# Assign it to our self.plot attributereturnplotdemo=LinePlot()
demo.configure_traits()
Once the plot comes up, try clicking on it. It crashes with the following traceback (full path has been replaced with <>).
Traceback (most recent call last):
File "<>/lib/python3.6/site-packages/enable/qt4/base_window.py", line 213, in paintEvent
self.handler.paintEvent(event)
File "<>/lib/python3.6/site-packages/enable/qt4/base_window.py", line 65, in paintEvent
self._enable_window._paint(event)
File "<>/lib/python3.6/site-packages/enable/abstract_window.py", line 471, in _paint
self.component.draw(gc, view_bounds=(0, 0, size[0], size[1]))
File "<>/lib/python3.6/site-packages/enable/component.py", line 427, in draw
self._draw(gc, view_bounds, mode)
File "<>/lib/python3.6/site-packages/enable/component.py", line 779, in _draw
self._dispatch_draw(layer, gc, view_bounds, mode)
File "<>/lib/python3.6/site-packages/enable/container.py", line 273, in _dispatch_draw
component._dispatch_draw(layer, gc, new_bounds, mode)
File "<>/lib/python3.6/site-packages/enable/container.py", line 258, in _dispatch_draw
my_handler(gc, view_bounds, mode)
File "<>/lib/python3.6/site-packages/enable/container.py", line 298, in _draw_container_underlay
self._draw_underlay(gc, view_bounds, mode)
File "<>/lib/python3.6/site-packages/enable/component.py", line 887, in _draw_underlay
underlay.overlay(self, gc, view_bounds, mode)
File "<>/lib/python3.6/site-packages/chaco/grid.py", line 307, in overlay
self._compute_ticks(other_component)
File "<>/lib/python3.6/site-packages/chaco/grid.py", line 255, in _compute_ticks
scale=scale)
File "<>/lib/python3.6/site-packages/chaco/ticks.py", line 84, in get_ticks
interval, use_endpoints=False), float64)
File "<>/lib/python3.6/site-packages/chaco/ticks.py", line 216, in auto_ticks
ticks = arange( start, end + (tick_interval / 2.0), tick_interval )
ValueError: arange: cannot compute length
Expected behavior:
No crash when an empty plot is clicked. After data is added, Zoom and Pan work.
OS, Python version: [Enter OS name and Python version]
Python 3.6, MacOS Catalina 10.15.6
chaco 4.8.0-4
enable 4.8.1-5
The text was updated successfully, but these errors were encountered:
@sandhya-sago I encountered this issue as well. A workaround, not elegant at all, is to append zoom and pan tools to your components/overlays after plotting some data: if you have a function to update your plot data, you can put in it something like:
At its core I believe this is really an issue with the Tools not playing nice with edge cases. Even so, there should be other safety checks in place elsewhere so that a crash like this doesn't happen. #636 adds one such check. Other PRs can follow to deal with the issue closer to the true source. (i.e. auto_ticks should really never be getting a NaN in the first place, but if it does it shouldn't cause a crash)
Problem Description
Clicking on an empty chaco plot results in a crash. In our usage, an empty chaco plot is created first, and later data is added.
Reproduction Steps:
Once the plot comes up, try clicking on it. It crashes with the following traceback (full path has been replaced with <>).
Expected behavior:
No crash when an empty plot is clicked. After data is added, Zoom and Pan work.
OS, Python version: [Enter OS name and Python version]
Python 3.6, MacOS Catalina 10.15.6
chaco 4.8.0-4
enable 4.8.1-5
The text was updated successfully, but these errors were encountered: