timelyportfolio / rcdimple

htmlwidgets for rCharts + dimple
http://www.buildingwidgets.com/blog/2015/3/18/week-11-dimple-as-htmlwidget
MIT License
28 stars 9 forks source link

What's the function to adjust the labels on xAxis to fit in canvas better? #5

Open happyshows opened 9 years ago

happyshows commented 9 years ago

I tried to use set_bounds to expand the space to allow it automatically fit in, but I'm not sure whether it's the right thing to do.

timelyportfolio commented 9 years ago

set_bounds is the correct method of placing the graph within the SVG container. Note, you can use both percentage value and/or integers (in px).

happyshows commented 9 years ago

k thanks. What's the function to set the dimension of SVG container? It seems that container starts to trim canvas when height pass 360px?

timelyportfolio commented 9 years ago

height and width parameters control the size of the dimple container. Below 400 px you'll probably start seeing some clipping, but for the example below 200 even works.

library(rcdimple)

dimple(
  data = data.frame(name = rownames(mtcars), mtcars )
  , mpg ~ hp
  , groups = c("name", "cyl")
  , type = "bubble"
  , xAxis = list( type = "addMeasureAxis" )
  , height = 200
  , width = 200
)