how to draw/have two scales in one chart ...?

TeeChart for ActiveX, COM and ASP
Post Reply
Aravind
Newbie
Newbie
Posts: 75
Joined: Fri Nov 15, 2002 12:00 am

how to draw/have two scales in one chart ...?

Post by Aravind » Wed Aug 16, 2006 8:48 am

i would like to have a two scales in one chart .. i.e.

left axis :scale 1-10000
right axis: 0.1%-100%

series 1-5 need to use left axis and series 6-10 must use the right axis


how can i achieve this ? how can i set the scales and point the corresponding series to axis ... .

if you have example pls send me

thanks
aravind

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Aug 16, 2006 11:01 am

Hi Aravind,

you can do :

Code: Select all

Private Sub Form_Load()
TeeCommander1.Chart = TChart1
For i = 0 To 9
Randomize
    TChart1.AddSeries scLine
    TChart1.Series(i).AddXY 0, 1000, "", clTeeColor
    TChart1.Series(i).AddXY 1, 3000, "", clTeeColor
    TChart1.Series(i).AddXY 2, 5000, "", clTeeColor
    TChart1.Series(i).AddXY 3, 8000, "", clTeeColor
    TChart1.Series(i).AddXY 4, 10000, "", clTeeColor
    
Next i
For i = 0 To 4
    TChart1.Series(i).VerticalAxis = aLeftAxis
Next i
For i = 5 To 9
Randomize
    TChart1.Series(i).VerticalAxis = aRightAxis
Next i
TChart1.Axis.Left.SetMinMax 0, 10000
TChart1.Axis.Right.SetMinMax 0, 10000
TChart1.Axis.Right.Labels.ValueFormat = "#####.##"

End Sub

Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
Dim v As Double
If Axis = 2 Then
     v = Val(LabelText) / 100
     LabelText = Str(v) + " %"
End If
End Sub

Post Reply