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

BarChar with only one single bar shows nothing #146

Open
farleylai opened this issue Sep 9, 2016 · 2 comments
Open

BarChar with only one single bar shows nothing #146

farleylai opened this issue Sep 9, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@farleylai
Copy link

farleylai commented Sep 9, 2016

Based on the simple barchart example, to reproduce the problem, I comment out the other rows and expect to see one single bar but there is nothing rendered. However, two bars works as expected. Any ideas?

          data.add(0.1 as double,  1, "January");
//        data.add(0.2 as double,  3, "February");
//        data.add(0.3 as double, -2, "March");
//        data.add(0.4 as double,  6, "April");
//        data.add(0.5 as double, -4, "May");
//        data.add(0.6 as double,  8, "June");
//        data.add(0.7 as double,  9, "July");
//        data.add(0.8 as double, 11, "August");

singlebar

@seifertm seifertm self-assigned this Sep 11, 2016
@seifertm
Copy link
Collaborator

I can reproduce your results.

In your example, the bar plot has only one data point at x=0.1. This causes the axis renderer of the x-axis to receive a display range from x=0.1 to x=0.1. By the looks of it, these limits are exclusive, which means that no data is displayed. I am not sure if this is a bug or not.

You can work around this by explicitly setting the displayed range of the axis after you added all the data to the plot. For example plot.getAxis(BarPlot.AXIS_X).setRange(0.0, 1.0);.

@farleylai
Copy link
Author

Thanks, I got it and it is possible to explicitly set the range manually.
Actually, the setRange() confused me a bit because the final tick of the range max may not be shown and rounded to the nearest spacing interval (ceil). The workaround is to set the range max to be a little larger than the nearest spacing ceil tick. So I would like to propose gral auto-scale or adjust the range in terms of the given dataset.

@seifertm seifertm added the bug label Sep 18, 2016
@seifertm seifertm added this to the 0.12 Release milestone Sep 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants