Hide Comments
Hide Comments

TRSChartAxis.AxisToPixel(TRSChartValueType,TCanvasRect) Method

Comments (0)

Converts from the chart value parameter to a pixel coordinate of the specified ChartRect parameter. Based on the    ZoomMinimum and    ZoomMaximum range of the chart axis, this routine converts the parameter value into a pixel coordinate. Unlike the overloaded AxisToPixel method, this method assumes that the visual pixel range of the chart axis is defined by the ChartRect property. The chart axis uses the bounds of the rectangle that apply to its location, e.g., a BottomAxis chart axis would use the ChartRect's Left=ZoomMinimum and Right=ZoomMaximum fields for the calculation (the rectangle is also adjusted if StartPosition and EndPosition properties are not their defaults).

Use one of the AxisToPixel methods anytime you need to convert from internal chart axis coordinates to a visual pixel coordinate. For example, if the chart axis has a zoomed range from 0 to 100 and the ChartRect is Left=150 and Right=500, this function would return:
AxisToPixel( 0 ) = 150
AxisToPixel( 50 ) = 325
AxisToPixel( 100 ) = 500

Use one of the    PixelToAxis methods to convert back from pixel coordinates to chart coordinates.
 

Namespace: FMX.RS.ChartPanel

expandingSyntax

Delphi

public 
  function AxisToPixel( Value: TRSChartValueType; const ChartRect: TCanvasRect ): TCanvasPixel; overload; 
 

Parameters

Value

Type: TRSChartValueType

ChartRect

Type: TCanvasRect

Return Value

Type: TCanvasPixel

expandingExamples

The following code draws a line onto a chart panel and a TPaintBox:

Delphi

begin
   // convert values to pixel coordinates for the chart panel and draw a line
   RSChartPanel1.Canvas.MoveTo(
     RSLineChart1.HorizontalAxis.AxisToPixel( 30 ),
     RSLineChart1.VerticalAxis.AxisToPixel( 10 ) );
   RSChartPanel1.Canvas.LineTo(
     RSLineChart1.HorizontalAxis.AxisToPixel( 10 ),
     RSLineChart1.VerticalAxis.AxisToPixel( 100 ) );
 
   // convert values to pixel coordinates for the paint box and draw a line
   PaintBox1.Canvas.MoveTo(
     RSLineChart1.HorizontalAxis.AxisToPixel( 30, PaintBox1.Canvas.ClipRect ),
     RSLineChart1.VerticalAxis.AxisToPixel( 10, PaintBox1.Canvas.ClipRect ) );
   PaintBox1.Canvas.LineTo(
     RSLineChart1.HorizontalAxis.AxisToPixel( 10, PaintBox1.Canvas.ClipRect ),
     RSLineChart1.VerticalAxis.AxisToPixel( 100, PaintBox1.Canvas.ClipRect ) );
 end;

expandingSee Also

Comments (0)

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