Blogs
Implementing a Fan Chart

Summarize this blog post with:

Fan chart series draws a line for the given actual y-values and draws colored bands over certain ranges to illustrate the uncertainty in the projections. You can find more details from this wiki link - https://en.wikipedia.org/wiki/Fan_chart_(time_series). By using Syncfusion’s multiple range area chart type, you can plot a Fan Chart series.

Below table shows data collection for a Fan chart:

DateTime(X-value)Actual ValueProjected Min ValueVar1Var2Var3Var4Projected Max Value
July 201124------
Oct 201132------
Jan 201216------
Apr 201245------
July 201230------
Oct 2012-51020506065
Jan 2013-101530607075
Apr 2013-202550708085
July 2013-253060809095

 

Actual values are available till July 2012 and after that the collection has projected values from Min to Max with four variant values. To render this data as a Fan chart series, we will copy the actual values to projected values till July 2012. Then use three range charts having the Min & Max, Var1 & Var4, Var3 & Var2 as DataSources. Below find the XAML for WPF implementation:

 

<!--RangeArea series1-->
<syncfusion:chartseries type="RangeArea" datasource="{Binding}" bindingpathx="Date" bindingpathsy="ProjectedMin, ProjectedMax" isindexed="False" showemptypoints="False">
    <syncfusion:chartseries.interior>
        <solidcolorbrush color="Red" opacity="0.2"></solidcolorbrush>
    </syncfusion:chartseries.interior>
    <syncfusion:chartseries.stroke>
        <solidcolorbrush color="Red" opacity="0.2"></solidcolorbrush>
    </syncfusion:chartseries.stroke>
</syncfusion:chartseries>            
<!--RangeArea series2-->
<syncfusion:chartseries type="RangeArea" datasource="{Binding}" bindingpathx="Date" bindingpathsy="Var1, Var4" isindexed="False" showemptypoints="False">
    <syncfusion:chartseries.interior>
        <solidcolorbrush color="Red" opacity="0.4"></solidcolorbrush>
    </syncfusion:chartseries.interior>
    <syncfusion:chartseries.stroke>
        <solidcolorbrush color="Red" opacity="0.4"></solidcolorbrush>
    </syncfusion:chartseries.stroke>
</syncfusion:chartseries>               
 
<!--RangeArea series3-->
<syncfusion:chartseries type="RangeArea" datasource="{Binding}" bindingpathx="Date" bindingpathsy="Var2,Var3" isindexed="False" showemptypoints="False">
    <syncfusion:chartseries.interior>
        <solidcolorbrush color="Red" opacity="0.6"></solidcolorbrush>
    </syncfusion:chartseries.interior>
    <syncfusion:chartseries.stroke>
        <solidcolorbrush color="Red" opacity="0.6"></solidcolorbrush>
    </syncfusion:chartseries.stroke>
</syncfusion:chartseries>
FanChart_wpf

WPF sample - FanChart_WPF.zip

The same approach can be used to render Fan Chart series for ASP.NET, ASP.NET MVC and Windows Forms platforms. Below find samples:

ASP.NET, ASP.NET MVC and Windows Forms samples – FanChartSamples.zip

Frame 2
App Center
Frame 4

Meet the Author

Jay Natarajan

Seasoned technology leader at Syncfusion since 2003, with a proven track record in support, development, product management, and team leadership. Currently serving as Pre-Sales Manager for Bold BI and Bold Reports, leveraging deep product expertise and global client engagement experience to drive customer success.