Seeing the current trends and user demands, ComponentOne has recently added a Chart control in Spread for Silverlight and WPF. This feature was in great demand because the Spread control has always been a replica of Microsoft Excel and Microsoft Excel has always had charts. It takes a lot of effort for analysis of data in table format. Hence, Data Visualization can be easily done using the Chart control. Adding a Chart control to ComponentOne Spread for Silverlight/ WPF is very simple and easy. The Chart control is added to a SpreadSheet as a floating object and not as a part of Cell/ Row/ Column objects. So after adding the Chart control to a SpreadSheet you can place it anywhere in the SpreadSheet just with a drag-and-drop operation with the mouse at run time.
Add Chart to SpreadSheet
public void FillData(GrapeCity.Windows.SpreadSheet.UI.GcSpreadSheet gcSpreadSheet1)
{
gcSpreadSheet1.Sheets[0].Cells[0, 1].Value = "Laptops";
gcSpreadSheet1.Sheets[0].Cells[0, 2].Value = "Mobiles";
gcSpreadSheet1.Sheets[0].Cells[0, 3].Value = "Tablets";
gcSpreadSheet1.Sheets[0].Cells[1, 0].Value = "Jan";
gcSpreadSheet1.Sheets[0].Cells[2, 0].Value = "Feb";
gcSpreadSheet1.Sheets[0].Cells[3, 0].Value = "Mar";
gcSpreadSheet1.Sheets[0].Cells[4, 0].Value = "Apr";
gcSpreadSheet1.Sheets[0].Cells[5, 0].Value = "May";
gcSpreadSheet1.Sheets[0].Cells[6, 0].Value = "Jun";
gcSpreadSheet1.Sheets[0].Cells[1, 1].Value = 1;
gcSpreadSheet1.Sheets[0].Cells[2, 1].Value = 2;
gcSpreadSheet1.Sheets[0].Cells[3, 1].Value = 3;
gcSpreadSheet1.Sheets[0].Cells[4, 1].Value = 4;
gcSpreadSheet1.Sheets[0].Cells[5, 1].Value = 5;
gcSpreadSheet1.Sheets[0].Cells[6, 1].Value = 6;
gcSpreadSheet1.Sheets[0].Cells[1, 2].Value = 7;
gcSpreadSheet1.Sheets[0].Cells[2, 2].Value = 8;
gcSpreadSheet1.Sheets[0].Cells[3, 2].Value = 9;
gcSpreadSheet1.Sheets[0].Cells[4, 2].Value = 10;
gcSpreadSheet1.Sheets[0].Cells[5, 2].Value = 11;
gcSpreadSheet1.Sheets[0].Cells[6, 2].Value = 12;
gcSpreadSheet1.Sheets[0].Cells[1, 3].Value = 13;
gcSpreadSheet1.Sheets[0].Cells[2, 3].Value = 14;
gcSpreadSheet1.Sheets[0].Cells[3, 3].Value = 15;
gcSpreadSheet1.Sheets[0].Cells[4, 3].Value = 16;
gcSpreadSheet1.Sheets[0].Cells[5, 3].Value = 17;
gcSpreadSheet1.Sheets[0].Cells[6, 3].Value = 18;
}
private void btn\_AddChart\_Click(object sender, RoutedEventArgs e)
{
gcSpreadSheet1.Sheets[0].AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.ColumnStacked, "Sheet1!$A$1:$D$7", 0, 140, 400, 200);
}
The added chart is basically an object of the SpreadChart class. This class is found under the GrapeCity.Windows.SpreadSheet.Data assembly. Spread supports more than thirty ChartTypes, a list of which can be find here. Here is the sample application that you can explore for yourself. Download Sample