1

Is it possible to hide the data points in the chart control from the WinRT XAML Toolkit from CodePlex? I'm using a LineSeries and only want a line without the dots.

Filip Skakun
  • 31,624
  • 6
  • 74
  • 100

2 Answers2

1

This seems to work. Though I am not yet sure why it makes my lines orange...

<charting:Chart
    x:Name="LineChart2"
    Title="Line Chart Without Data Points"
    Margin="70,0">
    <charting:LineSeries
        Title="Population"
        IndependentValueBinding="{Binding Name}"
        DependentValueBinding="{Binding Value}"
        IsSelectionEnabled="True">
        <charting:LineSeries.DataPointStyle>
            <Style
                TargetType="charting:LineDataPoint">
                <Setter
                    Property="BorderThickness"
                    Value="0" />
                <Setter
                    Property="IsTabStop"
                    Value="False" />
                <Setter
                    Property="Width"
                    Value="0" />
                <Setter
                    Property="Height"
                    Value="0" />
                <Setter
                    Property="Template">
                    <Setter.Value>
                        <ControlTemplate
                            TargetType="charting:LineDataPoint">
                            <Grid
                                x:Name="Root"
                                Opacity="0" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </charting:LineSeries.DataPointStyle>
    </charting:LineSeries>
</charting:Chart>
Filip Skakun
  • 31,624
  • 6
  • 74
  • 100
  • Yeah! It's working great, but you are right the color of the line is acutally orange, but this is not a problem for me. But if I have only one point to display, I see nothing on the graph, because of hiding the points. Is it possible to change the Style, if I have only one point to display? Thanks. – Thomas Sebastian Jensen Oct 31 '12 at 05:29
  • Of course - you could either use a different template depending on your data or modify the code of the line series to enable your scenario. – Filip Skakun Oct 31 '12 at 15:34
1

@Filip Skakun thanks for the very accurate answer, and about your issue regarding Orange Lines try adding this property and change the color to whatever color you want.

<Charting:LineSeries.DataPointStyle>
                            <Style TargetType="Charting:LineDataPoint">

                                <Setter Property="Background" Value="Red" />
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Charting:LineDataPoint">
                                            <Grid x:Name="Root" Opacity="0" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Charting:LineSeries.DataPointStyle>

it happens mainly because Chart's are capable of displaying multiple data series on single chart. and for Series[0] the default color is set to Orange.