281 lines
6.0 KiB
C#
281 lines
6.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using DevComponents.DotNetBar.Charts.Style;
|
|
|
|
namespace DevComponents.DotNetBar.Charts
|
|
{
|
|
/// <summary>
|
|
/// Represents a PieLabel (label associated with a pie data slice in the chart).
|
|
/// </summary>
|
|
public class PieLabel : IDisposable
|
|
{
|
|
#region Private data
|
|
|
|
private PieSeriesPoint _PieSeriesPoint;
|
|
|
|
private float _Angle;
|
|
private Rectangle _Bounds;
|
|
private Rectangle _ConnectorBounds;
|
|
|
|
private Point _PtBoxEdge;
|
|
private Point _PtBoxBend;
|
|
private Point _PtSliceEdge;
|
|
|
|
private double _Radius;
|
|
private double _OuterRadius;
|
|
|
|
private string _Label;
|
|
private Size _LabelSize;
|
|
|
|
private SliceOuterLabelVisualStyle _SliceLabelVisualStyle;
|
|
|
|
private States _States;
|
|
|
|
#endregion
|
|
|
|
public PieLabel(PieSeriesPoint sp, string label)
|
|
{
|
|
_PieSeriesPoint = sp;
|
|
_Label = label;
|
|
|
|
InitDefaultStates();
|
|
}
|
|
|
|
#region InitDefaultStates
|
|
|
|
private void InitDefaultStates()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Public properties
|
|
|
|
#region Angle
|
|
|
|
/// <summary>
|
|
/// Gets the angle used to display the point label
|
|
/// associated with the data point.
|
|
/// </summary>
|
|
public float Angle
|
|
{
|
|
get { return (_Angle); }
|
|
internal set { _Angle = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Bounds
|
|
|
|
/// <summary>
|
|
/// Gets the label text bounds.
|
|
/// </summary>
|
|
public Rectangle Bounds
|
|
{
|
|
get { return (_Bounds); }
|
|
internal set { _Bounds = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsLeftlabel
|
|
|
|
/// <summary>
|
|
/// Gets whether the label is a left positioned
|
|
/// label (with respect to the chart slice).
|
|
/// </summary>
|
|
public bool IsLeftlabel
|
|
{
|
|
get { return (!TestState(States.RightLabel)); }
|
|
internal set { SetState(States.RightLabel, !value); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsRightlabel
|
|
|
|
/// <summary>
|
|
/// Gets whether the label is a right positioned
|
|
/// label (with respect to the chart slice).
|
|
/// </summary>
|
|
public bool IsRightlabel
|
|
{
|
|
get { return (TestState(States.RightLabel)); }
|
|
internal set { SetState(States.RightLabel, value); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Label
|
|
|
|
/// <summary>
|
|
/// Gets or sets the label text
|
|
/// </summary>
|
|
public string Label
|
|
{
|
|
get { return (_Label); }
|
|
internal set { _Label = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region LabelSize
|
|
|
|
/// <summary>
|
|
/// Gets the label size.
|
|
/// </summary>
|
|
public Size LabelSize
|
|
{
|
|
get { return (_LabelSize); }
|
|
internal set { _LabelSize = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region PieSeriesPoint
|
|
|
|
/// <summary>
|
|
/// Gets the associated PieSeriesPoint.
|
|
/// </summary>
|
|
public PieSeriesPoint PieSeriesPoint
|
|
{
|
|
get { return (_PieSeriesPoint); }
|
|
internal set { _PieSeriesPoint = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region PtBoxBend
|
|
|
|
/// <summary>
|
|
/// Gets the middle connector point located
|
|
/// at the 'bend' of the connector.
|
|
/// </summary>
|
|
public Point PtBoxBend
|
|
{
|
|
get { return (_PtBoxBend); }
|
|
internal set { _PtBoxBend = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region PtBoxEdge
|
|
|
|
/// <summary>
|
|
/// Gets the connector point located and the
|
|
/// 'edge' of the label text bounding box.
|
|
/// </summary>
|
|
public Point PtBoxEdge
|
|
{
|
|
get { return (_PtBoxEdge); }
|
|
internal set { _PtBoxEdge = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region PtSliceEdge
|
|
|
|
/// <summary>
|
|
/// Gets the initial connector point, located at
|
|
/// the edge of the pie slice.
|
|
/// </summary>
|
|
public Point PtSliceEdge
|
|
{
|
|
get { return (_PtSliceEdge); }
|
|
internal set { _PtSliceEdge = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SliceLabelVisualStyle
|
|
|
|
/// <summary>
|
|
/// Gets the current slice label VisualStyle for the label.
|
|
/// </summary>
|
|
public SliceOuterLabelVisualStyle LabelStyle
|
|
{
|
|
get { return (_SliceLabelVisualStyle); }
|
|
internal set { _SliceLabelVisualStyle = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Internal properties
|
|
|
|
#region ConnectorBounds
|
|
|
|
internal Rectangle ConnectorBounds
|
|
{
|
|
get { return (_ConnectorBounds); }
|
|
set { _ConnectorBounds = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region OuterRadius
|
|
|
|
internal double OuterRadius
|
|
{
|
|
get { return (_OuterRadius); }
|
|
set { _OuterRadius = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Radius
|
|
|
|
internal double Radius
|
|
{
|
|
get { return (_Radius); }
|
|
set { _Radius = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region States
|
|
|
|
[Flags]
|
|
private enum States : uint
|
|
{
|
|
RightLabel = (1U << 0),
|
|
}
|
|
|
|
#region TestState
|
|
|
|
private bool TestState(States state)
|
|
{
|
|
return ((_States & state) == state);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SetState
|
|
|
|
private void SetState(States state, bool value)
|
|
{
|
|
if (value == true)
|
|
_States |= state;
|
|
else
|
|
_States &= ~state;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region IDisposable
|
|
|
|
public void Dispose()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|