TeeChart for ActiveX, COM and ASP
-
Rousseau
- Newbie
- Posts: 31
- Joined: Fri Oct 13, 2006 12:00 am
- Location: St-Jean-Port-Joli, Canada
-
Contact:
Post
by Rousseau » Fri May 14, 2010 8:38 pm
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
-
Attachments
-
- axes.JPG (74.84 KiB) Viewed 13055 times
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Mon May 17, 2010 7:15 am
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.
-
Rousseau
- Newbie
- Posts: 31
- Joined: Fri Oct 13, 2006 12:00 am
- Location: St-Jean-Port-Joli, Canada
-
Contact:
Post
by Rousseau » Mon May 17, 2010 1:43 pm
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.
-
Attachments
-
- axes.JPG (46.4 KiB) Viewed 12983 times
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Mon May 17, 2010 1:57 pm
Hi Rousseau,
Have you tried doing it as in the code snippets I posted in my first reply?
Thanks in advance.
-
Rousseau
- Newbie
- Posts: 31
- Joined: Fri Oct 13, 2006 12:00 am
- Location: St-Jean-Port-Joli, Canada
-
Contact:
Post
by Rousseau » Mon May 17, 2010 2:52 pm
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.
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Mon May 17, 2010 3:06 pm
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
-
Rousseau
- Newbie
- Posts: 31
- Joined: Fri Oct 13, 2006 12:00 am
- Location: St-Jean-Port-Joli, Canada
-
Contact:
Post
by Rousseau » Mon May 17, 2010 3:31 pm
Hi,
Sorry, I thought that I could use this properties to set my custom axe at right exactly like the left axis.
Thank you
-
Rousseau
- Newbie
- Posts: 31
- Joined: Fri Oct 13, 2006 12:00 am
- Location: St-Jean-Port-Joli, Canada
-
Contact:
Post
by Rousseau » Mon May 17, 2010 5:36 pm
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