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

MIsalignment of Primary and Secondary Y-Axis

1 Answer 69 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ralph
Top achievements
Rank 1
Ralph asked on 02 Sep 2010, 09:12 PM
Good morning to all

I am having a problem using a second Y Axis where I wish them both to start from zero and be labeled as such. I did this post this as a reply to this message:  http://www.telerik.com/community/forums/silverlight/chart/how-to-line-up-multi-y-axis-0-level.aspx  but I failed to note that it was answered already. I did attempt to follow the instructions there but to no avail with the chart that I am getting still looking like the attached image...

Note that the tool tip for the line series is showing $0 which is the correct amount for that time point afetr the payment of $178.09 dollars has occurred as seen in the 'Payment Schedule' seen to the right in the picture.
The chart is declared in the XAML as follows:

<telerik:RadChart x:Name="myChart"
                  Width="300"
                  Margin="0 10 0 10"
                  Height="300"
                  UseDefaultLayout="False"
                  telerik:StyleManager.Theme="Windows7"
                  Visibility="Collapsed">
    <Grid ShowGridLines="False">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <telerik:ChartTitle Content="Payments and Balances"
                            Grid.Row="0"
                            telerik:StyleManager.Theme="Windows7" />
        <telerik:ChartArea x:Name="ChartArea1"
                           LegendName="ChartLegend1"
                           Grid.Row="1"
                           Padding="2 2 2 2"
                           Height="230"
                           Width="250"
                           telerik:StyleManager.Theme="Windows7" />
 
    </Grid>
</telerik:RadChart>

And populated by code as follows:
Dim barSeries As DataSeries = GetPaymentSeriesForChart()
 
barSeries.LegendLabel = "Payments"
barSeries.Definition = New BarSeriesDefinition
barSeries.Definition.ShowItemLabels = False
barSeries.Definition.ShowItemToolTips = True
barSeries.Definition.ItemToolTipFormat = "#Y{C0}"
 
Dim lineSeries As DataSeries = GetBalanceSeriesForChart()
 
lineSeries.LegendLabel = "Balance"
lineSeries.Definition = New LineSeriesDefinition
lineSeries.Definition.ShowItemLabels = False
lineSeries.Definition.ShowItemToolTips = True
lineSeries.Definition.ItemToolTipFormat = "#Y{C0}"
 
lineSeries.Definition.AxisName = "Balance"
 
ChartArea1.AxisX.AutoRange = True
ChartArea1.AxisX.DefaultLabelFormat = "MMM-yy"
ChartArea1.AxisX.LabelRotationAngle = -90
 
ChartArea1.AxisY.AutoRange = False
ChartArea1.AxisY.DefaultLabelFormat = "#VAL{C0}"
ChartArea1.AxisY.LabelRotationAngle = -30
ChartArea1.AxisY.AddRange(0, _paymentMax, GetYScale(_paymentMax, 5))
 
ChartArea1.AdditionalYAxes.Clear()
ChartArea1.AdditionalYAxes.Add(New AxisY())
ChartArea1.AdditionalYAxes(0).AxisName = "Balance"
ChartArea1.AdditionalYAxes(0).DefaultLabelFormat = "#VAL{C0}"
ChartArea1.AdditionalYAxes(0).LabelRotationAngle = 30
ChartArea1.AdditionalYAxes(0).AutoRange = False
Try
    ChartArea1.AdditionalYAxes(0).AddRange(0, CDbl(txtBxAmntOwing.Text) * 1.1, GetYScale(CDbl(txtBxAmntOwing.Text) * 1.1, 5))
Catch ex As Exception
 
End Try
 
ChartArea1.DataSeries.Clear()
ChartArea1.DataSeries.Add(barSeries)
ChartArea1.DataSeries.Add(lineSeries)

Note that I am trying to have both Y-Axes have $0 as their starting minimum value. It would seem that the values on the chart are correct when checked by showing the tooltips for the datapoints but the additional Y-Axis (on the right) ends up with the wrong values.

Any thoughts on what I am doing wrong would be most appreciated.

Regards

Ralph Price

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 06 Sep 2010, 12:18 PM
Hi Ralph,

Please, find my answer in the other forum thread.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Ralph
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or