Revision: 31
http://nplot.svn.sourceforge.net/nplot/?rev=31&view=rev
Author: anmar
Date: 2007-10-04 03:48:51 -0700 (Thu, 04 Oct 2007)
Log Message:
-----------
Fixed [SF patch 1806859]
CandlePlot wasn't accepting input data as IList (only Array) while all util methods can handle it without problems. As Array implements IList, there aren't any backwards compatibility issues.
Patch by: eyal0
Signed off by: anmar
Modified Paths:
--------------
trunk/src/CandlePlot.cs
Modified: trunk/src/CandlePlot.cs
===================================================================
--- trunk/src/CandlePlot.cs 2007-08-08 23:52:52 UTC (rev 30)
+++ trunk/src/CandlePlot.cs 2007-10-04 10:48:51 UTC (rev 31)
@@ -30,6 +30,7 @@
*/
using System;
+using System.Collections;
using System.Drawing;
using System.Data;
@@ -303,14 +304,14 @@
return new PointOLHC(x, open, low, high, close);
}
- // the data is coming from individual arrays.
- else if (abscissaData_ is Array && openData_ is Array && lowData_ is Array && highData_ is Array && closeData_ is Array)
+ // the data is coming from individual ILists.
+ else if (abscissaData_ is IList && openData_ is IList && lowData_ is IList && highData_ is IList && closeData_ is IList)
{
- double x = Utils.ToDouble(((Array)abscissaData_).GetValue(i));
- double open = Utils.ToDouble(((Array)openData_).GetValue(i));
- double low = Utils.ToDouble(((Array)lowData_).GetValue(i));
- double high = Utils.ToDouble(((Array)highData_).GetValue(i));
- double close = Utils.ToDouble(((Array)closeData_).GetValue(i));
+ double x = Utils.ToDouble(((IList)abscissaData_)[i]);
+ double open = Utils.ToDouble(((IList)openData_)[i]);
+ double low = Utils.ToDouble(((IList)lowData_)[i]);
+ double high = Utils.ToDouble(((IList)highData_)[i]);
+ double close = Utils.ToDouble(((IList)closeData_)[i]);
return new PointOLHC(x, open, low, high, close);
}
@@ -346,20 +347,20 @@
return rows_.Count;
}
- if (openData_ is Array)
+ if (openData_ is IList)
{
- int size = ((Array)openData_).Length;
- if (size != ((Array)closeData_).Length)
+ int size = ((IList)openData_).Count;
+ if (size != ((IList)closeData_).Count)
{
throw new NPlotException("open and close arrays are not of same length");
}
- if (size != ((Array)lowData_).Length)
+ if (size != ((IList)lowData_).Count)
{
- throw new NPlotException("open and close arrays are not of same length");
+ throw new NPlotException("open and low arrays are not of same length");
}
- if (size != ((Array)highData_).Length)
+ if (size != ((IList)highData_).Count)
{
- throw new NPlotException("open and close arrays are not of same length");
+ throw new NPlotException("open and high arrays are not of same length");
}
return size;
}
@@ -385,15 +386,15 @@
if (((System.Collections.IList)abscissaData_).Count > 1)
{
- double first = Utils.ToDouble(((Array)abscissaData_).GetValue(0));
- double second = Utils.ToDouble(((Array)abscissaData_).GetValue(1));
+ double first = Utils.ToDouble(((IList)abscissaData_)[0]);
+ double second = Utils.ToDouble(((IList)abscissaData_)[1]);
minStep = Math.Abs(second - first);
}
if (((System.Collections.IList)abscissaData_).Count > 2)
{
- double first = Utils.ToDouble(((Array)abscissaData_).GetValue(1));
- double second = Utils.ToDouble(((Array)abscissaData_).GetValue(2));
+ double first = Utils.ToDouble(((IList)abscissaData_)[0]);
+ double second = Utils.ToDouble(((IList)abscissaData_)[1]);
if (Math.Abs(second - first) < minStep)
minStep = Math.Abs(second - first);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|