OHLC_Bar_Chart
Minimum Origin Version Required: Origin8.5 SR0
void plot_OHLC_bar_chart_ex1() { GraphPage gp; gp.Create(); GraphLayer gl = gp.Layers(); if(!gl) return; // Draw an OHLC bar chart Tree tr; TreeNode trLayer = tr.AddNode("Layer0"); trLayer.Rescale.nVal = 1; TreeNode trDataPlot = trLayer.AddNode("DataPlot1"); trDataPlot.PlotType.strVal = "OHLC"; TreeNode trDesigs = trDataPlot.AddNode("PlotDesigs"); trDesigs.Type.nVal = 221; trDesigs.ExValue.nVal = 1; // Specify the workbook and worksheet in order to point to the data. trDesigs.WksPage.strVal = "OHLC"; trDesigs.WksLayer.strVal = "OHLC"; // Name the tree node with a prefix "DPC..." TreeNode trOpen = trDesigs.AddNode("DPC1"); trOpen.Desig.nVal = COLDESIG_OPEN; trOpen.Name.strVal = "B"; TreeNode trHi = trDesigs.AddNode("DPC2"); trHi.Desig.nVal = COLDESIG_HIGH; trHi.Name.strVal = "C"; TreeNode trLo = trDesigs.AddNode("DPC3"); trLo.Desig.nVal = COLDESIG_LOW; trLo.Name.strVal = "D"; TreeNode trClose = trDesigs.AddNode("DPC4"); trClose.Desig.nVal = COLDESIG_CLOSE; trClose.Name.strVal = "E"; TreeNode trX = trDesigs.AddNode("DPC5"); trX.Desig.nVal = COLDESIG_X; trX.Name.strVal = "A"; gl.AddPlots(tr.Layer0); // Customize the graph layer format Tree trFormat; trFormat.Root.Axes.X.Scale.Type.nVal = 11; trFormat.Root.Axes.X.Labels.BottomLabels.Font.Size.nVal = 12; trFormat.Root.Axes.X.Labels.BottomLabels.Type.nVal = 3; trFormat.Root.Axes.X.Labels.BottomLabels.DateFormat.nVal = 21; trFormat.Root.Axes.X.Labels.BottomLabels.DateCustomDisplay.strVal = "dd'-'MMM'-'yyyy"; trFormat.Root.Axes.X.Labels.BottomLabels.Angle.nVal = 45; trFormat.Root.Axes.Y.Labels.LeftLabels.Font.Size.nVal = 12; if(0 == gl.UpdateThemeIDs(trFormat.Root)) bool bRet = gl.ApplyFormat(trFormat, true, true); // Update the graph layer format if(bRet) out_tree(gl.GetFormat(FPB_ALL, FOB_ALL, true, true)); //Output the whole format tree }