Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

strange plots on graphs

Solved!
Go to solution

This is list of points I feed to the Graph:

[0]: {729000000,-50}
[1]: {756000000,-50}
[2]: {NaN,NaN}
[3]: {758000000,-50}
[4]: {768000000,-50}
[5]: {NaN,NaN}
[6]: {869000000,-50}
[7]: {894000000,-50}
[8]: {NaN,NaN}
[9]: {1525000000,-50}
[10]: {1559000000,-50}
[11]: {NaN,NaN}
[12]: {1930000000,-50}
[13]: {1995000000,-50}
[14]: {NaN,NaN}
[15]: {2110000000,-50}
[16]: {2170000000,-50}
[17]: {NaN,NaN}
[18]: {2180000000,-50}
[19]: {2200000000,-50}
[20]: {NaN,NaN}
[21]: {2496000000,-50}
[22]: {2690000000,-50}
[23]: {NaN,NaN}

 

But the plot is straight line instead of number of segments (see attachment). Tried both Vector and Raster rendering, without success.

 

MS 2013 WPF, VS 2010

0 Kudos
Message 1 of 9
(7,456 Views)

I was able to reproduce the single-line behavior with the point data you provided. It looks like this is an issue with the linear decimation ignoring the gaps in the data. I have created a task to fix this.


To avoid this issue, you will want to include a renderer that uses a non-linear decimation. You could create a custom renderer, but the simplest workaround is to add a hidden renderer to the plot:


    <ni:Plot>
        <ni:PlotRendererGroup>
            <ni:PointPlotRenderer Fill="{x:Null}" Stroke="{x:Null}" />
            <ni:LinePlotRenderer ... />
        </ni:PlotRendererGroup>
    </ni:Plot>


Since the point renderer and line renderer use different decimation schemes, the group will use the less-aggressive implementation from the point renderer, avoiding the bug.

~ Paul H
0 Kudos
Message 2 of 9
(7,415 Views)

this solution breaks graph in other place:

 

take following data set:

[0]: {1000000,-50}
[1]: {10000000,40}
[2]: {NaN,NaN}
[3]: {1000000,-70}
[4]: {10000000,30}
[5]: {NaN,NaN}

 

and 2 ways of making renderer: line + point, or just line:

 

m_limitPlot = new Plot()
{
  Renderer = new PlotRendererGroup
  {
    PlotRenderers = {
      makeLineRenderer( GraphLineStyle.SOLID, color),
      makePointRenderer( GraphPointStyle.NONE, color, 1)
    }
  }
};


m_limitPlot = new Plot() { Renderer = makeLineRenderer(GraphLineStyle.SOLID, color) };

 

what you will see, that in case of just line renderer, 2 lines are drawn, but in case with line + point renderer, only single line is drawn

Download All
0 Kudos
Message 3 of 9
(7,369 Views)

Unfortunately, I was not able to reproduce the issue with the second set of data (both the line and the line+point plots rendered the data identically). Since decimation behavior is dependent on the size of the plot area, it may be that my configuration does not match yours accurately enough. If you could post the value of GetPlotAreaSize, I can try again with the new values.

 

Assuming decimation is still the issue though, we can also try disabling it altogether with a custom renderer:

 

    public sealed class NoDecimationRenderer : PlotRenderer {
        private static readonly DataRequirements _dataRequirements =
            new DataRequirements( DataCulling.PreserveLines, DataDecimation.None );

        public override SupportedRenderModes SupportedRenderModes {
            get { return SupportedRenderModes.VectorAndRaster; }
        }

        public override DataRequirements GetDataRequirements( ) {
            return _dataRequirements;
        }

        protected override Freezable CreateInstanceCore( ) {
            return new NoDecimationRenderer( );
        }

        protected override void RenderGraphCore( PlotRenderArgs renderArgs ) { }
        protected override void RenderLegendCore( LegendRenderArgs renderArgs ) { }
    }

~ Paul H
0 Kudos
Message 4 of 9
(7,347 Views)

Indeed it doesn't always happen. Please try this:

[0]: {1000000,-50}
[1]: {10000000,40}
[2]: {NaN,NaN}
[3]: {1000000,-70}
[4]: {10000000,40}
[5]: {NaN,NaN}

 

 

0 Kudos
Message 5 of 9
(7,341 Views)

Thanks for the update. I was able to reproduce the issue with the new values, and it looks like disabling decimation with the custom renderer avoids the problem. I have added the new data to the task, and marked it as effecting all of our scatter decimation code.

~ Paul H
0 Kudos
Message 6 of 9
(7,320 Views)

How do I use this no-decimation renderer? Is it instead of a line renderer? Why is it derived from PlotRenderer then?

0 Kudos
Message 7 of 9
(7,308 Views)
Solution
Accepted by topic author eugenem

Sorry for leaving out an example. Here is how you would use it in XAML:


    <ni:Plot>
        <ni:PlotRendererGroup>
            <local:NoDecimationRenderer />
            <ni:LinePlotRenderer ... />
        </ni:PlotRendererGroup>
    </ni:Plot>


Or in code:


    m_limitPlot = new Plot {
        Renderer = new PlotRendererGroup {
            PlotRenderers = {
                new NoDecimationRenderer( ),
                makeLineRenderer( GraphLineStyle.SOLID, color )
            }
        }
    };


The no-decimation renderer simply declares that no decimation should be used. So, when it is combined with another renderer, the no-decimation requirement takes precedence.

~ Paul H
0 Kudos
Message 8 of 9
(7,305 Views)

Just wanted to let you know this issue (#423510) was fixed in the Measurement Studio 2015 release.

~ Paul H
0 Kudos
Message 9 of 9
(5,755 Views)