Hi,
I have a very basic chart with Dates on the X axis and percentages on the Y axis. I have the scale set to Auto like this:
The chart renders with % values of -5000% to +5000%. Ok, so I understand there is no delta between the min and max so the autoscale doesn't have anything to work with. So I attempted to manually set the scale IF all the values are equal. I did this in the PreRender event. But now, the chart does indeed have the proper manually set min scale %, but the max scale % is not visible. Ideas ?
Thank you !
Paul
I have a very basic chart with Dates on the X axis and percentages on the Y axis. I have the scale set to Auto like this:
<
YAxis
AutoScale
=
"True"
IsZeroBased
=
"false"
>
The chart renders with % values of -5000% to +5000%. Ok, so I understand there is no delta between the min and max so the autoscale doesn't have anything to work with. So I attempted to manually set the scale IF all the values are equal. I did this in the PreRender event. But now, the chart does indeed have the proper manually set min scale %, but the max scale % is not visible. Ideas ?
Protected
Sub
RadChart1_PreRender(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadChart1.PreRender
Dim
TheMinValue
As
Double
Dim
TheMaxValue
As
Double
Dim
TheValue
As
Double
'Loop through each Y value in series 0 and get it's value. We need to get the
'Min and Max values for the entire chart.
'For seriescount As Integer = 0 To RadChart1.Series.Count - 1
For
itemcount
As
Integer
= 0
To
RadChart1.Series(0).Items.Count - 1
TheValue = RadChart1.Series(0).Item(itemcount).YValue
'assign default values in the 1st iteration of the loop
If
itemcount = 0
Then
TheMinValue = TheValue
TheMaxValue = TheValue
End
If
If
TheValue < TheMinValue
Then
TheMinValue = TheValue
If
TheValue > TheMaxValue
Then
TheMaxValue = TheValue
Next
If
TheMinValue = TheMaxValue
Then
'we have a problem because all Y values are equal. This is going to destroy the
'chart scaling along the left hand side.
'The below solution does not seem to work.
RadChart1.Series(0).PlotArea.YAxis.AutoScale =
False
RadChart1.Series(0).PlotArea.YAxis.MinValue = TheMinValue * 0.95
RadChart1.Series(0).PlotArea.YAxis.MaxValue = TheMaxValue * 1.05
RadChart1.Series(0).PlotArea.YAxis.
Step
= 5
Else
RadChart1.Series(0).PlotArea.YAxis.AutoScale =
True
End
If
End
Sub
Paul