Mathematica Asked by VanillaSpinIce on January 4, 2021
I am trying to use TradingChart
to display some intra day data (60 s. resolution). Is there a way to modify the time displayed when moving the mouse over the data. The default setting (see top left of the chart) is to show O,H,L,C
and the date without the hours, minutes and seconds. Is there a way to modify this display to include hours, minutes and seconds ?
Explicitly, consider the following code:
data = {{{2015, 6, 15, 10, 51, 0.`}, {53.19`, 53.19`, 53.19`, 53.19`,
100}}, {{2015, 6, 15, 12, 19, 0.`}, {53.3`, 53.33`, 53.3`, 53.32`,
1200}}, {{2015, 6, 15, 13, 49, 0.`}, {53.22`, 53.24`, 53.2`,
53.2`, 3800}}, {{2015, 6, 15, 15, 14, 0.`}, {53.395`, 53.41`,
53.395`, 53.405`, 3500}}, {{2015, 6, 16, 10, 6, 0.`}, {53.08`,
53.09`, 53.07`, 53.07`, 2000}}, {{2015, 6, 16, 11, 31,
0.`}, {53.2`, 53.21`, 53.2`, 53.21`, 800}}, {{2015, 6, 16, 13, 5,
0.`}, {53.24`, 53.26`, 53.24`, 53.26`, 1500}}, {{2015, 6, 16, 14,
36, 0.`}, {53.26`, 53.27`, 53.26`, 53.27`, 1400}}}
TradingChart[data]
The output looks something like:
As you can see at the top of chart, the time displayed is only for the day and does not include the time (hours,min,sec). Is there an easy command which would change this date display to include the time of the day as specified in the data ?
Most likely this is not possible. But you can use tooltips on the chart:
TradingChart[Tooltip[#, DateString@#[[1]]] & /@ data]
I hope it will still be helpful to you.
Answered by Alexey Golyshev on January 4, 2021
Post-process TradingChart
output to modify the date legend:
TradingChart[data] /. Dispatch[System`TradingChartDump`$visdates]:>
Dispatch[MapIndexed[#2[[1]] -> DateString[#[[1]]] &, data]]
In version 9, you can use
TradingChart[data] /. Dispatch[{(_ -> _String) ..}, ___] :>
Dispatch[MapIndexed[#2[[1]] -> DateString[#[[1]]] &, data]]
Answered by kglr on January 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP