Localization - Showing Axis Label Months in Italian - CanvasJS Charts

Localization - Showing Axis Label Months in Italian - CanvasJS Charts

by canvasjs

HTML

<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 360px; width: 100%;"></div>

JavaScript

CanvasJS.addCultureInfo("it", {                  
  months: ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"],
  shortMonths: ["genn", "febbr", "mar", "apr", "magg", "giugno", "luglio", "ag", "sett", "ott", "nov", "dic"]
});

var chart = new CanvasJS.Chart("chartContainer", {
  culture: "it",
  axisX:{
    valueFormatString:"MMMM", //Change it to MMM to show Short-Months
    interval: 1,
    intervalType: "month"
  },
  title:{
    text: "Localization Demo - Months in Italian"        
  },
  data: [
    {        
      type: "column",
      //indexLabel: "{x}",
      dataPoints: [
        //Note: month input is 0-11 in JavaScript - 05 is June
        { x: new Date(2020, 00, 1), y: 10000 },
        { x: new Date(2020, 01, 1), y: 12000 },
        { x: new Date(2020, 02, 1), y: 13000 },
        { x: new Date(2020, 03, 1), y: 10000 },
        { x: new Date(2020, 04, 1), y: 9000 },
        { x: new Date(2020, 05, 1), y: 8500 },
        { x: new Date(2020, 06, 1), y: 8000 }        
      ]
    }
  ]
});

chart.render();