New in Wolfram
Mathematica
8: Financial Visualization
◄
previous
|
next
►
Graphics & Visualization
Customize the Appearance of Chart Elements
Use different appearances for financial chart elements.
In[1]:=
X
data = FinancialData["MSFT", "OHLC", {{2010, 1, 8}, {2010, 1, 15}}];
In[2]:=
X
cross[{{xmin_, xmax_}, {ymin_, ymax_}}, {o_, h_, l_, c_}, metadata_] := {Line[{{(xmin + xmax)/2, l}, {(xmin + xmax)/2, h}}], Line[{{xmin, o}, {xmax, c}}]}
In[3]:=
X
arrow[{{xmin_, xmax_}, {ymin_, ymax_}}, {o_, h_, l_, c_}, metadata_] := {Arrowheads[Large], Arrow[{{(xmin + xmax)/2, o}, {(xmin + xmax)/2, c}}], Line[{{{xmin, o}, {(xmin + xmax)/2, o}, {(xmin + xmax)/2, If[o < c, l, h]}}, {{xmax, c}, {(xmin + xmax)/2, c}, {(xmin + xmax)/2, If[o < c, h, l]}}}]}
In[4]:=
X
cf = {"GlassCandlestick", "FadingCandlestick", "OHLC", "HLC", "FadingOHLC", "ArrowCandlestick", cross, arrow, ChartElementDataFunction["ArrowCandlestick", "TaperRatio" -> 1., "ArrowheadAngle" -> 101, "ArrowWidth" -> 0.5]};
In[5]:=
X
Grid@Partition[ Table[CandlestickChart[data, Axes -> False, GridLines -> None, AspectRatio -> 1, ImageSize -> 160, BarSpacing -> 0.3, TrendStyle -> "BlueYellow", ChartBaseStyle -> AbsoluteThickness[3], ChartElementFunction -> cf[[i]], PlotLabel -> If[StringQ[cf[[i]]], cf[[i]], "Customized"], BaseStyle -> {FontFamily -> "Helvetica"}], {i, 1, 9 }], 3]
Out[5]=