0
chart_Series
と色付きラインを表示すると、shiny
とスライダの使用に関する問題があります。スライダを右側から使用しているときは、色が適切に選択されます(主に赤い点)。スライダを左側に使用すると(最新のデータを見るなど)、色は適切に選択されません(緑色にする必要があります)。私は助けを求めており、私は助言に感謝しています! 、私の知る限りR光沢のある量子ドットズームチャートと固定したカラーリング
shiny
は、(それぞれのかなり論理的に...)着色ベクトルデータを編集しませんが。
require(quantmod)
require(shiny)
getSymbols("YHOO")
data <- YHOO
data <- data[1:100,]
col_function <- rep("red",50)
col_function <- c(col_function, rep("green",50))
plot <- {
date_range <- index(data)
if (interactive()) {
options(device.ask.default = FALSE)
# Define UI
ui <- fluidPage(
titlePanel("Time:"),
sidebarLayout(
# Sidebar with a slider input
wellPanel(
tags$style(type="text/css", '#leftSlide { width:200px; float:left;}'),
id = "leftSlide",
sliderInput("Range", "Choose Date Range:",
min = first(date_range), max = last(date_range), value = c(first(date_range),last(date_range)))
),
mainPanel(
plotOutput("Plot", width = "150%", height = "500px")
)
)
)
# Server logic
server <- function(input, output) {
output$range <- renderPrint({ input$slider2 })
output$Plot <- renderPlot({
x_ti2 <- xts(rep(1, NROW(data)), order.by = index(data))
x_ti2[1, ] <- 0.5
chart_Series(data)
add_TA(x_ti2, col = col_function, pch = 9, type = 'p', cex = .7)
# Another way below, but the color function is still not working
#chart_Series(data["2017"], TA = 'add_TA(x_ti, col = col_function, pch = 15, type = "p", cex = .7); add_TA(x_ti2, col = "orange", pch = 9, type = "p", cex = .7)')
zoom_Chart(paste(input$Range, collapse = "::"))
})
observe({
print(input$Range)
})
}
shinyApp(ui, server)
}
}
plot
私はchartSeriesとchart_seriesを見てきました。どちらも同じ問題を抱えているようです。私の見解では、プロットのズームは、尖った線を制御しません。あたかもchartSeriesとは独立しているようです。しかし、これは依然として相手側からの正確なズーミングの理由を説明していない。さらに、私はdateRangeInputをテストしました。同じ問題が発生しました。 – Simon