I'm new for JS but would like to change the original format to new format at the top of K chart as below. Would you please let me know how to modify the tooltip in K chart?
orignal format is
2017-06-13
Open開盤 :xxxx
High最高:xxxx
Close收盤:xxxx
Low最低:xxxx
new format is
2017-06-13 Open:xxxx | High:xxxx | Close:xxxx | Low最低:xxxx
so I try to modifiy the formatter in few ways.
1. copy the JS add " "
formatter = "function (params) {
var res = params[0].name;
for (var i = 0, l = params.length; i < l; i++) {
res += ' | ' + ' : ' + params[i].value;
}
}"
K chart only has one date with column c(open, close, low, high), the seriesName should be wrong to my purpose. and use ' ' to include the function
@miluylin commented on Tue Jun 13 2017
I'm new for JS but would like to change the original format to new format at the top of K chart as below. Would you please let me know how to modify the tooltip in K chart?
orignal format is 2017-06-13 Open開盤 :xxxx High最高:xxxx Close收盤:xxxx Low最低:xxxx
new format is 2017-06-13 Open:xxxx | High:xxxx | Close:xxxx | Low最低:xxxx so I try to modifiy the formatter in few ways. 1. copy the JS add " "
K chart only has one date with column c(open, close, low, high), the seriesName should be wrong to my purpose. and use ' ' to include the function
append the [i] to the value,
default string "{a} < br/>{b} : {c}" but I don't know how to modify it for K chart.
Thanks
@madlogos commented on Wed Jun 14 2017
This should be under recharts instead of recharts2.
Previously I did not include a high-level method to modify formatter. Now I just released a patch to GitHub to fix it. You can try it out.
Build an instance following the example:
By
cat(g$x$tooltip$formatter)
, you will see the default tooltip for K chart:So then:
If you don't want to re-install recharts, you can simply modify the object g in low-level manner:
@miluylin commented on Thu Jun 15 2017
非常感激. Thank you