Tutorial 28: Multi-series X/Y spline chart
« on: February 04, 2016, 03:34:32 PM »
Spline chart using 3 different colored series of X/Y data.
 
Steps:

1. Create a new Windows application project (VB.NET)
2. Add Crossing Charts Library to the toolbox pallete and drag it to Form1.
3. Copy and paste de following code:

Note: the code in the Form1_Load event could be used in ASP.NET applications as well.
 
Code: [Select]
Imports CrossingChartsLibrary
  Public Class Form1
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  ' Prepare chart control
  With CrossingCharts1
    .AutoRefresh = False
    .Title = "Multi-Series X/Y Spline Chart Sample"
    .Style = STYLE2D3D.STYLE2D_XY_SPLINE
    .ShowDataTable = False
    .ShowValues = False
    .ShowLegend = False
    ' Y-Axis config
    .YAxisScaleMaximum = 45
    .YAxisScaleMinimum = 5
    .YAxisScaleMode = SCALEMODE.SCALEMODE_FIXED
    .YAxisNumericFormat = "0"
    ' X-Axis config
    .XAxisDividersCount = 5
    .XAxisScaleMinimum = 0
    .XAxisScaleMaximum = 3000
    .XAxisScaleMode = SCALEMODE.SCALEMODE_FIXED
    .ShowDividerX = True
    .ShowXAxis = True
    ' Series special config
    .PointSize = 1
    .PointStyle = STYLEPOINT.STYLEPOINT_CIRCLE
    .SeriesLineStyle = New Pen() {New Pen(Color.Blue), New Pen(Color.Yellow), New Pen(Color.Green)}
  End With
  ' Add 3 series of random data
  Dim seriesFactory As New SeriesFactory
  Dim x As Single
  For serie As Integer = 1 To 3
    seriesFactory.NewSerie()
    x = 0
    For k As Integer = 1 To 30
      seriesFactory.AddPoint(x, Rnd() * 30 + 10)
      x += 100
    Next
  Next
  ' Assign data and refresh chart
  seriesFactory.ApplyTo(CrossingCharts1)
  CrossingCharts1.RefreshChart()
  End Sub
End Class

Results:

« Last Edit: February 16, 2016, 10:58:47 AM by CrossingCharts »