Forum Discussion
d3 v4 and selectionManager
- 8 years ago
It seems d3v4 handles selections in a different they in comparison to d3v3.
We'd recommend to take a look at this fixed version.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
We'd recommned to ask developer of d3 or d3 types about this issue.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Alright, i have found out how d3 selections work:
private chartSelection: d3.Selection<d3.BaseType, ChartDataPoint, d3.BaseType, any>;
private svg: d3.Selection<SVGElement, {}, HTMLElement, any>;
private g: d3.Selection<SVGElement, {}, HTMLElement, any>;But the problem seems to be something else because the syncSelectionState(): void
dont work (no Errors are shown). That means i can not click on a specific datapoint.
It also seems to be that by installing the newest version of d3 ([email protected] @types/[email protected]) it also installed a different version of typescript (there is are new typescript folder in my node_modules). So the syntax changed a bit.
//For e.g. instead of
this.svg.attr({
width: width,
height: height
});
//I now have to write it like this:
this.svg
.attr('width', width)
.attr('height', height);
However, the selectionIds actually exist for each datapoint (I can for e.g. change the color of each datapoint over formatting options)
this.datapoint.selectionId.getSelector()
I cant understand why the selectionManager wont work, where it should be working now.
Here is my whole code for download: MyGoogleDrive
Is there someone who is also using d3 v4 and managed to get selectionManager working?
I would be very thankful!