Spread WPF Documentation
Markers and Points
Spread WPF Documentation > Developer's Guide > Customizing the Appearance > Creating Sparklines > Markers and Points

You can show markers or points in the sparkline graphs. You can specify different colors for low or negative, high, first, and last points.

The high point is the point for the largest value. The low point is the smallest value. The negative point represents negative values. The first point is the first point that is drawn on the graph. The last point is the last point that is drawn on the graph. The MarkersColor property only applies to the line sparkline type.

Using Code

The following example sets marker colors and creates a sparkline with the SetSparkline method.

CS
Copy Code
GrapeCity.Windows.SpreadSheet.Data.CellRange cellr = new GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 1, 5);
GrapeCity.Windows.SpreadSheet.Data.SparklineSetting ex = new GrapeCity.Windows.SpreadSheet.Data.SparklineSetting();
ex.AxisColor = System.Windows.SystemColors.ActiveBorderColor;
ex.LineWeight = 1;
ex.ShowMarkers = true;
ex.MarkersColor = Color.FromRgb(255, 0, 128);
ex.ShowFirst = true;
ex.ShowHigh = true;
ex.ShowLast = true;
ex.ShowNegative = true;
ex.FirstMarkerColor = Color.FromRgb(163, 73, 164);
ex.HighMarkerColor = Color.FromRgb(49, 78, 111);
ex.LastMarkerColor = Color.FromRgb(0, 255, 255);
ex.NegativeColor = Color.FromRgb(255, 255, 0);
gcSpreadSheet1.Sheets[0].Cells[0, 0].Value = 2;
gcSpreadSheet1.Sheets[0].Cells[0, 1].Value = 5;
gcSpreadSheet1.Sheets[0].Cells[0, 2].Value = 4;
gcSpreadSheet1.Sheets[0].Cells[0, 3].Value = -1;
gcSpreadSheet1.Sheets[0].Cells[0, 4].Value = 3;
gcSpreadSheet1.Sheets[0].SetSparkline(0, 5, cellr, GrapeCity.Windows.SpreadSheet.Data.DataOrientation.Horizontal, GrapeCity.Windows.SpreadSheet.Data.SparklineType.Line, ex);
gcSpreadSheet1.Invalidate();  
VB.NET
Copy Code
Dim cellr As New GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 1, 5)
Dim ex As New GrapeCity.Windows.SpreadSheet.Data.SparklineSetting()
ex.AxisColor = System.Windows.SystemColors.ActiveBorderColor
ex.LineWeight = 1
ex.ShowMarkers = True
ex.MarkersColor = Color.FromRgb(255, 0, 128)
ex.ShowFirst = True
ex.ShowHigh = True
ex.ShowLast = True
ex.ShowNegative = True
ex.FirstMarkerColor = Color.FromRgb(163, 73, 164)
ex.HighMarkerColor = Color.FromRgb(49, 78, 111)
ex.LastMarkerColor = Color.FromRgb(0, 255, 255)
ex.NegativeColor = Color.FromRgb(255, 255, 0)
GcSpreadSheet1.Sheets(0).Cells(0, 0).Value = 2
GcSpreadSheet1.Sheets(0).Cells(0, 1).Value = 5
GcSpreadSheet1.Sheets(0).Cells(0, 2).Value = 4
GcSpreadSheet1.Sheets(0).Cells(0, 3).Value = -1
GcSpreadSheet1.Sheets(0).Cells(0, 4).Value = 3
GcSpreadSheet1.Sheets(0).SetSparkline(0, 5, cellr, GrapeCity.Windows.SpreadSheet.Data.DataOrientation.Horizontal, GrapeCity.Windows.SpreadSheet.Data.SparklineType.Line, ex)
GcSpreadSheet1.Invalidate()
See Also