Hi,
is it possible to set the width for a bar chart? If setting the canvas size width 1000px and have only one dataset, the column is huge. I'd like to have the chart fully visible and have the bar column taking only 50px for example. I'. using version 2.1.4
thanks
This is probably what you need: http://www.chartjs.org/docs/#bar-chart-barpercentage-vs-categorypercentage
thanks but this is in percentage, Can't I have it fixed in px? Also it centeres the bar in the middle of the graph. I need to have it positioned on the left.
thanks
@kiwi1342 there is no way to get it into px. To change the bar positioning, you may need to write your own chart type that extends the bar type
We wanted to display scrollable horizontal bar charts that maintained the same width for the bars. That way when you had 40+ labels you wouldn't end up with 1px wide bars that were impossible to read. Conversely, when you have 1 or 2 labels you don't get giant bars.
From a usability standpoint I really think that you should consider adding an option to set the max/min width of the bars.
What I ended up doing to get around this was write another function that counts the number of labels that are coming in and then multiplies that by a set number. That number is then used to set the height of the canvas. This allows us to show a consistent bar size, no matter how many entries there are.
Most helpful comment
We wanted to display scrollable horizontal bar charts that maintained the same width for the bars. That way when you had 40+ labels you wouldn't end up with 1px wide bars that were impossible to read. Conversely, when you have 1 or 2 labels you don't get giant bars.
From a usability standpoint I really think that you should consider adding an option to set the max/min width of the bars.
What I ended up doing to get around this was write another function that counts the number of labels that are coming in and then multiplies that by a set number. That number is then used to set the height of the canvas. This allows us to show a consistent bar size, no matter how many entries there are.