Page 1 of 1
Minimum Maximum, Custom Axes
Posted: Fri May 14, 2010 8:38 pm
by 9532689
Hi,
How can I change the Minimum and Maximum value to a custom axes. I tried something but it doesn't work.
Code: Select all
TChart:Series(2):VerticalAxisCustom = TChart:Axis:AddCustom(False).
TChart:Series(2):VerticalAxis = 1.
TChart:Axis:Custom(0):AUTOMATIC = FALSE.
TChart:Axis:Custom(0):MAXIMUM = 50.
TChart:Axis:Custom(0):MINIMUM = 0.
Thank you
Re: Minimum Maximum, Custom Axes
Posted: Mon May 17, 2010 7:15 am
by narcis
Hi Rousseau,
Easiest way is this:
Code: Select all
TChart1.Axis.Custom(0).SetMinMax 0,50
Alternatively you can do this:
Code: Select all
With TChart1.Axis.Custom(0)
.AutomaticMinimum = False
.Minimum = 0
.AutomaticMaximum = False
.Maximum = 50
End With
For more information please read tutorial 4. Tutorials can be found at TeeChart's program group.
Re: Minimum Maximum, Custom Axes
Posted: Mon May 17, 2010 1:43 pm
by 9532689
Hi,
There is an example.
Code: Select all
TChart:Axis:Left:Automatic = FALSE.
TChart:Axis:Left:Minimum = 0.
TChart:Axis:Left:Maximum = 50.
TChart:AddSeries(1).
TChart:AddSeries(6).
TChart:Series(1):Color = RGB-VALUE(0,255,0).
TChart:Series(1):AsFastLine:LinePen:Width = 4.
DO i = 1 TO 10:
TChart:Series(0):Add(i * 2,STRING(i * 2),RGB-VALUE(0,0,255)).
TChart:Series(1):Add(i ,STRING(i ),RGB-VALUE(0,255,0)).
END.
TChart:Series(1):VerticalAxisCustom = chCtrlFrame:TChart:Axis:AddCustom(False).
TChart:Series(1):VerticalAxis = 1.
TChart:Axis:Custom(0):SetMinMax(0,50).
I don't know why it doesn't set the min and max to my custom axe.
I read the tutorial 4 and tried different way but I wasn't able to set the min max.
Thank you for your help.
Re: Minimum Maximum, Custom Axes
Posted: Mon May 17, 2010 1:57 pm
by narcis
Hi Rousseau,
Have you tried doing it as in the code snippets I posted in my first reply?
Thanks in advance.
Re: Minimum Maximum, Custom Axes
Posted: Mon May 17, 2010 2:52 pm
by 9532689
Hi,
Yes I have tried with the function SetMinMax and set proprieties Automatic = false, Minnimun=0 Maximun=50. I have tried before and after to add data.
I have noticed that I can't set any proprieties to my custom axes for example title, gridpen style, etc.
Re: Minimum Maximum, Custom Axes
Posted: Mon May 17, 2010 3:06 pm
by narcis
Hi Rousseau,
Sorry, I missed the part of the code at the end of your code snippet. I think the problem is this line:
Code: Select all
TChart:Series(1):VerticalAxis = 1.
Removing it works fine for me here, for example:
Code: Select all
Private Sub Form_Load()
TChart1.Axis.Left.Automatic = False
TChart1.Axis.Left.Minimum = 0
TChart1.Axis.Left.Maximum = 50
TChart1.AddSeries 1
TChart1.AddSeries 6
TChart1.Series(1).Color = RGB(0, 255, 0)
TChart1.Series(1).asFastLine.LinePen.Width = 4
For i = 1 To 10#
TChart1.Series(0).Add i * 2, CStr(i * 2), RGB(0, 0, 255)
TChart1.Series(1).Add i, CStr(i), RGB(0, 255, 0)
Next
TChart1.Series(1).VerticalAxisCustom = TChart1.Axis.AddCustom(False)
TChart1.Axis.Custom(0).SetMinMax 0, 50
With TChart1.Axis.Custom(0)
.AxisPen.Color = vbGreen
.Title.Caption = "Extra axis"
.Title.Font.Bold = True
.Title.Angle = 90
.PositionPercent = 50 'percentage of Chart rectangle
End With
End Sub
Re: Minimum Maximum, Custom Axes
Posted: Mon May 17, 2010 3:31 pm
by 9532689
Hi,
Sorry, I thought that I could use this properties to set my custom axe at right exactly like the left axis.
Thank you
Re: Minimum Maximum, Custom Axes
Posted: Mon May 17, 2010 5:36 pm
by 9532689
I used the property OtherSide.
Code: Select all
TChart1.Series(1).VerticalAxisCustom = TChart1.Axis.AddCustom(False)
TChart1.Axis.Custom(0).SetMinMax 0, 50
With TChart1.Axis.Custom(0)
.OtherSide = True
.AxisPen.Color = vbGreen
.Title.Caption = "Extra axis"
.Title.Font.Bold = True
.Title.Angle = 90
'.PositionPercent = 50 'Don't need to use this property if you use otherside
End With
It's perfect. Thank you