why is arc labels blurred in my d3js pie chart?

。_饼干妹妹 提交于 2020-05-15 18:26:07

问题


I am having a piechart drawn using d3js. to the arc labels i am applying the following style.

.pieChartOuterLabel {
  font-size: 1em;
  fill: black;
  font-weight: bold;
  font-family: 'Times New Roman, Times, serif';
}

this is how my pie chart looks like. you can see the the percentage text labels are blurred ( it seems the other css styles applied to the parent elements are setting opacity to .5 to these labels).

i have tried this but it didnt work well.

.pieChartOuterLabel {
  font-size: 1em;
  fill: black;
  font-weight: bold;
  font-family: 'Times New Roman, Times, serif';
  opacity: 1 !important;
}

the project is available at here . what i expect the arc labels should be displayed in the same style that those in the center text of the doughnut chart.

https://stackblitz.com/edit/angular-6ufows

really appreciate if you can help thank you


回答1:


I fixed it by removing the opacity:0.5 that you have on all your <g> elements, and applying the opacity on the arcs paths using mouse events, also I moved the tooltip a bit higher since it makes it hard to hover the arcs, here is a working stackblitz



来源:https://stackoverflow.com/questions/60871670/why-is-arc-labels-blurred-in-my-d3js-pie-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!