Adding 2 range of information in the same chart (c

2019-09-13 23:12发布

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.

0条回答
登录 后发表回答