plotly.js: Add barnorm to Layout (#40874)

This commit is contained in:
mtgto
2019-12-19 22:08:30 -08:00
committed by Daniel Rosenwasser
parent db3ff1623a
commit c5bbcb252c
2 changed files with 14 additions and 8 deletions
+4 -3
View File
@@ -278,9 +278,10 @@ export interface Layout {
legend: Partial<Legend>;
font: Partial<Font>;
scene: Partial<Scene>;
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[];
}
+10 -5
View File
@@ -141,11 +141,11 @@ const graphDiv = '#test';
// Plotly.relayout
// update only values within nested objects
(() => {
const update = {
const update: Partial<Layout> = {
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<PlotData> = {
marker: { color: 'red' },
type: 'bar'
};
const layout_update = {
const layout_update: Partial<Layout> = {
title: 'some new title', // updates the title
barmode: 'stack',
barnorm: 'fraction',
bargap: 0,
bargroupgap: 0,
};
Plotly.update(graphDiv, data_update, layout_update);
})();