-
Notifications
You must be signed in to change notification settings - Fork 88
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
change font size and space between 2 boxes #6
Comments
To narrow the diagram, set the 'display_width' property of the sankey object:
You may also have to adjust the box width property to make it look ok:
At the moment there isn't an easy way of setting the font size that works across browsers. Once again you need to hack the sankey.js code a bit to add some extra font attributes, as documented in the Raphael library here: http://raphaeljs.com/reference.html#Element.attr You are looking to add a 'font-size' attribute to the array, with the size in pixels. The extra attributes need to go in the hashes at these lines: Hope that works. Tom |
Hi Tom, thanks for your help. I could change the width with success. I also manage to change the font size (font-size) of the input and output boxes and on the lines, but the name of the boxes remained small.. :-( here is how it looks like: http://i.imgur.com/QWXLI.png can you give me a last hand on this? |
Ok. For the text inside the box, can you check you added a font size attribute to this line: For the numbers above the boxes, add something like .attr({'font-size':10}) to the end of this lineL Does that work? Tom |
I tried to convert like 581 into this:
but it didn't work. i was also uable to add the attribute to l408... can you send an example on how this can be done? |
Ok. Just in case it works for you, there is an alternative approach that is simpler but only works on some browsers (definitely not older versions of IE). This just requires you to add some css to your webpage: 3686e24 On the x-browser approach we have been working on, you wrote:
But unfortunately javascript can't merge hashes like that. Doing this should work:
And for line 408, not sure what I was thinking. Sorry. I think I meant to say line 528: Which should be changed to something like:
Hope that helps. Tom |
Hi Tom, Thanks for this tool ‒ it's been very helpful! I do however have a similar problem to otmezger. I'm trying to add 'font-size' attributes to the relevant lines (305, 308, 520, 525, 528) as suggested in your comment from 3 Dec 2012, without much success. I'm wondering if the relevant line numbers have changed following alterations to the code since Dec 2012? Or perhaps I'm just making a mistake, in which case, please could you provide an example of what a line should look like? Many thanks, |
Hi Tom The lines probably changed. For the lines: For the boxes: Numbers on the top of the boxes: https://github.com/tamc/Sankey/blob/master/js/sankey.js#L658 Sorry this is a bit of an effort to do. This code has not had a lot of love recently. Hopefully I'll get a moment to update it sometime soon. |
That works perfectly. Thanks Tom! |
hi again,
is there a way to define the space between 2 boxes? I need to narrow my diagram so it will fit in my report.
I would also like to increase the font size.... is there a way to do that on the js?
I could not find any "font size" setting....
Thanks!
The text was updated successfully, but these errors were encountered: