FVANCOP / ChartNew.js

MIT License
420 stars 143 forks source link

Space after X axis #534

Open Leti opened 6 years ago

Leti commented 6 years ago

Hello, I have an issue when creating a big bar diagram (more than 50 bars), there is a white space before the legend. With a smaller diagram everything is fine. When I set "legend borders" at false, the space disappears… but I need borders ! Do you know how to remove the space?

Edit- ok I found the solution : legendBordersWidth: 0, legendBordersSpaceBefore: 0, legendBordersSpaceAfter: 0, legendBordersSpaceLeft: 0, legendBordersSpaceRight: 0,

FVANCOP commented 6 years ago

Hi Leti,

Thanks for using ChartNew.js.

You close the issue, but I will give an answer about that problem.

All bars have the same width. The width of the bars is computed by the script and is identical for all bars. When you have lot of bars this can be a problem in the display. Suppose that you have 50 bars. The program computes the maximum width of the bars. It could be that with this compuration there is 49 points left between the legend and the bottom of the chart, unfortunately, it will not be possible to increase the size of the bars and the 49 points will be loosen. If you increase a little bit (with some points) the height of the canvas, the problem should be solved. Can you try ?

Regards, François

Leti commented 6 years ago

Hello, thank you for your concern. I'm not sure I understand correctly : the problem comes from rounded values? I tried adding some points to the height of the canvas, without success, but in fact, my canvas has a dynamic size. I found that by putting a fixed value the problem doesn't show. But I need this dynamic size because I Don't know how many values I may have (sometimes it's a lot, sometimes not).