Hello,
I am trying to use the maxvisibleseriesvalue to calculate a max and min for the chart axis based only on the visible series.
When I call the function, for example:
ymax=tchart1.axis.right.maxvisibleseriesvalue(true,0)
I get an error:
Run-time error '-2147418113 (8000ffff)
range check error.
Is there a different way to do this?
(I am using activex v7 and the series are line plots with XY coords)
thanks
maxvisibleseriesvalue
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hello qanta,
or
Yes, the default axes settings already behaves like that. You just have to leave them setted to Automatic as in the code below or using the chart editor (right-click on the chart and select edit).Is there a different way to do this?
Code: Select all
TChart1.Axis.Left.Automatic = True
Code: Select all
TChart1.Axis.Left.AutomaticMaximum = True
TChart1.Axis.Left.AutomaticMinimum = True
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Hi, thanks for the reply (that was quick!)
I have turned the automatic scaling off, because I like to add 10% of space above and below the max and min points in graph. So I am trying to find the max and min visible values in the graph in order to do this.
Am I using the wrong parameters for maxvisibleseriesvalue? (the help file says the second parameter is ignored if the 1st is set to true)
thanks
I have turned the automatic scaling off, because I like to add 10% of space above and below the max and min points in graph. So I am trying to find the max and min visible values in the graph in order to do this.
Am I using the wrong parameters for maxvisibleseriesvalue? (the help file says the second parameter is ignored if the 1st is set to true)
thanks
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi qanta,
You're welcome !
Hi, thanks for the reply (that was quick!)
You're welcome !
Ah, ok, now I understand what you want. Then you'd better use axes offset properties like in the code snippet below. First turn axes to automatic again, then you have to force chart drawing (using InternalRepaint method) to apply correctly axes offset from the beginning. Finally you can implement the offsetting in the OnAfterDraw event as:I have turned the automatic scaling off, because I like to add 10% of space above and below the max and min points in graph. So I am trying to find the max and min visible values in the graph in order to do this.
Code: Select all
Private Sub Form_Load()
For i = 0 To TChart1.SeriesCount - 1
TChart1.Series(i).FillSampleValues 10
Next i
TChart1.Environment.InternalRepaint
End Sub
Private Sub TChart1_OnAfterDraw()
Dim offset As Double
offset = (TChart1.Axis.Left.Maximum - TChart1.Axis.Left.Minimum) * 0.1
TChart1.Axis.Left.MinimumOffset = offset
TChart1.Axis.Left.MaximumOffset = offset
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |