SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
Hi Guys
We are drawing annotation lines on our charts using the following
<visuals:HorizontalLineAnnotation HorizontalAlignment="Stretch" AnnotationCanvas="BelowChart" IsHidden="{Binding IsUpperThresholdVisible, Converter={StaticResource InvertBoolean}}" Stroke="Gainsboro" StrokeThickness="0.75" XAxisId="IndicatorXAxis" YAxisId="StandardAxis" Y1="{Binding UpperThreshold}"> <visuals:AnnotationLabel TextFormatting="0" FontSize="11" FontFamily="Segoe UI" Foreground="Black" FontWeight="Bold" LabelPlacement="Axis" /> </visuals:HorizontalLineAnnotation> <visuals:HorizontalLineAnnotation HorizontalAlignment="Stretch" AnnotationCanvas="BelowChart" IsHidden="{Binding IsLowerThresholdVisible, Converter={StaticResource InvertBoolean}}" Stroke="Gainsboro" StrokeThickness="0.75" XAxisId="IndicatorXAxis" YAxisId="StandardAxis" Y1="{Binding LowerThreshold}"> <visuals:AnnotationLabel TextFormatting="0" FontSize="11" Foreground="Black" FontFamily="Segoe UI" FontWeight="Bold" LabelPlacement="Axis" /> </visuals:HorizontalLineAnnotation>
The y1 value for each is set in Binding initially and once rendered can be manipulated by the user using a numeric up-down for each line.
Our problem is that when the lines are initially rendered they do not always display with the correct thickness (see Annotation Too Thin.png attached). When the line is subsequently moved using the numeric up-down to change its Y1 value the line then shows at the correct thickness.
We have tried snap to pixels to no effect and looked for, but did not find, anti-aliasing for annotation lines.
Could you point us in the right direction for this one please?
Thanks in advance
Ian Carson
If you set the line thickness to 0.75 (which you have), then WPF will try to render it between pixels. The result will be it will fade (become thicker/thinner) as you move it, as it spans pixels. Sometimes WPF will render it inside 1 pixel, sometimes spanning 2.
The best result to get a thin sharp line is to set line thickness to 1.0.
Please login first to submit.