我对Rshiny中的情节配置有疑问。基本上,我有一个条形图,我想设置一些列的宽度和相同的X值。 以下是代码的简化和可再现示例:
library("shiny")
library("highcharter")
data(citytemp)
ui <- fluidPage(
h1("Highcharter EXAMPLE"),
fluidRow(
column(width = 8,
highchartOutput("hcontainer",height = "500px")
)
)
)
server <- function(input, output) {
data <- citytemp[,c("month","tokyo","new_york")]
output$hcontainer <- renderHighchart({
chart <- highchart() %>%
hc_chart(type = "bar") %>%
hc_title(text = "Monthly Average Temperature for TOKYO") %>%
hc_subtitle(text = "Source: WorldClimate.com") %>%
hc_xAxis(categories = c('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')) %>%
hc_yAxis(title = list(text = "Temperature (C)"))
hc <- chart %>% hc_add_series(yAxis=0,name="Tokyo",data = data$tokyo)%>%
hc_plotOptions(bar = list(
pointWidth=10,
dataLabels = list(enabled = TRUE)
))
hc <- hc %>% hc_add_series(yAxis=0,name="NY",data = data$new_york)%>%
hc_plotOptions(bar = list(
pointWidth=0,
dataLabels = list(enabled = TRUE)
))
return(hc)
})
}
shinyApp(ui = ui, server = server)
我调查过,一个简单的方法是更改hc_plotOptions。但是,当我更改一个系列的pointWidth时,它将应用于两个系列。有没有办法将所需宽度仅应用于一个系列?非常感谢您的帮助 ! 最好的,Madzia
答案 0 :(得分:3)
添加时,您需要在系列中添加 var holding_Image: UIImage?
@IBOutlet weak var display_image: UIImageView!
imageData = UIImagePNGRepresentation(holding_Image!)!
let img = UIImage(data: self.imageData)
let imgsize = CGSize(width: 100.0, height: 100.0)
let newimg = imageget.imageResize(img, andResizeTo: imgsize)
let newdata = UIImagePNGRepresentation(newimg!)
self.dic1.setObject(newdata!, forKey: "image_data")
。例如pointWidth
hc_add_series(pointWidth=10,...