问题
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?
回答1:
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>
来源:https://stackoverflow.com/questions/24827896/scrollable-x-axis-in-chart-js