in src/EnhancedScatterChart.ts [568:667]
public init(options: VisualConstructorOptions): void {
this.element = options.element;
this.visualHost = options.host;
this.colorPalette = options.host.colorPalette;
this.tooltipServiceWrapper = createTooltipServiceWrapper(
this.visualHost.tooltipService,
this.element
);
this.selectionManager = this.visualHost.createSelectionManager();
this.eventService = options.host.eventService;
this.margin = {
top: EnhancedScatterChart.DefaultMarginValue,
right: EnhancedScatterChart.DefaultMarginValue,
bottom: EnhancedScatterChart.DefaultMarginValue,
left: EnhancedScatterChart.DefaultMarginValue
};
this.yAxisOrientation = yAxisPosition.left;
this.adjustMargins();
this.svg = d3.select(this.element)
.append("svg")
.classed(EnhancedScatterChart.ClassName, true);
this.axisGraphicsContext = this.svg
.append("g")
.classed(EnhancedScatterChart.AxisGraphicsContextClassName, true);
this.svgScrollable = this.svg
.append("svg")
.classed(EnhancedScatterChart.SvgScrollableSelector.className, true);
this.axisGraphicsContextScrollable = this.svgScrollable
.append("g")
.classed(EnhancedScatterChart.AxisGraphicsContextClassName, true);
this.clearCatcher = appendClearCatcher(this.axisGraphicsContextScrollable);
const axisGroup: Selection<any> = this.scrollY
? this.axisGraphicsContextScrollable
: this.axisGraphicsContext;
this.backgroundGraphicsContext = this.axisGraphicsContext.append("svg:image");
this.xAxisGraphicsContext = this.scrollY
? this.axisGraphicsContext
.append("g")
.classed(EnhancedScatterChart.XAxisSelector.className, true)
: this.axisGraphicsContextScrollable
.append("g")
.classed(EnhancedScatterChart.XAxisSelector.className, true);
this.yAxisGraphicsContext = axisGroup
.append("g")
.classed(EnhancedScatterChart.YAxisSelector.className, true);
this.xAxisGraphicsContext.classed(
EnhancedScatterChart.ShowLinesOnAxisSelector.className,
this.scrollY
);
this.yAxisGraphicsContext.classed(
EnhancedScatterChart.ShowLinesOnAxisSelector.className,
this.scrollX
);
this.xAxisGraphicsContext.classed(
EnhancedScatterChart.HideLinesOnAxisSelector.className,
!this.scrollY
);
this.yAxisGraphicsContext.classed(
EnhancedScatterChart.HideLinesOnAxisSelector.className,
!this.scrollX
);
this.interactivityService = createInteractivitySelectionService(this.visualHost);
this.legend = createLegend(
this.element,
false,
this.interactivityService,
true,
undefined,
this.colorPalette.isHighContrast
? new OpacityLegendBehavior()
: new LegendBehavior(),
);
this.mainGraphicsG = this.axisGraphicsContextScrollable
.append("g")
.classed(EnhancedScatterChart.MainGraphicsContextClassName, true);
this.mainGraphicsSVGSelection = this.mainGraphicsG.append("svg");
this.mainGraphicsContext = this.mainGraphicsSVGSelection.append("g");
}