ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Unprocessed Point Information in Plot Renderer

Solved!
Go to solution

I have been writing a program that plots points to a Writable Graph. I am working to overload the Plot Renderer so that I can customize how each point is represented on the graph. I wrote a custom point class that stores an (x, y) coordinate position, a Color, and eventually more attributes. I extended the DataTypeDescriptor class so that the point attributes could be stored in their respective buffers, specifically in the method titled: public IList<IBuffer> DecomposeValues(Buffer<PeakPoint> values, Trait decomposeOption). Now, when I am working in the Plot Renderer class, I want to access the attributes of each point.

 

In the method: RenderGraphCore(PlotRenderArgs renderArgs), I see that renderArgs.RelativeData[0] and renderArgs.RelativeData[1] accesses the processed x and y coordinates (the points are scaled to fit in an area with 0-1 being the range for both the x and y axes). My question is: how do I access the unprocessed point information (ie. the Color and other attributes that I will eventually store in the point class)?

 

Thanks

0 Kudos
Message 1 of 4
(3,657 Views)

Hey knb,

 

I'm having a little trouble visualizing exactly what the question is. Would you mind pasting your code here if it's not too large so I can take a look?

 

Cheers,

Ryan C.

0 Kudos
Message 2 of 4
(3,602 Views)
Solution
Accepted by topic author knb

A plot renderer only receives as much data as it declares in the GetDataRequirements method, and all data is mapped to relative values (the 0-1 double values for in-range data you mentioned). Color data can be treated numerically as a separate dimension, but if you add additional/non-numeric attributes then a different approach will probably work better.

 

I have attached an example project that implements one possible approach: saving the additional attribute information as a trait on the positional data. In the renderer, this trait can be retrieved and used to customize the drawn values. (It also includes a few notes on other approaches, using traits or dimension buffers.)

~ Paul H
0 Kudos
Message 3 of 4
(3,598 Views)

Thank you this was very helpful

0 Kudos
Message 4 of 4
(3,581 Views)