//The MIT License(MIT)
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
using System;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Windows.Controls;
using System.Windows.Forms.Integration;
using LiveCharts.Events;
using LiveCharts.Wpf;
namespace LiveCharts.WinForms
{
///
///
///
///
[Designer("System.Windows.Forms.Design.ControlDesigner, System.Design")]
[DesignerSerializer("System.ComponentModel.Design.Serialization.TypeCodeDomSerializer , System.Design", "System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design")]
public class PieChart : ElementHost
{
///
/// The WPF base
///
protected readonly Wpf.PieChart WpfBase = new Wpf.PieChart();
///
/// Initializes a new instance of the class.
///
public PieChart()
{
Child = WpfBase;
//workaround for windows 7 focus issue
//https://github.com/beto-rodriguez/Live-Charts/issues/515
HostContainer.MouseEnter += (sender, args) =>
{
Focus();
};
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
{
WpfBase.Series = WpfBase.GetDesignerModeCollection();
}
}
///
/// Occurs when the users clicks any point in the chart
///
public event DataClickHandler DataClick
{
add { WpfBase.DataClick += value; }
remove { WpfBase.DataClick += value; }
}
///
/// Occurs when the users hovers over any point in the chart
///
public event DataHoverHandler DataHover
{
add { WpfBase.DataHover += value; }
remove { WpfBase.DataHover += value; }
}
///
/// Occurs every time the chart updates
///
public event UpdaterTickHandler UpdaterTick
{
add { WpfBase.UpdaterTick += value; }
remove { WpfBase.UpdaterTick += value; }
}
#region ChartProperties
///
/// Gets or sets the axis y.
///
///
/// The axis y.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public AxesCollection AxisY
{
get { return WpfBase.AxisY; }
set { WpfBase.AxisY = value; }
}
///
/// Gets or sets the axis x.
///
///
/// The axis x.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public AxesCollection AxisX
{
get { return WpfBase.AxisX; }
set { WpfBase.AxisX = value; }
}
///
/// Gets or sets the default legend.
///
///
/// The default legend.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public UserControl DefaultLegend
{
get { return WpfBase.ChartLegend; }
set { WpfBase.ChartLegend = value; }
}
///
/// Gets or sets the zoom.
///
///
/// The zoom.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public ZoomingOptions Zoom
{
get { return WpfBase.Zoom; }
set { WpfBase.Zoom = value; }
}
///
/// Gets or sets the legend location.
///
///
/// The legend location.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public LegendLocation LegendLocation
{
get { return WpfBase.LegendLocation; }
set { WpfBase.LegendLocation = value; }
}
///
/// Gets or sets the series.
///
///
/// The series.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public SeriesCollection Series
{
get { return WpfBase.Series; }
set { WpfBase.Series = value; }
}
///
/// Gets or sets the animations speed.
///
///
/// The animations speed.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public TimeSpan AnimationsSpeed
{
get { return WpfBase.AnimationsSpeed; }
set { WpfBase.AnimationsSpeed = value; }
}
///
/// Gets or sets a value indicating whether [disable animations].
///
///
/// true if [disable animations]; otherwise, false.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool DisableAnimations
{
get { return WpfBase.DisableAnimations; }
set { WpfBase.DisableAnimations = value; }
}
///
/// Gets or sets the data tooltip.
///
///
/// The data tooltip.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public UserControl DataTooltip
{
get { return WpfBase.DataTooltip; }
set { WpfBase.DataTooltip = value; }
}
#endregion
#region ThisChartProperties
///
/// Gets or sets the inner radius.
///
///
/// The inner radius.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double InnerRadius
{
get { return WpfBase.InnerRadius; }
set { WpfBase.InnerRadius = value; }
}
///
/// Gets or sets the starting rotation angle.
///
///
/// The starting rotation angle.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double StartingRotationAngle
{
get { return WpfBase.StartingRotationAngle; }
set { WpfBase.StartingRotationAngle = value; }
}
///
/// Gets or sets the state of the updater.
///
///
/// The state of the updater.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public UpdaterState UpdaterState
{
get { return WpfBase.UpdaterState; }
set { WpfBase.UpdaterState = value; }
}
///
/// Gets or sets the units that a slice is pushed out when a user moves the mouse over data point.
///
///
/// The hover push out.
///
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double HoverPushOut
{
get { return WpfBase.HoverPushOut; }
set { WpfBase.HoverPushOut = value; }
}
#endregion
#region Methods
///
/// Updates the specified restart view.
///
/// if set to true [restart view].
/// if set to true [force].
public void Update(bool restartView, bool force)
{
WpfBase.Update(restartView, force);
}
#endregion
}
}