plotly.js: Move direction from Layout to PlotData (#40889)

This commit is contained in:
mtgto
2019-12-08 05:37:06 +09:00
committed by Ron Buckton
parent 856744a363
commit 0495ae4111
2 changed files with 19 additions and 2 deletions

View File

@@ -266,7 +266,6 @@ export interface Layout {
mapbox: {}; // TODO
radialaxis: Partial<Axis>;
angularaxis: {}; // TODO
direction: 'clockwise' | 'counterclockwise';
dragmode: 'zoom' | 'pan' | 'select' | 'lasso' | 'orbit' | 'turntable' | false;
orientation: number;
annotations: Array<Partial<Annotations>>;
@@ -630,6 +629,7 @@ export interface PlotData {
value: number;
values: Datum[];
labels: Datum[];
direction: 'clockwise' | 'counterclockwise';
hole: number;
rotation: number;
theta: Datum[];

View File

@@ -1,5 +1,5 @@
import * as Plotly from 'plotly.js/lib/core';
import { Datum, ScatterData, Layout, PlotlyHTMLElement, newPlot } from 'plotly.js/lib/core';
import { Datum, ScatterData, Layout, PlotlyHTMLElement, newPlot, PlotData } from 'plotly.js/lib/core';
const graphDiv = '#test';
@@ -43,6 +43,23 @@ const graphDiv = '#test';
Plotly.newPlot(graphDiv, data2, layout2);
})();
// Plotly.newPlot (bar)
(() => {
const data: Array<Partial<PlotData>> = [
{
values: [19, 26, 55],
labels: ['Residential', 'Non-Residential', 'Utility'],
type: 'pie',
direction: 'counterclockwise',
},
];
const layout = {
height: 400,
width: 500
};
Plotly.newPlot('myDiv', data, layout);
})();
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////