|
From: <jam...@us...> - 2006-11-11 19:05:44
|
Revision: 10
http://svn.sourceforge.net/nplot/?rev=10&view=rev
Author: jamcquay
Date: 2006-11-11 11:05:37 -0800 (Sat, 11 Nov 2006)
Log Message:
-----------
Fixed [SF bug 1469760]
A DataSource of one point in a StepPlot was causing a crash.
Now nothing is plotted when plotting one data point because there is now delta between a point and itself. No delta means no steps to plot.
Note: The solution suggested in the bug report is wrong.
Code fixed by: jamcquay
Signed off by: jamcquay
Modified Paths:
--------------
trunk/src/StepPlot.cs
Modified: trunk/src/StepPlot.cs
===================================================================
--- trunk/src/StepPlot.cs 2006-11-11 17:27:01 UTC (rev 9)
+++ trunk/src/StepPlot.cs 2006-11-11 19:05:37 UTC (rev 10)
@@ -58,7 +58,6 @@
/// <param name="yAxis">The Y-Axis to draw against.</param>
public virtual void Draw( Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis )
{
-
SequenceAdapter data =
new SequenceAdapter( this.DataSource, this.DataMember, this.OrdinateData, this.AbscissaData );
@@ -87,7 +86,19 @@
}
else
{
- p2 = data[i-1];
+ // Check that we are not dealing with a DataSource of 1 point.
+ // This check is done here so it is only checked on the end
+ // condition and not for every point in the DataSource.
+ if (data.Count > 1)
+ {
+ p2 = data[i - 1];
+ }
+ else
+ {
+ // TODO: Once log4net is set up post a message to the user that a step-plot of 1 really does not make any sense.
+ p2 = p1;
+ }
+
double offset = p1.X - p2.X;
p2.X = p1.X + offset;
p2.Y = p1.Y;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|