سؤال

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.

هل كانت مفيدة؟

المحلول

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 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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top