Example shows Vuejs Range Column Chart with index / data labels
- /* App.vue */
- <script>
- export default {
- data() {
- return {
- chart: null,
- options: {
- theme: "light2",
- title:{
- text: "Average Temperature Range"
- },
- animationEnabled: true,
- subtitles: [{
- text: "Manchester, UK"
- }],
- axisX: {
- valueFormatString: "MMM",
- interval: "1",
- intervalType: "month"
- },
- axisY: {
- title: "Temperature (°C)",
- suffix: "°C"
- },
- data: [{
- type: "rangeColumn",
- indexLabel: "{y[#index]}°C",
- toolTipContent: "<span style='\"'color: {color};'\"'>{x}</span><br>Min: {y[0]} °C<br/> Max: {y[1]} °C",
- xValueFormatString: "MMM YYYY",
- dataPoints: [
- { x: new Date(2021, 0, 1), y: [-5.889, 12] },
- { x: new Date(2021, 1, 1), y: [-5.278, 15] },
- { x: new Date(2021, 2, 1), y: [-3, 21] },
- { x: new Date(2021, 3, 1), y: [-4.278, 19] },
- { x: new Date(2021, 4, 1), y: [-1.389, 23] },
- { x: new Date(2021, 5, 1), y: [3.222, 27] },
- { x: new Date(2021, 6, 1), y: [8, 38] },
- { x: new Date(2021, 7, 1), y: [6.111, 23] },
- { x: new Date(2021, 8, 1), y: [4.778, 28] },
- { x: new Date(2021, 9, 1), y: [1.5, 21] },
- { x: new Date(2021, 10, 1), y: [-5.389, 16] },
- { x: new Date(2021, 11, 1), y: [-2.222, 15] }
- ]
- }]
- },
- styleOptions: {
- width: "100%",
- height: "360px"
- }
- }
- }
- }
- </script>
- <template>
- <CanvasJSChart :options="options" :style="styleOptions" />
- </template>
Indexlabels can be shown for any datapoint by setting indexLabel property. The orientation of the indexlabels can be customized using indexLabelOrientation property. Some other commonly used customization options include indexLabelFontSize, indexLableBackgroundColor, etc.
Note For step by step instructions, follow our Vuejs Integration Tutorial