How to hide Axes lines/labels?

Sep 26, 2014 at 2:23 PM
I was wondering how to hide the Axis lines or labels. I figured it'd be something simple like using a setter and then setting the value as Transparent or 0 or something along the lines. I'm just not sure what exact value I'd be doing it on though. I can't seem to find it in the source.

Thanks!
Nov 12, 2014 at 5:20 PM
I am looking for this solution as well. I would like to be able to hide the numbering on the vertical axis of a column chart.
Nov 12, 2014 at 9:28 PM
I'm not certain if you were referring to the left numbers on the axis, but that's what I was going for. If not, you may be able to modify my solution to achieve your goal.

First, I added a dependency property to ChartBase.cs:
        public static readonly DependencyProperty ChartLeftNumbersVisibilityProperty =
            DependencyProperty.Register("ChartLeftNumbersVisibility", typeof(Visibility), typeof(ChartBase), new PropertyMetadata(Visibility.Visible));

        public Visibility ChartLeftNumbersVisibility
        {
            get { return (Visibility)GetValue(ChartLeftNumbersVisibilityProperty); }
            set { SetValue(ChartLeftNumbersVisibilityProperty, value); }
        }
Then, I added a visibility binding in Generic.xaml for the "LeftLines" grid in the "ColumnChartAreaStyle":
    <Style x:Key="ColumnChartChartAreaStyle" TargetType="local:ChartArea">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ChartArea">
                    <Grid>
                        ...
                        <Grid x:Name="LeftLines" Grid.Column="0" Grid.Row="0" Visibility="{Binding Path=ParentChart.ChartLeftNumbersVisibility, RelativeSource={RelativeSource Mode=TemplatedParent}}">
                            ...
                         </Grid>
                         ...
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
When you change Generic.xaml, make sure you change the one contained in De.TorstenMandelKow.MetroChart. If you change it in one of the sub-projects (e.g. ".WPF") I found that it will overwrite your changes with the base Generic.xaml before compiling.

Then, in my project xaml:
        <chart:ClusteredColumnChart 
                ... 
                ChartLeftNumbersVisibility="Collapsed">
Hope that helps.