Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

bug(arc): label threshold not working properly for Pie and Donut #1298

Closed
michkami opened this issue Apr 1, 2020 · 2 comments
Closed

bug(arc): label threshold not working properly for Pie and Donut #1298

michkami opened this issue Apr 1, 2020 · 2 comments

Comments

@michkami
Copy link
Collaborator

michkami commented Apr 1, 2020

Description

By setting label_threshold for pie or donut it rerenders wrong texts after hiding columns.
As you can see in the example below (dame config as at the bottom of this issue), it shows 25.0% on data1, which shouldn't be there, as the threshold is set to 0.2 and data1's value is 10.
bug

This is how it should look like:
fix

It seems like changing this condition to:

const text = isUnderThreshold ?
	($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, id).toString() :
	"";

setTextValue(node, text, [-1, 1], hasGauge);

will fix the problem, as it will replace the text with value < threshold with an empty string.

Steps to check or reproduce

  1. Open this chart
  2. Use following code:
var chart = bb.generate({
  data: {
    columns: [
	["data1", 10],
	["data2", 30],
	["data3", 60]
    ],
    type: "pie"
  },
  pie: {
	label:{
		threshold: 0.2
	}
  },
  bindto: "#pieChart"
});
  1. Hide data3.
  2. Show data3
@netil netil added the bug label Apr 1, 2020
@netil
Copy link
Member

netil commented Apr 1, 2020

@michkami, thanks for the report!
I'll check that.

@netil netil closed this as completed in 46a2bea Apr 2, 2020
netil added a commit that referenced this issue Apr 2, 2020
netil pushed a commit that referenced this issue Apr 3, 2020
## [1.12.2](1.12.1...1.12.2) (2020-04-03)

### Bug Fixes

* **arc:** Fix label text update w/threshold ([46a2bea](46a2bea)), closes [#1298](#1298)
* **shape:** Fix non-grouped area/bar to be drawn from bottom of x Axis ([a47a829](a47a829)), closes [#1302](#1302)
@netil
Copy link
Member

netil commented Apr 3, 2020

🎉 This issue has been resolved in version 1.12.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@netil netil added the released label Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants