- Waterfall chart
- Binding data with series
- Series customization
- Empty points
- Corner radius
- Events
- See also
Contact Support
Waterfall Chart in Vue Component
7 Apr 202524 minutes to read
Waterfall chart
To render a waterfall
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
asWaterfall
in your chart configuration. This indicates that the data should be represented as a waterfall chart, which helps illustrate the cumulative effect of sequentially introduced positive and negative values. -
Inject the WaterfallSeries module: Use the
provide: { chart: [WaterfallSeries]}
method to inject theWaterfallSeries
module into your chart. This step is essential, as it ensures that the necessary functionalities for rendering waterfall series are available in your chart. -
Configure intermediate and cumulative sums: Use the
intermediateSumIndexes
property property to represent intermediate sum values, and thesumIndexes
property to represent cumulative sum values.
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </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, WaterfallSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const primaryXAxis = {
valueType: 'Category'
};
const sum = [8];
const intermediate = [4];
provide('chart', [WaterfallSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, 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: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
sum: [8],
intermediate: [4]
};
},
provide: {
chart: [WaterfallSeries, 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" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </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, WaterfallSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const primaryXAxis = {
valueType: 'Category'
};
const sum = [8];
const intermediate = [4];
provide('chart', [WaterfallSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, 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: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
sum: [8],
intermediate: [4]
};
},
provide: {
chart: [WaterfallSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Series customization
In waterfall charts, you can customize the appearance of different types of data changes using specific properties. The negativeFillColor
property is used to specify the color for negative changes, which helps visually distinguish decreases in the data. Similarly, the summaryFillColor
property is used to define the color for summary changes. By default, the negativeFillColor
is set to green, indicating decreases, while the summaryFillColor
is set to black, marking summary or total values.
<template>
<div id="app">
<ejs-chart id="container" :title='title' :primaryXAxis='primaryXAxis' :primaryYAxis='primaryYAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' summaryFillColor='black' negativeFillColor='green'
:connector='connector' :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, WaterfallSeries, Category, DataLabel } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const primaryXAxis = {
valueType: 'Category'
};
const primaryYAxis = {
labelFormat: '${value}M'
};
const sum = [8];
const intermediate = [4];
const connector = {
color: 'blue',
width: 1.5
};
const marker = {
dataLabel: {
visible: true,
position: 'Outer',
font: { size: '11px' }
}
};
const title = 'Company Revenue and Profit';
provide('chart', [WaterfallSeries, Category, DataLabel]);
</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='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' summaryFillColor='black' negativeFillColor='green'
:connector='connector' :marker='marker'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, Category, DataLabel } from "@syncfusion/ej2-vue-charts";
export default {
name: "App",
components: {
'ejs-chart': ChartComponent,
'e-series-collection': SeriesCollectionDirective,
'e-series': SeriesDirective
},
data() {
return {
seriesData: [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
primaryYAxis: {
labelFormat: '${value}M'
},
sum: [8],
intermediate: [4],
connector: { color: 'blue', width: 1.5 },
marker: {
dataLabel: {
visible: true,
position: 'Outer',
font: { size: '11px' }
}
},
title: 'Company Revenue and Profit'
};
},
provide: {
chart: [WaterfallSeries, Category, DataLabel]
}
};
</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" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' :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, WaterfallSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: null },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const primaryXAxis = {
valueType: 'Category'
};
const sum = [8];
const intermediate = [4];
const emptyPointSettings = {
mode: 'Average'
};
provide('chart', [WaterfallSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' :emptyPointSettings='emptyPointSettings'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, 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: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: null },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
sum: [8],
intermediate: [4],
emptyPointSettings: {
mode: 'Average'
}
};
},
provide: {
chart: [WaterfallSeries, 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" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' :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, WaterfallSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: null },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const primaryXAxis = {
valueType: 'Category'
};
const sum = [8];
const intermediate = [4];
const emptyPointSettings = {
mode: 'Average',
fill: 'red'
};
provide('chart', [WaterfallSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' :emptyPointSettings='emptyPointSettings'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, 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: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: null },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
sum: [8],
intermediate: [4],
emptyPointSettings: {
mode: 'Average',
fill: 'red'
}
};
},
provide: {
chart: [WaterfallSeries, 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" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' :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, WaterfallSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: null },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const primaryXAxis = {
valueType: 'Category'
};
const sum = [8];
const intermediate = [4];
const emptyPointSettings = {
mode: 'Average',
fill: 'red',
border: { width: 2, color: 'green' }
};
provide('chart', [WaterfallSeries, Category]);
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' :emptyPointSettings='emptyPointSettings'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, 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: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: null },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
sum: [8],
intermediate: [4],
emptyPointSettings: {
mode: 'Average',
fill: 'red',
border: { width: 2, color: 'green' }
}
};
},
provide: {
chart: [WaterfallSeries, Category]
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Corner radius
The cornerRadius
property in the chart series is used to customize the corner radius for bar series. This allows you to create bars with rounded corners, giving your chart a more polished appearance. You can customize each corner of the bars using the topLeft, topRight, bottomLeft, and bottomRight properties.
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis' :pointRender='pointRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' :cornerRadius = 'cornerRadius'> </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, WaterfallSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const cornerRadius = { topRight: 10, topLeft: 10 };
const primaryXAxis = {
valueType: 'Category'
};
const sum = [8];
const intermediate = [4];
provide('chart', [WaterfallSeries, Category]);
const pointRender= function (args) {
if (args.point.index % 2 !== 0) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis' :pointRender='pointRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum' :cornerRadius = 'cornerRadius'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, 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: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
cornerRadius: { topRight: 10, topLeft: 10 },
sum: [8],
intermediate: [4]
};
},
provide: {
chart: [WaterfallSeries, Category]
},
methods: {
pointRender: function (args) {
if (args.point.index % 2 !== 0) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
}
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
Point corner radius
We can customize the corner radius for individual points in the chart series using the pointRender
event by setting the cornerRadius
property in its event argument.
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis' :pointRender='pointRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </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, WaterfallSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const primaryXAxis = {
valueType: 'Category'
};
const sum = [8];
const intermediate = [4];
provide('chart', [WaterfallSeries, Category]);
const pointRender= function (args) {
if (args.point.index === 0) {
args.cornerRadius = { topLeft: 10, bottomLeft: 0, topRight: 10, bottomRight: 0 };
}
if (args.point.index === 3) {
args.cornerRadius = { topLeft: 10, bottomLeft: 0, topRight: 10, bottomRight: 0 };
}
if (args.point.index === 4) {
args.cornerRadius = { topLeft: 10, bottomLeft: 0, topRight: 10, bottomRight: 0 };
}
if (args.point.index === 6) {
args.cornerRadius = { topLeft: 10, bottomLeft: 0, topRight: 10, bottomRight: 0 };
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis' :pointRender='pointRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, 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: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
sum: [8],
intermediate: [4]
};
},
provide: {
chart: [WaterfallSeries, Category]
},
methods: {
pointRender: function (args) {
if (args.point.index === 0) {
args.cornerRadius = { topLeft: 10, bottomLeft: 0, topRight: 10, bottomRight: 0 };
}
if (args.point.index === 3) {
args.cornerRadius = { topLeft: 10, bottomLeft: 0, topRight: 10, bottomRight: 0 };
}
if (args.point.index === 4) {
args.cornerRadius = { topLeft: 10, bottomLeft: 0, topRight: 10, bottomRight: 0 };
}
if (args.point.index === 6) {
args.cornerRadius = { topLeft: 10, bottomLeft: 0, topRight: 10, bottomRight: 0 };
}
}
}
};
</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" :primaryXAxis='primaryXAxis' :seriesRender='seriesRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </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, WaterfallSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const primaryXAxis = {
valueType: 'Category'
};
const sum = [8];
const intermediate = [4];
provide('chart', [WaterfallSeries, Category]);
const seriesRender = function (args) {
args.fill = '#ff6347';
args.series.negativeFillColor = '#ff6347';
args.series.summaryFillColor = '#ff6347';
};
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis' :seriesRender='seriesRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, 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: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
sum: [8],
intermediate: [4]
};
},
provide: {
chart: [WaterfallSeries, Category]
},
methods: {
seriesRender: function (args) {
args.fill = '#ff6347';
args.series.negativeFillColor = '#ff6347';
args.series.summaryFillColor = '#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" :primaryXAxis='primaryXAxis' :pointRender='pointRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </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, WaterfallSeries, Category } from "@syncfusion/ej2-vue-charts";
const seriesData = [
{ x: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
];
const primaryXAxis = {
valueType: 'Category'
};
const sum = [8];
const intermediate = [4];
provide('chart', [WaterfallSeries, Category]);
const pointRender= function (args) {
if (args.point.index % 2 !== 0) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
};
</script>
<style>
#container {
height: 350px;
}
</style>
<template>
<div id="app">
<ejs-chart id="container" :primaryXAxis='primaryXAxis' :pointRender='pointRender'>
<e-series-collection>
<e-series :dataSource='seriesData' type='Waterfall' xName='x' yName='y' :intermediateSumIndexes='intermediate' :sumIndexes='sum'> </e-series>
</e-series-collection>
</ejs-chart>
</div>
</template>
<script>
import { ChartComponent, SeriesCollectionDirective, SeriesDirective, WaterfallSeries, 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: 'Income', y: 4711 },
{ x: 'Sales', y: -1015 },
{ x: 'Development', y: -688 },
{ x: 'Revenue', y: 1030 },
{ x: 'Balance' },
{ x: 'Administrative', y: -780 },
{ x: 'Expense', y: -361 },
{ x: 'Tax', y: -695 },
{ x: 'Net Profit' }
],
primaryXAxis: {
valueType: 'Category'
},
sum: [8],
intermediate: [4]
};
},
provide: {
chart: [WaterfallSeries, Category]
},
methods: {
pointRender: function (args) {
if (args.point.index % 2 !== 0) {
args.fill = '#ff6347';
}
else {
args.fill = '#009cb8';
}
}
}
};
</script>
<style>
#container {
height: 350px;
}
</style>