0.4.0-12 • Published 6 years ago

@ng-vcl/plotly v0.4.0-12

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

21.03.2017.

Be aware of this Plotly bug.

API

Properties:

Input()

NameTypeDefaultDescription
debug (1)booleanfalsewhether to output debug information in the console
plotIdstring''plot div id
plotHoverInfoIdstring''hoverinfo div id, defaults to ${this.plotId}HoverInfo
plotClassstring''plot div classes
plotHoverInfoClassstring''hoverinfo div classes

data | Plotly.Data[] | | plot data layout | Plotly.Layout | | plot layout configuration | Plotly.Configuration | | plot configuration events | event: string: Function | | plot events, see "Attaching events" below frames | Plotly.Frame | | plot frames

width | number | | the width of the plot in percentage relative to the parent element height | number | | the height of the plot in percentage relative to the parent element

Public

afterPlot | boolean | | Whether the plot has been drawn for the first time plot | HTMLElement | | The plot's HTML element hoverInfo | HTMLElement | | An HTML element which can be used as a custom hoverinfo

(1) Suggested use is in conjunction with browsing the vcl-plotly code

Methods:

NameArgumentsDescription
restyleupdate: any, traces?: number[]Plotly.restyle wrapper
resizePlotly.resize wrapper - resize the plot
relayoutlayout: any = this.layoutPlotly.relayout wrapper
updatePlotly.update wrapper
redrawPlotly.redraw wrapper - force a full recalculation and redraw of the plot
recreatePlotly.newPlot wrapper
addTracestraces: any OR any[], index?: numberPlotly.addTraces wrapper
deleteTracestraces: number OR number[]Plotly.deleteTraces wrapper

Usage

Using with webpack

The plotly package provides a special entry point for webpack. Add "webpack" to resolve.mainFields in your webpack config file.

resolve: { mainFields: "webpack", "module", "browser", "main", ... }

Importing plotly (polyfills.ts or some other file)

if you want to use plotly in combination with zone.js, you must include plotly before zone.js in your project!

import '@ng-vcl/plotly';

import 'zone.js/dist/zone';

See also: https://github.com/plotly/plotly.js/issues/955.

app.module.ts

import { VCLPlotlyModule } from '@ng-vcl/plotly';

@NgModule({
    ...
    imports: [
      VCLPlotlyModule
    ]
    ...
})
export class AppModule {}

myAwesomePlotly.component.ts

<vcl-plotly *ngIf="data"
  [debug]="debug"
  [plotId]="plotId"
  [data]="data"
  [layout]="layout"
  [configuration]="configuration"
  [events]="events">
</vcl-plotly>

Attaching events

The events field is an object just like layout and configuration. To attach your custom events to the plotly plot, see the possible events and create them like so:

const events = {
  plotly_click: (data: any, event: any, plotId: string, plot: any, Plotly: any) => {
    ...
  }
}

Note: if you want to add a plotly_afterplot event handler, you'll have to manually set afterPlot to true.

vclPlotlyComponent.afterPlot = true

Debug

It's also possible to enable the debug flag to output information in the console.

<vcl-plotly
  ...
  [debug]="true"
  ...>
</vcl-plotly>
0.4.0-12

6 years ago

0.4.0-11

6 years ago

0.4.0-8

6 years ago

0.4.0-6

6 years ago

0.4.0-5

6 years ago

0.4.0-4

6 years ago

0.4.0-3

6 years ago

0.4.0-2

6 years ago

0.4.0-1

6 years ago

0.4.0-0

6 years ago

0.3.19

6 years ago

0.3.18

7 years ago

0.3.17

7 years ago

0.3.16

7 years ago

0.3.14

7 years ago

0.3.13

7 years ago

0.3.12

7 years ago

0.3.11

7 years ago

0.3.10

7 years ago

0.3.9

7 years ago

0.3.8

7 years ago

0.3.7

7 years ago

0.3.6

7 years ago

0.3.5

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.3-9

7 years ago

0.3.3-8

7 years ago

0.3.3-7

7 years ago

0.3.3-6

7 years ago

0.3.3-5

7 years ago

0.3.3-4

7 years ago

0.3.3-3

7 years ago

0.3.3-2

7 years ago

0.2.14

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.3.1-1

7 years ago

0.3.1-0

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.5

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.10

7 years ago