From: <an...@us...> - 2006-11-13 21:38:07
|
Revision: 11 http://svn.sourceforge.net/nplot/?rev=11&view=rev Author: anmar Date: 2006-11-13 13:38:03 -0800 (Mon, 13 Nov 2006) Log Message: ----------- Fixed [SF bug 1590992] The Axis suggested in a few places wasn't handling properly the case when there is no data available. They now default to the same behavior as the other IAxisSuggester classes. * [src/AdapterUtils.cs] AxisSuggester_StartStep, AxisSuggester_Auto and AxisSuggester_RowAuto were suggesting wrong axis if there were no data. * [src/HistogramPlot.cs] SuggestXAxis: If there is no data, you can't use it to adjust the suggested axis. Signed off by: anmar Modified Paths: -------------- trunk/src/AdapterUtils.cs trunk/src/HistogramPlot.cs Modified: trunk/src/AdapterUtils.cs =================================================================== --- trunk/src/AdapterUtils.cs 2006-11-11 19:05:37 UTC (rev 10) +++ trunk/src/AdapterUtils.cs 2006-11-13 21:38:03 UTC (rev 11) @@ -213,9 +213,17 @@ /// <returns>the suggested axis</returns> public Axis Get() { - return new LinearAxis( - abscissaData_.Start, - abscissaData_.Start + (double)(ordinateData_.Count - 1) * abscissaData_.Step); + if (ordinateData_!=null && ordinateData_.Count>0) + { + return new LinearAxis( + abscissaData_.Start, + abscissaData_.Start + (double)(ordinateData_.Count - 1) * abscissaData_.Step); + } + + else + { + return new LinearAxis(0.0, 1.0); + } } } @@ -243,7 +251,16 @@ /// <returns>the suggested axis</returns> public Axis Get() { - return new LinearAxis(0, ordinateData_.Count - 1); + if (ordinateData_!=null && ordinateData_.Count>0) + { + return new LinearAxis(0, ordinateData_.Count - 1); + + } + + else + { + return new LinearAxis(0.0, 1.0); + } } } @@ -270,7 +287,15 @@ /// <returns>the suggested axis</returns> public Axis Get() { - return new LinearAxis(0, ordinateData_.Count - 1); + if (ordinateData_!=null && ordinateData_.Count>0) + { + return new LinearAxis(0, ordinateData_.Count - 1); + } + + else + { + return new LinearAxis(0.0, 1.0); + } } } Modified: trunk/src/HistogramPlot.cs =================================================================== --- trunk/src/HistogramPlot.cs 2006-11-11 19:05:37 UTC (rev 10) +++ trunk/src/HistogramPlot.cs 2006-11-13 21:38:03 UTC (rev 11) @@ -243,6 +243,10 @@ new SequenceAdapter( this.DataSource, this.DataMember, this.OrdinateData, this.AbscissaData ); Axis a = data.SuggestXAxis(); + if (data.Count==0) + { + return a; + } PointD p1; PointD p2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |