Linear Scale - Min-Max

Linear Scale - Min-Max - 图1

config setup

  1. const config = {
  2. type: 'line',
  3. data: data,
  4. options: {
  5. responsive: true,
  6. plugins: {
  7. title: {
  8. display: true,
  9. text: 'Min and Max Settings'
  10. }
  11. },
  12. scales: {
  13. y: {
  14. min: 10,
  15. max: 50,
  16. }
  17. }
  18. },
  19. };
  1. const DATA_COUNT = 7;
  2. const NUMBER_CFG = {count: DATA_COUNT, min: 0, max: 100};
  3. const labels = Utils.months({count: 7});
  4. const data = {
  5. labels: labels,
  6. datasets: [
  7. {
  8. label: 'Dataset 1',
  9. data: [10, 30, 50, 20, 25, 44, -10],
  10. borderColor: Utils.CHART_COLORS.red,
  11. backgroundColor: Utils.CHART_COLORS.red,
  12. },
  13. {
  14. label: 'Dataset 2',
  15. data: [100, 33, 22, 19, 11, 49, 30],
  16. borderColor: Utils.CHART_COLORS.blue,
  17. backgroundColor: Utils.CHART_COLORS.blue,
  18. }
  19. ]
  20. };

Docs