Hi,
I have a requirement to somehow break the line if a datapoint is marked as invalid. There are 2 questions:
- How to mark it, i.e. can I use a special Y-value (null, infinite, ..) to use?
- How to draw it?
a) if no line at all should be drawn between 2 valid data points when an invalid one is between them?
b) if a dashewd line should be drawn in this case?
/Efim
I kinda got this working in my case. However, it may not work in all cases.
I manually populated the series DataPoints collection, instead of using the DataSource. For each data point, you can set the Fill property. By setting the Fill of some of the data points to Brushes.Transparent, I was able to get a dashed line effect. This requires that you have sufficient data points.
It would be preferable if we could provide a System.Windows.Media.Pen.
Wally
Unfortunately, this works only on the chart level. This is because the Series is not the container in which the lines are rendered.
I did a test for the solution you provided. The dashed line style can only be applied on the chart level. That means if have two lines in the same chart, both lines are drawn as dashed line. I can not apply the style to the series level to drawn one line as dashed line and another line as non-dashed line.
Is there any way that I can draw one line as dashed line and another line as non-dashed line in the same chart? Thanks!
FYI. Following is the code I tried and the result is both lines are drawn as non-dashed line. The dashed line style does not take effect on the series level.
<igChart:XamChart Name="testChart" Grid.Row="2"> <igChart:XamChart.Axes> <igChart:Axis Name="testAxis" AxisType="PrimaryX" AutoRange="False"/> <igChart:Axis AxisType="PrimaryY" AutoRange="False" Minimum="0" Maximum="100" Unit="20"/> </igChart:XamChart.Axes> <igChart:XamChart.Series> <igChart:Series Name="seriesA" ChartType="ScatterLine" Fill="Purple" StrokeThickness="2"> <igChart:Series.Resources> <Style TargetType="{x:Type Line}"> <Setter Property="StrokeDashArray" Value="2,1" /> </Style> </igChart:Series.Resources> </igChart:Series> <igChart:Series Name="seriesB" ChartType="ScatterLine" Fill="Blue" StrokeThickness="2"> </igChart:Series> </igChart:XamChart.Series> <igChart:XamChart.Legend> <igChart:Legend Visible="False"/> </igChart:XamChart.Legend> </igChart:XamChart>
Yes, it will draw the whole line dashed.
I guess it would draw the whole line dashed?