From 0495ae4111f4495ca6514253ac2ff6acf77a876b Mon Sep 17 00:00:00 2001 From: mtgto Date: Sun, 8 Dec 2019 05:37:06 +0900 Subject: [PATCH] plotly.js: Move direction from Layout to PlotData (#40889) --- types/plotly.js/index.d.ts | 2 +- types/plotly.js/test/core-tests.ts | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index d3f85f431c..f1364f1845 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -266,7 +266,6 @@ export interface Layout { mapbox: {}; // TODO radialaxis: Partial; angularaxis: {}; // TODO - direction: 'clockwise' | 'counterclockwise'; dragmode: 'zoom' | 'pan' | 'select' | 'lasso' | 'orbit' | 'turntable' | false; orientation: number; annotations: Array>; @@ -630,6 +629,7 @@ export interface PlotData { value: number; values: Datum[]; labels: Datum[]; + direction: 'clockwise' | 'counterclockwise'; hole: number; rotation: number; theta: Datum[]; diff --git a/types/plotly.js/test/core-tests.ts b/types/plotly.js/test/core-tests.ts index ba48a8ee03..c24245167e 100644 --- a/types/plotly.js/test/core-tests.ts +++ b/types/plotly.js/test/core-tests.ts @@ -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> = [ + { + values: [19, 26, 55], + labels: ['Residential', 'Non-Residential', 'Utility'], + type: 'pie', + direction: 'counterclockwise', + }, + ]; + const layout = { + height: 400, + width: 500 + }; + Plotly.newPlot('myDiv', data, layout); +})(); + ////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////