Skip to main content

Graph defaults

The graphs all reference the js object tsChartDefaultOptions, with a couple of tweaks.

To see the defaults, open the terminal in you browser, on a page that has a graph and type the name of the object.

Specifik defaults

These can't be overwritten.

Area stacked

options.scales = {
    y: {
        stacked: true
    }
}

Area stacked, area and line

options.interaction = {
	intersect: false,
	mode: 'index',
}

Bars

options.indexAxis = 'y'

Overwriting defaults

To overwrite the default of all charts:

Define an object in js, named tsChartOverwriteOptions.

Set it based on the documentation fund here.


To overwrite the options for a specific chart:

Define an object in js, named tsChartOverwriteOptions.

Add an object with an index matching the chartID.

Set it based on the documentation fund here.


To test your overwrite:

From the console in the browser call tsChartOptions with the only parameter being the chartID.

The return will be the final options, that will be used for that chart.

Sample

let tsChartOverwriteOptions = {
  chart6: {
    scales: {
      y: {
          beginAtZero: true
      },
    },
  },
}