Trend Lines and Zones

Trend lines are customizable reference horizontal or vertical lines which aid in interpretation of data. They can be used to set context or define limits and targets. For example, while plotting quarterly sales of a company, you might want to use a trendline to depict the target sales.

In the FusionCharts Suite XT context, trendlines do not show trends for data points. They are only used to add context to data. For showing trends in data, use regression lines.

This section talks about:

  • Adding tool-text to a trend line

  • Adding trend zones

  • Customizing trend lines and trend zones

  • Adding dashed trend lines

  • Adding slanted trend lines

  • Configuring the trend line label

  • Adding trend lines in a dual y-axis chart

Adding tool-text to a trend line

FusionCharts Suite XT allows you to specify custom tool-text which will be rendered when the mouse pointer is hovered over the trend line.

A column 2D chart with a defined tool-text for trend line looks as below:

FusionCharts should load here..

Given below is the attribute used to add tool-text:

Attribute Description
toolText It specifies the text that will be displayed when mouse is hovered over the trend line.

The data structure needed to add tool-text for trend lines is given below:

...

Adding trend zones

Trend zones are similar to trend lines except that they mark out an entire zone rather than just a line. A column 2D chart with a trend zone looks as below:

FusionCharts should load here..

Given below are the attributes used to render a trend zone:

Attribute Description
isTrendZone Set this to 1 to render a trend zone on the chart and 0 to hide it.
startValue It specifies the starting point data-value for the trend-zone.
endValue It specifies the ending point data-value for the trend zone. If the endValue attribute is included in the code and IsTrendZone is set to 0, the trend-line is rendered as a slanted line, starting at the startValue on the primary y-axis and ending at endValue on the secondary y-axis (this could be an imaginative secondary y-axis).

The data structure needed to add trend zones is given below:

...

Customizing trend lines and trend zones

A column 2D chart with the trend line customized looks as below:

FusionCharts should load here..

Given below are the attributes used to customize trend lines and trend zones:

Attribute Description
color It specifies the hex code for the color that will be used to render the trend-line/zone e.g. #00ffaa.
thickness It specifies the thickness for the trend-line(in pixels). You cannot specify the thickness for a trend zone.
alpha Sets the transparency of trend line/zone. Can take values from 0 (transparent) to 100 (opaque).

The data structure needed to customize trend lines is given below:

...

A column 2D chart with the trend zone customized looks as below:

FusionCharts should load here..

The data structure needed to customize trend zones is given below:

...

Adding dashed trend lines

A column 2D chart with a dashed trendline looks as below:

FusionCharts should load here..

Given below are the attributes used to render a dashed trendline instead of the continuous line:

Attribute Description
dashed Set this to 1 to make trend lines dashed or 0 (default) to make them normal.
dashLen Sets the length of each dash of a trend line(in pixels).
dashGap Sets the gap between two consecutive dashes in trend lines (in pixels).

The data structure needed to render a dashed trendline is given below:

...

Adding slanted trendlines

A line chart with a slanted trend line is as shown below:

FusionCharts should load here..

Given below are the attributes used to render a slanted trend line:

Attribute Description
startValue It specifies the starting point data-value for the slanted trend line. This data value is plotted on the y-axis on the left.
endValue It specifies the ending point data-value for the slanted trend line. This data value is plotted on the imaginary y-axis on the right.

The data structure needed to add a slanted trendline is given below:

...

Configuring the trend line label

FusionCharts Suite XT allows you to show the trendline label to the right of the chart canvas. A column 2D chart with the trendline label rendered on the right looks as below:

FusionCharts should load here..

Given below is the attribute used to render the trend line label on the right:

Attribute Description
valueOnRight If set to 1, it renders the trend-line label on the right or 0(default) to render on the left.

The data structure needed to configure the trendline label is given below:

...

Adding trendlines for a dual y-axis chart

A dual y-axis chart has 2 y-axes. So when you are defining a trendline, you also need to define which axis the line has to be defined on.

This can be done using the parentYAxis attribute of the line object.

By default, the trend-line shows up on the primary y-axis but if you want to show it on the secondary y-axis you have to configure the same by setting parentYAxis equal to S.