You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@ -0,0 +1 @@
|
||||
57f8649f26ead43bade19c91b8a758e5f9566d65
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,471 @@
|
||||
//-------------------------------------------------------------
|
||||
// <copyright company=<3D>Microsoft Corporation<6F>>
|
||||
// Copyright <20> Microsoft Corporation. All Rights Reserved.
|
||||
// </copyright>
|
||||
//-------------------------------------------------------------
|
||||
// @owner=alexgor, deliant
|
||||
//=================================================================
|
||||
// File: ArrowAnnotation.cs
|
||||
//
|
||||
// Namespace: System.Web.UI.WebControls[Windows.Forms].Charting
|
||||
//
|
||||
// Classes: ArrowAnnotation
|
||||
//
|
||||
// Purpose: Arrow annotation classes.
|
||||
//
|
||||
// Reviewed:
|
||||
//
|
||||
//===================================================================
|
||||
|
||||
#region Used namespace
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing.Text;
|
||||
using System.Drawing.Drawing2D;
|
||||
#if Microsoft_CONTROL
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Data;
|
||||
using System.Windows.Forms.DataVisualization.Charting.ChartTypes;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Utilities;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Borders3D;
|
||||
|
||||
#else
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.DataVisualization.Charting;
|
||||
using System.Web.UI.DataVisualization.Charting.Data;
|
||||
using System.Web.UI.DataVisualization.Charting.Utilities;
|
||||
using System.Web.UI.DataVisualization.Charting.Borders3D;
|
||||
#endif
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#if Microsoft_CONTROL
|
||||
namespace System.Windows.Forms.DataVisualization.Charting
|
||||
|
||||
#else
|
||||
namespace System.Web.UI.DataVisualization.Charting
|
||||
|
||||
#endif
|
||||
{
|
||||
#region Enumeration
|
||||
|
||||
/// <summary>
|
||||
/// Arrow annotation styles.
|
||||
/// <seealso cref="ArrowAnnotation.ArrowStyle"/>
|
||||
/// </summary>
|
||||
[
|
||||
SRDescription("DescriptionAttributeArrowStyle_ArrowStyle")
|
||||
]
|
||||
public enum ArrowStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple arrow.
|
||||
/// </summary>
|
||||
Simple,
|
||||
|
||||
/// <summary>
|
||||
/// Arrow pointing in two directions.
|
||||
/// </summary>
|
||||
DoubleArrow,
|
||||
|
||||
/// <summary>
|
||||
/// Arrow with a tail.
|
||||
/// </summary>
|
||||
Tailed,
|
||||
}
|
||||
|
||||
#endregion // Enumeration
|
||||
|
||||
/// <summary>
|
||||
/// <b>ArrowAnnotation</b> is a class class that represents an arrow annotation.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Arrow annotations can be used to connect to points on the chart or highlight a
|
||||
/// single chart area. Different arrow styles and sizes may be applied.
|
||||
/// </remarks>
|
||||
[
|
||||
SRDescription("DescriptionAttributeArrowAnnotation_ArrowAnnotation"),
|
||||
]
|
||||
#if ASPPERM_35
|
||||
[AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
|
||||
[AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
|
||||
#endif
|
||||
public class ArrowAnnotation : Annotation
|
||||
{
|
||||
#region Fields
|
||||
|
||||
// Annotation arrow style
|
||||
private ArrowStyle _arrowStyle = ArrowStyle.Simple;
|
||||
|
||||
// Annotation arrow size
|
||||
private int _arrowSize = 5;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Construction and Initialization
|
||||
|
||||
/// <summary>
|
||||
/// Default public constructor.
|
||||
/// </summary>
|
||||
public ArrowAnnotation()
|
||||
: base()
|
||||
{
|
||||
base.AnchorAlignment = ContentAlignment.TopLeft;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
#region Arrow properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the arrow style of an arrow annotation.
|
||||
/// <seealso cref="ArrowSize"/>
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <see cref="ArrowStyle"/> of an annotation.
|
||||
/// </value>
|
||||
[
|
||||
SRCategory("CategoryAttributeAppearance"),
|
||||
Bindable(true),
|
||||
DefaultValue(ArrowStyle.Simple),
|
||||
SRDescription("DescriptionAttributeArrowAnnotation_ArrowStyle"),
|
||||
ParenthesizePropertyNameAttribute(true),
|
||||
]
|
||||
virtual public ArrowStyle ArrowStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return _arrowStyle;
|
||||
}
|
||||
set
|
||||
{
|
||||
_arrowStyle = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the arrow size in pixels of an arrow annotation.
|
||||
/// <seealso cref="ArrowStyle"/>
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// Integer value that represents arrow size (thickness) in pixels.
|
||||
/// </value>
|
||||
[
|
||||
SRCategory("CategoryAttributeAppearance"),
|
||||
Bindable(true),
|
||||
DefaultValue(5),
|
||||
SRDescription("DescriptionAttributeArrowAnnotation_ArrowSize"),
|
||||
ParenthesizePropertyNameAttribute(true),
|
||||
]
|
||||
virtual public int ArrowSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return _arrowSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(value <= 0)
|
||||
{
|
||||
throw(new ArgumentOutOfRangeException("value", SR.ExceptionAnnotationArrowSizeIsZero));
|
||||
}
|
||||
if(value > 100)
|
||||
{
|
||||
throw (new ArgumentOutOfRangeException("value", SR.ExceptionAnnotationArrowSizeMustBeLessThen100));
|
||||
}
|
||||
_arrowSize = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion // Arrow properties
|
||||
|
||||
#region Anchor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an annotation position's alignment to the anchor point.
|
||||
/// <seealso cref="Annotation.AnchorX"/>
|
||||
/// <seealso cref="Annotation.AnchorY"/>
|
||||
/// <seealso cref="Annotation.AnchorDataPoint"/>
|
||||
/// <seealso cref="Annotation.AnchorOffsetX"/>
|
||||
/// <seealso cref="Annotation.AnchorOffsetY"/>
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// A <see cref="ContentAlignment"/> value that represents the annotation's alignment to
|
||||
/// the anchor point.
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// The annotation must be anchored using either <see cref="Annotation.AnchorDataPoint"/>, or the <see cref="Annotation.AnchorX"/>
|
||||
/// and <see cref="Annotation.AnchorY"/> properties. Its <see cref="Annotation.X"/> and <see cref="Annotation.Y"/>
|
||||
/// properties must be set to <b>Double.NaN</b>.
|
||||
/// </remarks>
|
||||
[
|
||||
SRCategory("CategoryAttributeAnchor"),
|
||||
Browsable(false),
|
||||
EditorBrowsableAttribute(EditorBrowsableState.Never),
|
||||
DefaultValue(typeof(ContentAlignment), "TopLeft"),
|
||||
SRDescription("DescriptionAttributeAnchorAlignment"),
|
||||
]
|
||||
override public ContentAlignment AnchorAlignment
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.AnchorAlignment;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.AnchorAlignment = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Anchoring
|
||||
|
||||
#region Other
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an annotation's type name.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This property is used to get the name of each annotation type
|
||||
/// (e.g. Line, Rectangle, Ellipse).
|
||||
/// <para>
|
||||
/// This property is for internal use and is hidden at design and run time.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[
|
||||
SRCategory("CategoryAttributeMisc"),
|
||||
Bindable(true),
|
||||
Browsable(false),
|
||||
EditorBrowsableAttribute(EditorBrowsableState.Never),
|
||||
DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden),
|
||||
SerializationVisibilityAttribute(SerializationVisibility.Hidden),
|
||||
SRDescription("DescriptionAttributeAnnotationType"),
|
||||
]
|
||||
public override string AnnotationType
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Arrow";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets annotation selection points style.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// A <see cref="SelectionPointsStyle"/> value that represents annotation
|
||||
/// selection style.
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// This property is for internal use and is hidden at design and run time.
|
||||
/// </remarks>
|
||||
[
|
||||
SRCategory("CategoryAttributeAppearance"),
|
||||
DefaultValue(SelectionPointsStyle.Rectangle),
|
||||
ParenthesizePropertyNameAttribute(true),
|
||||
Browsable(false),
|
||||
EditorBrowsableAttribute(EditorBrowsableState.Never),
|
||||
DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden),
|
||||
SerializationVisibilityAttribute(SerializationVisibility.Hidden),
|
||||
SRDescription("DescriptionAttributeSelectionPointsStyle"),
|
||||
]
|
||||
override internal SelectionPointsStyle SelectionPointsStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelectionPointsStyle.TwoPoints;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Paints annotation object on specified graphics.
|
||||
/// </summary>
|
||||
/// <param name="graphics">
|
||||
/// A <see cref="ChartGraphics"/> used to paint annotation object.
|
||||
/// </param>
|
||||
/// <param name="chart">
|
||||
/// Reference to the <see cref="Chart"/> control.
|
||||
/// </param>
|
||||
override internal void Paint(Chart chart, ChartGraphics graphics)
|
||||
{
|
||||
// Get annotation position in relative coordinates
|
||||
PointF firstPoint = PointF.Empty;
|
||||
PointF anchorPoint = PointF.Empty;
|
||||
SizeF size = SizeF.Empty;
|
||||
GetRelativePosition(out firstPoint, out size, out anchorPoint);
|
||||
PointF secondPoint = new PointF(firstPoint.X + size.Width, firstPoint.Y + size.Height);
|
||||
|
||||
// Create selection rectangle
|
||||
RectangleF selectionRect = new RectangleF(firstPoint, new SizeF(secondPoint.X - firstPoint.X, secondPoint.Y - firstPoint.Y));
|
||||
|
||||
// Check if text position is valid
|
||||
if( float.IsNaN(firstPoint.X) ||
|
||||
float.IsNaN(firstPoint.Y) ||
|
||||
float.IsNaN(secondPoint.X) ||
|
||||
float.IsNaN(secondPoint.Y) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get arrow shape path
|
||||
using (GraphicsPath arrowPathAbs = GetArrowPath(graphics, selectionRect))
|
||||
{
|
||||
|
||||
// Draw arrow shape
|
||||
if (this.Common.ProcessModePaint)
|
||||
{
|
||||
graphics.DrawPathAbs(
|
||||
arrowPathAbs,
|
||||
(this.BackColor.IsEmpty) ? Color.White : this.BackColor,
|
||||
this.BackHatchStyle,
|
||||
String.Empty,
|
||||
ChartImageWrapMode.Scaled,
|
||||
Color.Empty,
|
||||
ChartImageAlignmentStyle.Center,
|
||||
this.BackGradientStyle,
|
||||
this.BackSecondaryColor,
|
||||
this.LineColor,
|
||||
this.LineWidth,
|
||||
this.LineDashStyle,
|
||||
PenAlignment.Center,
|
||||
this.ShadowOffset,
|
||||
this.ShadowColor);
|
||||
}
|
||||
|
||||
// Process hot region
|
||||
if (this.Common.ProcessModeRegions)
|
||||
{
|
||||
// Use callout defined hot region
|
||||
this.Common.HotRegionsList.AddHotRegion(
|
||||
graphics,
|
||||
arrowPathAbs,
|
||||
false,
|
||||
ReplaceKeywords(this.ToolTip),
|
||||
#if Microsoft_CONTROL
|
||||
String.Empty,
|
||||
String.Empty,
|
||||
String.Empty,
|
||||
#else // Microsoft_CONTROL
|
||||
ReplaceKeywords(this.Url),
|
||||
ReplaceKeywords(this.MapAreaAttributes),
|
||||
ReplaceKeywords(this.PostBackValue),
|
||||
#endif // Microsoft_CONTROL
|
||||
this,
|
||||
ChartElementType.Annotation);
|
||||
}
|
||||
|
||||
// Paint selection handles
|
||||
PaintSelectionHandles(graphics, selectionRect, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get arrow path for the specified annotation position
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
private GraphicsPath GetArrowPath(
|
||||
ChartGraphics graphics,
|
||||
RectangleF position)
|
||||
{
|
||||
// Get absolute position
|
||||
RectangleF positionAbs = graphics.GetAbsoluteRectangle(position);
|
||||
PointF firstPoint = positionAbs.Location;
|
||||
PointF secondPoint = new PointF(positionAbs.Right, positionAbs.Bottom);
|
||||
|
||||
// Calculate arrow length
|
||||
float deltaX = secondPoint.X - firstPoint.X;
|
||||
float deltaY = secondPoint.Y - firstPoint.Y;
|
||||
float arrowLength = (float)Math.Sqrt(deltaX * deltaX + deltaY * deltaY);
|
||||
|
||||
// Create unrotated graphics path for the arrow started at the annotation location
|
||||
// and going to the right for the length of the rotated arrow.
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
PointF[] points = null;
|
||||
float pointerRatio = 2.1f;
|
||||
if(this.ArrowStyle == ArrowStyle.Simple)
|
||||
{
|
||||
points = new PointF[] {
|
||||
firstPoint,
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y - this.ArrowSize*pointerRatio),
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y - this.ArrowSize),
|
||||
new PointF(firstPoint.X + arrowLength, firstPoint.Y - this.ArrowSize),
|
||||
new PointF(firstPoint.X + arrowLength, firstPoint.Y + this.ArrowSize),
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y + this.ArrowSize),
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y + this.ArrowSize*pointerRatio) };
|
||||
}
|
||||
else if(this.ArrowStyle == ArrowStyle.DoubleArrow)
|
||||
{
|
||||
points = new PointF[] {
|
||||
firstPoint,
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y - this.ArrowSize*pointerRatio),
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y - this.ArrowSize),
|
||||
new PointF(firstPoint.X + arrowLength - this.ArrowSize*pointerRatio, firstPoint.Y - this.ArrowSize),
|
||||
new PointF(firstPoint.X + arrowLength - this.ArrowSize*pointerRatio, firstPoint.Y - this.ArrowSize*pointerRatio),
|
||||
new PointF(firstPoint.X + arrowLength, firstPoint.Y),
|
||||
new PointF(firstPoint.X + arrowLength - this.ArrowSize*pointerRatio, firstPoint.Y + this.ArrowSize*pointerRatio),
|
||||
new PointF(firstPoint.X + arrowLength - this.ArrowSize*pointerRatio, firstPoint.Y + this.ArrowSize),
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y + this.ArrowSize),
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y + this.ArrowSize*pointerRatio) };
|
||||
}
|
||||
else if(this.ArrowStyle == ArrowStyle.Tailed)
|
||||
{
|
||||
float tailRatio = 2.1f;
|
||||
points = new PointF[] {
|
||||
firstPoint,
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y - this.ArrowSize*pointerRatio),
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y - this.ArrowSize),
|
||||
new PointF(firstPoint.X + arrowLength, firstPoint.Y - this.ArrowSize*tailRatio),
|
||||
new PointF(firstPoint.X + arrowLength - this.ArrowSize*tailRatio, firstPoint.Y),
|
||||
new PointF(firstPoint.X + arrowLength, firstPoint.Y + this.ArrowSize*tailRatio),
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y + this.ArrowSize),
|
||||
new PointF(firstPoint.X + this.ArrowSize*pointerRatio, firstPoint.Y + this.ArrowSize*pointerRatio) };
|
||||
}
|
||||
else
|
||||
{
|
||||
throw (new InvalidOperationException(SR.ExceptionAnnotationArrowStyleUnknown));
|
||||
}
|
||||
|
||||
path.AddLines(points);
|
||||
path.CloseAllFigures();
|
||||
|
||||
// Calculate arrow angle
|
||||
float angle = (float)(Math.Atan(deltaY / deltaX) * 180f / Math.PI);
|
||||
if(deltaX < 0)
|
||||
{
|
||||
angle += 180f;
|
||||
}
|
||||
|
||||
// Rotate arrow path around the first point
|
||||
using( Matrix matrix = new Matrix() )
|
||||
{
|
||||
matrix.RotateAt(angle, firstPoint);
|
||||
path.Transform(matrix);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,268 @@
|
||||
//-------------------------------------------------------------
|
||||
// <copyright company=<3D>Microsoft Corporation<6F>>
|
||||
// Copyright <20> Microsoft Corporation. All Rights Reserved.
|
||||
// </copyright>
|
||||
//-------------------------------------------------------------
|
||||
// @owner=alexgor, deliant
|
||||
//=================================================================
|
||||
// File: EmbossBorder.cs
|
||||
//
|
||||
// Namespace: System.Web.UI.WebControls[Windows.Forms].Charting.Borders3D
|
||||
//
|
||||
// Classes: EmbossBorder
|
||||
//
|
||||
// Purpose: Class that implements Emboss 3D border style.
|
||||
//
|
||||
// Reviewed: AG - August 7, 2002
|
||||
//
|
||||
//===================================================================
|
||||
|
||||
#region Used namespaces
|
||||
|
||||
using System;
|
||||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel.Design;
|
||||
|
||||
#if Microsoft_CONTROL
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Data;
|
||||
using System.Windows.Forms.DataVisualization.Charting.ChartTypes;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Utilities;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Borders3D;
|
||||
|
||||
#else
|
||||
using System.Web.UI.DataVisualization.Charting; using System.Web.UI.DataVisualization.Charting.Data;
|
||||
using System.Web.UI.DataVisualization.Charting.Utilities;
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
#if Microsoft_CONTROL
|
||||
namespace System.Windows.Forms.DataVisualization.Charting.Borders3D
|
||||
#else
|
||||
namespace System.Web.UI.DataVisualization.Charting.Borders3D
|
||||
#endif
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Implements emboss 3D border.
|
||||
/// </summary>
|
||||
internal class EmbossBorder : IBorderType
|
||||
{
|
||||
#region Border properties and methods
|
||||
|
||||
/// <summary>
|
||||
/// Default border radius size (relative)
|
||||
/// </summary>
|
||||
public float defaultRadiusSize = 15f;
|
||||
|
||||
public float resolution = 96f;
|
||||
|
||||
/// <summary>
|
||||
/// Array of corner radius
|
||||
/// </summary>
|
||||
internal float[] cornerRadius = { 15f, 15f, 15f, 15f, 15f, 15f, 15f, 15f };
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor
|
||||
/// </summary>
|
||||
public EmbossBorder()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chart type name
|
||||
/// </summary>
|
||||
public virtual string Name { get{ return "Emboss";}}
|
||||
|
||||
|
||||
public virtual float Resolution
|
||||
{
|
||||
set
|
||||
{
|
||||
resolution = value;
|
||||
float radius = 15f * value / 96.0f;
|
||||
defaultRadiusSize = radius;
|
||||
cornerRadius = new float[] { radius, radius, radius, radius, radius, radius, radius, radius };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the position of the rectangular area in the border where
|
||||
/// title should be displayed. Returns empty rect if title can't be shown in the border.
|
||||
/// </summary>
|
||||
/// <returns>Title position in border.</returns>
|
||||
public virtual RectangleF GetTitlePositionInBorder()
|
||||
{
|
||||
return RectangleF.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adjust areas rectangle coordinate to fit the 3D border.
|
||||
/// </summary>
|
||||
/// <param name="graph">Graphics to draw the border on.</param>
|
||||
/// <param name="areasRect">Position to adjust.</param>
|
||||
public virtual void AdjustAreasPosition(ChartGraphics graph, ref RectangleF areasRect)
|
||||
{
|
||||
SizeF borderSize = new SizeF(defaultRadiusSize/2f, defaultRadiusSize/2f);
|
||||
borderSize = graph.GetRelativeSize(borderSize);
|
||||
|
||||
// Do not do anything if rectangle is too small
|
||||
if(borderSize.Width < 30f)
|
||||
{
|
||||
areasRect.X += borderSize.Width;
|
||||
areasRect.Width -= (float)Math.Min(areasRect.Width, borderSize.Width * 2.5f);
|
||||
}
|
||||
|
||||
if(borderSize.Height < 30f)
|
||||
{
|
||||
areasRect.Y += borderSize.Height;
|
||||
areasRect.Height -= (float)Math.Min(areasRect.Height, borderSize.Height * 2.5f);
|
||||
}
|
||||
|
||||
if(areasRect.X + areasRect.Width > 100f)
|
||||
{
|
||||
areasRect.X -= 100f - areasRect.Width;
|
||||
}
|
||||
if(areasRect.Y + areasRect.Height > 100f)
|
||||
{
|
||||
areasRect.Y -= 100f - areasRect.Height;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws 3D border.
|
||||
/// </summary>
|
||||
/// <param name="graph">Graphics to draw the border on.</param>
|
||||
/// <param name="borderSkin">Border skin object.</param>
|
||||
/// <param name="rect">Rectangle of the border.</param>
|
||||
/// <param name="backColor">Color of rectangle</param>
|
||||
/// <param name="backHatchStyle">Hatch style</param>
|
||||
/// <param name="backImage">Back Image</param>
|
||||
/// <param name="backImageWrapMode">Image mode</param>
|
||||
/// <param name="backImageTransparentColor">Image transparent color.</param>
|
||||
/// <param name="backImageAlign">Image alignment</param>
|
||||
/// <param name="backGradientStyle">Gradient type</param>
|
||||
/// <param name="backSecondaryColor">Gradient End Color</param>
|
||||
/// <param name="borderColor">Border Color</param>
|
||||
/// <param name="borderWidth">Border Width</param>
|
||||
/// <param name="borderDashStyle">Border Style</param>
|
||||
public virtual void DrawBorder(
|
||||
ChartGraphics graph,
|
||||
BorderSkin borderSkin,
|
||||
RectangleF rect,
|
||||
Color backColor,
|
||||
ChartHatchStyle backHatchStyle,
|
||||
string backImage,
|
||||
ChartImageWrapMode backImageWrapMode,
|
||||
Color backImageTransparentColor,
|
||||
ChartImageAlignmentStyle backImageAlign,
|
||||
GradientStyle backGradientStyle,
|
||||
Color backSecondaryColor,
|
||||
Color borderColor,
|
||||
int borderWidth,
|
||||
ChartDashStyle borderDashStyle)
|
||||
{
|
||||
RectangleF absolute = graph.Round( rect );
|
||||
RectangleF shadowRect = absolute;
|
||||
|
||||
// Calculate shadow colors (0.2 - 0.6)
|
||||
float colorDarkeningIndex = 0.2f + (0.4f * (borderSkin.PageColor.R + borderSkin.PageColor.G + borderSkin.PageColor.B) / 765f);
|
||||
Color shadowColor = Color.FromArgb(
|
||||
(int)(borderSkin.PageColor.R*colorDarkeningIndex),
|
||||
(int)(borderSkin.PageColor.G*colorDarkeningIndex),
|
||||
(int)(borderSkin.PageColor.B*colorDarkeningIndex));
|
||||
if(borderSkin.PageColor == Color.Transparent)
|
||||
{
|
||||
shadowColor = Color.FromArgb(60, 0, 0, 0);
|
||||
}
|
||||
|
||||
colorDarkeningIndex += 0.2f;
|
||||
Color shadowLightColor = Color.FromArgb(
|
||||
(int)(borderSkin.PageColor.R*colorDarkeningIndex),
|
||||
(int)(borderSkin.PageColor.G*colorDarkeningIndex),
|
||||
(int)(borderSkin.PageColor.B*colorDarkeningIndex));
|
||||
|
||||
// Calculate rounded rect radius
|
||||
float radius = defaultRadiusSize;
|
||||
radius = (float)Math.Max(radius, 2f * resolution / 96.0f);
|
||||
radius = (float)Math.Min(radius, rect.Width/2f);
|
||||
radius = (float)Math.Min(radius, rect.Height/2f);
|
||||
radius = (float)Math.Ceiling(radius);
|
||||
|
||||
// Fill page background color
|
||||
using (Brush brush = new SolidBrush(borderSkin.PageColor))
|
||||
{
|
||||
graph.FillRectangle(brush, rect);
|
||||
}
|
||||
|
||||
// Top/Left shadow
|
||||
shadowRect = absolute;
|
||||
shadowRect.Width -= radius * .3f;
|
||||
shadowRect.Height -= radius * .3f;
|
||||
graph.DrawRoundedRectShadowAbs(shadowRect, cornerRadius, radius + 1 * resolution / 96.0f, shadowLightColor, borderSkin.PageColor, 1.4f);
|
||||
|
||||
// Bottom/Right shadow
|
||||
shadowRect = absolute;
|
||||
shadowRect.X = absolute.X + radius / 3f;
|
||||
shadowRect.Y = absolute.Y + radius / 3f;
|
||||
shadowRect.Width -= radius / 3.5f;
|
||||
shadowRect.Height -= radius / 3.5f;
|
||||
graph.DrawRoundedRectShadowAbs(shadowRect, cornerRadius, radius, shadowColor, borderSkin.PageColor, 1.3f);
|
||||
|
||||
// Draw Background
|
||||
shadowRect = absolute;
|
||||
shadowRect.X = absolute.X + 3f * resolution / 96.0f;
|
||||
shadowRect.Y = absolute.Y + 3f * resolution / 96.0f;
|
||||
shadowRect.Width -= radius * .75f;
|
||||
shadowRect.Height -= radius * .75f;
|
||||
GraphicsPath path = graph.CreateRoundedRectPath(shadowRect, cornerRadius);
|
||||
graph.DrawPathAbs(
|
||||
path,
|
||||
backColor,
|
||||
backHatchStyle,
|
||||
backImage,
|
||||
backImageWrapMode,
|
||||
backImageTransparentColor,
|
||||
backImageAlign,
|
||||
backGradientStyle,
|
||||
backSecondaryColor,
|
||||
borderColor,
|
||||
borderWidth,
|
||||
borderDashStyle,
|
||||
PenAlignment.Inset );
|
||||
|
||||
// Dispose Graphic path
|
||||
if( path != null )
|
||||
path.Dispose();
|
||||
|
||||
// Bottom/Right inner shadow
|
||||
Region innerShadowRegion = new Region(
|
||||
graph.CreateRoundedRectPath(
|
||||
new RectangleF(
|
||||
shadowRect.X - radius,
|
||||
shadowRect.Y - radius,
|
||||
shadowRect.Width + radius - radius*0.25f,
|
||||
shadowRect.Height + radius - radius*0.25f),
|
||||
cornerRadius));
|
||||
innerShadowRegion.Complement(graph.CreateRoundedRectPath(shadowRect, cornerRadius));
|
||||
graph.Clip = innerShadowRegion;
|
||||
graph.DrawRoundedRectShadowAbs(
|
||||
shadowRect,
|
||||
cornerRadius,
|
||||
radius,
|
||||
Color.Transparent,
|
||||
Color.FromArgb(128, Color.Gray),
|
||||
.5f);
|
||||
graph.Clip = new Region();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,497 @@
|
||||
//-------------------------------------------------------------
|
||||
// <copyright company=<3D>Microsoft Corporation<6F>>
|
||||
// Copyright <20> Microsoft Corporation. All Rights Reserved.
|
||||
// </copyright>
|
||||
//-------------------------------------------------------------
|
||||
// @owner=alexgor, deliant
|
||||
//=================================================================
|
||||
// File: BubbleChart.cs
|
||||
//
|
||||
// Namespace: DataVisualization.Charting.ChartTypes
|
||||
//
|
||||
// Classes: BubbleChart
|
||||
//
|
||||
// Purpose: Bubble chart type is similar to the Point chart
|
||||
// where each data point is presented with a marker
|
||||
// positioned using X and Y values. The difference
|
||||
// of the Bubble chart is that an additional Y value
|
||||
// is used to control the size of the marker.
|
||||
//
|
||||
// Reviewed: AG - August 6, 2002
|
||||
// AG - Microsoft 6, 2007
|
||||
//
|
||||
//===================================================================
|
||||
|
||||
#region Used namespaces
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
|
||||
#if Microsoft_CONTROL
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Data;
|
||||
using System.Windows.Forms.DataVisualization.Charting.ChartTypes;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Utilities;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Borders3D;
|
||||
|
||||
#else
|
||||
using System.Web.UI.DataVisualization.Charting;
|
||||
using System.Web.UI.DataVisualization.Charting.Data;
|
||||
using System.Web.UI.DataVisualization.Charting.ChartTypes;
|
||||
using System.Web.UI.DataVisualization.Charting.Utilities;
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
#if Microsoft_CONTROL
|
||||
namespace System.Windows.Forms.DataVisualization.Charting.ChartTypes
|
||||
#else
|
||||
namespace System.Web.UI.DataVisualization.Charting.ChartTypes
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// BubbleChart class extends PointChart class to add support for
|
||||
/// additional Y value which controls the size of the markers used.
|
||||
/// </summary>
|
||||
internal class BubbleChart : PointChart
|
||||
{
|
||||
#region Fields and Constructor
|
||||
|
||||
// Indicates that bubble size scale is calculated
|
||||
private bool _scaleDetected = false;
|
||||
|
||||
// Minimum/Maximum bubble size
|
||||
private double _maxPossibleBubbleSize = 15F;
|
||||
private double _minPossibleBubbleSize = 3F;
|
||||
private float _maxBubleSize = 0f;
|
||||
private float _minBubleSize = 0f;
|
||||
|
||||
// Current min/max size of the bubble size
|
||||
private double _minAll = double.MaxValue;
|
||||
private double _maxAll = double.MinValue;
|
||||
|
||||
|
||||
// Bubble size difference value
|
||||
private double _valueDiff = 0;
|
||||
private double _valueScale = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Class public constructor
|
||||
/// </summary>
|
||||
public BubbleChart() : base(true)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IChartType interface implementation
|
||||
|
||||
/// <summary>
|
||||
/// Chart type name
|
||||
/// </summary>
|
||||
override public string Name { get{ return ChartTypeNames.Bubble;}}
|
||||
|
||||
/// <summary>
|
||||
/// Number of supported Y value(s) per point
|
||||
/// </summary>
|
||||
override public int YValuesPerPoint { get { return 2; } }
|
||||
|
||||
/// <summary>
|
||||
/// Chart type with two y values used for scale ( bubble chart type )
|
||||
/// </summary>
|
||||
override public bool SecondYScale{ get{ return true;} }
|
||||
|
||||
/// <summary>
|
||||
/// Gets chart type image.
|
||||
/// </summary>
|
||||
/// <param name="registry">Chart types registry object.</param>
|
||||
/// <returns>Chart type image.</returns>
|
||||
override public System.Drawing.Image GetImage(ChartTypeRegistry registry)
|
||||
{
|
||||
return (System.Drawing.Image)registry.ResourceManager.GetObject(this.Name + "ChartType");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bubble chart methods
|
||||
|
||||
/// <summary>
|
||||
/// This method recalculates size of the bars. This method is used
|
||||
/// from Paint or Select method.
|
||||
/// </summary>
|
||||
/// <param name="selection">If True selection mode is active, otherwise paint mode is active</param>
|
||||
/// <param name="graph">The Chart Graphics object</param>
|
||||
/// <param name="common">The Common elements object</param>
|
||||
/// <param name="area">Chart area for this chart</param>
|
||||
/// <param name="seriesToDraw">Chart series to draw.</param>
|
||||
override protected void ProcessChartType(
|
||||
bool selection,
|
||||
ChartGraphics graph,
|
||||
CommonElements common,
|
||||
ChartArea area,
|
||||
Series seriesToDraw )
|
||||
{
|
||||
_scaleDetected = false;
|
||||
base.ProcessChartType(selection, graph, common, area, seriesToDraw );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets marker border size.
|
||||
/// </summary>
|
||||
/// <param name="point">Data point.</param>
|
||||
/// <returns>Marker border size.</returns>
|
||||
override protected int GetMarkerBorderSize(DataPointCustomProperties point)
|
||||
{
|
||||
if(point.series != null)
|
||||
{
|
||||
return point.series.BorderWidth;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns marker size.
|
||||
/// </summary>
|
||||
/// <param name="graph">The Chart Graphics object.</param>
|
||||
/// <param name="common">The Common elements object.</param>
|
||||
/// <param name="area">Chart area for this chart.</param>
|
||||
/// <param name="point">Data point.</param>
|
||||
/// <param name="markerSize">Marker size.</param>
|
||||
/// <param name="markerImage">Marker image.</param>
|
||||
/// <returns>Marker width and height.</returns>
|
||||
override protected SizeF GetMarkerSize(
|
||||
ChartGraphics graph,
|
||||
CommonElements common,
|
||||
ChartArea area,
|
||||
DataPoint point,
|
||||
int markerSize,
|
||||
string markerImage)
|
||||
{
|
||||
// Check required Y values number
|
||||
if(point.YValues.Length < this.YValuesPerPoint)
|
||||
{
|
||||
throw(new InvalidOperationException(SR.ExceptionChartTypeRequiresYValues(this.Name, this.YValuesPerPoint.ToString(CultureInfo.InvariantCulture))));
|
||||
}
|
||||
|
||||
// Marker size
|
||||
SizeF size = new SizeF(markerSize, markerSize);
|
||||
if (graph != null && graph.Graphics != null)
|
||||
{
|
||||
// Marker size is in pixels and we do the mapping for higher DPIs
|
||||
size.Width = markerSize * graph.Graphics.DpiX / 96;
|
||||
size.Height = markerSize * graph.Graphics.DpiY / 96;
|
||||
}
|
||||
|
||||
// Check number of Y values for non empty points
|
||||
if(point.series.YValuesPerPoint > 1 && !point.IsEmpty)
|
||||
{
|
||||
// Scale Y values
|
||||
size.Width = ScaleBubbleSize(graph, common, area, point.YValues[1]);
|
||||
size.Height = ScaleBubbleSize(graph, common, area, point.YValues[1]);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scales the value used to determine the size of the Bubble.
|
||||
/// </summary>
|
||||
/// <param name="graph">The Chart Graphics object</param>
|
||||
/// <param name="common">The Common elements object</param>
|
||||
/// <param name="area">Chart area for this chart</param>
|
||||
/// <param name="value">Value to scale.</param>
|
||||
/// <returns>Scaled values.</returns>
|
||||
private float ScaleBubbleSize(ChartGraphics graph, CommonElements common, ChartArea area, double value)
|
||||
{
|
||||
// Check if scaling numbers are detected
|
||||
if(!_scaleDetected)
|
||||
{
|
||||
// Try to find bubble size scale in the custom series properties
|
||||
_minAll = double.MaxValue;
|
||||
_maxAll = double.MinValue;
|
||||
foreach( Series ser in common.DataManager.Series )
|
||||
{
|
||||
if( String.Compare( ser.ChartTypeName, this.Name, true, System.Globalization.CultureInfo.CurrentCulture) == 0 &&
|
||||
ser.ChartArea == area.Name &&
|
||||
ser.IsVisible())
|
||||
{
|
||||
// Check if custom properties are set to specify scale
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleScaleMin))
|
||||
{
|
||||
_minAll = Math.Min(_minAll, CommonElements.ParseDouble(ser[CustomPropertyName.BubbleScaleMin]));
|
||||
}
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleScaleMax))
|
||||
{
|
||||
_maxAll = Math.Max(_maxAll, CommonElements.ParseDouble(ser[CustomPropertyName.BubbleScaleMax]));
|
||||
}
|
||||
|
||||
// Check if attribute for max. size is set
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleMaxSize))
|
||||
{
|
||||
_maxPossibleBubbleSize = CommonElements.ParseDouble(ser[CustomPropertyName.BubbleMaxSize]);
|
||||
if(_maxPossibleBubbleSize < 0 || _maxPossibleBubbleSize > 100)
|
||||
{
|
||||
throw(new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize")));
|
||||
}
|
||||
}
|
||||
|
||||
// Check if attribute for min. size is set
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleMinSize))
|
||||
{
|
||||
_minPossibleBubbleSize = CommonElements.ParseDouble(ser[CustomPropertyName.BubbleMinSize]);
|
||||
if(_minPossibleBubbleSize < 0 || _minPossibleBubbleSize > 100)
|
||||
{
|
||||
throw(new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMinSize")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if custom properties set to use second Y value (bubble size) as label text
|
||||
labelYValueIndex = 0;
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleUseSizeForLabel))
|
||||
{
|
||||
if(String.Compare(ser[CustomPropertyName.BubbleUseSizeForLabel], "true", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
labelYValueIndex = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scale values are not specified - auto detect
|
||||
if(_minAll == double.MaxValue || _maxAll == double.MinValue)
|
||||
{
|
||||
double minSer = double.MaxValue;
|
||||
double maxSer = double.MinValue;
|
||||
foreach( Series ser in common.DataManager.Series )
|
||||
{
|
||||
if( ser.ChartTypeName == this.Name && ser.ChartArea == area.Name && ser.IsVisible() )
|
||||
{
|
||||
foreach(DataPoint point in ser.Points)
|
||||
{
|
||||
if (!point.IsEmpty)
|
||||
{
|
||||
// Check required Y values number
|
||||
if (point.YValues.Length < this.YValuesPerPoint)
|
||||
{
|
||||
throw (new InvalidOperationException(SR.ExceptionChartTypeRequiresYValues(this.Name, this.YValuesPerPoint.ToString(CultureInfo.InvariantCulture))));
|
||||
}
|
||||
|
||||
minSer = Math.Min(minSer, point.YValues[1]);
|
||||
maxSer = Math.Max(maxSer, point.YValues[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_minAll == double.MaxValue)
|
||||
{
|
||||
_minAll = minSer;
|
||||
}
|
||||
if(_maxAll == double.MinValue)
|
||||
{
|
||||
_maxAll = maxSer;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate maximum bubble size
|
||||
SizeF areaSize = graph.GetAbsoluteSize(area.PlotAreaPosition.Size);
|
||||
_maxBubleSize = (float)(Math.Min(areaSize.Width, areaSize.Height) / (100.0/_maxPossibleBubbleSize));
|
||||
_minBubleSize = (float)(Math.Min(areaSize.Width, areaSize.Height) / (100.0/_minPossibleBubbleSize));
|
||||
|
||||
// Calculate scaling variables depending on the Min/Max values
|
||||
if(_maxAll == _minAll)
|
||||
{
|
||||
this._valueScale = 1;
|
||||
this._valueDiff = _minAll - (_maxBubleSize - _minBubleSize)/2f;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._valueScale = (_maxBubleSize - _minBubleSize) / (_maxAll - _minAll);
|
||||
this._valueDiff = _minAll;
|
||||
}
|
||||
|
||||
_scaleDetected = true;
|
||||
}
|
||||
|
||||
// Check if value do not exceed Min&Max
|
||||
if(value > _maxAll)
|
||||
{
|
||||
return 0F;
|
||||
}
|
||||
if(value < _minAll)
|
||||
{
|
||||
return 0F;
|
||||
}
|
||||
|
||||
// Return scaled value
|
||||
return (float)((value - this._valueDiff) * this._valueScale) + _minBubleSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scales the value used to determine the size of the Bubble.
|
||||
/// </summary>
|
||||
/// <param name="common">The Common elements object</param>
|
||||
/// <param name="area">Chart area for this chart</param>
|
||||
/// <param name="value">Value to scale.</param>
|
||||
/// <param name="yValue">True if Y value is calculated, false if X.</param>
|
||||
/// <returns>Scaled values.</returns>
|
||||
static internal double AxisScaleBubbleSize(CommonElements common, ChartArea area, double value, bool yValue )
|
||||
{
|
||||
|
||||
// Try to find bubble size scale in the custom series properties
|
||||
double minAll = double.MaxValue;
|
||||
double maxAll = double.MinValue;
|
||||
double maxPossibleBubbleSize = 15F;
|
||||
double minPossibleBubbleSize = 3F;
|
||||
float maxBubleSize;
|
||||
float minBubleSize;
|
||||
double valueScale;
|
||||
double valueDiff;
|
||||
foreach( Series ser in common.DataManager.Series )
|
||||
{
|
||||
if( String.Compare( ser.ChartTypeName, ChartTypeNames.Bubble, StringComparison.OrdinalIgnoreCase) == 0 &&
|
||||
ser.ChartArea == area.Name &&
|
||||
ser.IsVisible())
|
||||
{
|
||||
// Check if custom properties are set to specify scale
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleScaleMin))
|
||||
{
|
||||
minAll = Math.Min(minAll, CommonElements.ParseDouble(ser[CustomPropertyName.BubbleScaleMin]));
|
||||
}
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleScaleMax))
|
||||
{
|
||||
maxAll = Math.Max(maxAll, CommonElements.ParseDouble(ser[CustomPropertyName.BubbleScaleMax]));
|
||||
}
|
||||
|
||||
// Check if attribute for max. size is set
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleMaxSize))
|
||||
{
|
||||
maxPossibleBubbleSize = CommonElements.ParseDouble(ser[CustomPropertyName.BubbleMaxSize]);
|
||||
if(maxPossibleBubbleSize < 0 || maxPossibleBubbleSize > 100)
|
||||
{
|
||||
throw(new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize")));
|
||||
}
|
||||
}
|
||||
|
||||
// Check if custom properties set to use second Y value (bubble size) as label text
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleUseSizeForLabel))
|
||||
{
|
||||
if(String.Compare(ser[CustomPropertyName.BubbleUseSizeForLabel], "true", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scale values are not specified - auto detect
|
||||
double minimum = double.MaxValue;
|
||||
double maximum = double.MinValue;
|
||||
double minSer = double.MaxValue;
|
||||
double maxSer = double.MinValue;
|
||||
foreach( Series ser in common.DataManager.Series )
|
||||
{
|
||||
if( String.Compare(ser.ChartTypeName, ChartTypeNames.Bubble, StringComparison.OrdinalIgnoreCase) == 0
|
||||
&& ser.ChartArea == area.Name
|
||||
&& ser.IsVisible() )
|
||||
{
|
||||
foreach(DataPoint point in ser.Points)
|
||||
{
|
||||
if (!point.IsEmpty)
|
||||
{
|
||||
minSer = Math.Min(minSer, point.YValues[1]);
|
||||
maxSer = Math.Max(maxSer, point.YValues[1]);
|
||||
|
||||
if (yValue)
|
||||
{
|
||||
minimum = Math.Min(minimum, point.YValues[0]);
|
||||
maximum = Math.Max(maximum, point.YValues[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
minimum = Math.Min(minimum, point.XValue);
|
||||
maximum = Math.Max(maximum, point.XValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(minAll == double.MaxValue)
|
||||
{
|
||||
minAll = minSer;
|
||||
}
|
||||
if(maxAll == double.MinValue)
|
||||
{
|
||||
maxAll = maxSer;
|
||||
}
|
||||
|
||||
// Calculate maximum bubble size
|
||||
maxBubleSize = (float)( (maximum - minimum) / (100.0/maxPossibleBubbleSize));
|
||||
minBubleSize = (float)( (maximum - minimum) / (100.0/minPossibleBubbleSize));
|
||||
|
||||
// Calculate scaling variables depending on the Min/Max values
|
||||
if(maxAll == minAll)
|
||||
{
|
||||
valueScale = 1;
|
||||
valueDiff = minAll - (maxBubleSize - minBubleSize)/2f;
|
||||
}
|
||||
else
|
||||
{
|
||||
valueScale = (maxBubleSize - minBubleSize) / (maxAll - minAll);
|
||||
valueDiff = minAll;
|
||||
}
|
||||
|
||||
|
||||
// Check if value do not exceed Min&Max
|
||||
if(value > maxAll)
|
||||
{
|
||||
return 0F;
|
||||
}
|
||||
if(value < minAll)
|
||||
{
|
||||
return 0F;
|
||||
}
|
||||
|
||||
// Return scaled value
|
||||
return (float)((value - valueDiff) * valueScale) + minBubleSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get value from custom attribute BubbleMaxSize
|
||||
/// </summary>
|
||||
/// <param name="area">Chart Area</param>
|
||||
/// <returns>Bubble Max size</returns>
|
||||
static internal double GetBubbleMaxSize( ChartArea area )
|
||||
{
|
||||
double maxPossibleBubbleSize = 15;
|
||||
// Try to find bubble size scale in the custom series properties
|
||||
foreach( Series ser in area.Common.DataManager.Series )
|
||||
{
|
||||
if( String.Compare( ser.ChartTypeName, ChartTypeNames.Bubble, StringComparison.OrdinalIgnoreCase) == 0 &&
|
||||
ser.ChartArea == area.Name &&
|
||||
ser.IsVisible())
|
||||
{
|
||||
// Check if attribute for max. size is set
|
||||
if(ser.IsCustomPropertySet(CustomPropertyName.BubbleMaxSize))
|
||||
{
|
||||
maxPossibleBubbleSize = CommonElements.ParseDouble(ser[CustomPropertyName.BubbleMaxSize]);
|
||||
if(maxPossibleBubbleSize < 0 || maxPossibleBubbleSize > 100)
|
||||
{
|
||||
throw(new ArgumentException(SR.ExceptionCustomAttributeIsNotInRange0to100("BubbleMaxSize")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return maxPossibleBubbleSize / 100;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,453 @@
|
||||
//-------------------------------------------------------------
|
||||
// <copyright company=<3D>Microsoft Corporation<6F>>
|
||||
// Copyright <20> Microsoft Corporation. All Rights Reserved.
|
||||
// </copyright>
|
||||
//-------------------------------------------------------------
|
||||
// @owner=alexgor, deliant
|
||||
//=================================================================
|
||||
// File: ChartTypeRegistry.cs
|
||||
//
|
||||
// Namespace: DataVisualization.Charting.ChartTypes
|
||||
//
|
||||
// Classes: ChartTypeRegistry, IChartType
|
||||
//
|
||||
// Purpose: ChartTypeRegistry is a repository for all standard
|
||||
// and custom chart types. Each chart type has unique
|
||||
// name and IChartType derived class which provides
|
||||
// behaviour information about the chart type and
|
||||
// also contains drwaing functionality.
|
||||
//
|
||||
// ChartTypeRegistry can be used by user for custom
|
||||
// chart type registering and can be retrieved using
|
||||
// Chart.GetService(typeof(ChartTypeRegistry)) method.
|
||||
//
|
||||
// Reviewed: AG - Aug 6, 2002
|
||||
// AG - Microsoft 6, 2007
|
||||
//
|
||||
//===================================================================
|
||||
|
||||
#region Used namespaces
|
||||
|
||||
using System;
|
||||
using System.Resources;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Reflection;
|
||||
using System.Drawing;
|
||||
|
||||
#if Microsoft_CONTROL
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Data;
|
||||
using System.Windows.Forms.DataVisualization.Charting.ChartTypes;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Utilities;
|
||||
using System.Windows.Forms.DataVisualization.Charting.Borders3D;
|
||||
|
||||
#else
|
||||
using System.Web.UI.DataVisualization.Charting;
|
||||
|
||||
using System.Web.UI.DataVisualization.Charting.Data;
|
||||
using System.Web.UI.DataVisualization.Charting.ChartTypes;
|
||||
using System.Web.UI.DataVisualization.Charting.Utilities;
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
#if Microsoft_CONTROL
|
||||
namespace System.Windows.Forms.DataVisualization.Charting.ChartTypes
|
||||
#else
|
||||
namespace System.Web.UI.DataVisualization.Charting.ChartTypes
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// ChartTypeName class contains constant strings defining
|
||||
/// names of all ChartTypes used in the Chart.
|
||||
/// </summary>
|
||||
internal static class ChartTypeNames
|
||||
{
|
||||
#region Chart type names
|
||||
|
||||
internal const string Area = "Area";
|
||||
internal const string RangeBar = "RangeBar";
|
||||
internal const string Bar = "Bar";
|
||||
internal const string SplineArea = "SplineArea";
|
||||
internal const string BoxPlot = "BoxPlot";
|
||||
internal const string Bubble = "Bubble";
|
||||
internal const string Column = "Column";
|
||||
internal const string RangeColumn = "RangeColumn";
|
||||
internal const string Doughnut = "Doughnut";
|
||||
internal const string ErrorBar = "ErrorBar";
|
||||
internal const string FastLine = "FastLine";
|
||||
internal const string FastPoint = "FastPoint";
|
||||
internal const string Funnel = "Funnel";
|
||||
internal const string Pyramid = "Pyramid";
|
||||
internal const string Kagi = "Kagi";
|
||||
internal const string Spline = "Spline";
|
||||
internal const string Line = "Line";
|
||||
internal const string PointAndFigure = "PointAndFigure";
|
||||
internal const string Pie = "Pie";
|
||||
internal const string Point = "Point";
|
||||
internal const string Polar = "Polar";
|
||||
internal const string Radar = "Radar";
|
||||
internal const string SplineRange = "SplineRange";
|
||||
internal const string Range = "Range";
|
||||
internal const string Renko = "Renko";
|
||||
internal const string OneHundredPercentStackedArea = "100%StackedArea";
|
||||
internal const string StackedArea = "StackedArea";
|
||||
internal const string OneHundredPercentStackedBar = "100%StackedBar";
|
||||
internal const string StackedBar = "StackedBar";
|
||||
internal const string OneHundredPercentStackedColumn = "100%StackedColumn";
|
||||
internal const string StackedColumn = "StackedColumn";
|
||||
internal const string StepLine = "StepLine";
|
||||
internal const string Candlestick = "Candlestick";
|
||||
internal const string Stock = "Stock";
|
||||
internal const string ThreeLineBreak = "ThreeLineBreak";
|
||||
|
||||
#endregion // Keyword Names
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ChartTypeRegistry class is a repository for all standard and custom
|
||||
/// chart types. In order for the chart control to display the chart
|
||||
/// type, it first must be registered using unique name and IChartType
|
||||
/// derived class which provides the description of the chart type and
|
||||
/// also responsible for all drawing and hit testing.
|
||||
///
|
||||
/// ChartTypeRegistry can be used by user for custom chart type registering
|
||||
/// and can be retrieved using Chart.GetService(typeof(ChartTypeRegistry))
|
||||
/// method.
|
||||
/// </summary>
|
||||
internal class ChartTypeRegistry : IServiceProvider, IDisposable
|
||||
{
|
||||
#region Fields
|
||||
|
||||
// Chart types image resource manager
|
||||
private ResourceManager _resourceManager = null;
|
||||
|
||||
// Storage for registered/created chart types
|
||||
internal Hashtable registeredChartTypes = new Hashtable(StringComparer.OrdinalIgnoreCase);
|
||||
private Hashtable _createdChartTypes = new Hashtable(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor and Services
|
||||
|
||||
/// <summary>
|
||||
/// Chart types registry public constructor.
|
||||
/// </summary>
|
||||
public ChartTypeRegistry()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns chart type registry service object.
|
||||
/// </summary>
|
||||
/// <param name="serviceType">Service type to get.</param>
|
||||
/// <returns>Chart type registry service.</returns>
|
||||
[EditorBrowsableAttribute(EditorBrowsableState.Never)]
|
||||
object IServiceProvider.GetService(Type serviceType)
|
||||
{
|
||||
if(serviceType == typeof(ChartTypeRegistry))
|
||||
{
|
||||
return this;
|
||||
}
|
||||
throw (new ArgumentException(SR.ExceptionChartTypeRegistryUnsupportedType( serviceType.ToString() ) ) );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Registry methods
|
||||
|
||||
/// <summary>
|
||||
/// Adds chart type into the registry.
|
||||
/// </summary>
|
||||
/// <param name="name">Chart type name.</param>
|
||||
/// <param name="chartType">Chart class type.</param>
|
||||
public void Register(string name, Type chartType)
|
||||
{
|
||||
// First check if chart type with specified name already registered
|
||||
if(registeredChartTypes.Contains(name))
|
||||
{
|
||||
// If same type provided - ignore
|
||||
if(registeredChartTypes[name].GetType() == chartType)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Error - throw exception
|
||||
throw( new ArgumentException( SR.ExceptionChartTypeNameIsNotUnique( name ) ) );
|
||||
}
|
||||
|
||||
// Make sure that specified class support IChartType interface
|
||||
bool found = false;
|
||||
Type[] interfaces = chartType.GetInterfaces();
|
||||
foreach(Type type in interfaces)
|
||||
{
|
||||
if(type == typeof(IChartType))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
throw (new ArgumentException(SR.ExceptionChartTypeHasNoInterface ));
|
||||
}
|
||||
|
||||
// Add chart type to the hash table
|
||||
registeredChartTypes[name] = chartType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns chart type object by name.
|
||||
/// </summary>
|
||||
/// <param name="chartType">Chart type.</param>
|
||||
/// <returns>Chart type object derived from IChartType.</returns>
|
||||
public IChartType GetChartType(SeriesChartType chartType)
|
||||
{
|
||||
return this.GetChartType(Series.GetChartTypeName(chartType));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns chart type object by name.
|
||||
/// </summary>
|
||||
/// <param name="name">Chart type name.</param>
|
||||
/// <returns>Chart type object derived from IChartType.</returns>
|
||||
public IChartType GetChartType(string name)
|
||||
{
|
||||
// First check if chart type with specified name registered
|
||||
if(!registeredChartTypes.Contains(name))
|
||||
{
|
||||
throw( new ArgumentException( SR.ExceptionChartTypeUnknown( name ) ) );
|
||||
}
|
||||
|
||||
// Check if the chart type object is already created
|
||||
if(!_createdChartTypes.Contains(name))
|
||||
{
|
||||
// Create chart type object
|
||||
_createdChartTypes[name] =
|
||||
((Type)registeredChartTypes[name]).Assembly.
|
||||
CreateInstance(((Type)registeredChartTypes[name]).ToString());
|
||||
}
|
||||
|
||||
return (IChartType)_createdChartTypes[name];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chart images resource manager.
|
||||
/// </summary>
|
||||
public ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
// Create chart images resource manager
|
||||
if(_resourceManager == null)
|
||||
{
|
||||
_resourceManager = new ResourceManager(typeof(Chart).Namespace + ".Design", Assembly.GetExecutingAssembly());
|
||||
}
|
||||
return _resourceManager;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
/// <summary>
|
||||
/// Releases unmanaged and - optionally - managed resources
|
||||
/// </summary>
|
||||
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
// Dispose managed resource
|
||||
foreach (string name in this._createdChartTypes.Keys)
|
||||
{
|
||||
IChartType chartType = (IChartType)_createdChartTypes[name];
|
||||
chartType.Dispose();
|
||||
}
|
||||
this._createdChartTypes.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IChartType interface must be implemented for any standard or custom
|
||||
/// chart type displayed in the chart control. This interface defines
|
||||
/// properties which provide information on chart type behaviour including
|
||||
/// how many Y values supported, is it a stacked chart type, how it
|
||||
/// interacts with axes and much more.
|
||||
///
|
||||
/// IChartType interface methods define how to draw series data point,
|
||||
/// calculate Y values and process SmartLabelStyle.
|
||||
/// </summary>
|
||||
internal interface IChartType : IDisposable
|
||||
{
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Chart type name
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets chart type image
|
||||
/// </summary>
|
||||
/// <param name="registry">Chart types registry object.</param>
|
||||
/// <returns>Chart type image.</returns>
|
||||
System.Drawing.Image GetImage(ChartTypeRegistry registry);
|
||||
|
||||
/// <summary>
|
||||
/// True if chart type is stacked
|
||||
/// </summary>
|
||||
bool Stacked { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// True if stacked chart type supports groups
|
||||
/// </summary>
|
||||
bool SupportStackedGroups { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// True if stacked chart type should draw separately positive and
|
||||
/// negative data points ( Bar and column Stacked types ).
|
||||
/// </summary>
|
||||
bool StackSign { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True if chart type supports axeses
|
||||
/// </summary>
|
||||
bool RequireAxes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True if chart type requires circular chart area.
|
||||
/// </summary>
|
||||
bool CircularChartArea { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True if chart type supports logarithmic axes
|
||||
/// </summary>
|
||||
bool SupportLogarithmicAxes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True if chart type requires to switch the value (Y) axes position
|
||||
/// </summary>
|
||||
bool SwitchValueAxes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True if chart series can be placed side-by-side.
|
||||
/// </summary>
|
||||
bool SideBySideSeries { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True if each data point of a chart must be represented in the legend
|
||||
/// </summary>
|
||||
bool DataPointsInLegend { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True if palette colors should be applied for each data paoint.
|
||||
/// Otherwise the color is applied to the series.
|
||||
/// </summary>
|
||||
bool ApplyPaletteColorsToPoints { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that extra Y values are connected to the scale of the Y axis
|
||||
/// </summary>
|
||||
bool ExtraYValuesConnectedToYAxis{ get; }
|
||||
|
||||
/// <summary>
|
||||
/// If the crossing value is auto Crossing value should be
|
||||
/// automatically set to zero for some chart
|
||||
/// types (Bar, column, area etc.)
|
||||
/// </summary>
|
||||
bool ZeroCrossing { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of supported Y value(s) per point
|
||||
/// </summary>
|
||||
int YValuesPerPoint{ get; }
|
||||
|
||||
/// <summary>
|
||||
/// Chart type with two y values used for scale ( bubble chart type )
|
||||
/// </summary>
|
||||
bool SecondYScale{ get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that it's a hundredred percent chart.
|
||||
/// Axis scale from 0 to 100 percent should be used.
|
||||
/// </summary>
|
||||
bool HundredPercent{ get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that negative 100% stacked values are shown on
|
||||
/// the other side of the X axis
|
||||
/// </summary>
|
||||
bool HundredPercentSupportNegative{ get; }
|
||||
|
||||
/// <summary>
|
||||
/// How to draw series/points in legend:
|
||||
/// Filled rectangle, Line or Marker
|
||||
/// </summary>
|
||||
/// <param name="series">Legend item series.</param>
|
||||
/// <returns>Legend item style.</returns>
|
||||
LegendImageStyle GetLegendImageStyle(Series series);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Painting and Selection methods
|
||||
|
||||
/// <summary>
|
||||
/// Draw chart on specified chart graphics.
|
||||
/// </summary>
|
||||
/// <param name="graph">Chart grahhics object.</param>
|
||||
/// <param name="common">Common elements.</param>
|
||||
/// <param name="area">Chart area to draw on.</param>
|
||||
/// <param name="seriesToDraw">Chart series to draw.</param>
|
||||
void Paint(ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Y values methods
|
||||
|
||||
/// <summary>
|
||||
/// Helper function, which returns the Y value of the data point.
|
||||
/// </summary>
|
||||
/// <param name="common">Chart common elements.</param>
|
||||
/// <param name="area">Chart area the series belongs to.</param>
|
||||
/// <param name="series">Sereis of the point.</param>
|
||||
/// <param name="point">Point object.</param>
|
||||
/// <param name="pointIndex">Index of the point.</param>
|
||||
/// <param name="yValueIndex">Index of the Y value to get.</param>
|
||||
/// <returns>Y value of the point.</returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "5#y")]
|
||||
double GetYValue(CommonElements common, ChartArea area, Series series, DataPoint point, int pointIndex, int yValueIndex);
|
||||
|
||||
#endregion
|
||||
|
||||
#region SmartLabelStyle methods
|
||||
|
||||
/// <summary>
|
||||
/// Adds markers position to the list. Used to check SmartLabelStyle overlapping.
|
||||
/// </summary>
|
||||
/// <param name="common">Common chart elements.</param>
|
||||
/// <param name="area">Chart area.</param>
|
||||
/// <param name="series">Series values to be used.</param>
|
||||
/// <param name="list">List to add to.</param>
|
||||
void AddSmartLabelMarkerPositions(CommonElements common, ChartArea area, Series series, ArrayList list);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,143 @@
|
||||
//-------------------------------------------------------------
|
||||
// <copyright company=<3D>Microsoft Corporation<6F>>
|
||||
// Copyright <20> Microsoft Corporation. All Rights Reserved.
|
||||
// </copyright>
|
||||
//-------------------------------------------------------------
|
||||
// @owner=alexgor, deliant
|
||||
//=================================================================
|
||||
// File: DoughnutChart.cs
|
||||
//
|
||||
// Namespace: System.Web.UI.DataVisualization.Charting.ChartTypes
|
||||
//
|
||||
// Classes: DoughnutChart
|
||||
//
|
||||
// Purpose: DoughnutChart class provide only the behaviour
|
||||
// information for the Doughnut chart, all the drawing
|
||||
// routines are located in the PieChart base class.
|
||||
//
|
||||
// Reviewed: GS - Aug 8, 2002
|
||||
// AG - Aug 8, 2002
|
||||
// AG - Microsoft 6, 2007
|
||||
//
|
||||
//===================================================================
|
||||
|
||||
#region Used namespaces
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
#endregion
|
||||
|
||||
#if Microsoft_CONTROL
|
||||
namespace System.Windows.Forms.DataVisualization.Charting.ChartTypes
|
||||
#else
|
||||
namespace System.Web.UI.DataVisualization.Charting.ChartTypes
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// DoughnutChart class provide only the behaviour information for the
|
||||
/// Doughnut chart, all the drawing routines are located in the PieChart
|
||||
/// base class.
|
||||
/// </summary>
|
||||
internal class DoughnutChart : PieChart
|
||||
{
|
||||
#region IChartType interface implementation
|
||||
|
||||
/// <summary>
|
||||
/// Chart type name
|
||||
/// </summary>
|
||||
override public string Name { get{ return ChartTypeNames.Doughnut;}}
|
||||
|
||||
/// <summary>
|
||||
/// Gets chart type image.
|
||||
/// </summary>
|
||||
/// <param name="registry">Chart types registry object.</param>
|
||||
/// <returns>Chart type image.</returns>
|
||||
override public System.Drawing.Image GetImage(ChartTypeRegistry registry)
|
||||
{
|
||||
return (System.Drawing.Image)registry.ResourceManager.GetObject(this.Name + "ChartType");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if chart type is stacked
|
||||
/// </summary>
|
||||
override public bool Stacked { get{ return false;}}
|
||||
|
||||
/// <summary>
|
||||
/// True if chart type supports axeses
|
||||
/// </summary>
|
||||
override public bool RequireAxes { get{ return false;} }
|
||||
|
||||
/// <summary>
|
||||
/// True if chart type supports logarithmic axes
|
||||
/// </summary>
|
||||
override public bool SupportLogarithmicAxes { get{ return false;} }
|
||||
|
||||
/// <summary>
|
||||
/// True if chart type requires to switch the value (Y) axes position
|
||||
/// </summary>
|
||||
override public bool SwitchValueAxes { get{ return false;} }
|
||||
|
||||
/// <summary>
|
||||
/// True if chart series can be placed side-by-side.
|
||||
/// </summary>
|
||||
override public bool SideBySideSeries { get{ return false;} }
|
||||
|
||||
/// <summary>
|
||||
/// If the crossing value is auto Crossing value should be
|
||||
/// automatically set to zero for some chart
|
||||
/// types (Bar, column, area etc.)
|
||||
/// </summary>
|
||||
override public bool ZeroCrossing { get{ return false;} }
|
||||
|
||||
/// <summary>
|
||||
/// True if each data point of a chart must be represented in the legend
|
||||
/// </summary>
|
||||
override public bool DataPointsInLegend { get{ return true;} }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that extra Y values are connected to the scale of the Y axis
|
||||
/// </summary>
|
||||
override public bool ExtraYValuesConnectedToYAxis{ get { return false; } }
|
||||
|
||||
/// <summary>
|
||||
/// True if palette colors should be applied for each data paint.
|
||||
/// Otherwise the color is applied to the series.
|
||||
/// </summary>
|
||||
override public bool ApplyPaletteColorsToPoints { get { return true; } }
|
||||
|
||||
/// <summary>
|
||||
/// How to draw series/points in legend:
|
||||
/// Filled rectangle, Line or Marker
|
||||
/// </summary>
|
||||
/// <param name="series">Legend item series.</param>
|
||||
/// <returns>Legend item style.</returns>
|
||||
override public LegendImageStyle GetLegendImageStyle(Series series)
|
||||
{
|
||||
return LegendImageStyle.Rectangle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of supported Y value(s) per point
|
||||
/// </summary>
|
||||
override public int YValuesPerPoint{ get { return 1; } }
|
||||
|
||||
/// <summary>
|
||||
/// Chart is Doughnut or Pie type
|
||||
/// </summary>
|
||||
override public bool Doughnut{ get { return true; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public DoughnutChart()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user