2017-10-26 3 views
0

R에서는 탭을 사용하는 flexdashboard 레이아웃으로 shiny 앱을 만들고 있습니다. 하나의 탭에 dygraph을 포함시키고 싶지만 차트가 컨테이너 밖으로 나옵니다. 나는 폭과 높이를 모두 dygraph과 출력에서 ​​변경하려고했지만 그 중 아무 것도 작동하지 않는 것 같습니다.반짝이는 플렉스 대시 탭 세트 레이아웃 내에서 다이알 그래프 위젯의 크기를 올바르게 조정하려면 어떻게해야합니까?

최소 작업 예 :

--- 
title: "Example" 
output: 
flexdashboard::flex_dashboard: 
orientation: columns 
vertical_layout: fill 
runtime: shiny 
--- 

```{r global, include=FALSE} 
library(dygraphs) 
data=data.frame(x=1:10,y=11:20,val=21:30) 

ymin=min(data$y,na.rm=TRUE) 
ymax=max(data$y,na.rm=TRUE) 

``` 

TABS {.tabset} 
----------------------------------------------------------------------- 

### Tab1 



```{r singleSlider } 
sliderInput("sliceval", "Observation:", 
      min = ymin, max = ymax,step=1, 
      value = 11,width="90%") 



``` 

```{r dygraph} 

# Tried also changing height width to px 
output$sliceGraph <- renderDygraph({ 
    dygraph(data[input$sliceval>=data$y,c("x","val")],height="50%",width="80%") 
}) 

# Tried also changing height width to % 
dygraphOutput("sliceGraph",height='100px',width='100px') 


``` 

### Tab 2 

Some stuff here 

는 레이아웃에 제대로 dygraph에 맞게 할 수있는 방법이 있습니까?

답변

1

내가 다시 documentation for using flexdashboard를 살펴보고 사용하는 거라고 그들보다 더 컨트롤을 행사 fillCol 또는 fillRow을 권장합니다. 특히 다음 레이아웃을 사용해보십시오.

```{r singleSlider, echo=FALSE} 
fillCol(height = 600, flex = c(NA, 1), 
    sliderInput("sliceval", "Observation:", 
      min = ymin, max = ymax,step=1, 
      value = 11,width="90%"), 
    # Tried also changing height width to % 
    dygraphOutput("sliceGraph",height='400px',width='100%') 
) 


# Tried also changing height width to px 
output$sliceGraph <- renderDygraph({ 
    dygraph(data[input$sliceval>=data$y,c("x","val")],height="50%",width="80%") 
}) 
``` 
+0

감사합니다. 나는 그 모범을 보았지만 그것을 실천할 수는 없었다. –

+0

충분히 좋습니다. 합리적으로 보였던 것을 발견 할 때까지 대부분 CSS의 높이로 놀았습니다. –

관련 문제