From: SourceForge.net <no...@so...> - 2008-06-05 01:42:27
|
Bugs item #1901521, was opened at 2008-02-25 10:59 Message generated for change (Comment added) made by jesusfreke You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=821568&aid=1901521&group_id=161868 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Matthew McDougal (mmdoogie) Assigned to: Nobody/Anonymous (nobody) Summary: Y Axis recommendation extended while X Axis is not Initial Comment: I ran into a problem that I wouldn't have even noticed had I not been trying to use a LogAxis as the Y Axis on a plot. myPlotSurface.YAxis1 = new LogAxis(myLinePlot.SuggestYAxis) When I then tried to refresh my plot, it would fail saying I can't have negative data on a log axis, but of course I didn't have any negative data. Looking at the SequenceAdapter code in SVN, which I've trimmed a little just to get the relevant parts: public Axis SuggestXAxis() { Axis a = this.XAxisSuggester_.Get(); // The world length should never be returned as 0 // This would result in an axis with a span of 0 units // which can not be properly displayed. if (a.WorldLength == 0.0) { a.IncreaseRange(0.08); } return a; } public Axis SuggestYAxis() { Axis a = this.YAxisSuggester_.Get(); a.IncreaseRange(0.08); return a; } Basically, what occurs is on the X axis, the range is only increased if the returned axis was zero, but on the Y axis, it is always increased by +/- 8% of the range. If your span is sufficiently large enough, and your lower limit close enough to zero, the range can get extended negative. There may be a reason I don't know about, but if there isn't, I would suggest making the Y axis behave in the same manner as the X axis. --matt ---------------------------------------------------------------------- Comment By: JesusFreke (jesusfreke) Date: 2008-06-04 20:42 Message: Logged In: YES user_id=2104277 Originator: NO I ran into this same problem. Here's a quick code sample that generates the error: NPlot.Bitmap.PlotSurface2D plot = new NPlot.Bitmap.PlotSurface2D(1000, 1000); LogAxis verticalAxis = new LogAxis(); plot.YAxis1 = verticalAxis; System.Collections.ArrayList yvalues = new System.Collections.ArrayList(); yvalues.Add(1); yvalues.Add(1000000); System.Collections.ArrayList xvalues = new System.Collections.ArrayList(); xvalues.Add(0); xvalues.Add(1); LinePlot linePlot = new LinePlot(yvalues, xvalues); plot.Add(linePlot); A workaround to this issue is to add the lineplot first, and then the log axis. The problem is because the yaxis range is increased by 8%, and then that new range is passed to the "LUB" method of the log axis, which complains because the lower bound of the "suggested" axis is negative. I'm not familiar enough with the code to know what the best way to fix this might be. I don't think it would be to remove the 8% range increase altogether, I assume that is done for display reasons, so that the data doesn't go right up against the top and bottom of the graph. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=821568&aid=1901521&group_id=161868 |