2014-02-21 85 views
1

使用以下示例酒窩圖表的變體,如何使用Shiny bootstrap自動縮放,而不必硬編碼圖表的高度和寬度?rcharts微凹泡泡圖表

#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 

回答

4

嗨,你必須把width="100%"dplot(),像這樣:

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

非常感謝您回答這個;我正在嘗試將所有新的酒窩功能都納入到這裏https://github.com/timelyportfolio/rCharts/tree/dimple_layer,如果你想成爲前沿的話。這裏是一個例子http://bl.ocks.org/timelyportfolio/8869959。我會喜歡想法或想法。 – timelyportfolio

+0

偉大的工作!這非常有趣,圖表很棒。如果我有一些想法,我會告訴你。 – Victorp

+0

感謝指針@Victorp我設法讓JQuery和Bootstrap更深入。最大的痛苦是固定的尺寸,但帶腳手架的腳手架非常有用。 – digdeep