0
votes

I have a chart with a line series (or ten) using the WPF Toolkit resource. What I want is to see the lines extrapolating the points without actually seeing the points themselves.

In order to accomplish this I introduced a style that templates the points with a 0 opacity grid as follows.

   <Style x:Key="InvisiblePointStyle" TargetType="chartingToolkit:LineDataPoint">
       <Setter Property="Template">
           <Setter.Value>
               <ControlTemplate TargetType="chartingToolkit:LineDataPoint">
                   <Grid x:Name="Root"
                       Opacity="0">
                   </Grid>
               </ControlTemplate>
           </Setter.Value>
        </Setter>
   </Style>

Now this accomplishes removing the points, however now every line is colored the same way. The only thing I could think of is that there is some template binding for the line color that is being left out.

My question is this, given this template is there a way to explicitly set the color for the lines? Or alternatively is there another better way to remove the points from the view where I can also explicitly set the color of the line? (I looked through the properties of the line series and didn't see anything like PointVisibility but may have missed a key property).

Thank you.

Edit

I provided an answer below, if anyone has a better method I would still be interested in hearing it and would accept that as the answer, Thanks.

1

1 Answers

1
votes

I was not able to set the Background property on the line series itself and get the color I wanted returned. But what I was able to do was make different styles for each series and have a setter which set Background.

        <Style x:Key="InvisiblePointStyle"
               TargetType="chartingToolkit:LineDataPoint">
            <Setter Property="Background"
                    Value="#FF0000" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="chartingToolkit:LineDataPoint">
                        <Grid x:Name="Root"
                              Opacity="0">
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

That did the trick.