FlexChart > Understanding FlexChart > FlexChart Types > Mixed |
FlexChart allows you to create mixed charts that offer two key advantages, as follows:
The following image displays a mixed chart that combines column and line symbols chart types. The chart plots and compares sales and expenses data of four countries.
The following code sets the Column chart type for FlexChart and overrides it by setting the LineSymbols chart type for the Sales series, thereby implementing mixed charts.
FlexChart1.Series.Clear() ' Add data series Dim s1 = New Series() s1.Binding = InlineAssignHelper(s1.Name, "Sales") s1.ChartType = C1.Chart.ChartType.LineSymbols FlexChart1.Series.Add(s1) Dim s2 = New Series() s2.Binding = InlineAssignHelper(s2.Name, "Expenses") FlexChart1.Series.Add(s2) ' Set x-binding and add data to the chart FlexChart1.BindingX = "Country" FlexChart1.ChartType = C1.Chart.ChartType.Column FlexChart1.DataSource = New () {New With { Key .Country = "UK", Key .Sales = 5, Key .Expenses = 4 }, New With { Key .Country = "USA", Key .Sales = 7, Key .Expenses = 3 }, New With { Key .Country = "Germany", Key .Sales = 8, Key .Expenses = 5 }, New With { Key .Country = "Japan", Key .Sales = 12, Key .Expenses = 8 }}
flexChart1.Series.Clear(); // Add data series var s1 = new Series(); s1.Binding = s1.Name = "Sales"; s1.ChartType = C1.Chart.ChartType.LineSymbols; flexChart1.Series.Add(s1); var s2 = new Series(); s2.Binding = s2.Name = "Expenses"; flexChart1.Series.Add(s2); // Set x-binding and add data to the chart flexChart1.BindingX = "Country"; flexChart1.ChartType = C1.Chart.ChartType.Column; flexChart1.DataSource = new[] { new { Country = "UK", Sales = 5, Expenses = 4}, new { Country = "USA", Sales = 7, Expenses = 3}, new { Country = "Germany", Sales = 8, Expenses = 5}, new { Country = "Japan", Sales = 12, Expenses = 8}, };