Tutorial 13: DateTime Scatter Chart type (VB.NET)
« on: February 04, 2016, 02:39:01 PM »
Hi again!

In previous example, we learnt how to use a DateTime range on the X-axis but there was no relationship between the X-axis position and the date represented by each value.

The good news are that beginning version 9.1, there's a new chart type specially designed for DateTime in the X-axis scale and a numeric value on the Y-axis. It's called DateTime Scatter Chart.

Use this chart type when you need something like "add a point on 13/12/2006 with a value of 75.12".
 
Steps:

1. Create a new Windows application project
2. Add Crossing Charts Library to the toolbox palette and drag it to Form1
3. Copy and paste de following code:
 
Code: [Select]
Imports CrossingChartsLibrary
Public Class Form1
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim x As New CrossingChartsLibrary.SeriesFactory
    Dim k As Long
    Dim d As DateTime = DateTime.Now
    For k = 1 To 15
      x.AddDateTimeValue(d, k * 5)
      d = d.Add(New TimeSpan(Rnd() * 10, Rnd() + 10, Rnd() * 10))
    Next
    With CrossingCharts1
      .Style = STYLE2D3D.STYLE2D_XY_DATETIME
      .XAxisScaleMode = SCALEMODE.SCALEMODE_AUTOMATIC
      .ShowValues = False
      .Calculation = CALCULATION.CALCULATION_AVERAGE
      .ShowXAxis = True
      .XAxisLabelsRotated = True
      .HotSpotsEnabled = True
      .ShowLegend = False
      .ShowDataTable = False
      .WallsBackStyle =
                   STYLEWALLBACKGROUND.STYLEWALLBACKGROUND_GRADIENT_INVERTED
      .WallsBackColorPrincipal = Color.Goldenrod
    End With
    x.ApplyTo(CrossingCharts1)
   End Sub
End Class

Results:
« Last Edit: February 16, 2016, 09:26:15 AM by CrossingCharts »