Binding visibility of Axis

2 posts, 0 answers
  1. stijn Ver Eecke
    stijn Ver Eecke avatar
    10 posts
    Member since:
    May 2010

    Posted 22 Sep 2011 Link to this post

    hi,

    I am using an Chart with more then one Y-Axis ( multiple data on chart).
    I want the user to choose what data to see ( bij checking checkboxes).
    When toggling a checkbox the correspondent  Data-Series and Y-Axis should be collapsed ( invisible) .
    This works for all the DataSeries,
    This works fine for the Main Y-Axis, but does not work for the 'Additional Axis' ) ->

    Cannot find governing FrameworkElement or FrameworkContentElement for target element.

    code :
     

    <telerik:RadChart.DefaultView>
                               <telerik:ChartDefaultView ChartLegendPosition="Top">
                                   <telerik:ChartDefaultView.ChartArea>
                                       <telerik:ChartArea x:Name="chartarea" Padding="5,10,20,5" LegendName="legend">
                                           <telerik:ChartArea.AxisX>
                                               <telerik:AxisX DefaultLabelFormat="ddd dd.MM"/>
                                           </telerik:ChartArea.AxisX>
                                           <telerik:ChartArea.AxisY>
                                               <!--<telerik:AxisY Title="Temperatuur (°C)" AxisName="Temperatuur" MinValue="34" MaxValue="44" ExtendDirection="Smart"/>-->
                                               <telerik:AxisY Title="Temperatuur (°C)" AxisName="Temperatuur" MinValue="0" MaxValue="80" Step="10" ExtendDirection="Smart"
                                                   Visibility="{Binding Path=IsChecked,ElementName=checkboxViewSeriesTemp, Converter={StaticResource _BooleanToVisibilityYAxisConverter}}">
                                                   <telerik:AxisY.AxisStyles>
                                                       <telerik:AxisStyles AxisLineStyle="{StaticResource AxisLineStyleTemp}"
                                                                   TickLineStyle="{StaticResource MajorTickLineStyleTemp}"
                                                                   MinorTickLineStyle="{StaticResource MinorTickLineStyleTemp}"
                                                                   ItemLabelStyle="{StaticResource CustomLabelTemp}"/>
                                                   </telerik:AxisY.AxisStyles>
                                               </telerik:AxisY>
                                           </telerik:ChartArea.AxisY>
                                           <telerik:ChartArea.AdditionalYAxes>
                                               <telerik:AxisY  AxisName="Gewicht" Title="Gewicht (Kg)" MinValue="0" MaxValue="200" Step="5" ExtendDirection="Smart"
                                                   Visibility="{Binding Path=IsChecked,ElementName=checkboxViewSeriesTemp, Converter={StaticResource _BooleanToVisibilityYAxisConverter}}">                                                
                                                   <telerik:AxisY.AxisStyles>
                                                       <telerik:AxisStyles AxisLineStyle="{StaticResource AxisLineStyleGewicht}"
                                                                   TickLineStyle="{StaticResource MajorTickLineStyleGewicht}"
                                                                   MinorTickLineStyle="{StaticResource MinorTickLineStyleGewicht}"
                                                                   ItemLabelStyle="{StaticResource CustomLabelGewicht}"/>
                                                   </telerik:AxisY.AxisStyles>
                                               </telerik:AxisY>
                                               <telerik:AxisY  AxisName="Pijn" Title="Pijn (Vas)" MinValue="0" MaxValue="10" Step="1" ExtendDirection="Smart"
                                                   Visibility="{Binding Path=IsChecked,ElementName=checkboxViewSeriesPijn, Converter={StaticResource _BooleanToVisibilityYAxisConverter}}">
                                                   <telerik:AxisY.AxisStyles>
                                                       <telerik:AxisStyles AxisLineStyle="{StaticResource AxisLineStylePijn}"
                                                                       TickLineStyle="{StaticResource MajorTickLineStylePijn}"
                                                                       MinorTickLineStyle="{StaticResource MinorTickLineStylePijn}"
                                                                       ItemLabelStyle="{StaticResource CustomLabelPijn}"/>
                                                   </telerik:AxisY.AxisStyles>
                                               </telerik:AxisY>
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 27 Sep 2011 Link to this post

    Hi Stijn Ver Eecke,

    There is an online sample that demonstrates similar functionality as the one you are looking for. I have modified its code to include a secondary Y-axis and everything works as expected. Please take a look at the attached application and try to run it in your environment. If you encounter any problem with it I will be happy to assist you.

    Greetings,
    Yavor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top