Spotfire® User Guide

Adding a line or a curve to a visualization

Some of the visualization types can include additional information in reference lines or several different types of curves. Lines and curves can be added in the visualization properties for each applicable visualization.

About this task

See Lines and curves for generic information, and Curve fit models or Curve fit theory for details about the different options.

Before you begin

In most cases, lines and curves can only be configured using the installed client.

Procedure

  1. Open the visualization properties for the visualization of interest.
  2. Do one of the following:
    • In the visualization properties panel, click Add layer next to the visualization title and select Line or curve.
    • In the visualization properties dialog, go to the Lines & Curves page and click Add.
  3. Choose the line or curve to add from the list.
    You can select from a number of predefined curve fits, or define your own curve using Curve draw. Some of the curve types have additional settings, see below.
    Note: Whenever there is a reference to X or Y in lines or curves for a bar chart or waterfall chart, X always refers to the category axis while Y refers to the value axis. See Visualization axes in expressions.
    Note: You can only add lines to the X-axis (or category axis of a bar chart or waterfall chart) when it is in continuous mode. Right-click the scale labels and select Continuous Scale from the pop-up menu.
  4. For all lines and curves, you can specify whether an Automatic curve name should be created, or whether to use a Custom curve name. Many curve types have additional settings, see below.
  5. Once a curve has been created, you can change its settings in the visualization properties. Some of the curve settings are also available from the pop-up menu in the visualization.

Results

When a curve has been added to a visualization, you can hide it by hiding its layer (in the visualization properties panel) or by clearing its check box under Visible lines and curves in the visualization properties dialog.
For some types of curves, you can edit the settings.
Tip: Some of the curve settings are also available from the pop-up menu in the visualization.
In the visualization properties panel, you can access the configuration dialog for a specific curve from the Data card on the (parent) curve:

Note that most curves can only be completely configured using the installed client.

To export calculated curve data, click the menu for the parent curve and select Export. You can then decide whether to export the curve data to file, or to add the curve data as a new data table in the analysis.

Click Duplicate layer to create a duplicate of the curve. This can be particularly useful if you want to add one static curve that is calculated on the whole data set (select the Update manually check box in the curve configuration settings) and another one that is changed upon filtering (default).

On the Appearance tab, you can change the appearance of the selected line or curve. You can change the color, style, width, and transparency of lines and curves, as well as the color, style, size, and transparency of points, and select whether to place the line, curve or point in the foreground or background of the visualization. You can also determine the Transparency of the selected line, curve or point, that is, the degree to which the markers can be seen through it. The transparency is strongly connected to the color.

Labels and tooltips can be handled on a separate card in the Configuration tab of the visualization properties panel.

In the visualization properties dialog, you instead select the curve in the Lines & Curves page and click Edit to edit the curve configuration:



Select a curve and click More, and then select Duplicate to duplicate the curve.

Click More and select Export curve fit result to export the curve fit result for the selected curve to a text file.

Under Settings, you can change the appearance of the selected line or curve.

If you click Label and Tooltip, you can determine what information to show in the label and/or tooltip for the selected line, curve or point.

For Line from data table and Curve from data table you can make columns from the additional data table available here while setting up the line or curve using the Columns for label and tooltip field in the configuration dialog for the line or curve.

The Include in axis range setting sets the automatic zooming so that the line, curve or point is always shown, even if it lies far from the currently filtered values.

Select the Update manually check box to "freeze" the line or curve so that it is not automatically recalculated upon filtering. You can update the line or curve by clicking the Update button below or by right-clicking the visualization and selecting Update Lines and Curves and clicking the one you want to update.
Note: Not applicable for points.

The settings under One per determines whether to show one line or curve per Color, Trellis panel, and/or Line or Shape (depending on the visualization type).
Note: Not applicable for points.
Note: You should apply true categorical coloring before using the color option. If you use a continuous column on the color axis, you can end up with a different result than the expected. This applies even if the continuous color mode looks "categorical" at first sight.

Horizontal/Vertical line

Lines can currently be shown in the bar chart, line chart, combination chart, scatter plot and box plot visualizations.

Procedure

  1. In the Horizontal line or Vertical line dialog, under Line position, determine the type of line to add.
    OptionDescription
    Fixed value Adds a straight line at the defined value for the selected axis.
    Aggregated value Adds a straight line at the selected aggregation of values for the selected values.
    Column property value Adds a straight line at the specified column property value. All numerical column properties, both predefined and custom properties, are available for selection.
    Custom expression Adds a line at the specified custom expression.
  2. If desired, select Use axis transform in line calculation to apply the same axis transform, for example, a log scale, to the reference line as has been previously specified on the properties for the axis. A reversion of the axis is always applied.
    Note: If you change the orientation of the bars in a bar chart, any added lines will automatically switch orientation as well. For example, if you have added a horizontal line to a vertical bar chart and then switch to horizontal bars, the line will automatically become a vertical line.

Curve draw

This option is used to draw a curve based on a mathematical expression.

Procedure

  1. In the Curve draw dialog, if desired, select a Category of functions to limit the choices in the Function list.
  2. If desired, select a Function from the list and click Insert Function to add it to the current cursor position in the Curve expression y(x) field.
  3. In the Curve expression y(x) field, type or insert the expression to use on the form of y(x). For example, 2*x+25.
  4. See the Status field for the status of the current expression.
    If this field shows an error, there is a problem with the expression.

Curve from data table

This option is used to specify a custom curve expression which makes use of parameters available in a specified data table.

Procedure

  1. In the Curve from data table dialog, under Data table with curve parameters select the data table that contains the curve parameters to use in the definition of the curve.
  2. Under Expression, add the curve expression (using Edit) containing the independent variable (normally x) and any other parameters that are defined in the selected data table. All variables in the expression, except for the independent variable, must have corresponding columns in the parameter table.
    Note: If the main data table and the data table used in the line or curve, has a defined data table relation, any categorical features in the visualization can be utilized when rendering the lines. This makes it possible to show separate lines for each color, trellis panel, or shape.
  3. Optionally, under Columns for label and tooltip, you can specify columns from the data table selected above that also should be used in the label and/or tooltip for the curve. You can change whether to show the contents from the column in the label, in the tooltip or in both using the Labels and tooltips card in the visualization properties panel, or the Label and Tooltip dialog which is reached from the visualization properties dialog.

Line from column values

Use this alternative to show lines based on X and Y coordinates that already exist in two columns of your analysis. For example, coordinate values could be calculated from the input data using a statistical calculation in a data function and the output result could be presented as coordinate values for a curve.

About this task

When the line is drawn from column values it is also possible to show predictive values, if these are available:

Note: Lines cannot be drawn when categorical scales are used on the axes.

Procedure

  1. In the Line from column values dialog, select the data table with the coordinate values.
  2. Under X-values column, select the column in the data table that holds the X-axis coordinate values. (In a bar chart, this refers to the category axis coordinate values.)
  3. Under Y-values column, select the column in the data table that holds the Y-axis coordinate values. (In a bar chart, this refers to the value axis coordinate values.)
  4. Optionally, under Sorted by column, select a column to sort the values by. If none is selected, the line is drawn in the order of appearance of all values.
  5. Under Empty values, select whether to Ignore (skip) empty values and continue the line using the next coordinate pair, or to Split curve at empty values and split the curve whenever an empty value is encountered.

Line from data table

Use this alternative if you want to add lines to a visualization based on an existing data table in your analysis.

About this task

A simple example is if you have a data table with number of sales for two different products on different dates, you can also have a data table with the minimum acceptable number of sales on any given day for the different products. If the data with number of sales is set as a visualization, you can add lines from the minimum number of sales data table. This gives you an easy way of seeing whether any products have fewer sales than you expect.

Procedure

  1. In the Line from data table dialog, select the data table with the line positions.
  2. Select the Column in the data table from which you want to create your reference line.
  3. Optionally, under Columns for label and tooltip, you can select columns from the data table selected above that also should be used in the label and/or tooltip for the curve.