Pre loader

Lines are sometimes blurry when added to Modifier Surface

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hey guys,

I have a custom ChartModifier which attaches a vertical Line object to the ModifierSurface of a SciChart.

The Line has a Thickness of 1px.

I then move the line about the ChartModifier using X1 and X2. Where the line goes is based on the user’s interaction with another part of the chart, but it is always based off of the following code:

var xCoordCalculator = ParentSurface.XAxis.GetCurrentCoordinateCalculator();
if (xCoordCalculator == null)
{
    return;
}

var xPosition = xCoordCalculator.GetCoordinate(targetDate.Value);

The “targetDate value” is just a DateTime coming from my DataSeries’ XValues collection (it just makes sure the line is drawn always at a DataPoint in the Chart).

The problem is, the line is blurry and takes up 2px when it is dragged to some points on the Graph.

This is deterministic. I can locate a single DateTime to place the Line on and it will always be blurred when dragged to that point – yet all points around it are fine and the Line renders correctly.

I have tried the following as styles on my Line:
UseLayoutRounding set to true and false
SnapsToDevicePixles set to true and false (note: this is set to True at the Window level in our application and cascades down to the SciChartSurface as well)
RenderOptions.BitmapScalingMode set to NearestNeighbor (this sometimes fixes blurry image issues elsewhere in our application)

I think once we get to the bottom of this issue, a few other problems I’ve raised will also be solved.

As always, if you need any more details please let me know.

Thanks a bunch,
Miles

Images
  • You must to post comments
0
0

Hi Miles, Thanks for reporting, we logged it and get back to you after investigation or if we need any additional info. Best regards, Yuriy

  • You must to post comments
0
0

Hi Miles,

If its a System.Windows.Shapes.Line we’re talking about, it can only be a SnapsToDevicePixels/UseLayoutRounding issue. These flags are set on all SciChart elements but still we found that the chart was not always crisp unless certain parent elements had the same property set.

We found in SciChart that wherever you set SnapsToDevicePixels, you must also set UseLayoutRounding=True. In fact this latter property had more of an effect than the former.

We also found that by using WPF Snoop you can walk up and down the visual tree and find that setting UseLayoutRounding/SnapsToDevicePixels at one level does not necessarily mean it is snapped at lower levels. Even if the property is true at lower levels, it does not necessarily mean it is snapped visually.

This is a WPF issue – or ‘feature’ as they say.

My advice is open up Snoop and start walking up the tree, setting UseLayoutRounding/SnapsToDevicePixels in unison until the line appears crisp.

Thanks!
Andrew

  • bstapylton
    Hi Andrew, Thanks for your input on this. I've used Snoop to go from the Line (which is indeed a System.Windows.Shapes.Line) all the way up the Visual Tree. I ended up setting SnapsToDevicePixels and UseLayoutRounding to True for every ancestor in the tree, all the way to the Window element, and nothing changed. I did figure it out though. There is a RenderOptions.EdgeMode property. Setting this property on the Line, with the value of "Aliased" has just fixed my issue. I am now going back through other issues to try and see if they are also fixed by using a mixture of these three properties. Thanks, Miles
  • Andrew Burnett-Thompson
    Great, glad you have a solution :)
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies