You must be logged in to post your query.
Home › Forums › Chart Support › Year starts on "1961" instead of "1960"
Tagged: line graph
I’m listing some statistics over the course of half a century. I want the dates on the X axis to be the start of the decade, e.g. “1960”, “1970”, etc. For some reason, it starts at “1961” instead of “1960”. I can’t, for the life of me, figure out the problem, and any help is appreciated.
var options = { animationEnabled: true, theme: "dark2", backgroundColor: "transparent", axisY: { suffix: "K", minimum: 0, maximum: 250, gridColor: "#3372D1", lineColor: "#3372D1", tickColor: "#3372D1", stripLines: [{ color:"black" }] }, axisX:{ interval: 10, intervalType: "year", valueFormatString: "YYYY", labelFontSize: 20, labelFontFamily: "Helvetica", tickColor: "#3372D1", lineColor: "#3372D1", stripLines: [{ color:"black" }] }, legend:{ cursor:"pointer", verticalAlign: "bottom", horizontalAlign: "left", dockInsidePlotArea: true, itemclick: toogleDataSeries }, data: [{ type: "line", showInLegend: false, markerType: "none", color: "#fff", yValueFormatString: "#,##0K", xValueFormatString: "YYYY", xValueType: "dateTime", dataPoints: [ { x: new Date(1960, 01), y: 51 }, { x: new Date(1970, 01), y: 99 }, { x: new Date(1980, 01), y: 74 }, { x: new Date(1990, 01), y: 98 }, { x: new Date(2000, 01), y: 95 }, { x: new Date(2010, 01), y: 110 }, { x: new Date(2020, 01), y: 150 } ] }] }; $("#chartContainer").CanvasJSChart(options);
You must be logged in to reply to this topic. Login/Register