PMSI-AlignAlytics / dimple

An object-oriented API for business analytics
Other
2.73k stars 556 forks source link

Question about Text inside pieCharts #232

Closed DavidStrada closed 8 years ago

DavidStrada commented 8 years ago

Hey, I have a question about what would be the ideal way of inserting or achieving the following :

screen shot 2016-05-22 at 1 52 28 pm

I have tried to implement it but not sure about how good/bad it's, base on your experience how would you doit ?

here's the link to. Implementation Attempt

Thanks,

johnkiernander commented 8 years ago

The general approach you've used for adding the text is fine. I've adjusted your code to center it in a more flexible way. The key changes are adding:

.style("text-anchor", "middle")

to horizontally center text and:

.attr("dy", "0.35em")

which vertically centres the text.

Here's the updated bin:

http://jsbin.com/digegec/1/edit?js,output

DavidStrada commented 8 years ago

Thanks! appreciated

On May 22, 2016, at 2:27 PM, John Kiernander notifications@github.com wrote:

The general approach you've used for adding the text is fine. I've adjusted your code to center it in a more flexible way. The key changes are adding:

.style("text-anchor", "middle") to horizontally center text and:

.attr("dy", "0.35em") which vertically centres the text.

Here's the updated bin:

http://jsbin.com/digegec/1/edit?js,output http://jsbin.com/digegec/1/edit?js,output — You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/PMSI-AlignAlytics/dimple/issues/232#issuecomment-220854268