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

HorizontalBarChart bars do not render if all input values are under 10 #4

Open
mcooke-mdkl opened this issue Mar 2, 2021 · 0 comments

Comments

@mcooke-mdkl
Copy link

I had an issue with the HorizontalBarChart, where all of the values were under 10. This caused none of the bars to render.

Context:
I wanted to display all orders per hour over a 24 hour period.
InputData="0,0,0,0,0,0,0,0,0,0,0,1,0,2,1,1,7,0,0,0,0,0,0,0"

As none of the values were over 10, it had the effect that none of the horizontal bars would render.

I fixed it with the following change to the HorizontalBarCharts.cs

//Check the highest value in inputDataArr, if below 10, set the gridYUnits and gridXUnits to 1
var units = (inputDataArrDouble.Length > 0 && inputDataArrDouble.Max() < 10) ? 1 : 10;

double gridYUnits = units; //old value was hardcode to 10
double gridXUnits = units; //old value was hardcode to 10

It works fine for my needs.

Thanks for creating these charts. They are simple and easy to use.

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

1 participant