MultiTextFrame.setDelimiter(str)

Specifies a delimiter used to separate values in the MultiTextFrame for display. For better control over the display of values, use MultiTextFrame.setMessageFormat(str) instead.

Parameter

str

A delimiter

Example

Use MultiTextFrame to place multiple measures/dimensions as labels on a Chart. Follow the steps below:

  1. Create the desired Chart.

  2. If there are fields that you want to use as labels (that are not already on the ‘X’ or ‘Y’ axis or used in the Visual panel for ‘Color’, ‘Shape’, ‘Size’, or ‘Text’) add those fields in the ‘Break By’ region.

    In the example below, ‘Order Date’ and ‘Price’ are displayed on the axes, and ‘Region’ is assigned as the ‘Text’ binding. Because we want a label for ‘Total’ as well, this field has been placed in the ‘Break By’ region.

    MultiTextFrameSetField1

  3. Add the following script to the Chart component. (See Add Component Script.)

    Chart Component Script
    var tframe = new MultiTextFrame(); (1)
    tframe.setFields("Customer:Region", "Sum(Product:Price)", "Sum(Product:Total)"); (2)
    tframe.setDelimiter("\n"); (3)
    graph.getElement(0).setTextFrame(tframe); (4)
    1 Create the MultiTextFrame object.
    2 Use MultiTextFrame.setFields(arr) to assign the fields you want to use as labels.
    3 Use setDelimiter() to separate the label text with newline.
    4 Use GraphElement.setTextFrame(frame) to add the MultiTextFrame to the IntervalElement.
  4. Press OK. The labels are displayed on the Chart.

  5. Optional: Use the Format tab to change the label color to make them more visible. (See Add Visual Format.)

    MultiTextFrameSetDelimiter

Script that modifies the graph or dataset properties should be placed on the Chart component itself. See Add Component Script for more information. This script has access to the Chart data and Chart API methods. Scripted Charts are not good candidates for user-modification, so you should deselect ‘Enable Ad Hoc Editing’ in the Chart Properties dialog box.