4
$\begingroup$

I'm trying to setup FrameTicks for TradingChart, but it dosn't work.

(*take data*)
data = FinancialData["NASDAQ:AAPL", "OHLCV", {{2017, 1, 1}, {2017, 4, 16}}];

(*def. of ticks*)
maxh = Max[#[[2]]&/@Last/@data];
minl = Min[#[[3]]&/@Last/@data];
lstYTicks = Table[i,{i,minl,maxh,(maxh-minl)/6}];

(*draw chart*)
TradingChart[data,
 Frame -> True,
 FrameTicks -> {{Automatic, lstYTicks}, {Automatic, Automatic}},
 GridLines -> {Automatic, lstYTicks},
 GridLinesStyle -> Directive[Gray, Dotted],
 ImageSize -> Large]

enter image description here

It seems that FrameTicks -> {{Automatic, lstYTicks}, {Automatic, Automatic}} option pattern is invalid here. How to solve this case. Thanks!

$\endgroup$
1
  • $\begingroup$ Assumed GridLines and Ticks are set up as the trading reference lines of the share prices. $\endgroup$
    – Jerry
    Commented Apr 16, 2017 at 3:00

1 Answer 1

2
$\begingroup$

The main fault is not operating correct on TimeSeries!

(*def.of ticks*)
maxh = Max[# & /@ data["Values"][[All, 2]]][[1]]
minl = Min[# & /@ data["Values"][[All, 2]]][[1]]
lstYTicks = Table[i, {i, minl, maxh, (maxh - minl)/6}]

*draw chart*)
TradingChart[data, Frame -> True, 
 FrameTicks -> {{Automatic, Automatic}, {lstYTicks, Automatic}}, 
 ImageSize -> Large]

enter image description here

works the intended manner in V12.0.0.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.