intervalType - Sets the Unit of Interval on Axis X - 0 | JSFiddle Sample Code

intervalType - Sets the Unit of Interval on Axis X - 0 | JSFiddle Sample Code

by 13hola

HTML

<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>

  <div id="chartContainer" style="height: 300px; width: 100%;">
  </div>
<div style="margin-top:16px;color:dimgrey;font-size:9px;font-family: Verdana, Arial, Helvetica, sans-serif;text-decoration:none;">Source: <a href="https://canvasjs.com/docs/charts/chart-options/axisx/intervaltype/" target="_blank" title="intervalType - Sets the Unit of Interval on Axis X ">https://canvasjs.com/docs/charts/chart-options/axisx/intervaltype/</a></div>

JavaScript

window.onload = function () {
    var chart = new CanvasJS.Chart("chartContainer",
    {
      title:{
        text: "Date time axis with interval 1 months"
      },
      axisX:{
        interval: 2,
        intervalType: "hour"
       // minute
      },
      "data": [
        {
            "color": "#E9BD26",
            "dataPoints": [
                {
                    "x": 1673420752830,
                    "y": 200
                },
                {
                    "x": 1673420588986,
                    "y": 13
                }
            ],
            "name": "PAO2",
            "type": "line",
            "xValueType": "dateTime"
        }
    ],
   });

    chart.render();
  }