|
From: <jam...@us...> - 2007-03-30 19:12:06
|
Revision: 29
http://svn.sourceforge.net/nplot/?rev=29&view=rev
Author: jamcquay
Date: 2007-03-30 12:12:03 -0700 (Fri, 30 Mar 2007)
Log Message:
-----------
Fixed whitespace and other inconsistencies in the NPlot Source
Modified Paths:
--------------
trunk/src/AdapterUtils.cs
trunk/src/ArrowItem.cs
trunk/src/AssemblyInfo.cs
trunk/src/AxesConstraint.cs
trunk/src/Axis.cs
trunk/src/BarPlot.cs
trunk/src/BasePlot.cs
trunk/src/BaseSequencePlot.cs
trunk/src/Bitmap.PlotSurface2D.cs
trunk/src/CandlePlot.cs
trunk/src/DateTimeAxis.cs
trunk/src/FilledRegion.cs
trunk/src/Grid.cs
trunk/src/HistogramPlot.cs
trunk/src/HorizontalLine.cs
trunk/src/IDrawable.cs
trunk/src/IGradient.cs
trunk/src/IPlot.cs
trunk/src/IPlotSurface2D.cs
trunk/src/ISequencePlot.cs
trunk/src/ISurface.cs
trunk/src/ITransform2D.cs
trunk/src/ImagePlot.cs
trunk/src/LabelAxis.cs
trunk/src/LabelPointPlot.cs
trunk/src/Legend.cs
trunk/src/LegendBase.cs
trunk/src/LinePlot.cs
trunk/src/LinearAxis.cs
trunk/src/LinearGradient.cs
trunk/src/LogAxis.cs
trunk/src/Marker.cs
trunk/src/MarkerItem.cs
trunk/src/NPlotException.cs
trunk/src/PageAlignedPhysicalAxis.cs
trunk/src/PhysicalAxis.cs
trunk/src/PiAxis.cs
trunk/src/PlotSurface2D.cs
trunk/src/PointD.cs
trunk/src/PointPlot.cs
trunk/src/RectangleBrushes.cs
trunk/src/SequenceAdapter.cs
trunk/src/StartStep.cs
trunk/src/StepGradient.cs
trunk/src/StepPlot.cs
trunk/src/TextItem.cs
trunk/src/TradingDateTimeAxis.cs
trunk/src/Transform2D.cs
trunk/src/Utils.cs
trunk/src/VerticalLine.cs
trunk/src/Web.Design.PlotSurface2D.cs
trunk/src/Web.PlotSurface2D.cs
trunk/src/Windows.PlotSurface2D.cs
Modified: trunk/src/AdapterUtils.cs
===================================================================
--- trunk/src/AdapterUtils.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/AdapterUtils.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -156,7 +156,6 @@
{
return new DateTimeAxis(min, max);
}
-
else
{
return new LinearAxis(min, max);
@@ -219,7 +218,6 @@
abscissaData_.Start,
abscissaData_.Start + (double)(ordinateData_.Count - 1) * abscissaData_.Step);
}
-
else
{
return new LinearAxis(0.0, 1.0);
@@ -233,7 +231,6 @@
/// </summary>
public class AxisSuggester_Auto : IAxisSuggester
{
-
IList ordinateData_;
/// <summary>
@@ -254,9 +251,7 @@
if (ordinateData_!=null && ordinateData_.Count>0)
{
return new LinearAxis(0, ordinateData_.Count - 1);
-
}
-
else
{
return new LinearAxis(0.0, 1.0);
@@ -291,7 +286,6 @@
{
return new LinearAxis(0, ordinateData_.Count - 1);
}
-
else
{
return new LinearAxis(0.0, 1.0);
@@ -333,7 +327,6 @@
{
return new DateTimeAxis(min, max);
}
-
else
{
return new LinearAxis(min, max);
@@ -379,7 +372,6 @@
{
return new DateTimeAxis(min, max);
}
-
else
{
return new LinearAxis(min, max);
@@ -508,7 +500,6 @@
return dataView_.Count;
}
}
-
}
#endregion
@@ -717,7 +708,6 @@
/// <remarks>Note: Does not implement IDataGetter... Currently this class is not used.</remarks>
public class DataGetter_MultiRows
{
-
DataRowCollection rows_;
string abscissaName_;
int abscissaColumnNumber_;
@@ -733,8 +723,10 @@
abscissaName_ = omitThisColumn;
abscissaColumnNumber_ = rows_[0].Table.Columns.IndexOf( omitThisColumn );
- if (abscissaColumnNumber_ < 0)
- throw new NPlotException( "invalid column name" );
+ if (abscissaColumnNumber_ < 0)
+ {
+ throw new NPlotException("invalid column name");
+ }
}
/// <summary>
@@ -756,10 +748,14 @@
/// <returns>the required data point.</returns>
public double PointAt( int index, int seriesIndex )
{
- if (seriesIndex < abscissaColumnNumber_)
- return Utils.ToDouble( rows_[index][seriesIndex] );
- else
- return Utils.ToDouble( rows_[index][seriesIndex+1] );
+ if (seriesIndex < abscissaColumnNumber_)
+ {
+ return Utils.ToDouble(rows_[index][seriesIndex]);
+ }
+ else
+ {
+ return Utils.ToDouble(rows_[index][seriesIndex + 1]);
+ }
}
}
Modified: trunk/src/ArrowItem.cs
===================================================================
--- trunk/src/ArrowItem.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/ArrowItem.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -210,10 +210,14 @@
public void Draw( System.Drawing.Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis )
{
if (this.To.X > xAxis.Axis.WorldMax || this.To.X < xAxis.Axis.WorldMin)
+ {
return;
+ }
if (this.To.Y > yAxis.Axis.WorldMax || this.To.Y < yAxis.Axis.WorldMin)
+ {
return;
+ }
double angle = this.angle_;
@@ -320,7 +324,6 @@
{
offsetFromMiddle = new PointF( halfSize.Width, -dist );
}
-
break;
case 3:
@@ -333,7 +336,6 @@
{
offsetFromMiddle = new PointF( -dist, -halfSize.Height );
}
-
break;
default:
Modified: trunk/src/AssemblyInfo.cs
===================================================================
--- trunk/src/AssemblyInfo.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/AssemblyInfo.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -38,7 +38,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NPlot project")]
[assembly: AssemblyProduct("NPlot")]
-[assembly: AssemblyCopyright("Copyright (C) 2003-2006 Matt Howlett and others")]
+[assembly: AssemblyCopyright("Copyright (C) 2003-2007 Matt Howlett and others")]
[assembly: AssemblyTrademark("This program is under The BSD license")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.9.10.1")]
Modified: trunk/src/AxesConstraint.cs
===================================================================
--- trunk/src/AxesConstraint.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/AxesConstraint.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -215,7 +215,6 @@
/// </summary>
public class AxisPosition : AxesConstraint
{
-
private object xAxisPosition_;
private object yAxisPosition_;
private int position_;
@@ -439,7 +438,6 @@
pXAxis2.PhysicalMax = new Point( pXAxis2.PhysicalMax.X, pXAxis2.PhysicalMax.Y+changeTop );
}
-
else
{
Modified: trunk/src/Axis.cs
===================================================================
--- trunk/src/Axis.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/Axis.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -562,7 +562,6 @@
/// </summary>
protected static void DoClone( Axis b, Axis a )
{
-
// value items
a.autoScaleText_ = b.autoScaleText_;
a.autoScaleTicks_ = b.autoScaleTicks_;
@@ -602,7 +601,6 @@
a.FontScale = b.FontScale;
a.TickScale = b.TickScale;
-
}
@@ -824,19 +822,26 @@
// Force clipping at bounding box largeClip times that of real bounding box
// anyway. This is effectively at infinity.
const double largeClip = 100.0;
- if (prop > largeClip && clip)
- prop = largeClip;
+ if (prop > largeClip && clip)
+ {
+ prop = largeClip;
+ }
- if (prop < -largeClip && clip)
- prop = -largeClip;
+ if (prop < -largeClip && clip)
+ {
+ prop = -largeClip;
+ }
if (range == 0)
{
- if (coord >= WorldMin)
- prop = largeClip;
-
- if (coord < WorldMin)
- prop = -largeClip;
+ if (coord >= WorldMin)
+ {
+ prop = largeClip;
+ }
+ else
+ {
+ prop = -largeClip;
+ }
}
// calculate the physical coordinate.
@@ -1059,8 +1064,10 @@
PointF tickEnd = new PointF( tickStart.X + tickVector.X, tickStart.Y + tickVector.Y );
// and draw it!
- if (g != null)
- g.DrawLine( this.linePen_, (int)tickStart.X, (int)tickStart.Y, (int)tickEnd.X, (int)tickEnd.Y );
+ if (g != null)
+ {
+ g.DrawLine(this.linePen_, (int)tickStart.X, (int)tickStart.Y, (int)tickEnd.X, (int)tickEnd.Y);
+ }
// note: casting to int for tick positions was necessary to ensure ticks drawn where we wanted
// them. Not sure of the reason.
@@ -1191,7 +1198,6 @@
}
else
{
-
float bx1 = (textCenterX - textSize.Width/2.0f);
float by1 = (textCenterY - textSize.Height/2.0f);
float bx2 = textSize.Width;
@@ -1220,7 +1226,6 @@
labelOffset = new Point( (int)textCenterX, (int)textCenterY );
}
}
-
}
@@ -1249,7 +1254,6 @@
if (!Hidden)
{
-
// (1) Draw the axis line.
g.DrawLine( this.linePen_, physicalMin.X, physicalMin.Y, physicalMax.X, physicalMax.Y );
@@ -1267,12 +1271,15 @@
}
// (4) merge bounds and return.
- if (labelBounds != null)
- bounds = Rectangle.Union( bounds, (Rectangle)labelBounds );
+ if (labelBounds != null)
+ {
+ bounds = Rectangle.Union(bounds, (Rectangle)labelBounds);
+ }
- if (tickBounds != null)
- bounds = Rectangle.Union( bounds, (Rectangle)tickBounds );
-
+ if (tickBounds != null)
+ {
+ bounds = Rectangle.Union(bounds, (Rectangle)tickBounds);
+ }
}
boundingBox = bounds;
@@ -1391,8 +1398,10 @@
ArrayList largeTickPositions,
ref ArrayList smallTickPositions )
{
- if (smallTickPositions == null)
- smallTickPositions = new ArrayList();
+ if (smallTickPositions == null)
+ {
+ smallTickPositions = new ArrayList();
+ }
}
@@ -1454,7 +1463,6 @@
{
return fontScale_;
}
-
set
{
fontScale_ = value;
@@ -1484,11 +1492,15 @@
private void UpdateScale()
{
- if (labelFont_ != null)
- this.labelFontScaled_ = Utils.ScaleFont( labelFont_, FontScale );
-
- if (tickTextFont_ != null)
- this.tickTextFontScaled_ = Utils.ScaleFont( tickTextFont_, FontScale );
+ if (labelFont_ != null)
+ {
+ this.labelFontScaled_ = Utils.ScaleFont(labelFont_, FontScale);
+ }
+
+ if (tickTextFont_ != null)
+ {
+ this.tickTextFontScaled_ = Utils.ScaleFont(tickTextFont_, FontScale);
+ }
}
Modified: trunk/src/BarPlot.cs
===================================================================
--- trunk/src/BarPlot.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/BarPlot.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -130,7 +130,6 @@
g.DrawRectangle( borderPen_, r );
}
}
-
}
/// <summary>
@@ -151,8 +150,6 @@
}
-
-
/// <summary>
/// Returns a y-axis that is suitable for drawing this plot.
/// </summary>
@@ -185,6 +182,7 @@
g.DrawRectangle( borderPen_, newRectangle );
}
+
/// <summary>
/// The pen used to draw the plot
/// </summary>
@@ -238,7 +236,6 @@
{
rectangleBrush_ = value;
}
-
}
private IRectangleBrush rectangleBrush_ = new RectangleBrushes.Solid( Color.LightGray );
@@ -271,8 +268,5 @@
{
sb.Append( "Write data not implemented yet for BarPlot\r\n" );
}
-
-
}
-
}
Modified: trunk/src/BasePlot.cs
===================================================================
--- trunk/src/BasePlot.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/BasePlot.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -110,8 +110,5 @@
}
}
private string dataMember_ = null;
-
-
-
}
}
Modified: trunk/src/BaseSequencePlot.cs
===================================================================
--- trunk/src/BaseSequencePlot.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/BaseSequencePlot.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -93,6 +93,5 @@
sb.Append( "\r\n" );
data_.WriteData( sb, region, onlyInRegion );
}
-
}
}
Modified: trunk/src/Bitmap.PlotSurface2D.cs
===================================================================
--- trunk/src/Bitmap.PlotSurface2D.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/Bitmap.PlotSurface2D.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -34,505 +34,503 @@
using System.Drawing.Drawing2D;
using System.Collections;
-namespace NPlot
+namespace NPlot.Bitmap
{
-
- namespace Bitmap
+ /// <summary>
+ /// Wrapper around NPlot.PlotSurface2D that provides extra functionality
+ /// specific to drawing to Bitmaps.
+ /// </summary>
+ public class PlotSurface2D: IPlotSurface2D
{
/// <summary>
- /// Wrapper around NPlot.PlotSurface2D that provides extra functionality
- /// specific to drawing to Bitmaps.
+ /// Constructor.
/// </summary>
- public class PlotSurface2D: IPlotSurface2D
+ /// <param name="width">width of the bitmap.</param>
+ /// <param name="height">height of the bitmap.</param>
+ public PlotSurface2D( int width, int height )
{
+ b_ = new System.Drawing.Bitmap( width, height );
+ ps_ = new NPlot.PlotSurface2D();
+ }
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="width">width of the bitmap.</param>
- /// <param name="height">height of the bitmap.</param>
- public PlotSurface2D( int width, int height )
- {
- b_ = new System.Drawing.Bitmap( width, height );
- ps_ = new NPlot.PlotSurface2D();
- }
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="b">The Bitmap where the plot is to be rendered.</param>
- public PlotSurface2D( System.Drawing.Bitmap b )
- {
- b_ = b;
- ps_ = new NPlot.PlotSurface2D();
- }
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="b">The Bitmap where the plot is to be rendered.</param>
+ public PlotSurface2D( System.Drawing.Bitmap b )
+ {
+ b_ = b;
+ ps_ = new NPlot.PlotSurface2D();
+ }
- /// <summary>
- /// Renders the plot.
- /// </summary>
- /// <param name="g">The graphics surface.</param>
- /// <param name="bounds">The rectangle storing the bounds for rendering.</param>
- public void Draw( Graphics g, Rectangle bounds )
- {
- ps_.Draw( g, bounds );
- }
+ /// <summary>
+ /// Renders the plot.
+ /// </summary>
+ /// <param name="g">The graphics surface.</param>
+ /// <param name="bounds">The rectangle storing the bounds for rendering.</param>
+ public void Draw( Graphics g, Rectangle bounds )
+ {
+ ps_.Draw( g, bounds );
+ }
- /// <summary>
- /// Clears the plot.
- /// </summary>
- public void Clear()
- {
- ps_.Clear();
- }
+ /// <summary>
+ /// Clears the plot.
+ /// </summary>
+ public void Clear()
+ {
+ ps_.Clear();
+ }
- /// <summary>
- /// Adds a drawable object to the plot surface. If the object is an IPlot,
- /// the PlotSurface2D axes will also be updated.
- /// </summary>
- /// <param name="p">The IDrawable object to add to the plot surface.</param>
- public void Add( IDrawable p )
- {
- ps_.Add( p );
- }
+ /// <summary>
+ /// Adds a drawable object to the plot surface. If the object is an IPlot,
+ /// the PlotSurface2D axes will also be updated.
+ /// </summary>
+ /// <param name="p">The IDrawable object to add to the plot surface.</param>
+ public void Add( IDrawable p )
+ {
+ ps_.Add( p );
+ }
- /// <summary>
- /// Adds a drawable object to the plot surface against the specified axes. If
- /// the object is an IPlot, the PlotSurface2D axes will also be updated.
- /// </summary>
- /// <param name="p">the IDrawable object to add to the plot surface</param>
- /// <param name="xp">the x-axis to add the plot against.</param>
- /// <param name="yp">the y-axis to add the plot against.</param>
- public void Add( IDrawable p, NPlot.PlotSurface2D.XAxisPosition xp, NPlot.PlotSurface2D.YAxisPosition yp )
+ /// <summary>
+ /// Adds a drawable object to the plot surface against the specified axes. If
+ /// the object is an IPlot, the PlotSurface2D axes will also be updated.
+ /// </summary>
+ /// <param name="p">the IDrawable object to add to the plot surface</param>
+ /// <param name="xp">the x-axis to add the plot against.</param>
+ /// <param name="yp">the y-axis to add the plot against.</param>
+ public void Add( IDrawable p, NPlot.PlotSurface2D.XAxisPosition xp, NPlot.PlotSurface2D.YAxisPosition yp )
+ {
+ ps_.Add( p, xp, yp );
+ }
+
+
+ /// <summary>
+ /// Adds a drawable object to the plot surface. If the object is an IPlot,
+ /// the PlotSurface2D axes will also be updated.
+ /// </summary>
+ /// <param name="p">The IDrawable object to add to the plot surface.</param>
+ /// <param name="zOrder">The z-ordering when drawing (objects with lower numbers are drawn first)</param>
+ public void Add( IDrawable p, int zOrder )
+ {
+ ps_.Add( p, zOrder );
+ }
+
+
+ /// <summary>
+ /// Adds a drawable object to the plot surface against the specified axes. If
+ /// the object is an IPlot, the PlotSurface2D axes will also be updated.
+ /// </summary>
+ /// <param name="p">the IDrawable object to add to the plot surface</param>
+ /// <param name="xp">the x-axis to add the plot against.</param>
+ /// <param name="yp">the y-axis to add the plot against.</param>
+ /// <param name="zOrder">The z-ordering when drawing (objects with lower numbers are drawn first)</param>
+ public void Add( IDrawable p, NPlot.PlotSurface2D.XAxisPosition xp,
+ NPlot.PlotSurface2D.YAxisPosition yp, int zOrder )
+ {
+ ps_.Add( p, xp, yp , zOrder);
+ }
+
+
+ /// <summary>
+ /// The plot surface title.
+ /// </summary>
+ public string Title
+ {
+ get
{
- ps_.Add( p, xp, yp );
+ return ps_.Title;
}
-
- /// <summary>
- /// Adds a drawable object to the plot surface. If the object is an IPlot,
- /// the PlotSurface2D axes will also be updated.
- /// </summary>
- /// <param name="p">The IDrawable object to add to the plot surface.</param>
- /// <param name="zOrder">The z-ordering when drawing (objects with lower numbers are drawn first)</param>
- public void Add( IDrawable p, int zOrder )
+ set
{
- ps_.Add( p, zOrder );
+ ps_.Title = value;
}
+ }
- /// <summary>
- /// Adds a drawable object to the plot surface against the specified axes. If
- /// the object is an IPlot, the PlotSurface2D axes will also be updated.
- /// </summary>
- /// <param name="p">the IDrawable object to add to the plot surface</param>
- /// <param name="xp">the x-axis to add the plot against.</param>
- /// <param name="yp">the y-axis to add the plot against.</param>
- /// <param name="zOrder">The z-ordering when drawing (objects with lower numbers are drawn first)</param>
- public void Add( IDrawable p, NPlot.PlotSurface2D.XAxisPosition xp,
- NPlot.PlotSurface2D.YAxisPosition yp, int zOrder )
+ /// <summary>
+ /// The plot title font.
+ /// </summary>
+ public Font TitleFont
+ {
+ get
{
- ps_.Add( p, xp, yp , zOrder);
+ return ps_.TitleFont;
}
-
- /// <summary>
- /// The plot surface title.
- /// </summary>
- public string Title
+ set
{
- get
- {
- return ps_.Title;
- }
- set
- {
- ps_.Title = value;
- }
+ ps_.TitleFont = value;
}
+ }
-
- /// <summary>
- /// The plot title font.
- /// </summary>
- public Font TitleFont
+#if API_1_1
+ /// <summary>
+ /// It has been renamed to <see cref="SurfacePadding" /> and can be used with .NET 1.1 only.
+ /// </summary>
+ [
+ Obsolete("This property is only maintained in .NET 1.1 profile for compatibility, but it might be removed in the future. Use SurfacePadding instead")
+ ]
+ public int Padding
+ {
+ get
{
- get
- {
- return ps_.TitleFont;
- }
- set
- {
- ps_.TitleFont = value;
- }
+ return SurfacePadding;
}
-#if API_1_1
- /// <summary>
- /// It has been renamed to <see cref="SurfacePadding" /> and can be used with .NET 1.1 only.
- /// </summary>
- [
- Obsolete("This property is only maintained in .NET 1.1 profile for compatibility, but it might be removed in the future. Use SurfacePadding instead")
- ]
- public int Padding
+ set
{
- get
- {
- return SurfacePadding;
- }
- set
- {
- SurfacePadding = value;
- }
+ SurfacePadding = value;
}
+ }
#endif
- /// <summary>
- /// The distance in pixels to leave between of the edge of the bounding rectangle
- /// supplied to the Draw method, and the markings that make up the plot.
- /// </summary>
- public int SurfacePadding
+ /// <summary>
+ /// The distance in pixels to leave between of the edge of the bounding rectangle
+ /// supplied to the Draw method, and the markings that make up the plot.
+ /// </summary>
+ public int SurfacePadding
+ {
+ get
{
- get
- {
- return ps_.SurfacePadding;
- }
- set
- {
- ps_.SurfacePadding = value;
- }
+ return ps_.SurfacePadding;
}
+ set
+ {
+ ps_.SurfacePadding = value;
+ }
+ }
- /// <summary>
- /// The bottom abscissa axis.
- /// </summary>
- public Axis XAxis1
+ /// <summary>
+ /// The bottom abscissa axis.
+ /// </summary>
+ public Axis XAxis1
+ {
+ get
{
- get
- {
- return ps_.XAxis1;
- }
- set
- {
- ps_.XAxis1 = value;
- }
+ return ps_.XAxis1;
}
+ set
+ {
+ ps_.XAxis1 = value;
+ }
+ }
- /// <summary>
- /// The left ordinate axis.
- /// </summary>
- public Axis YAxis1
+ /// <summary>
+ /// The left ordinate axis.
+ /// </summary>
+ public Axis YAxis1
+ {
+ get
{
- get
- {
- return ps_.YAxis1;
- }
- set
- {
- ps_.YAxis1 = value;
- }
+ return ps_.YAxis1;
}
+ set
+ {
+ ps_.YAxis1 = value;
+ }
+ }
- /// <summary>
- /// The top abscissa axis.
- /// </summary>
- public Axis XAxis2
+ /// <summary>
+ /// The top abscissa axis.
+ /// </summary>
+ public Axis XAxis2
+ {
+ get
{
- get
- {
- return ps_.XAxis2;
- }
- set
- {
- ps_.XAxis2 = value;
- }
+ return ps_.XAxis2;
}
+ set
+ {
+ ps_.XAxis2 = value;
+ }
+ }
- /// <summary>
- /// The right ordinate axis.
- /// </summary>
- public Axis YAxis2
+ /// <summary>
+ /// The right ordinate axis.
+ /// </summary>
+ public Axis YAxis2
+ {
+ get
{
- get
- {
- return ps_.YAxis2;
- }
- set
- {
- ps_.YAxis2 = value;
- }
+ return ps_.YAxis2;
}
+ set
+ {
+ ps_.YAxis2 = value;
+ }
+ }
- /// <summary>
- /// Gets or Sets the legend to use with this plot surface.
- /// </summary>
- public NPlot.Legend Legend
+ /// <summary>
+ /// Gets or Sets the legend to use with this plot surface.
+ /// </summary>
+ public NPlot.Legend Legend
+ {
+ get
{
- get
- {
- return ps_.Legend;
- }
- set
- {
- ps_.Legend = value;
- }
+ return ps_.Legend;
}
-
- /// <summary>
- /// Gets or Sets the legend z-order.
- /// </summary>
- public int LegendZOrder
+ set
{
- get
- {
- return ps_.LegendZOrder;
- }
- set
- {
- ps_.LegendZOrder = value;
- }
+ ps_.Legend = value;
}
+ }
- /// <summary>
- /// A color used to paint the plot background. Mutually exclusive with PlotBackImage and PlotBackBrush
- /// </summary>
- public System.Drawing.Color PlotBackColor
+ /// <summary>
+ /// Gets or Sets the legend z-order.
+ /// </summary>
+ public int LegendZOrder
+ {
+ get
{
- set
- {
- ps_.PlotBackColor = value;
- }
+ return ps_.LegendZOrder;
}
+ set
+ {
+ ps_.LegendZOrder = value;
+ }
+ }
-
- /// <summary>
- /// An imaged used to paint the plot background. Mutually exclusive with PlotBackColor and PlotBackBrush
- /// </summary>
- public System.Drawing.Bitmap PlotBackImage
+ /// <summary>
+ /// A color used to paint the plot background. Mutually exclusive with PlotBackImage and PlotBackBrush
+ /// </summary>
+ public System.Drawing.Color PlotBackColor
+ {
+ set
{
- set
- {
- ps_.PlotBackImage = value;
- }
+ ps_.PlotBackColor = value;
}
+ }
- /// <summary>
- /// A Rectangle brush used to paint the plot background. Mutually exclusive with PlotBackColor and PlotBackBrush
- /// </summary>
- public IRectangleBrush PlotBackBrush
+ /// <summary>
+ /// An imaged used to paint the plot background. Mutually exclusive with PlotBackColor and PlotBackBrush
+ /// </summary>
+ public System.Drawing.Bitmap PlotBackImage
+ {
+ set
{
- set
- {
- ps_.PlotBackBrush = value;
- }
+ ps_.PlotBackImage = value;
}
+ }
- /// <summary>
- /// Smoothing mode to use when drawing plots.
- /// </summary>
- public System.Drawing.Drawing2D.SmoothingMode SmoothingMode
- {
- get
- {
- return ps_.SmoothingMode;
- }
- set
- {
- ps_.SmoothingMode = value;
- }
+ /// <summary>
+ /// A Rectangle brush used to paint the plot background. Mutually exclusive with PlotBackColor and PlotBackBrush
+ /// </summary>
+ public IRectangleBrush PlotBackBrush
+ {
+ set
+ {
+ ps_.PlotBackBrush = value;
}
+ }
- /// <summary>
- /// The bitmap width
- /// </summary>
- public int Width
+ /// <summary>
+ /// Smoothing mode to use when drawing plots.
+ /// </summary>
+ public System.Drawing.Drawing2D.SmoothingMode SmoothingMode
+ {
+ get
{
- get
- {
- return b_.Width;
- }
+ return ps_.SmoothingMode;
}
+ set
+ {
+ ps_.SmoothingMode = value;
+ }
+ }
- /// <summary>
- /// The bitmap height
- /// </summary>
- public int Height
+ /// <summary>
+ /// The bitmap width
+ /// </summary>
+ public int Width
+ {
+ get
{
- get
- {
- return b_.Height;
- }
+ return b_.Width;
}
+ }
- /// <summary>
- /// Renders the bitmap to a MemoryStream. Useful for returning the bitmap from
- /// an ASP.NET page.
- /// </summary>
- /// <returns>The MemoryStream object.</returns>
- public System.IO.MemoryStream ToStream( System.Drawing.Imaging.ImageFormat imageFormat )
+ /// <summary>
+ /// The bitmap height
+ /// </summary>
+ public int Height
+ {
+ get
{
- System.IO.MemoryStream stream = new System.IO.MemoryStream();
- ps_.Draw(Graphics.FromImage(this.Bitmap),new System.Drawing.Rectangle(0,0,b_.Width,b_.Height));
- this.Bitmap.Save(stream, imageFormat);
- return stream;
+ return b_.Height;
}
+ }
- /// <summary>
- /// The bitmap to use as the drawing surface.
- /// </summary>
- public System.Drawing.Bitmap Bitmap
+ /// <summary>
+ /// Renders the bitmap to a MemoryStream. Useful for returning the bitmap from
+ /// an ASP.NET page.
+ /// </summary>
+ /// <returns>The MemoryStream object.</returns>
+ public System.IO.MemoryStream ToStream( System.Drawing.Imaging.ImageFormat imageFormat )
+ {
+ System.IO.MemoryStream stream = new System.IO.MemoryStream();
+ ps_.Draw(Graphics.FromImage(this.Bitmap),new System.Drawing.Rectangle(0,0,b_.Width,b_.Height));
+ this.Bitmap.Save(stream, imageFormat);
+ return stream;
+ }
+
+
+ /// <summary>
+ /// The bitmap to use as the drawing surface.
+ /// </summary>
+ public System.Drawing.Bitmap Bitmap
+ {
+ get
{
- get
- {
- return b_;
- }
- set
- {
- b_ = value;
- }
+ return b_;
}
+ set
+ {
+ b_ = value;
+ }
+ }
- /// <summary>
- /// The bitmap background color outside the bounds of the plot surface.
- /// </summary>
- public Color BackColor
+ /// <summary>
+ /// The bitmap background color outside the bounds of the plot surface.
+ /// </summary>
+ public Color BackColor
+ {
+ set
{
- set
- {
- backColor_ = value;
- }
+ backColor_ = value;
}
- object backColor_ = null;
-
+ }
+ object backColor_ = null;
+
- /// <summary>
- /// Refreshes (draws) the plot.
- /// </summary>
- public void Refresh()
+ /// <summary>
+ /// Refreshes (draws) the plot.
+ /// </summary>
+ public void Refresh()
+ {
+ if (this.backColor_!=null)
{
- if (this.backColor_!=null)
- {
- Graphics g = Graphics.FromImage( b_ );
- g.FillRectangle( (new Pen( (Color)this.backColor_)).Brush,0,0,b_.Width,b_.Height );
- }
- ps_.Draw( Graphics.FromImage(b_), new System.Drawing.Rectangle(0,0,b_.Width,b_.Height) );
+ Graphics g = Graphics.FromImage( b_ );
+ g.FillRectangle( (new Pen( (Color)this.backColor_)).Brush,0,0,b_.Width,b_.Height );
}
+ ps_.Draw( Graphics.FromImage(b_), new System.Drawing.Rectangle(0,0,b_.Width,b_.Height) );
+ }
- private NPlot.PlotSurface2D ps_;
- private System.Drawing.Bitmap b_;
+ private NPlot.PlotSurface2D ps_;
+ private System.Drawing.Bitmap b_;
-
- /// <summary>
- /// Add an axis constraint to the plot surface. Axis constraints can
- /// specify relative world-pixel scalings, absolute axis positions etc.
- /// </summary>
- /// <param name="c">The axis constraint to add.</param>
- public void AddAxesConstraint( AxesConstraint c )
- {
- ps_.AddAxesConstraint( c );
- }
+
+ /// <summary>
+ /// Add an axis constraint to the plot surface. Axis constraints can
+ /// specify relative world-pixel scalings, absolute axis positions etc.
+ /// </summary>
+ /// <param name="c">The axis constraint to add.</param>
+ public void AddAxesConstraint( AxesConstraint c )
+ {
+ ps_.AddAxesConstraint( c );
+ }
- /// <summary>
- /// Whether or not the title will be scaled according to size of the plot
- /// surface.
- /// </summary>
- public bool AutoScaleTitle
+ /// <summary>
+ /// Whether or not the title will be scaled according to size of the plot
+ /// surface.
+ /// </summary>
+ public bool AutoScaleTitle
+ {
+ get
{
- get
- {
- return ps_.AutoScaleTitle;
- }
- set
- {
- ps_.AutoScaleTitle = value;
- }
+ return ps_.AutoScaleTitle;
}
+ set
+ {
+ ps_.AutoScaleTitle = value;
+ }
+ }
- /// <summary>
- /// When plots are added to the plot surface, the axes they are attached to
- /// are immediately modified to reflect data of the plot. If
- /// AutoScaleAutoGeneratedAxes is true when a plot is added, the axes will
- /// be turned in to auto scaling ones if they are not already [tick marks,
- /// tick text and label size scaled to size of plot surface]. If false,
- /// axes will not be autoscaling.
- /// </summary>
- public bool AutoScaleAutoGeneratedAxes
+ /// <summary>
+ /// When plots are added to the plot surface, the axes they are attached to
+ /// are immediately modified to reflect data of the plot. If
+ /// AutoScaleAutoGeneratedAxes is true when a plot is added, the axes will
+ /// be turned in to auto scaling ones if they are not already [tick marks,
+ /// tick text and label size scaled to size of plot surface]. If false,
+ /// axes will not be autoscaling.
+ /// </summary>
+ public bool AutoScaleAutoGeneratedAxes
+ {
+ get
{
- get
- {
- return ps_.AutoScaleAutoGeneratedAxes;
- }
- set
- {
- ps_.AutoScaleAutoGeneratedAxes = value;
- }
+ return ps_.AutoScaleAutoGeneratedAxes;
}
+ set
+ {
+ ps_.AutoScaleAutoGeneratedAxes = value;
+ }
+ }
- /// <summary>
- /// Sets the title to be drawn using a solid brush of this color.
- /// </summary>
- public Color TitleColor
+ /// <summary>
+ /// Sets the title to be drawn using a solid brush of this color.
+ /// </summary>
+ public Color TitleColor
+ {
+ set
{
- set
- {
- ps_.TitleColor = value;
- }
+ ps_.TitleColor = value;
}
+ }
- /// <summary>
- /// The brush used for drawing the title.
- /// </summary>
- public Brush TitleBrush
+ /// <summary>
+ /// The brush used for drawing the title.
+ /// </summary>
+ public Brush TitleBrush
+ {
+ get
{
- get
- {
- return ps_.TitleBrush;
- }
- set
- {
- ps_.TitleBrush = value;
- }
+ return ps_.TitleBrush;
}
+ set
+ {
+ ps_.TitleBrush = value;
+ }
+ }
- /// <summary>
- /// Remove a drawable object from the plot surface.
- /// </summary>
- /// <param name="p">the drawable to remove</param>
- /// <param name="updateAxes">whether or not to update the axes after removing the idrawable.</param>
- public void Remove(IDrawable p, bool updateAxes)
- {
- ps_.Remove(p, updateAxes);
- }
+ /// <summary>
+ /// Remove a drawable object from the plot surface.
+ /// </summary>
+ /// <param name="p">the drawable to remove</param>
+ /// <param name="updateAxes">whether or not to update the axes after removing the idrawable.</param>
+ public void Remove(IDrawable p, bool updateAxes)
+ {
+ ps_.Remove(p, updateAxes);
+ }
- /// <summary>
- /// Gets an array list containing all drawables currently added to the PlotSurface2D.
- /// </summary>
- public ArrayList Drawables
+ /// <summary>
+ /// Gets an array list containing all drawables currently added to the PlotSurface2D.
+ /// </summary>
+ public ArrayList Drawables
+ {
+ get
{
- get
- {
- return ps_.Drawables;
- }
+ return ps_.Drawables;
}
-
}
}
}
Modified: trunk/src/CandlePlot.cs
===================================================================
--- trunk/src/CandlePlot.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/CandlePlot.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -145,7 +145,6 @@
}
}
private double high_;
-
}
@@ -248,12 +247,10 @@
rows_ = ((DataTable)((DataSet)dataSource_).Tables[0]).Rows;
}
}
-
else if (dataSource_ is DataTable )
{
rows_ = ((DataTable)dataSource_).Rows;
}
-
else
{
throw new NPlotException ( "not implemented yet" );
@@ -285,7 +282,6 @@
{
get
{
-
// try a fast track first
if (useDoublesArrays_)
{
@@ -296,7 +292,6 @@
highDataArray_[i],
closeDataArray_[i]);
}
-
// is the data coming from a data source?
else if (rows_ != null)
{
@@ -308,7 +303,6 @@
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)
{
@@ -320,12 +314,10 @@
return new PointOLHC(x, open, low, high, close);
}
-
else
{
throw new NPlotException("not implemented yet");
}
-
}
}
@@ -339,7 +331,6 @@
get
{
// this is inefficient [could set up delegates in constructor].
-
if (useDoublesArrays_)
{
return openDataArray_.Length;
@@ -359,11 +350,17 @@
{
int size = ((Array)openData_).Length;
if (size != ((Array)closeData_).Length)
+ {
throw new NPlotException("open and close arrays are not of same length");
+ }
if (size != ((Array)lowData_).Length)
+ {
throw new NPlotException("open and close arrays are not of same length");
+ }
if (size != ((Array)highData_).Length)
+ {
throw new NPlotException("open and close arrays are not of same length");
+ }
return size;
}
@@ -392,6 +389,7 @@
double second = Utils.ToDouble(((Array)abscissaData_).GetValue(1));
minStep = Math.Abs(second - first);
}
+
if (((System.Collections.IList)abscissaData_).Count > 2)
{
double first = Utils.ToDouble(((Array)abscissaData_).GetValue(1));
@@ -399,6 +397,7 @@
if (Math.Abs(second - first) < minStep)
minStep = Math.Abs(second - first);
}
+
if (((System.Collections.IList)abscissaData_)[0] is DateTime)
{
return new DateTimeAxis(min - minStep / 2.0, max + minStep / 2.0);
@@ -410,7 +409,6 @@
}
else
{
-
Utils.RowArrayMinMax(this.rows_, out min, out max, (string)this.abscissaData_);
if (rows_.Count > 1)
@@ -419,6 +417,7 @@
double second = Utils.ToDouble(rows_[1][(string)abscissaData_]);
minStep = Math.Abs(second - first);
}
+
if (rows_.Count > 2)
{
double first = Utils.ToDouble(rows_[1][(string)abscissaData_]);
@@ -436,7 +435,6 @@
return new LinearAxis(min - minStep / 2.0, max + minStep / 2.0);
}
}
-
}
@@ -446,7 +444,6 @@
/// <returns>A suitable y-axis.</returns>
public Axis SuggestYAxis()
{
-
double min_l;
double max_l;
double min_h;
@@ -467,7 +464,6 @@
a.IncreaseRange( 0.08 );
return a;
}
-
}
@@ -496,12 +492,18 @@
if (cd.Count > 2)
{ // to be pretty sure we get the smallest gap.
int xPos3 = (int)(xAxis.WorldToPhysical(((PointOLHC)cd[2]).X, false)).X;
- if (xPos3 - xPos2 < minDist) minDist = xPos3 - xPos2;
+ if (xPos3 - xPos2 < minDist)
+ {
+ minDist = xPos3 - xPos2;
+ }
if (cd.Count > 3)
{
int xPos4 = (int)(xAxis.WorldToPhysical(((PointOLHC)cd[3]).X, false)).X;
- if (xPos4 - xPos3 < minDist) minDist = xPos4 - xPos3;
+ if (xPos4 - xPos3 < minDist)
+ {
+ minDist = xPos4 - xPos3;
+ }
}
}
@@ -564,11 +566,12 @@
PointOLHC point = (PointOLHC)cd[i];
if ( (!double.IsNaN (point.Open)) && (!double.IsNaN(point.High)) && (!double.IsNaN (point.Low)) && (!double.IsNaN(point.Close)) )
{
-
int xPos = (int)(xAxis.WorldToPhysical( point.X, false )).X;
- if (xPos + offset + addAmount < xAxis.PhysicalMin.X || xAxis.PhysicalMax.X < xPos + offset - addAmount)
- continue;
+ if (xPos + offset + addAmount < xAxis.PhysicalMin.X || xAxis.PhysicalMax.X < xPos + offset - addAmount)
+ {
+ continue;
+ }
int yPos1 = (int)(yAxis.WorldToPhysical( point.Low, false )).Y;
int yPos2 = (int)(yAxis.WorldToPhysical( point.High, false )).Y;
@@ -577,7 +580,6 @@
if (this.Style == Styles.Stick)
{
-
/*
// brant hyatt proposed.
if (i > 0)
@@ -597,7 +599,6 @@
g.DrawLine( p, xPos-addAmount+offset, yPos3, xPos+offset, yPos3 );
g.DrawLine( p, xPos+offset, yPos4, xPos+addAmount+offset, yPos4 );
}
-
else if (this.Style == Styles.Filled)
{
g.DrawLine( p, xPos+offset, yPos1, xPos+offset, yPos2 );
@@ -615,12 +616,9 @@
{
g.DrawLine( p, xPos-addAmount+offset, yPos3, xPos-addAmount+stickWidth+offset, yPos3 );
}
-
}
-
}
}
-
}
@@ -746,7 +744,6 @@
g.DrawLine( p, startEnd.Left, (startEnd.Top + startEnd.Bottom)/2,
startEnd.Right, (startEnd.Top + startEnd.Bottom)/2 );
-
}
@@ -774,7 +771,6 @@
/// </summary>
public enum Styles
{
-
/// <summary>
/// Draw vertical line between low and high, tick on left for open and tick on right for close.
/// </summary>
@@ -786,7 +782,6 @@
/// in BullishColor and BearishColor properties.
/// </summary>
Filled
-
}
@@ -865,6 +860,5 @@
public void WriteData( System.Text.StringBuilder sb, RectangleD region, bool onlyInRegion )
{
}
-
}
}
Modified: trunk/src/DateTimeAxis.cs
===================================================================
--- trunk/src/DateTimeAxis.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/DateTimeAxis.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -152,8 +152,7 @@
Point physicalMax,
out object labelOffset,
out object boundingBox )
- {
-
+ {
// TODO: Look at offset and bounding box logic again here. why temp and other vars?
Point tLabelOffset;
@@ -179,7 +178,6 @@
// draw large ticks.
for (int i=0; i<largeTicks.Count; ++i)
{
-
DateTime tickDate = new DateTime( (long)((double)largeTicks[i]) );
string label = LargeTickLabel(tickDate);
@@ -207,21 +205,18 @@
{
label = tickDate.Year.ToString();
}
-
else if ( this.LargeTickLabelType_ == LargeTickLabelType.month )
{
label = tickDate.ToString("MMM");
label += " ";
label += tickDate.Year.ToString().Substring(2,2);
}
-
else if ( this.LargeTickLabelType_ == LargeTickLabelType.day )
{
label = (tickDate.Day).ToString();
label += " ";
label += tickDate.ToString("MMM");
- }
-
+ }
else if ( this.LargeTickLabelType_ == LargeTickLabelType.hourMinute )
{
string minutes = tickDate.Minute.ToString();
@@ -246,7 +241,6 @@
}
label = tickDate.Hour.ToString() + ":" + minutes + "." + seconds;
}
-
}
else
{
@@ -328,25 +322,33 @@
if(largeTickStep_ == TimeSpan.Zero)
{
-
// if less than 10 minutes, then large ticks on second spacings.
-
if ( timeLength < new TimeSpan(0,0,2,0,0) )
{
this.LargeTickLabelType_ = LargeTickLabelType.hourMinuteSeconds;
double secondsSkip;
- if (timeLength < new TimeSpan( 0,0,0,10,0 ) )
- secondsSkip = 1.0;
- else if ( timeLength < new TimeSpan(0,0,0,20,0) )
- secondsSkip = 2.0;
- else if ( timeLength < new TimeSpan(0,0,0,50,0) )
- secondsSkip = 5.0;
- else if ( timeLength < new TimeSpan(0,0,2,30,0) )
- secondsSkip = 15.0;
- else
- secondsSkip = 30.0;
+ if (timeLength < new TimeSpan(0, 0, 0, 10, 0))
+ {
+ secondsSkip = 1.0;
+ }
+ else if (timeLength < new TimeSpan(0, 0, 0, 20, 0))
+ {
+ secondsSkip = 2.0;
+ }
+ else if (timeLength < new TimeSpan(0, 0, 0, 50, 0))
+ {
+ secondsSkip = 5.0;
+ }
+ else if (timeLength < new TimeSpan(0, 0, 2, 30, 0))
+ {
+ secondsSkip = 15.0;
+ }
+ else
+ {
+ secondsSkip = 30.0;
+ }
int second = worldMinDate.Second;
second -= second % (int)secondsSkip;
@@ -371,25 +373,33 @@
currentTickDate = currentTickDate.AddSeconds( secondsSkip );
}
}
-
// Less than 2 hours, then large ticks on minute spacings.
-
else if ( timeLength < new TimeSpan(0,2,0,0,0) )
{
this.LargeTickLabelType_ = LargeTickLabelType.hourMinute;
double minuteSkip;
- if ( timeLength < new TimeSpan(0,0,10,0,0) )
- minuteSkip = 1.0;
- else if ( timeLength < new TimeSpan(0,0,20,0,0) )
- minuteSkip = 2.0;
- else if ( timeLength < new TimeSpan(0,0,50,0,0) )
- minuteSkip = 5.0;
- else if ( timeLength < new TimeSpan(0,2,30,0,0) )
- minuteSkip = 15.0;
- else //( timeLength < new TimeSpan( 0,5,0,0,0) )
- minuteSkip = 30.0;
+ if (timeLength < new TimeSpan(0, 0, 10, 0, 0))
+ {
+ minuteSkip = 1.0;
+ }
+ else if (timeLength < new TimeSpan(0, 0, 20, 0, 0))
+ {
+ minuteSkip = 2.0;
+ }
+ else if (timeLength < new TimeSpan(0, 0, 50, 0, 0))
+ {
+ minuteSkip = 5.0;
+ }
+ else if (timeLength < new TimeSpan(0, 2, 30, 0, 0))
+ {
+ minuteSkip = 15.0;
+ }
+ else //( timeLength < new TimeSpan( 0,5,0,0,0) )
+ {
+ minuteSkip = 30.0;
+ }
int minute = worldMinDate.Minute;
minute -= minute % (int)minuteSkip;
@@ -415,20 +425,24 @@
}
// Less than 2 days, then large ticks on hour spacings.
-
else if ( timeLength < new TimeSpan(2,0,0,0,0) )
{
this.LargeTickLabelType_ = LargeTickLabelType.hourMinute;
double hourSkip;
- if ( timeLength < new TimeSpan(0,10,0,0,0) )
- hourSkip = 1.0;
- else if ( timeLength < new TimeSpan(0,20,0,0,0) )
- hourSkip = 2.0;
- else
- hourSkip = 6.0;
+ if (timeLength < new TimeSpan(0, 10, 0, 0, 0))
+ {
+ hourSkip = 1.0;
+ }
+ else if (timeLength < new TimeSpan(0, 20, 0, 0, 0))
+ {
+ hourSkip = 2.0;
+ }
+ else
+ {
+ hourSkip = 6.0;
+ }
-
int hour = worldMinDate.Hour;
hour -= hour % (int)hourSkip;
@@ -449,25 +463,29 @@
currentTickDate = currentTickDate.AddHours( hourSkip );
}
-
}
-
-
// less than 5 months, then large ticks on day spacings.
-
else if ( timeLength < new TimeSpan(daysInMonth*4,0,0,0,0))
{
this.LargeTickLabelType_ = LargeTickLabelType.day;
double daySkip;
- if ( timeLength < new TimeSpan(10,0,0,0,0) )
- daySkip = 1.0;
- else if (timeLength < new TimeSpan(20,0,0,0,0) )
- daySkip = 2.0;
- else if (timeLength < new TimeSpan(7*10,0,0,0,0) )
- daySkip = 7.0;
- else
- daySkip = 14.0;
+ if (timeLength < new TimeSpan(10, 0, 0, 0, 0))
+ {
+ daySkip = 1.0;
+ }
+ else if (timeLength < new TimeSpan(20, 0, 0, 0, 0))
+ {
+ daySkip = 2.0;
+ }
+ else if (timeLength < new TimeSpan(7 * 10, 0, 0, 0, 0))
+ {
+ daySkip = 7.0;
+ }
+ else
+ {
+ daySkip = 14.0;
+ }
DateTime currentTickDate = new DateTime(
worldMinDate.Year,
@@ -476,11 +494,12 @@
if (daySkip == 2.0)
{
-
TimeSpan timeSinceBeginning = currentTickDate - DateTime.MinValue;
if (timeSinceBeginning.Days % 2 == 1)
+ {
currentTickDate = currentTickDate.AddDays(-1.0);
+ }
}
if (daySkip == 7 || daySkip == 14.0)
@@ -508,8 +527,9 @@
case DayOfWeek.Sunday:
currentTickDate = currentTickDate.AddDays(-6.0);
break;
+ default:
+ break;
}
-
}
if (daySkip == 14.0f)
@@ -534,38 +554,48 @@
currentTickDate = currentTickDate.AddDays(daySkip);
}
}
-
-
- // else ticks on month or year spacings.
-
+ // else ticks on month or year spacings.
else if ( timeLength >= new TimeSpan(daysInMonth*4,0,0,0,0) )
{
-
int monthSpacing = 0;
if ( timeLength.Days < daysInMonth*(12*3+6) )
{
LargeTickLabelType_ = LargeTickLabelType.month;
- if ( timeLength.Days < daysInMonth*10 )
- monthSpacing = 1;
- else if ( timeLength.Days < daysInMonth*(12*2) )
- monthSpacing = 3;
- else // if ( timeLength.Days < daysInMonth*(12*3+6) )
- monthSpacing = 6;
+ if (timeLength.Days < daysInMonth * 10)
+ {
+ monthSpacing = 1;
+ }
+ else if (timeLength.Days < daysInMonth * (12 * 2))
+ {
+ monthSpacing = 3;
+ }
+ else // if ( timeLength.Days < daysInMonth*(12*3+6) )
+ {
+ monthSpacing = 6;
+ }
}
else
{
LargeTickLabelType_ = LargeTickLabelType.year;
if (timeLength.Days < daysInMonth * (12 * 6))
+ {
monthSpacing = 12;
+ }
else if (timeLength.Days < daysInMonth * (12 * 12))
+ {
monthSpacing = 24;
+ }
else if (timeLength.Days < daysInMonth * (12 * 30))
+ {
monthSpacing = 60;
+ }
else
+ {
monthSpacing = 120;
+ }
//LargeTickLabelType_ = LargeTickLabelType.none;
}
@@ -675,7 +705,5 @@
}
}
private TimeSpan largeTickStep_ = TimeSpan.Zero;
-
-
}
}
Modified: trunk/src/FilledRegion.cs
===================================================================
--- trunk/src/FilledRegion.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/FilledRegion.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -116,11 +116,9 @@
}
else if (lp1_ != null && lp2_ != null)
{
-
SequenceAdapter a1 = new SequenceAdapter(lp1_.DataSource, lp1_.DataMember, lp1_.OrdinateData, lp1_.AbscissaData);
SequenceAdapter a2 = new SequenceAdapter(lp2_.DataSource, lp2_.DataMember, lp2_.OrdinateData, lp2_.AbscissaData);
-
int count = a1.Count + a2.Count;
PointF[] points = new PointF[count];
for (int i = 0; i < a1.Count; ++i)
@@ -179,5 +177,4 @@
private Brush brush_ = new SolidBrush( Color.GhostWhite );
private IRectangleBrush areaBrush_ = null;
}
-
}
Modified: trunk/src/Grid.cs
===================================================================
--- trunk/src/Grid.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/Grid.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -191,7 +191,6 @@
/// <param name="yAxis">The physical y axis to draw vertical lines parallel to.</param>
public void Draw( Graphics g, PhysicalAxis xAxis, PhysicalAxis yAxis )
{
-
ArrayList xLargePositions = null;
ArrayList yLargePositions = null;
ArrayList xSmallPositions = null;
@@ -209,7 +208,6 @@
DrawGridLines( g, yAxis, xAxis, yLargePositions, false, this.MajorGridPen );
}
-
if (this.horizontalGridType_ == GridType.Fine)
{
xAxis.Axis.WorldTickPositions_SecondPass( xAxis.PhysicalMin, xAxis.PhysicalMax, xLargePositions, ref xSmallPositions );
@@ -221,8 +219,6 @@
yAxis.Axis.WorldTickPositions_SecondPass( yAxis.PhysicalMin, yAxis.PhysicalMax, yLargePositions, ref ySmallPositions );
DrawGridLines( g, yAxis, xAxis, ySmallPositions, false, this.MinorGridPen );
}
-
}
-
}
-}
+}
\ No newline at end of file
Modified: trunk/src/HistogramPlot.cs
===================================================================
--- trunk/src/HistogramPlot.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/HistogramPlot.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -87,23 +87,29 @@
// (1) determine the top left hand point of the bar (assuming not centered)
PointD p1 = data[i];
- if ( double.IsNaN(p1.X) || double.IsNaN(p1.Y) )
- continue;
+ if (double.IsNaN(p1.X) || double.IsNaN(p1.Y))
+ {
+ continue;
+ }
// (2) determine the top right hand point of the bar (assuming not centered)
PointD p2;
if (i+1 != data.Count)
{
p2 = data[i+1];
- if ( double.IsNaN(p2.X) || double.IsNaN(p2.Y) )
- continue;
+ if (double.IsNaN(p2.X) || double.IsNaN(p2.Y))
+ {
+ continue;
+ }
p2.Y = p1.Y;
}
else if (i != 0)
{
p2 = data[i-1];
- if ( double.IsNaN(p2.X) || double.IsNaN(p2.Y) )
- continue;
+ if (double.IsNaN(p2.X) || double.IsNaN(p2.Y))
+ {
+ continue;
+ }
double offset = p1.X - p2.X;
p2.X = p1.X + offset;
p2.Y = p1.Y;
@@ -186,7 +192,6 @@
}
g.DrawRectangle( Pen, r.X, r.Y, r.Width, r.Height );
-
}
}
@@ -295,8 +300,7 @@
/// <returns>A suitable y-axis.</returns>
public Axis SuggestYAxis()
{
-
- if ( this.isStacked_ )
+ if (this.isStacked_)
{
double tmpMax = 0.0f;
ArrayList adapterList = new ArrayList();
@@ -433,14 +437,12 @@
/// <param name="startEnd">A rectangle specifying the bounds of the area in the legend set aside for drawing.</param>
public void DrawInLegend( Graphics g, Rectangle startEnd )
{
-
if (Filled)
{
g.FillRectangle( rectangleBrush_.Get(startEnd), startEnd );
}
g.DrawRectangle( Pen, startEnd.X, startEnd.Y, startEnd.Width, startEnd.Height );
-
}
@@ -499,7 +501,5 @@
}
}
private double baseOffset_;
-
-
}
}
Modified: trunk/src/HorizontalLine.cs
===================================================================
--- trunk/src/HorizontalLine.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/HorizontalLine.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -62,6 +62,7 @@
this.pen_ = new Pen( color );
}
+
/// <summary>
/// Constructor
/// </summary>
@@ -100,7 +101,6 @@
this.label_ = value;
}
}
-
private string label_ = "";
@@ -140,6 +140,7 @@
return new LinearAxis( this.value_, this.value_ );
}
+
/// <summary>
/// Writes text data describing the horizontal line object to the supplied string builder. It is
/// possible to specify that the data will be written only if the line is in the specified
@@ -150,7 +151,6 @@
/// <param name="onlyInRegion">If true, data will be written only if the line is in the specified region.</param>
public void WriteData(System.Text.StringBuilder sb, RectangleD region, bool onlyInRegion)
{
-
// return if line is not in plot region and
if (value_ > region.Y+region.Height || value_ < region.Y)
{
@@ -165,9 +165,9 @@
sb.Append( "\r\n" );
sb.Append( value_.ToString() );
sb.Append( "\r\n" );
-
}
+
/// <summary>
/// Draws the horizontal line plot on a GDI+ surface against the provided x and y axes.
/// </summary>
@@ -196,7 +196,7 @@
// todo: clip and proper logic for flipped axis min max.
}
- private double value_;
+
/// <summary>
/// ordinate (Y) value to draw horizontal line at.
/// </summary>
@@ -211,8 +211,9 @@
value_ = value;
}
}
+ private double value_;
- private Pen pen_ = new Pen( Color.Black );
+
/// <summary>
/// Pen to use to draw the horizontal line.
/// </summary>
@@ -227,6 +228,7 @@
pen_ = value;
}
}
+ private Pen pen_ = new Pen(Color.Black);
/// <summary>
@@ -262,6 +264,5 @@
}
}
private float scale_ = 1.0f;
-
}
}
Modified: trunk/src/IDrawable.cs
===================================================================
--- trunk/src/IDrawable.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/IDrawable.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -34,6 +34,7 @@
namespace NPlot
{
+
/// <summary>
/// Defines a Draw method for drawing objects against an x and y
/// Physical Axis.
Modified: trunk/src/IGradient.cs
===================================================================
--- trunk/src/IGradient.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/IGradient.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -48,6 +48,5 @@
/// <param name="prop">the number to get corresponding color for (between 0.0 and 1.0)</param>
/// <returns>The color corresponding to the supplied number.</returns>
Color GetColor( double prop );
-
}
}
Modified: trunk/src/IPlot.cs
===================================================================
--- trunk/src/IPlot.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/IPlot.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -79,6 +79,5 @@
/// <param name="region">Only write out data in this region if onlyInRegion is true.</param>
/// <param name="onlyInRegion">If true, only data in region is written, else all data is written.</param>
void WriteData( System.Text.StringBuilder sb, RectangleD region, bool onlyInRegion );
-
}
}
Modified: trunk/src/IPlotSurface2D.cs
===================================================================
--- trunk/src/IPlotSurface2D.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/IPlotSurface2D.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -231,6 +231,5 @@
/// <param name="p"></param>
void UpdateAxes( IPlot p );
*/
-
}
}
Modified: trunk/src/ISequencePlot.cs
===================================================================
--- trunk/src/ISequencePlot.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/ISequencePlot.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -59,7 +59,5 @@
/// Gets or sets the data, or column name for the ordinate [y] axis.
/// </summary>
object OrdinateData { get; set; }
-
}
-
}
Modified: trunk/src/ISurface.cs
===================================================================
--- trunk/src/ISurface.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/ISurface.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -72,7 +72,5 @@
/// </summary>
/// <param name="e">mouse event args</param>
void DoMouseDown( MouseEventArgs e );
-
}
-
}
Modified: trunk/src/ITransform2D.cs
===================================================================
--- trunk/src/ITransform2D.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/ITransform2D.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -52,7 +52,5 @@
/// Transforms the given world point to physical coordinates
/// </summary>
PointF Transform( PointD worldPoint );
-
}
-
}
Modified: trunk/src/ImagePlot.cs
===================================================================
--- trunk/src/ImagePlot.cs 2007-03-28 23:28:32 UTC (rev 28)
+++ trunk/src/ImagePlot.cs 2007-03-30 19:12:03 UTC (rev 29)
@@ -41,6 +41,7 @@
/// </summary>
public class ImagePlot : IPlot
{
+
private double[,] data_;
private double xStart_ = 0.0;
private double xStep_ = 1.0;
@@ -343,7 +344,5 @@
public void WriteData( System.Text.StringBuilder sb, Rectan...
[truncated message content] |