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

Pie Chart show wrong with big value #6419

Open
Duc-Developer opened this issue Dec 27, 2022 · 1 comment
Open

Pie Chart show wrong with big value #6419

Duc-Developer opened this issue Dec 27, 2022 · 1 comment

Comments

@Duc-Developer
Copy link

Duc-Developer commented Dec 27, 2022

Hi Team,
I have an issue with Pie Chart. When my first value has a very large value compared to the rest, the chart will lose part or all of the image.
image

jsfiddle: https://jsfiddle.net/5u4zyoLd/
Here is my configuration.

var data =[
{
"type": "pie",
"values": [
"34000000000.00",
"20.4716",
"245.50"
],
"labels": [
"static 34,000,000,000: 34,000,000,000 ",
"Data 1: 20.4716 ",
"Data 2: 245.50 "
],
"marker": {
"colors": [
"#f8fc94",
"#769558",
"#b0cb34"
]
},
"textinfo": "percent",
"textfont": {
"family": "Noto Sans",
"size": 13
},
"text": [
"
static 34,000,000,000: 34,000,000,000",
"2022-12-27 (11:15:00.000)
Data 1: 20.4716 (t)",
"2022-12-27 (11:15:00.000)
Data 2: 245.50 (°)"
],
"hovertemplate": "%{text}
%{percent:.1%}",
"sort": false,
"hoverlabel": {
"align": "right",
"font": {
"family": "Noto Sans",
"size": 13
}
},
"outsidetextfont": {
"color": "#d1d9e0"
},
"texttemplate": "%{percent:.1%}"
}
];

var layout = {
"title": "",
"margin": {
"t": 0,
"b": 20,
"l": 40
},
"legend": {
"traceorder": "normal",
"borderwidth": 0,
"font": {
"color": "#d1d9e0",
"family": "Noto Sans",
"size": 13
}
},
"showlegend": true,
"hovermode": "false",
"width": 1000,
"height": 400
};

@alexcjohnson
Copy link
Contributor

Thanks @Duc-Developer - I see it too, looks like this gets below the precision of the SVG rendering engine, I can trace this down to the path attribute, and two paths that should give nearly the same result put the nearly-full circle in totally different places.

@archmoj maybe we can address this by breaking the arc into two pieces when it's >180 degrees? By the same token I wouldn't be surprised if there's a situation where a very small arc would decide to go the other way around and turn into almost the whole circle (or vice versa but breaking a large arc into two would fix that)... so if the arc is less than say a tenth of a degree maybe we should just turn it into a line?

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

No branches or pull requests

2 participants