Data labels in Vue Charts

Data labels display the values of data points directly on the chart, reducing the need to reference axes for exact values. Enable data labels by setting theĀ visible option to true in the dataLabel configuration. Labels automatically adjust to avoid overlapping and maintain readability.

<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
            <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'></e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script setup>
import { provide } from "vue";

import { ChartComponent as EjsChart, ColumnSeries, Category, DataLabel,
  SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries
 } from "@syncfusion/ej2-vue-charts";

const seriesData = [
        { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
        { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
        { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
        { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
        { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
        { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
        ];

const primaryXAxis = {
    valueType: 'Category'
  };

const marker = {
                //Data label for chart series
                dataLabel: { visible: true }
            };

const title = "Alaska Weather Statistics - 2016";

provide('chart',  [ColumnSeries, Category, DataLabel]);

</script>
<style>
 #container {
   height: 350px;
 }
</style>
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
            <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'></e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  data() {
    return {
      seriesData: [
              { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
              { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
              { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
              { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
              { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
              { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
              ],
        primaryXAxis: {
           valueType: 'Category'
        },
        marker: {
                    //Data label for chart series
                    dataLabel: { visible: true }
                },
      title: "Alaska Weather Statistics - 2016"
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel]
  }
};
</script>
<style>
 #container {
   height: 350px;
 }
</style>

Note: To use the data label feature, the DataLabel module must be injected into the provide.

Position

Use the position property to place data labels at Top, Middle, Bottom, or Outer (applicable to column and bar series). Appropriate label positioning enhances clarity and preserves chart readability.

<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script setup>
import { provide } from "vue";

import { ChartComponent as EjsChart, ColumnSeries, Category, DataLabel,
  SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries
 } from "@syncfusion/ej2-vue-charts";

const seriesData = [
        { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
        { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
        { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
        { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
        { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
        { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
        ];

const primaryXAxis = {
    valueType: 'Category'
  };

const marker = {
                dataLabel: { visible: true, position: 'Middle' }
            };
          
const title = "Alaska Weather Statistics - 2016";

provide('chart',  [ColumnSeries, Category, DataLabel]);

</script>
<style>
#container {
   height: 350px;
 }
</style>
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  data() {
    return {
      seriesData: [
              { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
              { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
              { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
              { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
              { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
              { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
              ],
        primaryXAxis: {
           valueType: 'Category'
        },
        marker: {
                  dataLabel: { visible: true, position: 'Middle' }
                },
      title: "Alaska Weather Statistics - 2016"
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel]
  }
};
</script>
<style>
#container {
   height: 350px;
 }
</style>

Note: The Outer position applies only to column and bar series types.

Data label template

Customize label content using templates. Use placeholders such as ${point.x} and ${point.y} to display data point values. The template property enables fully customizable and visually rich labels.

<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script setup>
import { provide } from "vue";

import { ChartComponent as EjsChart, ColumnSeries, Category, DataLabel,
  SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries
 } from "@syncfusion/ej2-vue-charts";
import {createApp} from 'vue';

const app = createApp({});
    let contentVue = app.component("contentTemplate", {
  template: `<div><div></div><div></div></div>`,
  data() {
    return {
      data: {}
    };
  }
});
let contentTemplate = function() {
  return { template: contentVue };
};

const seriesData = [
        { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
        { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
        { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
        { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
        { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
        { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
        ];

const primaryXAxis = {
    valueType: 'Category'
  };

const marker = {
                dataLabel: { visible: true, position: 'Middle' }, template: contentTemplate
            };

const title = "Alaska Weather Statistics - 2016";

provide('chart',  [ColumnSeries, Category, DataLabel]);

</script>
<style>
 #container {
   height: 350px;
 }
</style>
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";
import {createApp} from 'vue';

const app = createApp({});

    let contentVue = app.component("contentTemplate", {
  template: `<div><div></div><div></div></div>`,
  data() {
    return {
      data: {}
    };
  }
});
let contentTemplate = function() {
  return { template: contentVue };
};



export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  data() {
    return {
      seriesData: [
              { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
              { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
              { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
              { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
              { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
              { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
              ],
        primaryXAxis: {
           valueType: 'Category'
        },
        marker: { dataLabel: { visible: true, position: 'Middle',
                  template: contentTemplate } },
      title: "Alaska Weather Statistics - 2016"
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel]
  }
};
</script>
<style>
 #container {
   height: 350px;
 }
</style>

Text mapping

Display custom text using the name property, which maps label text from a specific field in the data source. This feature is useful for descriptive or category‑based labels.

<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script setup>
import { provide } from "vue";

import { ChartComponent as EjsChart, ColumnSeries, Category, DataLabel,
  SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries
 } 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 marker = {
                dataLabel: { visible: true, name: 'text' }
            };

const title = "Alaska Weather Statistics - 2016";

provide('chart',  [ColumnSeries, Category, DataLabel]);

</script>
<style>
 #container {
   height: 350px;
 }
</style>
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  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'
        },
        marker: { dataLabel: { visible: true, name: 'text'} },
      title: "Alaska Weather Statistics - 2016"
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel]
  }
};
</script>
<style>
 #container {
   height: 350px;
 }
</style>

Format

Apply number or date formatting using the format property. Global formatting symbols include:

  • n – number format
  • p – percentage format
  • c – currency format
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script setup>
import { provide } from "vue";

import { ChartComponent as EjsChart, ColumnSeries, Category, DataLabel,
  SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries
 } 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 marker = {
                dataLabel: { visible: true, name: 'text' }
            };

const title = "Alaska Weather Statistics - 2016";

provide('chart',  [ColumnSeries, Category, DataLabel]);

</script>
<style>
 #container {
   height: 350px;
 }
</style>
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  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'
        },
        marker: { dataLabel: { visible: true, format: 'n2'} },
      title: "Alaska Weather Statistics - 2016"
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel]
  }
};
</script>
<style>
 #container {
   height: 350px;
 }
</style>

Value Format Resultant Value Description
1000 n1 1000.0 Rounded to 1 decimal place.
1000 n2 1000.00 Rounded to 2 decimal places.
1000 n3 1000.000 Rounded to 3 decimal places.
0.01 p1 1.0% Converted to percentage with 1 decimal place.
0.01 p2 1.00% Converted to percentage with 2 decimal places.
0.01 p3 1.000% Converted to percentage with 3 decimal places.
1000 c1 $1000.0 Currency with 1 decimal place.
1000 c2 $1000.00 Currency with 2 decimal places.

Margin

Adjust spacing around labels using the margin property, which includes left, right, bottom, and top values. Margins help prevent labels from overlapping chart elements.

<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script setup>
import { provide } from "vue";

import { ChartComponent as EjsChart, ColumnSeries, Category, DataLabel, SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries } from "@syncfusion/ej2-vue-charts";

const seriesData = [
        { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
        { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
        { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
        { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
        { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
        { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
        ];

const primaryXAxis = {
    valueType: 'Category'
  };

const marker = {
                dataLabel: { visible: true,border:{width: 1, color : 'red'},
                    margin:{
                        left:5,
                        right:5,
                        top:5,
                        bottom:5
                    } }
            };

const title = "Alaska Weather Statistics - 2016";

provide('chart',  [ColumnSeries, Category, DataLabel]);

</script>
<style>
 #container {
   height: 350px;
 }
</style>
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  data() {
    return {
      seriesData: [
              { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
              { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
              { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
              { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
              { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
              { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
              ],
        primaryXAxis: {
           valueType: 'Category'
        },
        marker: { dataLabel: { visible: true,border:{width: 1, color : 'red'},
                        margin:{
                            left:5,
                            right:5,
                            top:5,
                            bottom:5
                        } }
        },
      title: "Alaska Weather Statistics - 2016"
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel]
  }
};
</script>
<style>
 #container {
   height: 350px;
 }
</style>

Data label rotation

Rotate data labels using the angle property. Rotation improves readability when labels are long or when space is limited.

<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script setup>
import { provide } from "vue";

import { ChartComponent as EjsChart, ColumnSeries, Category, DataLabel, SeriesCollectionDirective as ESeriesCollection,
  SeriesDirective as ESeries
 } from "@syncfusion/ej2-vue-charts";

const seriesData = [
        { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
        { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
        { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
        { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
        { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
        { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
        ];

const primaryXAxis = {
    valueType: 'Category'
  };

const marker = {
                dataLabel: { visible: true,border:{width: 1, color : 'red'},
                    margin:{
                        left:5,
                        right:5,
                        top:5,
                        bottom:5
                    }, angle: 45, enableRotation: true}
            };

const title = "Alaska Weather Statistics - 2016";

provide('chart',  [ColumnSeries, Category, DataLabel]);

</script>
<style>
 #container {
   height: 350px;
 }
</style>
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  data() {
    return {
      seriesData: [
              { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
              { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
              { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
              { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
              { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
              { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
              ],
        primaryXAxis: {
           valueType: 'Category'
        },
        marker: { dataLabel: { visible: true,border:{width: 1, color : 'red'},
                        margin:{
                            left:5,
                            right:5,
                            top:5,
                            bottom:5
                        }, angle: 45, enableRotation: true }
        },
      title: "Alaska Weather Statistics - 2016"
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel]
  }
};
</script>
<style>
 #container {
   height: 350px;
 }
</style>

Customization

Enhance label appearance using properties such as fill (background), border, and corner radius (rx, ry). Refine text appearance using the font settings, which support color, fontFamily, fontWeight, and size.

<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script setup>
import { provide } from "vue";

import { ChartComponent as EjsChart, ColumnSeries, Category, DataLabel,
  SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries
 } from "@syncfusion/ej2-vue-charts";

const seriesData = [
        { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
        { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
        { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
        { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
        { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
        { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
        ];

const primaryXAxis = {
    valueType: 'Category'
  };

const marker = {
                dataLabel: { visible: true,
                    border:{width: 2, color : 'red'},
                    rx:10, ry: 10
                }
            };

const title = "Alaska Weather Statistics - 2016";

provide('chart',  [ColumnSeries, Category, DataLabel]);

</script>
<style>
#container {
   height: 350px;
 }
</style>
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  data() {
    return {
      seriesData: [
              { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
              { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
              { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
              { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
              { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
              { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
              ],
        primaryXAxis: {
           valueType: 'Category'
        },
        marker:{ dataLabel: { visible: true,
                        border:{width: 2, color : 'red'},
                        rx:10, ry: 10
                    }
        },
      title: "Alaska Weather Statistics - 2016"
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel]
  }
};
</script>
<style>
#container {
   height: 350px;
 }
</style>

Note: The rx and ry properties require non‑null border values.

Handling Overlapping Data Labels

Use the labelIntersectAction property to specify how overlapping data labels are handled.

The available options are:

  • None - Displays all data labels even when they overlap.
  • Hide - Hides overlapping data labels.
  • Rotate90 - Rotates overlapping data labels by 90 degrees.
  • RelocateVertically - Relocates overlapping data labels vertically.
  • RelocateHorizontally - Relocates overlapping data labels horizontally.

The RelocateVertically and RelocateHorizontally options are supported only for the following series types:

  • StackingColumn
  • StackingColumn100
  • StackingBar
  • StackingBar100

These relocation modes improve readability by relocating overlapping data labels and connecting them to their corresponding data points using connector lines. Use the smartLabelSettings property to customize relocated labels through the background, pointerShape, border, connectorLineStyle, and offset settings. The offset property is applicable only when labelIntersectAction is set to RelocateVertically. Note that the seriesOverlapAction property in smartLabelSettings is not applicable for RelocateVertically and RelocateHorizontally.

<template>
  <div id="app">
    <ejs-chart id="container" :title="title" :tooltip="tooltip" :legendSettings="legendSettings" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis">
      <e-series-collection>
        <e-series :dataSource="dataA" type="StackingColumn" xName="x" yName="y" name="Category A" fill="#254061" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataB" type="StackingColumn" xName="x" yName="y" name="Category B" fill="#376092" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataC" type="StackingColumn" xName="x" yName="y" name="Category C" fill="#4f81bd" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataD" type="StackingColumn" xName="x" yName="y" name="Category D" fill="CornflowerBlue" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataE" type="StackingColumn" xName="x" yName="y" name="Category E" fill="LightBlue" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataF" type="StackingColumn" xName="x" yName="y" name="Category F" fill="LightSteelBlue" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataG" type="StackingColumn" xName="x" yName="y" name="Category G" fill="Moccasin" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataH" type="StackingColumn" xName="x" yName="y" name="Category H" fill="LightGrey" :columnWidth="0.6" :marker="marker"></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>

<script setup>
import { provide } from 'vue';
import { ChartComponent as EjsChart, SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries, StackingColumnSeries, Category, DataLabel, Tooltip,
  Legend } from '@syncfusion/ej2-vue-charts';

const dataA = [
  { x: 'Period 1', y: 35, text: '35%' },
  { x: 'Period 2', y: 30, text: '30%' },
  { x: 'Period 3', y: 32, text: '32%' }
];

const dataB = [
  { x: 'Period 1', y: 22, text: '22%' },
  { x: 'Period 2', y: 25, text: '25%' },
  { x: 'Period 3', y: 24, text: '24%' }
];

const dataC = [
  { x: 'Period 1', y: 14, text: '14%' },
  { x: 'Period 2', y: 16, text: '16%' },
  { x: 'Period 3', y: 15, text: '15%' }
];

const dataD = [
  { x: 'Period 1', y: 10, text: '10%' },
  { x: 'Period 2', y: 11, text: '11%' },
  { x: 'Period 3', y: 12, text: '12%' }
];

const dataE = [
  { x: 'Period 1', y: 7, text: '7%' },
  { x: 'Period 2', y: 8, text: '8%' },
  { x: 'Period 3', y: 6, text: '6%' }
];

const dataF = [
  { x: 'Period 1', y: 5, text: '5%' },
  { x: 'Period 2', y: 5, text: '5%' },
  { x: 'Period 3', y: 5, text: '5%' }
];

const dataG = [
  { x: 'Period 1', y: 4, text: '4%' },
  { x: 'Period 2', y: 3, text: '3%' },
  { x: 'Period 3', y: 4, text: '4%' }
];

const dataH = [
  { x: 'Period 1', y: 3, text: '3%' },
  { x: 'Period 2', y: 2, text: '2%' },
  { x: 'Period 3', y: 2, text: '2%' }
];

const primaryXAxis = {
  valueType: 'Category'
};

const primaryYAxis = {
  visible: false
};

const tooltip = {
  enable: true
};

const legendSettings = {
  visible: true
};

const marker = {
  dataLabel: {
    visible: true,
    name: 'text',
    fill: 'Transparent',
    labelIntersectAction: 'RelocateVertically',
    smartLabelSettings: {
      background: '#4f4f4f',
      border: {
        color: 'black',
        dashArray: '2',
        width: 2
      },
      connectorLineStyle: {
        color: 'black',
        width: 2
      },
      pointerShape: 'Arrow',
      offset: 0.5
    }
  }
};

const title = 'Chart Title';

provide('chart', [StackingColumnSeries, Category, DataLabel, Tooltip, Legend]);
</script>

<style>
#container {
  height: 350px;
}
</style>
<template>
  <div id="app">
    <ejs-chart id="container" :title="title" :tooltip="tooltip" :legendSettings="legendSettings" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis">
      <e-series-collection>
        <e-series :dataSource="dataA" type="StackingColumn" xName="x" yName="y" name="Category A" fill="#254061" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataB" type="StackingColumn" xName="x" yName="y" name="Category B" fill="#376092" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataC" type="StackingColumn" xName="x" yName="y" name="Category C" fill="#4f81bd" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataD" type="StackingColumn" xName="x" yName="y" name="Category D" fill="CornflowerBlue" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataE" type="StackingColumn" xName="x" yName="y" name="Category E" fill="LightBlue" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataF" type="StackingColumn" xName="x" yName="y" name="Category F" fill="LightSteelBlue" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataG" type="StackingColumn" xName="x" yName="y" name="Category G" fill="Moccasin" :columnWidth="0.6" :marker="marker"></e-series>
        <e-series :dataSource="dataH" type="StackingColumn" xName="x" yName="y" name="Category H" fill="LightGrey" :columnWidth="0.6" :marker="marker"></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>

<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, StackingColumnSeries, Category, DataLabel,
  Tooltip, Legend } from '@syncfusion/ej2-vue-charts';

export default {
  name: 'App',

  components: {
    'ejs-chart': ChartComponent,
    'e-series-collection': SeriesCollectionDirective,
    'e-series': SeriesDirective
  },

  data() {
    return {
      dataA: [
        { x: 'Period 1', y: 35, text: '35%' },
        { x: 'Period 2', y: 30, text: '30%' },
        { x: 'Period 3', y: 32, text: '32%' }
      ],

      dataB: [
        { x: 'Period 1', y: 22, text: '22%' },
        { x: 'Period 2', y: 25, text: '25%' },
        { x: 'Period 3', y: 24, text: '24%' }
      ],

      dataC: [
        { x: 'Period 1', y: 14, text: '14%' },
        { x: 'Period 2', y: 16, text: '16%' },
        { x: 'Period 3', y: 15, text: '15%' }
      ],

      dataD: [
        { x: 'Period 1', y: 10, text: '10%' },
        { x: 'Period 2', y: 11, text: '11%' },
        { x: 'Period 3', y: 12, text: '12%' }
      ],

      dataE: [
        { x: 'Period 1', y: 7, text: '7%' },
        { x: 'Period 2', y: 8, text: '8%' },
        { x: 'Period 3', y: 6, text: '6%' }
      ],

      dataF: [
        { x: 'Period 1', y: 5, text: '5%' },
        { x: 'Period 2', y: 5, text: '5%' },
        { x: 'Period 3', y: 5, text: '5%' }
      ],

      dataG: [
        { x: 'Period 1', y: 4, text: '4%' },
        { x: 'Period 2', y: 3, text: '3%' },
        { x: 'Period 3', y: 4, text: '4%' }
      ],

      dataH: [
        { x: 'Period 1', y: 3, text: '3%' },
        { x: 'Period 2', y: 2, text: '2%' },
        { x: 'Period 3', y: 2, text: '2%' }
      ],

      primaryXAxis: {
        valueType: 'Category'
      },

      primaryYAxis: {
        visible: false
      },

      tooltip: {
        enable: true
      },

      legendSettings: {
        visible: true
      },

      marker: {
        dataLabel: {
          visible: true,
          name: 'text',
          fill: 'Transparent',
          labelIntersectAction: 'RelocateVertically',
          smartLabelSettings: {
            background: '#4f4f4f',
            border: {
              color: 'black',
              dashArray: '2',
              width: 2
            },
            connectorLineStyle: {
              color: 'black',
              width: 2
            },
            pointerShape: 'Arrow',
            offset: 0.5
          }
        }
      },

      title: 'Chart Title'
    };
  },

  provide: {
    chart: [StackingColumnSeries, Category, DataLabel, Tooltip, Legend]
  }
};
</script>

<style>
#container {
  height: 350px;
}
</style>

Smart Label

Smart Label places data labels of Cartesian series so that they do not overlap each other, the markers, or the plot area boundary. Enable it by setting the enableSmartLabels property to true. The default value is false.

How it works:

  • Positioning: A label stays at its default position when that position is free. Otherwise, the label is checked around its point at the top, right, bottom, and left positions, and then at the diagonal positions. The first position that is inside the plot area of its series and does not overlap any other label or marker is used. For example, if the top and right positions collide with other labels, the label is placed at the bottom when there is enough space. If no free position is found, the label is hidden.
  • Label and marker detection: A label is checked against the other data labels and the visible markers of all series.
  • Connector line: A relocated label that is more than 12 px away from its point is joined to the point with a connector line and an arrow pointer.
<template>
  <div id="app">
    <ejs-chart id="container" :title="title" :subTitle="subTitle" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis" :enableSmartLabels="true">
      <e-series-collection>
        <e-series :dataSource="vietnam" type="Line" xName="x" yName="y" name="Vietnam" :width="2" :animation="animation" :marker="vietnamMarker"></e-series>
        <e-series :dataSource="indonesia" type="Line" xName="x" yName="y" name="Indonesia" :width="2" :animation="animation" :marker="indonesiaMarker"></e-series>
        <e-series :dataSource="france" type="Line" xName="x" yName="y" name="France" :width="2" :animation="animation" :marker="franceMarker"></e-series>
        <e-series :dataSource="poland" type="Line" xName="x" yName="y" name="Poland" :width="2" :animation="animation" :marker="polandMarker"></e-series>
        <e-series :dataSource="mexico" type="Line" xName="x" yName="y" name="Mexico" :width="2" :animation="animation" :marker="mexicoMarker"></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>

<script setup>
import { provide } from 'vue';
import { ChartComponent as EjsChart, SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries, LineSeries, DataLabel, Legend } from '@syncfusion/ej2-vue-charts';

const vietnam = [
  { x: 2016, y: 7.8 },
  { x: 2017, y: 10.3 },
  { x: 2018, y: 15.5 },
  { x: 2019, y: 17.5 },
  { x: 2020, y: 19.5 },
  { x: 2021, y: 23.0 },
  { x: 2022, y: 20.0 },
  { x: 2023, y: 19.0 },
  { x: 2024, y: 22.1 }
];

const indonesia = [
  { x: 2016, y: 4.8 },
  { x: 2017, y: 5.2 },
  { x: 2018, y: 6.2 },
  { x: 2019, y: 7.8 },
  { x: 2020, y: 9.3 },
  { x: 2021, y: 14.3 },
  { x: 2022, y: 15.6 },
  { x: 2023, y: 16.0 },
  { x: 2024, y: 17.0 }
];

const france = [
  { x: 2016, y: 14.6 },
  { x: 2017, y: 15.5 },
  { x: 2018, y: 15.4 },
  { x: 2019, y: 14.4 },
  { x: 2020, y: 11.6 },
  { x: 2021, y: 13.9 },
  { x: 2022, y: 12.1 },
  { x: 2023, y: 10.0 },
  { x: 2024, y: 10.8 }
];

const poland = [
  { x: 2016, y: 8.9 },
  { x: 2017, y: 10.3 },
  { x: 2018, y: 10.8 },
  { x: 2019, y: 9.0 },
  { x: 2020, y: 7.9 },
  { x: 2021, y: 8.5 },
  { x: 2022, y: 7.4 },
  { x: 2023, y: 6.4 },
  { x: 2024, y: 7.1 }
];

const mexico = [
  { x: 2016, y: 19.0 },
  { x: 2017, y: 20.0 },
  { x: 2018, y: 20.2 },
  { x: 2019, y: 18.4 },
  { x: 2020, y: 16.8 },
  { x: 2021, y: 18.5 },
  { x: 2022, y: 18.4 },
  { x: 2023, y: 16.3 },
  { x: 2024, y: 13.7 }
];

const primaryXAxis = {
  valueType: 'Double',
  majorGridLines: { width: 0 },
  edgeLabelPlacement: 'Shift'
};

const primaryYAxis = {
  title: 'Volume in million metric tons',
  labelFormat: '{value}',
  lineStyle: { width: 0 },
  majorTickLines: { width: 0 },
  minorTickLines: { width: 0 }
};

const animation = { enable: false };

const vietnamMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Circle',
  isFilled: true,
  dataLabel: { visible: true }
};

const indonesiaMarker = {
  visible: true,
  width: 6,
  height: 6,
  shape: 'Triangle',
  isFilled: true,
  dataLabel: { visible: true }
};

const franceMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Diamond',
  isFilled: true,
  dataLabel: { visible: true }
};

const polandMarker = {
  visible: true,
  width: 5,
  height: 5,
  shape: 'Rectangle',
  isFilled: true,
  dataLabel: { visible: true }
};

const mexicoMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Pentagon',
  isFilled: true,
  dataLabel: { visible: true }
};

const title = 'Annual Crude Steel Production by Country (2016–2024)';
const subTitle = 'Source: wikipedia.org';

provide('chart', [LineSeries, DataLabel, Legend]);
</script>

<style>
#container {
  height: 350px;
}
</style>
<template>
<div id="app">
  <ejs-chart id="container" :title="title" :subTitle="subTitle" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis" :enableSmartLabels="true">
    <e-series-collection>
      <e-series :dataSource="vietnam" type="Line" xName="x" yName="y" name="Vietnam" :width="2" :animation="animation" :marker="vietnamMarker"></e-series>
      <e-series :dataSource="indonesia" type="Line" xName="x" yName="y" name="Indonesia" :width="2" :animation="animation" :marker="indonesiaMarker"></e-series>
      <e-series :dataSource="france" type="Line" xName="x" yName="y" name="France" :width="2" :animation="animation" :marker="franceMarker"></e-series>
      <e-series :dataSource="poland" type="Line" xName="x" yName="y" name="Poland" :width="2" :animation="animation" :marker="polandMarker"></e-series>
      <e-series :dataSource="mexico" type="Line" xName="x" yName="y" name="Mexico" :width="2" :animation="animation" :marker="mexicoMarker"></e-series>
    </e-series-collection>
  </ejs-chart>
</div>
</template>

<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, LineSeries, DataLabel, Legend } from '@syncfusion/ej2-vue-charts';

export default {
name: 'App',
components: {
  'ejs-chart': ChartComponent,
  'e-series-collection': SeriesCollectionDirective,
  'e-series': SeriesDirective
},
data() {
  return {
    vietnam: [
      { x: 2016, y: 7.8 },
      { x: 2017, y: 10.3 },
      { x: 2018, y: 15.5 },
      { x: 2019, y: 17.5 },
      { x: 2020, y: 19.5 },
      { x: 2021, y: 23.0 },
      { x: 2022, y: 20.0 },
      { x: 2023, y: 19.0 },
      { x: 2024, y: 22.1 }
    ],
    indonesia: [
      { x: 2016, y: 4.8 },
      { x: 2017, y: 5.2 },
      { x: 2018, y: 6.2 },
      { x: 2019, y: 7.8 },
      { x: 2020, y: 9.3 },
      { x: 2021, y: 14.3 },
      { x: 2022, y: 15.6 },
      { x: 2023, y: 16.0 },
      { x: 2024, y: 17.0 }
    ],
    france: [
      { x: 2016, y: 14.6 },
      { x: 2017, y: 15.5 },
      { x: 2018, y: 15.4 },
      { x: 2019, y: 14.4 },
      { x: 2020, y: 11.6 },
      { x: 2021, y: 13.9 },
      { x: 2022, y: 12.1 },
      { x: 2023, y: 10.0 },
      { x: 2024, y: 10.8 }
    ],
    poland: [
      { x: 2016, y: 8.9 },
      { x: 2017, y: 10.3 },
      { x: 2018, y: 10.8 },
      { x: 2019, y: 9.0 },
      { x: 2020, y: 7.9 },
      { x: 2021, y: 8.5 },
      { x: 2022, y: 7.4 },
      { x: 2023, y: 6.4 },
      { x: 2024, y: 7.1 }
    ],
    mexico: [
      { x: 2016, y: 19.0 },
      { x: 2017, y: 20.0 },
      { x: 2018, y: 20.2 },
      { x: 2019, y: 18.4 },
      { x: 2020, y: 16.8 },
      { x: 2021, y: 18.5 },
      { x: 2022, y: 18.4 },
      { x: 2023, y: 16.3 },
      { x: 2024, y: 13.7 }
    ],
    primaryXAxis: {
      valueType: 'Double',
      majorGridLines: { width: 0 },
      edgeLabelPlacement: 'Shift'
    },
    primaryYAxis: {
      title: 'Volume in million metric tons',
      labelFormat: '{value}',
      lineStyle: { width: 0 },
      majorTickLines: { width: 0 },
      minorTickLines: { width: 0 }
    },
    animation: { enable: false },
    vietnamMarker: {
      visible: true,
      width: 7,
      height: 7,
      shape: 'Circle',
      isFilled: true,
      dataLabel: { visible: true }
    },
    indonesiaMarker: {
      visible: true,
      width: 6,
      height: 6,
      shape: 'Triangle',
      isFilled: true,
      dataLabel: { visible: true }
    },
    franceMarker: {
      visible: true,
      width: 7,
      height: 7,
      shape: 'Diamond',
      isFilled: true,
      dataLabel: { visible: true }
    },
    polandMarker: {
      visible: true,
      width: 5,
      height: 5,
      shape: 'Rectangle',
      isFilled: true,
      dataLabel: { visible: true }
    },
    mexicoMarker: {
      visible: true,
      width: 7,
      height: 7,
      shape: 'Pentagon',
      isFilled: true,
      dataLabel: { visible: true }
    },
    title: 'Annual Crude Steel Production by Country (2016–2024)',
    subTitle: 'Source: wikipedia.org'
  };
},
provide: {
  chart: [LineSeries, DataLabel, Legend]
}
};
</script>

<style>
#container {
height: 350px;
}
</style>

Note: When Smart Label is enabled, labelIntersectAction is ignored, and the data label position decides only the default position. Stacked column and bar series continue to use the RelocateVertically and RelocateHorizontally options.

Duplicate data labels

Use the showDuplicateLabels property of the chart to control labels that have the same text at the same location, such as labels of multiple series with identical values.

  • true (default) - Renders all the labels.
  • false - Renders only the first label and skips the others. The first label is decided by the series order and then the point order.

This property works with or without enableSmartLabels.

<template>
  <div id="app">
    <ejs-chart id="container" :title="title" :subTitle="subTitle" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis" :enableSmartLabels="true" :showDuplicateLabels="false">
      <e-series-collection>
        <e-series :dataSource="vietnam" type="Line" xName="x" yName="y" name="Vietnam" :width="2" :animation="animation" :marker="vietnamMarker"></e-series>
        <e-series :dataSource="indonesia" type="Line" xName="x" yName="y" name="Indonesia" :width="2" :animation="animation" :marker="indonesiaMarker"></e-series>
        <e-series :dataSource="france" type="Line" xName="x" yName="y" name="France" :width="2" :animation="animation" :marker="franceMarker"></e-series>
        <e-series :dataSource="poland" type="Line" xName="x" yName="y" name="Poland" :width="2" :animation="animation" :marker="polandMarker"></e-series>
        <e-series :dataSource="mexico" type="Line" xName="x" yName="y" name="Mexico" :width="2" :animation="animation" :marker="mexicoMarker"></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>

<script setup>
import { provide } from 'vue';
import { ChartComponent as EjsChart, SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries, LineSeries, DataLabel, Legend } from '@syncfusion/ej2-vue-charts';

const vietnam = [
  { x: 2016, y: 7.8 },
  { x: 2017, y: 10.3 },
  { x: 2018, y: 15.5 },
  { x: 2019, y: 17.5 },
  { x: 2020, y: 19.5 },
  { x: 2021, y: 23.0 },
  { x: 2022, y: 20.0 },
  { x: 2023, y: 19.0 },
  { x: 2024, y: 22.1 }
];

const indonesia = [
  { x: 2016, y: 4.8 },
  { x: 2017, y: 5.2 },
  { x: 2018, y: 6.2 },
  { x: 2019, y: 7.8 },
  { x: 2020, y: 9.3 },
  { x: 2021, y: 14.3 },
  { x: 2022, y: 15.6 },
  { x: 2023, y: 16.0 },
  { x: 2024, y: 17.0 }
];

const france = [
  { x: 2016, y: 14.6 },
  { x: 2017, y: 15.5 },
  { x: 2018, y: 15.4 },
  { x: 2019, y: 14.4 },
  { x: 2020, y: 11.6 },
  { x: 2021, y: 13.9 },
  { x: 2022, y: 12.1 },
  { x: 2023, y: 10.0 },
  { x: 2024, y: 10.8 }
];

const poland = [
  { x: 2016, y: 8.9 },
  { x: 2017, y: 10.3 },
  { x: 2018, y: 10.8 },
  { x: 2019, y: 9.0 },
  { x: 2020, y: 7.9 },
  { x: 2021, y: 8.5 },
  { x: 2022, y: 7.4 },
  { x: 2023, y: 6.4 },
  { x: 2024, y: 7.1 }
];

const mexico = [
  { x: 2016, y: 19.0 },
  { x: 2017, y: 20.0 },
  { x: 2018, y: 20.2 },
  { x: 2019, y: 18.4 },
  { x: 2020, y: 16.8 },
  { x: 2021, y: 18.5 },
  { x: 2022, y: 18.4 },
  { x: 2023, y: 16.3 },
  { x: 2024, y: 13.7 }
];

const primaryXAxis = {
  valueType: 'Double',
  majorGridLines: { width: 0 },
  edgeLabelPlacement: 'Shift'
};

const primaryYAxis = {
  title: 'Volume in million metric tons',
  labelFormat: '{value}',
  lineStyle: { width: 0 },
  majorTickLines: { width: 0 },
  minorTickLines: { width: 0 }
};

const animation = { enable: false };

const vietnamMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Circle',
  isFilled: true,
  dataLabel: { visible: true }
};

const indonesiaMarker = {
  visible: true,
  width: 6,
  height: 6,
  shape: 'Triangle',
  isFilled: true,
  dataLabel: { visible: true }
};

const franceMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Diamond',
  isFilled: true,
  dataLabel: { visible: true }
};

const polandMarker = {
  visible: true,
  width: 5,
  height: 5,
  shape: 'Rectangle',
  isFilled: true,
  dataLabel: { visible: true }
};

const mexicoMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Pentagon',
  isFilled: true,
  dataLabel: { visible: true }
};

const title = 'Annual Crude Steel Production by Country (2016–2024)';
const subTitle = 'Source: wikipedia.org';

provide('chart', [LineSeries, DataLabel, Legend]);
</script>

<style>
#container {
  height: 350px;
}
</style>
<template>
  <div id="app">
    <ejs-chart id="container" :title="title" :subTitle="subTitle" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis" :enableSmartLabels="true" :showDuplicateLabels="false">
      <e-series-collection>
        <e-series :dataSource="vietnam" type="Line" xName="x" yName="y" name="Vietnam" :width="2" :animation="animation" :marker="vietnamMarker"></e-series>
        <e-series :dataSource="indonesia" type="Line" xName="x" yName="y" name="Indonesia" :width="2" :animation="animation" :marker="indonesiaMarker"></e-series>
        <e-series :dataSource="france" type="Line" xName="x" yName="y" name="France" :width="2" :animation="animation" :marker="franceMarker"></e-series>
        <e-series :dataSource="poland" type="Line" xName="x" yName="y" name="Poland" :width="2" :animation="animation" :marker="polandMarker"></e-series>
        <e-series :dataSource="mexico" type="Line" xName="x" yName="y" name="Mexico" :width="2" :animation="animation" :marker="mexicoMarker"></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>

<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, LineSeries, DataLabel, Legend } from '@syncfusion/ej2-vue-charts';

export default {
  name: 'App',
  components: {
    'ejs-chart': ChartComponent,
    'e-series-collection': SeriesCollectionDirective,
    'e-series': SeriesDirective
  },
  data() {
    return {
      vietnam: [
        { x: 2016, y: 7.8 },
        { x: 2017, y: 10.3 },
        { x: 2018, y: 15.5 },
        { x: 2019, y: 17.5 },
        { x: 2020, y: 19.5 },
        { x: 2021, y: 23.0 },
        { x: 2022, y: 20.0 },
        { x: 2023, y: 19.0 },
        { x: 2024, y: 22.1 }
      ],
      indonesia: [
        { x: 2016, y: 4.8 },
        { x: 2017, y: 5.2 },
        { x: 2018, y: 6.2 },
        { x: 2019, y: 7.8 },
        { x: 2020, y: 9.3 },
        { x: 2021, y: 14.3 },
        { x: 2022, y: 15.6 },
        { x: 2023, y: 16.0 },
        { x: 2024, y: 17.0 }
      ],
      france: [
        { x: 2016, y: 14.6 },
        { x: 2017, y: 15.5 },
        { x: 2018, y: 15.4 },
        { x: 2019, y: 14.4 },
        { x: 2020, y: 11.6 },
        { x: 2021, y: 13.9 },
        { x: 2022, y: 12.1 },
        { x: 2023, y: 10.0 },
        { x: 2024, y: 10.8 }
      ],
      poland: [
        { x: 2016, y: 8.9 },
        { x: 2017, y: 10.3 },
        { x: 2018, y: 10.8 },
        { x: 2019, y: 9.0 },
        { x: 2020, y: 7.9 },
        { x: 2021, y: 8.5 },
        { x: 2022, y: 7.4 },
        { x: 2023, y: 6.4 },
        { x: 2024, y: 7.1 }
      ],
      mexico: [
        { x: 2016, y: 19.0 },
        { x: 2017, y: 20.0 },
        { x: 2018, y: 20.2 },
        { x: 2019, y: 18.4 },
        { x: 2020, y: 16.8 },
        { x: 2021, y: 18.5 },
        { x: 2022, y: 18.4 },
        { x: 2023, y: 16.3 },
        { x: 2024, y: 13.7 }
      ],
      primaryXAxis: {
        valueType: 'Double',
        majorGridLines: { width: 0 },
        edgeLabelPlacement: 'Shift'
      },
      primaryYAxis: {
        title: 'Volume in million metric tons',
        labelFormat: '{value}',
        lineStyle: { width: 0 },
        majorTickLines: { width: 0 },
        minorTickLines: { width: 0 }
      },
      animation: { enable: false },
      vietnamMarker: {
        visible: true,
        width: 7,
        height: 7,
        shape: 'Circle',
        isFilled: true,
        dataLabel: { visible: true }
      },
      indonesiaMarker: {
        visible: true,
        width: 6,
        height: 6,
        shape: 'Triangle',
        isFilled: true,
        dataLabel: { visible: true }
      },
      franceMarker: {
        visible: true,
        width: 7,
        height: 7,
        shape: 'Diamond',
        isFilled: true,
        dataLabel: { visible: true }
      },
      polandMarker: {
        visible: true,
        width: 5,
        height: 5,
        shape: 'Rectangle',
        isFilled: true,
        dataLabel: { visible: true }
      },
      mexicoMarker: {
        visible: true,
        width: 7,
        height: 7,
        shape: 'Pentagon',
        isFilled: true,
        dataLabel: { visible: true }
      },
      title: 'Annual Crude Steel Production by Country (2016–2024)',
      subTitle: 'Source: wikipedia.org'
    };
  },
  provide: {
    chart: [LineSeries, DataLabel, Legend]
  }
};
</script>

<style>
#container {
  height: 350px;
}
</style>

Customization

Use the smartLabelSettings property in the series dataLabel to customize relocated labels and their connector lines. Labels at their default position keep the dataLabel settings.

  • background - Sets the background color of the relocated label.
  • border - Sets the color, width, and dashArray of the relocated label border.
  • pointerShape - Sets the pointer at the point end of the connector line. The options are Arrow (default) and None.
  • connectorLineStyle - Sets the color, width, and opacity of the connector line and pointer. Set width to 0 or color to transparent to hide the line.
  • seriesOverlapAction - Specifies whether labels avoid series elements. See Series overlap action.

Note: The offset property is not applicable when Smart Label is enabled, because Smart Label automatically determines the final label position to avoid overlaps.

<template>
  <div id="app">
    <ejs-chart id="container" :title="title" :subTitle="subTitle" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis" :enableSmartLabels="true">
      <e-series-collection>
        <e-series :dataSource="vietnam" type="Line" xName="x" yName="y" name="Vietnam" :width="2" :animation="animation" :marker="vietnamMarker"></e-series>
        <e-series :dataSource="indonesia" type="Line" xName="x" yName="y" name="Indonesia" :width="2" :animation="animation" :marker="indonesiaMarker"></e-series>
        <e-series :dataSource="france" type="Line" xName="x" yName="y" name="France" :width="2" :animation="animation" :marker="franceMarker"></e-series>
        <e-series :dataSource="poland" type="Line" xName="x" yName="y" name="Poland" :width="2" :animation="animation" :marker="polandMarker"></e-series>
        <e-series :dataSource="mexico" type="Line" xName="x" yName="y" name="Mexico" :width="2" :animation="animation" :marker="mexicoMarker"></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>

<script setup>
import { provide } from 'vue';
import { ChartComponent as EjsChart, SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries, LineSeries, DataLabel, Legend } from '@syncfusion/ej2-vue-charts';

const vietnam = [
  { x: 2016, y: 7.8 },
  { x: 2017, y: 10.3 },
  { x: 2018, y: 15.5 },
  { x: 2019, y: 17.5 },
  { x: 2020, y: 19.5 },
  { x: 2021, y: 23.0 },
  { x: 2022, y: 20.0 },
  { x: 2023, y: 19.0 },
  { x: 2024, y: 22.1 }
];

const indonesia = [
  { x: 2016, y: 4.8 },
  { x: 2017, y: 5.2 },
  { x: 2018, y: 6.2 },
  { x: 2019, y: 7.8 },
  { x: 2020, y: 9.3 },
  { x: 2021, y: 14.3 },
  { x: 2022, y: 15.6 },
  { x: 2023, y: 16.0 },
  { x: 2024, y: 17.0 }
];

const france = [
  { x: 2016, y: 14.6 },
  { x: 2017, y: 15.5 },
  { x: 2018, y: 15.4 },
  { x: 2019, y: 14.4 },
  { x: 2020, y: 11.6 },
  { x: 2021, y: 13.9 },
  { x: 2022, y: 12.1 },
  { x: 2023, y: 10.0 },
  { x: 2024, y: 10.8 }
];

const poland = [
  { x: 2016, y: 8.9 },
  { x: 2017, y: 10.3 },
  { x: 2018, y: 10.8 },
  { x: 2019, y: 9.0 },
  { x: 2020, y: 7.9 },
  { x: 2021, y: 8.5 },
  { x: 2022, y: 7.4 },
  { x: 2023, y: 6.4 },
  { x: 2024, y: 7.1 }
];

const mexico = [
  { x: 2016, y: 19.0 },
  { x: 2017, y: 20.0 },
  { x: 2018, y: 20.2 },
  { x: 2019, y: 18.4 },
  { x: 2020, y: 16.8 },
  { x: 2021, y: 18.5 },
  { x: 2022, y: 18.4 },
  { x: 2023, y: 16.3 },
  { x: 2024, y: 13.7 }
];

const primaryXAxis = {
  valueType: 'Double',
  majorGridLines: { width: 0 },
  edgeLabelPlacement: 'Shift'
};

const primaryYAxis = {
  title: 'Volume in million metric tons',
  labelFormat: '{value}',
  lineStyle: { width: 0 },
  majorTickLines: { width: 0 },
  minorTickLines: { width: 0 }
};

const animation = { enable: false };

const vietnamMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Circle',
  isFilled: true,
  dataLabel: {
    visible: true,
    smartLabelSettings: {
      background: '#e0e0e0',
      border: { color: '#404040', width: 1 },
      pointerShape: 'Arrow',
      connectorLineStyle: { color: '#404040', width: 1.5 }
    }
  }
};

const indonesiaMarker = {
  visible: true,
  width: 6,
  height: 6,
  shape: 'Triangle',
  isFilled: true,
  dataLabel: { visible: true }
};

const franceMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Diamond',
  isFilled: true,
  dataLabel: { visible: true }
};

const polandMarker = {
  visible: true,
  width: 5,
  height: 5,
  shape: 'Rectangle',
  isFilled: true,
  dataLabel: { visible: true }
};

const mexicoMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Pentagon',
  isFilled: true,
  dataLabel: { visible: true }
};

const title = 'Annual Crude Steel Production by Country (2016–2024)';
const subTitle = 'Source: wikipedia.org';

provide('chart', [LineSeries, DataLabel, Legend]);
</script>

<style>
#container {
  height: 350px;
}
</style>
<template>
  <div id="app">
    <ejs-chart id="container" :title="title" :subTitle="subTitle" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis" :enableSmartLabels="true">
      <e-series-collection>
        <e-series :dataSource="vietnam" type="Line" xName="x" yName="y" name="Vietnam" :width="2" :animation="animation" :marker="vietnamMarker"></e-series>
        <e-series :dataSource="indonesia" type="Line" xName="x" yName="y" name="Indonesia" :width="2" :animation="animation" :marker="indonesiaMarker"></e-series>
        <e-series :dataSource="france" type="Line" xName="x" yName="y" name="France" :width="2" :animation="animation" :marker="franceMarker"></e-series>
        <e-series :dataSource="poland" type="Line" xName="x" yName="y" name="Poland" :width="2" :animation="animation" :marker="polandMarker"></e-series>
        <e-series :dataSource="mexico" type="Line" xName="x" yName="y" name="Mexico" :width="2" :animation="animation" :marker="mexicoMarker"></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>

<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, LineSeries, DataLabel, Legend } from '@syncfusion/ej2-vue-charts';

export default {
  name: 'App',
  components: {
    'ejs-chart': ChartComponent,
    'e-series-collection': SeriesCollectionDirective,
    'e-series': SeriesDirective
  },
  data() {
    return {
      vietnam: [
        { x: 2016, y: 7.8 },
        { x: 2017, y: 10.3 },
        { x: 2018, y: 15.5 },
        { x: 2019, y: 17.5 },
        { x: 2020, y: 19.5 },
        { x: 2021, y: 23.0 },
        { x: 2022, y: 20.0 },
        { x: 2023, y: 19.0 },
        { x: 2024, y: 22.1 }
      ],
      indonesia: [
        { x: 2016, y: 4.8 },
        { x: 2017, y: 5.2 },
        { x: 2018, y: 6.2 },
        { x: 2019, y: 7.8 },
        { x: 2020, y: 9.3 },
        { x: 2021, y: 14.3 },
        { x: 2022, y: 15.6 },
        { x: 2023, y: 16.0 },
        { x: 2024, y: 17.0 }
      ],
      france: [
        { x: 2016, y: 14.6 },
        { x: 2017, y: 15.5 },
        { x: 2018, y: 15.4 },
        { x: 2019, y: 14.4 },
        { x: 2020, y: 11.6 },
        { x: 2021, y: 13.9 },
        { x: 2022, y: 12.1 },
        { x: 2023, y: 10.0 },
        { x: 2024, y: 10.8 }
      ],
      poland: [
        { x: 2016, y: 8.9 },
        { x: 2017, y: 10.3 },
        { x: 2018, y: 10.8 },
        { x: 2019, y: 9.0 },
        { x: 2020, y: 7.9 },
        { x: 2021, y: 8.5 },
        { x: 2022, y: 7.4 },
        { x: 2023, y: 6.4 },
        { x: 2024, y: 7.1 }
      ],
      mexico: [
        { x: 2016, y: 19.0 },
        { x: 2017, y: 20.0 },
        { x: 2018, y: 20.2 },
        { x: 2019, y: 18.4 },
        { x: 2020, y: 16.8 },
        { x: 2021, y: 18.5 },
        { x: 2022, y: 18.4 },
        { x: 2023, y: 16.3 },
        { x: 2024, y: 13.7 }
      ],
      primaryXAxis: {
        valueType: 'Double',
        majorGridLines: { width: 0 },
        edgeLabelPlacement: 'Shift'
      },
      primaryYAxis: {
        title: 'Volume in million metric tons',
        labelFormat: '{value}',
        lineStyle: { width: 0 },
        majorTickLines: { width: 0 },
        minorTickLines: { width: 0 }
      },
      animation: { enable: false },
      vietnamMarker: {
        visible: true,
        width: 7,
        height: 7,
        shape: 'Circle',
        isFilled: true,
        dataLabel: {
          visible: true,
          smartLabelSettings: {
            background: '#e0e0e0',
            border: { color: '#404040', width: 1 },
            pointerShape: 'Arrow',
            connectorLineStyle: { color: '#404040', width: 1.5 }
          }
        }
      },
      indonesiaMarker: {
        visible: true,
        width: 6,
        height: 6,
        shape: 'Triangle',
        isFilled: true,
        dataLabel: { visible: true }
      },
      franceMarker: {
        visible: true,
        width: 7,
        height: 7,
        shape: 'Diamond',
        isFilled: true,
        dataLabel: { visible: true }
      },
      polandMarker: {
        visible: true,
        width: 5,
        height: 5,
        shape: 'Rectangle',
        isFilled: true,
        dataLabel: { visible: true }
      },
      mexicoMarker: {
        visible: true,
        width: 7,
        height: 7,
        shape: 'Pentagon',
        isFilled: true,
        dataLabel: { visible: true }
      },
      title: 'Annual Crude Steel Production by Country (2016–2024)',
      subTitle: 'Source: wikipedia.org'
    };
  },
  provide: {
    chart: [LineSeries, DataLabel, Legend]
  }
};
</script>

<style>
#container {
  height: 350px;
}
</style>

Series overlap action

Use the seriesOverlapAction property in smartLabelSettings to specify whether labels can overlap the series elements, such as lines, areas, columns, bars, and trendlines.

  • None (default) - Labels avoid only other labels and markers, so they can be placed over series elements.
  • Hide - Labels also avoid the elements of all visible series. A label moves to a free position if one exists, and is hidden only when none is available.

Note: In canvas rendering mode, Hide behaves like None.

<template>
  <div id="app">
    <ejs-chart id="container" :title="title" :subTitle="subTitle" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis" :enableSmartLabels="true">
      <e-series-collection>
        <e-series :dataSource="vietnam" type="Line" xName="x" yName="y" name="Vietnam" :width="2" :animation="animation" :marker="vietnamMarker"></e-series>
        <e-series :dataSource="indonesia" type="Line" xName="x" yName="y" name="Indonesia" :width="2" :animation="animation" :marker="indonesiaMarker"></e-series>
        <e-series :dataSource="france" type="Line" xName="x" yName="y" name="France" :width="2" :animation="animation" :marker="franceMarker"></e-series>
        <e-series :dataSource="poland" type="Line" xName="x" yName="y" name="Poland" :width="2" :animation="animation" :marker="polandMarker"></e-series>
        <e-series :dataSource="mexico" type="Line" xName="x" yName="y" name="Mexico" :width="2" :animation="animation" :marker="mexicoMarker"></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>

<script setup>
import { provide } from 'vue';
import { ChartComponent as EjsChart, SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries, LineSeries, DataLabel, Legend } from '@syncfusion/ej2-vue-charts';

const vietnam = [
  { x: 2016, y: 7.8 },
  { x: 2017, y: 10.3 },
  { x: 2018, y: 15.5 },
  { x: 2019, y: 17.5 },
  { x: 2020, y: 19.5 },
  { x: 2021, y: 23.0 },
  { x: 2022, y: 20.0 },
  { x: 2023, y: 19.0 },
  { x: 2024, y: 22.1 }
];

const indonesia = [
  { x: 2016, y: 4.8 },
  { x: 2017, y: 5.2 },
  { x: 2018, y: 6.2 },
  { x: 2019, y: 7.8 },
  { x: 2020, y: 9.3 },
  { x: 2021, y: 14.3 },
  { x: 2022, y: 15.6 },
  { x: 2023, y: 16.0 },
  { x: 2024, y: 17.0 }
];

const france = [
  { x: 2016, y: 14.6 },
  { x: 2017, y: 15.5 },
  { x: 2018, y: 15.4 },
  { x: 2019, y: 14.4 },
  { x: 2020, y: 11.6 },
  { x: 2021, y: 13.9 },
  { x: 2022, y: 12.1 },
  { x: 2023, y: 10.0 },
  { x: 2024, y: 10.8 }
];

const poland = [
  { x: 2016, y: 8.9 },
  { x: 2017, y: 10.3 },
  { x: 2018, y: 10.8 },
  { x: 2019, y: 9.0 },
  { x: 2020, y: 7.9 },
  { x: 2021, y: 8.5 },
  { x: 2022, y: 7.4 },
  { x: 2023, y: 6.4 },
  { x: 2024, y: 7.1 }
];

const mexico = [
  { x: 2016, y: 19.0 },
  { x: 2017, y: 20.0 },
  { x: 2018, y: 20.2 },
  { x: 2019, y: 18.4 },
  { x: 2020, y: 16.8 },
  { x: 2021, y: 18.5 },
  { x: 2022, y: 18.4 },
  { x: 2023, y: 16.3 },
  { x: 2024, y: 13.7 }
];

const primaryXAxis = {
  valueType: 'Double',
  majorGridLines: { width: 0 },
  edgeLabelPlacement: 'Shift'
};

const primaryYAxis = {
  title: 'Volume in million metric tons',
  labelFormat: '{value}',
  lineStyle: { width: 0 },
  majorTickLines: { width: 0 },
  minorTickLines: { width: 0 }
};

const animation = { enable: false };

const vietnamMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Circle',
  isFilled: true,
  dataLabel: {
    visible: true,
    smartLabelSettings: {
      seriesOverlapAction: 'Hide'
    }
  }
};

const indonesiaMarker = {
  visible: true,
  width: 6,
  height: 6,
  shape: 'Triangle',
  isFilled: true,
  dataLabel: {
    visible: true,
    smartLabelSettings: {
      seriesOverlapAction: 'Hide'
    }
  }
};

const franceMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Diamond',
  isFilled: true,
  dataLabel: {
    visible: true,
    smartLabelSettings: {
      seriesOverlapAction: 'Hide'
    }
  }
};

const polandMarker = {
  visible: true,
  width: 5,
  height: 5,
  shape: 'Rectangle',
  isFilled: true,
  dataLabel: {
    visible: true,
    smartLabelSettings: {
      seriesOverlapAction: 'Hide'
    }
  }
};

const mexicoMarker = {
  visible: true,
  width: 7,
  height: 7,
  shape: 'Pentagon',
  isFilled: true,
  dataLabel: {
    visible: true,
    smartLabelSettings: {
      seriesOverlapAction: 'Hide'
    }
  }
};

const title = 'Annual Crude Steel Production by Country (2016–2024)';
const subTitle = 'Source: wikipedia.org';

provide('chart', [LineSeries, DataLabel, Legend]);
</script>

<style>
#container {
  height: 350px;
}
</style>
<template>
  <div id="app">
    <ejs-chart id="container" :title="title" :subTitle="subTitle" :primaryXAxis="primaryXAxis" :primaryYAxis="primaryYAxis" :enableSmartLabels="true">
      <e-series-collection>
        <e-series :dataSource="vietnam" type="Line" xName="x" yName="y" name="Vietnam" :width="2" :animation="animation" :marker="vietnamMarker"></e-series>
        <e-series :dataSource="indonesia" type="Line" xName="x" yName="y" name="Indonesia" :width="2" :animation="animation" :marker="indonesiaMarker"></e-series>
        <e-series :dataSource="france" type="Line" xName="x" yName="y" name="France" :width="2" :animation="animation" :marker="franceMarker"></e-series>
        <e-series :dataSource="poland" type="Line" xName="x" yName="y" name="Poland" :width="2" :animation="animation" :marker="polandMarker"></e-series>
        <e-series :dataSource="mexico" type="Line" xName="x" yName="y" name="Mexico" :width="2" :animation="animation" :marker="mexicoMarker"></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>

<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, LineSeries, DataLabel, Legend } from '@syncfusion/ej2-vue-charts';

export default {
  name: 'App',
  components: {
    'ejs-chart': ChartComponent,
    'e-series-collection': SeriesCollectionDirective,
    'e-series': SeriesDirective
  },
  data() {
    return {
      vietnam: [
        { x: 2016, y: 7.8 },
        { x: 2017, y: 10.3 },
        { x: 2018, y: 15.5 },
        { x: 2019, y: 17.5 },
        { x: 2020, y: 19.5 },
        { x: 2021, y: 23.0 },
        { x: 2022, y: 20.0 },
        { x: 2023, y: 19.0 },
        { x: 2024, y: 22.1 }
      ],
      indonesia: [
        { x: 2016, y: 4.8 },
        { x: 2017, y: 5.2 },
        { x: 2018, y: 6.2 },
        { x: 2019, y: 7.8 },
        { x: 2020, y: 9.3 },
        { x: 2021, y: 14.3 },
        { x: 2022, y: 15.6 },
        { x: 2023, y: 16.0 },
        { x: 2024, y: 17.0 }
      ],
      france: [
        { x: 2016, y: 14.6 },
        { x: 2017, y: 15.5 },
        { x: 2018, y: 15.4 },
        { x: 2019, y: 14.4 },
        { x: 2020, y: 11.6 },
        { x: 2021, y: 13.9 },
        { x: 2022, y: 12.1 },
        { x: 2023, y: 10.0 },
        { x: 2024, y: 10.8 }
      ],
      poland: [
        { x: 2016, y: 8.9 },
        { x: 2017, y: 10.3 },
        { x: 2018, y: 10.8 },
        { x: 2019, y: 9.0 },
        { x: 2020, y: 7.9 },
        { x: 2021, y: 8.5 },
        { x: 2022, y: 7.4 },
        { x: 2023, y: 6.4 },
        { x: 2024, y: 7.1 }
      ],
      mexico: [
        { x: 2016, y: 19.0 },
        { x: 2017, y: 20.0 },
        { x: 2018, y: 20.2 },
        { x: 2019, y: 18.4 },
        { x: 2020, y: 16.8 },
        { x: 2021, y: 18.5 },
        { x: 2022, y: 18.4 },
        { x: 2023, y: 16.3 },
        { x: 2024, y: 13.7 }
      ],
      primaryXAxis: {
        valueType: 'Double',
        majorGridLines: { width: 0 },
        edgeLabelPlacement: 'Shift'
      },
      primaryYAxis: {
        title: 'Volume in million metric tons',
        labelFormat: '{value}',
        lineStyle: { width: 0 },
        majorTickLines: { width: 0 },
        minorTickLines: { width: 0 }
      },
      animation: { enable: false },
      vietnamMarker: {
        visible: true,
        width: 7,
        height: 7,
        shape: 'Circle',
        isFilled: true,
        dataLabel: {
          visible: true,
          smartLabelSettings: {
            seriesOverlapAction: 'Hide'
          }
        }
      },
      indonesiaMarker: {
        visible: true,
        width: 6,
        height: 6,
        shape: 'Triangle',
        isFilled: true,
        dataLabel: {
          visible: true,
          smartLabelSettings: {
            seriesOverlapAction: 'Hide'
          }
        }
      },
      franceMarker: {
        visible: true,
        width: 7,
        height: 7,
        shape: 'Diamond',
        isFilled: true,
        dataLabel: {
          visible: true,
          smartLabelSettings: {
            seriesOverlapAction: 'Hide'
          }
        }
      },
      polandMarker: {
        visible: true,
        width: 5,
        height: 5,
        shape: 'Rectangle',
        isFilled: true,
        dataLabel: {
          visible: true,
          smartLabelSettings: {
            seriesOverlapAction: 'Hide'
          }
        }
      },
      mexicoMarker: {
        visible: true,
        width: 7,
        height: 7,
        shape: 'Pentagon',
        isFilled: true,
        dataLabel: {
          visible: true,
          smartLabelSettings: {
            seriesOverlapAction: 'Hide'
          }
        }
      },
      title: 'Annual Crude Steel Production by Country (2016–2024)',
      subTitle: 'Source: wikipedia.org'
    };
  },
  provide: {
    chart: [LineSeries, DataLabel, Legend]
  }
};
</script>

<style>
#container {
  height: 350px;
}
</style>

Customizing a specific point

Customize individual markers or labels using the pointRenderandtextRender events.

  • pointRender modifies shape, color, or border of a point.
  • textRender customizes the label text for specific points.
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis' :pointRender='pointRender' :textRender='textRender'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script setup>
import { provide } from "vue";

import { ChartComponent as EjsChart, ColumnSeries, Category, DataLabel,
  SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries
 } from "@syncfusion/ej2-vue-charts";

const seriesData = [
        { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
        { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
        { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
        { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
        { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
        { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
        ];

const primaryXAxis = {
    valueType: 'Category'
  };

const marker = {
                dataLabel: { visible: true }
            };

const title = "Alaska Weather Statistics - 2016";

provide('chart',  [ColumnSeries, Category, DataLabel]);

const pointRender = function(args) {
    if (args.point.index === 6) {
                args.fill = 'red'
    }
};

const textRender = function(args) {
    if (args.point.index === 6) {
                args.text = 'Maximum Temperature';
                args.color = 'red';
            }
};

</script>
<style>
 #container {
   height: 350px;
 }
</style>
<template>
    <div id="app">
         <ejs-chart id= "container" :title='title' :primaryXAxis='primaryXAxis' :pointRender='pointRender' :textRender='textRender'>
            <e-series-collection>
                <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='Warmest' :marker='marker'> </e-series>
            </e-series-collection>
        </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  data() {
    return {
      seriesData: [
              { x: 'Jan', y: -7.1 }, { x: 'Feb', y: -3.7 },
              { x: 'Mar', y: 2 }, { x: 'Apr', y: 6.3 },
              { x: 'May', y: 13.3 }, { x: 'Jun', y: 18.0 },
              { x: 'Jul', y: 19.8 }, { x: 'Aug', y: 18.1 },
              { x: 'Sep', y: 13.1 }, { x: 'Oct', y: 4.1 },
              { x: 'Nov', y: -3.8 }, { x: 'Dec', y: -6.8 }
              ],
        primaryXAxis: {
           valueType: 'Category'
        },
        marker:{ dataLabel: { visible: true } },
      title: "Alaska Weather Statistics - 2016"
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel]
  },
  methods: {
      pointRender: function(args) {
       if (args.point.index === 6) {
                args.fill = 'red'
        }
  },
   textRender: function(args) {
      if (args.point.index === 6) {
                args.text = 'Maximum Temperature';
                args.color = 'red';
            }
  }
  }
};
</script>
<style>
 #container {
   height: 350px;
 }
</style>

Show percentage based on each series points

Calculate and display percentage values based on each series’ total using the seriesRender and textRender events.

  • In seriesRender, compute the total of y values.
  • In textRender, calculate the percentage for each point and update the label text.
<template>
  <div class="control-section">
    <div align="center">
      <ejs-chart
        style="display: block"
        :theme="theme"
        align="center"
        id="chartcontainer"
        :title="title"
        :primaryXAxis="primaryXAxis"
        :primaryYAxis="primaryYAxis"
        :chartArea="chartArea"
        :width="width"
        :tooltip="tooltip"
        :textRender="onTextRender"
        :seriesRender="onSeriesRender"
      >
        <e-series-collection>
          <e-series
            :dataSource="seriesData"
            type="Column"
            xName="x"
            yName="y"
            name="Gold"
            width="2"
            :marker="marker"
          >
          </e-series>
          <e-series
            :dataSource="seriesData1"
            type="Column"
            xName="x"
            yName="y"
            name="Silver"
            width="2"
            :marker="marker"
          >
          </e-series>
          <e-series
            :dataSource="seriesData2"
            type="Column"
            xName="x"
            yName="y"
            name="Bronze"
            width="2"
            :marker="marker"
          >
          </e-series>
        </e-series-collection>
      </ejs-chart>
    </div>
  </div>
</template>
<style scoped>
</style>
<script setup>
import { provide } from "vue";

import { Browser } from "@syncfusion/ej2-base";
import {
  ChartComponent as EjsChart,
  ColumnSeries,
  Category,
  DataLabel,
  Tooltip,
  Legend,
  SeriesCollectionDirective as ESeriesCollection,
  SeriesDirective as ESeries,
} from "@syncfusion/ej2-vue-charts";

let total = [];

const seriesData = [
  { x: "USA", y: 46 },
  { x: "GBR", y: 27 },
  { x: "CHN", y: 26 },
];

const seriesData1 = [
  { x: "USA", y: 37 },
  { x: "GBR", y: 23 },
  { x: "CHN", y: 18 },
];

const seriesData2 = [
  { x: "USA", y: 38 },
  { x: "GBR", y: 17 },
  { x: "CHN", y: 26 },
];

//Initializing Primary X Axis
const primaryXAxis = {
  valueType: "Category",
  interval: 1,
  majorGridLines: { width: 0 },
};

const chartArea = { border: { width: 0 } };

//Initializing Primary Y Axis

const primaryYAxis = {
  majorGridLines: { width: 0 },
  majorTickLines: { width: 0 },
  lineStyle: { width: 0 },
  labelStyle: { color: "transparent" },
};

const width = Browser.isDevice ? "100%" : "60%";

const marker = {
  dataLabel: {
    visible: true,
    position: "Top",
    font: { fontWeight: "600", color: "#ffffff" },
  },
};

const tooltip = {
  enable: true,
};

const title = "Olympic Medal Counts - RIO";

provide("chart", [ColumnSeries, Legend, DataLabel, Category, Tooltip]);

const onSeriesRender = function (args) {
  for (let i = 0; i < args.data.length; i++) {
    if (!total[args.data[i].x]) total[args.data[i].x] = 0;
    total[args.data[i].x] += parseInt(args.data[i].y);
  }
};

const onTextRender = function (args) {
  let percentage = (parseInt(args.text) / total[args.point.x]) * 100;
  percentage = percentage % 1 === 0 ? percentage : percentage.toFixed(2);
  args.text = percentage + "%";
};

</script>
<template>
  <div class="control-section">
    <div align="center">
      <ejs-chart
        style="display: block"
        :theme="theme"
        align="center"
        id="chartcontainer"
        :title="title"
        :primaryXAxis="primaryXAxis"
        :primaryYAxis="primaryYAxis"
        :chartArea="chartArea"
        :width="width"
        :tooltip="tooltip"
        :textRender="onTextRender"
        :seriesRender="onSeriesRender"
      >
        <e-series-collection>
          <e-series
            :dataSource="seriesData"
            type="Column"
            xName="x"
            yName="y"
            name="Gold"
            width="2"
            :marker="marker"
          >
          </e-series>
          <e-series
            :dataSource="seriesData1"
            type="Column"
            xName="x"
            yName="y"
            name="Silver"
            width="2"
            :marker="marker"
          >
          </e-series>
          <e-series
            :dataSource="seriesData2"
            type="Column"
            xName="x"
            yName="y"
            name="Bronze"
            width="2"
            :marker="marker"
          >
          </e-series>
        </e-series-collection>
      </ejs-chart>
    </div>
  </div>
</template>
<style scoped>
</style>
<script>

import { Browser } from "@syncfusion/ej2-base";
import {
  ChartComponent,
  ColumnSeries,
  Category,
  DataLabel,
  Tooltip,
  Legend,
  SeriesCollectionDirective,
  SeriesDirective,
} from "@syncfusion/ej2-vue-charts";

let total = [];

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,
},

  data: function () {
    return {
      seriesData: [
        { x: "USA", y: 46 },
        { x: "GBR", y: 27 },
        { x: "CHN", y: 26 },
      ],

      seriesData1: [
        { x: "USA", y: 37 },
        { x: "GBR", y: 23 },
        { x: "CHN", y: 18 },
      ],

      seriesData2: [
        { x: "USA", y: 38 },
        { x: "GBR", y: 17 },
        { x: "CHN", y: 26 },
      ],

      //Initializing Primary X Axis
      primaryXAxis: {
        valueType: "Category",
        interval: 1,
        majorGridLines: { width: 0 },
      },
      chartArea: { border: { width: 0 } },

      //Initializing Primary Y Axis
      primaryYAxis: {
        majorGridLines: { width: 0 },
        majorTickLines: { width: 0 },
        lineStyle: { width: 0 },
        labelStyle: { color: "transparent" },
      },

      width: Browser.isDevice ? "100%" : "60%",
      marker: {
        dataLabel: {
          visible: true,
          position: "Top",
          font: { fontWeight: "600", color: "#ffffff" },
        },
      },

      tooltip: {
        enable: true,
      },

      title: "Olympic Medal Counts - RIO",
    };
  },
  provide: {
    chart: [ColumnSeries, Legend, DataLabel, Category, Tooltip],
  },
  methods: {
    onSeriesRender: function (args) {
      for (let i = 0; i < args.data.length; i++) {
        if (!total[args.data[i].x]) total[args.data[i].x] = 0;
        total[args.data[i].x] += parseInt(args.data[i].y);
      }
    },
    onTextRender: function (args) {
      let percentage = (parseInt(args.text) / total[args.point.x]) * 100;
      percentage = percentage % 1 === 0 ? percentage : percentage.toFixed(2);
      args.text = percentage + "%";
    },
  },
};
</script>

Last value label in Vue Charts component

The lastValueLabel feature highlights the final data point in a series, making the latest trend or value easy to identify.

Enable last value label

Enable the label by setting the enable property inside the lastValueLabel configuration.

<template>
  <div id="app">
    <ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis' :width='width'
      :tooltip='tooltip'>
      <e-series-collection>
        <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='series1' :marker='marker'
          :lastValueLabel='lastValueLabel'></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>
<script setup>
import { provide } from "vue";

import {
  ChartComponent as EjsChart, ColumnSeries, Category, DataLabel, Legend, LastValueLabel, Tooltip
  SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries
} from "@syncfusion/ej2-vue-charts";

const seriesData = [
  { x: 2005, y: 28 }, { x: 2006, y: 25 }, { x: 2007, y: 26 },
  { x: 2008, y: 27 }, { x: 2009, y: 32 }, { x: 2010, y: 35 },
  { x: 2011, y: 40 }
];

const primaryXAxis = {
  title: 'Year',
  interval: 1
};

const primaryYAxis = {
  title: 'Efficiency',
  labelFormat: '{value}%'
};

const marker = {
  visible: false,
  dataLabel: { visible: true }
};

const lastValueLabel = { enable: true };
const tooltip = { enable: true };
const width = '90%';
const title = "Efficiency of oil-fired power production";

provide('chart', [LineSeries, Category, DataLabel, LastValueLabel]);

</script>
<style>
#container {
  height: 350px;
}
</style>
<template>
    <div id="app">
         <ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis' :width='width'
      :tooltip='tooltip'>
      <e-series-collection>
        <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='series1' :marker='marker'
          :lastValueLabel='lastValueLabel'></e-series>
      </e-series-collection>
    </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, LastValueLabel, Legend, Tooltip, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  data() {
    return {
      seriesData: [
        { x: 2005, y: 28 }, { x: 2006, y: 25 }, { x: 2007, y: 26 },
        { x: 2008, y: 27 }, { x: 2009, y: 32 }, { x: 2010, y: 35 },
        { x: 2011, y: 40 }
      ],
      primaryXAxis: {
        title: 'Year',
        interval: 1
      },
      primaryYAxis: {
        title: 'Efficiency',
        labelFormat: '{value}%'
      },
      marker: {
        visible: false,
        dataLabel: { visible: true }
      },
      lastValueLabel: { enable: true },
      tooltip: { enable: true },
      width: '90%',
      title: 'Efficiency of oil-fired power production'
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel, LastValueLabel, Legend, Tooltip]
  }
};
</script>
<style>
 #container {
   height: 350px;
 }
</style>

Note: To use the last value label feature, inject the LastValueLabel module into the provide.

Customization

Customize the appearance using properties such as font, background, border, dashArray, lineWidth, lineColor, rx, and ry.

<template>
  <div id="app">
    <ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis' :width='width'
      :tooltip='tooltip'>
      <e-series-collection>
        <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='series1' :marker='marker'
          :lastValueLabel='lastValueLabel'></e-series>
      </e-series-collection>
    </ejs-chart>
  </div>
</template>
<script setup>
import { provide } from "vue";

import {
  ChartComponent as EjsChart, ColumnSeries, Category, DataLabel, Legend, LastValueLabel, Tooltip
  SeriesCollectionDirective as ESeriesCollection, SeriesDirective as ESeries
} from "@syncfusion/ej2-vue-charts";

const seriesData = [
  { x: 2005, y: 28 }, { x: 2006, y: 25 }, { x: 2007, y: 26 },
  { x: 2008, y: 27 }, { x: 2009, y: 32 }, { x: 2010, y: 35 },
  { x: 2011, y: 40 }
];

const primaryXAxis = {
  title: 'Year',
  interval: 1
};

const primaryYAxis = {
  title: 'Efficiency',
  labelFormat: '{value}%'
};

const marker = {
  visible: false,
  dataLabel: { visible: true }
};

const lastValueLabel = { enable: true, background: "blue", lineColor: "red", lineWidth: 2, dashArray: "5,5", rx: 10, ry: 10, border: { width: 2, color: "red" }, font: { color: "white", size: "12px", fontWeight: "bold" } };
const tooltip = { enable: true };
const width = '90%';
const title = "Efficiency of oil-fired power production";

provide('chart', [LineSeries, Category, DataLabel, LastValueLabel]);

</script>
<style>
#container {
  height: 350px;
}
</style>
<template>
    <div id="app">
         <ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis' :width='width'
      :tooltip='tooltip'>
      <e-series-collection>
        <e-series :dataSource='seriesData' type='Column' xName='x' yName='y' name='series1' :marker='marker'
          :lastValueLabel='lastValueLabel'></e-series>
      </e-series-collection>
    </ejs-chart>
    </div>
</template>
<script>

import { ChartComponent, ColumnSeries, Category, DataLabel, LastValueLabel, Legend, Tooltip, SeriesCollectionDirective, SeriesDirective } from "@syncfusion/ej2-vue-charts";

export default {
name: "App",
components: {
"ejs-chart":ChartComponent,
"e-series-collection":SeriesCollectionDirective,
"e-series":SeriesDirective,

},

  data() {
    return {
      seriesData: [
        { x: 2005, y: 28 }, { x: 2006, y: 25 }, { x: 2007, y: 26 },
        { x: 2008, y: 27 }, { x: 2009, y: 32 }, { x: 2010, y: 35 },
        { x: 2011, y: 40 }
      ],
      primaryXAxis: {
        title: 'Year',
        interval: 1
      },
      primaryYAxis: {
        title: 'Efficiency',
        labelFormat: '{value}%'
      },
      marker: {
        visible: false,
        dataLabel: { visible: true }
      },
      lastValueLabel: { enable: true, background: "blue", lineColor: "red", lineWidth: 2, dashArray: "5,5", rx: 10, ry: 10, border: { width: 2, color: "red" }, font: { color: "white", size: "12px", fontWeight: "bold" } },
      tooltip: { enable: true },
      width: '90%',
      title: 'Efficiency of oil-fired power production'
    };
  },
  provide: {
    chart: [ColumnSeries, Category, DataLabel, LastValueLabel, Legend, Tooltip]
  }
};
</script>
<style>
 #container {
   height: 350px;
 }
</style>