Jump to content
Software FX Community

Line Chart Colors


Recommended Posts

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:

Posted Image

  •  The line is too light and appears to blend into the bar:

Posted Image


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):

Posted Image

Thank you,


Link to comment
Share on other sites

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


  <sys:Double x:Key="cfxDefMarkerSize">10</sys:Double>

  <sys:Double x:Key="cfxDefMarkerStrokeThickness">1</sys:Double>


  <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"/>



  <DataTrigger Binding="{Binding Path=Dimmed}">




  <Setter Property="Opacity" Value="0.3" />





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



Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...