wijmo.chart.analyticsモジュールには、Seriesクラスを拡張して、近似曲線、移動平均、誤差範囲、箱プロット、ウォータフォールプロット、関数プロットなど、データに関する追加情報を提供するクラスが含まれます。
ウォータフォールチャートは、順次取り込まれる正または負の値の累積的な影響を把握するために役立ちます。開始位置からの増加または減少の様子を一連の変化量によって表示します。ウォータフォールチャートは、列が宙に浮いているように見えることから、「空飛ぶレンガ」チャートまたはマリオチャートとも呼ばれます。
ウォータフォールチャートを作成するには、次の手順に従います。
例:
import * as chart from '@mescius/wijmo.chart';
import * as analytics from '@mescius/wijmo.chart.analytics';
// 「売上」のWaterfall系列を作成してチャートに追加します
var sales = new analytics.Waterfall();
sales.name = '売上';
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);
Waterfallクラスには、スタイルのカスタマイズのほかにも設定できるオプションがあります。
以下のスタイルがサポートされています。
完全な例:
import * as chart from '@mescius/wijmo.chart';
import * as analytics from '@mescius/wijmo.chart.analytics';
// すべてのオプションを使用してウォータフォール系列を作成します
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: '増加,減少,合計',
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);
Waterfall系列は、FlexChartの系列の1つとしてサポートされます。visibilityプロパティを次のいずれかに設定して、このウォータフォール系列を凡例に表示するかどうかを選択できます。
凡例テキストは、ウォータフォール系列のnameプロパティを使用して設定されます。