Table of Contents

TTMSFNCChart Class

Main chart control that renders series, axes, legend, title, crosshair, and annotations; supports virtual mode, data import from CSV and JSON, interactive zooming and panning, and export to image.

API unit family: TMSFNCChart Inherits from: TCustomControl Implements: ITMSFNCGraphicsExport, ITMSFNCPersistence

Syntax

TTMSFNCChart = class(TCustomControl, ITMSFNCGraphicsExport, ITMSFNCPersistence)

Properties

Name Description
Adapter Optional data adapter that populates the chart from an external data source.
AntiAliasing When True (default), the chart renders with anti-aliasing for smoother lines and curves.
Appearance Global chart appearance settings including color scheme, color list, and font propagation.
ClickMargin Pixel radius used to detect clicks on data points, bars, and slices; larger values make hit-testing more forgiving.
Crosshair Global crosshair settings; per-series appearance is configured through TTMSFNCChartSerie.Crosshair.
DefaultLoadOptions Default import options used when loading data from CSV or JSON without explicit options; can be shared across multiple load calls.
DrawOrder Controls z-order when bar series and other series types are rendered together; default is csdoBarsFirst.
Fill Fill settings for the chart background area.
Interaction When True (default), mouse and touch interaction (zooming, panning, clicking) is active.
InteractionOptions Mouse and touch interaction settings including scale mode, panning, and editor access.
Legend Chart-level legend settings including position, font, and visibility.
NativeCanvas When True, uses the platform-native canvas for rendering instead of the cross-platform canvas; default is True on VCL, False on other frameworks.
Orientation Controls the chart rendering orientation; coVertical (default) draws y-values upward, coHorizontal rotates the chart 90 degrees.
SerieByName Returns the series whose LegendText matches AName; returns nil if not found.
Series Collection of chart series; use BeginUpdate and EndUpdate when adding multiple series at once.
SeriesMargins Margin settings applied around the series drawing area inside the chart control.
Stroke Stroke settings for the chart border.
TextQuality Controls text rendering quality; default is gtqAntiAliasing.
Title Top and bottom chart title settings including text, font, visibility, and position.
Version Component version string.
XAxis Global x-axis appearance settings; per-series tick values are configured through TTMSFNCChartSerie.XValues.
YAxis Global y-axis appearance settings; per-series tick values are configured through TTMSFNCChartSerie.YValues.

Methods

Name Description
AddBandSerie Adds a band series with explicit start and end values for both the upper and lower boundary.
AddLineSerie Adds a straight line series spanning the given x range with start and end y values; useful for reference lines.
AddMovingAverage Adds a moving average line computed from the series at the given index using the specified window size.
AddParetoLine Adds a Pareto cumulative-percentage line overlaid on the series at the given index.
AddPointArray Creates a new series from a flat array of y-values and returns it.
AddSeriesFromDataArray Creates a new series from y-values (and optional x-values and labels) and returns it.
AddTrendChannel Adds upper and lower trend channel line series around the series at the given index; equivalent to AddTrendChannelBand but does not return the series.
AddTrendChannelBand Adds a band series representing the trend channel around the series at the given index.
AddTrendLine Adds a linear trend line computed from the series at the given index.
AppendFromDataArray Appends y-values to an existing series without removing existing points; returns the series.
BeginUpdate Begins a framework override batch update; call EndUpdate when done to redraw once.
CMGesture Handles platform gesture input for chart interaction.
Clear Removes all series and their points from the chart.
DrawChart Renders the chart into the provided graphics context within the given rectangle; used for custom drawing and export.
EndUpdate Ends a framework override batch update and redraws the chart once.
GetChartRectangle Returns the full chart bounding rectangle including all chart elements.
GetSeriesRectangle Returns the bounding rectangle of the series drawing area excluding axes and titles.
InitSample Populates the chart with sample data for design-time preview; override to provide component-specific sample content.
IsHorizontal Returns True when Orientation is coHorizontal.
LoadFromCSVData Imports series and points from a CSV file; creates a series for each column in YValueColumnIndexesArray.
LoadFromCSVDataEx Imports series from a CSV file including band and variable-radius columns using explicit load options.
LoadFromCSVMultiPointData Imports OHLC or box plot series from a CSV file using explicit load options.
LoadFromCSVStreamData Imports series from a CSV stream using explicit load options.
LoadFromCSVStreamDataEx Imports series from a CSV stream including band and variable-radius columns using explicit load options.
LoadFromCSVStreamMultiPointData Imports OHLC or box plot series from a CSV stream using explicit load options.
LoadFromCSVTextData Imports series from a CSV string using explicit load options.
LoadFromCSVTextDataEx Imports series from a CSV string including band and variable-radius columns using explicit load options.
LoadFromCSVTextMultiPointData Imports OHLC or box plot series from a CSV string using explicit load options.
LoadFromDataArray Replaces the points in an existing series with y-values from the array and returns the updated series.
LoadFromJSONData Imports series and points from a JSON file; specify JSON key names for series, points, and y-values.
LoadFromJSONDataEx Imports series and points from a JSON file including optional secondary and variable-radius values.
LoadFromJSONMultiPointData Imports OHLC or box plot series from a JSON file.
LoadFromJSONStreamData Imports series and points from a JSON stream.
LoadFromJSONStreamDataEx Imports series from a JSON stream including secondary and variable-radius values.
LoadFromJSONStreamMultiPointData Imports OHLC or box plot series from a JSON stream.
LoadFromJSONTextData Imports series and points from a JSON string.
LoadFromJSONTextDataEx Imports series from a JSON string including secondary and variable-radius values.
LoadFromJSONTextMultiPointData Imports OHLC or box plot series from a JSON string.
LoadSettingsFromFile Restores chart settings from a previously saved JSON settings file.
LoadSettingsFromStream Restores chart settings from a stream containing previously saved JSON settings.
Paint Paints the chart control.
Resize Updates the chart layout after the control size changes.
SaveSettingsToFile Saves the current chart settings to a file in JSON format.
SaveSettingsToStream Saves the current chart settings to a stream in JSON format.
SaveToBase64 Exports the current chart image as a Base64-encoded string.
SaveToImage Exports the current chart appearance to an image file; the format is inferred from the file extension.
SetAutoXRange Sets the x auto-range mode for a single series or all series at once.
SetAutoYRange Sets the y auto-range mode for a single series or all series at once.
SetXValuesPosition Sets the x-axis position flags for the series at the given index, optionally clearing other position flags first.
SetYValuesPosition Sets the y-axis position flags for the series at the given index, optionally clearing other position flags first.
ShowEditor Opens the specified chart editor dialog for the given series index.
XYToArea Returns the line or area series whose hit area contains the given screen coordinates; returns nil if none.
XYToBar Returns the bar rectangle point under the given screen coordinates; returns nil if none.
XYToBarVirtual Returns True and fills APoint when a virtual bar is under the given screen coordinates.
XYToClosestDrawPoint Returns True and fills ADrawPoint when the closest rendered point to the screen coordinates is within the click margin.
XYToLegendItem Returns the index of the chart-level legend item under the given screen coordinates; returns -1 if none.
XYToPoint Returns the data point (marker) under the given screen coordinates; returns nil if none.
XYToPointVirtual Returns True and fills APoint when a virtual marker point is under the given screen coordinates.
XYToSerieLegendItem Returns the index of the series legend item under the given screen coordinates, and sets ASerie to the owning series; returns -1 if none.
XYToSlice Returns the pie or spider slice point under the given screen coordinates; returns nil if none.
XYToSliceVirtual Returns True and fills APoint when a virtual slice is under the given screen coordinates.
XYToTitle Returns True when the given screen coordinates fall within the chart title area.
XYToXAxis Returns True when the given screen coordinates fall within the x-axis area.
XYToYAxis Returns True when the given screen coordinates fall within the y-axis area.

Events

Name Description
OnAfterDrawBackground Fires after the chart background has been drawn.
OnAfterDrawChart Fires after the chart content has been drawn.
OnAfterDrawLegend Fires after the chart legend has been drawn.
OnAfterDrawLegendIcon Fires after a legend icon has been drawn.
OnAfterDrawSerieAnnotation Fires after a series point annotation has been drawn.
OnAfterDrawSerieBar Fires after a bar series bar has been drawn.
OnAfterDrawSerieCrosshairHorizontalLine Fires after the crosshair horizontal line has been drawn.
OnAfterDrawSerieCrosshairVerticalLine Fires after the crosshair vertical line has been drawn.
OnAfterDrawSerieGridLegendText Fires after spider grid legend text has been drawn.
OnAfterDrawSerieLabel Fires after a series point label has been drawn.
OnAfterDrawSerieLegend Fires after a series legend item has been drawn.
OnAfterDrawSerieLegendIcon Fires after a series legend icon has been drawn.
OnAfterDrawSerieLegendIconVirtual Fires after a virtual series legend icon has been drawn.
OnAfterDrawSerieLine Fires after a series line segment has been drawn.
OnAfterDrawSerieMarker Fires after a series data point marker has been drawn.
OnAfterDrawSerieMultiPoint Fires after an OHLC or box plot point has been drawn.
OnAfterDrawSerieSlice Fires after a pie or spider chart slice has been drawn.
OnAfterDrawSerieXAxisCrosshairText Fires after the x-axis crosshair value text has been drawn.
OnAfterDrawSerieXGridLine Fires after a vertical grid line has been drawn.
OnAfterDrawSerieXValue Fires after an x-axis tick value label has been drawn.
OnAfterDrawSerieYAxisCrosshairText Fires after the y-axis crosshair value text has been drawn.
OnAfterDrawSerieYGridLine Fires after a horizontal grid line has been drawn.
OnAfterDrawSerieYValue Fires after a y-axis tick value label has been drawn.
OnAfterDrawSeries Fires after all series have been rendered in this paint cycle.
OnAfterDrawTitle Fires after the chart title has been drawn.
OnAfterDrawXAxis Fires after the x-axis has been drawn.
OnAfterDrawXValuesTitle Fires after the x-axis title has been drawn.
OnAfterDrawYAxis Fires after the y-axis has been drawn.
OnAfterDrawYValuesTitle Fires after the y-axis title has been drawn.
OnAnimateSerieFinished Fires when a series animation sequence completes.
OnAnimateSerieStarted Fires when a series animation sequence begins.
OnBeforeDrawBackground Fires before the chart background is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawChart Fires before the chart content is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawLegend Fires before the chart legend is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawLegendIcon Fires before a legend icon is drawn.
OnBeforeDrawSerieAnnotation Fires before a point annotation is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieBar Fires before a bar is drawn; set ADefaultDraw to False to suppress default rendering.
OnBeforeDrawSerieCrosshairHorizontalLine Fires before the crosshair horizontal line is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieCrosshairVerticalLine Fires before the crosshair vertical line is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieGridLegendText Fires before spider grid legend text is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieLabel Fires before a point label is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieLegend Fires before a series legend item is drawn.
OnBeforeDrawSerieLegendIcon Fires before a series legend icon is drawn; set ADefaultDraw to False to replace the icon entirely.
OnBeforeDrawSerieLegendIconVirtual Fires before a virtual series legend icon is drawn; set ADefaultDraw to False to replace the icon.
OnBeforeDrawSerieLine Fires before a line segment is drawn; set ADefaultDraw to False to suppress default rendering.
OnBeforeDrawSerieMarker Fires before a series data point marker is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieMultiPoint Fires before an OHLC or box plot point is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieSlice Fires before a pie or spider chart slice is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieXAxisCrosshairText Fires before the x-axis crosshair value text is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieXGridLine Fires before a vertical grid line is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieXValue Fires before an x-axis tick value label is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieYAxisCrosshairText Fires before the y-axis crosshair value text is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieYGridLine Fires before a horizontal grid line is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSerieYValue Fires before a y-axis tick value label is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawSeries Fires before all series are rendered in this paint cycle.
OnBeforeDrawTitle Fires before the chart title is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawXAxis Fires before the x-axis is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawXValuesTitle Fires before the x-axis title is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawYAxis Fires before the y-axis is drawn; set ADefaultDraw to False to suppress.
OnBeforeDrawYValuesTitle Fires before the y-axis title is drawn; set ADefaultDraw to False to suppress.
OnBeforeSetAllFonts Fires before global font changes are propagated to chart elements; use the Boolean parameters to restrict which groups receive the change.
OnCanLoadProperty Fires before a property is deserialized; set the ACanLoad parameter to False to skip the property.
OnCanSaveProperty Fires before a property is serialized; set the ACanSave parameter to False to exclude the property.
OnCustomizeAnnotationFill Fires to allow customizing the fill of an annotation before it is rendered.
OnCustomizeAnnotationFont Fires to allow customizing the font of an annotation before it is rendered.
OnCustomizeAnnotationStroke Fires to allow customizing the stroke of an annotation before it is rendered.
OnDrawTitleText Fires to allow customizing or replacing the chart title text before it is drawn.
OnGetAnnotation Fires in virtual mode to retrieve annotation data for a virtual point.
OnGetNumberOfAnnotations Fires in virtual mode to retrieve the number of annotations on the specified virtual point.
OnGetNumberOfPoints Fires in virtual mode to retrieve the total number of points in the specified series.
OnGetPoint Fires in virtual mode to retrieve point data for the given series and point index.
OnGetSerieLabel Fires to override or format a data point label text.
OnGetSerieLabelVirtual Fires in virtual mode to retrieve or format a point label text.
OnGetSerieLegendText Fires to override or format a series legend item text.
OnGetSerieLegendTextVirtual Fires in virtual mode to retrieve or format a series legend item text.
OnGetSerieSpiderLegendText Fires to override or format a spider chart spoke legend text.
OnGetSerieSpiderLegendTextVirtual Fires in virtual mode to retrieve or format a spider chart spoke legend text.
OnGetSerieXAxisCrosshairText Fires to override or format the x-axis crosshair value text.
OnGetSerieXValue Fires to override or format an x-axis tick value text.
OnGetSerieYAxisCrosshairText Fires to override or format the y-axis crosshair value text.
OnGetSerieYValue Fires to override or format a y-axis tick value text.
OnJSONAddPoint Fires when a new point is created from JSON import; allows customizing the point using the raw JSON value.
OnJSONAddSeries Fires when a new series is created from JSON import; allows customizing the series using the raw JSON value.
OnLegendItemClick Fires when the user clicks on a legend item.
OnParseDateTimeStringToDateTime Fires when a date/time string cannot be parsed automatically during CSV or JSON import; set ADate to the parsed value.
OnSerieAreaClick Fires when the user clicks in a series area.
OnSerieAreaVirtualClick Fires in virtual mode when the user clicks in a series area.
OnSerieBarClick Fires when the user clicks on a bar in a bar series.
OnSerieBarClickVirtual Fires in virtual mode when the user clicks on a bar.
OnSerieLegendItemClick Fires when the user clicks on a series legend item.
OnSeriePointClick Fires when the user clicks on a data point marker.
OnSeriePointClickVirtual Fires in virtual mode when the user clicks on a data point.
OnSerieSliceClick Fires when the user clicks on a pie or spider chart slice.
OnSerieSliceClickVirtual Fires in virtual mode when the user clicks on a pie or spider chart slice.
OnShowEditor Fires when an editor dialog is about to open; inspect or modify AShowEditorParams to change which editor is shown or to suppress it.
OnTitleClick Fires when the user clicks on the chart title area.
OnXAxisClick Fires when the user clicks on the x-axis area.
OnYAxisClick Fires when the user clicks on the y-axis area.

Used by