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
45
Toggling Axis on/off
posted

So I want to be able to toggle the x and y axis on and off.

 

It seems that toggling them to visible to false doesn't expand the chart area if you've set the margin manually. This seems like a massive oversight given that WPF provides visibility with Visbile, Hidden and Collapsed.  Why the xamChart doesn't use this I have no idea.

Then when I try to setup a data trigger to adjust the margin in the standard WPF way it doesn't seem to work at all.

<igCA:XamChart DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" Name="MainChart" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"

                        Style="{StaticResource ResourceKey=XamChartStyle1}">

            <igCA:XamChart.Scene>

                <igCA:Scene Style="{StaticResource xamSceneStyle}" >

                    <igCA:Scene.GridArea>

                        <igCA:GridArea x:Name="MainGridArea" MarginType="Percent" Margin="7,3,3,7">

                            <igCA:GridArea.Style>

                                <Style TargetType="{x:Type igCA:GridArea}" >

                                    <Style.Triggers>

                                        <DataTrigger Binding="{Binding Path=LineChartWindow.AxisProp.ShowXAxis}" Value="True" >

                                            <Setter Property="Margin" >

                                                <Setter.Value>

                                                    <Thickness Bottom="3" />

                                                </Setter.Value>

                                            </Setter>

                                        </DataTrigger>

                                    </Style.Triggers>

                                </Style>

                            </igCA:GridArea.Style>

                        </igCA:GridArea>

                    </igCA:Scene.GridArea>

                </igCA:Scene>

            </igCA:XamChart.Scene>

Parents
  • 12875
    posted

    Hi,

     

    What I noticed is that your style is setting the MarginType  in the Scene’s GridArea in your code.

     

    Not having all of your code I set up my style to react to a checkbox on my form and applied that style to the scene.  With my style I was able to reset the MarginType and Margin based on the state of the checkbox.

     

    <igCA:XamChart.Scene   >

         <igCA:Scene Background="Beige" BorderBrush="Red" BorderThickness="2"  Style="{StaticResource percentSceneStyle}">                   

         </igCA:Scene>

    </igCA:XamChart.Scene>

     

    This was the style I created.

    <Style TargetType="{x:Type igCA:Scene}" x:Key="percentSceneStyle" >

        <Style.Triggers>

             <DataTrigger Binding="{Binding ElementName=cbIsPercentScene, Path=IsChecked}" Value="True">

                 <Setter Property="Margin" >

                     <Setter.Value>

                         <Thickness Bottom="10" Top="10" />

                     </Setter.Value>

                 </Setter>                                       

                 <Setter Property=" MarginType" Value="Percent"/>

             </DataTrigger>

             <DataTrigger Binding="{Binding ElementName=cbIsPercentScene, Path=IsChecked}" Value="False">

                 <Setter Property=" MarginType" Value="Auto"/>

             </DataTrigger>

        </Style.Triggers>

    </Style>

     

    I would also eliminate the dockpanel that your scene is embedded in.  The MarginType and Margin cause the scene to reposition itself within the chart’s client area.

     

    There is a description here of the impact of those properties.

    http://help.infragistics.com/NetAdvantage/WPFDV/2011.1/CLR4.0/?page=xamChart_Working_with_the_Chart_Scene.html

     

Reply Children
No Data