Javascript Highchart选项(点和大小)-R
我是Shining的新用户,尝试通过库中提供的示例进行培训。 我对highchart选项有一些问题,我的绘图是一条带点的线,我想控制点的大小 以下是简化的代码:(使用“highchart”库中的示例,文件夹“demo”): ###代码的开头Javascript Highchart选项(点和大小)-R,javascript,r,highcharts,shiny,Javascript,R,Highcharts,Shiny,我是Shining的新用户,尝试通过库中提供的示例进行培训。 我对highchart选项有一些问题,我的绘图是一条带点的线,我想控制点的大小 以下是简化的代码:(使用“highchart”库中的示例,文件夹“demo”): ###代码的开头 library("shiny") library("highcharter") data(citytemp) ui <- fluidPage( h1("Highcharter Demo"), fluidRow( column(wid
library("shiny")
library("highcharter")
data(citytemp)
ui <- fluidPage(
h1("Highcharter Demo"),
fluidRow(
column(width = 4, class = "panel",
selectInput("type", label = "Type", width = "100%",
choices = c("line", "column", "bar", "spline")),
selectInput("stacked", label = "Stacked", width = "100%",
choices = c(FALSE, "normal", "percent")),
selectInput("theme", label = "Theme", width = "100%",
choices = c(FALSE, "fivethirtyeight", "economist", "darkunica", "gridlight",
"sandsignika", "null", "handdrwran", "chalk")
)
),
column(width = 8,
highchartOutput("hcontainer",height = "500px")
)
)
)
server = function(input, output) {
output$hcontainer <- renderHighchart({
hc <- highcharts_demo() %>%
hc_rm_series("Berlin") %>%
hc_chart(type = "line") %>%
hc_plotOptions(area = list(
stacking = input$stacked,
lineColor = "#ffffff",
lineWidth = 1,
marker = list(
lineWidth = 1,
radius=10,
lineColor = "#ffffff"
)))%>%
hc_tooltip(pointFormat = '<span style="color:{series.color}">{series.name}</span>:
<b>{point.percentage:.1f}%</b> ({point.y:,.0f} millions)<br/>',
shared = TRUE)
hc
})
}
shinyApp(ui = ui, server = server)
库(“闪亮”)
图书馆(“高宪章”)
数据(citytemp)
ui%
hc\U绘图选项(面积=列表(
堆叠=输入$stacked,
lineColor=“#ffffff”,
线宽=1,
标记=列表(
线宽=1,
半径=10,
lineColor=“#ffffff”
)))%>%
hc_工具提示(pointFormat='{series.name}:
{point.percentage:.1f}%({point.y:,.0f}百万)
,
共享=真)
hc
})
}
shinyApp(用户界面=用户界面,服务器=服务器)
##代码结尾
library("shiny")
library("highcharter")
data(citytemp)
ui <- fluidPage(
h1("Highcharter Demo"),
fluidRow(
column(width = 4, class = "panel",
selectInput("type", label = "Type", width = "100%",
choices = c("line", "column", "bar", "spline")),
selectInput("stacked", label = "Stacked", width = "100%",
choices = c(FALSE, "normal", "percent")),
selectInput("theme", label = "Theme", width = "100%",
choices = c(FALSE, "fivethirtyeight", "economist", "darkunica", "gridlight",
"sandsignika", "null", "handdrwran", "chalk")
)
),
column(width = 8,
highchartOutput("hcontainer",height = "500px")
)
)
)
server = function(input, output) {
output$hcontainer <- renderHighchart({
hc <- highcharts_demo() %>%
hc_rm_series("Berlin") %>%
hc_chart(type = "line") %>%
hc_plotOptions(area = list(
stacking = input$stacked,
lineColor = "#ffffff",
lineWidth = 1,
marker = list(
lineWidth = 1,
radius=10,
lineColor = "#ffffff"
)))%>%
hc_tooltip(pointFormat = '<span style="color:{series.color}">{series.name}</span>:
<b>{point.percentage:.1f}%</b> ({point.y:,.0f} millions)<br/>',
shared = TRUE)
hc
})
}
shinyApp(ui = ui, server = server)
我做了一些研究,发现可以使用“标记”及其选项控制大小。但我的图表看起来完全独立于此功能:我尝试了标记的几个宽度和半径值,但它没有改变任何东西
有人能告诉我我做错了什么吗?
非常感谢您的帮助 您好,您的图表是一条直线,因此在
hc\u plotOptions
中,您应该为直线而不是区域设置选项,例如:
hc_plotOptions(
line = list( # put line here instead of area
stacking = input$stacked,
lineColor = "#ffffff",
lineWidth = 1,
marker = list(
lineWidth = 1,
radius=10,
lineColor = "#ffffff"
)
)
)
非常感谢。很好用!:)(很抱歉耽搁了,我当天就回答了,但我的回答似乎没有被考虑)