Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateY chart issues w/single datapoint #188

Closed
jonapich opened this issue Jan 26, 2015 · 1 comment
Closed

DateY chart issues w/single datapoint #188

jonapich opened this issue Jan 26, 2015 · 1 comment

Comments

@jonapich
Copy link

The DateY chart seems to be missing some hooks when there's only 1 datapoint to show.

For instance, rendering a DateY chart with a single data point will render an empty graph (without the "NoData" text). The single datapoint will not be visible.

Worst: When Interpolation is enabled and there's only a single datapoint, render() will raise an AttributeError:

AttributeError                            Traceback (most recent call last)
<ipython-input-4-97a5b0c16273> in <module>()
----> 1 bmark.chart_document_count

E:\Projects\Repos\TestAutomation\pyces\sandbox\benchmarks\benchmarker.pyc in chart_document_count(self)
     59         for name, data in self.results.items():
     60             chart.add(name, data)
---> 61         return SVG(chart.render())
     62 
     63     def start(self):

C:\Apps\Python\lib\site-packages\pygal\ghost.pyc in render(self, is_unicode, **kwargs)
    109     def render(self, is_unicode=False, **kwargs):
    110         return (self
--> 111                 .make_instance(overrides=kwargs)
    112                 .render(is_unicode=is_unicode))
    113 

C:\Apps\Python\lib\site-packages\pygal\ghost.pyc in make_instance(self, overrides)
    103         self._last__inst = self.cls(
    104             self.config, series, secondary_series, self.uuid,
--> 105             self.xml_filters)
    106         return self._last__inst
    107 

C:\Apps\Python\lib\site-packages\pygal\graph\line.pyc in __init__(self, *args, **kwargs)
     31     def __init__(self, *args, **kwargs):
     32         self._self_close = False
---> 33         super(Line, self).__init__(*args, **kwargs)
     34 
     35     @cached_property

C:\Apps\Python\lib\site-packages\pygal\graph\base.pyc in __init__(self, config, series, secondary_series, uuid, xml_filters)
     67 
     68             self.zero = min(positive_values or (1,)) or 1
---> 69         self._draw()
     70         self.svg.pre_render()
     71 

C:\Apps\Python\lib\site-packages\pygal\graph\base.pyc in _draw(self)
    281         self._decorate()
    282         if self.series and self._has_data():
--> 283             self._plot()
    284         else:
    285             self.svg.draw_no_data()

C:\Apps\Python\lib\site-packages\pygal\graph\line.pyc in _plot(self)
    167     def _plot(self):
    168         for serie in self.series:
--> 169             self.line(serie)
    170 
    171         for serie in self.secondary_series:

C:\Apps\Python\lib\site-packages\pygal\graph\line.pyc in line(self, serie, rescale)
    121         if serie.stroke:
    122             if self.interpolate:
--> 123                 points = serie.interpolated
    124                 if rescale and self.secondary_series:
    125                     points = self._rescale(points)

AttributeError: 'Serie' object has no attribute 'interpolated'

Everything starts to work again when there are at least 2 datapoints to show.

@paradoxxxzero
Copy link
Member

Fix with DateLine in 1.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants