Creating a HiLoOpenClose Chart

To programmatically create a HiLoOpenClose chart, use the following code:

 

HighLowOpenCloseSeries ds = new HighLowOpenCloseSeries()

{

XValueBinding = new System.Windows.Data.Binding("NumberOfDay"),

HighValueBinding = new System.Windows.Data.Binding("High"),

LowValueBinding = new System.Windows.Data.Binding("Low"),

OpenValueBinding = new System.Windows.Data.Binding("Open"),

CloseValueBinding = new System.Windows.Data.Binding("Close"),

SymbolStrokeThickness = 1,     SymbolSize = new Size(5, 5)

}

ds.PlotElementLoaded += (s, e) =>

{

PlotElement pe = (PlotElement)s;

double open = (double)pe.DataPoint["OpenValues"];

double close = (double)pe.DataPoint["CloseValues"];

if (open > close)

{

pe.Fill = green;

pe.Stroke = green;

}

else

{

pe.Fill = red;

pe.Stroke = red;

}

};

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.