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

piechart not drawn correctly #18

Open
valendinosaurus opened this issue Nov 18, 2019 · 5 comments
Open

piechart not drawn correctly #18

valendinosaurus opened this issue Nov 18, 2019 · 5 comments

Comments

@valendinosaurus
Copy link

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.

b1

@jolo-dev
Copy link

jolo-dev commented Feb 9, 2020

Hi @valendinosaurus,
could you provide your code?

@valendinosaurus
Copy link
Author

valendinosaurus commented Feb 12, 2020

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.

@jolo-dev
Copy link

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.

@vcheeze
Copy link

vcheeze commented Jul 4, 2021

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?

@jolo-dev
Copy link

jolo-dev commented Jul 4, 2021

Hi @vcheeze,

Sorry, totally forgot about this.
I would love your contribution :)

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

3 participants