Spline area Chart in Vue Component
15 Dec 202424 minutes to read
Spline area
To render a spline area series in your chart, you need to follow a few steps to configure it correctly. Here’s a concise guide on how to do this:
-
Set the series type: Define the series
type
asSplineArea
in your chart configuration. This indicates that the data should be represented as a spline area chart, where data points are connected by smooth, curved lines (splines) instead of straight lines. -
Inject the SplineAreaSeries module: Use the
provide: { chart: [SplineAreaSeries]}
method to inject theSplineAreaSeries
module into your chart. This step is essential, as it ensures that the necessary functionalities for rendering spline area series are available in your chart.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y'> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
provide('chart', [SplineAreaSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012'
};
},
provide: {
chart: [SplineAreaSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Binding data with series
You can bind data to the chart using the dataSource
property within the series configuration. This allows you to connect a JSON dataset or remote data to your chart. To display the data correctly, map the fields from the data to the chart series xName
and yName
properties.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y'> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
provide('chart', [SplineAreaSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012'
};
},
provide: {
chart: [SplineAreaSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Series customization
The following properties can be used to customize the spline area
series.
Fill
The fill property determines the color applied to the series.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' fill='blue'> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
provide('chart', [SplineAreaSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' fill='blue'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012'
};
},
provide: {
chart: [SplineAreaSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
The fill property can be used to apply a gradient color to the spline area series. By configuring this property with gradient values, you can create a visually appealing effect in which the color transitions smoothly from one shade to another.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' fill='url(#gradient)'> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
provide('chart', [SplineAreaSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' fill='url(#gradient)'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012'
};
},
provide: {
chart: [SplineAreaSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Opacity
The opacity property specifies the transparency level of the fill. Adjusting this property allows you to control how opaque or transparent the fill color of the series appears.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' opacity=0.5> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
provide('chart', [SplineAreaSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' opacity=0.5> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012'
};
},
provide: {
chart: [SplineAreaSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Border
Use the border
property to customize the width, color and dash array of the series border.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' dashArray='5,5' :border='border'> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
const border = {
width: 2,
color: '#FFA500',
dashArray: "5,5"
};
provide('chart', [SplineAreaSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' dashArray='5,5' :border='border'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012',
border: {
width: 2,
color: '#FFA500',
dashArray: "5,5"
}
};
},
provide: {
chart: [SplineAreaSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Empty points
Data points with null
or undefined
values are considered empty. Empty data points are ignored and not plotted on the chart.
Mode
Use the mode
property to define how empty or missing data points are handled in the series. The default mode for empty points is Gap
.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' :emptyPointSettings='emptyPointSettings'> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: null },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: undefined },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
const emptyPointSettings = {
mode: 'Average'
};
provide('chart', [SplineAreaSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' :emptyPointSettings='emptyPointSettings'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: null },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: undefined },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012',
emptyPointSettings: {
mode: 'Average'
}
};
},
provide: {
chart: [SplineAreaSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Fill
Use the fill
property to customize the fill color of empty points in the series.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' :marker='marker' :emptyPointSettings='emptyPointSettings'> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: null },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: undefined },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
const emptyPointSettings = {
mode: 'Average',
fill: 'red'
};
const marker = {
visible: true,
width: 7,
height: 7,
isFilled: true
};
provide('chart', [SplineAreaSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' :marker='marker' :emptyPointSettings='emptyPointSettings'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: null },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: undefined },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012',
emptyPointSettings: {
mode: 'Average',
fill: 'red'
},
marker: {
visible: true,
width: 7,
height: 7,
isFilled: true
}
};
},
provide: {
chart: [SplineAreaSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Border
Use the border
property to customize the width and color of the border for empty points.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' :marker='marker' :emptyPointSettings='emptyPointSettings'> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: null },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: undefined },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
const emptyPointSettings = {
mode: 'Average',
fill: 'red',
border: {
width: 2,
color: 'green'
}
};
const marker = {
visible: true,
width: 7,
height: 7,
isFilled: true
};
provide('chart', [SplineAreaSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' :marker='marker' :emptyPointSettings='emptyPointSettings'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: null },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: undefined },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012',
emptyPointSettings: {
mode: 'Average',
fill: 'red',
border: {
width: 2,
color: 'green'
}
},
marker: {
visible: true,
width: 7,
height: 7,
isFilled: true
}
};
},
provide: {
chart: [SplineAreaSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Events
Series render
The seriesRender
event allows you to customize series properties, such as data, fill, and name, before they are rendered on the chart.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis' :seriesRender='seriesRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y'> </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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
provide('chart', [SplineAreaSeries, Category]);
const seriesRender = function (args) {
args.fill = '#ff6347';
};
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis' :seriesRender='seriesRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012'
};
},
provide: {
chart: [SplineAreaSeries, Category]
},
methods: {
seriesRender: function (args) {
args.fill = '#ff6347';
}
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Point render
The pointRender
event allows you to customize each data point before it is rendered on the chart.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis' :pointRender='pointRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' :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, SplineAreaSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Jan', y: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
];
const primaryXAxis = {
valueType: 'Category',
title: 'Month'
};
const primaryYAxis = {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
};
const title = 'Climate Graph-2012';
const marker = {
visible: true,
isFilled: true,
width: 7,
height: 7
};
provide('chart', [SplineAreaSeries, Category]);
const pointRender = function (args) {
if (args.point.y < 10) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis' :pointRender='pointRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='SplineArea' xName='x' yName='y' :marker='marker'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, SplineAreaSeries, Category } 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: -1 },
{ x: 'Feb', y: -1 },
{ x: 'Mar', y: 2 },
{ x: 'Apr', y: 8 },
{ x: 'May', y: 13 },
{ x: 'Jun', y: 18 },
{ x: 'Jul', y: 21 },
{ x: 'Aug', y: 20 },
{ x: 'Sep', y: 16 },
{ x: 'Oct', y: 10 },
{ x: 'Nov', y: 4 },
{ x: 'Dec', y: 0 }
],
primaryXAxis: {
valueType: 'Category',
title: 'Month'
},
primaryYAxis: {
minimum: -5,
maximum: 30,
interval: 5,
title: 'Temperature in Celsius',
labelFormat: '{value}°C'
},
title: 'Climate Graph-2012',
marker: {
visible: true,
isFilled: true,
width: 7,
height: 7
}
};
},
provide: {
chart: [SplineAreaSeries, Category]
},
methods: {
pointRender: function (args) {
if (args.point.y < 10) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
}
}
};
</script>
<style>
#container {
height: 350px;
}
</style>