in src/TornadoChart.ts [512:551]
public update(options: VisualUpdateOptions): void {
if (!options ||
!options.dataViews ||
!options.dataViews[0] ||
!options.dataViews[0].categorical ||
!options.dataViews[0].categorical.categories ||
!options.dataViews[0].categorical.categories[0] ||
!options.dataViews[0].categorical.categories[0].source ||
!options.dataViews[0].categorical.values ||
!options.dataViews[0].categorical.values[0] ||
!options.dataViews[0].categorical.values[0].values ||
!options.dataViews[0].categorical.values[0].values.length) {
this.clearData();
return;
}
this.viewport = {
height: Math.max(0, options.viewport.height - this.margin.top - this.margin.bottom),
width: Math.max(0, options.viewport.width - this.margin.left - this.margin.right)
};
this.dataView = TornadoChart.CONVERTER(this.validateDataView(options.dataViews[0]), this.hostService, this.textOptions, this.colors, this.localizationManager);
if (!this.dataView || this.scrolling.scrollViewport.height < TornadoChart.CategoryMinHeight) {
this.clearData();
return;
}
this.root.on("contextmenu", () => {
const mouseEvent: MouseEvent = getEvent();
const eventTarget: EventTarget = mouseEvent.target;
let dataPoint: any = d3.select(<d3.BaseType>eventTarget).datum();
this.selectionManager.showContextMenu(dataPoint ? dataPoint.selectionId : {}, {
x: mouseEvent.clientX,
y: mouseEvent.clientY
});
mouseEvent.preventDefault();
});
this.render();
}