Hello Yihui,
I'm trying to create K plot, but I can't let tool tip popup correctly. I think it's something wrong with JavaScript. Can you help me fix it up?
test=rbind( c(2320.26,2302.6,2287.3,2362.94),
c(2300,2291.3,2288.26,2308.38),
c(2295.35,2346.5,2295.35,2346.92),
c(2347.22,2358.98,2337.35,2363.8))
names(test)=c('open', 'close', 'high', 'low')
K1 = list(
title = list(
text = 'test',
subtext = 'From d3.js',
x = 'right',
y = 'bottom'
),
tooltip = list(
trigger = 'item',
# Something wrong here!!!
formatter = JS("function (params) {
var res = params[0].seriesName + ' ' + params[0].name;
res += 'open : ' + params[0].value[0] + ' high : ' + params[0].value[3];
res += ' close : ' + params[0].value[1] + ' low : ' + params[0].value[2];
return res;
}")
),
toolbox = list(
show = TRUE,
feature = list(
restore = list(show = TRUE),
saveAsImage = list(show = TRUE)
)
),
dataZoom =list(
show =TRUE,
realtime=TRUE,
start = 50,
end = 100
),
xAxis=list(
type = 'category',
boundaryGap = TRUE,
axisTick=list( onGap=FALSE),
splitLine=list(show=FALSE),
data =c(
"2013/1/24", "2013/1/25", "2013/1/28", "2013/1/29"
)
),
yAxis =list(
type='value',
scale=TRUE,
boundaryGap=c(0.01, 0.01)
),
series = list(
list(
type = 'k',
name = c('open','close','high','low'),
data = test
)))
echart(K1)
Hello Yihui,
I'm trying to create K plot, but I can't let tool tip popup correctly. I think it's something wrong with JavaScript. Can you help me fix it up?