Page 1 of 1

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

Posted: Wed Aug 16, 2006 8:48 am
by 6925851
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

Posted: Wed Aug 16, 2006 11:01 am
by Pep
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