07-16-2017 06:06 PM
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
Solved! Go to Solution.
07-17-2017 04:32 PM
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.
07-17-2017 05:51 PM
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.)
07-19-2017 02:44 PM
Thank you this was very helpful