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

example 49 plots a straight line as layer? #11

Open happyshows opened 9 years ago

happyshows commented 9 years ago

Hi,

I was looking for some overlay capabilities in this package like one existed in rCharts: d1$layer(with a different datasource). However when I ran the example #49, it doesn't seem to be working. I'm not sure whether its the problem with chrome or package itself. At least in Rstudio it didn't work either.

untitled

example 49 multiple layers qq style plot with 2 datasets

df <- data.frame( id = 1:100, x=ppoints(100), y=sort(rnorm(100)), #100 random normal distributed points
normref=qnorm(ppoints(100))#lattice uses ppoints for the x )

dimple( y ~ x, #x ~ id for a different look groups = c("id","sample"), data = df[,c("id","x","y")], #specify columns to prove diff data type = "bubble" ) %>% xAxis(type="addMeasureAxis",orderRule="x") -> d1 d1

now add a layer with a line to represent normal distribution

! note: this is buggy with Chrome, but works in IE (don't hear that often)

will eventually add full layer integration for dimple

d1$x$options$layers = list(list( x = "x", y = "normref", groups = c("id","sample"), data=df[,c("id","x","normref")], #specify columns to prove diff data type="line" ))

layers don't line up

for now to make it work, need overrideMin and overrideMax

d1 %>% yAxis( overrideMin = min(df$y), overrideMax = max(df$y), outputFormat = "0.2f" ) %>% xAxis( overrideMin = 0, overrideMax = 1)

timelyportfolio commented 9 years ago

This currently is not working. I need to move the facet transform to other layer data, or just remove facets. Will let you know.