Skip to main content
Skip table of contents

sw2-chart-config-options.js

Location<tomcat_home>\webapps\webapi\scripts\sw2-charts\sw2-chart-config-options.js

The file allows you to configure some settings for Graph View. For example, you can change the default type of graph that is displayed when you change to Graph View.

It is not necessary to restart SuperWEB2 to apply changes to the configuration settings in this file. Any changes you make will be applied immediately.

Colors

This section contains an array of HTML hexadecimal colour codes that define the colours that will be used in the graph. You can use any colours that you like as long as you specify valid HTML hexadecimal colour codes.

You can include as many or as few colours as you like: the graph will repeat the colours if there are not enough specified to represent all of the cells in the graph.

You can also set this to null, in which case Graph View will use the default colours.

For example:

A single colour for all cells in the graph:

JS
"colors": [
        "#7cb5ec"
    ],

Use the default colours (set to null):

JS
"colors": null,

Use nine different colours (and then repeat the sequence if more are required):

JS
"colors": [
        "#7cb5ec",
        "#90ed7d",
        "#f7a35c",
        "#8085e9",
        "#f15c80",
        "#e4d354",
        "#91e8e1",
        "#61D8A2",
        "#FFE273"
    ],

Init

This section controls the default settings that are applied when users open Graph View.

SettingDescription
charttype

The type of graph displayed initially. This can be set to one of the following values:

  • line
  • bar
  • stacked-bar
  • column
  • stacked-column
  • stacked-percentage-column
  • area
  • stacked-area
  • stacked-percentage-area
  • pie
graphby

The initial setting for the Graph By option. This can be set to either row or column.

hidetotals
Whether to initially hide totals from the graph. This can be set to true or false.
hidesubtotals
Whether to initially hide subtotals. This can be set to true or false.
hideaxisderivations
Whether to initially hide axis derivations. This can be set to true or false.

Feature

This section allows you to disable some of the Customise Graph options. If you turn off any of these options then the setting will be fixed at whatever you set in the init section and users will not be able to change it.

SettingDescription
graphby
Whether to allow users to change the Graph By option. This can be set to true or false.
toggletotals
Whether to allow users to change the Hide Totals setting. This can be set to true or false.
togglesubtotals
Whether to allow users to change the Hide Sub-totals setting. This can be set to true or false.
toggleaxisderivations
Whether to allow users to change the Hide Axis Derivations setting. This can be set to true or false.

Numeric Symbols

This section allows you to configure metric prefixes that shorten high numbers in axis labels. By default, this is set to:

CODE
"numericSymbols": ["K", "M", "B", "T"]

The first item in this list is used to shorten values of 103 (1,000) and above, the second item to shorten 106 (1,000,000) and above, the third for 109, and so on. With the default configuration, the value of 1,000 in an axis will be abbreviated to 1K, while 5,000,000 will be displayed as 5M.

Regardless of the axis abbreviations, values are always shown in full in the tooltips. For example:

Although only four symbols are specified by default, you can add extra ones to the list if you expect to have very large numbers in your charts.

You can also set any of the individual items to null, in which case the next lowest configured abbreviation will be used for values in that range. For example, the following setting ensures that any value from 106 (1,000,000) but less than 1012 will be abbreviated using M. For example 109 (1,000,000,000) will be abbreviated as 1,000M:

CODE
"numericSymbols": ["K", "M", null, "B"]

The following configuration shows any value under 1,000,000 in full:

CODE
"numericSymbols": [null, "M", "B", "T"]

If you want to always show values in the labels in full, set numericSymbols to null:

CODE
"numericSymbols": null
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.