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

Doughnut slice disappears when data label is same as a html colour #3321

Closed
manijbasnet opened this issue Aug 4, 2023 · 3 comments
Closed

Comments

@manijbasnet
Copy link

manijbasnet commented Aug 4, 2023

Description

On a doughnut chart, if i have a label that is also a html colour name (e.g. Gold, Silver, etc), the slice with that colour disappears when my cursor enters the area. The slice does not reappear when my cursor leaves the area. Below is the example i used from the demo link (https://naver.github.io/billboard.js/demo/#Chart.DonutChart) but i have changed the label.

Steps to check or reproduce

var chart = bb.generate({
  data: {
    columns: [
	["data1", 30],
	["data2", 120]
    ],
    type: "donut", // for ESM specify as: donut()
    onclick: function(d, i) {
	console.log("onclick", d, i);
   },
    onover: function(d, i) {
	console.log("onover", d, i);
   },
    onout: function(d, i) {
	console.log("onout", d, i);
   }
  },
  donut: {
    title: "Iris Petal Width"
  },
  bindto: "#donutChart"
});

setTimeout(function() {
	chart.load({
		columns: [
			["gold", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2],
			["silver", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, 1.0, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3],
			["bronze", 2.5, 1.9, 2.1, 1.8, 2.2, 2.1, 1.7, 1.8, 1.8, 2.5, 2.0, 1.9, 2.1, 2.0, 2.4, 2.3, 1.8, 2.2, 2.3, 1.5, 2.3, 2.0, 2.0, 1.8, 2.1, 1.8, 1.8, 1.8, 2.1, 1.6, 1.9, 2.0, 2.2, 1.5, 1.4, 2.3, 2.4, 1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2.0, 2.3, 1.8],
		]
	});
}, 1500);

setTimeout(function() {
	chart.unload({
		ids: "data1"
	});
	chart.unload({
		ids: "data2"
	});
}, 2500);
@manijbasnet manijbasnet changed the title Doughnut slice disappear when data label is a html colour name Doughnut slice disappears when data label is same as a html colour Aug 4, 2023
@watnab
Copy link

watnab commented Aug 7, 2023

the slice with that colour disappears

The "d" attribute of the path element of the slice seems to be broken.
d="M 0 0"

@watnab
Copy link

watnab commented Aug 8, 2023

return updated ? <string>arc.cornerRadius(cornerR)(updated) : "M 0 0";

It seems updated can be null when the label is same as a html color.
I could not see the reason though.

@netil
Copy link
Member

netil commented Aug 8, 2023

Hi @manijbasnet, it seems a side effect from #2938 (starting from v3.7)

netil pushed a commit to netil/billboard.js that referenced this issue Aug 9, 2023
For interpolation, make sure to be applied only necessary values.
Issue happend becasue colorish string were interpolated, which transformed
id values as interpolated color string.

Ref naver#3321
netil pushed a commit to netil/billboard.js that referenced this issue Aug 9, 2023
For interpolation, make sure to be applied only necessary values.
Issue happened because colorish string were interpolated, which transformed
id values as interpolated color string.

Ref naver#3321
netil pushed a commit to netil/billboard.js that referenced this issue Aug 9, 2023
For interpolation, make sure to be applied only necessary values.
Issue happened because colorish string were interpolated, which transformed
id values as interpolated color string.

Ref naver#3321
@netil netil closed this as completed in 64e6e3c Aug 9, 2023
netil added a commit that referenced this issue Aug 9, 2023
For interpolation, make sure to be applied only necessary values.
Issue happened because colorish string were interpolated, which transformed
id values as interpolated color string.

Fix #3321
github-actions bot pushed a commit that referenced this issue Aug 9, 2023
## [3.9.3](3.9.2...3.9.3) (2023-08-09)

### Bug Fixes

* **arc:** Fix shape rendering when data id equivalent of color string ([047d1db](047d1db)), closes [#3321](#3321)
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

3 participants