1. Home
  2. Docs
  3. Graph Chart
  4. Applying string values to axis or points

Applying string values to axis or points

The graph chart has a few utility properties and methods that allow you to place string instead of values on both the axis and the items.

Mapping Value into string on the graph Axis

You can map any double value into a string. This mapping applies to either the vertical axis or the horizontal axis. It will cause the axis labels to be replaced with your string value. It can be done in the following way:

//for the vertical axis
graph.VerticalValueToStringMap[doubleValue] = "stringValue";
//for the horizontal axis
graph.HorizontalValueToStringMap[doubleValue] = "stringValue";

For example , the following call :

graph.HorizontalValueToStringMap[0.0] = “Zero”;

Will have the following effect :

Adding a point with a custom label

You can also add point with custom labels. The following methods allow you to do so :

GraphData.AddPointToCategoryWithLabel(graph, "category", x, y, pointSize, "XLabel", "YLabel");
//or for real-time:
GraphData.AddPointToCategoryWithLabelRealtime(graph, "category", x, y, animationTime,pointSize, "XLabel", "YLabel");

The result looks like this:

The labels are formatted according to ItemFormat which is described in Graph Chart Settings