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

XY chart gets bounding box wrong for incomplete data #22

Closed
kevcampb opened this issue Feb 4, 2013 · 1 comment
Closed

XY chart gets bounding box wrong for incomplete data #22

kevcampb opened this issue Feb 4, 2013 · 1 comment

Comments

@kevcampb
Copy link

kevcampb commented Feb 4, 2013

If you do an XY chart and you supply multiple datasets, the bounding box for the y-axis may be wrong if some datasets define a value with a certain x-value, but other datasets don't.

line_chart = pygal.XY(width=1024, height=800)
line_chart.title = 'Bounding Box Issue'
line_chart.add("x1", [(10,10), (11,11), (12,12)])
line_chart.add("x1", [(10,11),          (12,13)])

The line chart will now include y=0

The issue appears to be at this section:

        if rng:
            self._box.xmin, self._box.xmax = min(xvals), max(xvals)
            self._box.ymin, self._box.ymax = min(yvals), max(yvals)

yvals will have 0 values for any dataset where an x-value exists in another dataset, but not that dataset.

@paradoxxxzero
Copy link
Member

Indeed!
Thanks for the report.

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