jeromefroe / circlepackeR

R htmlwidget for circle packing visualization
http://jeromefroe.github.io/circlepackeR/
MIT License
25 stars 13 forks source link

line breaks with /n #9

Open bookerbn opened 5 years ago

bookerbn commented 5 years ago

Hello, I am developing a shiny app and am using circlepackeR for a visualization. I have multiple levels and everything is working fine but it does not appear that circlepackeR supports line breaks within a circle using "/n". I am trying to input two lines of text within a single circle using the following code:

data_nested$pathString <- paste(data_nested$level1, data_nested$circle1.OI.Primary, data_nested$circle1.OI.Secondary, data_nested$circle1.FEMA, paste0(data_nested$circle1.MG.Name," ", "\nFEMA", data_nested$circle1.FEMA), sep = "/") data_nested$value=7 data_Node <- as.Node(data_nested) circle <- circlepackeR(data_Node, size = "value") circle

But it still outputs the text in a single line instead of two lines. Is there anyway to create a single circle with two lines of text?

jeromefroe commented 5 years ago

Hey! My guess is that the newline isn't being handled when it's being converted to JSON via the jsonlite package. It seems the jsonlite package supports unicode characters though, what happens if you replace \n with its unicode equivalent \u000d?

bookerbn commented 5 years ago

Hi Jerome,

Thanks for you the response. Unfortunately using the Unicode text does not work either. It gives me the same output as /n

jeromefroe commented 5 years ago

That's a bummer. Unfortunately, I'm out of ideas then. I don't have the cycles to actively maintain this package anymore (I don't really have the opportunity to use R in my current position) but if you find the time to look into the root cause, I'd be more than happy to review and merge a PR.