piechart not drawn correctly
When drawing a pie chart, somehow there are areas which are drawn two times, as visible in the screenshot. also, the message popup box on hover is displaced underneath the graph.
Hi @valendinosaurus, could you provide your code?
Hi @jolo-dev
In my service, I create the chart like this
new roughViz.Pie({
element: element,
data: data,
width: width,
height: height,
roughness: roughness,
fillStyle: 'hachure',
fillWeight: 4,
innerStrokeWidth: 1,
simplification: 0.5,
axisFontSize: '1rem',
tooltipFontSize: '1rem',
labelFontSize: '1rem',
titleFontSize: '1rem',
axisRoughness: 0.5
});
and my data gets created like following
mapAccountsForRoughViz(accounts: AccountNormalized[]): {} {
let labels = [];
let values = [];
accounts.forEach(a => {
labels.push(a.name);
values.push(a.saldo);
});
return {labels, values};
}
resulting in this effective data
{
"labels":
["Hauptkonto","Sparkonto"],
"values":
[1064.5899999999701,3497.4500000000007]
}
I also tried to round the numbers with Math.round() resulting in
{
"labels":
["Hauptkonto","Sparkonto"],
"values":
[1065,3497]
}
but the result is the same. I have another chart at a different place with more than two elements, there I never saw this behaviour. Funny enough, from time to time the chart with only two elements gets drawin correctly, but I couldn't reproduce the behaviour.
I suspect it has something to do with having only two elements, if I alter my function mapAccountsForRoughViz that it pushes everything twice (resulting in 4 elements), the chart gets drawn correctly.
Oh yes, you're right. With two elements there is "weird" behavior. I have tested that in the example: https://blockbuilder.org/jwilber/d117e0b0864a161bec2d914013ed69da
Let me check what I can do.
Hi @jolo-dev, just wondering if you have any updates on this or any suggestions/direction for me to try and resolve it if I can?
Hi @vcheeze,
Sorry, totally forgot about this. I would love your contribution :)