Hi,
My program plots various LinePlots and PointPlots using the AbscissaData and OrdinateData. The data can change based on user interaction. A bug occurs when the data is for only one point.
First there is an exception in
DateTimeAxis.cs
void DrawTicks(...)
{
...
PointF lastPos = WorldToPhysical((double)largeTicks[0], physicalMin, physicalMax, true);//ed
The exception is due to accessing largeTicks[0]. The previous call to WorldTickPositions() fails to add any data to the largeTicks array.
A quick fix was to add the following code:
if (largeTicks.Count <= 0) { return; }
But the result is not very satisfactory as I'd still like to see the point plotted. My temporary hack was to adjust the XAxis1.WorldMax and XAxis1.WorldMin by 100 so as to show a centered point but this is far from ideal.
Thanks,
Randal
Logged In: YES
user_id=613279
Originator: NO
Code snippet:
plotSurface.Clear();
DateTime[] xs = { new DateTime(2002, 9, 1)};
float[] ys = { 4.7f };
Marker m = new Marker(Marker.MarkerType.Diamond, 6, Color.DarkGreen);
PointPlot pp = new PointPlot();
pp.AbscissaData = xs;
pp.OrdinateData = ys;
pp.Marker = m;
plotSurface.Add(pp);
LabelAxis lay = new LabelAxis(plotSurface.YAxis1);
lay.AddLabel("P3", 3);
lay.AddLabel("P4", 4);
lay.AddLabel("P5", 5);
plotSurface.YAxis1 = lay;
plotSurface.Refresh();
Logged In: NO
I have rather similar problem with 5 point at LabelAxis.cs
This is Stack Trace of 0.9.9.2 but it happen in 0.9.10.0 as well.
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at NPlot.LabelAxis.DrawTicks(Graphics g, Point physicalMin, Point physicalMax, Object& labelOffset, Object& boundingBox) in LabelAxis.cs:line 209
at NPlot.Axis.Draw(Graphics g, Point physicalMin, Point physicalMax, Rectangle& boundingBox) in Axis.cs:line 1280
at NPlot.PhysicalAxis.Draw(Graphics g, Rectangle& boundingBox) in PhysicalAxis.cs:line 125
at NPlot.PhysicalAxis.GetBoundingBox() in PhysicalAxis.cs:line 112
at NPlot.PlotSurface2D.DeterminePhysicalAxesToDraw(Rectangle bounds, Axis xAxis1, Axis xAxis2, Axis yAxis1, Axis yAxis2, PhysicalAxis& pXAxis1, PhysicalAxis& pXAxis2, PhysicalAxis& pYAxis1, PhysicalAxis& pYAxis2) in PlotSurface2D.cs:line 831
at NPlot.PlotSurface2D.Draw(Graphics g, Rectangle bounds) in PlotSurface2D.cs:line 972
at NPlot.Bitmap.PlotSurface2D.Refresh() in Bitmap.PlotSurface2D.cs:line 433
Logged In: NO
Hi guys