Table value renderers render values in table visualization columns. The most common scenario is to turn data values into images, which are rendered in the table cells.
Overview
A value renderer renders data values into images or strings and, optionally, supplies
a tooltip for the values. By default each table column has a default renderer model
associated with it. By associating a CustomValueRenderSettings model
with a column, the custom value renderer returns an image or string based on the
data values.
Whenever the renderer model is not the default model, the renderer type identifier
of the model is used to create an instance of a corresponding ValueRenderer.
A renderer for a table plot column may be specified like this:
plot.TableColumns.SetValueRenderer(dataColumn, typeIdOfRenderer);
Tutorial
-
How to Create a Table Value Renderer
This tutorial describes how to create a simple renderer turning data values into images. The source code is available in the SDK, and includes a dialog for the renderer settings.
The Renderer Framework: Concepts and Classes
Value renderer instances are first created by a factory, which also defines how well
the particular renderer fits a specific content type.
The Factory
A ValueRenderer is created by a ValueRendererFactory. It
should override the GetRendererMatchCore method, which returns a float
value indicating how well the renderers produced by the factory can render a given
kind of values.
The Value Renderer
The value renderer performs the actual rendering from data value into image or string.
Override its RenderCore method when implementing a custom value renderer.
The RenderCore method takes three parameters: a settings object defining
the rendering process, an arguments object defining the actual rendering, and a
result object returning the image, string or tooltip.
- The
ValueRendererSettings instance is a document node, that is, a model
object. It holds rendering settings and a type identifier for a suitable renderer.
Each column in the table plot which does not use the built-in default renderer has
exactly one such model object. Its GetRenderTriggerCore method returns
a trigger that is used to detect when a column should be re-rendered.
- The
ValueRendererArgs instance contains width and height in pixels
for a requested image, the data value itself, and the data value as a formatted
string. Height and width can simply be ignored for strings. Its DataValueProperties
property holds, among other properties, the column's Content-Type. Since the ValueRendererArgs
class implements the IEquatable interface, it can be used as a key
in caches.
- The
ValueRendererResult holds the result returned from the renderer,
that is, an image, a string, or the optional tooltip string.