Click here to Skip to main content
15,395,181 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The following xaml Line Chart code works great, except it shows the diamonds for each data point on the two line graphs. I do not want to show them. In Forms there is something like LegendItem.ImageStyle but I can't seem to find the System.Windows.Controls.DataVisualization equivalent. Any help is greatly appreciated!


<dvc:Chart Name="Chart1" Title="Test Chart" >
            <dvc:LineSeries Title="Humidity"
                            ItemsSource="{Binding Points, Delay=2500, IsAsync=False}"                              
                            IndependentValueBinding="{Binding ts}"
                            DependentValueBinding="{Binding Humidity}" 
                    <dvc:LinearAxis Orientation="Y" Title="Humidity" 

                    <!-- change the line color to green and set the thickness -->
                    <ControlTemplate TargetType="dvc:LineSeries">
                        <Canvas x:Name="PlotArea">
                            <Polyline x:Name="polyline"
                                          Points="{TemplateBinding Points}"                                           
                                          Style="{TemplateBinding PolylineStyle}"
                                          Stroke="Green" StrokeThickness="0.1" />

            <dvc:LineSeries Title="Temperature"
                            ItemsSource="{Binding Points, Delay=2500, IsAsync=False}"
                            IndependentValueBinding="{Binding ts}"
                            DependentValueBinding="{Binding Temperature}">

                <dvc:LineSeries.DependentRangeAxis >
                    <dvc:LinearAxis Orientation="Y" Title="Temperature"/>
                <dvc:LinearAxis Orientation="X" Title="X-Axis" ShowGridLines="True"/>

What I have tried:

I cannot find any reference online to solve my problem.
Updated 26-Apr-21 23:33pm

1 solution

Try sonmething like this:

<Style x:Key="DataPointStyle1" TargetType="{x:Type dvc:LineDataPoint}">
    <Setter Property="Visibility" Value="Collapsed"/>

(dvc is your xmlns namespace definition for the datavisualization control.

If you want to make this available for all line series all the time, put this style definition in app.xaml.

        <dvc:LineSeries DataPointStyle="{DynamicResource DataPointStyle1}" ...>

If you don't want to bother with specifying the data point style in the chart, remove the x:Key element in your custom style, and it will be applied to all line series by default.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900