diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 3e2cc1a351..22c7eeeccd 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -278,9 +278,10 @@ export interface Layout { legend: Partial; font: Partial; scene: Partial; - barmode: "stack" | "group" | "overlay" | "relative"; - bargap: number; - bargroupgap: number; + barmode: 'stack' | 'group' | 'overlay' | 'relative'; + barnorm: '' | 'fraction' | 'percent'; + bargap: 0 | 1; + bargroupgap: 0 | 1; selectdirection: 'h' | 'v' | 'd' | 'any'; hiddenlabels: string[]; } diff --git a/types/plotly.js/test/core-tests.ts b/types/plotly.js/test/core-tests.ts index c24245167e..fb44e77450 100644 --- a/types/plotly.js/test/core-tests.ts +++ b/types/plotly.js/test/core-tests.ts @@ -141,11 +141,11 @@ const graphDiv = '#test'; // Plotly.relayout // update only values within nested objects (() => { - const update = { + const update: Partial = { title: 'some new title', // updates the title 'xaxis.range': [0, 5], // updates the xaxis range 'yaxis.range[1]': 15 // updates the end of the yaxis range - } as Layout; + }; Plotly.relayout(graphDiv, update); })(); @@ -163,11 +163,16 @@ const graphDiv = '#test'; ////////////////////////////////////////////////////////////////////// // Plotly.update (() => { - const data_update = { - marker: { color: 'red' } + const data_update: Partial = { + marker: { color: 'red' }, + type: 'bar' }; - const layout_update = { + const layout_update: Partial = { title: 'some new title', // updates the title + barmode: 'stack', + barnorm: 'fraction', + bargap: 0, + bargroupgap: 0, }; Plotly.update(graphDiv, data_update, layout_update); })();