Tutorial 7: Date/time scale in the X-axis (VB.NET)
« on: February 04, 2016, 01:04:23 PM »
Hello there!
In this example, we will show you how to use a datetime range for the X-axis. For simplicity, we will use a VB.NET windows application project.

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:

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 v As New CrossingChartsLibrary.CrossingCharts
    Dim x As Single
    ' Precalculate some random values
    For k As Integer = 0 To 8
       x = x + Int(Rnd() * 10) + 15
    ' Populate the chart
    With CrossingCharts1
       .AutoRefresh = False
       .Title = "Working with axis demo"
       .Style = STYLE2D3D.STYLE2D_BAR
       ' Don't show decimals on Y-Axis so I assign "0" (integer values)
       .YAxisNumericFormat = "0"
       ' On X-axis I want a datetime scale
       .XAxisNumericFormat = "d" ' short date format (see VS help for
                                   DateTime string formats)
       ' Specify the range for the datetime scale
       .XAxisScaleMinimumDateTime = #1/10/2007#
       .XAxisScaleMaximumDateTime = #4/20/2007#
       .ShowXAxis = True
       ' Minor fancy adjustements
       .XAxisLabelsRotated = True
       .ShowLegend = False
       .ShowDataTable = False
       .ValuesLocationStyle =
   End With
   ' Assign the previous calculated values to the chart
   ' Show me the chart!
   End Sub
End Class

« Last Edit: February 16, 2016, 09:10:57 AM by CrossingCharts »