Skip to content

EnableVirtualMode Method

Description

Enables virtual mode for this series.

Syntax

Public Sub EnableVirtualMode( _
    ByVal MinRange As Double, _
    ByVal MaxRange As Double, _
    ByVal Step As Double _
)

Parameters

  • MinRange: Minimum value of the series.
  • MaxRange: Maximum value of the series.
  • Step: Steps between virtual points. Virtual points will be added for each step between the min and max range. For example, if Min = 0, Max = 5.0, and Step = 1.0, then virtual points will be created with 1 step increments, resulting in points 0, 1, 2, 3, 4, 5.

Remarks

VirtualMode should be used when there will be a very large number of points in a series and speed is important. While VirtualMode can be used with any number of points, it is recommended for scenarios involving more than 10,000 points, as adding more than that in normal mode can become quite slow. Using VirtualMode will dramatically increase performance.

VirtualMode does not require you to manually create the points in the series; all you need to do is fill in the points data in the GetPointValue event when the series is being displayed. The GetPointValue event is used to assign values to points in a virtual series.

VirtualMode is designed to be used with series of type ChartFastLineSeriesStyle.

When using VirtualMode, the points that will be displayed should be stored internally in an array or another means that can easily be accessed by the Chart Control. If you have to waste time calculating the points data, it defeats the purpose of virtual mode.

The following steps should be followed when working in VirtualMode:

  1. Create your own array (dim) with the data that you want to show in the series. Each "point" in the array will represent a point in the series.
  2. Call EnableVirtualMode, specifying the minimum, maximum, and step values.
  3. Use the GetPointValue event to manually assign the value for each point in the series.

Note: You might choose to use the AddPoints method to batch allocate memory instead of virtual mode.

Example

Private Sub Form_Load()
    Dim Series As ChartSeries  
    Dim SeriesCount As Long  
    SeriesCount = 1  

    Dim i As Long  
    For i = 1 To SeriesCount  
        Set Series = ChartControl.Content.Series.Add("Series")  
        Dim Style As New ChartFastLineSeriesStyle  
        Set Series.Style = Style  
        Series.ArgumentScaleType = xtpChartScaleNumerical  
    Next i  

    ChartControl.Content.Series(0).EnableVirtualMode -5, 5, 0.001  

    Dim Diagram As ChartDiagram2D  
    Set Diagram = ChartControl.Content.Diagrams(0)  

    Diagram.AxisY.Range.MaxValue = 1  
    Diagram.AxisY.Range.MinValue = -1  
    Diagram.AxisY.Range.AutoRange = False  

    Diagram.AxisX.Range.MaxValue = 5  
    Diagram.AxisX.Range.MinValue = -5  
    Diagram.AxisX.Range.AutoRange = False  

    Diagram.AxisX.Interlaced = False  
End Sub

Private Sub ChartControl_GetPointValue(ByVal Series As XtremeChartControl.ChartSeries, ByVal Argument As Double, Value As Double)  
    Value = Sin(Argument)  
End Sub

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.