Adding 2 range of information in the same chart (chart.js)

有些话、适合烂在心里 提交于 2019-12-12 03:57:27

问题


I created a line type chart, using chart.js (2.5 version), exactly like in this example: http://codepen.io/SitePoint/pen/WGZGNE

 <div class="container">
  <h2>Chart.js — Line Chart Demo</h2>
  <div>
    <canvas id="myChart"></canvas>
  </div>
</div>

.container {
  width: 80%;
  margin: 15px auto;
}

https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.2/Chart.min.js

var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
  type: 'line',
  data: {
    labels: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
    datasets: [{
      label: 'apples',
      data: [12, 19, 3, 17, 6, 3, 7],
      backgroundColor: "rgba(153,255,51,0.6)"
    }, {
      label: 'oranges',
      data: [2, 29, 5, 5, 2, 3, 10],
      backgroundColor: "rgba(255,153,0,0.6)"
    }]
  }
});

I'm feeding the chart with 2 information. One is a big amount like 500,000 or 900,000. The other is 10-90. Since the difference is too high the second almost doesn't appear visually. Is there any elegant way to show both information without changing the number?

Thanks in advance.

来源:https://stackoverflow.com/questions/42386164/adding-2-range-of-information-in-the-same-chart-chart-js

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