/*
Copyright (C) 2008 Webyog Softworks Private Limited
This file is a part of Visifire Charts.
Visifire is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
You should have received a copy of the GNU General Public License
along with Visifire Charts. If not, see .
If GPL is not suitable for your products or company, Webyog provides Visifire
under a flexible commercial license designed to meet your specific usage and
distribution requirements. If you have already obtained a commercial license
from Webyog, you can use this file under those license terms.
*/
#if WPF
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Collections.ObjectModel;
using System.Windows.Media.Animation;
#else
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Collections.Generic;
using System.Windows.Markup;
using System.Collections.ObjectModel;
#endif
using System.Windows.Shapes;
using Visifire.Commons;
using System.Windows.Data;
namespace Visifire.Charts
{
///
/// Visifire.Charts.DataSeries class
///
#if SL
[System.Windows.Browser.ScriptableType]
#endif
public class DataSeries : ObservableObject
{
#region Public Methods
///
/// Initializes a new instance of the Visifire.Charts.DataSeries class
///
public DataSeries()
{
ToolTipText = "";
IsZIndexSet = false;
// Apply default style from generic
#if WPF
if (!_defaultStyleKeyApplied)
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(DataSeries), new FrameworkPropertyMetadata(typeof(DataSeries)));
_defaultStyleKeyApplied = true;
}
#else
DefaultStyleKey = typeof(DataSeries);
#endif
// Initialize DataPoints list
DataPoints = new DataPointCollection();
// Initialize InternalDataPoints list
InternalDataPoints = new List();
// Attach event handler for the Title collection changed event
DataPoints.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(DataPoints_CollectionChanged);
}
public override void Bind()
{
#if SL
Binding b = new Binding("BorderThickness");
b.Source = this;
this.SetBinding(InternalBorderThicknessProperty, b);
b = new Binding("Opacity");
b.Source = this;
this.SetBinding(InternalOpacityProperty, b);
#endif
}
#endregion
#region Public Properties
///
/// Identifies the Visifire.Charts.DataPoint.MinPointHeight dependency property.
///
///
/// The identifier for the Visifire.Charts.DataPoint.MinPointHeight dependency property.
///
public static readonly DependencyProperty MinPointHeightProperty = DependencyProperty.Register
("MinPointHeight",
typeof(Double),
typeof(DataSeries),
new PropertyMetadata(Double.NaN, OnMinPointHeightPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.MovingMarkerEnabled dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.MovingMarkerEnabled dependency property.
///
public static readonly DependencyProperty MovingMarkerEnabledProperty = DependencyProperty.Register
("MovingMarkerEnabled",
typeof(Boolean),
typeof(DataSeries),
new PropertyMetadata(false, OnMovingMarkerEnabledPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.Exploded dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.Exploded dependency property.
///
public static readonly DependencyProperty ExplodedProperty = DependencyProperty.Register
("Exploded",
typeof(Boolean),
typeof(DataSeries),
new PropertyMetadata(OnExplodedPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.Enabled dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.Enabled dependency property.
///
public static readonly DependencyProperty EnabledProperty = DependencyProperty.Register
("Enabled",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnEnabledPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.RenderAs dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.RenderAs dependency property.
///
public static readonly DependencyProperty RenderAsProperty = DependencyProperty.Register
("RenderAs",
typeof(RenderAs),
typeof(DataSeries),
new PropertyMetadata(OnRenderAsPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.HrefTarget dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.HrefTarget dependency property.
///
public static readonly DependencyProperty HrefTargetProperty = DependencyProperty.Register
("HrefTarget",
typeof(HrefTargets),
typeof(DataSeries),
new PropertyMetadata(OnHrefTargetChanged));
///
/// Identifies the Visifire.Charts.DataSeries.Href dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.Href dependency property.
///
public static readonly DependencyProperty HrefProperty = DependencyProperty.Register
("Href",
typeof(String),
typeof(DataSeries),
new PropertyMetadata(OnHrefChanged));
///
/// Identifies the Visifire.Charts.DataSeries.Color dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.Color dependency property.
///
public static readonly DependencyProperty ColorProperty = DependencyProperty.Register
("Color",
typeof(Brush),
typeof(DataSeries),
new PropertyMetadata(OnColorPropertyChanged));
public static readonly DependencyProperty PriceUpColorProperty = DependencyProperty.Register
("PriceUpColor",
typeof(Brush),
typeof(DataSeries),
new PropertyMetadata(OnPriceUpColorPropertyChanged));
public static readonly DependencyProperty PriceDownColorProperty = DependencyProperty.Register
("PriceDownColor",
typeof(Brush),
typeof(DataSeries),
new PropertyMetadata(OnPriceDownColorPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LightingEnabled dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LightingEnabled dependency property.
///
public static readonly DependencyProperty LightingEnabledProperty = DependencyProperty.Register
("LightingEnabled",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnLightingEnabledPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.ShadowEnabled dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.ShadowEnabled dependency property.
///
public static readonly DependencyProperty ShadowEnabledProperty = DependencyProperty.Register
("ShadowEnabled",
typeof(Boolean),
typeof(DataSeries),
new PropertyMetadata(OnShadowEnabledPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LegendText dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LegendText dependency property.
///
public static readonly DependencyProperty LegendTextProperty = DependencyProperty.Register
("LegendText",
typeof(String),
typeof(DataSeries),
new PropertyMetadata(OnLegendTextPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.Legend dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.Legend dependency property.
///
public static readonly DependencyProperty LegendProperty = DependencyProperty.Register
("Legend",
typeof(String),
typeof(DataSeries),
new PropertyMetadata(OnLegendPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.Bevel dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.Bevel dependency property.
///
public static readonly DependencyProperty BevelProperty = DependencyProperty.Register
("Bevel",
typeof(Boolean),
typeof(DataSeries),
new PropertyMetadata(OnBevelPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.ColorSet dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.ColorSet dependency property.
///
public static readonly DependencyProperty ColorSetProperty = DependencyProperty.Register
("ColorSet",
typeof(String),
typeof(DataSeries),
new PropertyMetadata(OnColorSetPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.RadiusX dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.RadiusX dependency property.
///
public static readonly DependencyProperty RadiusXProperty = DependencyProperty.Register
("RadiusX",
typeof(CornerRadius),
typeof(DataSeries),
new PropertyMetadata(OnRadiusXPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.RadiusY dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.RadiusY dependency property.
///
public static readonly DependencyProperty RadiusYProperty = DependencyProperty.Register
("RadiusY",
typeof(CornerRadius),
typeof(DataSeries),
new PropertyMetadata(OnRadiusYPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LineThickness dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LineThickness dependency property.
///
public static readonly DependencyProperty LineThicknessProperty = DependencyProperty.Register
("LineThickness",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnLineThicknessPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LineStyle dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LineStyle dependency property.
///
public static readonly DependencyProperty LineStyleProperty = DependencyProperty.Register
("LineStyle",
typeof(LineStyles),
typeof(DataSeries),
new PropertyMetadata(OnLineStylePropertyChanged));
#if WPF
///
/// Identifies the Visifire.Charts.DataSeries.Opacity dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.Opacity dependency property.
///
public new static readonly DependencyProperty OpacityProperty = DependencyProperty.Register
("Opacity",
typeof(Double),
typeof(DataSeries),
new PropertyMetadata(1.0, OnOpacityPropertyChanged));
#endif
///
/// Identifies the Visifire.Charts.DataSeries.ShowInLegend dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.ShowInLegend dependency property.
///
public static readonly DependencyProperty ShowInLegendProperty = DependencyProperty.Register
("ShowInLegend",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnShowInLegendPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelEnabled dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelEnabled dependency property.
///
public static readonly DependencyProperty LabelEnabledProperty = DependencyProperty.Register
("LabelEnabled",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnLabelEnabledPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelText dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelText dependency property.
///
public static readonly DependencyProperty LabelTextProperty = DependencyProperty.Register
("LabelText",
typeof(String),
typeof(DataSeries),
new PropertyMetadata(OnLabelTextPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelFontFamily dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelFontFamily dependency property.
///
public static readonly DependencyProperty LabelFontFamilyProperty = DependencyProperty.Register
("LabelFontFamily",
typeof(FontFamily),
typeof(DataSeries),
new PropertyMetadata(OnLabelFontFamilyPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelFontSize dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelFontSize dependency property.
///
public static readonly DependencyProperty LabelFontSizeProperty = DependencyProperty.Register
("LabelFontSize",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnLabelFontSizePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelFontColor dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelFontColordependency property.
///
public static readonly DependencyProperty LabelFontColorProperty = DependencyProperty.Register
("LabelFontColor",
typeof(Brush),
typeof(DataSeries),
new PropertyMetadata(OnLabelFontColorPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelFontWeight dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelFontWeight dependency property.
///
public static readonly DependencyProperty LabelFontWeightProperty = DependencyProperty.Register
("LabelFontWeight",
typeof(FontWeight),
typeof(DataSeries),
new PropertyMetadata(OnLabelFontWeightPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelFontStyle dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelFontStyle dependency property.
///
public static readonly DependencyProperty LabelFontStyleProperty = DependencyProperty.Register
("LabelFontStyle",
typeof(FontStyle),
typeof(DataSeries),
new PropertyMetadata(OnLabelFontStylePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelBackground dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelBackground dependency property.
///
public static readonly DependencyProperty LabelBackgroundProperty = DependencyProperty.Register
("LabelBackground",
typeof(Brush),
typeof(DataSeries),
new PropertyMetadata(OnLabelBackgroundPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelStyle dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelStyle dependency property.
///
public static readonly DependencyProperty LabelStyleProperty = DependencyProperty.Register
("LabelStyle",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnLabelStylePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelLineEnabled dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelLineEnabled dependency property.
///
public static readonly DependencyProperty LabelLineEnabledProperty = DependencyProperty.Register
("LabelLineEnabled",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnLabelLineEnabledPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelLineColor dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelLineColor dependency property.
///
public static readonly DependencyProperty LabelLineColorProperty = DependencyProperty.Register
("LabelLineColor",
typeof(Brush),
typeof(DataSeries),
new PropertyMetadata(OnLabelLineColorPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelLineThickness dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelLineThickness dependency property.
///
public static readonly DependencyProperty LabelLineThicknessProperty = DependencyProperty.Register
("LabelLineThickness",
typeof(Double),
typeof(DataSeries),
new PropertyMetadata(OnLabelLineThicknessPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelLineStyle dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelLineStyle dependency property.
///
public static readonly DependencyProperty LabelLineStyleProperty = DependencyProperty.Register
("LabelLineStyle",
typeof(LineStyles),
typeof(DataSeries),
new PropertyMetadata(OnLabelLineStylePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.LabelAngle dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.LabelAngle dependency property.
///
public static readonly DependencyProperty LabelAngleProperty = DependencyProperty.Register
("LabelAngle",
typeof(Double),
typeof(DataSeries),
new PropertyMetadata(Double.NaN, OnLabelAnglePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.MarkerEnabled dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.MarkerEnabled dependency property.
///
public static readonly DependencyProperty MarkerEnabledProperty = DependencyProperty.Register
("MarkerEnabled",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnMarkerEnabledPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.MarkerType dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.MarkerType dependency property.
///
public static readonly DependencyProperty MarkerTypeProperty = DependencyProperty.Register
("MarkerType",
typeof(MarkerTypes),
typeof(DataSeries),
new PropertyMetadata(OnMarkerTypePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.MarkerBorderThickness dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.MarkerBorderThickness dependency property.
///
public static readonly DependencyProperty MarkerBorderThicknessProperty = DependencyProperty.Register
("MarkerBorderThickness",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnMarkerBorderThicknessPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.MarkerBorderColor dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.MarkerBorderColor dependency property.
///
public static readonly DependencyProperty MarkerBorderColorProperty = DependencyProperty.Register
("MarkerBorderColor",
typeof(Brush),
typeof(DataSeries),
new PropertyMetadata(OnMarkerBorderColorPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.MarkerSize dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.MarkerSize dependency property.
///
public static readonly DependencyProperty MarkerSizeProperty = DependencyProperty.Register
("MarkerSize",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnMarkerSizePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.MarkerColor dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.MarkerColor dependency property.
///
public static readonly DependencyProperty MarkerColorProperty = DependencyProperty.Register
("MarkerColor",
typeof(Brush),
typeof(DataSeries),
new PropertyMetadata(OnMarkerColorPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.MarkerScale dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.MarkerScale dependency property.
///
public static readonly DependencyProperty MarkerScaleProperty = DependencyProperty.Register
("MarkerScale",
typeof(Nullable),
typeof(DataSeries),
new PropertyMetadata(OnMarkerScalePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.StartAngle dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.StartAngle dependency property.
///
public static readonly DependencyProperty StartAngleProperty = DependencyProperty.Register
("StartAngle",
typeof(Double),
typeof(DataSeries),
new PropertyMetadata(OnStartAnglePropertyChanged));
#if WPF
///
/// Identifies the Visifire.Charts.DataSeries.BorderThickness dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.BorderThickness dependency property.
///
public new static readonly DependencyProperty BorderThicknessProperty = DependencyProperty.Register
("BorderThickness",
typeof(Thickness),
typeof(DataSeries),
new PropertyMetadata(OnBorderThicknessPropertyChanged));
#endif
///
/// Identifies the Visifire.Charts.DataSeries.BorderColor dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.BorderColor dependency property.
///
public static readonly DependencyProperty BorderColorProperty = DependencyProperty.Register
("BorderColor",
typeof(Brush),
typeof(DataSeries),
new PropertyMetadata(OnBorderColorPropertychanged));
///
/// Identifies the Visifire.Charts.DataSeries.BorderStyle dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.BorderStyle dependency property.
///
public static readonly DependencyProperty BorderStyleProperty = DependencyProperty.Register
("BorderStyle",
typeof(BorderStyles),
typeof(DataSeries),
new PropertyMetadata(OnBorderStylePropertychanged));
///
/// Identifies the Visifire.Charts.DataSeries.XValueFormatString dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.XValueFormatString dependency property.
///
public static readonly DependencyProperty XValueFormatStringProperty = DependencyProperty.Register
("XValueFormatString",
typeof(String),
typeof(DataSeries),
new PropertyMetadata(OnXValueFormatStringPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.YValueFormatString dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.YValueFormatString dependency property.
///
public static readonly DependencyProperty YValueFormatStringProperty = DependencyProperty.Register
("YValueFormatString",
typeof(String),
typeof(DataSeries),
new PropertyMetadata(OnYValueFormatStringPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.ZValueFormatString dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.ZValueFormatString dependency property.
///
public static readonly DependencyProperty ZValueFormatStringProperty = DependencyProperty.Register
("ZValueFormatString",
typeof(String),
typeof(DataSeries),
new PropertyMetadata(OnZValueFormatStringPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.AxisXType dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.AxisXType dependency property.
///
public static readonly DependencyProperty AxisXTypeProperty = DependencyProperty.Register
("AxisXType",
typeof(AxisTypes),
typeof(DataSeries),
new PropertyMetadata(OnAxisXTypePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.AxisYType dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.AxisYType dependency property.
///
public static readonly DependencyProperty AxisYTypeProperty = DependencyProperty.Register
("AxisYType",
typeof(AxisTypes),
typeof(DataSeries),
new PropertyMetadata(OnAxisYTypePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.XValueType dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.XValueType dependency property.
///
public static readonly DependencyProperty XValueTypeProperty = DependencyProperty.Register
("XValueType",
typeof(ChartValueTypes),
typeof(DataSeries),
new PropertyMetadata(OnXValueTypePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.SelectionEnabled dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.SelectionEnabled dependency property.
///
public static readonly DependencyProperty SelectionEnabledProperty = DependencyProperty.Register
("SelectionEnabled",
typeof(Boolean),
typeof(DataSeries),
new PropertyMetadata(false, OnSelectionEnabledPropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.SelectionMode dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.SelectionMode dependency property.
///
public static readonly DependencyProperty SelectionModeProperty = DependencyProperty.Register
("SelectionMode",
typeof(SelectionModes),
typeof(DataSeries),
new PropertyMetadata(OnSelectionModePropertyChanged));
///
/// Identifies the Visifire.Charts.DataSeries.ZIndex dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.ZIndex dependency property.
///
public static readonly DependencyProperty ZIndexProperty = DependencyProperty.Register
("ZIndex",
typeof(Int32),
typeof(DataSeries),
new PropertyMetadata(OnZIndexPropertyChanged));
///
/// Get or set the MinPointHeight property.
/// Minimum height of a DataPoint having the minimum YValue in a DataSeries.
/// Currently MinPointHeight property is applicable for funnel chart only.
/// (Value is in percentage(%) of Height of PlotArea)
///
public Double MinPointHeight
{
get
{
return (Double)GetValue(MinPointHeightProperty);
}
set
{
SetValue(MinPointHeightProperty, value);
}
}
///
/// Get or set the MovingMarkerEnabled property.
/// Enables moving-marker over chart. Currently is applicable for Line chart only
///
public Boolean MovingMarkerEnabled
{
get
{
return (Boolean)GetValue(MovingMarkerEnabledProperty);
}
set
{
SetValue(MovingMarkerEnabledProperty, value);
}
}
///
/// Get or set the Exploded property. This is used in Pie/Doughnut/Funnel charts.
///
public Boolean Exploded
{
get
{
return (Boolean)GetValue(ExplodedProperty);
}
set
{
SetValue(ExplodedProperty, value);
}
}
///
/// Get or set ZIndex property
/// (Will be used to decide which series comes in front and which one goes back)
///
public Int32 ZIndex
{
get
{
return (Int32)GetValue(ZIndexProperty);
}
set
{
InternalZIndex = value;
SetValue(ZIndexProperty, value);
}
}
///
/// Enables or disables DataSeries
///
[System.ComponentModel.TypeConverter(typeof(NullableBoolConverter))]
public Nullable Enabled
{
get
{
if ((Nullable)GetValue(EnabledProperty) == null)
return true;
else
return (Nullable)GetValue(EnabledProperty);
}
set
{
SetValue(EnabledProperty, value);
}
}
///
/// Get or set the Opacity property
///
public new Double Opacity
{
get
{
return (Double)GetValue(OpacityProperty);
}
set
{
#if SL
if (Opacity != value)
{
InternalOpacity = value;
SetValue(OpacityProperty, value);
FirePropertyChanged("Opacity");
}
#else
SetValue(OpacityProperty, value);
#endif
}
}
///
/// Get or set the Cursor property
///
public new Cursor Cursor
{
get
{
return base.Cursor;
}
set
{
if (base.Cursor != value)
{
base.Cursor = value;
if (DataPoints != null)
{
foreach (DataPoint dp in DataPoints)
dp.SetCursor2DataPointVisualFaces();
}
else
FirePropertyChanged("Cursor");
}
}
}
///
/// Get or set the RenderAs property (Chart type)
///
public RenderAs RenderAs
{
get
{
return (RenderAs)GetValue(RenderAsProperty);
}
set
{
SetValue(RenderAsProperty, value);
}
}
///
/// Get or set the HrefTarget property
///
public HrefTargets HrefTarget
{
get
{
return (HrefTargets)GetValue(HrefTargetProperty);
}
set
{
SetValue(HrefTargetProperty, value);
}
}
///
///Get or set the Href property
///
public String Href
{
get
{
return (String) GetValue(HrefProperty);
}
set
{
SetValue(HrefProperty, value);
}
}
///
/// Get or set the Color property
///
public Brush Color
{
get
{
if(((Brush)GetValue(DataSeries.ColorProperty) == null))
return _internalColor;
else
return (Brush)GetValue(ColorProperty);
}
set
{
SetValue(ColorProperty, value);
}
}
///
/// Get or set the Color property
///
public Brush PriceUpColor
{
get
{
//if (((Brush)GetValue(DataSeries.PriceUpColorProperty) == null))
// return new SolidColorBrush(new Color() { A = 255, R = 168, G = 212, B = 79 });
//else
return (Brush)GetValue(PriceUpColorProperty);
}
set
{
SetValue(PriceUpColorProperty, value);
}
}
///
/// Get or set the Color property
///
public Brush PriceDownColor
{
get
{
if (((Brush)GetValue(DataSeries.PriceDownColorProperty) == null))
return Graphics.RED_BRUSH;
else
return (Brush)GetValue(PriceDownColorProperty);
}
set
{
SetValue(PriceDownColorProperty, value);
}
}
///
/// Get or set the LightingEnabled property
///
[System.ComponentModel.TypeConverter(typeof(NullableBoolConverter))]
public Nullable LightingEnabled
{
get
{
if ((Nullable)GetValue(LightingEnabledProperty) == null)
{
if (this.RenderAs == RenderAs.Bubble)
return true;
else
return false;
}
else
return (Nullable)GetValue(LightingEnabledProperty);
}
set
{
SetValue(LightingEnabledProperty, value);
}
}
///
/// Get or set the ShadowEnabled property
///
public Boolean ShadowEnabled
{
get
{
return (Boolean)GetValue(ShadowEnabledProperty);
}
set
{
SetValue(ShadowEnabledProperty, value);
}
}
///
/// Get or set the LegendText property
///
public String LegendText
{
get
{
return (String)GetValue(LegendTextProperty);
}
set
{
SetValue(LegendTextProperty, value);
}
}
///
/// Get or set the Legend (Legend Name) for the DataSeries
///
public String Legend
{
get
{
return (String.IsNullOrEmpty((String)GetValue(LegendProperty))? "Legend0": (String)GetValue(LegendProperty));
}
set
{
SetValue(LegendProperty, value);
}
}
///
/// Get or set the Bevel property for bevel effect
///
public Boolean Bevel
{
get
{
return (Boolean)GetValue(BevelProperty);
}
set
{
SetValue(BevelProperty, value);
}
}
///
/// Get or set the ColorSet property
///
public String ColorSet
{
get
{
return (String)GetValue(ColorSetProperty);
}
set
{
SetValue(ColorSetProperty, value);
}
}
///
/// Get or set the RadiusX property
///
#if WPF
[System.ComponentModel.TypeConverter(typeof(System.Windows.CornerRadiusConverter))]
#endif
public CornerRadius RadiusX
{
get
{
return (CornerRadius)GetValue(RadiusXProperty);
}
set
{
SetValue(RadiusXProperty, value);
}
}
///
/// Get or set the RadiusY property
///
#if WPF
[System.ComponentModel.TypeConverter(typeof(System.Windows.CornerRadiusConverter))]
#endif
public CornerRadius RadiusY
{
get
{
return (CornerRadius)GetValue(RadiusYProperty);
}
set
{
SetValue(RadiusYProperty, value);
}
}
///
/// Get or set the LineThickness property
///
#if SL
[System.ComponentModel.TypeConverter(typeof(Converters.NullableDoubleConverter))]
#endif
public Nullable LineThickness
{
get
{
if ((Nullable)GetValue(LineThicknessProperty) == null)
{
if (RenderAs == RenderAs.Line)
{
Double retValue = (Double) (((Chart as Chart).ActualWidth * (Chart as Chart).ActualHeight) + 25000) / 35000;
return retValue > 4 ? 4 : retValue;
}
else if (RenderAs == RenderAs.Stock)
return 2;
else
return (Double)(((Chart as Chart).ActualWidth * (Chart as Chart).ActualHeight) + 25000) / 70000;
}
else
return (Nullable)GetValue(LineThicknessProperty);
}
set
{
SetValue(LineThicknessProperty, value);
}
}
///
/// Get or set the LineStyle property
///
public LineStyles LineStyle
{
get
{
return (LineStyles)GetValue(LineStyleProperty);
}
set
{
SetValue(LineStyleProperty, value);
}
}
///
/// Get or set the ShowInLegend property
///
[System.ComponentModel.TypeConverter(typeof(NullableBoolConverter))]
public Nullable ShowInLegend
{
get
{
if ((Nullable)GetValue(ShowInLegendProperty) == null)
{
if ((Chart as Chart).Series.Count > 1)
return true;
else
return false;
}
else
return (Nullable)GetValue(ShowInLegendProperty);
}
set
{
SetValue(ShowInLegendProperty, value);
}
}
#region Label Properties
///
/// Get or set the LabelEnabled property
///
[System.ComponentModel.TypeConverter(typeof(NullableBoolConverter))]
public Nullable LabelEnabled
{
get
{
if (GetValue(LabelEnabledProperty) == null)
{
switch(RenderAs)
{
case RenderAs.Pie:
case RenderAs.Doughnut:
case RenderAs.SectionFunnel:
case RenderAs.StreamLineFunnel:
return true;
default:
return false;
}
}
else
return (Nullable)GetValue(LabelEnabledProperty);
}
set
{
SetValue(LabelEnabledProperty, value);
}
}
///
/// Get or set the LabelAngle property
///
public Double LabelAngle
{
get
{
return (Double)GetValue(LabelAngleProperty);
}
set
{
if (value > 90 || value < -90)
throw (new Exception("Invalid property value:: LabelAngle should be greater than -90 and less than 90."));
SetValue(LabelAngleProperty, value);
}
}
///
/// Get or set the LabelText property
///
public String LabelText
{
get
{
if (String.IsNullOrEmpty((String)GetValue(LabelTextProperty)))
{
if (RenderAs == RenderAs.Doughnut || RenderAs == RenderAs.Pie || RenderAs == RenderAs.StreamLineFunnel)
{
return "#AxisXLabel, #YValue";
}
else if(RenderAs == RenderAs.Stock || RenderAs == RenderAs.CandleStick)
{
return "#Close";
}
else
{
return "#YValue";
}
}
else
return (String)GetValue(LabelTextProperty);
}
set
{
SetValue(LabelTextProperty, value);
}
}
///
/// Get or set the LabelFontFamily property
///
public FontFamily LabelFontFamily
{
get
{
if (GetValue(LabelFontFamilyProperty) == null)
return new FontFamily("Verdana");
else
return (FontFamily)GetValue(LabelFontFamilyProperty);
}
set
{
SetValue(LabelFontFamilyProperty, value);
}
}
///
/// Get or set the LabelFontSize property
///
#if SL
[System.ComponentModel.TypeConverter(typeof(Converters.NullableDoubleConverter))]
#endif
public Nullable LabelFontSize
{
get
{
if ((Nullable)GetValue(LabelFontSizeProperty) == null)
return 10;
else
return (Nullable)GetValue(LabelFontSizeProperty);
}
set
{
SetValue(LabelFontSizeProperty, value);
}
}
///
/// Get or set the LabelFontColor property
///
public Brush LabelFontColor
{
get
{
return (Brush)GetValue(LabelFontColorProperty);
}
set
{
SetValue(LabelFontColorProperty, value);
}
}
///
/// Get or set the LabelFontWeight property
///
#if SL
[System.ComponentModel.TypeConverter(typeof(Visifire.Commons.Converters.FontWeightConverter))]
#endif
public FontWeight LabelFontWeight
{
get
{
return (FontWeight)GetValue(LabelFontWeightProperty);
}
set
{
SetValue(LabelFontWeightProperty, value);
}
}
///
/// Get or set the LabelFontStyle property
///
#if SL
[System.ComponentModel.TypeConverter(typeof(Visifire.Commons.Converters.FontStyleConverter))]
#endif
public FontStyle LabelFontStyle
{
get
{
return (FontStyle)GetValue(LabelFontStyleProperty);
}
set
{
SetValue(LabelFontStyleProperty, value);
}
}
///
/// Get or set the LabelBackground property
///
public Brush LabelBackground
{
get
{
if (GetValue(LabelBackgroundProperty) != null)
return (Brush)GetValue(LabelBackgroundProperty);
else
return null;
}
set
{
SetValue(LabelBackgroundProperty, value);
}
}
///
/// Get or set the LabelStyle property
///
#if SL
[System.ComponentModel.TypeConverter(typeof(Converters.NullableLabelStylesConverter))]
#endif
public Nullable LabelStyle
{
get
{
if ((Nullable)GetValue(LabelStyleProperty) == null)
{
switch (RenderAs)
{
case RenderAs.StackedColumn100:
case RenderAs.StackedBar100:
case RenderAs.StackedArea100:
return LabelStyles.Inside;
default:
return LabelStyles.OutSide;
}
}
else
{
IsLabelStyleSet = true;
return (Nullable)GetValue(LabelStyleProperty);
}
}
set
{
SetValue(LabelStyleProperty, value);
}
}
///
/// Get or set the LabelLineEnabled property
///
[System.ComponentModel.TypeConverter(typeof(NullableBoolConverter))]
public NullableLabelLineEnabled
{
get
{
//if ((Boolean)LabelEnabled)
return (Nullable)GetValue(LabelLineEnabledProperty);
//return false;
}
set
{
SetValue(LabelLineEnabledProperty, value);
}
}
///
/// Get or set the LabelLineColor property
///
public Brush LabelLineColor
{
get
{
if (GetValue(LabelLineColorProperty) != null)
return (Brush)GetValue(LabelLineColorProperty);
else
return new SolidColorBrush(Colors.Gray);
}
set
{
SetValue(LabelLineColorProperty, value);
}
}
///
/// Get or set the LabelLineThickness property
///
public Double LabelLineThickness
{
get
{
return (Double)GetValue(LabelLineThicknessProperty);
}
set
{
SetValue(LabelLineThicknessProperty, value);
}
}
///
/// Get or set the LabelLineStyle property
///
public LineStyles LabelLineStyle
{
get
{
return (LineStyles)GetValue(LabelLineStyleProperty);
}
set
{
SetValue(LabelLineStyleProperty, value);
}
}
#endregion
#region Marker Properties
///
/// Get or set the MarkerEnabled property
///
[System.ComponentModel.TypeConverter(typeof(NullableBoolConverter))]
public Nullable MarkerEnabled
{
get
{
if (this.RenderAs == RenderAs.Line || this.RenderAs == RenderAs.Point)
return ((Nullable)GetValue(MarkerEnabledProperty) == null) ? true : (Nullable)GetValue(MarkerEnabledProperty);
else
return ((Nullable)GetValue(MarkerEnabledProperty) == null) ? false : (Nullable)GetValue(MarkerEnabledProperty);
}
set
{
SetValue(MarkerEnabledProperty, value);
}
}
///
/// Get or set the MarkerStyle property
///
public MarkerTypes MarkerType
{
get
{
return (MarkerTypes)GetValue(MarkerTypeProperty);
}
set
{
SetValue(MarkerTypeProperty, value);
}
}
///
/// Sets the MarkerBorderThickness property
///
#if SL
[System.ComponentModel.TypeConverter(typeof(Converters.NullableThicknessConverter))]
#endif
public NullableMarkerBorderThickness
{
get
{
return (Nullable)GetValue(MarkerBorderThicknessProperty);
}
set
{
SetValue(MarkerBorderThicknessProperty, value);
}
}
///
/// Get or set the MarkerBorderColor property
///
public Brush MarkerBorderColor
{
get
{
return (Brush)GetValue(MarkerBorderColorProperty);
}
set
{
SetValue(MarkerBorderColorProperty, value);
}
}
///
/// Get or set the MarkerSize property
///
#if SL
[System.ComponentModel.TypeConverter(typeof(Converters.NullableDoubleConverter))]
#endif
public Nullable MarkerSize
{
get
{
if ((Nullable)GetValue(MarkerSizeProperty) == null)
if (this.RenderAs == RenderAs.Line)
return (this.LineThickness * 2);
else
return 8;
else
return (Nullable)GetValue(MarkerSizeProperty);
}
set
{
SetValue(MarkerSizeProperty, value);
}
}
///
/// Get or set the MarkerColor property
///
public Brush MarkerColor
{
get
{
return (Brush)GetValue(MarkerColorProperty);
}
set
{
SetValue(MarkerColorProperty, value);
}
}
///
/// Get or set MarkerScale property
///
#if SL
[System.ComponentModel.TypeConverter(typeof(Converters.NullableDoubleConverter))]
#endif
public Nullable MarkerScale
{
get
{
if ((Nullable)GetValue(MarkerScaleProperty) == null)
{
if (RenderAs == RenderAs.Bubble)
{
Double x = Math.Abs(Chart.ActualHeight - Chart.ActualWidth);
x = x / 100;
return 2 + Math.Sqrt(x);
}
else
return 1;
}
else
return (Nullable)GetValue(MarkerScaleProperty);
}
set
{
SetValue(MarkerScaleProperty, value);
}
}
#endregion Marker Properties
///
/// Get or set ZIndex property
/// (Will be used to decide which series comes in front and which one goes back)
///
internal Int32 InternalZIndex
{
get;
set;
}
internal Boolean IsZIndexSet
{
get;
set;
}
///
/// Get or set the Internal Start angle property
///
internal Double InternalStartAngle
{
get
{
return (StartAngle % 360) * (Math.PI / 180);
}
}
///
/// Get or set the StartAngle property.
/// This property is generally used in Pie/Doughnut.
///
public Double StartAngle
{
get
{
return (Double)GetValue(StartAngleProperty);
}
set
{
if(value < 0 || value > 360)
throw (new Exception("Invalid property value:: StartAngle should be greater than 0 and less than 360."));
SetValue(StartAngleProperty, value);
}
}
#region BorderProperties
///
/// Get or set the BorderThickness property
///
public new Thickness BorderThickness
{
get
{
Thickness retVal = (Thickness)GetValue(BorderThicknessProperty);
if (retVal == new Thickness(0) && RenderAs == RenderAs.Stock)
return new Thickness(2);
else
return (Thickness)GetValue(BorderThicknessProperty);
}
set
{
#if SL
if (BorderThickness != value)
{
InternalBorderThickness = value;
SetValue(BorderThicknessProperty, value);
FirePropertyChanged("BorderThickness");
}
#else
SetValue(BorderThicknessProperty, value);
#endif
}
}
///
/// Get or set the BorderColor property
///
public Brush BorderColor
{
get
{
if (GetValue(BorderColorProperty) == null)
{
if (RenderAs == RenderAs.CandleStick)
return (Brush)GetValue(BorderColorProperty);
else
return Graphics.BLACK_BRUSH;
}
else
return (Brush)GetValue(BorderColorProperty);
}
set
{
SetValue(BorderColorProperty, value);
}
}
///
/// Get or set the BorderStyle property
///
public BorderStyles BorderStyle
{
get
{
return (BorderStyles)GetValue(BorderStyleProperty);
}
set
{
SetValue(BorderStyleProperty, value);
}
}
#endregion
///
/// Get or set the XValueFormatString property
///
public String XValueFormatString
{
get
{
return (String)GetValue(XValueFormatStringProperty);
}
set
{
SetValue(XValueFormatStringProperty, value);
}
}
///
/// Get or set the YValueFormatString property
///
public String YValueFormatString
{
get
{
return (String)GetValue(YValueFormatStringProperty);
}
set
{
SetValue(YValueFormatStringProperty, value);
}
}
///
/// Get or set the ZValueFormatString property
///
public String ZValueFormatString
{
get
{
if (String.IsNullOrEmpty((String)GetValue(ZValueFormatStringProperty)))
return "###,##0.##";
else
return (String)GetValue(ZValueFormatStringProperty);
}
set
{
SetValue(ZValueFormatStringProperty, value);
}
}
///
/// Get or set the ToolTipText property for the DataSeries
///
public override String ToolTipText
{
get
{
if ((Chart != null && !String.IsNullOrEmpty((Chart as Chart).ToolTipText)))
return null;
if (String.IsNullOrEmpty((String)GetValue(ToolTipTextProperty)))
{
if (GetValue(ToolTipTextProperty) == null)
return null;
Chart chart = Chart as Chart;
switch (RenderAs)
{
case RenderAs.StackedColumn100:
case RenderAs.StackedBar100:
case RenderAs.StackedArea100:
if (chart.ChartArea.AxisX != null && chart.ChartArea.AxisX.XValueType != ChartValueTypes.Numeric)
return "#XValue, #YValue(#Sum)";
else
return "#AxisXLabel, #YValue(#Sum)";
case RenderAs.Pie:
case RenderAs.Doughnut:
if (InternalXValueType != ChartValueTypes.Numeric)
return "#XValue, #YValue(#Percentage%)";
else
return "#AxisXLabel, #YValue(#Percentage%)";
case RenderAs.Stock:
case RenderAs.CandleStick:
return "Open: #Open\nClose: #Close\nHigh: #High\nLow: #Low";
default:
if (chart.ChartArea != null && chart.ChartArea.AxisX != null && chart.ChartArea.AxisX.XValueType != ChartValueTypes.Numeric)
return "#XValue, #YValue";
else
return "#AxisXLabel, #YValue";
}
}
else
return (String) GetValue(ToolTipTextProperty);
}
set
{
SetValue(ToolTipTextProperty, value);
}
}
///
/// Collection of DataPoints
///
public DataPointCollection DataPoints
{
get;
set;
}
///
/// Get or set the AxisXType property
///
public AxisTypes AxisXType
{
get
{
return (AxisTypes)GetValue(AxisXTypeProperty);
}
set
{
SetValue(AxisXTypeProperty, value);
}
}
///
/// Get or set the AxisYType property
///
public AxisTypes AxisYType
{
get
{
return (AxisTypes)GetValue(AxisYTypeProperty);
}
set
{
SetValue(AxisYTypeProperty, value);
}
}
///
/// Type of scale used in axis
///
public ChartValueTypes XValueType
{
get
{
return (ChartValueTypes)GetValue(XValueTypeProperty);
}
set
{
SetValue(XValueTypeProperty, value);
}
}
///
/// Get or set the SelectionEnabled property
///
public Boolean SelectionEnabled
{
get
{
return (Boolean)GetValue(SelectionEnabledProperty);
}
set
{
SetValue(SelectionEnabledProperty, value);
}
}
///
/// Get or set the SelectionMode property
///
public SelectionModes SelectionMode
{
get
{
return (SelectionModes)GetValue(SelectionModeProperty);
}
set
{
SetValue(SelectionModeProperty, value);
}
}
#endregion
#region Public Events
#endregion
#region Protected Methods
///
/// UpdateVisual is used for partial rendering
///
/// Name of the property
/// Value of the property
internal override void UpdateVisual(String propertyName, object value)
{
if (propertyName == "Color")
{
if (RenderAs == RenderAs.Area || RenderAs == RenderAs.StackedArea || RenderAs == RenderAs.StackedArea100)
{
if (Faces != null && Faces.Parts != null)
{
if ((Chart as Chart).View3D)
{
Brush sideBrush = (Boolean)LightingEnabled ? Graphics.GetRightFaceBrush((Brush)value) : (Brush)value;
Brush topBrush = (Boolean)LightingEnabled ? Graphics.GetTopFaceBrush((Brush)value) : (Brush)value;
foreach (FrameworkElement fe in Faces.Parts)
{
ElementData ed = fe.Tag as ElementData;
if (ed != null)
{
if (ed.VisualElementName == "AreaBase")
(fe as Shape).Fill = (Boolean)LightingEnabled ? Graphics.GetFrontFaceBrush((Brush)value) : (Brush)value;
else if (ed.VisualElementName == "Side")
(fe as Shape).Fill = sideBrush;
else if (ed.VisualElementName =="Top")
(fe as Shape).Fill = topBrush;
}
}
}
else
{
foreach (FrameworkElement fe in Faces.Parts)
{
ElementData ed = fe.Tag as ElementData;
if (ed != null)
{
if (ed.VisualElementName == "AreaBase")
{
(fe as Shape).Fill = (Boolean)LightingEnabled ? Graphics.GetLightingEnabledBrush((Brush)value, "Linear", null) : (Brush)value;
}
else if (ed.VisualElementName == "Bevel")
{
(fe as Shape).Fill = Graphics.GetBevelTopBrush((Brush)value);
}
}
}
}
foreach (DataPoint dp in InternalDataPoints)
dp.UpdateVisual("Color", null);
}
}
else if (RenderAs == RenderAs.Line)
{
if (VisualParams != null)
{
LineChartShapeParams lineParams = VisualParams as LineChartShapeParams;
(Faces.Parts[0] as Path).Stroke = lineParams.Lighting ? Graphics.GetLightingEnabledBrush((Brush)value, "Linear", new Double[] { 0.65, 0.55 }) : (Brush)value;
foreach (DataPoint dp in InternalDataPoints)
dp.UpdateVisual("Color", null);
}
}
else if (RenderAs != RenderAs.CandleStick) // CandleStick does not require Color update for DataSeries
{
foreach (DataPoint dp in InternalDataPoints)
dp.UpdateVisual("Color", null);
}
if (LegendMarker != null && LegendMarker.Visual != null && RenderAs != RenderAs.CandleStick)
{
LegendMarker.BorderColor = (Brush)Color;
//LegendMarker.MarkerFillColor = (Brush)Color;
if (RenderAs == RenderAs.Line || RenderAs == RenderAs.Stock)
{
if ((LegendMarker.Visual as Grid).Parent != null && (((LegendMarker.Visual as Grid).Parent as Canvas).Children[0] as Line) != null)
(((LegendMarker.Visual as Grid).Parent as Canvas).Children[0] as Line).Stroke = (Brush)Color;
}
else
LegendMarker.MarkerFillColor = (Brush)Color;
LegendMarker.UpdateMarker();
}
}
else
FirePropertyChanged("Color");
}
#endregion
#region Internal Properties
#if SL
///
/// Identifies the Visifire.Charts.Axis.Opacity dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.Opacity dependency property.
///
private static readonly DependencyProperty InternalOpacityProperty = DependencyProperty.Register
("InternalOpacity",
typeof(Double),
typeof(DataSeries),
new PropertyMetadata(1.0, OnOpacityPropertyChanged));
///
/// Identifies the Visifire.Charts.Title.BorderThickness dependency property.
///
///
/// The identifier for the Visifire.Charts.DataSeries.BorderThickness dependency property.
///
private static readonly DependencyProperty InternalBorderThicknessProperty = DependencyProperty.Register
("InternalBorderThickness",
typeof(Thickness),
typeof(DataSeries),
new PropertyMetadata(OnBorderThicknessPropertyChanged));
#endif
///
/// Get or set the BorderThickness of title
///
internal Thickness InternalBorderThickness
{
get
{
Thickness retVal = (Thickness)((_borderThickness == null) ? GetValue(BorderThicknessProperty) : _borderThickness);
if (retVal == new Thickness(0) && RenderAs == RenderAs.Stock)
return new Thickness(2);
return retVal;
}
set
{
_borderThickness = value;
}
}
///
/// Get or set the Opacity property
///
internal Double InternalOpacity
{
get
{
return (Double)(Double.IsNaN(_internalOpacity) ? GetValue(OpacityProperty) : _internalOpacity);
}
set
{
_internalOpacity = value;
}
}
internal Boolean IsLabelStyleSet
{
get;
set;
}
///
/// Collection of InternalDataPoints used for calculation
///
internal List InternalDataPoints
{
get;
set;
}
///
/// Internal XValue Type
///
internal ChartValueTypes InternalXValueType
{
get;
set;
}
///
/// Visual Parameters
///
internal object VisualParams
{
get;
set;
}
///
/// Marker associated with DataSeries and shown in legend
///
internal Marker LegendMarker
{
get;
set;
}
///
/// This storyboard is used for animating the DataSeries
///
internal Storyboard Storyboard
{
get;
set;
}
///
/// Total Count of DataSeries of the group to which this series belongs.
/// This count is helpful while rendering, the space allocated for the columns at a particular InternalXValue
/// must be divided between indivisual datapoints of different series with same InternalXValue
///
internal Int32 SeriesCountOfSameRenderAs
{
get;
set;
}
///
/// Faces holds the visual object references associated with this DataSeries
///
internal Faces Faces
{
get;
set;
}
///
/// PlotGroup associated with the DataSeries
///
internal PlotGroup PlotGroup
{
get;
set;
}
///
/// InternalLegendName is used for automatic linking a Legend with a DataSeries
///
//internal String InternalLegendName
//{
// get;
// set;
//}
#endregion
#region Private Delegates
#endregion
#region Private Property
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
private new Brush Background
{
get;
set;
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
private new Brush BorderBrush
{
get;
set;
}
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
private new Brush Foreground
{
get;
set;
}
#endregion
#region Private Methods
///
/// MinPointHeightProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnMinPointHeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if ((Double)e.NewValue < 0 || (Double)e.NewValue > 100)
throw new Exception("MinPointHeightProperty value is out of Range. MinPointHeight Property Value must be within the range of 0 to 100.");
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("MinPointHeight");
}
///
/// ExplodedProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnMovingMarkerEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("MovingMarkerEnabled");
}
///
/// ExplodedProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnExplodedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("Enabled");
}
///
/// EnabledProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("Enabled");
}
///
/// OpacityProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnOpacityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.InternalOpacity = (Double) e.NewValue;
dataSeries.FirePropertyChanged("Opacity");
}
///
/// RenderAsProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnRenderAsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries._internalColor = null;
dataSeries.FirePropertyChanged("RenderAs");
}
///
/// HrefTargetProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnHrefTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("HrefTarget");
}
///
/// HrefProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnHrefChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("Href");
}
///
/// ColorProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.UpdateVisual("Color", e.NewValue);
}
///
/// ColorProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnPriceUpColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("PriceUpColor");
//DataSeries dataSeries = d as DataSeries;
//dataSeries.UpdateVisual("PriceUpColor", e.NewValue);
}
///
/// ColorProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnPriceDownColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("PriceDownColor");
//DataSeries dataSeries = d as DataSeries;
//dataSeries.UpdateVisual("PriceDownColor", e.NewValue);
}
///
/// LightingEnabledProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLightingEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LightingEnabled");
}
///
/// ShadowEnabledProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnShadowEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("ShadowEnabled");
}
///
/// LegendTextProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLegendTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LegendText");
}
///
/// LegendProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLegendPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
// dataSeries.InternalLegendName = (String)e.NewValue;
dataSeries.FirePropertyChanged("Legend");
}
///
/// BevelProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnBevelPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("Bevel");
}
///
/// ColorSetProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnColorSetPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("ColorSet");
}
///
/// RadiusXProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnRadiusXPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("RadiusX");
}
///
/// RadiusYProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnRadiusYPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("RadiusY");
}
///
/// LineThicknessProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLineThicknessPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LineThickness");
}
///
/// LineStyleProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLineStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LineStyle");
}
///
/// ShowInLegendProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnShowInLegendPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("ShowInLegend");
}
///
/// LabelEnabledProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelEnabled");
}
///
/// LabelTextProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelText");
}
///
/// LabelFontFamilyProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelFontFamilyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelFontFamily");
}
///
/// LabelFontSizeProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelFontSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelFontSize");
}
///
/// LabelFontColorProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelFontColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelFontColor");
}
///
/// LabelFontWeightProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelFontWeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelFontWeight");
}
///
/// LabelFontStyleProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelFontStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelFontStyle");
}
///
/// LabelBackgroundProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelBackgroundPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelBackground");
}
///
/// LabelStyleProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelStyle");
}
///
/// LabelLineEnabledProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelLineEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelLineEnabled");
}
///
/// LabelLineColorProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelLineColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelLineColor");
}
///
/// LabelLineThicknessProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelLineThicknessPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelLineThickness");
}
///
/// LabelLineStyleProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelLineStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelLineStyle");
}
///
/// LabelAngleProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnLabelAnglePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("LabelAngle");
}
///
/// MarkerEnabledProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnMarkerEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("MarkerEnabled");
}
///
/// MarkerTypeProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnMarkerTypePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("MarkerType");
}
///
/// MarkerBorderThicknessProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnMarkerBorderThicknessPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.UpdateMarkers();
}
///
/// MarkerBorderColorProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnMarkerBorderColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.UpdateMarkers();
}
///
/// MarkerSizeProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnMarkerSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("MarkerSize");
}
///
/// MarkerColorProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnMarkerColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.UpdateMarkers();
}
///
/// MarkerScaleProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnMarkerScalePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("MarkerScale");
}
///
/// StartAngleProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnStartAnglePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("StartAngle");
}
///
/// BorderThicknessProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnBorderThicknessPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.InternalBorderThickness = (Thickness)e.NewValue;
dataSeries.FirePropertyChanged("BorderThickness");
}
///
/// BorderColorProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnBorderColorPropertychanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("BorderColor");
}
///
/// BorderStyleProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnBorderStylePropertychanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("BorderStyle");
}
///
/// XValueFormatStringProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnXValueFormatStringPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("XValueFormatString");
}
///
/// YValueFormatStringProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnYValueFormatStringPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("YValueFormatString");
}
///
/// ZValueFormatStringProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnZValueFormatStringPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("ZValueFormatString");
}
///
/// AxisXTypeProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnAxisXTypePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("AxisXType");
}
///
/// AxisYTypeProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnAxisYTypePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.FirePropertyChanged("AxisYType");
}
///
/// XValueTypeProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnXValueTypePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.InternalXValueType = (ChartValueTypes) e.NewValue;
dataSeries.FirePropertyChanged("XValueType");
}
///
/// SelectionEnabledProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnSelectionModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
if((SelectionModes)e.NewValue == SelectionModes.Single)
Visifire.Charts.Chart.SelectDataPoints(dataSeries.Chart as Chart);
}
///
/// SelectionEnabledProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnSelectionEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
if (!dataSeries._isSelectedEventAttached)
{
MouseButtonEventHandler event1 = dataSeries.GetMouseLeftButtonDownEventHandler();
if(event1 != null)
dataSeries.IsNotificationEnable = false;
dataSeries._isSelectedEventAttached = true;
dataSeries.MouseLeftButtonUp += new MouseButtonEventHandler(dataSeries_MouseLeftButtonUp);
dataSeries.IsNotificationEnable = true;
}
else
{
dataSeries.IsNotificationEnable = false;
dataSeries.MouseLeftButtonUp -= new MouseButtonEventHandler(dataSeries_MouseLeftButtonUp);
dataSeries.IsNotificationEnable = true;
dataSeries._isSelectedEventAttached = false;
}
if (!dataSeries.SelectionEnabled)
{
foreach (DataPoint dp in dataSeries.InternalDataPoints)
{
dp.DeSelect(dp, false, true);
}
}
dataSeries.AttachOrDetachIntaractivity();
}
///
///
///
///
///
static void dataSeries_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
DataPoint dp = sender as DataPoint;
dp.Selected = (dp.Parent != null && dp.Parent.SelectionEnabled) ? !dp.Selected : false;
}
///
/// ZIndexProperty changed call back function
///
/// DependencyObject
/// DependencyPropertyChangedEventArgs
private static void OnZIndexPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
DataSeries dataSeries = d as DataSeries;
dataSeries.InternalZIndex = (Int32) e.NewValue;
dataSeries.IsZIndexSet = true;
dataSeries.FirePropertyChanged("ZIndex");
}
///
/// Update marker partially
///
private void UpdateMarkers()
{
foreach (DataPoint dataPoint in InternalDataPoints)
dataPoint.UpdateMarker();
}
///
/// InternalDataPoints collection changed event handler
///
/// InternalDataPoints
/// NotifyCollectionChangedEventArgs
private void DataPoints_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
if (e.NewItems != null)
{
foreach (DataPoint dataPoint in e.NewItems)
{
dataPoint.Parent = this;
if (Chart != null)
dataPoint.Chart = Chart;
if (Double.IsNaN(dataPoint.InternalXValue))
dataPoint.InternalXValue = this.DataPoints.Count;
if (String.IsNullOrEmpty((String)dataPoint.GetValue(NameProperty)))
{
//dataPoint.SetValue(NameProperty, dataPoint.GetType().Name + this.DataPoints.IndexOf(dataPoint).ToString() + "_" + Guid.NewGuid().ToString().Replace('-','_'));
dataPoint.Name = "DataPoint" + (this.DataPoints.Count - 1).ToString() + "_" + Guid.NewGuid().ToString().Replace('-', '_');
dataPoint._isAutoName = true;
}
else
dataPoint._isAutoName = false;
// dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
dataPoint.PropertyChanged -= DataPoint_PropertyChanged;
dataPoint.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(DataPoint_PropertyChanged);
}
}
}
this.FirePropertyChanged("DataPoints");
}
///
/// Find nearest DataPoint by InternalXValue
///
/// Double InternalXValue
/// DataPoint
internal DataPoint GetNearestDataPoint(Double xValue)
{
DataPoint dp = this.InternalDataPoints[0];
Double diff = Math.Abs(dp.InternalXValue - xValue);
for (Int32 i = 1; i < this.InternalDataPoints.Count; i++)
{
if (Math.Abs(this.InternalDataPoints[i].InternalXValue - xValue) < diff)
{
diff = Math.Abs(this.InternalDataPoints[i].InternalXValue - xValue);
dp = this.InternalDataPoints[i];
}
}
return dp;
}
///
/// DataPoint property changed event handler
///
/// DataSeries
/// PropertyChangedEventArgs
private void DataPoint_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
this.FirePropertyChanged(e.PropertyName);
}
#endregion
#region Internal Methods
///
/// OnToolTipTextPropertyChanged call back virtual function
///
/// New ToolTip value
internal override void OnToolTipTextPropertyChanged(string newValue)
{
// base.OnToolTipTextPropertyChanged(newValue);
if (Chart != null)
{
foreach (DataPoint dp in DataPoints)
dp.OnToolTipTextPropertyChanged(newValue);
}
}
///
/// Attach events to each and every visual face in Faces
///
internal void AttachEvent2DataSeriesVisualFaces()
{
if (RenderAs == RenderAs.Area || RenderAs == RenderAs.StackedArea || RenderAs == RenderAs.StackedArea100)
{
AttachEvent2AreaVisualFaces(this);
}
else
{
foreach (DataPoint dp in InternalDataPoints)
{
dp.AttachEvent2DataPointVisualFaces(this);
}
}
}
///
/// Attach events to Area faces
///
/// Object where events to be attached
internal void AttachEvent2AreaVisualFaces(ObservableObject Object)
{
if (Faces != null)
{
foreach(FrameworkElement face in Faces.VisualComponents)
AttachEvents2AreaVisual(Object, this, face);
}
foreach (DataPoint dp in InternalDataPoints)
{
dp.AttachEvent2DataPointVisualFaces(this);
}
}
///
/// Get DataPoint for MouseButton event
///
///
///
internal DataPoint GetNearestDataPointOnMouseButtonEvent(MouseButtonEventArgs e)
{
DataPoint dataPoint = null;
Point position = e.GetPosition(this.Faces.Visual);
Double xValue = Graphics.PixelPositionToValue(0, this.Faces.Visual.Width, (Double)(Chart as Chart).ChartArea.AxisX.AxisManager.AxisMinimumValue, (Double)(Chart as Chart).ChartArea.AxisX.AxisManager.AxisMaximumValue, position.X);
dataPoint = GetNearestDataPoint(xValue);
return dataPoint;
}
///
/// Get DataPoint for Mouse event
///
///
///
internal DataPoint GetNearestDataPointOnMouseEvent(MouseEventArgs e)
{
DataPoint dataPoint = null;
Point position = e.GetPosition(this.Faces.Visual);
Double xValue = Graphics.PixelPositionToValue(0, this.Faces.Visual.Width, (Double)(Chart as Chart).ChartArea.AxisX.AxisManager.AxisMinimumValue, (Double)(Chart as Chart).ChartArea.AxisX.AxisManager.AxisMaximumValue, position.X);
dataPoint = GetNearestDataPoint(xValue);
return dataPoint;
}
///
/// Attach tooltip with a framework element
///
/// Control reference
/// FrameworkElement list
internal void AttachAreaToolTip(VisifireControl control, List elements)
{
// Show ToolTip on mouse move over the chart element
foreach (FrameworkElement element in elements)
{
element.MouseMove += delegate(object sender, MouseEventArgs e)
{
Point position = e.GetPosition(this.Faces.Visual);
Double xValue = Graphics.PixelPositionToValue(0, this.Faces.Visual.Width, (Double)(control as Chart).ChartArea.AxisX.AxisManager.AxisMinimumValue, (Double)(control as Chart).ChartArea.AxisX.AxisManager.AxisMaximumValue, position.X);
DataPoint dataPoint = GetNearestDataPoint(xValue);
if (dataPoint.ToolTipText == null)
{
control._toolTip.Text = "";
control._toolTip.Hide();
return;
}
else
{
control._toolTip.Text = dataPoint.ParseToolTipText(dataPoint.ToolTipText);
if (control.ToolTipEnabled)
control._toolTip.Show();
(control as Chart).UpdateToolTipPosition(sender, e);
}
};
// Hide ToolTip on mouse out from the chart element
element.MouseLeave += delegate(object sender, MouseEventArgs e)
{
control._toolTip.Hide();
};
}
}
#if WPF
internal void DetachOpacityPropertyFromAnimation()
{
foreach (DataPoint dp in InternalDataPoints)
{
if (dp.Faces != null)
{
if ((Chart as Chart).View3D && (RenderAs == RenderAs.Pie || RenderAs == RenderAs.Doughnut || RenderAs == RenderAs.SectionFunnel || RenderAs == RenderAs.StreamLineFunnel))
{
foreach (FrameworkElement fe in dp.Faces.VisualComponents)
{
InteractivityHelper.DetachOpacityPropertyFromAnimation(fe, Opacity * dp.Opacity);
}
}
}
}
}
#endif
///
/// Attach or detach DataPoint selection intaractivity
///
internal void AttachOrDetachIntaractivity()
{
foreach (DataPoint dp in InternalDataPoints)
{
if (dp.Faces != null)
{
if ((Chart as Chart).View3D && (RenderAs == RenderAs.Pie || RenderAs == RenderAs.Doughnut || RenderAs == RenderAs.SectionFunnel || RenderAs == RenderAs.StreamLineFunnel))
{
foreach (FrameworkElement fe in dp.Faces.VisualComponents)
{
if (SelectionEnabled)
InteractivityHelper.ApplyOnMouseOverOpacityInteractivity2Visuals(fe);
else
InteractivityHelper.RemoveOnMouseOverOpacityInteractivity(fe, InternalOpacity * dp.InternalOpacity);
}
}
else
{
if(SelectionEnabled)
InteractivityHelper.ApplyOnMouseOverOpacityInteractivity(dp.Faces.Visual);
else
InteractivityHelper.RemoveOnMouseOverOpacityInteractivity(dp.Faces.Visual, InternalOpacity * dp.InternalOpacity);
}
if ((Chart as Chart).ChartArea != null && !(Chart as Chart).ChartArea._isFirstTimeRender && !IsInDesignMode && (Chart as Chart).ChartArea.PlotDetails.ChartOrientation == ChartOrientationType.NoAxis)
dp.ExplodeOrUnexplodeAnimation();
}
if (dp.Marker != null && dp.Marker.Visual != null)
{
if (SelectionEnabled)
InteractivityHelper.ApplyOnMouseOverOpacityInteractivity(dp.Marker.Visual);
else if (!(Chart as Chart).ChartArea._isFirstTimeRender)
InteractivityHelper.RemoveOnMouseOverOpacityInteractivity(dp.Marker.Visual, InternalOpacity * dp.InternalOpacity);
}
}
}
#endregion
#region Internal Events
#endregion
#region Data
///
/// Whether event attached for DataPoint selection
///
internal Boolean _isSelectedEventAttached = false;
///
/// Internal color holds color from theme
///
internal Brush _internalColor;
///
/// Whether name for DataSeries is generated automatically
///
internal Boolean _isAutoName = true;
internal Ellipse _movingMarker;
Nullable _borderThickness = null;
Double _internalOpacity = Double.NaN;
///
/// Nearest DataPoint form mouse pointer
/// Currently it is applicable for line chart interactivity only
///
internal DataPoint _lastNearestDataPoint;
#if WPF
///
/// Whether the default style is applied
///
private static Boolean _defaultStyleKeyApplied;
#endif
#endregion
}
}