Scrollable x-axis in Chart.js

China☆狼群 提交于 2019-12-22 04:48:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!