Color scheme: Light
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library API reference » WklChart

WklChart

WklChart class

Signature

Dim myWklChart As WklChart
Set myWklChart = Me!ControlName.Object

Summary

A data-bound chart of a form: lines, points, columns or bars with limit lines, bands and a linear trend, following the current record like a subform.

Parameters

None

Remarks

In Form view the chart reads its data when the form opens, on Requery and when a value of LinkMasterFields changes (checked every 300 ms). Design view shows a sample of the chosen kind. A read error is shown in the chart and in LastError, never raised.

An ActiveX control: inserted into a form in design view (Form Design › Controls › ActiveX Controls); reports are not supported. VBA reaches it through the Object property of the control, where ControlName is the name of the control on the form.

MemberKindSummary
`RecordSource`PropertyGets or sets the table, query or SQL statement of the data.
`XField`PropertyGets or sets the field of the X values.
`YFields`PropertyGets or sets the fields of the Y values.
`SeriesField`PropertyGets or sets the field whose values name the series.
`XKind`PropertyGets or sets what the X values are.
`ChartType`PropertyGets or sets the kind of picture.
`Grouping`PropertyGets or sets how several series of columns or bars stand.
`Aggregate`PropertyGets or sets how values of one X or period are combined.
`Period`PropertyGets or sets the period a date axis is grouped by for Aggregate.
`Missing`PropertyGets or sets what happens with a missing Y value.
`Title`PropertyGets or sets the title above the chart.
`YFormat`PropertyGets or sets the number format of the Y labels.
`ShowLegend`PropertyGets or sets whether the legend is shown with more than one series.
`ShowTrend`PropertyGets or sets whether a linear trend line is drawn per series.
`ShowMarkers`PropertyGets or sets whether lines show markers on their points.
`LinkMasterFields`PropertyGets or sets the fields or controls of the form whose values filter the data.
`LinkChildFields`PropertyGets or sets the fields of RecordSource matched with LinkMasterFields.
`Requery`MethodReads the data again.
`AddReference`MethodAdds a limit line or a band.
`ClearReferences`MethodRemoves all limit lines and bands.
`SeriesCount`PropertyGets the number of series.
`SeriesName`PropertyGets the name of a series.
`SeriesVisible`PropertyGets or sets whether a series is shown.
`TrendSlope`MethodGets the slope of the linear trend of a series.
`TrendReaches`MethodGets the X where the linear trend of a series reaches a value.
`RowsWithoutX`PropertyGets the number of rows skipped because their X value was missing or not readable.
`LastError`PropertyGets the text of the last read error.
`ColorScheme`PropertyGets or sets the color scheme.
`PrintStyle`PropertyGets or sets when series, limits and bands are told apart by pattern as well as by color.
EventSummary
`PointClick`Occurs on a click on a point, column or bar.
`DataLoaded`Occurs when the data were read, also after an error.

Code example

None

Inheritance

None

RecordSource property

Signature

Property Get RecordSource() As String
Property Let RecordSource(RHS As String)

Summary

Gets or sets the table, query or SQL statement of the data.

Parameters

None

Property value: String – A name or an SQL statement.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

XField property

Signature

Property Get XField() As String
Property Let XField(RHS As String)

Summary

Gets or sets the field of the X values.

Parameters

None

Property value: String – A field name of RecordSource.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

YFields property

Signature

Property Get YFields() As String
Property Let YFields(RHS As String)

Summary

Gets or sets the fields of the Y values.

Parameters

None

Property value: String – Field names separated by semicolons; one series each.

Remarks

With SeriesField only the first field is used.

Read/write.

Code example

None

Inheritance

Declared by WklChart.

SeriesField property

Signature

Property Get SeriesField() As String
Property Let SeriesField(RHS As String)

Summary

Gets or sets the field whose values name the series.

Parameters

None

Property value: String – A field name, or empty (default).

Remarks

For data with one row per point and series.

Read/write.

Code example

None

Inheritance

Declared by WklChart.

XKind property

Signature

Property Get XKind() As WklChartXKind
Property Let XKind(RHS As WklChartXKind)

Summary

Gets or sets what the X values are.

Parameters

None

Property value: `WklChartXKind` – wcxNumber, wcxDate (default) or wcxCategory.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

ChartType property

Signature

Property Get ChartType() As WklChartType
Property Let ChartType(RHS As WklChartType)

Summary

Gets or sets the kind of picture.

Parameters

None

Property value: `WklChartType` – wctLine (default), wctPoint, wctColumn or wctBar.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

Grouping property

Signature

Property Get Grouping() As WklChartGrouping
Property Let Grouping(RHS As WklChartGrouping)

Summary

Gets or sets how several series of columns or bars stand.

Parameters

None

Property value: `WklChartGrouping` – wcgGrouped (default) or wcgStacked.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

Aggregate property

Signature

Property Get Aggregate() As WklChartAggregate
Property Let Aggregate(RHS As WklChartAggregate)

Summary

Gets or sets how values of one X or period are combined.

Parameters

None

Property value: `WklChartAggregate` – wcaNone (default), wcaSum, wcaAverage, wcaCount, wcaMin or wcaMax.

Remarks

A group without any value is a gap, not 0.

Read/write.

Code example

None

Inheritance

Declared by WklChart.

Period property

Signature

Property Get Period() As WklChartPeriod
Property Let Period(RHS As WklChartPeriod)

Summary

Gets or sets the period a date axis is grouped by for Aggregate.

Parameters

None

Property value: `WklChartPeriod` – wcyNone (default), wcyDay, wcyWeek, wcyMonth, wcyQuarter or wcyYear.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

Missing property

Signature

Property Get Missing() As WklChartMissing
Property Let Missing(RHS As WklChartMissing)

Summary

Gets or sets what happens with a missing Y value.

Parameters

None

Property value: `WklChartMissing` – wcvGap (default), wcvConnect or wcvZero.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

Title property

Signature

Property Get Title() As String
Property Let Title(RHS As String)

Summary

Gets or sets the title above the chart.

Parameters

None

Property value: String – Text; empty for none.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

YFormat property

Signature

Property Get YFormat() As String
Property Let YFormat(RHS As String)

Summary

Gets or sets the number format of the Y labels.

Parameters

None

Property value: String – A .NET number format such as 0.0; empty for automatic.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

ShowLegend property

Signature

Property Get ShowLegend() As Boolean
Property Let ShowLegend(RHS As Boolean)

Summary

Gets or sets whether the legend is shown with more than one series.

Parameters

None

Property value: Boolean – True (default).

Remarks

A click on a legend entry hides or shows its series.

Read/write.

Code example

None

Inheritance

Declared by WklChart.

ShowTrend property

Signature

Property Get ShowTrend() As Boolean
Property Let ShowTrend(RHS As Boolean)

Summary

Gets or sets whether a linear trend line is drawn per series.

Parameters

None

Property value: Boolean – False (default).

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

ShowMarkers property

Signature

Property Get ShowMarkers() As Boolean
Property Let ShowMarkers(RHS As Boolean)

Summary

Gets or sets whether lines show markers on their points.

Parameters

None

Property value: Boolean – True (default).

Remarks

Markers are drawn on lines with up to 200 points.

Read/write.

Code example

None

Inheritance

Declared by WklChart.

LinkMasterFields property

Signature

Property Get LinkMasterFields() As String
Property Let LinkMasterFields(RHS As String)

Summary

Gets or sets the fields or controls of the form whose values filter the data.

Parameters

None

Property value: String – Names separated by semicolons, as LinkChildFields.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

LinkChildFields property

Signature

Property Get LinkChildFields() As String
Property Let LinkChildFields(RHS As String)

Summary

Gets or sets the fields of RecordSource matched with LinkMasterFields.

Parameters

None

Property value: String – Names separated by semicolons.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

Requery method

Signature

Sub Requery()

Summary

Reads the data again.

Parameters

None

Remarks

None

Code example

None

Inheritance

Declared by WklChart.

AddReference method

Signature

Function AddReference(ByVal FromValue As Double, Optional ByVal ToValue As Variant, Optional ByVal Caption As String = "", Optional ByVal Kind As Long = 0) As Long

Summary

Adds a limit line or a band.

Parameters

NameTypeOptionalDefaultDescription
FromValueDoubleNo–The value of a line, or one end of a band.
ToValueVariantYes–The other end of a band; omitted for a line.
CaptionStringYes""The text at the line.
KindLongYes0A wsk* status kind for the color (default wskNeutral).

Return value: Long – The number of the reference.

Remarks

The value axis always includes every reference. References are not stored with the form: add them in Form_Current.

Code example

None

Inheritance

Declared by WklChart.

ClearReferences method

Signature

Sub ClearReferences()

Summary

Removes all limit lines and bands.

Parameters

None

Remarks

None

Code example

None

Inheritance

Declared by WklChart.

SeriesCount property

Signature

Property Get SeriesCount() As Long

Summary

Gets the number of series.

Parameters

None

Property value: Long – The number.

Remarks

Read-only.

Code example

None

Inheritance

Declared by WklChart.

SeriesName property

Signature

Property Get SeriesName(ByVal Series As Long) As String

Summary

Gets the name of a series.

Parameters

NameTypeOptionalDefaultDescription
SeriesLongNo–The series from 0.

Property value: String – The Y field or the value of SeriesField.

Remarks

Read-only.

Code example

None

Inheritance

Declared by WklChart.

SeriesVisible property

Signature

Property Get SeriesVisible(ByVal Series As Long) As Boolean
Property Let SeriesVisible(ByVal Series As Long, RHS As Boolean)

Summary

Gets or sets whether a series is shown.

Parameters

NameTypeOptionalDefaultDescription
SeriesLongNo–The series from 0.

Property value: Boolean – True when shown.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

TrendSlope method

Signature

Function TrendSlope(ByVal Series As Long) As Variant

Summary

Gets the slope of the linear trend of a series.

Parameters

NameTypeOptionalDefaultDescription
SeriesLongNo–The series from 0.

Return value: Variant – The change of Y per X unit (per day on a date axis), or Null with fewer than two points.

Remarks

None

Code example

None

Inheritance

Declared by WklChart.

TrendReaches method

Signature

Function TrendReaches(ByVal Series As Long, ByVal Value As Double) As Variant

Summary

Gets the X where the linear trend of a series reaches a value.

Parameters

NameTypeOptionalDefaultDescription
SeriesLongNo–The series from 0.
ValueDoubleNo–The value, for example the minimum wall thickness.

Return value: Variant – A date on a date axis, otherwise a number; Null when the trend never reaches it.

Remarks

Valid only as long as the trend holds.

Code example

None

Inheritance

Declared by WklChart.

RowsWithoutX property

Signature

Property Get RowsWithoutX() As Long

Summary

Gets the number of rows skipped because their X value was missing or not readable.

Parameters

None

Property value: Long – The number.

Remarks

Read-only.

Code example

None

Inheritance

Declared by WklChart.

LastError property

Signature

Property Get LastError() As String

Summary

Gets the text of the last read error.

Parameters

None

Property value: String – Empty when the data were read.

Remarks

Read-only.

Code example

None

Inheritance

Declared by WklChart.

ColorScheme property

Signature

Property Get ColorScheme() As WklColorScheme
Property Let ColorScheme(RHS As WklColorScheme)

Summary

Gets or sets the color scheme.

Parameters

None

Property value: `WklColorScheme` – As for the other components.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklChart.

PrintStyle property

Signature

Property Get PrintStyle() As WklPrintStyle
Property Let PrintStyle(RHS As WklPrintStyle)

Summary

Gets or sets when series, limits and bands are told apart by pattern as well as by color.

Parameters

None

Property value: `WklPrintStyle` – wpsAutomatic (default), wpsColor or wpsPatterns.

Remarks

On a black-and-white or grayscale printout colors of similar lightness become the same gray. With patterns, every series after the first has its own dash pattern (lines) or hatch (columns and bars), the legend shows the pattern, limit lines differ by stroke (bad solid and heavy, warn dashed, ok dotted), bands are hatched with their edges drawn, and captions are in the text color. wpsAutomatic draws them only for a printer, a PDF or the print preview of a report; on the screen the control stays in color. wpsPatterns draws them also on the screen, for readers who cannot rely on color. Windows high contrast mode always tells the series apart by dash pattern. The value is saved with the form or report.

Read/write.

Code example

None

Inheritance

Declared by WklChart.

PointClick event

Signature

Event PointClick(ByVal Series As Long, ByVal X As Variant, ByVal Y As Variant)

Summary

Occurs on a click on a point, column or bar.

Parameters

NameTypeOptionalDefaultDescription
SeriesLongNo–The series from 0.
XVariantNo–A date, a category text or a number.
YVariantNo–The value.

Remarks

In a form module: Private Sub <ControlName>_PointClick(...). Parameters passed by reference can be changed by the procedure.

Code example

None

Inheritance

Declared by WklChart.

DataLoaded event

Signature

Event DataLoaded(ByVal Points As Long)

Summary

Occurs when the data were read, also after an error.

Parameters

NameTypeOptionalDefaultDescription
PointsLongNo–The number of points read.

Remarks

In a form module: Private Sub <ControlName>_DataLoaded(...). Parameters passed by reference can be changed by the procedure.

Code example

None

Inheritance

Declared by WklChart.

en/wiki/msaccess/comctl/api-reference/wklchart.txt · Last modified: by Wolfgang van der Stille