# 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.

### <span class="mw-headline" id="bkmrk-specifik-defaults-1">Specifik defaults</span>

These can't be overwritten.

#### <span class="mw-headline" id="bkmrk-area-stacked-1">Area stacked</span>

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

#### <span id="bkmrk-"></span><span class="mw-headline" id="bkmrk-area-stacked%2C-area-a-1">Area stacked, area and line</span>

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

#### <span class="mw-headline" id="bkmrk-bars-1">Bars</span>

```javascript
options.indexAxis = 'y'
```

### <span class="mw-headline" id="bkmrk-overwriting-defaults-1">Overwriting defaults</span>

To overwrite the default of all charts:

Define an object in js, named tsChartOverwriteOptions.

Set it based on the documentation fund [here](https://www.chartjs.org/docs/3.7.1/).

  
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](https://www.chartjs.org/docs/3.7.1/).

  
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

Force a graph (graph with ID 6) to always have y-axis start at 0.

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

Convert a barchart vertical (graph with ID 4) to a stacked barchart.

```javascript
let tsChartOverwriteOptions = {
  chart4: {
    scales: {
      x: {
        stacked: true
      },
      y: {
        stacked: true
      }
    },
  },
}
```