Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

dc sunburst chart - externalLabels not working #1867

Open
rfx77 opened this issue May 11, 2022 · 0 comments
Open

dc sunburst chart - externalLabels not working #1867

rfx77 opened this issue May 11, 2022 · 0 comments

Comments

@rfx77
Copy link

rfx77 commented May 11, 2022

when i set the externalLabels on a sunburst chart all labels are displayed in the center of the chart.

the problem is that startAngle and endAngle is not set on the d3Shape.arc in the function _labelPositon.
when i change to

_labelPosition (d, _arc) {
         let centroid;
         if (this._externalLabelRadius) {
             centroid = d3Shape.arc()
                 .startAngle(d => d.x0)
                 .endAngle(d => d.x1)
                 .outerRadius(this._radius + this._externalLabelRadius)
                 .innerRadius(this._radius + this._externalLabelRadius)
                 .centroid(d);
         } else {
             centroid = _arc.centroid(d);
         }
         if (isNaN(centroid[0]) || isNaN(centroid[1])) {
             return 'translate(0,0)';
         } else {
             return `translate(${centroid})`;
         }
     }

the labels are displayed but labels of each path in the tree overwrite each other. so the position in the path should be taken into account.

versions:
"d3": "^6.6.2",
"dc": "^4.2.7"

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant