made selected data point more general for bar plots etc (#29582)

This commit is contained in:
Megan Riel-Mehan
2018-10-09 11:29:48 -07:00
committed by Andy
parent 7ac171e685
commit 63fe7c321d
3 changed files with 20 additions and 9 deletions

View File

@@ -39,8 +39,19 @@ export interface PlotScatterDataPoint {
yaxis: LayoutAxis;
}
export interface PlotDatum {
curveNumber: number;
data: PlotData;
pointIndex: number;
pointNumber: number;
x: Datum;
xaxis: LayoutAxis;
y: Datum;
yaxis: LayoutAxis;
}
export interface PlotMouseEvent {
points: PlotScatterDataPoint[];
points: PlotDatum[];
event: MouseEvent;
}
@@ -55,10 +66,10 @@ export interface SelectionRange {
y: number[];
}
export type PlotSelectedData = Partial<PlotScatterDataPoint>;
export type PlotSelectedData = Partial<PlotDatum>;
export interface PlotSelectionEvent {
points: PlotScatterDataPoint[];
points: PlotDatum[];
range?: SelectionRange;
lassoPoints?: SelectionRange;
}

View File

@@ -1,5 +1,5 @@
import * as Plotly from 'plotly.js/lib/core';
import { ScatterData, Layout, PlotlyHTMLElement, newPlot } from 'plotly.js/lib/core';
import { Datum, ScatterData, Layout, PlotlyHTMLElement, newPlot } from 'plotly.js/lib/core';
const graphDiv = '#test';
@@ -336,8 +336,8 @@ function rand() {
});
myPlot.on('plotly_selected', (data) => {
const x = [] as number[];
const y = [] as number[];
const x = [] as Datum[];
const y = [] as Datum[];
const N = 1000;
const color1 = '#7b3294';
const color1Light = '#c2a5cf';

View File

@@ -1,5 +1,5 @@
import * as Plotly from 'plotly.js';
import { Layout, PlotData, PlotlyHTMLElement, newPlot } from 'plotly.js';
import { Datum, Layout, PlotData, PlotlyHTMLElement, newPlot } from 'plotly.js';
const graphDiv = '#test';
@@ -446,8 +446,8 @@ function rand() {
});
myPlot.on('plotly_selected', (data) => {
const x = [] as number[];
const y = [] as number[];
const x = [] as Datum[];
const y = [] as Datum[];
const N = 1000;
const color1 = '#7b3294';
const color1Light = '#c2a5cf';