demo
demo

Reputation: 6235

Remove marks on X-Axis

I use WPF toolKit to draw chart. I bind List<KeyValuePair<string,int>> to chart DataContext - as result i get chart with LineSeries. But on X-Axis there are some marks (what i mean - just small lines on Axis).

<chartingToolkit:LineSeries DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding}" DataContext="{Binding}" Margin="5.5,0,0,3"/>

When i specify X-Axis like

 <chartingToolkit:Chart.Axes>
                            <chartingToolkit:LinearAxis Orientation="X">
                                <chartingToolkit:LinearAxis.MajorTickMarkStyle>
                                    <Style TargetType="Line">
                                        <Setter Property="Stroke" Value="#bdb3ce" />
                                        <Setter Property="StrokeThickness"  Value="0" />
                                        <Setter Property="X1"   Value="-4" />
                                        <Setter Property="X2"  Value="4" />
                                    </Style>
                                </chartingToolkit:LinearAxis.MajorTickMarkStyle>
                            </chartingToolkit:LinearAxis>
                        </chartingToolkit:Chart.Axes>

it doesn't help, marks still on Axis.

How to remove that marks?

Upvotes: 0

Views: 937

Answers (1)

demo
demo

Reputation: 6235

I found solution on msdn forum.

I need specify my X-Axis as <chartingToolkit:LineSeries.IndependentAxis> and add Style to my Axis like :

<chartingToolkit:CategoryAxis Orientation="X" MajorTickMarkStyle="{StaticResource ChartMajorTickMarkStyle}"/>

where ChartMajorTickMarkStyle is next :

<Style x:Key ="ChartMajorTickMarkStyle" TargetType="Line">
    <Setter Property="Visibility" Value="Collapsed" />
</Style>

NOTE : I set style to CategoryAxis - I don't know why but when I set style to LinearAxis I get exception about problems with binding. I work with LineSeries, so I supposed to set style to LinearAxis but...

Upvotes: 1

Related Questions