From: Dave C. <dav...@gm...> - 2009-01-15 18:24:56
|
I've never used this technique to build candles. I've always used the example code that uses a DataTable. chartDataTable = new DataTable(); protected void DataTablePrepare(DataTable chartDataTable) { chartDataTable.Columns.Add(new DataColumn("StringDate", typeof(string))); chartDataTable.Columns.Add(new DataColumn("Open", typeof(double))); chartDataTable.Columns.Add(new DataColumn("High", typeof(double))); chartDataTable.Columns.Add(new DataColumn("Low", typeof(double))); chartDataTable.Columns.Add(new DataColumn("Close", typeof(double))); chartDataTable.Columns.Add(new DataColumn("Volume", typeof(double))); chartDataTable.Columns.Add(new DataColumn("CloseAdj", typeof(double))); chartDataTable.Columns.Add(new DataColumn("Date", typeof(DateTime))); chartDataTable.Columns.Add(new DataColumn("Sequence", typeof(int))); } Fill your datatable with data here: if (addQuote) chartDataTable.Rows.Add(new object[] { datestring, quote.Open, quote.High, quote.Low, quote.Close, quote.Volume, quote.PrevClose, DateTime.Now, quoteSequence }); And then in your plot redraw method: // create CandlePlot. CandlePlot cp = new CandlePlot(); cp.DataSource = chartDataTable; cp.AbscissaData = "Sequence"; cp.OpenData = "Open"; cp.HighData = "High"; cp.LowData = "Low"; cp.CloseData = "Close"; cp.BearishColor = Color.Red; cp.BullishColor = Color.Green; cp.Style = CandlePlot.Styles.Filled; plotSurface.Add(cp, 1000); On Thu, Jan 15, 2009 at 1:48 AM, dynamix . <dy...@li...> wrote: > Hi, > > I have a problem with the candle plot. > I created arrays of highs, lows, opens, closes and dates and this info > displays fine if i create 4 line plots each with the same dateset based on > each batch of info in those arrays. When i try to put that info into a > candle plot display it either doesnt display anything or sometimes spits out > a divide by 0 error. > Im moving info from an arraylist to an array first - with the line plot > either way it works, just not with the candle plot. > I made a separate test app and that works fine, i dont see what im doing > differently here? > > Here is my code. > > ElseIf strMainPlotType = "CandleStick" Then > > Dim pqrs As Integer > > pqrs = closedata1.Count - 1 > Dim closedataarray As Double() = New Double(pqrs) {} > Dim opendataarray As Double() = New Double(pqrs) {} > Dim highdataarray As Double() = New Double(pqrs) {} > Dim lowdataarray As Double() = New Double(pqrs) {} > Dim datedataarray As Date() = New Date(pqrs) {} > > For z = 0 To closedata1.Count - 1 > closedataarray(z) = closedata1(z) > opendataarray(z) = opendata1(z) > highdataarray(z) = highdata1(z) > lowdataarray(z) = lowdata1(z) > datedataarray(z) = datedata1(z) > Next > > cp.AbscissaData = datedataarray > cp.CloseData = closedataarray > cp.OpenData = opendataarray > cp.HighData = highdataarray > cp.LowData = lowdataarray > > cp.Label = "Price" > > cp.BearishColor = Color.Red > cp.BullishColor = Color.Green > cp.StickWidth = 8 > cp.Color = Color.Yellow > 'cp.Style = CandlePlot.Styles.Filled > > PlotSurface2D1.Add(cp, PlotSurface2D.XAxisPosition.Bottom, > PlotSurface2D.YAxisPosition.Right) > > > > > = > Automatic Refractometers by Rudolph > Bench top Automatic Refractometers by Rudolph. > > http://a8-asy.a8ww.net/a8-ads/adftrclick?redirectid=5e78fd4210a4b5b02f39232585fee78d > > > -- > Powered by Outblaze > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Nplot-devel mailing list > Npl...@li... > https://lists.sourceforge.net/lists/listinfo/nplot-devel > -- ___________________ Dav...@gm... Lake Oswego, OR 801-473-9213 ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ |