Example shows Vuejs range spline area chart with axis labels shown for every month.
/* App.vue */
<script>
export default {
data() {
return {
options: {
animationEnabled: true,
title: {
text: "Monthly Temperature Variation"
},
subtitles: [{
text: "Munich, Germany"
}],
axisX: {
valueFormatString: "MMM",
interval: 1,
intervalType: "month"
},
axisY: {
title: "Temperature (°C)",
suffix: "°C"
},
data: [{
type: "rangeSplineArea",
yValueFormatString: "#0.#°C",
xValueFormatString: "MMM YYYY",
color: "#2196F3",
toolTipContent: "<b><span style='\"'color: {color};'\"'>{x}</span></b><br/>Min: {y[0]}<br/>Max: {y[1]}",
dataPoints: [
{ x: new Date(2020, 0, 1), y: [-8, 14.5] },
{ x: new Date(2020, 1, 1), y: [-7.4, 17.2] },
{ x: new Date(2020, 2, 1), y: [-7.7, 19.4] },
{ x: new Date(2020, 3, 1), y: [-8, 25.2] },
{ x: new Date(2020, 4, 1), y: [-1, 26.4] },
{ x: new Date(2020, 5, 1), y: [4.4, 29.2] },
{ x: new Date(2020, 6, 1), y: [6.7, 32.7] },
{ x: new Date(2020, 7, 1), y: [6.5, 34.2] },
{ x: new Date(2020, 8, 1), y: [1, 28.9] },
{ x: new Date(2020, 9, 1), y: [-1.8, 22.1] },
{ x: new Date(2020, 10, 1), y: [-8.2, 22.2] },
{ x: new Date(2020, 11, 1), y: [-10.4, 14.6] }
]
}]
},
styleOptions: {
width: "100%",
height: "360px"
}
}
}
}
</script>
<template>
<CanvasJSChart :options="options" :style="styleOptions" />
</template>
You can control the interval of ticks, grids & labels by setting interval property. You can define the unit of interval by setting intervalType. For example: Setting interval to 3 & intervalType to month shows labels at every 3 months.
Note For step by step instructions, follow our Vuejs Integration Tutorial