The wijmo.chart.analytics module contains classes that extend the Series class to provide extra information about the data including: trend lines, moving averages, error bars, box and waterfall plots, and function plots.
Waterfall charts help in understanding the cumulative effect of sequentially introduced positive or negative values. It demonstrates how the starting position either increases or decreases through a series of changes. The Waterfall chart is also known as a "flying bricks" chart or Mario chart due to the apparent suspension of columns in mid-air.
To create a Waterfall chart, follow these steps:
Example:
import * as chart from '@grapecity/wijmo.chart';
import * as analytics from '@grapecity/wijmo.chart.analytics';
// create Waterfall series for 'sales' and add it to the chart
var sales = new analytics.Waterfall();
sales.name = 'Sales';
sales.binding = 'sales';
sales.styles = {
start: { fill: 'blue', stroke: 'blue' },
total: { fill: 'yellow', stroke: 'yellow' },
falling: { fill: 'red', stroke: 'red' },
rising: { fill: 'green', stroke: 'green' }
};
myChart.series.push(sales);
In addition to customizing the style, the Waterfall class includes several other options you can configure.
The following styles are supported:
Complete Example:
import * as chart from '@grapecity/wijmo.chart';
import * as analytics from '@grapecity/wijmo.chart.analytics';
// create Waterfall series with all options
var waterfall = new analytics.Waterfall({
relativeData: true,
connectorLines: true,
showTotal: true,
start: 1000,
showIntermediateTotal: true,
intermediateTotalPositions: [3, 6, 9, 12],
intermediateTotalLabels: ['Q1', 'Q2', 'Q3', 'Q4'],
name: 'Increase,Decrease,Total',
styles: {
connectorLines: {
stroke: '#333',
strokeWidth: 3
},
start: {
fill: '#7dc7ed'
},
falling: {
fill: '#dd2714',
stroke: '#a52714'
},
rising: {
fill: '#0f9d58',
stroke: '#0f9d58'
},
intermediateTotal: {
fill: '#7dc7ed'
},
total: {
fill: '#7dc7ed'
}
}
});
myChart.series.push(waterfall);
The Waterfall series is supported like any series in FlexChart. You can choose whether or not the waterfall series displays an entry in the legend by setting the visibility property to one of the following:
Visible: The series is visible on the plot and in the legend.
Plot: The series is visible only on the plot.
Legend: The series is visible only in the legend.
Hidden: The series is hidden.
The legend text is set using the name property of the waterfall series.