我更喜欢dygraph而不是highchart图作为内部javascript图形,因此我想知道链接中所建议的highcharts区域范围图(http://www.highcharts.com/demo/arearange)是否有对应的dygraph?

我在这里浏览了示例和文档(http://dygraphs.com/),但不确定是否可以找到适合的示例和文档。

一如既往,这里的任何帮助将不胜感激。

最亲切的问候,

HLM

最佳答案

我最初使用R来执行此操作...并实现了执行该范围的版本

# range areas...
library(quantmod)
library(dygraphs)

getSymbols(c("MSFT", "HPQ"), from = "2014-06-01", auto.assign=TRUE)

stocks <- cbind(MSFT[,"MSFT.Close"]-10,HPQ[,"HPQ.Close"])
colnames(stocks) <- c('A','B')

stocks$A_low <- NA
stocks$B_low <- NA

stocks$A_high <- stocks$A
stocks$B_high <- stocks$B

stocks[stocks$A>stocks$B,'B_low'] <- stocks[stocks$A>stocks$B,'B']
stocks[stocks$A>stocks$B,'A_low'] <- stocks[stocks$A>stocks$B,'B']

stocks[stocks$A<stocks$B,'B_low'] <- stocks[stocks$A<stocks$B,'A']
stocks[stocks$A<stocks$B,'A_low'] <- stocks[stocks$A<stocks$B,'A']


dygraph(stocks, main = "A vs B Share Prices") %>%
  dySeries(c("A_low", "A", "A_high"), label = "A") %>%
  dySeries(c("B_low", "B", "B_high"), label = "B")

09-27 16:20