Hide Comments
Hide Comments

Comments (0)

Specifies the RSChartPanel.TRSChartAxis object that the chart is bound to for the horizontal (X) axis. This axis controls the range of values that will be drawn for the chart. The chart uses this axis to convert its internal    Values into pixel values and vice versa.

You should never directly convert the chart's values to canvas coordinates, use the chart's    HorizontalAxis and    VerticalAxis to call the    AxisToPixel method. A chart's values are consistent with the chart only and have nothing to do with the canvas. These values specify chart graphical elements in floating point format and ignore any visual issues, such as is the chart zoomed. Every chart is bound to a horizontal axis (top or bottom) and vertical axis (left or right) of the chart panel. The axes are responsible for tracking if the view is zoomed, what are the min and max values etc. Call the AxisToPixel method to convert your chart value into the correct canvas value.

Namespace: RSChartPanel



  property HorizontalAxis: TRSChartAxis read FHorizontalAxis write SetHorizontalAxis stored IsAxisStored;

Property Value

Type: TRSChartAxis


The following example shows the DrawLink method of the TRSShapeChart class. This class uses the HorizontalAxis and VerticalAxis to convert its values from its internal format to canvas pixel coordinates:


procedure TRSGraphChart.DrawLink(const Canvas: TCanvas; ARect: TRect;
   Link: TRSGraphChartLink);
    ShapeRect: TRect;
    LinkPoint: TPoint;
    OriginPoint: TPoint;
    Points: TPoints;
    i: Integer;
      // first, translate the shape's arect to this arect
      ShapeRect := GetShapeRect( ARect, Link.Collection.Owner );
      OriginPoint := GetPointOnRect( ShapeRect, Link.ConnectionPoint );
      ShapeRect := GetShapeRect( ARect, Link.Value );
      LinkPoint := GetPointOnRect( ShapeRect, Link.ValueConnectionPoint );
      // draw arrow from bottom of shape to top of link shape
      if Length(Link.LinePoints) > 0 then
           SetLength(Points, Length(Link.LinePoints) + 2);
           Points[0] := OriginPoint;
           for i := 0 to Length(Link.LinePoints) - 1 do
               Points[i+1] := Point( HorizontalAxis.AxisToPixel(Link.LinePoints[i].X, ARect),
                                     VerticalAxis.AxisToPixel(Link.LinePoints[i].Y+GetAdjOffsetVertical, ARect) );
           Points[Length(Points)-1] := LinkPoint;
           DrawArrow( Canvas, Points, 10, Link.Caption );
          DrawArrow( Canvas, OriginPoint.X, OriginPoint.Y, LinkPoint.X, LinkPoint.Y,
                     10, Link.Caption );

expandingSee Also

Comments (0)

RiverSoftAVG Charting Component Suite (RCCS) © 2005-2015, Thomas G. Grubb