TIBCO Cloud™ Spotfire® Web Client User Guide

Adding lines using a property

You can use a property as the input to a line or a curve. A property value can either be a string expression in itself, or it can be used as a variable in a custom expression.

Before you begin

The functionality described here must be authored using the installed client.

Using a property value to define a line in a visualization

The first example describes how the position of a horizontal line in a scatter plot can be changed by anyone using a property control in a text area.

About this task



Follow the steps to create this type of analysis.

Procedure

  1. Create or edit a text area.
  2. In edit mode, add the property control to the text area. In this example, we add an input field.


  3. In the Property Control dialog, create the property via New. Give it a name, specify its data type, and a starting value. In this example, we call the property 'LineAt'.


  4. When the property exists and has been selected, you can adjust the formatting of the values at the bottom of the Property Control dialog. Click OK when you are done, and Save the text area.
  5. The next step is to connect the created property to the setting that should be affected by the property value. In the visualization where you want to add the line, right-click and select Properties.
  6. Click Lines & Curves.
  7. Click Add > Horizontal Line > Straight Line.
  8. In the Horizontal Line dialog, select the Custom expression option, click Edit and, in the Custom Expression dialog, enter ${LineAt}.
    This is the syntax used when adding the value of the property as text in an expression (and also the default if you double-click the property in the Available properties for column list). See Properties in expressions for more information regarding the different syntaxes.
  9. Click OK.
    The curve is shown in the visualization and you can use the property control in the text area to change the value, and hence, the position of the line.

Using a property expression to define a line showing different statistical measures

In this example, a scatter plot is used to show salaries for employees, trellised per education level. The text area contains a property control in the form of a drop-down list, where a dashboard user can select to add horizontal lines that show either the average, the median, or the most common salary within each education level.

About this task



Follow the steps to create this type of analysis.

Procedure

  1. Create or edit a text area.
  2. In edit mode, add the property control to the text area. In this example, we add a drop-down list.


  3. In the Property Control dialog, create the property via New. Give it a name, specify its data type, and a starting value. In this example, we call the property 'SalaryExpression'.


  4. Now that the property exists, define which values to include in the drop-down list. In this example, you define Fixed values yourself, by typing the text to show under Display Name, and by adding their values to the right.


  5. In the visualization where you want to add the curve, locate the Properties.
  6. Click Lines & Curves.
  7. Click Add > Horizontal Line > Straight Line.
  8. In the Horizontal Line dialog, select the Custom expression option, click Edit and, in the Custom Expression dialog, enter ${SalaryExpression}([Y]), where SalaryExpression is the property you have created (the result of the custom expression ${SalaryExpression}([Y]) will, depending on the selection in the drop-down list, become Avg([Y]), Sum([Y]), or MostCommon([Y])).
  9. Click OK.
    The curve is shown in the visualization and you can select where a line should be drawn in the visualization by making a choice in the drop-down list. For example, in the image below, Median salary is selected.

Using a property expression to define a curve

A property can either be a string expression in itself, or it can be used as a variable in a custom expression. This step instruction assumes that the property contains a string which is an expression.

Procedure

  1. For the visualization where you want to add the curve, open the visualization properties.
  2. Locate the Lines & Curves section.
  3. Click Add and select Curve Draw.
  4. In the Curve Draw dialog, call the property containing the expression in the Curve expression field using the Text syntax: For example, ${curve.expression}.
    The document property curve.expression could in this example hold a value such as 2+3*x. The expression could also contain other properties. For example, the value of curve.expression could be2+DocumentProperty("ExpressionConstant")*x, where ExpressionConstant is another property which holds a numeric value. Note that the syntax for calling a property differs when calling it to retrieve the value of the property. See Properties in expressions for more information regarding the different syntaxes.
  5. Click OK.