Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
Multiple Y-axes in code behind
posted

Hi,

I'm trying to put two series with very different Y ranges on the same chart and I need multiple Y-axes. I must create the charts dynamically in code so xaml is of no help. I cant seem to get the second series to associate to the secondary Y axis properly. I've tried setting the Series.AxisY =Axis.Name="Y2"  but no luck. Both series render with the range set by the primary Y axis. Can I see some working code for this? I just dont see what I'm doing wrong...

Also, setting the axisY/axis.Name pair for the primary Y axis caused both axes to disappear, is this a bug? I'm also seeing buggy behavior with AutoRange=true in all cases.

Thanks,

Daniel

 

 

  • 28496
    Offline posted

    try this:

     

                y1.SetValue(FrameworkElement.NameProperty, "Y1");
                y2.SetValue(FrameworkElement.NameProperty, "Y2");