Search code examples
silverlightxamlsilverlight-toolkit

Setting the IndependentRangeAxis in XAML for chart with multiple series and two Y axis


In my chart I have defined three axes, one X and two Y.

<Axis x:Name="PercentageAxis" Orientation="Y" [...] /> 
<Axis x:Name="NormalAxis" Orientation="Y"[...] />
<Axis [...] />

And several series.

<LineSeries .... />
<LineSeries .... />
<LineSeries .... />
<LineSeries .... />

I would like to be able to assign a series to a specific Axis like so:

<LineSeries DependentRangeAxis='PercentageAxis' [...] />

because most of the series will be plotted against the normal Y axis while only a few will be plotted against the percentage axis. How do I do this binding in XAML?


Solution

  • Use Element name binding, in your example you would use:-

     <LineSeries DependentRangeAxis="{Binding ElementName=PercentageAxis}" [...] />
    

    BTW, Your Axis are actually LinearAxis though and are listed in the charts Axes property right?