Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollable x-axis in Chart.js

I would like to use Chart.js library for drawing charts on my website, but I intend to feed the chart large amounts of data (>1000). However, when I feed the data to chart.js line chart, the chart is not made scrollable, but the values are pushed together rendering the chart unreadable. Is there a way to make the chart.js line chart scrollable on the x-axis?

like image 223
stepanbujnak Avatar asked Jul 18 '14 14:07

stepanbujnak


1 Answers

I was experiencing this problem and worked around it by using jquery to edit the css of the parent div for my chartjs canvas. This isn't a very robust solution, but is does make the data readable/scrollable.

<div id="parentDiv"><canvas id="myChart" width="15000" height="400"></canvas></div>

<script>
    $("#parentDiv").css("width", "1000px");
    $("#parentDiv").css("overflow", "auto");
</script>
like image 144
emma Avatar answered Oct 13 '22 03:10

emma