Spread WinRT Documentation > Developer's Guide > Working with Charts > Understanding Charts > Data Series |
A series is a collection of data points that are displayed in the plot area and represents the data trends for one group of data values. A data point can have a marker and a label.
Formulas can be used to add a chart by using data in the sheet. The DataFormula property is used for the data points in each series. The NameFormula property is used for the name of each series. The ItemsFormula property is used for the category name or axis title. The Formula property is for the entire data range for the chart.
You can add values to a chart with a data series or you can add values to the control and then add the chart. You can also set marker properties such as MarkerType, MarkerSize, and DataMarkerStyle.
The following example uses a data series to add values to a chart.
CS |
Copy Code |
---|---|
GrapeCity.Xaml.SpreadSheet.Data.SpreadChart chart = new GrapeCity.Xaml.SpreadSheet.Data.SpreadChart("Chart", GrapeCity.Xaml.SpreadSheet.Data.SpreadChartType.ColumnStacked, 0, 0, 200, 200); GrapeCity.Xaml.SpreadSheet.Data.SpreadDataSeries ds = new GrapeCity.Xaml.SpreadSheet.Data.SpreadDataSeries(); ds.Values.Add(4); ds.Values.Add(-7); ds.Values.Add(-6); ds.Values.Add(10); ds.Values.Add(4); ds.Fill = new SolidColorBrush(Windows.UI.Colors.Green); ds.Stroke = new SolidColorBrush(Windows.UI.Colors.Blue); ds.StrokeDashType = GrapeCity.Xaml.SpreadSheet.Data.StrokeDashType.Dot; ds.StrokeThickness = 2; ds.InvertIfNegative = true; ds.NegativeFill = new SolidColorBrush(Windows.UI.Colors.Red); chart.DataSeries.Add(ds); gcSpreadSheet1.ActiveSheet.Charts.Add(chart); |
VB |
Copy Code |
---|---|
Dim chart As New GrapeCity.Xaml.SpreadSheet.Data.SpreadChart("Chart", GrapeCity.Xaml.SpreadSheet.Data.SpreadChartType.ColumnStacked, 0, 0, 200, 200) Dim ds As New GrapeCity.Xaml.SpreadSheet.Data.SpreadDataSeries() ds.Values.Add(4) ds.Values.Add(-7) ds.Values.Add(-6) ds.Values.Add(10) ds.Values.Add(4) ds.Fill = New SolidColorBrush(Windows.UI.Colors.Green) ds.Stroke = New SolidColorBrush(Windows.UI.Colors.Blue) ds.StrokeDashType = GrapeCity.Xaml.SpreadSheet.Data.StrokeDashType.Dot ds.StrokeThickness = 2 ds.InvertIfNegative = True ds.NegativeFill = New SolidColorBrush(Windows.UI.Colors.Red) chart.DataSeries.Add(ds) GcSpreadSheet1.ActiveSheet.Charts.Add(chart) |