08-19-2013 09:17 AM
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
Solved! Go to Solution.
08-22-2013 10:22 AM
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.
08-28-2013 04:13 AM - edited 08-28-2013 04:14 AM
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
08-28-2013
09:00 AM
- last edited on
11-20-2024
10:42 AM
by
Content Cleaner
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 ) { }
}
08-28-2013 11:29 AM
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}
08-29-2013 09:37 AM
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.
08-30-2013 05:49 AM
How do I use this no-decimation renderer? Is it instead of a line renderer? Why is it derived from PlotRenderer then?
08-30-2013 09:43 AM
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.
08-11-2015
12:28 PM
- last edited on
11-20-2024
10:42 AM
by
Content Cleaner
Just wanted to let you know this issue (#423510) was fixed in the Measurement Studio 2015 release.