Hi again,
If someone wants to run the code in the screenshot, just use the dummy
data file attached and load this:
Gofer new
smalltalkhubUser: 'Offray' project: 'Dataviz';
package: 'Dataviz';
load.
Cheers,
Offray
On 08/12/15 21:53, Offray Vladimir Luna Cárdenas wrote:
Hi,
Some time ago I asked about how to make some kind of matrix sunburst,
like the one on [1]. Thanks to the help of the community, specially
Milton we're almost there. Look at this:
[1]
http://www.theguardian.com/world/interactive/2012/may/08/gay-rights-united-…
Now I would like to locate better the labels for each country, ideally
at the center of each arc. The important part of message which is
making this is here:
=================
PublishedMedInfo>>addLineSeparatorsTo: aView withData: data
separatedBy: aDistance centerSized: aSize
| e1 e2 ang cos sin radio label countries |
label := RTLabel new
height: 16.
countries := self medDataMatrix at: 1.
1 to: data children size do: [ :i |
e1 := (RTBox new size: 1) element.
ang := ((i - 0) * 360 / data children size) degreesToRadians.
cos := ang cos.
sin := ang sin.
radio := aSize.
e1 translateTo: (radio * cos)@(radio * sin).
e2 := (RTBox new size: 1) element.
radio := self arcWidth * 30 + aSize.
e2 translateTo: (radio * cos )@ (radio * sin).
label text: (countries at: (countries size + 1 - i)).
aView
add: e1;
add: e2;
add: (RTLine new width: aDistance; color: Color white;
edgeFrom: e1 to: e2);
add: (label element translateBy: (((radio - 70) * cos)"-
15" )@ (radio - 70 * sin) "+ 15")
]
=================
as you can see the e1 and e2 edges are the ones that create the
separation between columns in the matrix sunburst and are computed
inside an iterator. I would like to keep a temporal edge that stores
the value of the e2 edge in the previous run and locate the label in
the coordinates between actual e2 and the previous one (lets call it
"edgeTemp"). How can I do this?
Thanks,
Offray
Ps: I have subscribed this new direction because my previous one is
failing tonight. Probably I will unsubscribe the previous and keep
this one for Pharo and Moose mailing lists.
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev