apexcharts / apexcharts.js

📊 Interactive JavaScript Charts built on SVG
https://apexcharts.com
MIT License
14.22k stars 1.29k forks source link

toggleDataPointSelection not showing label value in donut chart #1080

Closed aospinagcg closed 2 years ago

aospinagcg commented 4 years ago

Codepen

https://codepen.io/aospinagcg/pen/gOOBdER

Explanation

The method should show the name and value of the series when in plotOptions they are showing, currently only expand the label

Mike-Gilge commented 3 years ago

I am also having this issue with the donut chart. I am trying to render the chart with a section selected and labels in the center. The labels do not show until I mouse over the chart, is there a way to fix this?

marssantoso commented 3 years ago

Is there an update on this? Still happening in version 3.26.0.

Or is there any workaround, yet?

juancdominici commented 3 years ago

Is there an update on this? Still happening in version 3.26.0.

Or is there any workaround, yet?

The tooltip only shows when the user directly interacts with the chart. It doesn't get displayed on the data-point selection. It's not a bug but the feature you're expecting isn't there. Originally posted by @junedchhipa in https://github.com/apexcharts/apexcharts.js/issues/1361#issuecomment-595896423

Hope this helps, maybe its the same for labels.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

AlanNabiev commented 2 years ago

Hi guys, I found a hack. You can use total.This is the labels property. total: { show: true, label: 'Token', formatter: (w) => { return this.selectedUserToken.usd + ' $' } } We also need a variable that will store the current value. Then we will write this variable in total.formatter (it will be reactive and the value will change accordingly). Label is more difficult. We need to create a function to change to change our a variable and also change the label there. Something like this selectUserToken (token) { this.selectedUserToken = token this.apexTokenPieChartOptions.plotOptions.pie.donut.labels.total.label = token.symbol }

benjamin-aubry commented 1 year ago

Hi, Another hack : Call toggleDataPointSelection 3 times, it works !

SilvioDiasJr commented 1 year ago

@benjamin-aubry you helped a lot! thanks