Closed gavinspearhead closed 8 years ago
You can use option spaceLeft and spaceRight to force free space on sides.
See : https://github.com/FVANCOP/ChartNew.js/wiki/100_120_Spacing_Layout
These are absolute values (pixels) right? And that would also move the axis to the middle of the canvas? That is not gonna much help, I'm afraid, the canvas size (height and width) is dynamic, the number of bars as well. And I don't know the width of the Yaxis texts in advance as well. And I'm not sure it would actually look better.
I check next week in the code if I could implement your (good) request.
François
Unfortunately, I don't see how to implement your request in the code of ChartNew.js; The function that computes the size of the Yaxis can not be called from your program... and this function computes other values that would provide other results if the canvas is resized... (I hope those explanations are comprehensive).
The only solution that I can propose is to change the width (height) of the canvas before you call the chart function. See new file "Samples\resize_canvas.html".
Thanx for taking the time to look into this. I'm not sure we are actually talking about the same thing. I now end up with something that looks like this.
And this is what I would like to end up with: (q&d drawing)
Is that possible?
The canvas size I create is generated dynamically from the size of the web page (and there are more than one graphs on the same page) so apart from that it becomes complex (e.g. the size of the y-axis is generated from a dataset as well, calculating fonts, number of columns etc etc and other thing to consider) to adjust the width of the canvas, I don't think it actually would improve the way it looks.
I thought that you would also that the X axis was reduced to a smaller width; What you propose here can be implemented easely (I think); I try to implement it next week.
option maxBarWidth has been created; Default value is -1 <=> no maximum for the bar width;
Specify the maximum bar width in point :
Example : maxBarWidth : 50
See : https://github.com/FVANCOP/ChartNew.js/wiki/100_070_Graph_Layout#maxbarwidth
Works like a charm. Thanx a lot!
Is it somehow possible to set the maximum width of a bar in a bar diagram? Eg set it to 20% of the width graph. I sometimes end up with bar graphs with only one bar and that looks a bit silly.