Tutorial 8: Fixed numeric scale on both axis (VB.NET)
« on: February 04, 2016, 01:06:13 PM »
By default, Crossing Charts for .NET automatically calculates the minimum and maximum values for both axis and then displays the values according to that range.

For scatter and bubble chart types, since the values are X/Y pairs, you may specify a fixed numeric scale for both Y and X axis, instead of the automatic mode.

For other chart types you may also specify a fixed numeric scale for Y-axis but not for X-axis (for X-axis you may use for any chart type DATETIME_AUTOMATIC, DATETIME_FIXED or AUTOMATIC).

In this example, 500 random points are calculated from (0..500, 0..500) space. The example uses fixed scale for both axis, X and Y, with a range of 0..1000, 0..1000. Because of this, points are drawn in the lower-left quadrant.

Using XAxisDividersCount and YAxisDividersCount properties, you may also specify the number of items in the X or Y axis.

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 Object, ByVal e As System.EventArgs) Handles Me.Load
      Dim v As New CrossingChartsLibrary.SeriesFactory
      Dim x, y As Single
      ' Precalculate some random values
      x = 100
      For k As Integer = 0 To 500
         x = Rnd() * 500
         y = Rnd() * 500
         v.AddPoint(x, y)
      ' Populate the chart
      With CrossingCharts1
         .AutoRefresh = False
         .Title = "Working with fixed scales on X-axis"
         .Style = STYLE2D3D.STYLE2D_XY
         ' Fixed scale on y-axis
         .YAxisScaleMinimum = 0
         .YAxisScaleMaximum = 1000
         .YAxisDividersCount = 8
         ' Fixed scale on x-axis
         .XAxisScaleMinimum = 0
         .XAxisScaleMaximum = 1000
         .XAxisDividersCount = 5
         ' Minor fancy adjustements
         .XAxisLabelsRotated = True
         .ShowXAxis = True
         .ShowLegend = False
         .ShowDataTable = False
         .ShowValues = False
   End With
   ' Assign the previous calculated values to the chart
   ' Show me the chart!
   End Sub
End Class


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