どのように私はc3ライブラリを使用する必要がありますか?私はすでにそれをインストールして、簡単なゲージチャートを表示しようとしています。以下は光沢のあるc3ライブラリの使い方は?単純なゲージチャートを作成するには?
ui.R
とserver.R
のための私のコードです:
server.R
library(shiny)
library(c3)
shinyServer(function(input, output) {
observeEvent(input$button, {
output$name <- renderText({
paste("Welcome ",input$name,". This is your Assesment result!")})
output$nl <- renderText({input$nl})
whrs <- input$whrs
if(whrs == 10) {
point <- 20
} else if (whrs == 8 || whrs == 9) {
point <- 18
} else if (whrs == 7 || whrs == 6) {
point <- 12
} else if(whrs == 5) {
point <- 8
} else {
point <- 0
}
pwhrs <- point
nl <- input$nl
if(nl == 10) {
point <- 20
} else if (nl == 8 || whrs == 9) {
point <- 18
} else if (nl == 7 || whrs == 6) {
point <- 12
} else if(nl == 5) {
point <- 8
} else {
point <- 0
}
pnl <- point
output$pwhrs <- renderText({pwhrs})
output$pnl <- renderText({pnl})
output$plot <- renderPlot({
gauge.chart <- data.frame(red=20,green=45,blue=10) %>%
c3() %>%
c3_gauge(title= 'Colours')
})
})
})
と、ユーザー入力に基づいて、単純なゲージチャートを生成するために行われなければならない何私のui.R
library(shiny)
shinyUI(fluidPage(
hr(),
titlePanel("Summary"),
hr(),
sidebarLayout(
sidebarPanel(
textInput("name","Enter your name",""),
numericInput("whrs","How many hours do you work daily?","0",min=0,max=10),
numericInput("nl","How many leaves do you take per month?","0",min= 0,max=20),
numericInput("bhr","How many hours of break do you take daily?","0",min= 0,max=10),
selectInput("wrkdlvr","How often you complete your works?",choices=c("On time","Before Deadline","Delayed")),
selectInput("consleave","How often you leaves are consecutive?",choices=c("Never","Always","Not Applicable")),
actionButton("button", "Calculate")
),
mainPanel(("About this tool"),
p(helpText("Try this tool to assess yourself.
You need to work for a minimum of 9 hrs per day.")),
helpText("This tool will ask for some parameters and based on the input you will
be assessed"),
hr(),
textOutput("name"),
textOutput("pwhrs"),
textOutput("pnl"),
plotOutput("plot"),
hr()
)
),
hr()
))
?グラフの最大値は100で、ユーザー入力に基づいて表示される値が設定されます。これを達成する方法は?
ui.R
とserver.R
の両方にc3ライブラリを追加する必要がありますか? (両方のファイルに追加のライブラリを追加する必要があるかどうか教えてください)
shiny
とshinydashboard
ライブラリはほとんど同じですか?
ニースパッケージ 'uが作成billboarder'、私はそれについて聞くのは初めて、私は間違いなくなります私のレパートリーに追加してください。 'rmarkdown'で作成されたもののような静的HTMLを使ったリアルタイムレンダリングの例がありますか? –
ありがとう!それは聞いていいです!パッケージは最近ですが、私は2ヶ月前に始めました。私は今週いくつかのテストを行い、9月上旬にCRANに行く予定です。私はRpubsの例をアップロードしました:http://rpubs.com/Victorp/billboarder_examples、もしあなたがそれを使用して私に教えてください! – Victorp