|
From: <jam...@us...> - 2007-01-24 23:02:36
|
Revision: 24
http://svn.sourceforge.net/nplot/?rev=24&view=rev
Author: jamcquay
Date: 2007-01-24 15:02:37 -0800 (Wed, 24 Jan 2007)
Log Message:
-----------
Fixed [SF patch 1639722]
There was a problem displaying a HistogramPlot when the displayed plot width is smaller than the length of the DataSource array. I made a fix by changing the brushes to take in RectangleF in addition to Rectangle.
Code fixed by: rshyffer
Signed off by: jamcquay
Modified Paths:
--------------
trunk/src/HistogramPlot.cs
trunk/src/RectangleBrushes.cs
Modified: trunk/src/HistogramPlot.cs
===================================================================
--- trunk/src/HistogramPlot.cs 2007-01-23 00:02:09 UTC (rev 23)
+++ trunk/src/HistogramPlot.cs 2007-01-24 23:02:37 UTC (rev 24)
@@ -174,8 +174,8 @@
}
float xoff = (1.0f - baseWidth_)/2.0f*width;
- Rectangle r = new Rectangle( (int)(xPos1.X+xoff), (int)yPos1.Y, (int)(width-2*xoff), (int)height );
-
+ RectangleF r = new RectangleF( xPos1.X+xoff, yPos1.Y, width-2*xoff, height );
+
if (this.Filled)
{
if (r.Height != 0 && r.Width != 0)
Modified: trunk/src/RectangleBrushes.cs
===================================================================
--- trunk/src/RectangleBrushes.cs 2007-01-23 00:02:09 UTC (rev 23)
+++ trunk/src/RectangleBrushes.cs 2007-01-24 23:02:37 UTC (rev 24)
@@ -48,6 +48,13 @@
/// <param name="rectangle">the rectangle used to construct the brush</param>
/// <returns>The brush</returns>
Brush Get( Rectangle rectangle );
+
+ /// <summary>
+ /// Gets a brush according to the supplied rectangle.
+ /// </summary>
+ /// <param name="rectangle">the rectangle used to construct the brush</param>
+ /// <returns>The brush</returns>
+ Brush Get(RectangleF rectangle);
}
/// <summary>
@@ -82,7 +89,12 @@
return brush_;
}
- #region Default Brushes
+ public Brush Get(RectangleF rectangle)
+ {
+ return brush_;
+ }
+
+ #region Default Brushes
/// <summary>
/// AliceBlue solid brush.
/// </summary>
@@ -1668,8 +1680,13 @@
return new LinearGradientBrush( rectangle, c1_, c2_, LinearGradientMode.Horizontal );
}
- #region DefaultBrushes
+ public Brush Get(RectangleF rectangle)
+ {
+ return new LinearGradientBrush(rectangle, c1_, c2_, LinearGradientMode.Horizontal);
+ }
+ #region DefaultBrushes
+
/// <summary>
/// Default brush - fades from faint blue to white.
/// </summary>
@@ -1737,8 +1754,12 @@
return new LinearGradientBrush( rectangle, c1_, c2_, LinearGradientMode.Vertical );
}
+ public Brush Get(RectangleF rectangle)
+ {
+ return new LinearGradientBrush(rectangle, c1_, c2_, LinearGradientMode.Vertical);
+ }
- #region DefaultBrushes
+ #region DefaultBrushes
/// <summary>
/// Default brush - fades from faint blue to white.
@@ -1813,8 +1834,20 @@
return brush;
}
- #region DefaultBrushes
+ public Brush Get(RectangleF rectangle)
+ {
+ LinearGradientBrush brush = new LinearGradientBrush(rectangle, c1_, c2_, LinearGradientMode.Horizontal);
+ float[] relativeIntensities = { 0.0f, 0.9f, 1.0f, 0.9f, 0.0f };
+ float[] relativePositions = { 0.0f, 0.4f, 0.5f, 0.6f, 1.0f };
+ Blend blend = new Blend();
+ blend.Factors = relativeIntensities;
+ blend.Positions = relativePositions;
+ brush.Blend = blend;
+ return brush;
+ }
+ #region DefaultBrushes
+
/// <summary>
/// Default brush - fades from faint blue to white.
/// </summary>
@@ -1889,8 +1922,20 @@
return brush;
}
- #region DefaultBrushes
+ public Brush Get(RectangleF rectangle)
+ {
+ LinearGradientBrush brush = new LinearGradientBrush(rectangle, c1_, c2_, LinearGradientMode.Vertical);
+ float[] relativeIntensities = { 0.0f, 0.9f, 1.0f, 0.9f, 0.0f };
+ float[] relativePositions = { 0.0f, 0.4f, 0.5f, 0.6f, 1.0f };
+ Blend blend = new Blend();
+ blend.Factors = relativeIntensities;
+ blend.Positions = relativePositions;
+ brush.Blend = blend;
+ return brush;
+ }
+ #region DefaultBrushes
+
/// <summary>
/// Default brush - fades from faint blue to white.
/// </summary>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|