This is a migrated thread and some comments may be shown as answers.

Customized Yaxis range

1 Answer 12 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Kurt Kluth
Top achievements
Rank 1
Kurt Kluth asked on 30 Jul 2015, 09:40 PM

Is it possible to customize the range that is displayed on my Yaxis?  If the recordset populating the chart has numbers from 75,000,000 - 85,000,000, I don't want to start at 0 but say have my range be 65,000,000 - 95,000,000.  But the range can change based upon the data being returned.  It would be nice to have my range be 10% of the minimum value and maximum value.  Something else is that my values returned may also be a percentage. 

 Also on my Xaxis I will be displaying dates.  How do I only show the labels where the month is a quarter end (3, 6, 9, 12)?

 Thanks

1 Answer, 1 is accepted

Sort by
0
Kurt Kluth
Top achievements
Rank 1
answered on 31 Jul 2015, 07:52 PM

I have solved my own problem.  Within SQL returned Min & Max values

MIN(' + cast(@field as nvarchar(50)) + ') OVER (PARTITION BY acct_Num) AS MinValue,
Max(' + cast(@field as nvarchar(50)) + ') OVER (PARTITION BY acct_Num) AS MaxValue

Dim percentage As Double = 0.1D    '10%
Dim currentValue As Double                   
RadHtmlChart1.PlotArea.YAxis.LabelsAppearance.DataFormatString = "{0:p2}"
                    RadHtmlChart1.PlotArea.CommonTooltipsAppearance.DataFormatString = "{0:p2}"
                    If Double.TryParse(dr("Minvalue"), Globalization.NumberStyles.Number, Nothing, currentValue) Then
                        If dr("MinValue") < 0 Then
                            percentage = 1.5D
                            currentValue -= dr("Minvalue") * percentage
                        Else
                            'Add 10% of the value to it
                            currentValue -= dr("Minvalue") * percentage
                        End If
                        RadHtmlChart1.PlotArea.YAxis.MinValue = currentValue.ToString
                    End If
 
                    If Double.TryParse(dr("MaxValue"), Globalization.NumberStyles.Number, Nothing, currentValue) Then
                        'Add 10% of the value to it
                        currentValue += dr("MaxValue") * percentage
                        RadHtmlChart1.PlotArea.YAxis.MaxValue = currentValue.ToString
                    End If

Solved Xaxis problem by setting BaseUnits to "Years"

 

 

 

 

 

Tags
Chart (HTML5)
Asked by
Kurt Kluth
Top achievements
Rank 1
Answers by
Kurt Kluth
Top achievements
Rank 1
Share this question
or