Skip to content

AddPoints Method

Description

Adds a batch of points. (Use to allocate memory for a very large number of points)

Syntax

Public Sub AddPoints( _
    ByVal Count As Long _
)

Parameters

  • Count: Number of points to add.

Remarks

AddPoints is a way to optimize adding a large number of points. Memory will be allocated once for the specified number of points. This will dramatically increase the speed at which the points are added when adding a large number of points. You can both AddPoints using AddPoints and any other "Add" method for the same series.

You will have to manually add values to the points after they have been added. Below you will find a few samples.

Example

Area Chart with 1 Series Added Using AddPoints

ChartControl.Content.Legend.Visible = True  
ChartControl.Content.Legend.HorizontalAlignment = xtpChartLegendNearOutside  

Dim Series As ChartSeries  
Set Series = ChartControl.Content.Series.Add("New York")  

' Sample usage of Batch Allocation using AddPoints. This should be used when adding  
' many points in a chart and performance starts to suffer.  
Series.Points.AddPoints 5

Series.Points(0).ArgumentValueString = 1900  
Series.Points(0).Value(0) = 7268  
Series.Points(1).ArgumentValueString = 1950  
Series.Points(1).Value(0) = 14830  
Series.Points(2).ArgumentValueString = 1990  
Series.Points(2).Value(0) = 17990  
Series.Points(3).ArgumentValueString = 2000  
Series.Points(3).Value(0) = 18976  
Series.Points(4).ArgumentValueString = 2008  
Series.Points(4).Value(0) = 20323  

Set Series = ChartControl.Content.Series.Add("California")  

Series.Points.Add 1900, 1485  
Series.Points.Add 1950, 10586  
Series.Points.Add 1990, 29760  
Series.Points.Add 2000, 33871  
Series.Points.Add 2008, 36756  

Set Series = ChartControl.Content.Series.Add("Florida")  

Series.Points.Add 1900, 528  
Series.Points.Add 1950, 2771  
Series.Points.Add 1990, 12937  
Series.Points.Add 2000, 15982  
Series.Points.Add 2008, 18328  

Set Series = ChartControl.Content.Series.Add("Texas")  

Series.Points.Add 1900, 3048  
Series.Points.Add 1950, 7711  
Series.Points.Add 1990, 14986  
Series.Points.Add 2000, 20851  
Series.Points.Add 2008, 24326  

ChartControl.Content.Titles.Add "Population by U.S. State"  
ChartControl.Content.Legend.Visible = True  

Set ChartControl.Content.Series(3).Style = New ChartAreaSeriesStyle  
Set ChartControl.Content.Series(2).Style = New ChartAreaSeriesStyle  
Set ChartControl.Content.Series(1).Style = New ChartAreaSeriesStyle  
Set ChartControl.Content.Series(0).Style = New ChartAreaSeriesStyle  

Dim Diagram As ChartDiagram2D  
Set Diagram = ChartControl.Content.Series(0).Diagram  
Diagram.AxisY.Title = "Population Growth (Millions)"  
Diagram.AxisY.Title.Visible = True  
Diagram.AxisX.Title = "Decade / Year"  
Diagram.AxisX.Title.Visible = True  

Diagram.AxisY.Range.SideMargins = False  
Diagram.AxisX.Range.SideMargins = False

Point Chart with 1 Series Added Using AddPoints

ChartControl.Content.Titles(0).Text = "Point Chart"  
ChartControl.Content.Legend.Visible = True  
ChartControl.Content.Legend.HorizontalAlignment = xtpChartLegendFar  

Dim Series As ChartSeries  
Set Series = ChartControl.Content.Series.Add("Series 1")  

Series.ArgumentScaleType = xtpChartScaleNumerical  

Series.Points.Add 1, 67  
Series.Points.Add 14, 50  
Series.Points.Add 9, 74  
Series.Points.Add 38, 58  
Series.Points.Add 2, 64  
Series.Points.Add 25, 95  
Series.Points.Add 1, 77  
Series.Points.Add 1, 91  
Series.Points.Add 35, 92  
Series.Points.Add 27, 86  
Series.Points.Add 31, 54  
Series.Points.Add 22, 53  
Series.Points.Add 12, 82  
Series.Points.Add 21, 66  
Series.Points.Add 38, 95  
Series.Points.Add 7, 76  
Series.Points.Add 11, 88  
Series.Points.Add 29, 62  
Series.Points.Add 27, 99  
Series.Points.Add 35, 94  

Set Series = ChartControl.Content.Series.Add("Series 2")  

' Sample usage of Batch Allocation using AddPoints. This should be used when adding  
' many points in a chart and performance starts to suffer.  
Series.Points.AddPoints 20

Series.Points(0).ArgumentValue = 63  
Series.Points(0).Value(0) = 11  
Series.Points(1).ArgumentValue = 42  
Series.Points(1).Value(0) = 33  
Series.Points(2).ArgumentValue = 73  
Series.Points(2).Value(0) = 14  
Series.Points(3).ArgumentValue = 61  
Series.Points(3).Value(0) = 11  
Series.Points(4).ArgumentValue = 53  
Series.Points(4).Value(0) = 18  
Series.Points(5).ArgumentValue = 67  
Series.Points(5).Value(0) = 44  
Series.Points(6).ArgumentValue = 62  
Series.Points(6).Value(0) = 7  
Series.Points(7).ArgumentValue = 77  
Series.Points(7).Value(0) = 9  
Series.Points(8).ArgumentValue = 43  
Series.Points(8).Value(0) = 41  
Series.Points(9).ArgumentValue = 49  
Series.Points(9).Value(0) = 28  
Series.Points(10).ArgumentValue = 76  
Series.Points(10).Value(0) = 35  
Series.Points(11).ArgumentValue = 70  
Series.Points(11).Value(0) = 42  
Series.Points(12).ArgumentValue = 48  
Series.Points(12).Value(0) = 6  
Series.Points(13).ArgumentValue = 40  
Series.Points(13).Value(0) = 42  
Series.Points(14).ArgumentValue = 64  
Series.Points(14).Value(0) = 48  
Series.Points(15).ArgumentValue = 46  
Series.Points(15).Value(0) = 5  
Series.Points(16).ArgumentValue = 50  
Series.Points(16).Value(0) = 29  
Series.Points(17).ArgumentValue = 50  
Series.Points(17).Value(0) = 0  
Series.Points(18).ArgumentValue = 46  
Series.Points(18).Value(0) = 1  
Series.Points(19).ArgumentValue = 73  
Series.Points(19).Value(0) = 48

Set ChartControl.Content.Series(0).Style = New ChartPointSeriesStyle  
Set ChartControl.Content.Series(1).Style = New ChartPointSeriesStyle  

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

Diagram.AxisY.Visible = True  
Diagram.AxisY.Alignment = xtpChartAxisNear  
Diagram.AxisY.Interlaced = True  
Diagram.AxisY.MinorCount = 1  
Diagram.AxisY.Thickness = 1  
Diagram.AxisX.Thickness = 1  

Diagram.AxisX.Label.Visible = True  
Diagram.AxisX.Title.Text = "Axis Title"  

Diagram.AxisY.Label.Angle = -45  
Diagram.AxisY.Label.Antialiasing = True  

Diagram.AxisX.TickMarks.CrossAxis = True  
Diagram.AxisX.TickMarks.Length = 5  
Diagram.AxisX.TickMarks.Thickness = 1  
Diagram.AxisX.TickMarks.MinorLength = 1  
Diagram.AxisX.TickMarks.MinorThickness = 1  
Diagram.AxisX.TickMarks.MinorVisible = True  
Diagram.AxisX.TickMarks.Visible = True  

Diagram.AxisX.GridLines.Visible = True  
Diagram.AxisX.GridLines.MinorVisible = True  
Diagram.AxisX.Interlaced = False  

Diagram.AxisY.GridLines.Visible = True  
Diagram.AxisY.GridLines.MinorVisible = True  

Diagram.AxisX.GridLines.LineStyle.DashStyle = xtpChartDashStyleSolid  
Diagram.AxisX.GridLines.MinorLineStyle.DashStyle = xtpChartDashStyleSolid

See Also

ChartSeriesPointCollection Collection


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