Skip to content
Advertisement

Tag: chart.js2

HorizontalBar chart is displayed below canvas when I set height with style attribute for chart div (Chart.js 2.9.4)

If I set height with style attribute for chart div <div id=”chartDiv” style=”height: 100px; border: 1px solid red;”><canvas id=”chart”></canvas></div> chart is looking like that (chart is displayed below canvas): How to fix that? Answer It’s showing like this because canvas’s aspect ratio is changing automatically with window size but you’ve set your div to a specific height of 100px. That’s

Chart.js OnClick event with a mixed chart, which chart did I click?

EDIT: Modified to add options, and a suggested (from the answer) chartClickEvent, here is a jsfiddle: http://jsfiddle.net/jmpxgufu/174/ Imagine if you will a Chart.js mixed chart with the following config: As my chartClickEvent says, my array is length 2, because I have two charts. That’s great and all, but I have no idea how to figure out whether to use array[0]

Chart.js v2 – hiding grid lines

I am using Chart.js v2 to draw a simple line chart. Everything looks fine, except there are grid lines that I don’t want: The documentation for Line Chart is here: https://nnnick.github.io/Chart.js/docs-v2/#line-chart, but I can’t find anything about hiding those “Grid Lines”. How can I remove the grid lines? Answer I found a solution that works for hiding the grid lines

Advertisement