Configuring Bubble and XY Charts

FusionCharts Suite XT allows you to configure the functional and cosmetic properties of bubble and xy charts.

In this section, you will be shown how you can:

  • Display labels on bubbles

  • Segment the x-axis into categorical zones

  • Configure the x-axis labels

  • Configure the x-axis vertical divisional lines

  • Connect scatter plots in a scatter chart

  • Render regression lines in charts

Displaying Labels on Bubbles

By default, data labels are not rendered on the bubbles in a bubble chart.

A bubble chart with data labels rendered on bubbles looks like this:

FusionCharts should load here..

Given below is a brief description of the attribute used to show/hide labels on bubbles:

Attribute Name Description
showValues It is used to specify whether labels will be displayed on bubbles. Setting this attribute to 1 will show the labels, setting it to 0 (default) will hide them.

The data structure needed to show labels on bubbles is given below:

...

Segmenting the X-axis of Bubble/Scatter Charts into Categorical Zones

The x-axis of the bubble/scatter chart can be segmented into categorical zones using vertical trend lines.

A bubble chart with the x-axis segmented looks like this:

FusionCharts should load here..

The data structure needed to segment the x-axis into categorical zones is given below:

...

Configuring the X-axis Labels of Bubble/Scatter Charts

You can configure the display mode of the x-axis labels for bubble and scatter charts. You can either choose to make the chart automatically generate the x-axis labels along with vertical divisional lines or you can explicitly define each x-axis label. Additionally, you can also opt to mix these two modes.

Given below is a brief description of the attribute used to configure the x-axis labels:

Attribute Name Description
xAxisLabelMode It is used to specify the mode in which the x-axis labels will be rendered. This attribute takes three values: AUTO (default), CATEGORIES and MIXED.

Auto Mode

In the auto mode, the chart automatically calculates and displays the x-axis labels. In this mode, the chart ignores the categories object array and allows the x-axis to inherit the properties similar to that of the vertical y-Axis.

A bubble chart with the x-axis labels rendered in the auto mode looks like this:

FusionCharts should load here..

In the above chart, you can see that the x-axis labels are automatically calculated and displayed. These x-axis labels are based on x-axis values which in turn are generated using the x values of the chart data. Additionally, along with each label a vertical divisional line is also rendered.

The data structure needed to render the x-axis labels in the auto mode is given below:

...

Categories Mode

In this mode, the x-axis displays labels explicitly defined through the objects in the category array within the categories object array.

A bubble chart with the x-axis labels rendered in the categories mode looks like this:

FusionCharts should load here..

In the above chart, you can see that the labels explicitly defined in the category object array within the categories object array are displayed. The automatically calculated labels are not displayed.

To render the x-axis labels in the categories, set the value of the xAxisLabelMode attribute to CATEGORIES.

Mixed Mode

This mode is a combination of the auto mode and the category mode. It allows the x-axis to display the automatically calculated x-axis labels as well as the explicitly defined x-axis labels simultaneously.

A bubble chart with the x-axis labels rendered in the mixed mode looks like this:

FusionCharts should load here..

In the above chart, you can see that the x-axis displays the automatically calculated labels as well as the explicitly defined labels.

To render the x-axis labels in the categories, set the value of the xAxisLabelMode attribute to MIXED.

By default, when xAxisLabelMode attribute is not defined and when categories are not explicitly defined in the data, the chart displays x-axis labels in the auto mode. In case, categories are defined (and the xAxisLabelMode attribute is not defined), the chart switches to the categories mode. You can also force any of the above three modes by explicitly defining the mode using the xAxisLabelMode attribute.

Configuring the X-axis Vertical Divisional Lines

Given below is a brief description of the attributes used to configure the vertical divisional lines related to the x-axis:

Attribute Name Description
adjustVDiv It is used to allow you to explicitly set the lower and upper limit values and the number of divisional lines for this x-axis. By default, this is done automatically. Setting this attribute to 0 will disable the automatic adjustment of the divisional lines, setting it to 1 will enable it.
showXAxisValues It is used to specify whether the divisional lines values for the x-axis will be shown.
numVDivlines It is used to specify the number of vertical axis divisional lines to be rendered on the chart.
xAxisValuesStep By default, all divisional lines show their values. However, you can opt to skip every x(th) divisional line value using this attribute.
vDivlineColor It is used to specify the hex code for the color that will be used to render the vertical divisional lines.
vDivlineThickness It is used to specify the thickness of the vertical divisional lines. This attribute takes values between 1 (thinnest) and 5 (thickest).
vDivlineAlpha It is used to specify the transparency for the vertical divisional lines. This attribute takes values between 0 (transparent) and 100 (opaque), e.g. 20.
vDivlineIsDashed It is used to specify whether the vertical div lines will be rendered as dashed lines. Setting this attribute to 1 will render the divisional lines as dashed lines, setting it to 0 (default) will render them as whole lines.
vDivlineDashLen It is used to specify the length of each dash, if the vertical divisional lines are to be rendered as dashed lines.
vDivlineDashGap It is used to specify the gap between each dash, if the vertical divisional lines are to be rendered as dashed lines.
showAlternateVGridColor It is used to specify whether alternate-colored vertical grid bands will be shown.
alternateVGridColor It is used to specify the hex code for the color that will be used to render the alternate vertical grid bands.
alternateVGridAlpha It is used to specify the transparency for the alternate vertical grid bands. This attribute takes values between 0 (transparent) and 100 (opaque), e.g. 20.

Connecting Scatter Plots by a Line in XY (Scatter) Charts

A scatter chart with all the data points connected by a line looks like this:

FusionCharts should load here..

Given below is a brief description of the attribute used to connect data points by a line:

Attribute Name Description
drawLine It is used to specify whether the data points on the scatter chart will be connected by a line. Setting this attribute to 1 will connect the data points using a line, setting it to 0 (default) will not connect them. This attribute belongs to the dataset object.

The data structure needed to connect all data points of a dataset by a line is given below:

...

Regression Lines in Scatter and Bubble charts

For scatter and bubble charts, regression lines can be drawn based on the values provided to the charts.

In scatter or bubble charts, each data point has two distinct numeric values: the x value w.r.t the x-axis and the y value w.r.t the y-axis. A regression line is used to show the trend of the y values with respect to the x values or the trend of the x values with respect to the y values. Hence, a regression line can be used to derive a particular trend from the scattered data points in the chart canvas and predict values accordingly.

The regression line is shown as a straight line.

Regression line can be used to find trends and predict future sales, stock prices, currency exchange rates, productivity gains resulting from a training program, etc.

There are several methods to calculate and draw regression lines; the scatter and bubble charts use linear Regression and least-squares or least absolute deviation method. This method calculates the best-fitting straight-line for the observed data by minimizing the sum of the squares of the vertical deviations from each data point to the line (if a point lies on the fitted line exactly, then its vertical deviation is 0). Because the deviations are first squared, then summed, there are no cancellations between positive and negative values.

A scatter chart with a regression line looks like this:

FusionCharts should load here..

Given below is a brief description of the attribute used to show regression lines:

Attribute Name Description
showRegressionLine It is used to specify whether a regression line will be shown for the chart. Setting this attribute to 1 will show the regression line, setting it to 0 (default) will hide it. This attribute belongs to the dataset object.

The data structure needed to show a regression line for a scatter chart is given below:

...

Modes of Regression

Scatter charts can display regression lines in one of the following two modes:

  • Y on X : When y values are predicted or a trend of y values is calculated based on the x values

  • X on Y : When x values are predicted or a trend of x values is calculated based on the y values

By default, scatter and bubble charts use the Y on X mode to draw the regression lines.

The scatter chart with a regression line shown above uses the Y on X mode.

The same chart with a regression line drawn using the X on Y mode looks like this:

FusionCharts should load here..

Given below is a brief description of the attributes used to set the mode and customize regression lines:

Attribute Name Description
showYOnX It is used to specify the mode in which a regression line will be drawn. Setting this attribute to 0 will draw the regression line in X on Y mode , setting it to 1 (default) will draw the regression line in Y on X mode. This attribute belongs to the dataset object.
regressionLineColor It is used to specify the hex code of the color that will be used to draw the regression line.
regressionLineThickness It is used to specify the thickness of the regression line.
regressionLineAlpha It is used to specify the transparency of the regression line. This attribute takes values between 0 (transparent) and 100 (opaque), e.g. 50.

The data structure needed to draw a regression line in the X on Y mode is given below:

...

The formulae used to draw the regression lines for both the modes are given below:
Y on X – The regression equation of Y on X is the equation of the best fitting straight line in the form y= a+bx, where x is the explanatory variable and y is the dependent variable.
When, b = ( n . Σ (x.y) - (Σ x).(Σ y) )/ (n Σx² – (Σx)² )

X on Y - The regression equation of X on Y is the equation of the best fitting straight line in the form x= a+by, where y is the explanatory variable and x is the dependent variable.
When, b = ( n . Σ (x.y) - (Σ x).(Σ y) )/ (n Σy² – (Σy)² )

There! You have now seen how you can configure the bubble and XY charts.