The TRSGraphChart component is a RSCharts.TRSShapeChart descendant that provides a visual representation of a graph or network with nodes and links between them, similar to a flow chart or org chart. The Graph Chart connects chart values ( RSGraphCharts.TRSGraphChartValue ) by drawing an arrow representing the link ( RSGraphCharts.TRSGraphChartLink ) between the shapes.
A lot of graph charts, such as org charts and flow charts, are not just scattered about the chart surface. There is a definite organization, e.g., things flow from a top to a bottom (or a left to a right) and many nodes are considered equivalent so they are placed at the same level as other nodes. Each TRSGraphChartValue has a Level property, which is an integer property from 0 to whatever specifying the level of a node. This Level property is used by the Arrange method to divide the chart canvas into a big grid, where each cell in the grid can contain one chart value. One axis of this virtual grid will be the Levels in the chart. The other axis will be all the nodes/values at that level.
Namespace: RSGraphCharts
TGraphicControl |
Delphi |
type |
|
|
The grid would look like this:
The Arrange method makes nodes of the same level the same size but different levels can have a different level size. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method Assign(TPersistent). (Overrides RSCharts.TRSCustomPointChart.Assign(TPersistent).) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method AxisChanged(TRSChartAxis). (Inherited from RSChartPanel.TRSCustomChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Suspends screen repainting of the chart. The BeginUpdate method suspends screen repainting and change events until the EndUpdate method is called. Use BeginUpdate to speed processing and avoid flicker while items are added to or deleted from a collection. (Inherited from RSChartPanel.TRSCustomChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Creates an array of points for all the values in the chart and returns the FirstIndex in FI and LastIndex in LI. (Inherited from RSCharts.TRSCustomLineChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Overloaded. Represents method Changed. (Inherited from RSChartPanel.TRSCustomChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Overloaded. Represents method Changed(TRSChartValue). (Inherited from RSChartPanel.TRSCustomChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Creates a "deep" copy of the chart. It constructs a new chart of the correct type and then calls the Assign method to copy its properties to the new copy.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method CMHitTest(TCMHitTest). (Inherited from RSChartPanel.TRSCustomChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method CMVisibleChanged(TMessage). (Inherited from RSChartPanel.TRSCustomChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method CreateBrush. (Inherited from RSChartPanel.TRSCustomChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Creates the RSChartPanel.TRSChartValues class for the Values property
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method CreateFont. (Inherited from RSChartPanel.TRSCustomChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method CreatePen. (Overrides RSChartPanel.TRSCustomChart.CreatePen.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Creates the default PointsInfo object (Overrides RSCharts.TRSCustomPointChart.CreatePointsInfo.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Creates sample values for illustrating how the chart will look. This function is automatically called at design-time to fill the chart with sample values. It can also be called at run-time to add more values to the chart (i.e., the chart is not cleared first)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Represents method DoUpdateAxisInfo(TRSChartAxis). (Inherited from RSChartPanel.TRSCustomChart.) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Overloaded. Paints the chart to the specified Canvas in the specified location. The Draw method first calls the OnDrawing event, which signals that it is about to draw and allows users to stop the drawing before it occurs. Then, it calls the protected InternalDraw method to actually do the drawing. Finally, it calls the OnDraw event to signal the end of drawing of the chart. Use the Draw method to paint the chart to any canvas and anywhere and with any size on the canvas.
|
(Inherited from RSChartPanel.TRSCustomChart.)
Draw(TCanvas,TCanvasRect,TRSChartAxis,TRSChartAxis,Boolean,Boolean)
Overloaded. Paints the chart to the specified Canvas in the specified location. The Draw Method uses the supplied TRSChartAxis (instead of the HorizontalAxis and VerticalAxis properties) to convert the chart values into pixel coordinates.
Unlike the regular Draw method, this method draws the axes as well (useful for when the chart is not connected to a panel).
Use the Draw method to paint the chart to any canvas and anywhere and with any size on the canvas.
DrawArea(TCanvas,TRS2DChartValue,TCanvasRect,TCanvasPixel,TCanvasPixel,Boolean)
Draws the area under the line for that line segment (Inherited from RSCharts.TRSCustomLineChart.)
DrawAxes(TCanvas,TCanvasRect,TRSChartAxis,TRSChartAxis)
Draws the specified axes to the Canvas (Inherited from RSChartPanel.TRSCustomChart.)
DrawGlyph(TCanvas,TCanvasRect)
Overloaded. Represents method DrawGlyph(TCanvas,TCanvasRect). (Inherited from RSChartPanel.TRSCustomChart.)
DrawGlyph(TCanvas,TRSChartValue,TCanvasRect)
Represents method DrawGlyph(TCanvas,TRSChartValue,TCanvasRect). (Overrides RSCharts.TRSCustomPointChart.DrawGlyph(TCanvas,TRSChartValue,TCanvasRect).)
Calls the OnDrawing event and returns True if the draw process should continue.
This method is called before the InternalDraw method.
DrawLabel(TCanvas,String,TCanvasPixel,TCanvasPixel,Single)
Overloaded. Draws the text caption centered above the X, Y point without clipping.
Note |
---|
The Opacity is ignored in VCL |
DrawLabel(TCanvas,String,TCanvasRect,Single)
Overloaded. Draws the text caption centered within the rectangle. The text is clipped
Note |
---|
The Opacity is ignored in VCL |
DrawLabel(TCanvas,TRSChartValue,TCanvasPixel,TCanvasPixel)
Overloaded. Draws the text caption centered above the X, Y point without clipping.
Note |
---|
The Opacity is specified by the RSChartPanel.TRSChartValue.Opacity property |
DrawLabel(TCanvas,TRSChartValue,TCanvasRect)
Draws a label for the TRSChartValue on the canvas. The text of the label is controlled by the ValueLabelStyle property.
The label is drawn within the specified rectangle.
Note |
---|
The Opacity is specified by the RSChartPanel.TRSChartValue.Opacity property |
DrawLine(TCanvas,TCanvasRect,Boolean)
Overloaded. Draws the entire line for the chart. The method calls other methods depending on the LineStyle. (Inherited from RSCharts.TRSCustomLineChart.)
DrawLine(TCanvas,TRS2DChartValue,TCanvasRect,TCanvasPixel,TCanvasPixel,Boolean)
Overloaded. Draws the line for the line segment (from last point value to this point value) (Inherited from RSCharts.TRSCustomLineChart.)
DrawLink(TCanvas,TCanvasRect,TRSGraphChartValue,TRSGraphChartLink)
Draw one link
DrawLinks(TCanvas,TCanvasRect,TRSGraphChartValue)
Draw all the links from the input TRSGraphChartValue to other nodes
Calls the OnDraw event.
This method is called after the InternalDraw method.
DrawPoint(TCanvas,TCanvasRect,TRSPointChartValue)
Draws one point at the specified rectangle (Inherited from RSCharts.TRSCustomPointChart.)
DrawShape(TCanvas,TCanvasRect,TRSShapeChartValue)
Draws one shape at the specified rectangle (Overrides RSCharts.TRSCustomShapeChart.DrawShape(TCanvas,TCanvasRect,TRSShapeChartValue).)
DrawSmoothline(TCanvas,TCanvasRect,Boolean)
Draws the smooth line for the entire values collection (i.e., the LineStyle is lsCurveInterpolation or lsCurveApproximation). If the LineStyle is lsCurveInterpolation, it uses the DrawSmoothSegment method for each segment of the line. (Inherited from RSCharts.TRSCustomLineChart.)
DrawSmoothSegment(TCanvas,TRS2DChartValue,TCanvasPoint,TCanvasPoints,Boolean)
Draws a smooth line segment using the SegmentPoints. The Line is assumed to touch all the segment points (i.e., the LineStyle is lsCurveInterpolation) (Inherited from RSCharts.TRSCustomLineChart.)
Re-enables screen repainting and change events. Use EndUpdate to re-enable screen repainting and change events that were turned off with the BeginUpdate method. (Inherited from RSChartPanel.TRSCustomChart.)
FormatValue(TRSChartValue,TRSLabelTextStyle)
Generates a label for the Value based on the TextStyle (Inherited from RSChartPanel.TRSCustomChart.)
Returns the vertical offset ( OffsetVertical).
If coUseVerticalOffset is not in Options, this method always returns 0. If coUseVerticalOffset is in Options, the function returns the OffsetVertical value.
GetAxisCaption(TRSChartAxis,Integer,TRSChartValueType)
Returns a label for an axis ( RSChartPanel.TRSChartAxis ) based on the input Value. The Index specifies where to start looking in the chart Values (for optimization purposes) and decrements from there until the closest chart value is found. (Inherited from RSChartPanel.TRSCustomChart.)
Returns the chart type enumerated value for this class. Each chart class overrides this class function to return the RSChartConsts|TRSChartType enumerated value (Overrides RSCharts.TRSCustomShapeChart.GetChartType.)
Represents method GetColor. (Overrides RSChartPanel.TRSCustomChart.GetColor.)
Overloaded. Returns the color of the chart value. The color of the TRSChartValue can change depending on the Options property as well as any other chart states (e.g., the TRSCandleStickChart class overrides this method to turn the color red or green depending on if the Open value is greater than the Closing Value) (Inherited from RSChartPanel.TRSCustomChart.)
GetCumulativeTotal(Integer,Integer,TRSCustomChartClass)
Determine the cumulative value at this index for all charts in the Group. The ValIndex specifies the TRSChartValue.Values dimension to compare.
Used for stacking charts.
GetCumulativeValue(Integer,Integer,TRSCustomChartClass)
Determine the cumulative value at this index for all charts below (spatially) this chart in the same Group. The ValIndex specifies the TRSChartValue.Values dimension to compare.
Used for stacking charts.
Represents method GetGroupDimension. (Inherited from RSChartPanel.TRSCustomChart.)
GetPoints(TCanvasPoint,TCanvasPoint,TCanvasRect)
Returns an array of points from StartPoint to EndPoint based on the LineStyle and LineChartElements (Inherited from RSCharts.TRSCustomLineChart.)
GetShapeRect(TCanvasRect,TRSShapeChartValue)
Represents method GetShapeRect(TCanvasRect,TRSShapeChartValue). (Inherited from RSCharts.TRSCustomShapeChart.)
Returns a new chart color based on the ChartColorScheme and ChartColorList. Every time a chart is created, it is assigned a new color from the current ChartColorList. (Inherited from RSChartPanel.TRSCustomChart.)
Initialize the OnChange events of structures. Use this method to assign event handlers for structures (e.g., Pen.OnChange := MyChangeMethod).
Notes to Inheritors |
---|
The constructor calls this method after it calls the InitializeChart method, which is where the structures should be actually created and initialized. |
Creates and initialize structures and values of chart. This method is the safe place to initialize chart values without change events occurring.
Notes to Inheritors |
---|
The constructor calls this method. Use this method to actually create and initialize properties. Do not assign event properties in this method (use the InitializeChangeEvents method instead) |
InternalDraw(TCanvas,TCanvasRect)
Overloaded. Paints the chart graphic to the specified canvas at the specified rectangle. The InternalDraw method is called by the Draw method.
Descendant classes of TRSCustomChart override the InternalDraw method to actually paint themselves.
Notes to Inheritors |
---|
The default InternalDraw method implementation assigns the Brush, Pen , and Font to the Canvas. |
InternalSelect(TCanvasRect,TRSChartSelectionAction)
Selects or deselects chart Values ( RSChartPanel.TRSChartValue ) based on whether they intersect with the selection rectangle (which is in pixel coordinates).
The base method converts the SelectionRect to chart coordinates (based on HorizontalAxis and VerticalAxis) and then selects values based on the TRSChartValue.Selectable method
Returns True if any value in the chart intersects with the SelectionRect (Inherited from RSChartPanel.TRSCustomChart.)
Represents method IsValuesStored. (Inherited from RSChartPanel.TRSCustomChart.)
Indicates whether the chart is visible. A chart is visible if its Visible property is True and both axes have been assigned. (Inherited from RSChartPanel.TRSCustomChart.)
LevelChanged(TRSGraphChartValue)
Represents method LevelChanged(TRSGraphChartValue).
LinksNotify(TRSGraphChartLink,TCollectionNotification)
Represents method LinksNotify(TRSGraphChartLink,TCollectionNotification).
LinksUpdate(TRSGraphChartLink)
Represents method LinksUpdate(TRSGraphChartLink).
Represents method Loaded. (Inherited from RSChartPanel.TRSCustomChart.)
Represents method MouseHover(TCanvasRect). (Inherited from RSChartPanel.TRSCustomChart.)
Notification(TComponent,TOperation)
Represents method Notification(TComponent,TOperation). (Overrides RSChartPanel.TRSCustomChart.Notification(TComponent,TOperation).)
Represents method OrientationChanged.
Represents method Paint. (Inherited from RSChartPanel.TRSCustomChart.)
Represents method PanelChanged. (Inherited from RSChartPanel.TRSCustomChart.)
Represents method RSVisibleChanged. (Inherited from RSChartPanel.TRSCustomChart.)
SaveCanvasResources(TCanvas,TBrush,TRSPen,TFont)
Represents method SaveCanvasResources(TCanvas,TBrush,TRSPen,TFont). (Inherited from RSChartPanel.TRSCustomChart.)
Select(TCanvasRect,TRSChartSelectionAction)
Selects or deselects chart Values ( RSChartPanel.TRSChartValue ) based on whether they intersect with the selection rectangle (which is in pixel coordinates).
The base method converts the SelectionRect to chart coordinates (based on HorizontalAxis and VerticalAxis) and then selects values based on the TRSChartValue.Selectable method
Notes to Inheritors |
---|
Descendant classes override the InternalSelect method |
Represents method SelectionColorChanged. (Inherited from RSChartPanel.TRSCustomChart.)
Overloaded. Represents method SenderChanged(TObject). (Inherited from RSChartPanel.TRSCustomChart.)
SetCanvasResources(TCanvas,TBrush,TRSPen,TFont,Boolean,Boolean)
Overloaded. Represents method SetCanvasResources(TCanvas,TBrush,TRSPen,TFont,Boolean,Boolean). (Inherited from RSChartPanel.TRSCustomChart.)
SetCanvasResources(TCanvas,TRSChartValue,Boolean,Boolean)
Represents method SetCanvasResources(TCanvas,TRSChartValue,Boolean,Boolean). (Overrides RSCharts.TRSCustomPointChart.SetCanvasResources(TCanvas,TRSChartValue,Boolean,Boolean).)
Represents method SetColor(TCanvasColor). (Overrides RSChartPanel.TRSCustomChart.SetColor(TCanvasColor).)
Represents method SetOptions(TChartOptions). (Overrides RSChartPanel.TRSCustomChart.SetOptions(TChartOptions).)
Represents method UpdateAxisInfo(TRSChartAxis). (Overrides RSChartPanel.TRSCustomChart.UpdateAxisInfo(TRSChartAxis).)
Updates the values to the current color scheme. If PanelColorScheme is True then uses the Panel's color scheme (Inherited from RSChartPanel.TRSCustomChart.)
ValueNotify(TRSChartValue,TCollectionNotification)
Represents method ValueNotify(TRSChartValue,TCollectionNotification). (Inherited from RSCharts.TRSCustomShapeChart.)
ValueSelectionChanged(TRSChartValue)
Represents method ValueSelectionChanged(TRSChartValue). (Inherited from RSChartPanel.TRSCustomChart.)
ValueVisibleChanged(TRSChartValue)
Represents method ValueVisibleChanged(TRSChartValue). (Inherited from RSChartPanel.TRSCustomChart.)
Returns true if the chart prefers Captions over Values for its labels on the input Axis. This method provides a hint to the TRSChartAxis when LabelStyle is alsAutomatic. (Inherited from RSChartPanel.TRSCustomChart.)
|
In the Create New Chart Types Tutorial, we discuss how we created the graph chart. You should check it out for tips on building charts in general and the graph chart in particular. |
To display a chart, you drop the component on a form and optionally connect its Panel property to the RSChartPanel.TRSChartPanel component where you want it to be displayed. The Values property is the most important property of the chart type and allows you to define the chart values at design-time or run-time. For the Graph Chart, the Values property contains TRSGraphChartValue collection items which define the node of a graph and contains the links (TRSGraphChartLink) from that node to other nodes. To display a graph chart inside a chart panel: • Drop a TRSGraphChart component on a form • Drop a TRSChartPanel component where you want the chart to be displayed. (Note, more than one chart can share the same chart panel) • Connect the Panel property of the chart to the chart panel |
To add a node to the chart (at Design-Time):
• Select the TRSGraphChart component • Click the ellipsis button (...) for the Values property of the chart. This action displays Delphi's Collection Editor for the TRSGraphChartValues collection. • Use the Add button to add nodes (TRSGraphChartValue collection item) to the chart. • Edit the properties for the node • After you have added nodes, you can add links between the nodes |
To add a node to the chart (at Run-Time):
Delphi |
---|
var |