using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing.Imaging;
using DevComponents.DotNetBar.MicroCharts;
using DevComponents.DotNetBar.Rendering;
using System.Threading;
namespace DevComponents.DotNetBar
{
///
/// Represents the micro-chart item.
///
[ToolboxItem(false), DesignTimeVisible(false), DefaultEvent("Click"), Designer("DevComponents.DotNetBar.Design.MicroChartItemDesigner, DevComponents.DotNetBar.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=90f470f34c89ccaf")]
public class MicroChartItem : PopupItem, IPersonalizedMenuItem
{
#region Events
#endregion
#region Constructor
internal static readonly int TextChartSpacing = 3;
///
/// Creates new instance of MicroChartItem.
///
public MicroChartItem() : this("", "") { }
///
/// Creates new instance of MicroChartItem and assigns the name to it.
///
/// Item name.
public MicroChartItem(string sItemName) : this(sItemName, "") { }
///
/// Creates new instance of MicroChartItem and assigns the name and text to it.
///
/// Item name.
/// item text.
public MicroChartItem(string sItemName, string ItemText)
: base(sItemName, ItemText)
{
_Margin.PropertyChanged += new PropertyChangedEventHandler(MarginPropertyChanged);
_LineMicroChartStyle = new LineMicroChartStyle();
_LineMicroChartStyle.StyleChanged += new EventHandler(ChartStyleChanged);
_PlotMicroChartStyle = new PlotMicroChartStyle();
_PlotMicroChartStyle.StyleChanged += new EventHandler(ChartStyleChanged);
_ColumnMicroChartStyle = new BarMicroChartStyle();
_ColumnMicroChartStyle.StyleChanged += new EventHandler(ChartStyleChanged);
_BarMicroChartStyle = new BarMicroChartStyle();
_BarMicroChartStyle.StyleChanged += new EventHandler(ChartStyleChanged);
_WinLoseMicroChartStyle = new BarMicroChartStyle();
_WinLoseMicroChartStyle.StyleChanged += new EventHandler(ChartStyleChanged);
_PieMicroChartStyle = new PieMicroChartStyle();
_PieMicroChartStyle.StyleChanged += new EventHandler(ChartStyleChanged);
_AreaMicroChartStyle = new AreaMicroChartStyle();
_AreaMicroChartStyle.StyleChanged += new EventHandler(ChartStyleChanged);
_HundredPctMicroChartStyle = new HundredPctMicroChartStyle();
_HundredPctMicroChartStyle.StyleChanged += new EventHandler(ChartStyleChanged);
}
///
/// Returns copy of the item.
///
public override BaseItem Copy()
{
MicroChartItem objCopy = new MicroChartItem(m_Name);
this.CopyToItem(objCopy);
return objCopy;
}
///
/// Copies the MicroChartItem specific properties to new instance of the item.
///
/// New MicroChartItem instance.
internal void InternalCopyToItem(MicroChartItem copy)
{
CopyToItem(copy);
}
///
/// Copies the MicroChartItem specific properties to new instance of the item.
///
/// New MicroChartItem instance.
protected override void CopyToItem(BaseItem copy)
{
MicroChartItem item = copy as MicroChartItem;
if (item != null)
{
item.ChartHeight = this.ChartHeight;
item.ChartType = this.ChartType;
item.ChartWidth = this.ChartWidth;
item.DataPoints = this.DataPoints;
item.MouseOverEnabled = this.MouseOverEnabled;
item.TextVisible = this.TextVisible;
item.TrackChartPoints = this.TrackChartPoints;
base.CopyToItem(item);
}
}
#endregion
#region Implementation
protected override void Dispose(bool disposing)
{
if (_TransitionWorker != null)
{
_TransitionWorker.Dispose();
_TransitionWorker = null;
}
Image image = _ChartImage;
_ChartImage = null;
if (image != null)
image.Dispose();
base.Dispose(disposing);
}
private int _TextWidth = 0;
///
/// Gets or sets the suggested text-width. If you want to make sure that text you set wraps over multiple lines you can set suggested text-width so word break is performed.
///
[DefaultValue(0), Category("Appearance"), Description("Indicates suggested text-width. If you want to make sure that text you set wraps over multiple lines you can set suggested text-width so word break is performed.")]
public int TextWidth
{
get { return _TextWidth; }
set
{
_TextWidth = value;
NeedRecalcSize = true;
Refresh();
}
}
private Size _TextSize = Size.Empty;
///
/// Recalculate the size of the item. If overridden base implementation must be called so default processing can occur.
///
public override void RecalcSize()
{
int chartWidth = _ChartWidth;
int chartHeight =_ChartHeight;
if (!(this.ContainerControl is MicroChart))
{
chartWidth = Dpi.Width(_ChartWidth);
chartHeight = Dpi.Height(_ChartHeight);
}
Padding padding = Dpi.Size(_Margin);
m_Rect.Width = chartWidth + padding.Horizontal + Dpi.Width8;
m_Rect.Height = chartHeight + padding.Vertical + Dpi.Height8;
bool onMenu = this.IsOnMenu && !(this.Parent is ItemContainer);
if (onMenu)
{
Size sideBarSize = GetMaxImageSize();
// Get the right image size that we will use for calculation
m_Rect.Width += (sideBarSize.Width + 7);
if (this.IsOnCustomizeMenu)
m_Rect.Width += (sideBarSize.Height + 2);
}
if (_TextVisible && !string.IsNullOrEmpty(this.Text))
{
Control parent = this.ContainerControl as Control;
if (parent != null)
{
Font font = parent.Font;
using (Graphics g = parent.CreateGraphics())
{
int textWidth = Dpi.Width(_TextWidth);
Size textSize = ButtonItemLayout.MeasureItemText(this, g, textWidth, font, (textWidth > 0 ? eTextFormat.WordBreak : eTextFormat.SingleLine), parent.RightToLeft == RightToLeft.Yes);
_TextSize = textSize;
Padding textPadding = Dpi.Size(_TextPadding);
textSize.Width += textPadding.Horizontal;
textSize.Height += textPadding.Vertical;
int textChartSpacing = Dpi.Width(TextChartSpacing);
if (_TextPosition == eMicroChartTextPosition.Left || _TextPosition == eMicroChartTextPosition.Right)
{
textSize.Width += textChartSpacing;
m_Rect.Width += textSize.Width;
m_Rect.Height = Math.Max(m_Rect.Height, textSize.Height);
}
else
{
textSize.Height += textChartSpacing;
m_Rect.Height += textSize.Height;
m_Rect.Width = Math.Max(m_Rect.Width, textSize.Width);
}
}
}
}
base.RecalcSize();
}
private Size GetMaxImageSize()
{
if (m_Parent != null)
{
ImageItem objParentImageItem = m_Parent as ImageItem;
if (objParentImageItem != null)
return objParentImageItem.SubItemsImageSize;
else
return this.ImageSize;
}
else
return this.ImageSize;
}
private string _TooltipValueFormatString = "";
///
/// Gets or sets the format string for the value when it is displayed as tool-tip for data point.
///
[DefaultValue(""), Category("Appearance"), Description("Indicates format string for the value when it is displayed as tool-tip for data point.")]
public string TooltipValueFormatString
{
get { return _TooltipValueFormatString; }
set
{
if (value == null) value = string.Empty;
if (value != _TooltipValueFormatString)
{
string oldValue = _TooltipValueFormatString;
_TooltipValueFormatString = value;
OnTooltipValueFormatStringChanged(oldValue, value);
}
}
}
private void OnTooltipValueFormatStringChanged(string oldValue, string newValue)
{
//OnPropertyChanged(new PropertyChangedEventArgs("TooltipValueFormatString"));
}
private List _DataPoints = new List();
///
/// Gets or sets the chart data points. Note that if you are adding or removing points directly from this collection you must call
/// Refresh() method on the control to refresh the display.
///
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public List DataPoints
{
get { return _DataPoints; }
set
{
if (value != _DataPoints)
{
List oldValue = _DataPoints;
_DataPoints = value;
OnDataPointsChanged(oldValue, value);
}
}
}
private void OnDataPointsChanged(List oldValue, List newValue)
{
//OnPropertyChanged(new PropertyChangedEventArgs("DataPoints"));
TransitionChart();
}
private List _DataPointTooltips = new List();
///
/// Gets or sets the tooltips for each data-point assigned through DataPoints property. If not set control will automatically
/// show tooltip based on the data-point value.
///
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public List DataPointTooltips
{
get { return _DataPointTooltips; }
set
{
if (value != _DataPointTooltips)
{
List oldValue = _DataPointTooltips;
_DataPointTooltips = value;
OnDataPointTooltipsChanged(oldValue, value);
}
}
}
private void OnDataPointTooltipsChanged(List oldValue, List newValue)
{
//OnPropertyChanged(new PropertyChangedEventArgs("DataPointTooltips"));
}
private Image _TransitionImage = null;
private float _TransitionOpacity = 0f;
private BackgroundWorker _TransitionWorker = null;
private void TransitionChart()
{
if (_ChartImage != null)
{
Control cc = this.ContainerControl as Control;
if (cc != null && cc.IsHandleCreated && IsAnimationEnabled)
{
Image image = _TransitionImage;
_TransitionImage = _ChartImage;
if (image != null)
image.Dispose();
_ChartImage = null;
InvalidateChartImage(false);
if (_TransitionWorker == null)
{
_TransitionWorker = new BackgroundWorker();
_TransitionWorker.WorkerSupportsCancellation = true;
_TransitionWorker.DoWork += TransitionWorkerDoWork;
_TransitionWorker.RunWorkerCompleted += TransitionWorkerCompleted;
_TransitionWorker.RunWorkerAsync();
}
return;
}
}
InvalidateChartImage(false);
}
System.Threading.Semaphore _CompletedSemaphore = new System.Threading.Semaphore(1, 1);
void TransitionWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
_CompletedSemaphore.WaitOne();
BackgroundWorker worker = _TransitionWorker;
Image image = _TransitionImage;
_TransitionImage = null;
if (image != null)
image.Dispose();
_TransitionWorker = null;
if (worker != null)
worker.Dispose();
this.Refresh();
_CompletedSemaphore.Release();
}
void TransitionWorkerDoWork(object sender, DoWorkEventArgs e)
{
while (_TransitionOpacity < 1)
{
_TransitionOpacity += 0.1f;
if (e.Cancel) break;
this.Refresh();
try
{
using (
System.Threading.ManualResetEvent wait =
new System.Threading.ManualResetEvent(false))
wait.WaitOne(60);
//Thread.Sleep(60);
}
catch
{
}
}
_TransitionOpacity = 0f;
}
private bool _AnimationEnabled = true;
///
/// Gets or sets whether transition animation between same chart with different data-points is enabled. Default value is true.
///
[DefaultValue(true), Category("Behavior"), Description("Indicates whether transition animation between same chart with different data-points is enabled.")]
public bool AnimationEnabled
{
get { return _AnimationEnabled; }
set
{
_AnimationEnabled = value;
}
}
///
/// Gets whether fade effect is enabled.
///
private bool IsAnimationEnabled
{
get
{
//if (!_AnimationEnabled) return false;
//System.Windows.Forms.Control cc = this.ContainerControl as System.Windows.Forms.Control;
//if (cc != null)
//{
// if (cc is ItemControl)
// return ((ItemControl)cc).IsFadeEnabled;
// else if (cc is MicroChart)
// return ((MicroChart)cc).IsAnimationEnabled;
// else if (cc is Bar)
// return ((Bar)cc).IsFadeEnabled;
// else if (cc is ButtonX)
// return ((ButtonX)cc).IsFadeEnabled;
//}
return _AnimationEnabled;
}
}
private bool _TrackChartPoints = true;
///
/// Gets or sets whether chart is tracking mouse movement to show data-point and its value on tooltip. Default value is true.
///
[DefaultValue(true), Category("Behavior"), Description("Indicates whether chart is tracking mouse movement to show data-point and its value on tooltip.")]
public bool TrackChartPoints
{
get { return _TrackChartPoints; }
set
{
_TrackChartPoints = value;
}
}
private bool _MouseOverEnabled = false;
///
/// Gets or sets whether button like mouse over tracking is enabled for whole control. When enabled control looks like a button when mouse is over it. Default value is false.
///
[DefaultValue(false), Category("Behavior"), Description("Indicates whether button like mouse over tracking is enabled for whole control. When enabled control looks like a button when mouse is over it.")]
public bool MouseOverEnabled
{
get { return _MouseOverEnabled; }
set
{
_MouseOverEnabled = value;
}
}
///
/// Gets the index of data point (DataPoints collection) that mouse is over or returns -1 if mouse is not over any data-point.
///
[Browsable(false)]
public int MouseOverDataPointIndex
{
get
{
if (_HotPoint.IsEmpty) return -1;
return _HotPoint.DataPointIndex;
}
}
private bool _MouseOverDataPointTooltipEnabled = true;
///
/// Gets or sets whether mouse over tooltip for data point is enabled. Default value is true.
///
[Category("Behavior"), DefaultValue(true), Description("Indicates whether mouse over tooltip for data point is enabled")]
public bool MouseOverDataPointTooltipEnabled
{
get { return _MouseOverDataPointTooltipEnabled; }
set
{
_MouseOverDataPointTooltipEnabled = value;
}
}
///
/// Occurs when MouseOverDataPointIndex property changes due to user moving the mouse and pointing it to different data point on chart.
///
public event EventHandler MouseOverDataPointChanged;
///
/// Raises MouseOverDataPointChanged event.
///
/// Provides event arguments.
protected virtual void OnMouseOverDataPointChanged(EventArgs e)
{
EventHandler handler = MouseOverDataPointChanged;
if (handler != null)
handler(this, e);
}
private MicroChartHotPoint _HotPoint = MicroChartHotPoint.Empty;
private MicroChartHotPoint HotPoint
{
get
{
return _HotPoint;
}
set
{
if (_HotPoint.HotPointBounds != value.HotPointBounds)
{
_HotPoint = value;
if (_HotPoint.IsEmpty && this.ToolTipVisible)
{
this.HideToolTip();
this.Tooltip = "";
}
else if (_TrackChartPoints && _MouseOverDataPointTooltipEnabled)
{
if (_DataPointTooltips.Count > 0 && _DataPointTooltips.Count > value.DataPointIndex)
{
string tooltip = _DataPointTooltips[value.DataPointIndex];
if (tooltip.IndexOf("{0}") >= 0)
tooltip = string.Format(tooltip, value.Value);
this.Tooltip = tooltip;
}
else if (string.IsNullOrEmpty(_TooltipValueFormatString))
this.Tooltip = value.Value.ToString();
else
this.Tooltip = value.Value.ToString(_TooltipValueFormatString);
if (!this.ToolTipVisible) this.ShowToolTip();
}
OnMouseOverDataPointChanged(EventArgs.Empty);
this.Refresh();
}
}
}
private bool _IsMouseOver = false;
public override void InternalMouseEnter()
{
base.InternalMouseEnter();
if (!_IsMouseOver)
{
_IsMouseOver = true;
this.Refresh();
}
}
public override void InternalMouseLeave()
{
HotPoint = MicroChartHotPoint.Empty;
if (_IsMouseOver)
{
_IsMouseOver = false;
this.Refresh();
}
base.InternalMouseLeave();
}
private bool _IsPressed = false;
public override void InternalMouseDown(MouseEventArgs objArg)
{
if (!_IsPressed && objArg.Button == MouseButtons.Left)
{
_IsPressed = true;
this.Refresh();
}
base.InternalMouseDown(objArg);
}
public override void InternalMouseUp(MouseEventArgs objArg)
{
if (_IsPressed && objArg.Button == MouseButtons.Left)
{
_IsPressed = false;
this.Refresh();
}
base.InternalMouseUp(objArg);
}
public override void InternalMouseMove(MouseEventArgs objArg)
{
if (m_Rect.Contains(objArg.X, objArg.Y) && _ChartHotPoints != null)
{
MicroChartHotPoint newHotPoint = MicroChartHotPoint.Empty;
int chartWidth = _ChartWidth;
int chartHeight = _ChartHeight;
if (!(this.ContainerControl is MicroChart))
{
chartWidth = Dpi.Width(_ChartWidth);
chartHeight = Dpi.Height(_ChartHeight);
}
Rectangle chartBounds = new Rectangle(_ChartLocation.X, _ChartLocation.Y, chartWidth, chartHeight);
if (chartBounds.Contains(objArg.X, objArg.Y))
{
foreach (MicroChartHotPoint point in _ChartHotPoints)
{
Point chartPoint = new Point(objArg.X - _ChartLocation.X, objArg.Y - _ChartLocation.Y);
Rectangle r = point.HotPointBounds;
Rectangle sliceBounds = point.ChartSliceBounds;
r.Offset(_ChartLocation);
if (!sliceBounds.IsEmpty)
sliceBounds.Offset(_ChartLocation);
if (_ChartType == eMicroChartType.Pie && PieSliceContains(chartPoint, point) ||
_ChartType != eMicroChartType.Pie && (r.Contains(objArg.X, objArg.Y) || sliceBounds.Contains(objArg.X, objArg.Y)))
{
newHotPoint = point;
break;
}
}
}
HotPoint = newHotPoint;
}
base.InternalMouseMove(objArg);
}
private bool PieSliceContains(Point point, MicroChartHotPoint hotPoint)
{
int chartWidth = _ChartWidth;
int chartHeight = _ChartHeight;
if (!(this.ContainerControl is MicroChart))
{
chartWidth = Dpi.Width(_ChartWidth);
chartHeight = Dpi.Height(_ChartHeight);
}
int diameter = Math.Min(chartHeight, chartWidth);
double a = diameter / 2 + (chartWidth - diameter) / 2;
double b = diameter / 2 + (chartHeight - diameter) / 2; ;
double x = point.X - a;
double y = point.Y - b;
double angle = Math.Atan2(y, x);
if (angle < 0)
angle += 2 * Math.PI;
double angleDegrees = angle * 180 / Math.PI;
// point is inside the pie slice only if between start and end angle
if (angleDegrees >= hotPoint.StartAngle &&
angleDegrees <= hotPoint.StartAngle + hotPoint.SweepAngle)
{
return true;
}
return false;
}
///
/// Invalidates the chart display and requests the re-paint.
///
/// Indicates whether to animate transition to new chart
public void InvalidateChart(bool animateTransition)
{
if (animateTransition)
TransitionChart();
else
InvalidateChartImage(false);
}
private void InvalidateChartImage(bool isPainting)
{
Image image = _ChartImage;
_ChartImage = null;
if (image != null)
image.Dispose();
if (!isPainting)
this.Refresh();
}
private Bitmap _ChartImage = null;
private Point _ChartLocation = Point.Empty;
///
/// Draws the chart.
///
/// Paint arguments
public override void Paint(ItemPaintArgs p)
{
if (_DataPoints != null && _LastDataPointCount != _DataPoints.Count)
InvalidateChartImage(true);
if (_ChartImage == null)
_ChartImage = CreateChartImage();
Graphics g = p.Graphics;
Rectangle contentBounds = m_Rect;
bool onMenu = this.IsOnMenu && !(this.Parent is ItemContainer);
bool rtl = p.RightToLeft;
eDotNetBarStyle effectiveStyle = this.EffectiveStyle;
bool enabled = GetEnabled(p.ContainerControl);
if (onMenu)
{
Size sideBarSize = GetMaxImageSize();
if (!rtl)
contentBounds.X += sideBarSize.Width + 7;
contentBounds.Width -= sideBarSize.Width + 7;
DrawMenuSideBar(p, effectiveStyle);
}
if (_MouseOverEnabled && enabled && (_IsMouseOver || this.Expanded))
{
DrawMouseOverState(p, effectiveStyle);
}
if (_BackgroundImage != null)
BarFunctions.PaintBackgroundImage(g, contentBounds, _BackgroundImage, _BackgroundImagePosition, 255);
Padding padding = Dpi.Size(_Margin);
Point chartLocation = new Point(contentBounds.X + Dpi.Width4 + padding.Left, contentBounds.Y + Dpi.Height4 + padding.Top);
int chartHeight = _ChartHeight;
int chartWidth = _ChartWidth;
if (!(this.ContainerControl is MicroChart))
{
chartWidth = Dpi.Width(_ChartWidth);
chartHeight = Dpi.Height(_ChartHeight);
}
if (_TextVisible && !string.IsNullOrEmpty(this.Text))
{
Rectangle textRect = contentBounds;
int textChartSpacing = Dpi.Width(TextChartSpacing);
Padding textPadding = Dpi.Size(_TextPadding);
if (_TextPosition == eMicroChartTextPosition.Left && !rtl || _TextPosition == eMicroChartTextPosition.Right && rtl)
{
textRect.Width = _TextSize.Width;
textRect.Y += textPadding.Top + padding.Top + Dpi.Height1;
textRect.X += padding.Left + textPadding.Left + Dpi.Width1;
textRect.Height = Math.Max(_TextSize.Height + Dpi.Height2, chartHeight + Dpi.Height6);
chartLocation.X = textRect.Right + textPadding.Right + textChartSpacing;
}
else if (_TextPosition == eMicroChartTextPosition.Right && !rtl || _TextPosition == eMicroChartTextPosition.Left && rtl)
{
textRect.Width = _TextSize.Width;
textRect.Y += textPadding.Top + padding.Top + Dpi.Height1;
textRect.X += padding.Left + textPadding.Left + chartWidth + textChartSpacing + Dpi.Width1;
textRect.Height = Math.Max(_TextSize.Height + Dpi.Height2, chartHeight + Dpi.Height6);
}
else if (_TextPosition == eMicroChartTextPosition.Top)
{
textRect.Width = _TextSize.Width;
textRect.Y += textPadding.Top + padding.Top + Dpi.Height1;
textRect.X += padding.Left;
textRect.Height = _TextSize.Height;
chartLocation.Y = textRect.Bottom + textPadding.Bottom + textChartSpacing;
if (_TextSize.Width > chartWidth)
chartLocation.X += (_TextSize.Width - chartWidth) / 2;
else
textRect.X = chartLocation.X + (chartWidth - _TextSize.Width) / 2;
}
else if (_TextPosition == eMicroChartTextPosition.Bottom)
{
textRect.Width = _TextSize.Width;
textRect.Y += textPadding.Top + padding.Top + chartHeight + textChartSpacing + Dpi.Height1;
textRect.X += padding.Left;
textRect.Height = _TextSize.Height;
if (_TextSize.Width > chartWidth)
chartLocation.X += (_TextSize.Width - chartWidth) / 2;
else
textRect.X = chartLocation.X + (chartWidth - _TextSize.Width) / 2;
}
Color textColor = this.TextColor;
if (textColor.IsEmpty)
{
textColor = LabelItem.GetTextColor(p, this.EffectiveStyle, GetEnabled(), textColor);
}
Font textFont = p.Font;
eTextFormat tf = eTextFormat.Left | eTextFormat.VerticalCenter | eTextFormat.WordBreak;
if (this.TextMarkupBody != null)
{
TextMarkup.MarkupDrawContext d = new TextMarkup.MarkupDrawContext(g, textFont, textColor, rtl);
d.HotKeyPrefixVisible = !((tf & eTextFormat.HidePrefix) == eTextFormat.HidePrefix);
if ((tf & eTextFormat.VerticalCenter) == eTextFormat.VerticalCenter)
textRect.Y = this.TopInternal + (contentBounds.Height - this.TextMarkupBody.Bounds.Height) / 2;
else if ((tf & eTextFormat.Bottom) == eTextFormat.Bottom)
textRect.Y += (this.TextMarkupBody.Bounds.Height - textRect.Height) + Dpi.Height1;
textRect.Height = this.TextMarkupBody.Bounds.Height;
this.TextMarkupBody.Bounds = textRect;
this.TextMarkupBody.Render(d);
}
else
{
if (p != null && p.GlassEnabled && this.Parent is CaptionItemContainer && !(p.ContainerControl is DevComponents.DotNetBar.Ribbon.QatToolbar))
{
if (!p.CachedPaint)
Office2007RibbonControlPainter.PaintTextOnGlass(g, this.Text, textFont, textRect, TextDrawing.GetTextFormat(tf));
}
else
TextDrawing.DrawString(g, this.Text, textFont, textColor, textRect, tf);
}
}
if (_TransitionImage != null)
{
Rectangle chartRect = new Rectangle(chartLocation.X, chartLocation.Y, chartWidth, chartHeight);
System.Drawing.Imaging.ColorMatrix matrix1 = new System.Drawing.Imaging.ColorMatrix();
matrix1[3, 3] = (1 - _TransitionOpacity);
using (System.Drawing.Imaging.ImageAttributes imageAtt = new System.Drawing.Imaging.ImageAttributes())
{
imageAtt.SetColorMatrix(matrix1);
g.DrawImage(_TransitionImage, chartRect, 0, 0, chartRect.Width, chartRect.Height, GraphicsUnit.Pixel, imageAtt);
}
matrix1[3, 3] = _TransitionOpacity;
using (System.Drawing.Imaging.ImageAttributes imageAtt = new System.Drawing.Imaging.ImageAttributes())
{
imageAtt.SetColorMatrix(matrix1);
g.DrawImage(_ChartImage, chartRect, 0, 0, chartRect.Width, chartRect.Height, GraphicsUnit.Pixel, imageAtt);
}
}
else
{
g.DrawImage(_ChartImage, chartLocation);
}
_ChartLocation = chartLocation;
if (_TrackChartPoints && !_HotPoint.IsEmpty)
{
Rectangle hotPointBounds = _HotPoint.HotPointBounds;
hotPointBounds.Offset(chartLocation);
using (Pen pen = new Pen(Brushes.DarkGray, Dpi.Width1))
{
g.FillEllipse(Brushes.White, hotPointBounds);
g.DrawEllipse(pen, hotPointBounds);
}
hotPointBounds.Inflate(-Dpi.Width2, -Dpi.Height2);
using (SolidBrush brush = new SolidBrush(_HotPoint.Color))
g.FillEllipse(brush, hotPointBounds);
}
//g.DrawRectangle(Pens.Yellow, new Rectangle(m_Rect.X, m_Rect.Y, m_Rect.Width - 1, m_Rect.Height - 1));
if (this.Focused && this.DesignMode)
{
Rectangle r = m_Rect;
r.Inflate(-1, -1);
DesignTime.DrawDesignTimeSelection(g, r, p.Colors.ItemDesignTimeBorder);
}
this.DrawInsertMarker(p.Graphics);
}
private static RoundRectangleShapeDescriptor _MenuShape = new RoundRectangleShapeDescriptor(3);
private void DrawMouseOverState(ItemPaintArgs p, eDotNetBarStyle effectiveStyle)
{
Rectangle rHover = this.DisplayRectangle;
rHover.Inflate(-1, 0);
Graphics g = p.Graphics;
if (BarFunctions.IsOffice2007Style(effectiveStyle) && !(p.Owner is DotNetBarManager) && GlobalManager.Renderer is Office2007Renderer)
{
Office2007ButtonItemStateColorTable bt;
if (this.Expanded)
bt = ((Office2007Renderer)GlobalManager.Renderer).ColorTable.ButtonItemColors[0].Expanded;
else if (_IsPressed)
bt = ((Office2007Renderer)GlobalManager.Renderer).ColorTable.ButtonItemColors[0].Pressed;
else
bt = ((Office2007Renderer)GlobalManager.Renderer).ColorTable.ButtonItemColors[0].MouseOver;
Office2007ButtonItemPainter.PaintBackground(g, bt, rHover, _MenuShape);
}
else
{
if (!p.Colors.ItemHotBackground2.IsEmpty)
{
System.Drawing.Drawing2D.LinearGradientBrush gradient = BarFunctions.CreateLinearGradientBrush(rHover, p.Colors.ItemHotBackground, p.Colors.ItemHotBackground2, p.Colors.ItemHotBackgroundGradientAngle);
g.FillRectangle(gradient, rHover);
gradient.Dispose();
}
else
g.FillRectangle(new SolidBrush(p.Colors.ItemHotBackground), rHover);
NativeFunctions.DrawRectangle(g, new Pen(p.Colors.ItemHotBorder), rHover);
}
}
private void DrawMenuSideBar(ItemPaintArgs pa, eDotNetBarStyle effectiveStyle)
{
Rectangle sideRect = GetMenuSideBounds(pa.RightToLeft);
Graphics g = pa.Graphics;
// Draw side bar
if (!BarFunctions.IsOffice2007Style(effectiveStyle))
{
if (this.MenuVisibility == eMenuVisibility.VisibleIfRecentlyUsed && !this.RecentlyUsed)
{
if (!pa.Colors.MenuUnusedSide2.IsEmpty)
{
System.Drawing.Drawing2D.LinearGradientBrush gradient = BarFunctions.CreateLinearGradientBrush(new Rectangle(m_Rect.Left, m_Rect.Top, sideRect.Width, m_Rect.Height), pa.Colors.MenuUnusedSide, pa.Colors.MenuUnusedSide2, pa.Colors.MenuUnusedSideGradientAngle);
g.FillRectangle(gradient, sideRect);
gradient.Dispose();
}
else
g.FillRectangle(new SolidBrush(pa.Colors.MenuUnusedSide), sideRect);
}
else
{
if (!pa.Colors.MenuSide2.IsEmpty)
{
System.Drawing.Drawing2D.LinearGradientBrush gradient = BarFunctions.CreateLinearGradientBrush(sideRect, pa.Colors.MenuSide, pa.Colors.MenuSide2, pa.Colors.MenuSideGradientAngle);
g.FillRectangle(gradient, sideRect);
gradient.Dispose();
}
else
g.FillRectangle(new SolidBrush(pa.Colors.MenuSide), sideRect);
}
}
if (BarFunctions.IsOffice2007Style(effectiveStyle) && GlobalManager.Renderer is Office2007Renderer)
{
Office2007MenuColorTable mt = ((Office2007Renderer)GlobalManager.Renderer).ColorTable.Menu;
if (mt != null)
{
// Draw side bar
if (this.MenuVisibility == eMenuVisibility.VisibleIfRecentlyUsed && !this.RecentlyUsed)
DisplayHelp.FillRectangle(g, sideRect, mt.SideUnused);
else
DisplayHelp.FillRectangle(g, sideRect, mt.Side);
}
if (mt != null && !mt.SideBorder.IsEmpty)
{
if (pa.RightToLeft)
DisplayHelp.DrawGradientLine(g, sideRect.X, sideRect.Y, sideRect.X, sideRect.Bottom - 1, mt.SideBorder, 1);
else
DisplayHelp.DrawGradientLine(g, sideRect.Right - 2, sideRect.Y, sideRect.Right - 2, sideRect.Bottom - 1, mt.SideBorder, 1);
}
if (mt != null && !mt.SideBorderLight.IsEmpty)
{
if (pa.RightToLeft)
DisplayHelp.DrawGradientLine(g, sideRect.X + 1, sideRect.Y, sideRect.X + 1, sideRect.Bottom - 1, mt.SideBorderLight, 1);
else
DisplayHelp.DrawGradientLine(g, sideRect.Right - 1, sideRect.Y, sideRect.Right - 1, sideRect.Bottom - 1, mt.SideBorderLight, 1);
}
}
}
private Rectangle GetMenuSideBounds(bool rtl)
{
Size sideBarSize = GetMaxImageSize();
sideBarSize.Width += 7;
if (this.IsOnCustomizeMenu)
sideBarSize.Width += sideBarSize.Height + 8;
Rectangle bounds = m_Rect;
Rectangle sideRect = new Rectangle(bounds.Left, bounds.Top, sideBarSize.Width, bounds.Height);
if (rtl)
sideRect.X = bounds.Right - sideRect.Width;
return sideRect;
}
private MicroChartHotPoint[] _ChartHotPoints = new MicroChartHotPoint[0];
private int _LastDataPointCount = -1;
private Bitmap CreateChartImage()
{
int chartWidth = _ChartWidth;
int chartHeight = _ChartHeight;
if (!(this.ContainerControl is MicroChart))
{
chartWidth = Dpi.Width(_ChartWidth);
chartHeight = Dpi.Height(_ChartHeight);
}
Bitmap image = new Bitmap(chartWidth, chartHeight, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(image))
{
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
MicroChartBase draw = GetMicroChart();
MicroChartRenderInfo info = new MicroChartRenderInfo(_DataPoints, g, chartWidth, chartHeight, _DataMaxValue, _DataMinValue);
draw.CreateChart(info);
_ChartHotPoints = info.MicroChartHotPoints;
}
if (_DataPoints != null)
_LastDataPointCount = _DataPoints.Count;
else
_LastDataPointCount = -1;
return image;
}
private void ChartStyleChanged(object sender, EventArgs e)
{
InvalidateChartImage(false);
}
private LineMicroChartStyle _LineMicroChartStyle = null;
///
/// Gets the style used to customize appearance of Line micro-chart.
///
[Category("Style"), Description("Identifies style used to customize appearance of Line micro-chart."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public LineMicroChartStyle LineChartStyle
{
get
{
return _LineMicroChartStyle;
}
}
private PlotMicroChartStyle _PlotMicroChartStyle = null;
///
/// Gets the style used to customize appearance of Plot micro-chart.
///
[Category("Style"), Description("Identifies style used to customize appearance of Plot micro-chart."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PlotMicroChartStyle PlotChartStyle
{
get
{
return _PlotMicroChartStyle;
}
}
private BarMicroChartStyle _ColumnMicroChartStyle = null;
///
/// Gets the style used to customize appearance of Column micro-chart.
///
[Category("Style"), Description("Identifies style used to customize appearance of Column micro-chart."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public BarMicroChartStyle ColumnChartStyle
{
get
{
return _ColumnMicroChartStyle;
}
}
private BarMicroChartStyle _BarMicroChartStyle = null;
///
/// Gets the style used to customize appearance of Bar micro-chart.
///
[Category("Style"), Description("Identifies style used to customize appearance of Bar micro-chart."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public BarMicroChartStyle BarChartStyle
{
get
{
return _BarMicroChartStyle;
}
}
private BarMicroChartStyle _WinLoseMicroChartStyle = null;
///
/// Gets the style used to customize appearance of Win-Lose micro-chart.
///
[Category("Style"), Description("Identifies style used to customize appearance of Win-Lose micro-chart."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public BarMicroChartStyle WinLoseChartStyle
{
get
{
return _WinLoseMicroChartStyle;
}
}
private PieMicroChartStyle _PieMicroChartStyle = null;
///
/// Gets the style used to customize appearance of Pie micro-chart.
///
[Category("Style"), Description("Identifies style used to customize appearance of Pie micro-chart."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public PieMicroChartStyle PieChartStyle
{
get
{
return _PieMicroChartStyle;
}
}
private AreaMicroChartStyle _AreaMicroChartStyle = null;
///
/// Gets the style used to customize appearance of Area micro-chart.
///
[Category("Style"), Description("Identifies style used to customize appearance of Area micro-chart."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public AreaMicroChartStyle AreaChartStyle
{
get
{
return _AreaMicroChartStyle;
}
}
private HundredPctMicroChartStyle _HundredPctMicroChartStyle = null;
///
/// Gets the style used to customize appearance of 100% micro-chart.
///
[Category("Style"), Description("Identifies style used to customize appearance of 100% micro-chart."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public HundredPctMicroChartStyle HundredPctChartStyle
{
get
{
return _HundredPctMicroChartStyle;
}
}
private MicroChartBase GetMicroChart()
{
MicroChartBase chart = null;
if (_ChartType == eMicroChartType.Line)
{
LineMicroChart lineChart = new LineMicroChart();
lineChart.Style = _LineMicroChartStyle;
chart = lineChart;
}
else if (_ChartType == eMicroChartType.Plot)
{
PlotMicroChart plotChart = new PlotMicroChart();
plotChart.Style = _PlotMicroChartStyle;
chart = plotChart;
}
else if (_ChartType == eMicroChartType.Column)
{
ColumnMicroChart columnChart = new ColumnMicroChart();
columnChart.Style = _ColumnMicroChartStyle;
chart = columnChart;
}
else if (_ChartType == eMicroChartType.Bar)
{
BarMicroChart barChart = new BarMicroChart();
barChart.Style = _BarMicroChartStyle;
chart = barChart;
}
else if (_ChartType == eMicroChartType.WinLose)
{
WinLoseMicroChart columnChart = new WinLoseMicroChart();
columnChart.Style = _WinLoseMicroChartStyle;
chart = columnChart;
}
else if (_ChartType == eMicroChartType.Pie)
{
PieMicroChart pieChart = new PieMicroChart();
pieChart.Style = _PieMicroChartStyle;
chart = pieChart;
}
else if (_ChartType == eMicroChartType.Area)
{
AreaMicroChart areaChart = new AreaMicroChart();
areaChart.Style = _AreaMicroChartStyle;
chart = areaChart;
}
else if (_ChartType == eMicroChartType.HundredPercentBar)
{
HundredPctBar pctChart = new HundredPctBar();
pctChart.Style = _HundredPctMicroChartStyle;
chart = pctChart;
}
return chart;
}
private int _ChartWidth = 54;
///
/// Gets or sets the width of the chart part of the control.
///
[DefaultValue(54), Category("Appearance"), Description("Indicates width of the chart part of the control.")]
public int ChartWidth
{
get { return _ChartWidth; }
set
{
if (value != _ChartWidth)
{
if (_ChartWidth <= 0)
throw new ArgumentException("CharWidth must be greater than 0");
int oldValue = _ChartWidth;
_ChartWidth = value;
OnChartWidthChanged(oldValue, value);
}
}
}
private void OnChartWidthChanged(int oldValue, int newValue)
{
//OnPropertyChanged(new PropertyChangedEventArgs("ChartWidth"));
InvalidateChartImage(false);
}
private int _ChartHeight = 15;
///
/// Gets or sets the height of the chart part of the control.
///
[DefaultValue(15), Category("Appearance"), Description("Indicates height of the chart part of the control.")]
public int ChartHeight
{
get { return _ChartHeight; }
set
{
if (value != _ChartHeight)
{
if (_ChartWidth <= 0)
throw new ArgumentException("CharHeight must be greater than 0");
int oldValue = _ChartHeight;
_ChartHeight = value;
OnChartHeightChanged(oldValue, value);
}
}
}
private void OnChartHeightChanged(int oldValue, int newValue)
{
//OnPropertyChanged(new PropertyChangedEventArgs("ChartHeight"));
InvalidateChartImage(false);
}
private eMicroChartType _ChartType = eMicroChartType.Line;
///
/// Gets or sets the type of the chart rendered.
///
[DefaultValue(eMicroChartType.Line), Category("Appearance"), Description("Indicates type of the chart rendered.")]
public eMicroChartType ChartType
{
get { return _ChartType; }
set
{
if (value != _ChartType)
{
eMicroChartType oldValue = _ChartType;
_ChartType = value;
OnChartTypeChanged(oldValue, value);
}
}
}
private void OnChartTypeChanged(eMicroChartType oldValue, eMicroChartType newValue)
{
//OnPropertyChanged(new PropertyChangedEventArgs("ChartType"));
InvalidateChartImage(false);
}
///
/// Gets whether item supports text markup. Default is false.
///
protected override bool IsMarkupSupported
{
get { return _EnableMarkup; }
}
private bool _EnableMarkup = true;
///
/// Gets or sets whether text-markup support is enabled for items Text property. Default value is true.
/// Set this property to false to display HTML or other markup in the item instead of it being parsed as text-markup.
///
[DefaultValue(true), Category("Appearance"), Description("Indicates whether text-markup support is enabled for items Text property.")]
public bool EnableMarkup
{
get { return _EnableMarkup; }
set
{
if (_EnableMarkup != value)
{
_EnableMarkup = value;
NeedRecalcSize = true;
OnTextChanged();
}
}
}
private eMicroChartTextPosition _TextPosition = eMicroChartTextPosition.Left;
///
/// Gets or sets text-position in relation to the chart.
///
[DefaultValue(eMicroChartTextPosition.Left), Category("Appearance"), Description("Indicates text-position in relation to the chart.")]
public eMicroChartTextPosition TextPosition
{
get { return _TextPosition; }
set
{
if (value != _TextPosition)
{
eMicroChartTextPosition oldValue = _TextPosition;
_TextPosition = value;
OnTextPositionChanged(oldValue, value);
}
}
}
private void OnTextPositionChanged(eMicroChartTextPosition oldValue, eMicroChartTextPosition newValue)
{
//OnPropertyChanged(new PropertyChangedEventArgs("TextPosition"));
NeedRecalcSize = true;
this.Refresh();
}
///
/// Gets or sets the text associated with this item.
///
[System.ComponentModel.Browsable(true), Editor("DevComponents.DotNetBar.Design.TextMarkupUIEditor, DevComponents.DotNetBar.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=90f470f34c89ccaf", typeof(System.Drawing.Design.UITypeEditor)), System.ComponentModel.Category("Appearance"), System.ComponentModel.Description("The text contained in the item."), System.ComponentModel.Localizable(true), System.ComponentModel.DefaultValue("")]
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
}
private bool _TextVisible = true;
///
/// Gets or sets whether caption/label set using Text property is visible.
///
[DefaultValue(true), Category("Appearance"), Description("Indicates whether caption/label set using Text property is visible.")]
public bool TextVisible
{
get { return _TextVisible; }
set
{
_TextVisible = value;
NeedRecalcSize = true;
this.Refresh();
}
}
private Padding _TextPadding = new Padding(0, 0, 0, 0);
///
/// Gets or sets text padding.
///
[Browsable(true), Category("Appearance"), Description("Gets or sets text padding."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Padding TextPadding
{
get { return _TextPadding; }
}
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeTextPadding()
{
return _TextPadding.Bottom != 0 || _TextPadding.Top != 0 || _TextPadding.Left != 0 || _TextPadding.Right != 0;
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void ResetTextPadding()
{
_TextPadding = new Padding(0, 0, 0, 0);
}
private void TextPaddingPropertyChanged(object sender, PropertyChangedEventArgs e)
{
NeedRecalcSize = true;
this.Refresh();
}
private Padding _Margin = new Padding(0, 0, 0, 0);
///
/// Gets or sets switch margin.
///
[Browsable(true), Category("Appearance"), Description("Gets or sets switch margin."), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Padding Margin
{
get { return _Margin; }
}
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeMargin()
{
return _Margin.Bottom != 0 || _Margin.Top != 0 || _Margin.Left != 0 || _Margin.Right != 0;
}
[EditorBrowsable(EditorBrowsableState.Never)]
private void ResetMargin()
{
_Margin = new Padding(0, 0, 0, 0);
}
private void MarginPropertyChanged(object sender, PropertyChangedEventArgs e)
{
NeedRecalcSize = true;
this.Refresh();
}
private Color _TextColor = Color.Empty;
///
/// Gets or sets the text color.
///
[Category("Appearance"), Description("Indicates text color.")]
public Color TextColor
{
get { return _TextColor; }
set { _TextColor = value; }
}
///
/// Gets whether property should be serialized.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeTextColor()
{
return !_TextColor.IsEmpty;
}
///
/// Resets property to its default value.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public void ResetTextColor()
{
this.TextColor = Color.Empty;
}
private eBackgroundImagePosition _BackgroundImagePosition = eBackgroundImagePosition.Tile;
///
/// Gets or sets the background image position
///
[Browsable(true), Category("Appearance"), DefaultValue(eBackgroundImagePosition.Tile), Description("Specifies background image position")]
public eBackgroundImagePosition BackgroundImagePosition
{
get { return _BackgroundImagePosition; }
set
{
if (_BackgroundImagePosition != value)
{
_BackgroundImagePosition = value;
this.Refresh();
}
}
}
private Image _BackgroundImage = null;
///
/// Gets or sets the background image used by the control.
///
[Browsable(true), Category("Appearance"), DefaultValue(null), Description("Indicates background image used by the control.")]
public Image BackgroundImage
{
get { return _BackgroundImage; }
set
{
_BackgroundImage = value;
this.Refresh();
}
}
private double _DataMaxValue = double.NaN;
///
/// Gets or sets the maximum value for data points. By default maximum data point is calculated based on that data displayed by the chart, but when
/// two charts need to be scaled the same setting maximum and minimum values for them will ensure that scales are visually the same.
///
[DefaultValue(double.NaN), Category("Behavior"), Description("Indicates maximum value for data points. By default maximum data point is calculated based on that data displayed by the chart, but when two charts need to be scaled the same setting maximum and minimum values for them will ensure that scales are visually the same.")]
public double DataMaxValue
{
get { return _DataMaxValue; }
set
{
if (value != _DataMaxValue)
{
double oldValue = _DataMaxValue;
_DataMaxValue = value;
InvalidateChart(false);
this.Refresh();
OnDataMaxValueChanged(oldValue, value);
}
}
}
///
/// Called when DataMaxValue property has changed.
///
/// Old property value
/// New property value
protected virtual void OnDataMaxValueChanged(double oldValue, double newValue)
{
//OnPropertyChanged(new PropertyChangedEventArgs("DataMaxValue"));
}
private double _DataMinValue = double.NaN;
///
/// Gets or sets the minimum value for data points. By default minimum data point is calculated based on that data displayed by the chart, but when
/// two charts need to be scaled the same setting maximum and minimum values for them will ensure that scales are visually the same.
///
[DefaultValue(double.NaN), Category("Behavior"), Description("Indicates minimum value for data points. By default minimum data point is calculated based on that data displayed by the chart, but when two charts need to be scaled the same setting maximum and minimum values for them will ensure that scales are visually the same.")]
public double DataMinValue
{
get { return _DataMinValue; }
set
{
if (value != _DataMinValue)
{
double oldValue = _DataMinValue;
_DataMinValue = value;
InvalidateChart(false);
this.Refresh();
OnDataMinValueChanged(oldValue, value);
}
}
}
///
/// Called when DataMinValue property has changed.
///
/// Old property value
/// New property value
protected virtual void OnDataMinValueChanged(double oldValue, double newValue)
{
//OnPropertyChanged(new PropertyChangedEventArgs("DataMinValue"));
}
#endregion
#region IPersonalizedMenuItem Members
private eMenuVisibility _MenuVisibility = eMenuVisibility.VisibleAlways;
///
/// Indicates item's visibility when on pop-up menu.
///
[DefaultValue(eMenuVisibility.VisibleAlways), Browsable(true), DevCoBrowsable(true), System.ComponentModel.Category("Appearance"), System.ComponentModel.Description("Indicates item's visibility when on pop-up menu.")]
public eMenuVisibility MenuVisibility
{
get
{
return _MenuVisibility;
}
set
{
if (_MenuVisibility != value)
{
_MenuVisibility = value;
if (ShouldSyncProperties)
BarFunctions.SyncProperty(this, "MenuVisibility");
}
}
}
private bool _RecentlyUsed = false;
///
/// Indicates whether item was recently used.
///
[Browsable(false), DefaultValue(false)]
public bool RecentlyUsed
{
get
{
return _RecentlyUsed;
}
set
{
if (_RecentlyUsed != value)
{
_RecentlyUsed = value;
if (ShouldSyncProperties)
BarFunctions.SyncProperty(this, "RecentlyUsed");
}
}
}
#endregion
}
///
/// Represents MicroChart hot-points.
///
internal struct MicroChartHotPoint
{
public Rectangle HotPointBounds;
public Rectangle ChartSliceBounds;
public Color Color;
public double Value;
public static readonly MicroChartHotPoint Empty = new MicroChartHotPoint();
public int DataPointIndex;
///
/// Start angle for pie slice.
///
public double StartAngle;
///
/// Sweep angle for pie slice.
///
public double SweepAngle;
public bool IsEmpty
{
get
{
return this.HotPointBounds.IsEmpty;
}
}
///
/// Initializes a new instance of the MicroChartHotPoint structure.
///
///
///
public MicroChartHotPoint(Rectangle hotPoint, Color hotPointColor, double value, int dataPointIndex)
{
HotPointBounds = hotPoint;
Color = hotPointColor;
Value = value;
StartAngle = 0;
SweepAngle = 0;
ChartSliceBounds = Rectangle.Empty;
DataPointIndex = dataPointIndex;
}
///
/// Initializes a new instance of the MicroChartHotPoint structure.
///
///
///
///
///
public MicroChartHotPoint(Rectangle hotPointBounds, Rectangle chartSliceBounds, Color color, double value, int dataPointIndex)
{
HotPointBounds = hotPointBounds;
ChartSliceBounds = chartSliceBounds;
Color = color;
Value = value;
StartAngle = 0;
SweepAngle = 0;
DataPointIndex = dataPointIndex;
}
///
/// Initializes a new instance of the MicroChartHotPoint structure.
///
///
///
///
///
///
public MicroChartHotPoint(Rectangle bounds, Color color, double value, double startAngle, double sweepAngle, int dataPointIndex)
{
HotPointBounds = bounds;
Color = color;
Value = value;
StartAngle = startAngle;
SweepAngle = sweepAngle;
ChartSliceBounds = Rectangle.Empty;
DataPointIndex = dataPointIndex;
}
}
///
/// Defines available MicroChar types.
///
public enum eMicroChartType
{
///
/// Identifies Plot chart.
///
Plot,
///
/// Identifies WinLose chart.
///
WinLose,
///
/// Identifies Area chart.
///
Area,
///
/// Identifies Line chart.
///
Line,
///
/// Identifies Column chart.
///
Column,
///
/// Identifies Bar chart.
///
Bar,
///
/// Identifies Pie chart.
///
Pie,
///
/// Identifies 100% bar.
///
HundredPercentBar
}
///
/// Defines micro-chart text position in relation to the chart.
///
public enum eMicroChartTextPosition
{
///
/// Text is positioned to the left of the chart.
///
Left,
///
/// Text is positioned to the right of the chart.
///
Right,
///
/// Text is positioned on top of the chart.
///
Top,
///
/// Text is positioned on bottom of the chart.
///
Bottom
}
}