Search code examples
rrchartsshiny-serverdimple.js

rcharts dimple bubble chart in shiny


Using a variation of the below example dimple chart, how can I get this to auto scale with Shiny bootstrap without having to hard code height and width of the chart?

#get data used by dimple for all of its examples as a first test
data <- read.delim(
  "http://pmsi-alignalytics.github.io/dimple/data/example_data.tsv"
)

#eliminate . to avoid confusion in javascript
colnames(data) <- gsub("[.]","",colnames(data))


#example 27 Bubble Matrix
d1 <- dPlot(
  x = c( "Channel", "PriceTier"),
  y = "Owner",
  z = "Distribution",
  groups = "PriceTier",
  data = data,
  type = "bubble",
  aggregate = "dimple.aggregateMethod.max"
)
d1$xAxis( type = "addCategoryAxis" )
d1$yAxis( type = "addCategoryAxis" )
d1$zAxis( type = "addMeasureAxis", overrideMax = 200 )
d1$legend(
  x = 200,
  y = 10,
  width = 500,
  height = 20,
  horizontalAlign = "right"
)
d1

Solution

  • Hi you have to put width="100%" in dplot(), like this :

    d1 <- dPlot(
      x = c( "Channel", "PriceTier"),
      y = "Owner",
      z = "Distribution",
      groups = "PriceTier",
      data = data,
      type = "bubble",
      aggregate = "dimple.aggregateMethod.max",
      width="100%"
    )