Data labels in Vue 3D Chart component
Data labels are fields that includes information about the sample point connected to an output. It can be added to a chart series by enabling the visible property in the dataLabel. By default, the labels will arrange smartly without overlapping.
<template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script setup>
import { provide } from "vue";
import { Chart3DComponent as EjsChart3d, Chart3DSeriesCollectionDirective as EChart3dSeriesCollection, Chart3DSeriesDirective as EChart3dSeries, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 },
{ country: "France", gold: 50 },
{ country: "Germany", gold: 40 },
{ country: "Italy", gold: 40 },
{ country: "Sweden", gold: 30 }
];
const primaryXAxis = {
valueType: 'Category'
};
const dataLabel = {
visible: true
};
const title = 'Olympic Medals';
const wallColor = 'transparent';
const enableRotation = true;
const rotation = 7;
const tilt = 10;
const depth = 100;
provide('chart3d', [ColumnSeries3D, Category3D, DataLabel3D]);
</script>
<style>
#container {
height: 350px;
}
</style><template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script>
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
export default {
name: "App",
components: {
'ejs-chart3d': Chart3DComponent,
'e-chart3d-series-collection': Chart3DSeriesCollectionDirective,
'e-chart3d-series': Chart3DSeriesDirective
},
data() {
return {
seriesData: [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 },
{ country: "France", gold: 50 },
{ country: "Germany", gold: 40 },
{ country: "Italy", gold: 40 },
{ country: "Sweden", gold: 30 }
],
primaryXAxis: {
valueType: 'Category'
},
dataLabel: {
visible: true
},
title: 'Olympic Medals',
wallColor: 'transparent',
enableRotation: true,
rotation: 7,
tilt: 10,
depth: 100
};
},
provide: {
chart3d: [ColumnSeries3D, Category3D, DataLabel3D]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>Note: To use data label feature, we need to inject
DataLabel3Dinto theprovide.
Position
The position property is used to place the label either on Top, Middle, or Bottom.
<template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script setup>
import { provide } from "vue";
import { Chart3DComponent as EjsChart3d, Chart3DSeriesCollectionDirective as EChart3dSeriesCollection, Chart3DSeriesDirective as EChart3dSeries, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 },
{ country: "France", gold: 50 },
{ country: "Germany", gold: 40 },
{ country: "Italy", gold: 40 },
{ country: "Sweden", gold: 30 }
];
const primaryXAxis = {
valueType: 'Category'
};
const dataLabel = {
visible: true,
position: 'Middle'
};
const title = 'Olympic Medals';
const wallColor = 'transparent';
const enableRotation = true;
const rotation = 7;
const tilt = 10;
const depth = 100;
provide('chart3d', [ColumnSeries3D, Category3D, DataLabel3D]);
</script>
<style>
#container {
height: 350px;
}
</style><template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script>
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
export default {
name: "App",
components: {
'ejs-chart3d': Chart3DComponent,
'e-chart3d-series-collection': Chart3DSeriesCollectionDirective,
'e-chart3d-series': Chart3DSeriesDirective
},
data() {
return {
seriesData: [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 },
{ country: "France", gold: 50 },
{ country: "Germany", gold: 40 },
{ country: "Italy", gold: 40 },
{ country: "Sweden", gold: 30 }
],
primaryXAxis: {
valueType: 'Category'
},
dataLabel: {
visible: true,
position: 'Middle'
},
title: 'Olympic Medals',
wallColor: 'transparent',
enableRotation: true,
rotation: 7,
tilt: 10,
depth: 100
};
},
provide: {
chart3d: [ColumnSeries3D, Category3D, DataLabel3D]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>Template
Label content can be formatted by using the template option. Inside the template, the placeholder text ${point.x} and ${point.y} can be added to display corresponding data points x & y value. Using template property, the data label template can be set.
<template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script setup>
import { provide } from "vue";
import { Chart3DComponent as EjsChart3d, Chart3DSeriesCollectionDirective as EChart3dSeriesCollection, Chart3DSeriesDirective as EChart3dSeries, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 },
{ country: "France", gold: 50 },
{ country: "Germany", gold: 40 },
{ country: "Italy", gold: 40 },
{ country: "Sweden", gold: 30 }
];
const primaryXAxis = {
valueType: 'Category'
};
const dataLabel = {
visible: true,
template: '<div style="border: 1px solid black; padding: 3px 3px 3px 3px"><div>${point.x}</div><div>${point.y}</div></div>'
};
const title = 'Olympic Medals';
const wallColor = 'transparent';
const enableRotation = true;
const rotation = 7;
const tilt = 10;
const depth = 100;
provide('chart3d', [ColumnSeries3D, Category3D, DataLabel3D]);
</script>
<style>
#container {
height: 350px;
}
</style><template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script>
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
export default {
name: "App",
components: {
'ejs-chart3d': Chart3DComponent,
'e-chart3d-series-collection': Chart3DSeriesCollectionDirective,
'e-chart3d-series': Chart3DSeriesDirective
},
data() {
return {
seriesData: [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 },
{ country: "France", gold: 50 },
{ country: "Germany", gold: 40 },
{ country: "Italy", gold: 40 },
{ country: "Sweden", gold: 30 }
],
primaryXAxis: {
valueType: 'Category'
},
dataLabel: {
visible: true,
template: '<div style="border: 1px solid black; padding: 3px 3px 3px 3px"><div>${point.x}</div><div>${point.y}</div></div>'
},
title: 'Olympic Medals',
wallColor: 'transparent',
enableRotation: true,
rotation: 7,
tilt: 10,
depth: 100
};
},
provide: {
chart3d: [ColumnSeries3D, Category3D, DataLabel3D]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>Text mapping
Text from the data source can be mapped using the name property.
<template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='x' yName='y'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script setup>
import { provide } from "vue";
import { Chart3DComponent as EjsChart3d, Chart3DSeriesCollectionDirective as EChart3dSeriesCollection, Chart3DSeriesDirective as EChart3dSeries, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: 12, text: 'January : 12°C' },
{ x: 'Feb', y: 8, text: 'February : 8°C' },
{ x: 'Mar', y: 11, text: 'March : 11°C' },
{ x: 'Apr', y: 6, text: 'April : 6°C' }
];
const primaryXAxis = {
valueType: 'Category'
};
const dataLabel = {
visible: true,
name: "text"
};
const title = 'Olympic Medals';
const wallColor = 'transparent';
const enableRotation = true;
const rotation = 7;
const tilt = 10;
const depth = 100;
provide('chart3d', [ColumnSeries3D, Category3D, DataLabel3D]);
</script>
<style>
#container {
height: 350px;
}
</style><template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='x' yName='y'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script>
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
export default {
name: "App",
components: {
'ejs-chart3d': Chart3DComponent,
'e-chart3d-series-collection': Chart3DSeriesCollectionDirective,
'e-chart3d-series': Chart3DSeriesDirective
},
data() {
return {
seriesData: [
{ x: 'Jan', y: 12, text: 'January : 12°C' },
{ x: 'Feb', y: 8, text: 'February : 8°C' },
{ x: 'Mar', y: 11, text: 'March : 11°C' },
{ x: 'Apr', y: 6, text: 'April : 6°C' }
],
primaryXAxis: {
valueType: 'Category'
},
dataLabel: {
visible: true,
name: "text"
},
title: 'Olympic Medals',
wallColor: 'transparent',
enableRotation: true,
rotation: 7,
tilt: 10,
depth: 100
};
},
provide: {
chart3d: [ColumnSeries3D, Category3D, DataLabel3D]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>Format
Data label for the chart can be formatted using the format property. The global formatting options can be used as ‘n’, ‘p’, and ‘c’.
<template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script setup>
import { provide } from "vue";
import { Chart3DComponent as EjsChart3d, Chart3DSeriesCollectionDirective as EChart3dSeriesCollection, Chart3DSeriesDirective as EChart3dSeries, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 }
];
const primaryXAxis = {
valueType: 'Category'
};
const dataLabel = {
visible: true,
format: 'n2'
};
const title = 'Olympic Medals';
const wallColor = 'transparent';
const enableRotation = true;
const rotation = 7;
const tilt = 10;
const depth = 100;
provide('chart3d', [ColumnSeries3D, Category3D, DataLabel3D]);
</script>
<style>
#container {
height: 350px;
}
</style><template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script>
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
export default {
name: "App",
components: {
'ejs-chart3d': Chart3DComponent,
'e-chart3d-series-collection': Chart3DSeriesCollectionDirective,
'e-chart3d-series': Chart3DSeriesDirective
},
data() {
return {
seriesData: [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 }
],
primaryXAxis: {
valueType: 'Category'
},
dataLabel: {
visible: true,
format: 'n2'
},
title: 'Olympic Medals',
wallColor: 'transparent',
enableRotation: true,
rotation: 7,
tilt: 10,
depth: 100
};
},
provide: {
chart3d: [ColumnSeries3D, Category3D, DataLabel3D]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>| Value | Format | Resultant Value | Description |
|---|---|---|---|
| 1000 | n1 | 1000.0 | The number is rounded to 1 decimal place. |
| 1000 | n2 | 1000.00 | The number is rounded to 2 decimal places. |
| 1000 | n3 | 1000.000 | The number is rounded to 3 decimal place. |
| 0.01 | p1 | 1.0% | The number is converted to percentage with 1 decimal place. |
| 0.01 | p2 | 1.00% | The number is converted to percentage with 2 decimal place. |
| 0.01 | p3 | 1.000% | The number is converted to percentage with 3 decimal place. |
| 1000 | c1 | $1000.0 | The currency symbol is appended to number and number is rounded to 1 decimal place. |
| 1000 | c2 | $1000.00 | The currency symbol is appended to number and number is rounded to 2 decimal place. |
Margin
The margin for data label can be applied by using left, right, bottom and top properties.
<template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script setup>
import { provide } from "vue";
import { Chart3DComponent as EjsChart3d, Chart3DSeriesCollectionDirective as EChart3dSeriesCollection, Chart3DSeriesDirective as EChart3dSeries, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 }
];
const primaryXAxis = {
valueType: 'Category'
};
const dataLabel = {
visible: true,
border: {
width: 1,
color: 'red'
},
margin: {
left: 5,
right: 5,
top: 5,
bottom: 5
}
};
const title = 'Olympic Medals';
const wallColor = 'transparent';
const enableRotation = true;
const rotation = 7;
const tilt = 10;
const depth = 100;
provide('chart3d', [ColumnSeries3D, Category3D, DataLabel3D]);
</script>
<style>
#container {
height: 350px;
}
</style><template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script>
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
export default {
name: "App",
components: {
'ejs-chart3d': Chart3DComponent,
'e-chart3d-series-collection': Chart3DSeriesCollectionDirective,
'e-chart3d-series': Chart3DSeriesDirective
},
data() {
return {
seriesData: [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 }
],
primaryXAxis: {
valueType: 'Category'
},
dataLabel: {
visible: true,
border: {
width: 1,
color: 'red'
},
margin: {
left: 5,
right: 5,
top: 5,
bottom: 5
}
},
title: 'Olympic Medals',
wallColor: 'transparent',
enableRotation: true,
rotation: 7,
tilt: 10,
depth: 100
};
},
provide: {
chart3d: [ColumnSeries3D, Category3D, DataLabel3D]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>Customization
The stroke and border of data label can be customized using fill and border properties.
<template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script setup>
import { provide } from "vue";
import { Chart3DComponent as EjsChart3d, Chart3DSeriesCollectionDirective as EChart3dSeriesCollection, Chart3DSeriesDirective as EChart3dSeries, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 }
];
const primaryXAxis = {
valueType: 'Category'
};
const dataLabel = {
visible: true,
border: { width: 2, color: 'red' }
};
const title = 'Olympic Medals';
const wallColor = 'transparent';
const enableRotation = true;
const rotation = 7;
const tilt = 10;
const depth = 100;
provide('chart3d', [ColumnSeries3D, Category3D, DataLabel3D]);
</script>
<style>
#container {
height: 350px;
}
</style><template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script>
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
export default {
name: "App",
components: {
'ejs-chart3d': Chart3DComponent,
'e-chart3d-series-collection': Chart3DSeriesCollectionDirective,
'e-chart3d-series': Chart3DSeriesDirective
},
data() {
return {
seriesData: [
{ country: "USA", gold: 50 },
{ country: "China", gold: 40 },
{ country: "Japan", gold: 70 },
{ country: "Australia", gold: 60 }
],
primaryXAxis: {
valueType: 'Category'
},
dataLabel: {
visible: true,
border: { width: 2, color: 'red' }
},
title: 'Olympic Medals',
wallColor: 'transparent',
enableRotation: true,
rotation: 7,
tilt: 10,
depth: 100
};
},
provide: {
chart3d: [ColumnSeries3D, Category3D, DataLabel3D]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>Customizing specific label
A specific label can be customized by using the textRender event. The textRender event allows you to change the label text for the point.
<template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth' :textRender='textRender'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script setup>
import { provide } from "vue";
import { Chart3DComponent as EjsChart3d, Chart3DSeriesCollectionDirective as EChart3dSeriesCollection, Chart3DSeriesDirective as EChart3dSeries, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'USA', y: 46 },
{ x: 'GBR', y: 27 },
{ x: 'CHN', y: 26 }
];
const primaryXAxis = {
valueType: 'Category'
};
const dataLabel = {
visible: true
};
const title = 'Olympic Medals';
const wallColor = 'transparent';
const enableRotation = true;
const rotation = 7;
const tilt = 10;
const depth = 100;
provide('chart3d', [ColumnSeries3D, Category3D, DataLabel3D]);
const textRender = (args) => {
if (args.point.index === 2) {
args.text = 'Label';
}
else {
args.cancel = true;
}
};
</script>
<style>
#container {
height: 350px;
}
</style><template>
<div id="app">
<ejs-chart3d id="container" :primaryXAxis='primaryXAxis' :title='title' :wallColor='wallColor'
:enableRotation='enableRotation' :rotation='rotation' :tilt='tilt' :depth='depth' :textRender='textRender'>
<e-chart3d-series-collection>
<e-chart3d-series :dataSource='seriesData' type='Column' xName='country' yName='gold'
:dataLabel='dataLabel'></e-chart3d-series>
</e-chart3d-series-collection>
</ejs-chart3d>
</div>
</template>
<script>
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, ColumnSeries3D, Category3D, DataLabel3D } from "@syncfusion/ej2-vue-charts";
export default {
name: "App",
components: {
'ejs-chart3d': Chart3DComponent,
'e-chart3d-series-collection': Chart3DSeriesCollectionDirective,
'e-chart3d-series': Chart3DSeriesDirective
},
data() {
return {
seriesData: [
{ x: 'USA', y: 46 },
{ x: 'GBR', y: 27 },
{ x: 'CHN', y: 26 }
],
primaryXAxis: {
valueType: 'Category'
},
dataLabel: {
visible: true
},
title: 'Olympic Medals',
wallColor: 'transparent',
enableRotation: true,
rotation: 7,
tilt: 10,
depth: 100
};
},
provide: {
chart3d: [ColumnSeries3D, Category3D, DataLabel3D]
},
methods: {
textRender: function (args) {
if (args.point.index === 2) {
args.text = 'Label';
}
else {
args.cancel = true;
}
}
}
};
</script>
<style>
#container {
height: 350px;
}
</style>