Mick Posted January 4, 2010 Report Share Posted January 4, 2010 I am in the process of making a chart that has bars and lines. I want to be able to use ChartFX theming, but when the lines overlap, The line is too dark to immediately recognize the color: The line is too light and appears to blend into the bar: --- Is there any way to specify the color I want the "border" of the line to be? I think the following is much easier to read (I hand drew the border lines): Thank you, Mick Quote Link to comment Share on other sites More sharing options...
JuanC Posted January 5, 2010 Report Share Posted January 5, 2010 Because we paint our lines using a WPF polyline you cannot have a border but you could use the following template for your line series <DataTemplate x:Key="Line"> <DataTemplate.Resources> <sys:Double x:Key="cfxDefMarkerSize">10</sys:Double> <sys:Double x:Key="cfxDefMarkerStrokeThickness">1</sys:Double> </DataTemplate.Resources> <Canvas Opacity="{Binding Path=Opacity}"> <Polyline Points="{Binding Path=Points}" Stroke="Black" StrokeThickness="8" StrokeDashArray="{Binding Path=StrokeDashArray}" StrokeMiterLimit="1"/> <Polyline Points="{Binding Path=Points}" Stroke="{Binding Path=Stroke}" StrokeThickness="6" StrokeDashArray="{Binding Path=StrokeDashArray}" StrokeMiterLimit="1"/> </Canvas> <DataTemplate.Triggers> <DataTrigger Binding="{Binding Path=Dimmed}"> <DataTrigger.Value> <sys:Boolean>True</sys:Boolean> </DataTrigger.Value> <Setter Property="Opacity" Value="0.3" /> </DataTrigger> </DataTemplate.Triggers> </DataTemplate> For simplicity I am hardcoding the line thickness to be 6 so that we can paint a thicker line that will be become the border, if you wanted to be more correct you could bind the first line thickness to a converter that adds 2 to the provided value and then bind the second line thickness to StrokeThickness. To use this template in a chart with only lines you could say chart1.AllSeries.Template = (DataTemplate) FindResource("Line"); In your case you will probably want to assign this template to the series that are painted by line. Hope this gets you on the right track JuanC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.