You must be logged in to post your query.
Home › Forums › Chart Support › dynamic Year-Month on Axis value-bar chart
I want to display dynamic x-Axis value.. for example 2022-Mar , 2022-April,
axisY: { title: “Patient Treatment Duration”, //intervalType: “month”, labelFormatter: function (e) { //return CanvasJS.formatDate( e.value, “MMM-YYYY”); var abc = [‘2022-aug’,’2022-sep’]; for (var i = 0; i < abc.length; i++){ return CanvasJS.formatDate(new Date(abc[i]), “YYYY-MMM”); } }, includeZero: true, },
var chart = new CanvasJS.Chart(“chartContainer”, { title:{ text: “Basic Column Chart” }, axisY: { title: “Patient Treatment Duration”, //intervalType: “month”, labelFormatter: function (e) { return CanvasJS.formatDate( e.value, “MMM-YYYY”); }, includeZero: true, }, data: [{ type: “bar”, indexLabel: “{y}”, indexLabelPlacement: “inside”, indexLabelFontWeight: “bolder”, indexLabelFontColor: “white”, dataPoints: [ {label:”A”,y: 71 }, {label:”b”,y: 55}, {label:”c”,y: 50 }, {label:”d”,y: 65 }, {label:”e”,y: 95 } ] }] });
chart.render();
@rajuweb,
You can pass x-value in date-time format and use valueFormatString to define how axis labels must be formatted before they appear on the x-axis.
— Thangaraj Raman Team CanvasJS
You must be logged in to reply to this topic. Login/Register