Skip to content

How to set the graph size to a fix value ? #10808

Answered by Udemology
gperrin asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @gperrin

Not sure if this is an option as there is no method that I know that could control the chartArea directly in Chart.js (im sure there is something somewhere). However, since you indicate 2 issues and both needs to be solved eventually.

  1. Control of the 'chartArea' section
  2. Clipped off legend items.

Would it perhaps be an option to hide the legend and make the legend a custom HTML legend outside of the canvas? (You can use generateLegend for that: https://youtu.be/eIy8J-YhanU) This would ensure all the items on the legend to be displayed. By taking out the legend from the canvas the canvas becomes only the 'chartArea' which you can control by maintainAspectRatio or set your own s…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@gperrin
Comment options

@gperrin
Comment options

@Udemology
Comment options

Answer selected by gperrin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants