IAxis.CustomDraw
IAxis

procedure CustomDraw(APosLabels, APosTitle, APosAxis: Integer; GridVisible: WordBool);

Type Library
TeeChartx

Description
The CustomDraw method displays an Axis at the specified screen positions with the current axis scales.

This method can be used in very special Charting applications, as it involves quite good TeeChart internals knowledge.

For normal charting the TChart class provides two horizontal and two vertical axis that are output to the screen automatically.

This method stores the Axis old positions, draws the Axis and restores the positions again.

The PosLabels, PosTitle and PosAxis parameters determine the Axis Labels, Title and Axis positions.

For horizontal Axis like Axis.Top or Axis.Bottom, these positions are in vertical screen coordinates.

For vertical Axis like Axis.Left or Axis.Right, these positions are in horizontal screen coordinates.

The GridVisible parameter determine if the Axis should draw or not the grid lines from the axis to chart edges.

The Axis is drawn using the current formatting properties such as fonts, ticks and colors.

Example

This example draws 2 new axis in Visual Basic

Private Sub TChart1_OnBeforeDrawSeries()

Dim posaxis As Integer

With TChart1

If .Axis.Left.Maximum > 0 Then

'When scrolling or on zoom always keep the gridlines enclosed

'in the Chart rectangle

.Canvas.ClipRectangle .Canvas.Left, .Canvas.Top, _

(.Canvas.Left + .Canvas.Width), _

(.Canvas.Top + .Canvas.Height)

'Always draw the 2nd vertical Axis at the middle point of the

'Chart

posaxis = (.Canvas.Left) + (.Canvas.Width * 0.5)

.Axis.Left.CustomDraw posaxis - 10, posaxis - 20, _

posaxis, True

'Draw the 2nd Horizontal axis at the level of "10" on the

'vertical axis

posaxis = (.Axis.Left.CalcYPosValue(10))

.Axis.Bottom.CustomDraw posaxis + 10, posaxis + 40, _

posaxis, True

.Canvas.UnClipRectangle

End If

End With

End Sub