SeriesBuffer

One chart's worth of series definitions. Entry N describes one complete series: the data range name, the chart type, the axis side, the category range name, the legend range name and the display prefix. Add appends one entry, Count answers how many are held, and RangeName, ChartType, AxisSide, CategoryRange, LegendRange and LabelPrefix read one field of one entry by index. Both graph builders fill one of these and every consumer walks it by index.

ONE ADD PER SERIES

The six values that describe one series arrive in a single Add, and an entry is one array of six.

Depends on: BetterArray, Checking

Version: 1.0 (2026-07-31)

Instantiation

Create #

create

Create an empty series buffer

Signature:

Public Function Create() As SeriesBuffer

The buffer starts with no entry. Every builder makes one per chart, so a chart that ends with no series answers a Count of 0 and the caller draws nothing.

Returns: SeriesBuffer. An empty buffer ready for Add.


Operations

Add #

add

Append one complete series to the buffer

Signature:

Public Sub Add(ByVal rangeName As String, _
               ByVal chartType As String, _
               ByVal axisSide As String, _
               ByVal categoryRange As String, _
               ByVal legendRange As String, _
               Optional ByVal labelPrefix As String = vbNullString)

The six values that describe a series arrive together, so index N of the buffer always holds a whole series.

Parameters:

  • rangeName: String. Named range holding the series data.
  • chartType: String. How the series is drawn: "bar", "hbar", "point" or "line".
  • axisSide: String. "left" for the primary axis, "right" for the secondary one.
  • categoryRange: String. Named range holding the category axis labels.
  • legendRange: String. Named range holding the legend entry text.
  • labelPrefix: Optional String. Text put in front of the legend entry.

Reading

Count #

count

How many series the buffer holds

Signature:

Public Property Get Count() As Long

Returns: Long. The number of entries.


RangeName #

range-name

Named range holding the data of one series

Signature:

Public Property Get RangeName(ByVal index As Long) As String

Parameters:

  • index: Long. 1-based position in the buffer.

Returns: String. The data range name.

Throws:

  • ProjectError.InvalidArgument When index is outside the buffer.

ChartType #

chart-type

How one series is drawn

Signature:

Public Property Get ChartType(ByVal index As Long) As String

Parameters:

  • index: Long. 1-based position in the buffer.

Returns: String. "bar", "hbar", "point" or "line".

Throws:

  • ProjectError.InvalidArgument When index is outside the buffer.

AxisSide #

axis-side

Which axis one series is plotted against

Signature:

Public Property Get AxisSide(ByVal index As Long) As String

Parameters:

  • index: Long. 1-based position in the buffer.

Returns: String. "left" or "right".

Throws:

  • ProjectError.InvalidArgument When index is outside the buffer.

CategoryRange #

category-range

Named range holding the category axis labels of one series

Signature:

Public Property Get CategoryRange(ByVal index As Long) As String

Parameters:

  • index: Long. 1-based position in the buffer.

Returns: String. The category range name.

Throws:

  • ProjectError.InvalidArgument When index is outside the buffer.

LegendRange #

legend-range

Named range holding the legend entry of one series

Signature:

Public Property Get LegendRange(ByVal index As Long) As String

Parameters:

  • index: Long. 1-based position in the buffer.

Returns: String. The legend range name.

Throws:

  • ProjectError.InvalidArgument When index is outside the buffer.

LabelPrefix #

label-prefix

Text put in front of the legend entry of one series

Signature:

Public Property Get LabelPrefix(ByVal index As Long) As String

A time series series is labelled by its prefix alone. The other builders leave it empty.

Parameters:

  • index: Long. 1-based position in the buffer.

Returns: String. The prefix, or an empty string.

Throws:

  • ProjectError.InvalidArgument When index is outside the buffer.

Internal members (not exported)

Instantiation

Initialise #

initialise

Build the entry list

Signature:

Public Sub Initialise()

Public because the factory calls it on the instance it just made. The list is 1-based, which is what every consumer walks.


Helpers

FieldOf #

field-of

Read one value of one entry

Signature:

Private Function FieldOf(ByVal index As Long, ByVal field As Long) As String

Parameters:

Returns: String. The value, as text.

Throws:


ValidateIndex #

validate-index

Refuse a position the buffer does not hold

Signature:

Private Sub ValidateIndex(ByVal index As Long)

Parameters:

Throws:


ThrowError #

throw-error

Raise a ProjectError-based exception

Signature:

Private Sub ThrowError(ByVal errNumber As Long, ByVal message As String)

Parameters:

Throws:


Used in (6 file(s))