Fine scale ( fineLinear )

Test

by SAiTO TOSHiKi

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.bundle.js"></script>
<div style="width:75%;">
  <canvas id="canvas"></canvas>
  <br>
  <br>
  <button id="randomizeData">Randomize Data</button>
  <button id="addDataset">Add Dataset</button>
  <button id="removeDataset">Remove Dataset</button>
  <button id="addData">Add Data</button>
  <button id="removeData">Remove Data</button>

  <script>
    window.chartColors = {
      red: 'rgb(255, 99, 132)',
      orange: 'rgb(255, 159, 64)',
      yellow: 'rgb(255, 205, 86)',
      green: 'rgb(75, 192, 192)',
      blue: 'rgb(54, 162, 235)',
      purple: 'rgb(153, 102, 255)',
      grey: 'rgb(231,233,237)'
    };

    window.randomScalingFactor = function() {
      return (Math.random() > 0.5 ? 1.0 : -1.0) * Math.round(Math.random() * 100);
    };

</script>

<script>/* !
 * chartjs-extension-finescale.js
 *
 * Version: 0.0.1
 *
 * chartjs-extension-finescale.js Copyright 2016 koyoSE
 * Released under the MIT license
 * https://github.com/KoyoSE/chartjs-extension-finescale.git
 *
 * Chart.js Copyright 2016 Nick Downie
 * Released under the MIT license
 * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
 */
!function t(i,e,a){function s(l,o){if(!e[l]){if(!i[l]){var r="function"==typeof require&&require;if(!o&&r)return r(l,!0);if(n)return n(l,!0);var c=new Error("Cannot find module '"+l+"'");throw c.code="MODULE_NOT_FOUND",c}var f=e[l]={exports:{}};i[l][0].call(f.exports,function(t){var e=i[l][1][t];return s(e?e:t)},f,f.exports,t,i,e,a)}return e[l].exports}for(var n="function"==typeof require&&require,l=0;l<a.length;l++)s(a[l]);return s}({1:[function(t,i,e){t(2)(Chart),t(3)(Chart),t(4)(Chart),t(6)(Chart),t(7)(Chart),t(5)(Chart)},{2:2,3:3,4:4,5:5,6:6,7:7}],2:[function(t,i,e){"use strict";i.exports=function(t){var i=t.helpers;t.FineScale={getScaleOptionsAray:function(t){var i=this,e=[];return...

JavaScript

var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

var randomScalingFactor = function() {
  return Math.round(Math.random() * 100);
};

var config = {
  type: 'line',
  data: {
    labels: ["January", "February", "March", "April", "May", "June", "July"],
    datasets: [{
      label: "My First dataset",
      backgroundColor: window.chartColors.red,
      borderColor: window.chartColors.red,
      data: [
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor()
      ],
      fill: false,
    }, {
      label: "My Second dataset",
      fill: false,
      backgroundColor: window.chartColors.blue,
      borderColor: window.chartColors.blue,
      data: [
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor(),
        randomScalingFactor()
      ],
    }]
  },
  options: {
    responsive: true,
    title: {
      display: true,
      text: 'Chart.js : Fine scale extension demo'
    },
    tooltips: {
      mode: 'index',
      intersect: false,
    },
    hover: {
      mode: 'nearest',
      intersect: true
    },
    scales: {
      xAxes: [{
        display: true,
        scaleLabel: {
          display: true,
          labelString: 'Month'
        }
      }],
      yAxes: [{
        // ------- fineLinear ----------
        type: "fineLinear",
        subScale: {
             subScale: {
                gridLines: {
                     //drawOnChartArea: false,
                 }
             }
         },
        // -----------------------------
        display: true,
        scaleLabel: {
          display: true,
          labelString: 'Fine scale - fineLinear',
        },
        ticks: {
...