示例#1
0
        public void ReCreate(VisifireElement element, ElementTypes elementType, VcProperties property, object oldValue, object newValue)
        {   
            //Type elementType = element.GetType();
            
            // Create a plot groups list
            // this.PlotGroups = new List<PlotGroup>();

            CalculateInternalXValue4NumericAxis(Chart);

            // Set default chart orientation
            if((elementType == ElementTypes.Chart && property == VcProperties.Series)
                ||(elementType == ElementTypes.DataSeries && property == VcProperties.RenderAs)
            )
                this.ChartOrientation = ChartOrientationType.Undefined;

            // Validate XValue type of the DataPoint and DataSeries
            if ((elementType == ElementTypes.Chart && property == VcProperties.Series)
                || (elementType == ElementTypes.DataSeries && property == VcProperties.RenderAs)
                || (elementType == ElementTypes.DataPoint && property == VcProperties.XValue)
                || (elementType == ElementTypes.Chart && property == VcProperties.None)
             )  
                SetDataPointsNameAndValidateDataPointXValueType();

            // Calculate all the required details
            this.Calculate(element, elementType, property, oldValue, newValue);
        }
示例#2
0
        ///// <summary>
        ///// Identifies the Visifire.Charts.CustomAxisLabel.FontSize dependency property.
        ///// </summary>
        ///// <returns>
        ///// The identifier for the Visifire.Charts.CustomAxisLabel.FontSize dependency property.
        ///// </returns>
        //private static readonly DependencyProperty
        //    InternalFontSizeProperty = DependencyProperty.Register
        //    ("InternalFontSize",
        //    typeof(Double),
        //    typeof(CustomAxisLabel),
        //    new PropertyMetadata(OnFontSizePropertyChanged));

        ///// Identifies the Visifire.Charts.CustomAxisLabel.FontFamily dependency property.
        ///// </summary>
        ///// <returns>
        ///// The identifier for the Visifire.Charts.CustomAxisLabel.FontFamily dependency property.
        ///// </returns>
        //private static readonly DependencyProperty InternalFontFamilyProperty = DependencyProperty.Register
        //    ("InternalFontFamily",
        //    typeof(FontFamily),
        //    typeof(CustomAxisLabel),
        //    new PropertyMetadata(OnFontFamilyPropertyChanged));

        ///// <summary>
        ///// Identifies the Visifire.Charts.CustomAxisLabel.FontStyle dependency property.
        ///// </summary>
        ///// <returns>
        ///// The identifier for the Visifire.Charts.CustomAxisLabel.FontStyle dependency property.
        ///// </returns>
        //private static readonly DependencyProperty InternalFontStyleProperty = DependencyProperty.Register
        //    ("InternalFontStyle",
        //    typeof(FontStyle),
        //    typeof(CustomAxisLabel),
        //    new PropertyMetadata(OnFontStylePropertyChanged));

        ///// <summary>
        ///// Identifies the Visifire.Charts.CustomAxisLabel.FontWeight dependency property.
        ///// </summary>
        ///// <returns>
        ///// The identifier for the Visifire.Charts.CustomAxisLabel.FontWeight dependency property.
        ///// </returns>
        //private static readonly DependencyProperty InternalFontWeightProperty = DependencyProperty.Register
        //    ("InternalFontWeight",
        //    typeof(FontWeight),
        //    typeof(CustomAxisLabel),
        //    new PropertyMetadata(OnFontWeightPropertyChanged));

        ///// <summary>
        ///// Event handler attached with FontFamily property changed event of CustomAxisLabels element
        ///// </summary>
        ///// <param name="d">DependencyObject</param>
        ///// <param name="e">DependencyPropertyChangedEventArgs</param>
        //private static void OnFontFamilyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    CustomAxisLabel customAxisLabel = d as CustomAxisLabel;

        //    if (e.NewValue == null || e.OldValue == null)
        //    {
        //        customAxisLabel.InternalFontFamily = (FontFamily)e.NewValue;
        //        customAxisLabel.FirePropertyChanged(VcProperties.FontFamily);
        //    }
        //    else if (e.NewValue.ToString() != e.OldValue.ToString())
        //    {
        //        customAxisLabel.InternalFontFamily = (FontFamily)e.NewValue;
        //        customAxisLabel.FirePropertyChanged(VcProperties.FontFamily);
        //    }
        //}

        ///// <summary>
        ///// Event handler attached with FontStyle property changed event of CustomAxisLabels element
        ///// </summary>
        ///// <param name="d">DependencyObject</param>
        ///// <param name="e">DependencyPropertyChangedEventArgs</param>
        //private static void OnFontStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    CustomAxisLabel customAxisLabel = d as CustomAxisLabel;
        //    customAxisLabel.InternalFontStyle = (FontStyle)e.NewValue;
        //    customAxisLabel.UpdateVisual(VcProperties.FontStyle, e.NewValue);
        //}

        ///// <summary>
        ///// Event handler attached with FontWeight property changed event of CustomAxisLabels element
        ///// </summary>
        ///// <param name="d">DependencyObject</param>
        ///// <param name="e">DependencyPropertyChangedEventArgs</param>
        //private static void OnFontWeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    CustomAxisLabel customAxisLabel = d as CustomAxisLabel;
        //    customAxisLabel.InternalFontWeight = (FontWeight)e.NewValue;
        //    customAxisLabel.UpdateVisual(VcProperties.FontWeight, e.NewValue);
        //}

        ///// <summary>
        ///// Event handler attached with FontSize property changed event of CustomAxisLabels element
        ///// </summary>
        ///// <param name="d">DependencyObject</param>
        ///// <param name="e">DependencyPropertyChangedEventArgs</param>
        //private static void OnFontSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    CustomAxisLabel customAxisLabel = d as CustomAxisLabel;
        //    customAxisLabel.InternalFontSize = (Double)e.NewValue;
        //    customAxisLabel.FirePropertyChanged(VcProperties.FontSize);
        //}

        #endregion

        #region Internal Methods

        /// <summary>
        /// Update visual used for partial update
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties propertyName, object value)
        {
            if (TextElement != null || CustomLabelPath != null)
            {
                ApplyCustomLabelProperties();
            }
            else
            {
                FirePropertyChanged(propertyName);
            }
        }
        /// <summary>
        /// Fire property change event
        /// </summary>
        /// <param name="propertyName">Property Name</param>
        internal void FirePropertyChanged(VcProperties propertyName)
        {
            _isPropertyChangedFired = false; // Used for testing

            if (this.PropertyChanged != null && this.IsNotificationEnable)
            {
                if (Chart != null)
                {
                    (Chart as Chart)._internalPartialUpdateEnabled = false;
                }

#if SL
                if (IsInDesignMode)
                {
                    if (Chart != null)
                    {
                        (Chart as Chart)._forcedRedraw = true;
                    }

                    this.PropertyChanged(this, new PropertyChangedEventArgs(Enum.GetName(typeof(VcProperties), propertyName)));
                }
                else if (Chart != null && (Chart as Chart)._isTemplateApplied)
                {
                    if (Application.Current != null && Application.Current.RootVisual != null && Application.Current.RootVisual.Dispatcher != null)
                    {
                        System.Windows.Threading.Dispatcher currentDispatcher = Application.Current.RootVisual.Dispatcher;

                        (Chart as Chart)._forcedRedraw = true;

                        if (currentDispatcher.CheckAccess())
                        {
                            (Chart as Chart).InvokeRender();
                        }
                        else
                        {
                            currentDispatcher.BeginInvoke(new Action <VcProperties>(FirePropertyChanged), propertyName);
                        }
                    }
                    else // if we did not get the Dispatcher throw an exception
                    {
                        throw new InvalidOperationException("This object must be initialized after that the RootVisual has been loaded");
                    }

                    _isPropertyChangedFired = true;   // Used for testing
                }
#else
                if (Chart != null)
                {
                    (Chart as Chart)._forcedRedraw = true;
                    this.PropertyChanged(this, new PropertyChangedEventArgs(Enum.GetName(typeof(VcProperties), propertyName)));
                }
#endif
            }
        }
示例#4
0
        /// <summary>
        /// Validates PartialUpdate
        /// </summary>
        /// <param name="chart">Chart</param>
        /// <returns>true - Get entry for PartialUpdate
        /// false - Get entry for PartialUpdate</returns>
        internal virtual Boolean ValidatePartialUpdate(RenderAs renderAs, VcProperties property)
        {
            Chart chart = Chart as Chart;

            if (chart == null || chart.ChartArea == null || chart.ChartArea._isFirstTimeRender)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#5
0
        public static void Update(ObservableObject sender, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Boolean isDataPoint = sender.GetType().Equals(typeof(DataPoint));

            if (isDataPoint)
            {
                UpdateDataPoint(sender as DataPoint, property, newValue, isAxisChanged);
            }
            else
            {
                UpdateDataSeries(sender as DataSeries, property, newValue, isAxisChanged);
            }
        }
示例#6
0
        public static void Update(ObservableObject sender, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Boolean isDataPoint = sender.GetType().Equals(typeof(DataPoint));

            if (isDataPoint)
            {
                DataSeries ds = (sender as DataPoint).Parent;

                if (ds != null && (property == VcProperties.YValue || property == VcProperties.XValue))
                    UpdateDataSeries(ds, property, newValue);
            }
            else
                UpdateDataSeries(sender as DataSeries, property, newValue);
        }
示例#7
0
文件: Ticks.cs 项目: tmpkus/openvss
 /// <summary>
 /// UpdateVisual is used for partial update
 /// </summary>
 /// <param name="propertyName">Name of the property</param>
 /// <param name="value">Value of the property</param>
 internal override void UpdateVisual(VcProperties property, object value)
 {
     if (Visual != null)
     {
         foreach (Line line in Visual.Children)
         {
             line.Stroke          = LineColor;
             line.StrokeThickness = LineThickness;
             line.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
         }
     }
     else
     {
         FirePropertyChanged(property);
     }
 }
        /// <summary>
        /// Check whether the Property value is changed
        /// </summary>
        /// <typeparam name="T">Type</typeparam>
        /// <param name="propertyName">Property Name</param>
        /// <param name="oldValue">Old property value</param>
        /// <param name="newValue">New property value</param>
        /// <returns></returns>
        protected bool CheckPropertyChanged <T>(VcProperties propertyName, ref T oldValue, ref T newValue)
        {
            if (oldValue == null && newValue == null)
            {
                return(false);
            }

            if ((oldValue == null && newValue != null) || !oldValue.Equals((T)newValue))
            {
                oldValue = newValue;

                FirePropertyChanged(propertyName);

                return(true);
            }

            return(false);
        }
        public static void Update(ObservableObject sender, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Boolean isDataPoint = sender.GetType().Equals(typeof(DataPoint));

            if (isDataPoint)
            {
                DataSeries ds = (sender as DataPoint).Parent;

                if (ds != null && (property == VcProperties.YValue || property == VcProperties.XValue))
                {
                    UpdateDataSeries(ds, property, newValue);
                }
            }
            else
            {
                UpdateDataSeries(sender as DataSeries, property, newValue);
            }
        }
示例#10
0
 /// <summary>
 /// UpdateVisual is used for partial rendering
 /// </summary>
 /// <param name="propertyName">Name of the property</param>
 /// <param name="value">Value of the property</param>
 internal override void UpdateVisual(VcProperties propertyName, object value)
 {
     if (Line == null || Shadow == null)
     {
         FirePropertyChanged(propertyName);
     }
     else if (propertyName == VcProperties.Value)
     {
         Chart chart = (Chart as Chart);
         Axis  axis  = chart.PlotDetails.GetAxisXFromChart(chart, AxisType);
         chart.PlotDetails.SetTrendLineValue(this, axis);
         Canvas visualCanvas = (Chart as Chart).ChartArea.ChartVisualCanvas;
         PositionTheLine(visualCanvas.Width, visualCanvas.Height);
     }
     else
     {
         ApplyProperties();
     }
 }
        /// <summary>
        /// Validates PartialUpdate
        /// </summary>
        /// <param name="chart">Chart</param>
        /// <returns>true - Get entry for PartialUpdate
        /// false - Get entry for PartialUpdate</returns>
        internal virtual Boolean ValidatePartialUpdate(RenderAs renderAs, VcProperties property)
        {
            Chart chart = Chart as Chart;

            if (chart == null || chart.ChartArea == null || chart.ChartArea._isFirstTimeRender)
            {
                return(false);
            }
            else if ((chart.SamplingThreshold != 0 && property != VcProperties.ScrollBarScale) ||
                     (chart.PlotDetails != null && chart.PlotDetails.AutoFitToPlotArea && property != VcProperties.ScrollBarScale))
            {
                FirePropertyChanged(property);
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#12
0
        /// <summary>
        /// Update visual used for partial update
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties propertyName, object value)
        {
            if (Visual != null)
            {
                foreach (Rectangle rec in InterlacedRectangles)
                {
                    rec.Fill = InterlacedColor;
                }

                foreach (Line line in InterlacedLines)
                {
                    line.Stroke          = LineColor;
                    line.StrokeThickness = LineThickness;
                    line.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
                }
            }
            else
            {
                FirePropertyChanged(propertyName);
            }
        }
示例#13
0
文件: Ticks.cs 项目: tdhieu/openvss
 /// <summary>
 /// UpdateVisual is used for partial update
 /// </summary>
 /// <param name="propertyName">Name of the property</param>
 /// <param name="value">Value of the property</param>
 internal override void UpdateVisual(VcProperties property, object value)
 {   
     if (Visual != null)
         foreach (Line line in Visual.Children)
         {    
             line.Stroke = LineColor;
             line.StrokeThickness = LineThickness;
             line.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
         }
     else
         FirePropertyChanged(property);
 }
        private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Chart chart = dataPoint.Chart as Chart;

            if (chart == null)
            {
                return;
            }

            DataSeries dataSeries = dataPoint.Parent;
            PlotGroup  plotGroup  = dataSeries.PlotGroup;
            Faces      dsFaces    = dataSeries.Faces;
            Faces      dpFaces    = dataPoint.Faces;
            Double     dataPointWidth;

            if (dsFaces != null)
            {
                ColumnChart.UpdateParentVisualCanvasSize(chart, dsFaces.Visual as Canvas);
            }

            if (dpFaces != null && dpFaces.Visual != null)
            {
                dataPointWidth = dpFaces.Visual.Width;
            }
            else if (dsFaces == null)
            {
                return;
            }
            else
            {
                dataPointWidth = CalculateDataPointWidth(dsFaces.Visual.Width, dsFaces.Visual.Height, chart);
            }

            if (property == VcProperties.Enabled || (dpFaces == null && (property == VcProperties.XValue || property == VcProperties.YValues)))
            {
                CreateOrUpdateACandleStick(dataPoint, dsFaces.Visual as Canvas, dsFaces.LabelCanvas, dsFaces.Visual.Width, dsFaces.Visual.Height, dataPointWidth);
                return;
            }

            if (dpFaces == null)
            {
                return;
            }

            switch (property)
            {
            case VcProperties.BorderThickness:
                ApplyOrUpdateBorder(dataPoint, dataPointWidth);
                ApplyOrRemoveBevel(dataPoint, dataPointWidth);
                break;

            case VcProperties.BorderStyle:
                ApplyOrUpdateBorder(dataPoint, dataPointWidth);
                break;

            case VcProperties.BorderColor:
                ApplyOrUpdateBorder(dataPoint, dataPointWidth);
                break;

            case VcProperties.Bevel:
                ApplyOrRemoveBevel(dataPoint, dataPointWidth);
                break;

            case VcProperties.Color:
            case VcProperties.PriceUpColor:
            case VcProperties.PriceDownColor:
            case VcProperties.StickColor:
                ApplyOrUpdateColorForACandleStick(dataPoint);
                break;

            case VcProperties.Cursor:
                dataPoint.SetCursor2DataPointVisualFaces();
                break;

            case VcProperties.Href:
                dataPoint.SetHref2DataPointVisualFaces();
                break;

            case VcProperties.HrefTarget:
                dataPoint.SetHref2DataPointVisualFaces();
                break;

            case VcProperties.LabelBackground:
            case VcProperties.LabelEnabled:
            case VcProperties.LabelFontColor:
            case VcProperties.LabelFontFamily:
            case VcProperties.LabelFontStyle:
            case VcProperties.LabelFontSize:
            case VcProperties.LabelFontWeight:
            case VcProperties.LabelStyle:
            case VcProperties.LabelText:
                CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                break;


            case VcProperties.LegendText:
                chart.InvokeRender();
                break;

            case VcProperties.LightingEnabled:
                ApplyOrUpdateColorForACandleStick(dataPoint);
                break;

            //case VcProperties.MarkerBorderColor:
            //case VcProperties.MarkerBorderThickness:
            //case VcProperties.MarkerColor:
            //case VcProperties.MarkerEnabled:
            //case VcProperties.MarkerScale:
            //case VcProperties.MarkerSize:
            //case VcProperties.MarkerType:
            case VcProperties.ShadowEnabled:
                ApplyOrRemoveShadow(dataPoint, dataPointWidth);
                break;

            case VcProperties.Opacity:
                dpFaces.Visual.Opacity = (Double)dataSeries.Opacity * (Double)dataPoint.Opacity;
                break;

            case VcProperties.ShowInLegend:
                chart.InvokeRender();
                break;

            case VcProperties.ToolTipText:
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                break;

            case VcProperties.XValueFormatString:
            case VcProperties.YValueFormatString:
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                break;

            case VcProperties.XValueType:
                chart.InvokeRender();
                break;

            case VcProperties.Enabled:
                CreateOrUpdateACandleStick(dataPoint, dsFaces.Visual as Canvas, dsFaces.LabelCanvas, dsFaces.Visual.Width, dsFaces.Visual.Height, dataPointWidth);
                break;

            case VcProperties.XValue:
            case VcProperties.YValue:
            case VcProperties.YValues:
                if (isAxisChanged || dataPoint.InternalYValues == null)
                {
                    UpdateDataSeries(dataSeries, property, newValue, isAxisChanged);
                }
                else
                {
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    UpdateYValueAndXValuePosition(dataPoint, dsFaces.Visual.Width, dsFaces.Visual.Height, dpFaces.Visual.Width);

                    if ((Boolean)dataPoint.LabelEnabled)
                    {
                        CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                    }
                }

                if (dataPoint.Parent.SelectionEnabled && dataPoint.Selected)
                {
                    dataPoint.Select(true);
                }

                break;
            }
        }
示例#15
0
        /// <summary>
        /// Update visual used for partial update
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties propertyName, object value)
        {
            if (Visual != null)
            {
                if(InterlacedRectangles != null)
                {
                    foreach (Rectangle rec in InterlacedRectangles)
                        rec.Fill = InterlacedColor;
                }

                if (InterlacedPaths != null)
                {
                    foreach (Path path in InterlacedPaths)
                        path.Fill = InterlacedColor;
                }

                if (InterlacedLines != null)
                {   
                    foreach (Line line in InterlacedLines)
                    {
                        line.Stroke = LineColor;
                        line.StrokeThickness = (Double)LineThickness;
                        line.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
                    }
                }

                Chart chart = Chart as Chart;

                if (Chart != null && ParentAxis != null && chart.ChartArea != null)
                {
                    if (ParentAxis.AxisRepresentation == AxisRepresentations.AxisY
                        && ParentAxis.AxisType == AxisTypes.Primary)
                    {
                        List<Line> interlacedLinesOverVerticalPlank = chart.ChartArea.InterlacedLinesOverVerticalPlank;

                        if (interlacedLinesOverVerticalPlank != null)
                        {   
                            foreach (Line line in interlacedLinesOverVerticalPlank)
                            {
                                line.Stroke = LineColor;
                                line.StrokeThickness = (Double)LineThickness;
                                line.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
                            }
                        }

                        List<Path> interlacedPathsOverVerticalPlank = chart.ChartArea.InterlacedPathsOverVerticalPlank;

                        if (interlacedPathsOverVerticalPlank != null)
                        {   
                            foreach (Path path in interlacedPathsOverVerticalPlank)
                                path.Fill = InterlacedColor;
                        }
                    }
                }
            }
            else
                FirePropertyChanged(propertyName);
        }
示例#16
0
        private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Chart      chart      = dataPoint.Chart as Chart;
            DataSeries dataSeries = dataPoint.Parent;
            PlotGroup  plotGroup  = dataSeries.PlotGroup;
            Faces      dsFaces    = dataSeries.Faces;
            Faces      dpFaces    = dataPoint.Faces;

            Double dataPointWidth;

            if (dsFaces != null)
            {
                ColumnChart.UpdateParentVisualCanvasSize(chart, dsFaces.Visual as Canvas);
            }

            if (dpFaces != null && dpFaces.Visual != null)
            {
                dataPointWidth = dpFaces.Visual.Width;
            }
            else if (dsFaces == null)
            {
                return;
            }
            else
            {
                dataPointWidth = CandleStick.CalculateDataPointWidth(dsFaces.Visual.Width, dsFaces.Visual.Height, chart);
            }

            if (property == VcProperties.Enabled)
            {
                CreateOrUpdateAStockDataPoint(dataPoint, dsFaces.Visual as Canvas, dsFaces.LabelCanvas, dsFaces.Visual.Width, dsFaces.Visual.Height, dataPointWidth);
                return;
            }

            if (dpFaces == null)
            {
                return;
            }

            Canvas dataPointVisual = dpFaces.Visual as Canvas;            // DataPoint visual canvas
            Line   highLowLine     = dpFaces.VisualComponents[0] as Line; // HighLowline
            Line   closeLine       = dpFaces.VisualComponents[1] as Line; // Closeline
            Line   openLine        = dpFaces.VisualComponents[2] as Line; // Openline

            switch (property)
            {
            case VcProperties.BorderThickness:
            case VcProperties.BorderStyle:
                ApplyBorderProperties(dataPoint, highLowLine, openLine, closeLine, dataPointWidth);
                break;

            case VcProperties.Color:
                ApplyOrUpdateColorForAStockDp(dataPoint, highLowLine, openLine, closeLine);
                break;

            case VcProperties.Cursor:
                dataPoint.SetCursor2DataPointVisualFaces();
                break;

            case VcProperties.Href:
                dataPoint.SetHref2DataPointVisualFaces();
                break;

            case VcProperties.HrefTarget:
                dataPoint.SetHref2DataPointVisualFaces();
                break;

            case VcProperties.LabelBackground:
            case VcProperties.LabelEnabled:
            case VcProperties.LabelFontColor:
            case VcProperties.LabelFontFamily:
            case VcProperties.LabelFontStyle:
            case VcProperties.LabelFontSize:
            case VcProperties.LabelFontWeight:
            case VcProperties.LabelStyle:
            case VcProperties.LabelText:
                CandleStick.CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                break;

            case VcProperties.LegendText:
                chart.InvokeRender();
                break;

            case VcProperties.LightingEnabled:
                ApplyOrUpdateColorForAStockDp(dataPoint, highLowLine, openLine, closeLine);
                break;

            //case VcProperties.MarkerBorderColor:
            //case VcProperties.MarkerBorderThickness:
            //case VcProperties.MarkerColor:
            //case VcProperties.MarkerEnabled:
            //case VcProperties.MarkerScale:
            //case VcProperties.MarkerSize:
            //case VcProperties.MarkerType:
            case VcProperties.ShadowEnabled:
                ApplyOrUpdateShadow(dataPoint, dataPointVisual, highLowLine, openLine, closeLine, dataPointWidth);
                break;

            case VcProperties.Opacity:
                dpFaces.Visual.Opacity = dataSeries.Opacity * dataPoint.Opacity;
                break;

            case VcProperties.ShowInLegend:
                chart.InvokeRender();
                break;

            case VcProperties.ToolTipText:
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                break;

            case VcProperties.XValueFormatString:
            case VcProperties.YValueFormatString:
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                CandleStick.CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                break;

            case VcProperties.XValueType:
                chart.InvokeRender();
                break;

            case VcProperties.Enabled:
                CreateOrUpdateAStockDataPoint(dataPoint, dsFaces.Visual as Canvas, dsFaces.LabelCanvas, dsFaces.Visual.Width, dsFaces.Visual.Height, dataPointWidth);
                break;

            case VcProperties.XValue:
            case VcProperties.YValues:
                if (isAxisChanged)
                {
                    UpdateDataSeries(dataSeries, property, newValue, isAxisChanged);
                }
                else
                {
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    UpdateYValueAndXValuePosition(dataPoint, dsFaces.Visual.Width, dsFaces.Visual.Height, dpFaces.Visual.Width);

                    if ((Boolean)dataPoint.LabelEnabled)
                    {
                        CandleStick.CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                    }
                }

                if (dataPoint.Parent.SelectionEnabled && dataPoint.Selected)
                {
                    dataPoint.Select(true);
                }

                break;
            }
        }
示例#17
0
        /// <summary>
        /// Updates a spline DataSeries
        /// </summary>
        /// <param name="property">VcProperties</param>
        /// <param name="dataSeries">DataSeries</param>
        /// <param name="width">Width of the parent of the visual</param>
        /// <param name="height">Height of the parent of the visual</param>
        /// <param name="label2dCanvas">LabelCanvas</param>
        internal static void UpdateSplineSeries(VcProperties property, DataSeries dataSeries, Double width, Double height, Canvas label2dCanvas)
        {   
            Chart chart = dataSeries.Chart as Chart;
           
            if (dataSeries.Enabled == false || chart == null)
                return;

            Boolean isAnimatedUpdate = (Boolean) chart.AnimatedUpdate;

            Canvas chartsCanvas = dataSeries.Faces.Visual.Parent as Canvas;
            Canvas labelsCanvas = dataSeries.Faces.LabelCanvas.Parent as Canvas;

            UpdateSizeOfTheParentCanvas(dataSeries, width, height);
            
            // Groups of broken line segments
            List<List<DataPoint>> pointCollectionList = new List<List<DataPoint>>();
            
            HideAllMarkersAndLabels(dataSeries);

            List<DataPoint> viewPortDataPoints = RenderHelper.GetDataPointsUnderViewPort(dataSeries, false);

            LineChart.CreateGroupOfBrokenLineSegment(dataSeries, viewPortDataPoints, width, height, out pointCollectionList);

            if (property != VcProperties.DataPointUpdate || isAnimatedUpdate == false)
                ReDrawLineSplineSereis(dataSeries, pointCollectionList, width, height, label2dCanvas);

            if (property == VcProperties.DataPointUpdate && isAnimatedUpdate == true)
            {
                /* If old YValue of any DataPoint was NAN or YValue of any DataPoint set to NAN 
                 * then its needed to redraw the Spline of while doing PartialUpdate  */
                Boolean forceRedraw = false;

                // Check whether any YValue is updated and its set to NaN
                foreach (DataPoint dp in viewPortDataPoints)
                {
                    if ((!Double.IsNaN(dp._oldYValue) && Double.IsNaN(dp.InternalYValue)) ||
                        (!Double.IsNaN(dp.InternalYValue) && Double.IsNaN(dp._oldYValue)))
                    {   
                        // dp.Faces = null;
                        dp._oldYValue = dp.InternalYValue;
                        forceRedraw = true;
                        break;
                    }
                }

                if (forceRedraw == false)
                {
                    foreach (List<DataPoint> pointList in pointCollectionList)
                    {
                        foreach (DataPoint dp in pointList)
                        {
                            if (dp.Faces == null)
                            {
                                forceRedraw = true;
                                break;
                            }
                        }

                        if (forceRedraw)
                            break;

                    }
                }

                if (forceRedraw)
                    ReDrawLineSplineSereis(dataSeries, pointCollectionList, width, height, label2dCanvas);

                //if (dataSeries.Storyboard != null)
                //{
                //    dataSeries.Storyboard.FillBehavior = FillBehavior.Stop;
                //    dataSeries.Storyboard.Stop();
                //    dataSeries.Storyboard.Children.Clear();
                //}

                dataSeries.Storyboard = AnimateSpline(pointCollectionList);

                if(dataSeries.Storyboard != null)
                    dataSeries.Storyboard.Begin();

                if (dataSeries._movingMarker != null)
                    dataSeries._movingMarker.Visibility = Visibility.Collapsed;

                chart._toolTip.Hide();

                if (dataSeries.ToolTipElement != null)
                    dataSeries.ToolTipElement.Hide();

                chart.ChartArea.DisableIndicators();
            }

            dataSeries._movingMarker.Visibility = Visibility.Collapsed;

            Clip(chart, chartsCanvas, labelsCanvas, dataSeries.PlotGroup);
        }
示例#18
0
        /// <summary>
        /// UpdateVisual is used for partial rendering
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties property, object newValue)
        {
            if (!IsNotificationEnable || (Chart != null && (Double.IsNaN((Chart as Chart).ActualWidth) || Double.IsNaN((Chart as Chart).ActualHeight) || (Chart as Chart).ActualWidth == 0 || (Chart as Chart).ActualHeight == 0)))
                return;

            if (IsInDesignMode)
            {   
                if (Chart != null)
                    (Chart as Chart).RENDER_LOCK = false;

                FirePropertyChanged(property);
                return;
            }

            if (Chart != null && (Chart as Chart).IS_FULL_RENDER_PENDING)
                return;

            if (ValidatePartialUpdate(RenderAs, property))
            {   
                if (NonPartialUpdateChartTypes(RenderAs) && property != VcProperties.ScrollBarScale)
                {
                    if (property == VcProperties.Color)
                        PartialUpdateOfColorProperty((Brush)newValue);
                    else
                        FirePropertyChanged(property);

                    return;
                }

                Chart chart = Chart as Chart;

                if (chart == null)
                    return;
                else
                    chart._internalPartialUpdateEnabled = true;

                Boolean renderAxis = false;

                _isZooming = false;

                if (property == VcProperties.ColorSet)
                {
                    Brush brush = null;
                    (Chart as Chart).ChartArea.LoadSeriesColorSet4SingleSeries(this);

                    if (RenderHelper.IsLineCType(this) || RenderAs == RenderAs.Area)
                    {
                        brush = Color;
                        RenderHelper.UpdateVisualObject(RenderAs, this, VcProperties.Color, brush, renderAxis);
                    }

                    foreach (DataPoint dp in InternalDataPoints)
                    {
                        if (!String.IsNullOrEmpty(ColorSet) && (Brush)dp.GetValue(DataSeries.ColorProperty) == null)
                            brush = dp._internalColor;

                        RenderHelper.UpdateVisualObject(RenderAs, dp, VcProperties.Color, brush, renderAxis);

                        if (RenderAs != RenderAs.CandleStick)
                            DataPoint.UpdateLegendMarker(dp, dp.Color);
                    }

                    if (RenderAs != RenderAs.CandleStick)
                        UpdateLegendMarker();

                }
                else if (property == VcProperties.Color)
                {
                    if (RenderAs != RenderAs.CandleStick)
                        UpdateLegendMarker();

                    if (RenderHelper.IsLineCType(this) || RenderAs == RenderAs.Area)
                    {
                        RenderHelper.UpdateVisualObject(RenderAs, this, VcProperties.Color, newValue, renderAxis);
                    }

                    foreach (DataPoint dp in InternalDataPoints)
                    {
                        RenderHelper.UpdateVisualObject(RenderAs, dp, VcProperties.Color, newValue, renderAxis);

                        if (RenderAs != RenderAs.CandleStick)
                            DataPoint.UpdateLegendMarker(dp, (Brush)newValue);
                    }
                }
                else if (property == VcProperties.ShadowEnabled || property == VcProperties.Opacity)
                {
                    if (RenderHelper.IsLineCType(this) || RenderAs == RenderAs.Area)
                        //LineChart.Update(this, property, newValue);
                        RenderHelper.UpdateVisualObject(RenderAs, this, property, newValue, renderAxis);

                    foreach (DataPoint dp in InternalDataPoints)
                        RenderHelper.UpdateVisualObject(RenderAs, dp, property, newValue, renderAxis);
                }
                else if (property == VcProperties.LineStyle || property == VcProperties.LineThickness || property == VcProperties.LightingEnabled)
                {
                    if (RenderHelper.IsLineCType(this) || RenderAs == RenderAs.Area)
                        RenderHelper.UpdateVisualObject(RenderAs, this, property, newValue, renderAxis);

                    foreach (DataPoint dp in InternalDataPoints)
                        RenderHelper.UpdateVisualObject(RenderAs, dp, property, newValue, renderAxis);
                }
                else if (property == VcProperties.BorderColor || property == VcProperties.BorderThickness || property == VcProperties.BorderStyle)
                {   
                    if (RenderAs == RenderAs.Area)
                        RenderHelper.UpdateVisualObject(RenderAs, this, property, newValue, renderAxis);

                    foreach (DataPoint dp in InternalDataPoints)
                        RenderHelper.UpdateVisualObject(RenderAs, dp, property, newValue, renderAxis);
                }
                else if (property == VcProperties.ViewportRangeEnabled)
                {
                    renderAxis = true;
                    RenderHelper.UpdateVisualObject(chart, property, newValue, false);
                }
                else if (property == VcProperties.DataPointUpdate || property == VcProperties.DataPoints || property == VcProperties.Enabled || property == VcProperties.ScrollBarScale || property == VcProperties.AxisMinimum || property == VcProperties.AxisMaximum)
                {
                    AxisRepresentations axisRepresentation = AxisRepresentations.AxisX;

                    if ((chart.ZoomingEnabled && property == VcProperties.ScrollBarScale)
                        || (property == VcProperties.AxisMinimum || property == VcProperties.AxisMaximum))
                    {   
                        renderAxis = true;
                        _isZooming = true;
                        property = VcProperties.DataPoints;
                    }
                    else
                    {
                        if (chart.PlotDetails == null || PlotGroup == null)
                            return;

                        Double oldAxisMaxY = chart.PlotDetails.GetAxisYMaximumDataValue(PlotGroup.AxisY);
                        Double oldAxisMinY = chart.PlotDetails.GetAxisYMinimumDataValue(PlotGroup.AxisY);
                        Double oldAxisMaxX = chart.PlotDetails.GetAxisXMaximumDataValue(PlotGroup.AxisX);
                        Double oldAxisMinX = chart.PlotDetails.GetAxisXMinimumDataValue(PlotGroup.AxisX);

                        chart.ChartArea.PrePartialUpdateConfiguration(this, ElementTypes.DataSeries, (property == VcProperties.DataPointUpdate ? VcProperties.DataPoints : property), null, newValue, true, true, false, AxisRepresentations.AxisX, true);

                        Double newAxisMaxY = chart.PlotDetails.GetAxisYMaximumDataValue(PlotGroup.AxisY);
                        Double newAxisMinY = chart.PlotDetails.GetAxisYMinimumDataValue(PlotGroup.AxisY);
                        Double newAxisMaxX = chart.PlotDetails.GetAxisXMaximumDataValue(PlotGroup.AxisX);
                        Double newAxisMinX = chart.PlotDetails.GetAxisXMinimumDataValue(PlotGroup.AxisX);

                        // System.Diagnostics.Debug.WriteLine("OldAxisMaxY = " + OldAxisMaxY.ToString() + " OldAxisMinY=" + OldAxisMinY.ToString());
                        // System.Diagnostics.Debug.WriteLine("NewAxisMaxY = " + NewAxisMaxY.ToString() + " NewAxisMinY=" + NewAxisMinY.ToString());

                        if (PlotGroup.AxisY.ViewportRangeEnabled)
                        {   
                            renderAxis = true;
                            axisRepresentation = AxisRepresentations.AxisY;
                        }
                        if (newAxisMaxY != oldAxisMaxY || newAxisMinY != oldAxisMinY)
                        {
                            renderAxis = true;
                            axisRepresentation = AxisRepresentations.AxisY;
                        }
                        else if (newAxisMaxX != oldAxisMaxX || newAxisMinX != oldAxisMinX)
                        {
                            renderAxis = true;
                        }
                        // New value will be null if one or more number of DataPoints removed
                        else if (property == VcProperties.DataPoints && newValue == null)
                        {   
                            renderAxis = true;
                            axisRepresentation = AxisRepresentations.AxisX;
                        }
                    }

                    // Render Axis if required
                    chart.ChartArea.PrePartialUpdateConfiguration(this, ElementTypes.DataSeries, property, null, newValue, false, false, renderAxis, axisRepresentation, true);

                    if (property == VcProperties.DataPointUpdate && !_isZooming)
                    {
                        if (renderAxis)
                        {
                            foreach (DataSeries ds in chart.InternalSeries)
                            {
                                if (ds.RenderAs == RenderAs.Spline || ds.RenderAs == RenderAs.QuickLine)
                                    RenderHelper.UpdateVisualObject(this.RenderAs, this, property, newValue, renderAxis);
                                else
                                {
                                    foreach (DataPoint dp in ds.InternalDataPoints)
                                    {
                                        dp.UpdateVisual(VcProperties.YValue, dp.InternalYValue, false);
                                    }
                                }
                            }
                        }
                        else
                            RenderHelper.UpdateVisualObject(this.RenderAs, this, property, newValue, renderAxis);
                    }
                    else if (renderAxis)
                    {   
                        // Need to Rerender all charts if axis changes
                        RenderHelper.UpdateVisualObject(chart, property, newValue, false);
                    }
                    else
                    {   
                        RenderHelper.UpdateVisualObject(this.RenderAs, this, property, newValue, renderAxis);
                    }
                }
                else if (property == VcProperties.AxisXType ||
                    property == VcProperties.AxisXType || property == VcProperties.Enabled)
                {
                    renderAxis = true;
                    chart.ChartArea.PrePartialUpdateConfiguration(this, ElementTypes.DataSeries, property, null, newValue, true, true, true, AxisRepresentations.AxisX, true);
                    RenderHelper.UpdateVisualObject(RenderAs, this, property, newValue, renderAxis);
                }
                else
                    foreach (DataPoint dp in InternalDataPoints)
                        RenderHelper.UpdateVisualObject(RenderAs, dp, property, newValue, renderAxis);
            }
        }
 /// <summary>
 /// UpdateVisual is used for partial rendering
 /// </summary>
 /// <param name="propertyName">Name of the property</param>
 /// <param name="value">Value of the property</param>
 internal virtual void UpdateVisual(VcProperties propertyName, object value)
 {
 }
示例#20
0
        internal static void UpdateVisualObject(RenderAs chartType, Visifire.Commons.ObservableObject sender, VcProperties property, object newValue, Boolean isAXisChanged)
        {
            Boolean   isDataPoint = sender.GetType().Equals(typeof(DataPoint));
            DataPoint dataPoint   = sender as DataPoint;
            Chart     chart       = (sender as ObservableObject).Chart as Chart;

            switch (chartType)
            {
            case RenderAs.Column:
            case RenderAs.Bar:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                //ColumnChart.GetVisualObjectForColumnChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                break;

            // renderedCanvas = BarChart.GetVisualObjectForBarChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);

            case RenderAs.Line:

                //if (isAXisChanged && isDataPoint && chart._partialUpdateAnimation)
                //{   foreach (DataSeries ds in chart.Series)
                //    {
                //        //if (ds == dataPoint.Parent)
                //        //    continue;

                //        foreach (DataPoint dp in ds.DataPoints)
                //        {
                //            RenderHelper.UpdateVisualObject(ds.RenderAs, dp, property, newValue, false);
                //        }
                //    }
                //}
                //else
                //    LineChart.Update(sender, property, newValue);

                LineChart.Update(sender, property, newValue, isAXisChanged);

                break;

            case RenderAs.Point:
                PointChart.Update(sender, property, newValue, isAXisChanged);
                //renderedCanvas = PointChart.GetVisualObjectForPointChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.Bubble:
                BubbleChart.Update(sender, property, newValue, isAXisChanged);
                //renderedCanvas = BubbleChart.GetVisualObjectForBubbleChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.Area:
                AreaChart.Update(sender, property, newValue, isAXisChanged);
                //renderedCanvas = AreaChart.GetVisualObjectForAreaChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.StackedColumn:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                //renderedCanvas = ColumnChart.GetVisualObjectForStackedColumnChart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.StackedColumn100:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                // renderedCanvas = ColumnChart.GetVisualObjectForStackedColumn100Chart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.StackedBar:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                //renderedCanvas = BarChart.GetVisualObjectForStackedBarChart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.StackedBar100:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                //renderedCanvas = BarChart.GetVisualObjectForStackedBar100Chart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.Pie:
                //renderedCanvas = PieChart.GetVisualObjectForPieChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                break;

            case RenderAs.Doughnut:
                //renderedCanvas = PieChart.GetVisualObjectForDoughnutChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                break;

            case RenderAs.StackedArea:
                //renderedCanvas = AreaChart.GetVisualObjectForStackedAreaChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.StackedArea100:
                //renderedCanvas = AreaChart.GetVisualObjectForStackedArea100Chart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.SectionFunnel:
                //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, false);
                break;

            case RenderAs.StreamLineFunnel:
                //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, true);
                break;

            case RenderAs.Stock:
                StockChart.Update(sender, property, newValue, isAXisChanged);
                //renderedCanvas = StockChart.GetVisualObjectForStockChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                break;

            case RenderAs.CandleStick:
                CandleStick.Update(sender, property, newValue, isAXisChanged);
                //renderedCanvas = CandleStick.GetVisualObjectForCandleStick(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                break;
            }

            chart.ChartArea.AttachScrollEvents();
        }
示例#21
0
        /// <summary>
        /// UpdateVisual is used for partial rendering
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties propertyName, object value)
        {
            if (Chart == null)
                return;

            if (StartValue != null && EndValue != null && Value != null)
                throw new Exception("Value property cannot be set with StartValue and EndValue in TrendLine");

            if (Visual == null || (Value != null && Line == null) || (StartValue != null && EndValue != null && Rectangle == null))
            {   
                FirePropertyChanged(propertyName);
            }
            else if((!VisifireControl.IsMediaEffectsEnabled && propertyName == VcProperties.ShadowEnabled))
            {
                FirePropertyChanged(propertyName);
            }
            else if (propertyName == VcProperties.Value || propertyName == VcProperties.StartValue || propertyName == VcProperties.EndValue)
            {   
                Chart chart = (Chart as Chart);
                Axis axis = chart.PlotDetails.GetAxisXFromChart(chart, AxisType);
                chart.PlotDetails.SetTrendLineValue(this, axis);
                chart.PlotDetails.SetTrendLineStartAndEndValue(this, axis);
                Canvas visualCanvas = (Chart as Chart).ChartArea.ChartVisualCanvas;
                PositionTrendLineLabel(visualCanvas.Width, visualCanvas.Height);
                PositionTheLine(visualCanvas.Width, visualCanvas.Height);
                PositionTheStartEndRectangle(visualCanvas.Width, visualCanvas.Height);
            }
            else
            {
                ApplyProperties();
                ApplyRectangleProperties();
                ApplyLabelFontProperties(LabelTextBlock);
                PositionTrendLineLabel((Chart as Chart).ChartArea.ChartVisualCanvas.Width, (Chart as Chart).ChartArea.ChartVisualCanvas.Height);
            }
        }
示例#22
0
 /// <summary>
 /// UpdateVisual is used for partial rendering
 /// </summary>
 /// <param name="propertyName">Name of the property</param>
 /// <param name="value">Value of the property</param>
 internal override void UpdateVisual(VcProperties propertyName, object value)
 {
     if (Line == null || Shadow == null)
         FirePropertyChanged(propertyName);
     else if (propertyName == VcProperties.Value)
     {
         Chart chart = (Chart as Chart);
         Axis axis = chart.PlotDetails.GetAxisXFromChart(chart, AxisType);
         chart.PlotDetails.SetTrendLineValue(this, axis);
         Canvas visualCanvas = (Chart as Chart).ChartArea.ChartVisualCanvas;
         PositionTheLine(visualCanvas.Width, visualCanvas.Height);
     }
     else
         ApplyProperties();
 }
示例#23
0
        internal static void Update(Chart chart, RenderAs currentRenderAs, List<DataSeries> selectedDataSeries4Rendering, VcProperties property, object newValue)
        {   
            Boolean is3D = chart.View3D;
            ChartArea chartArea = chart.ChartArea;
            Canvas ChartVisualCanvas = chart.ChartArea.ChartVisualCanvas;

            // Double width = chart.ChartArea.ChartVisualCanvas.Width;
            // Double height = chart.ChartArea.ChartVisualCanvas.Height;

            Panel preExistingPanel = null;
            Dictionary<RenderAs, Panel> RenderedCanvasList = chart.ChartArea.RenderedCanvasList;

            if (chartArea.RenderedCanvasList.ContainsKey(currentRenderAs))
            {
                preExistingPanel = RenderedCanvasList[currentRenderAs];
            }

            Panel renderedChart = chartArea.RenderSeriesFromList(preExistingPanel, selectedDataSeries4Rendering);

            if (preExistingPanel == null)
            {
                chartArea.RenderedCanvasList.Add(currentRenderAs, renderedChart);
                ChartVisualCanvas.Children.Add(renderedChart);
            }
        }
示例#24
0
        internal static void UpdateVisualObject(RenderAs chartType, Visifire.Commons.ObservableObject sender, VcProperties property, object newValue, Boolean isAXisChanged)
        {
            Boolean isDataPoint = sender.GetType().Equals(typeof(DataPoint));
            DataPoint dataPoint = sender as DataPoint;
            Chart chart = (sender as ObservableObject).Chart as Chart;
            switch (chartType)
            {   
                case RenderAs.Column:
                case RenderAs.Bar:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                    //ColumnChart.GetVisualObjectForColumnChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;
                    
                    // renderedCanvas = BarChart.GetVisualObjectForBarChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);

                case RenderAs.Line:

                    //if (isAXisChanged && isDataPoint && chart._partialUpdateAnimation)
                    //{   foreach (DataSeries ds in chart.Series)
                    //    {   
                    //        //if (ds == dataPoint.Parent)
                    //        //    continue;
                            
                    //        foreach (DataPoint dp in ds.DataPoints)
                    //        {   
                    //            RenderHelper.UpdateVisualObject(ds.RenderAs, dp, property, newValue, false);
                    //        }
                    //    }
                    //}
                    //else
                    //    LineChart.Update(sender, property, newValue);

                    LineChart.Update(sender, property, newValue, isAXisChanged);
                    
                    break;

                case RenderAs.Point:
                    PointChart.Update(sender, property, newValue, isAXisChanged);
                    //renderedCanvas = PointChart.GetVisualObjectForPointChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.Bubble:
                    BubbleChart.Update(sender, property, newValue, isAXisChanged);
                    //renderedCanvas = BubbleChart.GetVisualObjectForBubbleChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.Area:
                    AreaChart.Update(sender, property, newValue, isAXisChanged);
                    //renderedCanvas = AreaChart.GetVisualObjectForAreaChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedColumn:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                    //renderedCanvas = ColumnChart.GetVisualObjectForStackedColumnChart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedColumn100:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                   // renderedCanvas = ColumnChart.GetVisualObjectForStackedColumn100Chart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedBar:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                    //renderedCanvas = BarChart.GetVisualObjectForStackedBarChart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedBar100:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                    //renderedCanvas = BarChart.GetVisualObjectForStackedBar100Chart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.Pie:
                    //renderedCanvas = PieChart.GetVisualObjectForPieChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                    break;

                case RenderAs.Doughnut:
                    //renderedCanvas = PieChart.GetVisualObjectForDoughnutChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                    break;

                case RenderAs.StackedArea:
                    //renderedCanvas = AreaChart.GetVisualObjectForStackedAreaChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedArea100:
                    //renderedCanvas = AreaChart.GetVisualObjectForStackedArea100Chart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.SectionFunnel:
                    //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, false);
                    break;

                case RenderAs.StreamLineFunnel:
                    //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, true);
                    break;

                case RenderAs.Stock:
                    StockChart.Update(sender, property, newValue, isAXisChanged);
                    //renderedCanvas = StockChart.GetVisualObjectForStockChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.CandleStick:
                    CandleStick.Update(sender, property, newValue, isAXisChanged);
                    //renderedCanvas = CandleStick.GetVisualObjectForCandleStick(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;
            }

            chart.ChartArea.AttachScrollEvents();
        }
示例#25
0
        internal static void UpdateVisualObject(Chart chart, VcProperties property, object newValue, Boolean partialUpdate)
        {   
            if (partialUpdate && chart._datapoint2UpdatePartially.Count <= 500)
            {   
                chart.PARTIAL_DP_RENDER_LOCK = false;
                Boolean isNeed2UpdateAllSeries = false;

                foreach(KeyValuePair<DataPoint, VcProperties>  dpInfo in chart._datapoint2UpdatePartially)
                {   
                    DataPoint dp = dpInfo.Key;

                    if (dpInfo.Value == VcProperties.XValue)
                    {
                        isNeed2UpdateAllSeries = true;
                        break;
                    }

                    PropertyInfo pInfo = dp.GetType().GetProperty(dpInfo.Value.ToString());
                    newValue = pInfo.GetValue(dp, null);

                    isNeed2UpdateAllSeries = dpInfo.Key.UpdateVisual(dpInfo.Value, newValue, true);

                    if (isNeed2UpdateAllSeries)
                        break;
                }

                if (!isNeed2UpdateAllSeries)
                    return;
            }

            chart.ChartArea.PrePartialUpdateConfiguration(chart, VcProperties.None, null, null, false, true, true, AxisRepresentations.AxisY, true);
            
            //chart.ChartArea.RenderSeries();
            Int32 renderedSeriesCount = 0;      // Contain count of series that have been already rendered

            // Contains a list of serties as per the drawing order generated in the plotdetails
            List<DataSeries> dataSeriesListInDrawingOrder = chart.PlotDetails.SeriesDrawingIndex.Keys.ToList();

            List<DataSeries> selectedDataSeries4Rendering;          // Contains a list of serries to be rendered in a rendering cycle
            Int32 currentDrawingIndex;                              // Drawing index of the selected series 
            RenderAs currentRenderAs;                               // Rendereas type of the selected series

            // This loop will select series for rendering and it will repeat until all series have been rendered
            while (renderedSeriesCount < chart.InternalSeries.Count)
            {
                selectedDataSeries4Rendering = new List<DataSeries>();

                currentRenderAs = dataSeriesListInDrawingOrder[renderedSeriesCount].RenderAs;

                currentDrawingIndex = chart.PlotDetails.SeriesDrawingIndex[dataSeriesListInDrawingOrder[renderedSeriesCount]];

                for (Int32 i = renderedSeriesCount; i < chart.InternalSeries.Count; i++)
                {
                    DataSeries ds = dataSeriesListInDrawingOrder[i];
                    if (currentRenderAs == ds.RenderAs && currentDrawingIndex == chart.PlotDetails.SeriesDrawingIndex[ds])
                        selectedDataSeries4Rendering.Add(ds);
                }

                if (selectedDataSeries4Rendering.Count == 0)
                    break;

                chart._toolTip.Hide();

                switch (currentRenderAs)
                {
                    case RenderAs.Column:
                    case RenderAs.Bar:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                        break;

                     //renderedCanvas = BarChart.GetVisualObjectForBarChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);

                  case RenderAs.Line:

                        if(property == VcProperties.Enabled)
                            ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                            //LineChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                        else
                            //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                            foreach(DataSeries ds in selectedDataSeries4Rendering)
                                LineChart.Update(ds, property, newValue, false);
                        break;

                    case RenderAs.Point:

                        foreach (DataSeries ds in selectedDataSeries4Rendering)
                        {
                            foreach (DataPoint dp in ds.InternalDataPoints)
                            {
                                RenderHelper.UpdateVisualObject(ds.RenderAs, dp, property, newValue, false);
                            }
                        }

                        // ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                        break;

                    case RenderAs.Bubble:

                        foreach (DataSeries ds in selectedDataSeries4Rendering)
                        {
                            foreach (DataPoint dp in ds.InternalDataPoints)
                            {
                                RenderHelper.UpdateVisualObject(ds.RenderAs, dp, property, newValue, false);
                            }
                        }

                        // ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                        // BubbleChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);

                        //renderedCanvas = BubbleChart.GetVisualObjectForBubbleChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                        break;

                    case RenderAs.Area:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                       // AreaChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                        //renderedCanvas = AreaChart.GetVisualObjectForAreaChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                        break;

                    case RenderAs.StackedColumn:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                        //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                        //renderedCanvas = ColumnChart.GetVisualObjectForStackedColumnChart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                        break;

                    case RenderAs.StackedColumn100:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                        //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);

                         //renderedCanvas = ColumnChart.GetVisualObjectForStackedColumn100Chart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                        break;

                    case RenderAs.StackedBar:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                        //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                        //renderedCanvas = BarChart.GetVisualObjectForStackedBarChart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                        break;

                    case RenderAs.StackedBar100:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                        //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);

                        //renderedCanvas = BarChart.GetVisualObjectForStackedBar100Chart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                        break;

                    case RenderAs.Pie:
                        //renderedCanvas = PieChart.GetVisualObjectForPieChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                        break;

                    case RenderAs.Doughnut:
                        //renderedCanvas = PieChart.GetVisualObjectForDoughnutChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                        break;

                    case RenderAs.StackedArea:
                        //renderedCanvas = AreaChart.GetVisualObjectForStackedAreaChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                        break;

                    case RenderAs.StackedArea100:
                        //renderedCanvas = AreaChart.GetVisualObjectForStackedArea100Chart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                        break;

                    case RenderAs.SectionFunnel:
                       // renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, false);

                        break;

                    case RenderAs.StreamLineFunnel:
                        //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, true);
                        break;

                    case RenderAs.Stock:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                        //StockChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                       // renderedCanvas = StockChart.GetVisualObjectForStockChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                        break;

                    case RenderAs.CandleStick:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                       // CandleStick.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                       // renderedCanvas = CandleStick.GetVisualObjectForCandleStick(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                        break;
               
                }

                //renderedChart = RenderSeriesFromList(selectedDataSeries4Rendering);

                renderedSeriesCount += selectedDataSeries4Rendering.Count;
            }

            chart.ChartArea.AttachScrollEvents();
            Visifire.Charts.Chart.SelectDataPoints(chart);
            //AttachEventsToolTipHref2DataSeries();
        }
示例#26
0
        /// <summary>
        /// UpdateVisual is used for partial rendering
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        /// <returns>Is need to update all DataPoints on axis change</returns>
        internal Boolean UpdateVisual(VcProperties property, object newValue, Boolean recursive)
        {   
            // if (Parent == null || !ValidatePartialUpdate(Parent.RenderAs, property))
            //    return;

            if (!recursive && NonPartialUpdateChartTypes(Parent.RenderAs))
            {   
                if (property == VcProperties.Color)
                    PartialUpdateOfColorProperty(newValue as Brush);
                else
                    FirePropertyChanged(property);

                return false;
            }

            Chart chart = Chart as Chart;

            if (!chart.PARTIAL_DP_RENDER_LOCK || recursive)
            {   
                Boolean updateAllDpsOnAxisChange = false;
                Boolean renderAxis = false;
                PlotGroup plotGroup = Parent.PlotGroup;
                AxisRepresentations axisRepresentation = AxisRepresentations.AxisX;

                /* Line and bubble are first while updating DataPoints one by one. So to take advantage of updating DataPoints one by one
                conditions are written below */
                if (Parent.RenderAs != RenderAs.Line || (Parent.RenderAs == RenderAs.Line && chart.AnimatedUpdate == false))
                {
                    if (!recursive && (property == VcProperties.YValue) && (chart.PlotDetails.ListOfAllDataPoints.Count > 1000 || !chart.AnimatedUpdate))
                    {
                        chart.PARTIAL_DP_RENDER_LOCK = true;
                        chart.PARTIAL_RENDER_BLOCKD_COUNT = 0;
                        chart._datapoint2UpdatePartially = new Dictionary<DataPoint, VcProperties>();
                        chart._datapoint2UpdatePartially.Add(this, property);
                    }
                    else if (!recursive && property == VcProperties.XValue && (Parent.RenderAs != RenderAs.Line || Parent.RenderAs != RenderAs.Bubble || Parent.RenderAs != RenderAs.Point))
                    {   
                        chart.PARTIAL_DP_RENDER_LOCK = true;
                        chart.PARTIAL_RENDER_BLOCKD_COUNT = 0;
                        chart._datapoint2UpdatePartially = new Dictionary<DataPoint, VcProperties>();
                        chart._datapoint2UpdatePartially.Add(this, property);
                    }
                    else
                        chart.PARTIAL_DP_RENDER_LOCK = false;

                }


                if (!chart.PARTIAL_DP_RENDER_LOCK || recursive)
                {
                    if (Parent.RenderAs == RenderAs.Area)
                    {
                        if (property == VcProperties.BorderThickness || property == VcProperties.BorderColor || property == VcProperties.BorderStyle)
                            return false;
                    }

                    if (property == VcProperties.YValue || property == VcProperties.YValues)
                    {
                        Double OldMaxYValue = chart.PlotDetails.GetAxisYMaximumDataValue(plotGroup.AxisY);
                        Double OldMinYValue = chart.PlotDetails.GetAxisYMinimumDataValue(plotGroup.AxisY);

                        Object oldValue = (Parent.RenderAs == RenderAs.CandleStick || Parent.RenderAs == RenderAs.Stock) ? (Object)_oldYValues : _oldYValue;

                        chart.PlotDetails.ReCreate(this, property, oldValue, newValue);

                        Double NewMaxYValue = chart.PlotDetails.GetAxisYMaximumDataValue(plotGroup.AxisY);
                        Double NewMinYValue = chart.PlotDetails.GetAxisYMinimumDataValue(plotGroup.AxisY);

                        System.Diagnostics.Debug.WriteLine("OldAxisMaxY = " + OldMaxYValue.ToString() + " OldAxisMinY=" + OldMinYValue.ToString());
                        System.Diagnostics.Debug.WriteLine("NewAxisMaxY = " + NewMaxYValue.ToString() + " NewAxisMinY=" + NewMinYValue.ToString());

                        if (plotGroup.AxisY.AxisMinimum == null || plotGroup.AxisY.AxisMaximum == null)
                        {
                            if (NewMaxYValue != OldMaxYValue || (Double)NewMinYValue != OldMinYValue)
                            {
                                renderAxis = true;
                                axisRepresentation = AxisRepresentations.AxisY;
                                System.Diagnostics.Debug.WriteLine("RenderAxis1 =" + renderAxis.ToString());
                            }
                        }
                    }
                    else if (property == VcProperties.XValue)
                    {
                        Double OldMaxXValue = chart.PlotDetails.GetAxisXMaximumDataValue(plotGroup.AxisX);
                        Double OldMinXValue = chart.PlotDetails.GetAxisXMinimumDataValue(plotGroup.AxisX);
                        Double OldMaxYValue = chart.PlotDetails.GetAxisYMaximumDataValue(plotGroup.AxisY);
                        Double OldMinYValue = chart.PlotDetails.GetAxisYMinimumDataValue(plotGroup.AxisY);

                        chart.PlotDetails.ReCreate(this, property, null, newValue);

                        Double NewMaxXValue = chart.PlotDetails.GetAxisXMaximumDataValue(plotGroup.AxisX);
                        Double NewMinXValue = chart.PlotDetails.GetAxisXMinimumDataValue(plotGroup.AxisX);
                        Double NewMaxYValue = chart.PlotDetails.GetAxisYMaximumDataValue(plotGroup.AxisY);
                        Double NewMinYValue = chart.PlotDetails.GetAxisYMinimumDataValue(plotGroup.AxisY);

                        //System.Diagnostics.Debug.WriteLine("OldAxisMaxX = " + OldAxisMaxX.ToString() + " OldAxisMinX=" + OldAxisMinX.ToString());
                        //System.Diagnostics.Debug.WriteLine("NewAxisMaxX = " + NewAxisMaxX.ToString() + " NewAxisMinX=" + NewAxisMinX.ToString());

                        if (plotGroup.AxisX.AxisMinimum == null || plotGroup.AxisX.AxisMaximum == null)
                        {
                            if (NewMaxXValue != OldMaxXValue || (Double)NewMinXValue != OldMinXValue)
                            {
                                renderAxis = true;
                                axisRepresentation = AxisRepresentations.AxisX;
                            }
                        }

                        if (plotGroup.AxisY.AxisMinimum == null || plotGroup.AxisY.AxisMaximum == null)
                        {
                            if (NewMaxYValue != OldMaxYValue || (Double)NewMinYValue != OldMinYValue)
                            {
                                renderAxis = true;
                                axisRepresentation = AxisRepresentations.AxisY;
                            }
                        }
                    }

                    // renderAxis = false;
                    Double oldZeroBaseLineY = 0, oldZeroBaseLineX = 0;
                    if (renderAxis == true)
                    {
                        if (property == VcProperties.YValue)
                            oldZeroBaseLineY = plotGroup.AxisY._zeroBaseLinePosition;
                        else if (property == VcProperties.XValue)
                            oldZeroBaseLineX = plotGroup.AxisX._zeroBaseLinePosition;
                    }
                    System.Diagnostics.Debug.WriteLine("RenderAxis2 =" + renderAxis.ToString());
                    chart.ChartArea.PrePartialUpdateConfiguration(this, property, null, null, false, false, renderAxis, axisRepresentation, true);

                    if (property == VcProperties.YValue)
                    {
                        if (plotGroup.AxisY._oldInternalAxisMinimum == plotGroup.AxisY.InternalAxisMinimum &&
                            plotGroup.AxisY._oldInternalAxisMaximum == plotGroup.AxisY.InternalAxisMaximum)
                            renderAxis = false;
                    }
                    else if (property == VcProperties.XValue)
                    {
                        if (plotGroup.AxisX._oldInternalAxisMinimum == plotGroup.AxisX.InternalAxisMinimum &&
                            plotGroup.AxisX._oldInternalAxisMaximum == plotGroup.AxisX.InternalAxisMaximum)
                            renderAxis = false;
                    }

                    if (renderAxis == true)
                    {   
                        if (property == VcProperties.YValue)
                        {   
                            if (oldZeroBaseLineY == plotGroup.AxisY._zeroBaseLinePosition)
                                renderAxis = false;

                        }
                        else if (property == VcProperties.XValue)
                        {
                            if (oldZeroBaseLineX == plotGroup.AxisX._zeroBaseLinePosition)
                                renderAxis = false;
                        }

                        if (renderAxis == false)
                            updateAllDpsOnAxisChange = true;
                    }
                }

                System.Diagnostics.Debug.WriteLine("RenderAxis3 =" + renderAxis.ToString());
                System.Diagnostics.Debug.WriteLine("updateAllDpsOnAxisChange =" + updateAllDpsOnAxisChange.ToString());
                if (chart.PARTIAL_DP_RENDER_LOCK)
                {   
                    chart.Dispatcher.BeginInvoke(new Action<Chart, VcProperties, object, Boolean>(RenderHelper.UpdateVisualObject), new object[] { chart, property, newValue , true });
                    chart.Dispatcher.BeginInvoke(new Action(ActivePartialUpdateRenderLock));

                    // RenderHelper.UpdateVisualObject(chart, property, newValue);
                }
                else if (updateAllDpsOnAxisChange)
                {
                    if (recursive && (!chart.AnimatedUpdate || chart.PlotDetails.ListOfAllDataPoints.Count > 1000))
                    {
                        return true;
                    }
                    else
                    {   
                        foreach (DataSeries ds in chart.InternalSeries)
                        {   
                            foreach (DataPoint dp in ds.InternalDataPoints)
                            {
                                RenderHelper.UpdateVisualObject(ds.RenderAs, dp, property, newValue, !updateAllDpsOnAxisChange);
                            }
                        }
                    }
                }
                else
                    RenderHelper.UpdateVisualObject(Parent.RenderAs, this, property, newValue, renderAxis);

                if (property == VcProperties.Color)
                    UpdateLegendMarker(this, (Brush)newValue);

                // chart._renderLock = false;
            }
            else
            {
                if (!chart._datapoint2UpdatePartially.Keys.Contains(this))
                {   
                    chart._datapoint2UpdatePartially.Add(this, property);
                    chart.PARTIAL_RENDER_BLOCKD_COUNT++;
                }
            }

            return false;
        }
示例#27
0
        /// <summary>
        /// Update visual used for partial update
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties propertyName, object value)
        {
            if (Visual != null)
            {
                //foreach (AxisLabel axisLabel in AxisLabelList)
                //{
                //    ApplyAxisLabelFontProperties(axisLabel);
                //    axisLabel.ApplyProperties(axisLabel);
                //}

                for (Int32 i = 0; i < AxisLabelList.Count; i++)
                {
                    AxisLabel label = AxisLabelList[i];

                    CustomAxisLabel customLabel = CustomAxisLabelList[i];

                    ApplyAxisLabelFontProperties(label, customLabel);
                    label.ApplyProperties(label);
                }
            }
            else
                FirePropertyChanged(propertyName);
        }
示例#28
0
        internal static void UpdateVisualObject(Chart chart, VcProperties property, object newValue, Boolean partialUpdate)
        {
            if (partialUpdate && chart._datapoint2UpdatePartially.Count <= 500)
            {
                chart.PARTIAL_DP_RENDER_LOCK = false;
                Boolean isNeed2UpdateAllSeries = false;

                foreach (KeyValuePair <DataPoint, VcProperties> dpInfo in chart._datapoint2UpdatePartially)
                {
                    DataPoint dp = dpInfo.Key;

                    if (dpInfo.Value == VcProperties.XValue)
                    {
                        isNeed2UpdateAllSeries = true;
                        break;
                    }

                    PropertyInfo pInfo = dp.GetType().GetProperty(dpInfo.Value.ToString());
                    newValue = pInfo.GetValue(dp, null);

                    isNeed2UpdateAllSeries = dpInfo.Key.UpdateVisual(dpInfo.Value, newValue, true);

                    if (isNeed2UpdateAllSeries)
                    {
                        break;
                    }
                }

                if (!isNeed2UpdateAllSeries)
                {
                    return;
                }
            }

            chart.ChartArea.PrePartialUpdateConfiguration(chart, VcProperties.None, null, null, false, true, true, AxisRepresentations.AxisY, true);

            //chart.ChartArea.RenderSeries();
            Int32 renderedSeriesCount = 0;      // Contain count of series that have been already rendered

            // Contains a list of serties as per the drawing order generated in the plotdetails
            List <DataSeries> dataSeriesListInDrawingOrder = chart.PlotDetails.SeriesDrawingIndex.Keys.ToList();

            List <DataSeries> selectedDataSeries4Rendering;         // Contains a list of serries to be rendered in a rendering cycle
            Int32             currentDrawingIndex;                  // Drawing index of the selected series
            RenderAs          currentRenderAs;                      // Rendereas type of the selected series

            // This loop will select series for rendering and it will repeat until all series have been rendered
            while (renderedSeriesCount < chart.InternalSeries.Count)
            {
                selectedDataSeries4Rendering = new List <DataSeries>();

                currentRenderAs = dataSeriesListInDrawingOrder[renderedSeriesCount].RenderAs;

                currentDrawingIndex = chart.PlotDetails.SeriesDrawingIndex[dataSeriesListInDrawingOrder[renderedSeriesCount]];

                for (Int32 i = renderedSeriesCount; i < chart.InternalSeries.Count; i++)
                {
                    DataSeries ds = dataSeriesListInDrawingOrder[i];
                    if (currentRenderAs == ds.RenderAs && currentDrawingIndex == chart.PlotDetails.SeriesDrawingIndex[ds])
                    {
                        selectedDataSeries4Rendering.Add(ds);
                    }
                }

                if (selectedDataSeries4Rendering.Count == 0)
                {
                    break;
                }

                chart._toolTip.Hide();

                switch (currentRenderAs)
                {
                case RenderAs.Column:
                case RenderAs.Bar:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                    break;

                //renderedCanvas = BarChart.GetVisualObjectForBarChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);

                case RenderAs.Line:

                    if (property == VcProperties.Enabled)
                    {
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    }
                    //LineChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                    else
                    {
                        //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                        foreach (DataSeries ds in selectedDataSeries4Rendering)
                        {
                            LineChart.Update(ds, property, newValue, false);
                        }
                    }
                    break;

                case RenderAs.Point:

                    foreach (DataSeries ds in selectedDataSeries4Rendering)
                    {
                        foreach (DataPoint dp in ds.InternalDataPoints)
                        {
                            RenderHelper.UpdateVisualObject(ds.RenderAs, dp, property, newValue, false);
                        }
                    }

                    // ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                    break;

                case RenderAs.Bubble:

                    foreach (DataSeries ds in selectedDataSeries4Rendering)
                    {
                        foreach (DataPoint dp in ds.InternalDataPoints)
                        {
                            RenderHelper.UpdateVisualObject(ds.RenderAs, dp, property, newValue, false);
                        }
                    }

                    // ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                    // BubbleChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);

                    //renderedCanvas = BubbleChart.GetVisualObjectForBubbleChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.Area:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                    // AreaChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                    //renderedCanvas = AreaChart.GetVisualObjectForAreaChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedColumn:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                    //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                    //renderedCanvas = ColumnChart.GetVisualObjectForStackedColumnChart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedColumn100:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                    //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);

                    //renderedCanvas = ColumnChart.GetVisualObjectForStackedColumn100Chart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedBar:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                    //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                    //renderedCanvas = BarChart.GetVisualObjectForStackedBarChart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedBar100:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                    //ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);

                    //renderedCanvas = BarChart.GetVisualObjectForStackedBar100Chart(width, height, plotDetails, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.Pie:
                    //renderedCanvas = PieChart.GetVisualObjectForPieChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                    break;

                case RenderAs.Doughnut:
                    //renderedCanvas = PieChart.GetVisualObjectForDoughnutChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                    break;

                case RenderAs.StackedArea:
                    //renderedCanvas = AreaChart.GetVisualObjectForStackedAreaChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.StackedArea100:
                    //renderedCanvas = AreaChart.GetVisualObjectForStackedArea100Chart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.SectionFunnel:
                    // renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, false);

                    break;

                case RenderAs.StreamLineFunnel:
                    //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, true);
                    break;

                case RenderAs.Stock:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);

                    //StockChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                    // renderedCanvas = StockChart.GetVisualObjectForStockChart(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;

                case RenderAs.CandleStick:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    // CandleStick.Update(chart, currentRenderAs, selectedDataSeries4Rendering, property, newValue);
                    // renderedCanvas = CandleStick.GetVisualObjectForCandleStick(width, height, plotDetails, dataSeriesList4Rendering, chart, plankDepth, animationEnabled);
                    break;
                }

                //renderedChart = RenderSeriesFromList(selectedDataSeries4Rendering);

                renderedSeriesCount += selectedDataSeries4Rendering.Count;
            }

            chart.ChartArea.AttachScrollEvents();
            Visifire.Charts.Chart.SelectDataPoints(chart);
            //AttachEventsToolTipHref2DataSeries();
        }
示例#29
0
        internal static void UpdateVisualObject(RenderAs chartType, Visifire.Commons.ObservableObject sender, VcProperties property, object newValue, Boolean isAXisChanged)
        {
            Boolean   isDataPoint = sender.GetType().Equals(typeof(DataPoint));
            DataPoint dataPoint   = sender as DataPoint;
            Chart     chart       = (sender as ObservableObject).Chart as Chart;

            switch (chartType)
            {
            case RenderAs.Column:
            case RenderAs.Bar:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                break;

            case RenderAs.Line:
            case RenderAs.Spline:
                LineChart.Update(sender, property, newValue, isAXisChanged);

                break;

            case RenderAs.QuickLine:
                QuickLineChart.Update(sender, property, newValue, isAXisChanged);

                break;

            case RenderAs.StepLine:
                StepLineChart.Update(sender, property, newValue, isAXisChanged);

                break;

            case RenderAs.Point:
                PointChart.Update(sender, property, newValue, isAXisChanged);
                break;

            case RenderAs.Bubble:
                BubbleChart.Update(sender, property, newValue, isAXisChanged);
                break;

            case RenderAs.Area:
                AreaChart.Update(sender, property, newValue, isAXisChanged);
                break;

            case RenderAs.StackedColumn:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                break;

            case RenderAs.StackedColumn100:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                break;

            case RenderAs.StackedBar:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                break;

            case RenderAs.StackedBar100:
                ColumnChart.Update(sender, property, newValue, isAXisChanged);
                break;

            case RenderAs.Pie:
                //renderedCanvas = PieChart.GetVisualObjectForPieChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                break;

            case RenderAs.Doughnut:
                //renderedCanvas = PieChart.GetVisualObjectForDoughnutChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                break;

            case RenderAs.StackedArea:
                List <DataSeries> stackedAreaList = (from ds in chart.Series where ds.RenderAs == RenderAs.StackedArea select ds).ToList();

                if (stackedAreaList.Count > 0)
                {
                    ColumnChart.Update(chart, stackedAreaList[0].RenderAs, stackedAreaList);
                }

                chart.ChartArea.AttachEventsToolTipHref2DataSeries();

                break;

            case RenderAs.StackedArea100:
                List <DataSeries> stackedArea100List = (from ds in chart.Series where ds.RenderAs == RenderAs.StackedArea select ds).ToList();

                if (stackedArea100List.Count > 0)
                {
                    ColumnChart.Update(chart, stackedArea100List[0].RenderAs, stackedArea100List);
                }

                chart.ChartArea.AttachEventsToolTipHref2DataSeries();
                break;

            case RenderAs.SectionFunnel:
            case RenderAs.StreamLineFunnel:
            case RenderAs.Pyramid:
                //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, true);
                break;

            case RenderAs.Stock:
                StockChart.Update(sender, property, newValue, isAXisChanged);
                break;

            case RenderAs.CandleStick:
                CandleStick.Update(sender, property, newValue, isAXisChanged);
                break;
            }

            //chart.ChartArea.AttachScrollEvents();
        }
示例#30
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj">Object may be DataSeries or DataPoint</param>
        /// <param name="property"></param>
        /// <param name="newValue"></param>
        private static void UpdateDataSeries(ObservableObject obj, VcProperties property, object newValue)
        {
            DataPoint dataPoint = null;
            DataSeries dataSeries = obj as DataSeries;
            Boolean isDataPoint = false;
            
            if (dataSeries == null)
            {
                isDataPoint = true;
                dataPoint = obj as DataPoint;
                dataSeries = dataPoint.Parent;
            }

            Chart chart = dataSeries.Chart as Chart;

            if (chart == null)
                return;

            PlotGroup plotGroup = dataSeries.PlotGroup;
            Canvas line2dCanvas = null;
            Canvas label2dCanvas = null;
            Path linePath = null;
            Path lineShadowPath = null;

            if (dataSeries.Faces != null)
            {   
                if (dataSeries.Faces.Parts.Count > 0)
                {
                    linePath = dataSeries.Faces.Parts[0] as Path;

                    if (dataSeries.Faces.Parts.Count > 1)
                        lineShadowPath = dataSeries.Faces.Parts[1] as Path;
                }

                line2dCanvas = dataSeries.Faces.Visual as Canvas;
                label2dCanvas = dataSeries.Faces.LabelCanvas as Canvas;
            }
            else if (dataSeries.Faces == null && property == VcProperties.Enabled && (Boolean)newValue == true)
            {
                ColumnChart.Update(chart, dataSeries.RenderAs, (from ds in chart.InternalSeries where ds.RenderAs == RenderAs.Spline || ds.RenderAs == RenderAs.Line select ds).ToList());
                return;
            }
            else
                return;

            Double height = chart.ChartArea.ChartVisualCanvas.Height;
            Double width = chart.ChartArea.ChartVisualCanvas.Width;

            switch (property)
            {   
                case VcProperties.Color:
                    if (linePath != null)
                    {
                        Brush lineColorValue = (newValue != null) ? newValue as Brush : dataSeries.Color;

                        linePath.Stroke = ((Boolean)dataSeries.LightingEnabled) ? Graphics.GetLightingEnabledBrush(lineColorValue, "Linear", new Double[] { 0.65, 0.55 }) : lineColorValue; //dataPoint.Color;
                    }
                    break;
                case VcProperties.LightingEnabled:
                    if (linePath != null)
                        linePath.Stroke = ((Boolean)newValue) ? Graphics.GetLightingEnabledBrush(dataSeries.Color, "Linear", new Double[] { 0.65, 0.55 }) : dataSeries.Color;
                        
                    break;

                case VcProperties.Opacity:
                    if (linePath != null)
                        linePath.Opacity = (Double)dataSeries.Opacity;
                    break;
                case VcProperties.LineStyle:
                case VcProperties.LineThickness:

                    if (lineShadowPath != null)
                        lineShadowPath.StrokeThickness = (Double)dataSeries.LineThickness;
                    if (linePath != null)
                        linePath.StrokeThickness = (Double)dataSeries.LineThickness;

                    if (lineShadowPath != null)
                        lineShadowPath.StrokeDashArray = ExtendedGraphics.GetDashArray(dataSeries.LineStyle);
                    if (linePath != null)
                        linePath.StrokeDashArray = ExtendedGraphics.GetDashArray(dataSeries.LineStyle);

                    break;
                case VcProperties.Enabled:
                    
                    if (!isDataPoint && line2dCanvas != null)
                    {
                        if ((Boolean)newValue == false)
                        {
                            line2dCanvas.Visibility = Visibility.Collapsed;
                            label2dCanvas.Visibility = Visibility.Collapsed;
                        }
                        else
                        {
                            if (line2dCanvas.Parent == null) 
                            {

                                ColumnChart.Update(chart, dataSeries.RenderAs, (from ds in chart.InternalSeries where ds.RenderAs == RenderAs.Line || ds.RenderAs == RenderAs.Spline select ds).ToList());
                                return;
                            }
                            
                            line2dCanvas.Visibility = Visibility.Visible;
                            label2dCanvas.Visibility = Visibility.Visible;
                        }

                        chart._toolTip.Hide();

                        break;
                    }

                    goto RENDER_SERIES;

                case VcProperties.ShadowEnabled:
                case VcProperties.DataPoints:
                case VcProperties.YValue:
                case VcProperties.YValues:
                case VcProperties.XValue:
                case VcProperties.ViewportRangeEnabled:
                case VcProperties.DataPointUpdate:
                RENDER_SERIES:

                    if (dataSeries.RenderAs == RenderAs.Spline && property != VcProperties.DataPointUpdate)
                        dataSeries.StopDataSeriesAnimation();
                    else if(dataSeries.RenderAs == RenderAs.Line)
                        dataSeries.StopDataPointsAnimation();

                    if(dataSeries.RenderAs == RenderAs.Line)
                        UpdateLineSeries(dataSeries, width, height, label2dCanvas);
                    else
                        UpdateSplineSeries(property, dataSeries, width, height, label2dCanvas);
                break;
            }
        }
示例#31
0
        /// <summary>
        /// Update the axis
        /// </summary>
        /// <param name="isSizeChanged"></param>
        internal void PrePartialUpdateConfiguration(VisifireElement sender, VcProperties property, object oldValue, object newValue, Boolean updateLists, Boolean calculatePlotDetails, Boolean updateAxis, AxisRepresentations renderAxisType, Boolean isPartialUpdate)
        {   
            if(updateLists)
                PopulateInternalSeriesList();

            if (calculatePlotDetails)
            {
                // PlotDetails = new PlotDetails(Chart);
                
                PlotDetails.ReCreate(sender, property, oldValue, newValue);
            }

            if (updateLists)
            {
                SetDataPointColorFromColorSet(Chart.Series);
            }

            if (updateAxis)
            {
                PopulateInternalAxesXList();
                PopulateInternalAxesYList();

                ClearAxesPanel();

                //  Check if drawing axis is necessary or not
                //if (PlotDetails.ChartOrientation != ChartOrientationType.NoAxis)
                //    SetAxesProperties();

                Size remainingSizeAfterDrawingAxes = RenderAxes(_plotAreaSize);
                
                ResizePanels(remainingSizeAfterDrawingAxes, renderAxisType, isPartialUpdate);

                // Draw the chart grids
                if (PlotDetails.ChartOrientation != ChartOrientationType.NoAxis)
                {
                    RenderGrids();
                    RenderTrendLines();
                }

                
            }

            AddOrRemovePanels(Chart);
        }
示例#32
0
        /// <summary>
        /// UpdateVisual is used for partial rendering
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties property, object newValue)
        {
            if (!IsNotificationEnable)
                return;

            if (ValidatePartialUpdate(RenderAs, property))
            {   
                if (NonPartialUpdateChartTypes(RenderAs))
                {   
                    if (property == VcProperties.Color)
                        PartialUpdateOfColorProperty((Brush)newValue);
                    else
                        FirePropertyChanged(property);
                    
                    return;
                }

                Chart chart = Chart as Chart;
                Boolean renderAxis = false;

                if (property == VcProperties.ColorSet)
                {   
                    Brush brush = null;
                    (Chart as Chart).ChartArea.LoadSeriesColorSet4SingleSeries(this);

                    if (RenderAs == RenderAs.Line || RenderAs == RenderAs.Area)
                    {
                        //if ((Brush)GetValue(DataSeries.ColorProperty) == null)
                        //    brush = InternalDataPoints[0]._internalColor;
                        //else
                        brush = Color;

                        RenderHelper.UpdateVisualObject(RenderAs, this, VcProperties.Color, brush, renderAxis);
                    }

                    foreach (DataPoint dp in InternalDataPoints)
                    {
                        if (!String.IsNullOrEmpty(ColorSet) && (Brush)dp.GetValue(DataSeries.ColorProperty) == null)
                            brush = dp._internalColor;

                        RenderHelper.UpdateVisualObject(RenderAs, dp, VcProperties.Color, brush, renderAxis);
                    }

                }
                else if (property == VcProperties.Color )
                {
                    if(RenderAs != RenderAs.CandleStick)
                        UpdateLegendMarker();

                    if (RenderAs == RenderAs.Line || RenderAs == RenderAs.Area)
                    {
                        RenderHelper.UpdateVisualObject(RenderAs, this, VcProperties.Color, newValue, renderAxis);
                    }
                    
                    foreach (DataPoint dp in InternalDataPoints)
                    {
                        RenderHelper.UpdateVisualObject(RenderAs, dp, VcProperties.Color, newValue, renderAxis);
                        
                        if (RenderAs != RenderAs.CandleStick)
                            DataPoint.UpdateLegendMarker(dp, (Brush)newValue);
                    }
                }
                else if (property == VcProperties.ShadowEnabled || property == VcProperties.Opacity)
                {
                    if (RenderAs == RenderAs.Line || RenderAs == RenderAs.Area)
                        //LineChart.Update(this, property, newValue);
                        RenderHelper.UpdateVisualObject(RenderAs, this, property, newValue, renderAxis);

                    foreach (DataPoint dp in InternalDataPoints)
                        RenderHelper.UpdateVisualObject(RenderAs, dp, property, newValue, renderAxis);
                }
                else if (property == VcProperties.LineStyle || property == VcProperties.LineThickness || property == VcProperties.LightingEnabled )
                {
                    if (RenderAs == RenderAs.Line || RenderAs == RenderAs.Area)
                        RenderHelper.UpdateVisualObject(RenderAs, this, property, newValue, renderAxis);
                    
                    foreach (DataPoint dp in InternalDataPoints)
                        RenderHelper.UpdateVisualObject(RenderAs, dp, property, newValue, renderAxis);
                }
                else if (property == VcProperties.BorderColor || property == VcProperties.BorderThickness || property == VcProperties.BorderStyle)
                {
                    if (RenderAs == RenderAs.Area)
                        RenderHelper.UpdateVisualObject(RenderAs, this, property, newValue, renderAxis);

                    foreach (DataPoint dp in InternalDataPoints)
                        RenderHelper.UpdateVisualObject(RenderAs, dp, property, newValue, renderAxis);
                }
                else if (property == VcProperties.DataPoints || property == VcProperties.Enabled)
                {
                    AxisRepresentations axisRepresentation = AxisRepresentations.AxisX;

                    Double OldAxisMaxY = chart.PlotDetails.GetAxisYMaximumDataValue(PlotGroup.AxisY);
                    Double OldAxisMinY = chart.PlotDetails.GetAxisYMinimumDataValue(PlotGroup.AxisY);
                    Double OldAxisMaxX = chart.PlotDetails.GetAxisXMaximumDataValue(PlotGroup.AxisX);
                    Double OldAxisMinX = chart.PlotDetails.GetAxisXMinimumDataValue(PlotGroup.AxisX);

                    chart.ChartArea.PrePartialUpdateConfiguration(this, property, null, newValue, true, true, false, AxisRepresentations.AxisX, true);

                    Double NewAxisMaxY = chart.PlotDetails.GetAxisYMaximumDataValue(PlotGroup.AxisY);
                    Double NewAxisMinY = chart.PlotDetails.GetAxisYMinimumDataValue(PlotGroup.AxisY);
                    Double NewAxisMaxX = chart.PlotDetails.GetAxisXMaximumDataValue(PlotGroup.AxisX);
                    Double NewAxisMinX = chart.PlotDetails.GetAxisXMinimumDataValue(PlotGroup.AxisX);

                    //System.Diagnostics.Debug.WriteLine("OldAxisMaxY = " + OldAxisMaxY.ToString() + " OldAxisMinY=" + OldAxisMinY.ToString());
                    //System.Diagnostics.Debug.WriteLine("NewAxisMaxY = " + NewAxisMaxY.ToString() + " NewAxisMinY=" + NewAxisMinY.ToString());

                    if (NewAxisMaxY != OldAxisMaxY || NewAxisMinY != OldAxisMinY)
                    {
                        renderAxis = true;
                        axisRepresentation = AxisRepresentations.AxisY;
                    }
                    else if (NewAxisMaxX != OldAxisMaxX || NewAxisMinX != OldAxisMinX)
                    {
                        renderAxis = true;
                    }

                    // Render Axis if required
                    chart.ChartArea.PrePartialUpdateConfiguration(this, property, null, newValue, false, false, renderAxis, axisRepresentation, true);

                    // Return
                    if (renderAxis)
                    {
                        // Need to Rerender all charts if axis changes
                        RenderHelper.UpdateVisualObject(chart, property, newValue, false);
                    }
                    else
                    {   
                        RenderHelper.UpdateVisualObject(this.RenderAs, this, property, newValue, renderAxis);
                    }

                    //// Render Axis if required
                    //chart.ChartArea.PrePartialUpdateConfiguration(this, property, newValue, false, false, renderAxis, axisRepresentation, true);

                    //// Return
                    //if (renderAxis)
                    //{
                    //    // Need to Rerender all charts if axis changes
                    //    RenderHelper.UpdateVisualObject(chart, property, newValue);
                    //}
                    //else
                    //{
                    //    RenderHelper.UpdateVisualObject(this.RenderAs, this, property, newValue, renderAxis);
                    //}
                }
                else if (property == VcProperties.AxisXType ||
                    property == VcProperties.AxisXType || property == VcProperties.Enabled)
                {
                    renderAxis = true;
                    chart.ChartArea.PrePartialUpdateConfiguration(this, property, null, newValue, true, true, true, AxisRepresentations.AxisX, true);
                    RenderHelper.UpdateVisualObject(RenderAs, this, property, newValue, renderAxis);
                }
                else
                    foreach (DataPoint dp in InternalDataPoints)
                        RenderHelper.UpdateVisualObject(RenderAs, dp, property, newValue, renderAxis);

                // FirePropertyChanged(VcProperties.DataPoints);
            }
        }
示例#33
0
        private static void UpdateDataSeries(DataSeries dataSeries, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Chart chart = dataSeries.Chart as Chart;

            if (chart == null)
                return;

            switch (property)
            {
                case VcProperties.DataPoints:
                    //case VcProperties.YValues:
                    chart.ChartArea.RenderSeries();
                    //Canvas ChartVisualCanvas = chart.ChartArea.ChartVisualCanvas;

                    //Double width = chart.ChartArea.ChartVisualCanvas.Width;
                    //Double height = chart.ChartArea.ChartVisualCanvas.Height;

                    //PlotDetails plotDetails = chart.PlotDetails;
                    //PlotGroup plotGroup = dataSeries.PlotGroup;

                    //List<DataSeries> dataSeriesListInDrawingOrder = plotDetails.SeriesDrawingIndex.Keys.ToList();

                    //List<DataSeries> selectedDataSeries4Rendering = new List<DataSeries>();

                    //RenderAs currentRenderAs = dataSeries.RenderAs;

                    //Int32 currentDrawingIndex = plotDetails.SeriesDrawingIndex[dataSeries];

                    //for (Int32 i = 0; i < chart.InternalSeries.Count; i++)
                    //{
                    //    if (currentRenderAs == dataSeriesListInDrawingOrder[i].RenderAs && currentDrawingIndex == plotDetails.SeriesDrawingIndex[dataSeriesListInDrawingOrder[i]])
                    //        selectedDataSeries4Rendering.Add(dataSeriesListInDrawingOrder[i]);
                    //}

                    //if (selectedDataSeries4Rendering.Count == 0)
                    //    return;

                    //Panel oldPanel = null;
                    //Dictionary<RenderAs, Panel> RenderedCanvasList = chart.ChartArea.RenderedCanvasList;

                    //if (chart.ChartArea.RenderedCanvasList.ContainsKey(currentRenderAs))
                    //{   
                    //    oldPanel = RenderedCanvasList[currentRenderAs];
                    //}

                    //Panel renderedChart = chart.ChartArea.RenderSeriesFromList(oldPanel, selectedDataSeries4Rendering);

                    //if (oldPanel == null)
                    //{
                    //    chart.ChartArea.RenderedCanvasList.Add(currentRenderAs, renderedChart);
                    //    renderedChart.SetValue(Canvas.ZIndexProperty, currentDrawingIndex);
                    //    ChartVisualCanvas.Children.Add(renderedChart);
                    //}
                    //else
                    //    chart.ChartArea.RenderedCanvasList[currentRenderAs] = renderedChart;

                    break;

                default:
                    // case VcProperties.Enabled:
                    foreach (DataPoint dataPoint in dataSeries.InternalDataPoints)
                        UpdateDataPoint(dataPoint, property, newValue, isAxisChanged);
                    break;
            }
        }
示例#34
0
        private void DataPointRenderManager(VcProperties property, object newValue)
        {
            Chart chart = Chart as Chart;

            if (chart != null && !chart.PARTIAL_DS_RENDER_LOCK)
            {
                chart.PARTIAL_DS_RENDER_LOCK = true;
                chart.Dispatcher.BeginInvoke(new Action<VcProperties, object>(UpdateVisual), new Object[] { VcProperties.DataPoints, newValue });
                chart.Dispatcher.BeginInvoke(new Action<Chart>(ActivatePartialUpdateLock), new Object[] { chart });
            }
        }
示例#35
0
        /// <summary>
        /// Update visual used for partial update
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties propertyName, object value)
        {
            if (Visual != null)
            {
                if (InterlacedRectangles != null)
                {
                    foreach (Rectangle rec in InterlacedRectangles)
                    {
                        rec.Fill = InterlacedColor;
                    }
                }

                if (InterlacedPaths != null)
                {
                    foreach (Path path in InterlacedPaths)
                    {
                        path.Fill = InterlacedColor;
                    }
                }

                if (InterlacedLines != null)
                {
                    foreach (Line line in InterlacedLines)
                    {
                        line.Stroke          = LineColor;
                        line.StrokeThickness = (Double)LineThickness;
                        line.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
                    }
                }

                Chart chart = Chart as Chart;

                if (Chart != null && ParentAxis != null && chart.ChartArea != null)
                {
                    if (ParentAxis.AxisRepresentation == AxisRepresentations.AxisY &&
                        ParentAxis.AxisType == AxisTypes.Primary)
                    {
                        List <Line> interlacedLinesOverVerticalPlank = chart.ChartArea.InterlacedLinesOverVerticalPlank;

                        if (interlacedLinesOverVerticalPlank != null)
                        {
                            foreach (Line line in interlacedLinesOverVerticalPlank)
                            {
                                line.Stroke          = LineColor;
                                line.StrokeThickness = (Double)LineThickness;
                                line.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
                            }
                        }

                        List <Path> interlacedPathsOverVerticalPlank = chart.ChartArea.InterlacedPathsOverVerticalPlank;

                        if (interlacedPathsOverVerticalPlank != null)
                        {
                            foreach (Path path in interlacedPathsOverVerticalPlank)
                            {
                                path.Fill = InterlacedColor;
                            }
                        }
                    }
                }
            }
            else
            {
                FirePropertyChanged(propertyName);
            }
        }
示例#36
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj">Object may be DataSeries or DataPoint</param>
        /// <param name="property"></param>
        /// <param name="newValue"></param>
        private static void UpdateDataSeries(ObservableObject obj, VcProperties property, object newValue)
        {
            DataPoint  dataPoint   = null;
            DataSeries dataSeries  = obj as DataSeries;
            Boolean    isDataPoint = false;

            if (dataSeries == null)
            {
                isDataPoint = true;
                dataPoint   = obj as DataPoint;
                dataSeries  = dataPoint.Parent;
            }

            Chart chart = dataSeries.Chart as Chart;

            if (chart == null)
            {
                return;
            }

            PlotGroup plotGroup      = dataSeries.PlotGroup;
            Canvas    line2dCanvas   = null;
            Canvas    label2dCanvas  = null;
            Path      linePath       = null;
            Path      lineShadowPath = null;

            if (dataSeries.Faces != null)
            {
                if (dataSeries.Faces.Parts.Count > 0)
                {
                    linePath = dataSeries.Faces.Parts[0] as Path;

                    if (dataSeries.Faces.Parts.Count > 1)
                    {
                        lineShadowPath = dataSeries.Faces.Parts[1] as Path;
                    }
                }

                line2dCanvas  = dataSeries.Faces.Visual as Canvas;
                label2dCanvas = dataSeries.Faces.LabelCanvas as Canvas;
            }
            else if (dataSeries.Faces == null && property == VcProperties.Enabled && (Boolean)newValue == true)
            {
                ColumnChart.Update(chart, dataSeries.RenderAs, (from ds in chart.InternalSeries where ds.RenderAs == RenderAs.QuickLine select ds).ToList());
                return;
            }
            else
            {
                return;
            }

            Double height = chart.ChartArea.ChartVisualCanvas.Height;
            Double width  = chart.ChartArea.ChartVisualCanvas.Width;

            switch (property)
            {
            case VcProperties.Color:
                if (linePath != null)
                {
                    Brush lineColorValue = (newValue != null) ? newValue as Brush : dataSeries.Color;

                    linePath.Stroke = ((Boolean)dataSeries.LightingEnabled) ? Graphics.GetLightingEnabledBrush(lineColorValue, "Linear", new Double[] { 0.65, 0.55 }) : lineColorValue;     //dataPoint.Color;
                }
                break;

            case VcProperties.LightingEnabled:
                if (linePath != null)
                {
                    linePath.Stroke = ((Boolean)newValue) ? Graphics.GetLightingEnabledBrush(dataSeries.Color, "Linear", new Double[] { 0.65, 0.55 }) : dataSeries.Color;
                }

                break;

            case VcProperties.Opacity:
                if (linePath != null)
                {
                    linePath.Opacity = (Double)dataSeries.Opacity;
                }
                break;

            case VcProperties.LineStyle:
            case VcProperties.LineThickness:

                if (lineShadowPath != null)
                {
                    lineShadowPath.StrokeThickness = (Double)dataSeries.LineThickness;
                }
                if (linePath != null)
                {
                    linePath.StrokeThickness = (Double)dataSeries.LineThickness;
                }

                if (lineShadowPath != null)
                {
                    lineShadowPath.StrokeDashArray = ExtendedGraphics.GetDashArray(dataSeries.LineStyle);
                }
                if (linePath != null)
                {
                    linePath.StrokeDashArray = ExtendedGraphics.GetDashArray(dataSeries.LineStyle);
                }

                break;

            case VcProperties.Enabled:

                if (!isDataPoint && line2dCanvas != null)
                {
                    if ((Boolean)newValue == false)
                    {
                        line2dCanvas.Visibility  = Visibility.Collapsed;
                        label2dCanvas.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        if (line2dCanvas.Parent == null)
                        {
                            ColumnChart.Update(chart, dataSeries.RenderAs, (from ds in chart.InternalSeries where ds.RenderAs == RenderAs.QuickLine select ds).ToList());
                            return;
                        }

                        line2dCanvas.Visibility  = Visibility.Visible;
                        label2dCanvas.Visibility = Visibility.Visible;
                    }

                    chart._toolTip.Hide();

                    break;
                }

                goto RENDER_SERIES;

            case VcProperties.ShadowEnabled:
            case VcProperties.DataPoints:
            case VcProperties.YValue:
            case VcProperties.YValues:
            case VcProperties.XValue:
            case VcProperties.ViewportRangeEnabled:
            case VcProperties.DataPointUpdate:
RENDER_SERIES:

                LineChart.UpdateLineSeries(dataSeries, width, height, label2dCanvas);

                break;
            }
        }
示例#37
0
        ///// <summary>
        ///// Identifies the Visifire.Charts.CustomAxisLabel.FontSize dependency property.
        ///// </summary>
        ///// <returns>
        ///// The identifier for the Visifire.Charts.CustomAxisLabel.FontSize dependency property.
        ///// </returns>
        //private static readonly DependencyProperty
        //    InternalFontSizeProperty = DependencyProperty.Register
        //    ("InternalFontSize",
        //    typeof(Double),
        //    typeof(CustomAxisLabel),
        //    new PropertyMetadata(OnFontSizePropertyChanged));

        ///// Identifies the Visifire.Charts.CustomAxisLabel.FontFamily dependency property.
        ///// </summary>
        ///// <returns>
        ///// The identifier for the Visifire.Charts.CustomAxisLabel.FontFamily dependency property.
        ///// </returns>
        //private static readonly DependencyProperty InternalFontFamilyProperty = DependencyProperty.Register
        //    ("InternalFontFamily",
        //    typeof(FontFamily),
        //    typeof(CustomAxisLabel),
        //    new PropertyMetadata(OnFontFamilyPropertyChanged));

        ///// <summary>
        ///// Identifies the Visifire.Charts.CustomAxisLabel.FontStyle dependency property.
        ///// </summary>
        ///// <returns>
        ///// The identifier for the Visifire.Charts.CustomAxisLabel.FontStyle dependency property.
        ///// </returns>
        //private static readonly DependencyProperty InternalFontStyleProperty = DependencyProperty.Register
        //    ("InternalFontStyle",
        //    typeof(FontStyle),
        //    typeof(CustomAxisLabel),
        //    new PropertyMetadata(OnFontStylePropertyChanged));

        ///// <summary>
        ///// Identifies the Visifire.Charts.CustomAxisLabel.FontWeight dependency property.
        ///// </summary>
        ///// <returns>
        ///// The identifier for the Visifire.Charts.CustomAxisLabel.FontWeight dependency property.
        ///// </returns>
        //private static readonly DependencyProperty InternalFontWeightProperty = DependencyProperty.Register
        //    ("InternalFontWeight",
        //    typeof(FontWeight),
        //    typeof(CustomAxisLabel),
        //    new PropertyMetadata(OnFontWeightPropertyChanged));

        ///// <summary>
        ///// Event handler attached with FontFamily property changed event of CustomAxisLabels element
        ///// </summary>
        ///// <param name="d">DependencyObject</param>
        ///// <param name="e">DependencyPropertyChangedEventArgs</param>
        //private static void OnFontFamilyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    CustomAxisLabel customAxisLabel = d as CustomAxisLabel;

        //    if (e.NewValue == null || e.OldValue == null)
        //    {
        //        customAxisLabel.InternalFontFamily = (FontFamily)e.NewValue;
        //        customAxisLabel.FirePropertyChanged(VcProperties.FontFamily);
        //    }
        //    else if (e.NewValue.ToString() != e.OldValue.ToString())
        //    {
        //        customAxisLabel.InternalFontFamily = (FontFamily)e.NewValue;
        //        customAxisLabel.FirePropertyChanged(VcProperties.FontFamily);
        //    }
        //}

        ///// <summary>
        ///// Event handler attached with FontStyle property changed event of CustomAxisLabels element
        ///// </summary>
        ///// <param name="d">DependencyObject</param>
        ///// <param name="e">DependencyPropertyChangedEventArgs</param>
        //private static void OnFontStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    CustomAxisLabel customAxisLabel = d as CustomAxisLabel;
        //    customAxisLabel.InternalFontStyle = (FontStyle)e.NewValue;
        //    customAxisLabel.UpdateVisual(VcProperties.FontStyle, e.NewValue);
        //}

        ///// <summary>
        ///// Event handler attached with FontWeight property changed event of CustomAxisLabels element
        ///// </summary>
        ///// <param name="d">DependencyObject</param>
        ///// <param name="e">DependencyPropertyChangedEventArgs</param>
        //private static void OnFontWeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    CustomAxisLabel customAxisLabel = d as CustomAxisLabel;
        //    customAxisLabel.InternalFontWeight = (FontWeight)e.NewValue;
        //    customAxisLabel.UpdateVisual(VcProperties.FontWeight, e.NewValue);
        //}

        ///// <summary>
        ///// Event handler attached with FontSize property changed event of CustomAxisLabels element
        ///// </summary>
        ///// <param name="d">DependencyObject</param>
        ///// <param name="e">DependencyPropertyChangedEventArgs</param>
        //private static void OnFontSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        //{
        //    CustomAxisLabel customAxisLabel = d as CustomAxisLabel;
        //    customAxisLabel.InternalFontSize = (Double)e.NewValue;
        //    customAxisLabel.FirePropertyChanged(VcProperties.FontSize);
        //}

        #endregion

        #region Internal Methods

        /// <summary>
        /// Update visual used for partial update
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties propertyName, object value)
        {
            if (TextElement != null || CustomLabelPath != null)
            {
                ApplyCustomLabelProperties();
            }
            else
                FirePropertyChanged(propertyName);
        }
示例#38
0
        //internal static void Update(Chart chart, RenderAs currentRenderAs, List<DataSeries> selectedDataSeries4Rendering, VcProperties property, object newValue)
        //{
        //    Boolean is3D = chart.View3D;
        //    ChartArea chartArea = chart.ChartArea;
        //    Canvas ChartVisualCanvas = chart.ChartArea.ChartVisualCanvas;

        //    // Double width = chart.ChartArea.ChartVisualCanvas.Width;
        //    // Double height = chart.ChartArea.ChartVisualCanvas.Height;

        //    Panel preExistingPanel = null;
        //    Dictionary<RenderAs, Panel> RenderedCanvasList = chart.ChartArea.RenderedCanvasList;

        //    if (chartArea.RenderedCanvasList.ContainsKey(currentRenderAs))
        //    {
        //        preExistingPanel = RenderedCanvasList[currentRenderAs];
        //    }

        //    Panel renderedChart = chartArea.RenderSeriesFromList(preExistingPanel, selectedDataSeries4Rendering);

        //    if (preExistingPanel == null)
        //    {
        //        chartArea.RenderedCanvasList.Add(currentRenderAs, renderedChart);
        //        ChartVisualCanvas.Children.Add(renderedChart);
        //    }
        //}

        /// <summary>
        ///
        /// </summary>
        /// <param name="dataPoint"></param>
        /// <param name="property"></param>
        /// <param name="newValue"></param>
        /// <param name="isAxisChanged"></param>
        private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Chart       chart       = dataPoint.Chart as Chart;
            PlotDetails plotDetails = chart.PlotDetails;
            Marker      marker      = dataPoint.Marker;
            DataSeries  dataSeries  = dataPoint.Parent;

            Canvas pointChartCanvas = dataSeries.Faces.Visual as Canvas;

            Double plotHeight = chart.ChartArea.ChartVisualCanvas.Height;
            Double plotWidth  = chart.ChartArea.ChartVisualCanvas.Width;

            ColumnChart.UpdateParentVisualCanvasSize(chart, pointChartCanvas);

            if (property == VcProperties.Enabled)
            {
                CreateOrUpdateAPointDataPoint(pointChartCanvas, dataPoint, plotWidth, plotHeight);
                return;
            }

            if (dataPoint.Faces == null)
            {
                return;
            }

            Grid bubbleVisual = dataPoint.Faces.Visual as Grid;

            switch (property)
            {
            case VcProperties.Bevel:
                break;

            case VcProperties.Cursor:
                break;

            case VcProperties.Href:
                dataPoint.SetHref2DataPointVisualFaces();
                break;

            case VcProperties.HrefTarget:
                dataPoint.SetHref2DataPointVisualFaces();
                break;

            case VcProperties.LabelBackground:
                if (marker != null)
                {
                    marker.TextBackground = dataPoint.LabelBackground;
                }
                break;

            case VcProperties.LabelEnabled:
                CreateOrUpdateAPointDataPoint(pointChartCanvas, dataPoint, plotWidth, plotHeight);
                //if (marker != null)
                //    marker.LabelEnabled = (Boolean)dataPoint.LabelEnabled;
                break;

            case VcProperties.LabelFontColor:
                if (marker != null)
                {
                    marker.FontColor = dataPoint.LabelFontColor;
                }

                break;

            case VcProperties.LabelFontFamily:
                if (marker != null)
                {
                    marker.FontFamily = dataPoint.LabelFontFamily;
                }
                break;

            case VcProperties.LabelFontStyle:
                if (marker != null)
                {
                    marker.FontStyle = (FontStyle)dataPoint.LabelFontStyle;
                }
                break;

            //case VcProperties.LabelFontSize:
            //    if (marker != null)
            //        marker.FontSize = (Double)dataPoint.LabelFontSize;
            //    break;

            case VcProperties.LabelFontWeight:
                if (marker != null)
                {
                    marker.FontWeight = (FontWeight)dataPoint.LabelFontWeight;
                }
                break;

            case VcProperties.LabelAngle:
                if (marker != null)
                {
                    marker.FontWeight = (FontWeight)dataPoint.LabelFontWeight;
                }
                break;

            case VcProperties.LegendText:
                chart.InvokeRender();
                break;

            case VcProperties.Color:
            case VcProperties.LightingEnabled:
                if (marker != null)
                {
                    marker.MarkerShape.Fill = (chart.View3D ? Graphics.Get3DBrushLighting(dataPoint.Color, (Boolean)dataPoint.LightingEnabled) : ((Boolean)dataPoint.LightingEnabled ? Graphics.GetLightingEnabledBrush(dataPoint.Color, "Linear", null) : dataPoint.Color));
                }
                break;

            case VcProperties.MarkerBorderColor:
                if (marker != null)
                {
                    marker.BorderColor = dataPoint.MarkerBorderColor;
                }
                break;

            case VcProperties.MarkerBorderThickness:
                if (marker != null)
                {
                    marker.BorderThickness = dataPoint.MarkerBorderThickness.Value.Left;
                }
                break;

            case VcProperties.MarkerColor:
                if (marker != null)
                {
                    marker.MarkerFillColor = dataPoint.MarkerColor;
                }
                break;

            case VcProperties.LabelFontSize:
            case VcProperties.LabelStyle:
            case VcProperties.LabelText:
            case VcProperties.MarkerScale:
            case VcProperties.MarkerSize:
            case VcProperties.MarkerType:
                CreateOrUpdateAPointDataPoint(pointChartCanvas, dataPoint, plotWidth, plotHeight);
                break;

            case VcProperties.ShadowEnabled:
                if (marker != null)
                {
                    marker.ShadowEnabled = (Boolean)dataPoint.ShadowEnabled;
                    marker.ApplyRemoveShadow();
                }

                break;

            case VcProperties.Opacity:
                if (marker != null)
                {
                    marker.Visual.Opacity = dataPoint.Opacity * dataSeries.Opacity;
                }
                break;

            case VcProperties.ShowInLegend:
                chart.InvokeRender();
                break;

            case VcProperties.ToolTipText:
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                break;

            case VcProperties.XValueFormatString:
            case VcProperties.YValueFormatString:
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                CreateOrUpdateAPointDataPoint(pointChartCanvas, dataPoint, plotWidth, plotHeight);
                break;

            case VcProperties.XValueType:
                chart.InvokeRender();
                break;

            case VcProperties.XValue:
            case VcProperties.YValue:
                if (isAxisChanged)
                {
                    UpdateDataSeries(dataSeries, property, newValue, false);
                }
                else
                if (marker != null)
                {
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);

                    if ((Boolean)dataPoint.LabelEnabled)
                    {
                        marker.Text = dataPoint.TextParser(dataPoint.LabelText);
                    }

                    BubbleChart.UpdateBubblePositionAccording2XandYValue(dataPoint, plotWidth, plotHeight, chart.AnimatedUpdate, marker.MarkerShape.Width, marker.MarkerShape.Width);
                }

                break;
            }

            if (pointChartCanvas.Parent != null)
            {
                Double tickLengthOfAxisX = (from tick in chart.AxesX[0].Ticks
                                            where (Boolean)chart.AxesX[0].Enabled && (Boolean)tick.Enabled
                                            select tick.TickLength).Sum();

                if (tickLengthOfAxisX == 0)
                {
                    tickLengthOfAxisX = 5;
                }

                Double tickLengthOfPrimaryAxisY = (from axis in chart.AxesY
                                                   where axis.AxisType == AxisTypes.Primary
                                                   from tick in axis.Ticks
                                                   where (Boolean)axis.Enabled && (Boolean)tick.Enabled
                                                   select tick.TickLength).Sum();

                if (tickLengthOfPrimaryAxisY == 0)
                {
                    tickLengthOfPrimaryAxisY = 8;
                }

                Double tickLengthOfSecondaryAxisY = (from axis in chart.AxesY
                                                     where axis.AxisType == AxisTypes.Secondary
                                                     from tick in axis.Ticks
                                                     where (Boolean)axis.Enabled && (Boolean)tick.Enabled
                                                     select tick.TickLength).Sum();

                if (tickLengthOfSecondaryAxisY == 0)
                {
                    tickLengthOfSecondaryAxisY = 8;
                }

                Double plotGroupCount = (from c in chart.PlotDetails.PlotGroups
                                         where c.AxisY.AxisType == AxisTypes.Secondary
                                         select c).Count();

                RectangleGeometry clipRectangle = new RectangleGeometry();
                clipRectangle.Rect = new Rect(-tickLengthOfPrimaryAxisY, -chart.ChartArea.PLANK_DEPTH - 4, plotWidth + tickLengthOfSecondaryAxisY + (plotGroupCount > 0 ? tickLengthOfPrimaryAxisY : 8) + chart.ChartArea.PLANK_OFFSET, plotHeight + chart.ChartArea.PLANK_DEPTH + chart.ChartArea.PLANK_THICKNESS + tickLengthOfAxisX + 4);
                (pointChartCanvas.Parent as Canvas).Clip = clipRectangle;
            }
        }
示例#39
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataPoint"></param>
        /// <param name="property"></param>
        /// <param name="newValue"></param>
        /// <param name="isAxisChanged"></param>
        private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue, Boolean isAxisChanged)
        {   
            Chart chart = dataPoint.Chart as Chart;

            if (chart == null)
                return;

            PlotDetails plotDetails = chart.PlotDetails;
            Marker marker = dataPoint.Marker;
            DataSeries dataSeries = dataPoint.Parent;

            if (dataSeries.Faces == null)
                return;

            Canvas bubleChartCanvas = dataSeries.Faces.Visual as Canvas;
            
            Double plotHeight = chart.ChartArea.ChartVisualCanvas.Height;
            Double plotWidth = chart.ChartArea.ChartVisualCanvas.Width;
            Double minimumZVal, maximumZVal;

            ColumnChart.UpdateParentVisualCanvasSize(chart, bubleChartCanvas);

            if (property == VcProperties.Enabled || ((dataPoint.Faces == null || Double.IsNaN(dataPoint.InternalYValue)) && (property == VcProperties.XValue || property == VcProperties.YValue)))
            {   
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);

                // Calculate max and min ZValue from all DataSeries
                List<DataSeries> seriesList = (from ds in chart.InternalSeries where ds.RenderAs == RenderAs.Bubble && ((Boolean)ds.Enabled == true) select ds).ToList(); 
                CalculateMaxAndMinZValueFromAllSeries(ref seriesList, out minimumZVal, out maximumZVal);

                CreateOrUpdateAPointDataPoint(bubleChartCanvas, dataPoint, minimumZVal, maximumZVal, plotWidth, plotHeight);
                return;
            }

            if (dataPoint.Faces == null)
                return;

            Grid bubbleVisual = dataPoint.Faces.Visual as Grid;
            
            switch (property)
            {   
                case VcProperties.Bevel:
                    break;
                
                case VcProperties.Cursor:
                    break;

                case VcProperties.Href:
                    dataPoint.SetHref2DataPointVisualFaces();
                    break;

                case VcProperties.HrefTarget:
                    dataPoint.SetHref2DataPointVisualFaces();
                    break;

                case VcProperties.LabelBackground:
                    if (marker != null)
                        marker.TextBackground = dataPoint.LabelBackground;
                    break;

                case VcProperties.LabelEnabled:
                    CalculateMaxAndMinZValue(dataPoint.Parent, out minimumZVal, out maximumZVal);
                    CreateOrUpdateAPointDataPoint(bubleChartCanvas, dataPoint, minimumZVal, maximumZVal, plotWidth, plotHeight);

                    // if (marker != null)
                    //   marker.LabelEnabled = (Boolean)dataPoint.LabelEnabled;

                    break;

                case VcProperties.LabelFontColor:
                    if (marker != null)
                        marker.FontColor = dataPoint.LabelFontColor;

                    break;

                case VcProperties.LabelFontFamily:
                    if (marker != null)
                        marker.FontFamily = dataPoint.LabelFontFamily;
                    break;

                case VcProperties.LabelFontStyle:
                    if (marker != null)
                        marker.FontStyle = (FontStyle)dataPoint.LabelFontStyle;
                    break;

                //case VcProperties.LabelFontSize:
                //    if (marker != null)
                //        marker.FontSize = (Double)dataPoint.LabelFontSize;
                //    break;

                case VcProperties.LabelFontWeight:
                    if (marker != null)
                        marker.FontWeight = (FontWeight)dataPoint.LabelFontWeight;
                    break;

                case VcProperties.LabelAngle:
                    if (marker != null)
                        marker.FontWeight = (FontWeight)dataPoint.LabelFontWeight;
                    break;

                case VcProperties.LegendText:
                    chart.InvokeRender();
                    break;

                case VcProperties.Color:
                case VcProperties.LightingEnabled:
                    if (marker != null)
                        marker.MarkerShape.Fill = (chart.View3D ? Graphics.Get3DBrushLighting(dataPoint.Color, (Boolean)dataPoint.LightingEnabled) : ((Boolean)dataPoint.LightingEnabled ? Graphics.GetLightingEnabledBrush(dataPoint.Color, "Linear", null) : dataPoint.Color));
                    break;

                case VcProperties.MarkerBorderColor:
                    if (marker != null)
                        marker.BorderColor = dataPoint.MarkerBorderColor;
                    break;

                case VcProperties.MarkerBorderThickness:
                    if (marker != null)
                        marker.BorderThickness = dataPoint.MarkerBorderThickness.Value.Left;
                    break;

                case VcProperties.XValueFormatString:
                case VcProperties.YValueFormatString:
                case VcProperties.LabelFontSize:
                case VcProperties.LabelStyle:
                case VcProperties.LabelText:
                case VcProperties.MarkerScale:
                case VcProperties.MarkerSize:
                case VcProperties.MarkerType:
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    CalculateMaxAndMinZValue(dataPoint.Parent, out minimumZVal, out maximumZVal);
                    CreateOrUpdateAPointDataPoint(bubleChartCanvas, dataPoint, minimumZVal, maximumZVal, plotWidth, plotHeight);
                    break;

                case VcProperties.ShadowEnabled:
                    if (marker != null)
                    {
                        marker.ShadowEnabled = (Boolean)dataPoint.ShadowEnabled;
                        marker.ApplyRemoveShadow();
                    }
                    break;

                case VcProperties.Opacity:
                    if (marker != null)
                        marker.Visual.Opacity = (Double)dataPoint.Opacity * (Double)dataSeries.Opacity;
                    break;

                case VcProperties.ShowInLegend:
                    chart.InvokeRender();
                    break;

                case VcProperties.ToolTipText:
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    break;

                case VcProperties.XValueType:
                    chart.InvokeRender();
                    break;
                    
                case VcProperties.XValue:
                case VcProperties.YValue:
                case VcProperties.YValues:
                case VcProperties.DataPoints:

                    if (isAxisChanged)
                        UpdateDataSeries(dataSeries, property, newValue, false);
                    else
                        if(marker != null)
                        {   
                            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);

                            if ((Boolean)dataPoint.LabelEnabled)
                                marker.Text = dataPoint.TextParser(dataPoint.LabelText);

                            UpdateBubblePositionAccording2XandYValue(dataPoint, plotWidth, plotHeight, (Boolean)chart.AnimatedUpdate, marker.MarkerShape.Width, marker.MarkerShape.Width);
                        }

                    break;

                case VcProperties.ZValue:

                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);

                    //if ((Boolean)dataPoint.LabelEnabled)
                    //    marker.Text = dataPoint.TextParser(dataPoint.LabelText);

                    List<DataSeries> seriesList = (from ds in chart.InternalSeries where ds.RenderAs == RenderAs.Bubble && ((Boolean)ds.Enabled == true) select ds).ToList();
                    CalculateMaxAndMinZValueFromAllSeries(ref seriesList, out minimumZVal, out maximumZVal);
                        
                    // CalculateMaxAndMinZValue(dataPoint.Parent, out minimumZVal, out maximumZVal);
                    foreach (DataSeries ds in seriesList)
                    {
                        foreach (DataPoint dp in ds.InternalDataPoints)
                        {   
                            if (Double.IsNaN(dp.InternalYValue) || (dp.Enabled == false))
                                continue;

                            ApplyZValue(dp, minimumZVal, maximumZVal, plotWidth, plotHeight);
                        }
                    }

                    break;
            }
            
            if (bubleChartCanvas.Parent != null)
            {
                RectangleGeometry clipRectangle = new RectangleGeometry();
                clipRectangle.Rect = new Rect(0, -(dataPoint.Chart as Chart).ChartArea.PLANK_DEPTH, plotWidth + (dataPoint.Chart as Chart).ChartArea.PLANK_OFFSET, plotHeight + (dataPoint.Chart as Chart).ChartArea.PLANK_DEPTH);
                (bubleChartCanvas.Parent as Canvas).Clip = clipRectangle;
            }
        }
示例#40
0
 /// <summary>
 /// Update visual used for partial update
 /// </summary>
 /// <param name="propertyName">Name of the property</param>
 /// <param name="value">Value of the property</param>
 internal override void UpdateVisual(VcProperties propertyName, object value)
 {
     if (Visual != null)
     {
         foreach (AxisLabel axisLabel in AxisLabelList)
         {
             ApplyAxisLabelFontProperties(axisLabel);
             axisLabel.ApplyProperties(axisLabel);
         }
     }
     else
         FirePropertyChanged(propertyName);
 }
示例#41
0
        private static void UpdateDataSeries(DataSeries dataSeries, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Chart chart = dataSeries.Chart as Chart;

            switch (property)
            {
            case VcProperties.DataPoints:
                //case VcProperties.YValues:
                chart.ChartArea.RenderSeries();
                //Canvas ChartVisualCanvas = chart.ChartArea.ChartVisualCanvas;

                //Double width = chart.ChartArea.ChartVisualCanvas.Width;
                //Double height = chart.ChartArea.ChartVisualCanvas.Height;

                //PlotDetails plotDetails = chart.PlotDetails;
                //PlotGroup plotGroup = dataSeries.PlotGroup;

                //List<DataSeries> dataSeriesListInDrawingOrder = plotDetails.SeriesDrawingIndex.Keys.ToList();

                //List<DataSeries> selectedDataSeries4Rendering = new List<DataSeries>();

                //RenderAs currentRenderAs = dataSeries.RenderAs;

                //Int32 currentDrawingIndex = plotDetails.SeriesDrawingIndex[dataSeries];

                //for (Int32 i = 0; i < chart.InternalSeries.Count; i++)
                //{
                //    if (currentRenderAs == dataSeriesListInDrawingOrder[i].RenderAs && currentDrawingIndex == plotDetails.SeriesDrawingIndex[dataSeriesListInDrawingOrder[i]])
                //        selectedDataSeries4Rendering.Add(dataSeriesListInDrawingOrder[i]);
                //}

                //if (selectedDataSeries4Rendering.Count == 0)
                //    return;

                //Panel oldPanel = null;
                //Dictionary<RenderAs, Panel> RenderedCanvasList = chart.ChartArea.RenderedCanvasList;

                //if (chart.ChartArea.RenderedCanvasList.ContainsKey(currentRenderAs))
                //{
                //    oldPanel = RenderedCanvasList[currentRenderAs];
                //}

                //Panel renderedChart = chart.ChartArea.RenderSeriesFromList(oldPanel, selectedDataSeries4Rendering);

                //if (oldPanel == null)
                //{
                //    chart.ChartArea.RenderedCanvasList.Add(currentRenderAs, renderedChart);
                //    renderedChart.SetValue(Canvas.ZIndexProperty, currentDrawingIndex);
                //    ChartVisualCanvas.Children.Add(renderedChart);
                //}
                //else
                //    chart.ChartArea.RenderedCanvasList[currentRenderAs] = renderedChart;

                break;

            default:
                // case VcProperties.Enabled:
                foreach (DataPoint dataPoint in dataSeries.InternalDataPoints)
                {
                    UpdateDataPoint(dataPoint, property, newValue, isAxisChanged);
                }
                break;
            }
        }
示例#42
0
        //internal static void Update(Chart chart, RenderAs currentRenderAs, List<DataSeries> selectedDataSeries4Rendering, VcProperties property, object newValue)
        //{
        //    Boolean is3D = chart.View3D;
        //    ChartArea chartArea = chart.ChartArea;
        //    Canvas ChartVisualCanvas = chart.ChartArea.ChartVisualCanvas;

        //    // Double width = chart.ChartArea.ChartVisualCanvas.Width;
        //    // Double height = chart.ChartArea.ChartVisualCanvas.Height;

        //    Panel preExistingPanel = null;
        //    Dictionary<RenderAs, Panel> RenderedCanvasList = chart.ChartArea.RenderedCanvasList;

        //    if (chartArea.RenderedCanvasList.ContainsKey(currentRenderAs))
        //    {
        //        preExistingPanel = RenderedCanvasList[currentRenderAs];
        //    }

        //    Panel renderedChart = chartArea.RenderSeriesFromList(preExistingPanel, selectedDataSeries4Rendering);

        //    if (preExistingPanel == null)
        //    {
        //        chartArea.RenderedCanvasList.Add(currentRenderAs, renderedChart);
        //        ChartVisualCanvas.Children.Add(renderedChart);
        //    }
        //}

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataPoint"></param>
        /// <param name="property"></param>
        /// <param name="newValue"></param>
        /// <param name="isAxisChanged"></param>
        private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Chart chart = dataPoint.Chart as Chart;

            if (chart == null)
                return;

            PlotDetails plotDetails = chart.PlotDetails;
            Marker marker = dataPoint.Marker;
            DataSeries dataSeries = dataPoint.Parent;

            if (dataSeries.Faces == null)
                return;

            Canvas pointChartCanvas = dataSeries.Faces.Visual as Canvas;

            Double plotHeight = chart.ChartArea.ChartVisualCanvas.Height;
            Double plotWidth = chart.ChartArea.ChartVisualCanvas.Width;
            ColumnChart.UpdateParentVisualCanvasSize(chart, pointChartCanvas);

            if (property == VcProperties.Enabled || ((dataPoint.Faces == null || Double.IsNaN(dataPoint.InternalYValue)) && (property == VcProperties.XValue || property == VcProperties.YValue)))
            {
                CreateOrUpdateAPointDataPoint(pointChartCanvas, dataPoint, plotWidth, plotHeight);
                return;
            }

            if (dataPoint.Faces == null)
                return;

            //Grid bubbleVisual = dataPoint.Faces.Visual as Grid;
            
            switch (property)
            {
                case VcProperties.Bevel:
                    break;

                case VcProperties.Cursor:
                    break;

                case VcProperties.Href:
                    dataPoint.SetHref2DataPointVisualFaces();
                    break;

                case VcProperties.HrefTarget:
                    dataPoint.SetHref2DataPointVisualFaces();
                    break;

                case VcProperties.LabelBackground:
                    if (marker != null)
                        marker.TextBackground = dataPoint.LabelBackground;
                    break;

                case VcProperties.LabelEnabled:
                    CreateOrUpdateAPointDataPoint(pointChartCanvas, dataPoint, plotWidth, plotHeight);
                    //if (marker != null)
                    //    marker.LabelEnabled = (Boolean)dataPoint.LabelEnabled;
                    break;

                case VcProperties.LabelFontColor:
                    if (marker != null)
                        marker.FontColor = dataPoint.LabelFontColor;

                    break;

                case VcProperties.LabelFontFamily:
                    if (marker != null)
                        marker.FontFamily = dataPoint.LabelFontFamily;
                    break;

                case VcProperties.LabelFontStyle:
                    if (marker != null)
                        marker.FontStyle = (FontStyle)dataPoint.LabelFontStyle;
                    break;

                //case VcProperties.LabelFontSize:
                //    if (marker != null)
                //        marker.FontSize = (Double)dataPoint.LabelFontSize;
                //    break;

                case VcProperties.LabelFontWeight:
                    if (marker != null)
                        marker.FontWeight = (FontWeight)dataPoint.LabelFontWeight;
                    break;

                case VcProperties.LabelAngle:
                    if (marker != null)
                        marker.FontWeight = (FontWeight)dataPoint.LabelFontWeight;
                    break;

                case VcProperties.LegendText:
                    chart.InvokeRender();
                    break;

                case VcProperties.Color:
                case VcProperties.LightingEnabled:
                    if (marker != null)
                        marker.MarkerShape.Fill = (chart.View3D ? Graphics.Get3DBrushLighting(dataPoint.Color, (Boolean)dataPoint.LightingEnabled) : ((Boolean)dataPoint.LightingEnabled ? Graphics.GetLightingEnabledBrush(dataPoint.Color, "Linear", null) : dataPoint.Color));
                    break;

                case VcProperties.MarkerBorderColor:
                    if (marker != null)
                        marker.BorderColor = dataPoint.MarkerBorderColor;
                    break;

                case VcProperties.MarkerBorderThickness:
                    if (marker != null)
                        marker.BorderThickness = dataPoint.MarkerBorderThickness.Value.Left;
                    break;

                case VcProperties.MarkerColor:
                    if (marker != null)
                        marker.MarkerFillColor = dataPoint.MarkerColor;
                    break;

                case VcProperties.LabelFontSize:
                case VcProperties.LabelStyle:
                case VcProperties.LabelText:
                case VcProperties.MarkerScale:
                case VcProperties.MarkerSize:
                case VcProperties.MarkerType:
                    CreateOrUpdateAPointDataPoint(pointChartCanvas, dataPoint, plotWidth, plotHeight);
                    break;

                case VcProperties.ShadowEnabled:
                    if (marker != null)
                    {
                        marker.ShadowEnabled = (Boolean)dataPoint.ShadowEnabled;
                        marker.ApplyRemoveShadow();
                    }

                    break;

                case VcProperties.Opacity:
                    if (marker != null)
                        marker.Visual.Opacity = (Double)dataPoint.Opacity * (Double)dataSeries.Opacity;
                    break;

                case VcProperties.ShowInLegend:
                    chart.InvokeRender();
                    break;

                case VcProperties.ToolTipText:
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    break;

                case VcProperties.XValueFormatString:
                case VcProperties.YValueFormatString:
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    CreateOrUpdateAPointDataPoint(pointChartCanvas, dataPoint, plotWidth, plotHeight);
                    break;

                case VcProperties.XValueType:
                    chart.InvokeRender();
                    break;
                    
                case VcProperties.XValue:
                case VcProperties.YValue:
                case VcProperties.YValues:
                case VcProperties.DataPoints:
                    if (isAxisChanged)
                        UpdateDataSeries(dataSeries, property, newValue, false);
                    else
                        if (marker != null)
                        {   
                            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                            
                            if((Boolean)dataPoint.LabelEnabled)
                                marker.Text = dataPoint.TextParser(dataPoint.LabelText);

                            BubbleChart.UpdateBubblePositionAccording2XandYValue(dataPoint, plotWidth, plotHeight, (Boolean)chart.AnimatedUpdate, marker.MarkerShape.Width, marker.MarkerShape.Width);
                        }

                    break;
            }

            if (pointChartCanvas.Parent != null)
            {
                Double tickLengthOfAxisX = (from tick in chart.AxesX[0].Ticks
                                            where (Boolean)chart.AxesX[0].Enabled && (Boolean)tick.Enabled
                                            select (Double)tick.TickLength).Sum();

                if (tickLengthOfAxisX == 0)
                    tickLengthOfAxisX = 5;

                Double tickLengthOfPrimaryAxisY = (from axis in chart.AxesY
                                                   where axis.AxisType == AxisTypes.Primary
                                                   from tick in axis.Ticks
                                                   where (Boolean)axis.Enabled && (Boolean)tick.Enabled
                                                   select (Double)tick.TickLength).Sum();

                if (tickLengthOfPrimaryAxisY == 0)
                    tickLengthOfPrimaryAxisY = 8;

                Double tickLengthOfSecondaryAxisY = (from axis in chart.AxesY
                                                     where axis.AxisType == AxisTypes.Secondary
                                                     from tick in axis.Ticks
                                                     where (Boolean)axis.Enabled && (Boolean)tick.Enabled
                                                     select (Double)tick.TickLength).Sum();

                if (tickLengthOfSecondaryAxisY == 0)
                    tickLengthOfSecondaryAxisY = 8;

                Double plotGroupCount = (from c in chart.PlotDetails.PlotGroups
                                         where c.AxisY.AxisType == AxisTypes.Secondary
                                         select c).Count();

                RectangleGeometry clipRectangle = new RectangleGeometry();
                clipRectangle.Rect = new Rect(-tickLengthOfPrimaryAxisY, -chart.ChartArea.PLANK_DEPTH - 4, plotWidth + tickLengthOfSecondaryAxisY + (plotGroupCount > 0 ? tickLengthOfPrimaryAxisY : 8) + chart.ChartArea.PLANK_OFFSET, plotHeight + chart.ChartArea.PLANK_DEPTH + chart.ChartArea.PLANK_THICKNESS + tickLengthOfAxisX + 4);
                (pointChartCanvas.Parent as Canvas).Clip = clipRectangle;
            }
        }
示例#43
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dataPoint"></param>
        /// <param name="property"></param>
        /// <param name="newValue"></param>
        /// <param name="isAxisChanged"></param>
        private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Chart       chart            = dataPoint.Chart as Chart;
            PlotDetails plotDetails      = chart.PlotDetails;
            Marker      marker           = dataPoint.Marker;
            DataSeries  dataSeries       = dataPoint.Parent;
            Canvas      bubleChartCanvas = dataSeries.Faces.Visual as Canvas;

            Double plotHeight = chart.ChartArea.ChartVisualCanvas.Height;
            Double plotWidth = chart.ChartArea.ChartVisualCanvas.Width;
            Double minimumZVal, maximumZVal;

            ColumnChart.UpdateParentVisualCanvasSize(chart, bubleChartCanvas);

            if (property == VcProperties.Enabled)
            {
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                CalculateMaxAndMinZValue(dataPoint.Parent, out minimumZVal, out maximumZVal);
                CreateOrUpdateAPointDataPoint(bubleChartCanvas, dataPoint, minimumZVal, maximumZVal, plotWidth, plotHeight);
                return;
            }

            if (dataPoint.Faces == null)
            {
                return;
            }

            Grid bubbleVisual = dataPoint.Faces.Visual as Grid;

            switch (property)
            {
            case VcProperties.Bevel:
                break;

            case VcProperties.Cursor:
                break;

            case VcProperties.Href:
                dataPoint.SetHref2DataPointVisualFaces();
                break;

            case VcProperties.HrefTarget:
                dataPoint.SetHref2DataPointVisualFaces();
                break;

            case VcProperties.LabelBackground:
                if (marker != null)
                {
                    marker.TextBackground = dataPoint.LabelBackground;
                }
                break;

            case VcProperties.LabelEnabled:
                CalculateMaxAndMinZValue(dataPoint.Parent, out minimumZVal, out maximumZVal);
                CreateOrUpdateAPointDataPoint(bubleChartCanvas, dataPoint, minimumZVal, maximumZVal, plotWidth, plotHeight);

                //if (marker != null)
                //    marker.LabelEnabled = (Boolean)dataPoint.LabelEnabled;

                break;

            case VcProperties.LabelFontColor:
                if (marker != null)
                {
                    marker.FontColor = dataPoint.LabelFontColor;
                }

                break;

            case VcProperties.LabelFontFamily:
                if (marker != null)
                {
                    marker.FontFamily = dataPoint.LabelFontFamily;
                }
                break;

            case VcProperties.LabelFontStyle:
                if (marker != null)
                {
                    marker.FontStyle = (FontStyle)dataPoint.LabelFontStyle;
                }
                break;

            //case VcProperties.LabelFontSize:
            //    if (marker != null)
            //        marker.FontSize = (Double)dataPoint.LabelFontSize;
            //    break;

            case VcProperties.LabelFontWeight:
                if (marker != null)
                {
                    marker.FontWeight = (FontWeight)dataPoint.LabelFontWeight;
                }
                break;

            case VcProperties.LabelAngle:
                if (marker != null)
                {
                    marker.FontWeight = (FontWeight)dataPoint.LabelFontWeight;
                }
                break;

            case VcProperties.LegendText:
                chart.InvokeRender();
                break;

            case VcProperties.Color:
            case VcProperties.LightingEnabled:
                if (marker != null)
                {
                    marker.MarkerShape.Fill = (chart.View3D ? Graphics.Get3DBrushLighting(dataPoint.Color, (Boolean)dataPoint.LightingEnabled) : ((Boolean)dataPoint.LightingEnabled ? Graphics.GetLightingEnabledBrush(dataPoint.Color, "Linear", null) : dataPoint.Color));
                }
                break;

            case VcProperties.MarkerBorderColor:
                if (marker != null)
                {
                    marker.BorderColor = dataPoint.MarkerBorderColor;
                }
                break;

            case VcProperties.MarkerBorderThickness:
                if (marker != null)
                {
                    marker.BorderThickness = dataPoint.MarkerBorderThickness.Value.Left;
                }
                break;

            case VcProperties.XValueFormatString:
            case VcProperties.YValueFormatString:
            case VcProperties.LabelFontSize:
            case VcProperties.LabelStyle:
            case VcProperties.LabelText:
            case VcProperties.MarkerScale:
            case VcProperties.MarkerSize:
            case VcProperties.MarkerType:
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                CalculateMaxAndMinZValue(dataPoint.Parent, out minimumZVal, out maximumZVal);
                CreateOrUpdateAPointDataPoint(bubleChartCanvas, dataPoint, minimumZVal, maximumZVal, plotWidth, plotHeight);
                break;

            case VcProperties.ShadowEnabled:
                if (marker != null)
                {
                    marker.ShadowEnabled = (Boolean)dataPoint.ShadowEnabled;
                    marker.ApplyRemoveShadow();
                }
                break;

            case VcProperties.Opacity:
                if (marker != null)
                {
                    marker.Visual.Opacity = dataPoint.Opacity * dataSeries.Opacity;
                }
                break;

            case VcProperties.ShowInLegend:
                chart.InvokeRender();
                break;

            case VcProperties.ToolTipText:
                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                break;

            case VcProperties.XValueType:
                chart.InvokeRender();
                break;

            case VcProperties.XValue:
            case VcProperties.YValue:

                if (isAxisChanged)
                {
                    UpdateDataSeries(dataSeries, property, newValue, false);
                }
                else
                if (marker != null)
                {
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);

                    if ((Boolean)dataPoint.LabelEnabled)
                    {
                        marker.Text = dataPoint.TextParser(dataPoint.LabelText);
                    }

                    UpdateBubblePositionAccording2XandYValue(dataPoint, plotWidth, plotHeight, chart.AnimatedUpdate, marker.MarkerShape.Width, marker.MarkerShape.Width);
                }

                break;

            case VcProperties.ZValue:

                dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);

                //if ((Boolean)dataPoint.LabelEnabled)
                //    marker.Text = dataPoint.TextParser(dataPoint.LabelText);

                CalculateMaxAndMinZValue(dataPoint.Parent, out minimumZVal, out maximumZVal);

                foreach (DataPoint dp in dataSeries.InternalDataPoints)
                {
                    if (Double.IsNaN(dp.InternalYValue) || (dp.Enabled == false))
                    {
                        continue;
                    }

                    ApplyZValue(dp, minimumZVal, maximumZVal, plotWidth, plotHeight);
                }

                break;
            }


            if (bubleChartCanvas.Parent != null)
            {
                RectangleGeometry clipRectangle = new RectangleGeometry();
                clipRectangle.Rect = new Rect(0, -(dataPoint.Chart as Chart).ChartArea.PLANK_DEPTH, plotWidth + (dataPoint.Chart as Chart).ChartArea.PLANK_OFFSET, plotHeight + (dataPoint.Chart as Chart).ChartArea.PLANK_DEPTH);
                (bubleChartCanvas.Parent as Canvas).Clip = clipRectangle;
            }
        }
示例#44
0
        /// <summary>
        /// Update visual used for partial update
        /// </summary>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">Value of the property</param>
        internal override void UpdateVisual(VcProperties propertyName, object value)
        {
            if (Visual != null)
            {
                foreach (Rectangle rec in InterlacedRectangles)
                    rec.Fill = InterlacedColor;

                foreach (Line line in InterlacedLines)
                {
                    line.Stroke = LineColor;
                    line.StrokeThickness = LineThickness;
                    line.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
                }
            }
            else
                FirePropertyChanged(propertyName);
        }
示例#45
0
        //internal static void Update(Chart chart, RenderAs currentRenderAs, List<DataSeries> selectedDataSeries4Rendering, VcProperties property, object newValue)
        //{   
        //    foreach(
        //}

        //internal static void Update(Chart chart, RenderAs currentRenderAs, List<DataSeries> selectedDataSeries4Rendering, VcProperties property, object newValue)
        //{   
        //    Boolean is3D = chart.View3D;
        //    ChartArea chartArea = chart.ChartArea;
        //    Canvas ChartVisualCanvas = chart.ChartArea.ChartVisualCanvas;

        //    // Double width = chart.ChartArea.ChartVisualCanvas.Width;
        //    // Double height = chart.ChartArea.ChartVisualCanvas.Height;

        //    Panel preExistingPanel = null;
        //    Dictionary<RenderAs, Panel> RenderedCanvasList = chart.ChartArea.RenderedCanvasList;

        //    if (chartArea.RenderedCanvasList.ContainsKey(currentRenderAs))
        //    {   
        //        preExistingPanel = RenderedCanvasList[currentRenderAs];
        //    }

        //    Panel renderedChart = chartArea.RenderSeriesFromList(preExistingPanel, selectedDataSeries4Rendering);

        //    if (preExistingPanel == null)
        //    {
        //        chartArea.RenderedCanvasList.Add(currentRenderAs, renderedChart);
        //        ChartVisualCanvas.Children.Add(renderedChart);
        //    }
        //}

        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj">Object may be DataSeries or DataPoint</param>
        /// <param name="property"></param>
        /// <param name="newValue"></param>
        private static void UpdateDataSeries(ObservableObject obj, VcProperties property, object newValue)
        {
            DataPoint dataPoint = null;
            DataSeries dataSeries = obj as DataSeries;
            Boolean isDataPoint = false;
            
            if (dataSeries == null)
            {
                isDataPoint = true;
                dataPoint = obj as DataPoint;
                dataSeries = dataPoint.Parent;
            }

            Chart chart = dataSeries.Chart as Chart;

            if (chart == null)
                return;

            PlotGroup plotGroup = dataSeries.PlotGroup;
            Canvas line2dCanvas = null;
            Canvas label2dCanvas = null;
            Path linePath = null;
            Path lineShadowPath = null;

            if (dataSeries.Faces != null)
            {
                if (dataSeries.Faces.Parts.Count > 0)
                {
                    linePath = dataSeries.Faces.Parts[0] as Path;

                    if (dataSeries.Faces.Parts.Count > 1)
                        lineShadowPath = dataSeries.Faces.Parts[1] as Path;
                }

                line2dCanvas = dataSeries.Faces.Visual as Canvas;
                label2dCanvas = dataSeries.Faces.LabelCanvas as Canvas;
            }
            else if (dataSeries.Faces == null && property == VcProperties.Enabled && (Boolean)newValue == true)
            {
                ColumnChart.Update(chart, RenderAs.StepLine, (from ds in chart.InternalSeries where ds.RenderAs == RenderAs.StepLine select ds).ToList());
                return;
            }
            else
                return;

            Double height = chart.ChartArea.ChartVisualCanvas.Height;
            Double width = chart.ChartArea.ChartVisualCanvas.Width;

            switch (property)
            {
                case VcProperties.Color:
                    if (linePath != null)
                    {
                        Brush lineColorValue = (newValue != null) ? newValue as Brush : dataSeries.Color;

                        linePath.Stroke = ((Boolean)dataSeries.LightingEnabled) ? Graphics.GetLightingEnabledBrush(lineColorValue, "Linear", new Double[] { 0.65, 0.55 }) : lineColorValue; //dataPoint.Color;
                    }
                    break;
                case VcProperties.LightingEnabled:
                    if (linePath != null)
                        linePath.Stroke = ((Boolean)newValue) ? Graphics.GetLightingEnabledBrush(dataSeries.Color, "Linear", new Double[] { 0.65, 0.55 }) : dataSeries.Color;

                    break;

                case VcProperties.Opacity:
                    if (linePath != null)
                        linePath.Opacity = (Double)dataSeries.Opacity;
                    break;
                case VcProperties.LineStyle:
                case VcProperties.LineThickness:

                    if (lineShadowPath != null)
                        lineShadowPath.StrokeThickness = (Double)dataSeries.LineThickness;
                    if (linePath != null)
                        linePath.StrokeThickness = (Double)dataSeries.LineThickness;

                    if (lineShadowPath != null)
                        lineShadowPath.StrokeDashArray = ExtendedGraphics.GetDashArray(dataSeries.LineStyle);
                    if (linePath != null)
                        linePath.StrokeDashArray = ExtendedGraphics.GetDashArray(dataSeries.LineStyle);

                    break;
                case VcProperties.Enabled:

                    if (!isDataPoint && line2dCanvas != null)
                    {
                        if ((Boolean)newValue == false)
                        {
                            line2dCanvas.Visibility = Visibility.Collapsed;
                            label2dCanvas.Visibility = Visibility.Collapsed;
                        }
                        else
                        {
                            if (line2dCanvas.Parent == null)
                            {

                                ColumnChart.Update(chart, RenderAs.StepLine, (from ds in chart.InternalSeries where ds.RenderAs == RenderAs.StepLine select ds).ToList());
                                return;
                            }

                            line2dCanvas.Visibility = Visibility.Visible;
                            label2dCanvas.Visibility = Visibility.Visible;
                        }

                        chart._toolTip.Hide();

                        break;
                    }

                    goto RENDER_SERIES;

                case VcProperties.ShadowEnabled:
                case VcProperties.DataPoints:
                case VcProperties.YValue:
                case VcProperties.YValues:
                case VcProperties.XValue:
                case VcProperties.ViewportRangeEnabled:
                RENDER_SERIES:

                    if (dataSeries.Enabled == false)
                        return;

                    dataSeries.StopDataPointsAnimation();

                Axis axisX = plotGroup.AxisX;
                Axis axisY = plotGroup.AxisY;
                
                // line2dCanvas.OpacityMask = new SolidColorBrush(Colors.Transparent);
                // label2dCanvas.OpacityMask = new SolidColorBrush(Colors.Transparent);

                (dataSeries.Faces.Visual as Canvas).Width = width;
                (dataSeries.Faces.Visual as Canvas).Height = height;
                (dataSeries.Faces.LabelCanvas as Canvas).Width = width;
                (dataSeries.Faces.LabelCanvas as Canvas).Height = height;

                Canvas chartsCanvas = dataSeries.Faces.Visual.Parent as Canvas;
                Canvas labelsCanvas = dataSeries.Faces.LabelCanvas.Parent as Canvas;
                chartsCanvas.Width = width;
                chartsCanvas.Height = height;
                labelsCanvas.Width = width;
                labelsCanvas.Height = height;

                List<DataPoint> pc = new List<DataPoint>();
                List<List<DataPoint>> pointCollectionList = new List<List<DataPoint>>();
                
                pointCollectionList.Add(pc);

                foreach (DataPoint dp in dataSeries.InternalDataPoints)
                {
                    if (dp.Marker != null && dp.Marker.Visual != null)
                        dp.Marker.Visual.Visibility = Visibility.Collapsed;

                    if (dp.LabelVisual != null)
                        dp.LabelVisual.Visibility = Visibility.Collapsed;

                    if(Double.IsNaN(dp.InternalYValue))
                        dp.Faces = null;
                }
                
                List<DataPoint> viewPortDataPoints = RenderHelper.GetDataPointsUnderViewPort(dataSeries, false);
                foreach (DataPoint dp in viewPortDataPoints)
                {
                    if (dp.Enabled == false)
                    {
                        chart._toolTip.Hide();
                        continue;
                    }

                    if (Double.IsNaN(dp.InternalYValue))
                    {
                        pc = new List<DataPoint>();
                        pointCollectionList.Add(pc);
                        continue;
                    }

                    Double x = Graphics.ValueToPixelPosition(0, width, axisX.InternalAxisMinimum, axisX.InternalAxisMaximum, dp.InternalXValue);
                    Double y = Graphics.ValueToPixelPosition(height, 0, axisY.InternalAxisMinimum, axisY.InternalAxisMaximum, dp.InternalYValue);

                    //Point newMarkerPosition;
                    dp._visualPosition = new Point(x, y);

                    pc.Add(dp);
                }

                // gg.Children.Clear();
                GeometryGroup gg = (dataSeries.Faces.Parts[0] as Path).Data as GeometryGroup;

                // Apply new Data for Line
                StepLineChart.GetPathGeometry(gg, pointCollectionList, false, width, height, label2dCanvas);

                if (!VisifireControl.IsMediaEffectsEnabled)
                {
                    // Update GeometryGroup for shadow
                    if (dataSeries.Faces.Parts[1] != null)
                    {
                        if ((Boolean)dataSeries.ShadowEnabled)
                        {
                            (dataSeries.Faces.Parts[1] as Path).Visibility = Visibility.Visible;

                            // gg.Children.Clear();
                            GeometryGroup ggShadow = (dataSeries.Faces.Parts[1] as Path).Data as GeometryGroup;

                            // Apply new Data for Line
                            StepLineChart.GetPathGeometry(ggShadow, pointCollectionList, true, width, height, label2dCanvas);
                        }
                        else
                            (dataSeries.Faces.Parts[1] as Path).Visibility = Visibility.Collapsed;
                    }
                }
                else
                {
                    if (dataSeries.Faces != null && dataSeries.Faces.Visual != null)
                    {
#if !WP
                        if ((Boolean)dataSeries.ShadowEnabled)
                        {
                            dataSeries.Faces.Visual.Effect = ExtendedGraphics.GetShadowEffect(315, 2.5, 1);
                        }
                        else
                            dataSeries.Faces.Visual.Effect = null;
#endif
                    }
                }

                dataSeries._movingMarker.Visibility = Visibility.Collapsed;

                LineChart.Clip(chart, chartsCanvas, labelsCanvas, dataSeries.PlotGroup);

                //if (label2dCanvas.Parent != null)
                //{
                //    RectangleGeometry clipRectangle = new RectangleGeometry();

                //    Double depth3d = chart.ChartArea.PLANK_DEPTH;

                //    Double clipLeft = 0;
                //    Double clipTop = -depth3d - 4;
                //    Double clipWidth = line2dCanvas.Width + depth3d;
                //    Double clipHeight = line2dCanvas.Height + depth3d + chart.ChartArea.PLANK_THICKNESS + 10;

                //    AreaChart.GetClipCoordinates(chart, ref clipLeft, ref clipTop, ref clipWidth, ref clipHeight, plotGroup.MinimumX, plotGroup.MaximumX);

                //    clipRectangle.Rect = new Rect(clipLeft, clipTop, clipWidth, clipHeight);

                //    (label2dCanvas.Parent as Canvas).Clip = clipRectangle;

                //    clipRectangle = new RectangleGeometry();
                //    clipRectangle.Rect = new Rect(0, -depth3d - 4, line2dCanvas.Width + depth3d, line2dCanvas.Height + chart.ChartArea.PLANK_DEPTH + 10);
                //    (line2dCanvas.Parent as Canvas).Clip = clipRectangle;
                //}
                break;
            }
        }
示例#46
0
        internal static void UpdateVisualObject(Chart chart, VcProperties property, object newValue, Boolean partialUpdate)
        {   
            if (!chart._internalPartialUpdateEnabled || Double.IsNaN(chart.ActualWidth) || Double.IsNaN(chart.ActualHeight) || chart.ActualWidth == 0 || chart.ActualHeight == 0)
                return;

            if (partialUpdate && chart._datapoint2UpdatePartially.Count <= 500)
            {   
                chart.PARTIAL_DP_RENDER_LOCK = false;
                Boolean isNeed2UpdateAllSeries = false;

                List<DataSeries> _dataSeries2UpdateAtSeriesWise = (from value in chart._datapoint2UpdatePartially
                                                                   where value.Key.Parent.RenderAs == RenderAs.Spline || value.Key.Parent.RenderAs == RenderAs.QuickLine
                                                      select value.Key.Parent).Distinct().ToList();

                foreach (DataSeries splineDs in _dataSeries2UpdateAtSeriesWise)
                    splineDs.UpdateVisual(VcProperties.DataPointUpdate, null);

                List<KeyValuePair<DataPoint, VcProperties>> remainingDpInfo = (from dpInfo in chart._datapoint2UpdatePartially where !_dataSeries2UpdateAtSeriesWise.Contains(dpInfo.Key.Parent) select dpInfo).ToList();

                // If there is nothing to render anymore
                if (remainingDpInfo.Count == 0)
                    return;

                foreach (KeyValuePair<DataPoint, VcProperties> dpInfo in remainingDpInfo)
                {   
                    DataPoint dp = dpInfo.Key;

                    if (dp.Parent.RenderAs == RenderAs.Spline || dp.Parent.RenderAs == RenderAs.QuickLine)
                    {
                        isNeed2UpdateAllSeries = false;
                        continue;
                    }

                    if (dpInfo.Value == VcProperties.XValue)
                    {   
                        isNeed2UpdateAllSeries = true;
                        break;
                    }

                    PropertyInfo pInfo = dp.GetType().GetProperty(dpInfo.Value.ToString());
                    newValue = pInfo.GetValue(dp, null);

                    isNeed2UpdateAllSeries = dpInfo.Key.UpdateVisual(dpInfo.Value, newValue, true);

                    if (isNeed2UpdateAllSeries)
                        break;
                }

                if (!isNeed2UpdateAllSeries)
                    return;
            }

            chart.ChartArea.PrePartialUpdateConfiguration(chart, Visifire.Charts.ElementTypes.Chart, VcProperties.None, null, null, false, true, true, AxisRepresentations.AxisY, true);

            Int32 renderedSeriesCount = 0;      // Contain count of series that have been already rendered

            // Contains a list of serties as per the drawing order generated in the plotdetails
            List<DataSeries> dataSeriesListInDrawingOrder = chart.PlotDetails.SeriesDrawingIndex.Keys.ToList();

            List<DataSeries> selectedDataSeries4Rendering;          // Contains a list of serries to be rendered in a rendering cycle
            Int32 currentDrawingIndex;                              // Drawing index of the selected series 
            RenderAs currentRenderAs;                               // Rendereas type of the selected series

            // This loop will select series for rendering and it will repeat until all series have been rendered
            while (renderedSeriesCount < chart.InternalSeries.Count)
            {
                selectedDataSeries4Rendering = new List<DataSeries>();

                currentRenderAs = dataSeriesListInDrawingOrder[renderedSeriesCount].RenderAs;

                currentDrawingIndex = chart.PlotDetails.SeriesDrawingIndex[dataSeriesListInDrawingOrder[renderedSeriesCount]];

                for (Int32 i = renderedSeriesCount; i < chart.InternalSeries.Count; i++)
                {
                    DataSeries ds = dataSeriesListInDrawingOrder[i];
                    if (currentRenderAs == ds.RenderAs && currentDrawingIndex == chart.PlotDetails.SeriesDrawingIndex[ds])
                        selectedDataSeries4Rendering.Add(ds);
                }

                if (selectedDataSeries4Rendering.Count == 0)
                    break;

                chart._toolTip.Hide();

                if (selectedDataSeries4Rendering.Count > 0)
                {
                    if (selectedDataSeries4Rendering[0].ToolTipElement != null)
                        selectedDataSeries4Rendering[0].ToolTipElement.Hide();
                }

                chart.ChartArea.DisableIndicators();

                switch (currentRenderAs)
                {
                    case RenderAs.Column:
                    case RenderAs.Bar:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        break;

                  case RenderAs.Spline:
                  case RenderAs.QuickLine:
                        if (property == VcProperties.Enabled)
                            ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        else
                            foreach (DataSeries ds in selectedDataSeries4Rendering)
                                UpdateVisualObject(ds.RenderAs, ds, property, newValue, false);

                        break;

                  case RenderAs.Line:
                        if (property == VcProperties.Enabled)
                            ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        else
                            foreach(DataSeries ds in selectedDataSeries4Rendering)
                                LineChart.Update(ds, property, newValue, false);
                        break;

                  case RenderAs.StepLine:

                        if (property == VcProperties.Enabled)
                            ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        else
                            foreach (DataSeries ds in selectedDataSeries4Rendering)
                                StepLineChart.Update(ds, property, newValue, false);
                        break;


                    case RenderAs.Point:
                        if (property == VcProperties.ViewportRangeEnabled)
                            ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        else
                        {
                            foreach (DataSeries ds in selectedDataSeries4Rendering)
                                PointChart.Update(ds, property, newValue, false);
                        }
                        break;

                    case RenderAs.Bubble:
                        if (property == VcProperties.ViewportRangeEnabled)
                            ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        else
                        {
                            foreach (DataSeries ds in selectedDataSeries4Rendering)
                                BubbleChart.Update(ds, property, newValue, false);
                        }
                        break;

                    case RenderAs.Area:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        break;

                    case RenderAs.StackedColumn:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        break;

                    case RenderAs.StackedColumn100:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        break;

                    case RenderAs.StackedBar:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        break;

                    case RenderAs.StackedBar100:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        break;

                    case RenderAs.Pie:
                        //renderedCanvas = PieChart.GetVisualObjectForPieChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                        break;

                    case RenderAs.Doughnut:
                        //renderedCanvas = PieChart.GetVisualObjectForDoughnutChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                        break;

                    case RenderAs.StackedArea:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        chart.ChartArea.AttachEventsToolTipHref2DataSeries();
                        break;

                    case RenderAs.StackedArea100:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        chart.ChartArea.AttachEventsToolTipHref2DataSeries();
                        break;

                    case RenderAs.SectionFunnel:
                    case RenderAs.StreamLineFunnel:
                    case RenderAs.Pyramid:
                        //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, true);
                        break;

                    case RenderAs.Stock:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        break;

                    case RenderAs.CandleStick:
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                        break;
                }

                renderedSeriesCount += selectedDataSeries4Rendering.Count;
            }

            chart.ChartArea.AttachScrollBarOffsetChangedEventWithAxes();

            chart.ChartArea.AttachOrDetachIntaractivity(chart.InternalSeries);
            Visifire.Charts.Chart.SelectDataPoints(chart);
            //AttachEventsToolTipHref2DataSeries();
        }
示例#47
0
        internal static void UpdateVisualObject(Chart chart, VcProperties property, object newValue, Boolean partialUpdate)
        {
            if (!chart._internalPartialUpdateEnabled || Double.IsNaN(chart.ActualWidth) || Double.IsNaN(chart.ActualHeight) || chart.ActualWidth == 0 || chart.ActualHeight == 0)
            {
                return;
            }

            if (partialUpdate && chart._datapoint2UpdatePartially.Count <= 500)
            {
                chart.PARTIAL_DP_RENDER_LOCK = false;
                Boolean isNeed2UpdateAllSeries = false;

                List <DataSeries> _dataSeries2UpdateAtSeriesWise = (from value in chart._datapoint2UpdatePartially
                                                                    where value.Key.Parent.RenderAs == RenderAs.Spline || value.Key.Parent.RenderAs == RenderAs.QuickLine
                                                                    select value.Key.Parent).Distinct().ToList();

                foreach (DataSeries splineDs in _dataSeries2UpdateAtSeriesWise)
                {
                    splineDs.UpdateVisual(VcProperties.DataPointUpdate, null);
                }

                List <KeyValuePair <DataPoint, VcProperties> > remainingDpInfo = (from dpInfo in chart._datapoint2UpdatePartially where !_dataSeries2UpdateAtSeriesWise.Contains(dpInfo.Key.Parent) select dpInfo).ToList();

                // If there is nothing to render anymore
                if (remainingDpInfo.Count == 0)
                {
                    return;
                }

                foreach (KeyValuePair <DataPoint, VcProperties> dpInfo in remainingDpInfo)
                {
                    DataPoint dp = dpInfo.Key;

                    if (dp.Parent.RenderAs == RenderAs.Spline || dp.Parent.RenderAs == RenderAs.QuickLine)
                    {
                        isNeed2UpdateAllSeries = false;
                        continue;
                    }

                    if (dpInfo.Value == VcProperties.XValue)
                    {
                        isNeed2UpdateAllSeries = true;
                        break;
                    }

                    PropertyInfo pInfo = dp.GetType().GetProperty(dpInfo.Value.ToString());
                    newValue = pInfo.GetValue(dp, null);

                    isNeed2UpdateAllSeries = dpInfo.Key.UpdateVisual(dpInfo.Value, newValue, true);

                    if (isNeed2UpdateAllSeries)
                    {
                        break;
                    }
                }

                if (!isNeed2UpdateAllSeries)
                {
                    return;
                }
            }

            chart.ChartArea.PrePartialUpdateConfiguration(chart, Visifire.Charts.ElementTypes.Chart, VcProperties.None, null, null, false, true, true, AxisRepresentations.AxisY, true);

            Int32 renderedSeriesCount = 0;      // Contain count of series that have been already rendered

            // Contains a list of serties as per the drawing order generated in the plotdetails
            List <DataSeries> dataSeriesListInDrawingOrder = chart.PlotDetails.SeriesDrawingIndex.Keys.ToList();

            List <DataSeries> selectedDataSeries4Rendering;         // Contains a list of serries to be rendered in a rendering cycle
            Int32             currentDrawingIndex;                  // Drawing index of the selected series
            RenderAs          currentRenderAs;                      // Rendereas type of the selected series

            // This loop will select series for rendering and it will repeat until all series have been rendered
            while (renderedSeriesCount < chart.InternalSeries.Count)
            {
                selectedDataSeries4Rendering = new List <DataSeries>();

                currentRenderAs = dataSeriesListInDrawingOrder[renderedSeriesCount].RenderAs;

                currentDrawingIndex = chart.PlotDetails.SeriesDrawingIndex[dataSeriesListInDrawingOrder[renderedSeriesCount]];

                for (Int32 i = renderedSeriesCount; i < chart.InternalSeries.Count; i++)
                {
                    DataSeries ds = dataSeriesListInDrawingOrder[i];
                    if (currentRenderAs == ds.RenderAs && currentDrawingIndex == chart.PlotDetails.SeriesDrawingIndex[ds])
                    {
                        selectedDataSeries4Rendering.Add(ds);
                    }
                }

                if (selectedDataSeries4Rendering.Count == 0)
                {
                    break;
                }

                chart._toolTip.Hide();

                if (selectedDataSeries4Rendering.Count > 0)
                {
                    if (selectedDataSeries4Rendering[0].ToolTipElement != null)
                    {
                        selectedDataSeries4Rendering[0].ToolTipElement.Hide();
                    }
                }

                chart.ChartArea.DisableIndicators();

                switch (currentRenderAs)
                {
                case RenderAs.Column:
                case RenderAs.Bar:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    break;

                case RenderAs.Spline:
                case RenderAs.QuickLine:
                    if (property == VcProperties.Enabled)
                    {
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    }
                    else
                    {
                        foreach (DataSeries ds in selectedDataSeries4Rendering)
                        {
                            UpdateVisualObject(ds.RenderAs, ds, property, newValue, false);
                        }
                    }

                    break;

                case RenderAs.Line:
                    if (property == VcProperties.Enabled)
                    {
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    }
                    else
                    {
                        foreach (DataSeries ds in selectedDataSeries4Rendering)
                        {
                            LineChart.Update(ds, property, newValue, false);
                        }
                    }
                    break;

                case RenderAs.StepLine:

                    if (property == VcProperties.Enabled)
                    {
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    }
                    else
                    {
                        foreach (DataSeries ds in selectedDataSeries4Rendering)
                        {
                            StepLineChart.Update(ds, property, newValue, false);
                        }
                    }
                    break;


                case RenderAs.Point:
                    if (property == VcProperties.ViewportRangeEnabled)
                    {
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    }
                    else
                    {
                        foreach (DataSeries ds in selectedDataSeries4Rendering)
                        {
                            PointChart.Update(ds, property, newValue, false);
                        }
                    }
                    break;

                case RenderAs.Bubble:
                    if (property == VcProperties.ViewportRangeEnabled)
                    {
                        ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    }
                    else
                    {
                        foreach (DataSeries ds in selectedDataSeries4Rendering)
                        {
                            BubbleChart.Update(ds, property, newValue, false);
                        }
                    }
                    break;

                case RenderAs.Area:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    break;

                case RenderAs.StackedColumn:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    break;

                case RenderAs.StackedColumn100:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    break;

                case RenderAs.StackedBar:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    break;

                case RenderAs.StackedBar100:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    break;

                case RenderAs.Pie:
                    //renderedCanvas = PieChart.GetVisualObjectForPieChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                    break;

                case RenderAs.Doughnut:
                    //renderedCanvas = PieChart.GetVisualObjectForDoughnutChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                    break;

                case RenderAs.StackedArea:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    chart.ChartArea.AttachEventsToolTipHref2DataSeries();
                    break;

                case RenderAs.StackedArea100:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    chart.ChartArea.AttachEventsToolTipHref2DataSeries();
                    break;

                case RenderAs.SectionFunnel:
                case RenderAs.StreamLineFunnel:
                case RenderAs.Pyramid:
                    //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, true);
                    break;

                case RenderAs.Stock:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    break;

                case RenderAs.CandleStick:
                    ColumnChart.Update(chart, currentRenderAs, selectedDataSeries4Rendering);
                    break;
                }

                renderedSeriesCount += selectedDataSeries4Rendering.Count;
            }

            chart.ChartArea.AttachScrollBarOffsetChangedEventWithAxes();

            chart.ChartArea.AttachOrDetachIntaractivity(chart.InternalSeries);
            Visifire.Charts.Chart.SelectDataPoints(chart);
            //AttachEventsToolTipHref2DataSeries();
        }
示例#48
0
        internal static void Update(Chart chart, RenderAs currentRenderAs, List <DataSeries> selectedDataSeries4Rendering, VcProperties property, object newValue)
        {
            Boolean   is3D              = chart.View3D;
            ChartArea chartArea         = chart.ChartArea;
            Canvas    ChartVisualCanvas = chart.ChartArea.ChartVisualCanvas;

            // Double width = chart.ChartArea.ChartVisualCanvas.Width;
            // Double height = chart.ChartArea.ChartVisualCanvas.Height;

            Panel preExistingPanel = null;
            Dictionary <RenderAs, Panel> RenderedCanvasList = chart.ChartArea.RenderedCanvasList;

            if (chartArea.RenderedCanvasList.ContainsKey(currentRenderAs))
            {
                preExistingPanel = RenderedCanvasList[currentRenderAs];
            }

            Panel renderedChart = chartArea.RenderSeriesFromList(preExistingPanel, selectedDataSeries4Rendering);

            if (preExistingPanel == null)
            {
                chartArea.RenderedCanvasList.Add(currentRenderAs, renderedChart);
                ChartVisualCanvas.Children.Add(renderedChart);
            }
        }
示例#49
0
        internal static void UpdateVisualObject(RenderAs chartType, Visifire.Commons.ObservableObject sender, VcProperties property, object newValue, Boolean isAXisChanged)
        {
            Boolean isDataPoint = sender.GetType().Equals(typeof(DataPoint));
            DataPoint dataPoint = sender as DataPoint;
            Chart chart = (sender as ObservableObject).Chart as Chart;
            switch (chartType)
            {   
                case RenderAs.Column:
                case RenderAs.Bar:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                    break;

                case RenderAs.Line:
                case RenderAs.Spline:
                    LineChart.Update(sender, property, newValue, isAXisChanged);
                    
                    break;
                case RenderAs.QuickLine:
                    QuickLineChart.Update(sender, property, newValue, isAXisChanged);

                    break;
                case RenderAs.StepLine:
                    StepLineChart.Update(sender, property, newValue, isAXisChanged);

                    break;

                case RenderAs.Point:
                    PointChart.Update(sender, property, newValue, isAXisChanged);
                    break;

                case RenderAs.Bubble:
                    BubbleChart.Update(sender, property, newValue, isAXisChanged);
                    break;

                case RenderAs.Area:
                    AreaChart.Update(sender, property, newValue, isAXisChanged);
                    break;

                case RenderAs.StackedColumn:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                    break;

                case RenderAs.StackedColumn100:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                    break;

                case RenderAs.StackedBar:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                    break;

                case RenderAs.StackedBar100:
                    ColumnChart.Update(sender, property, newValue, isAXisChanged);
                    break;

                case RenderAs.Pie:
                    //renderedCanvas = PieChart.GetVisualObjectForPieChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                    break;

                case RenderAs.Doughnut:
                    //renderedCanvas = PieChart.GetVisualObjectForDoughnutChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled);
                    break;

                case RenderAs.StackedArea:
                    List<DataSeries> stackedAreaList = (from ds in chart.Series where ds.RenderAs == RenderAs.StackedArea select ds).ToList();

                    if (stackedAreaList.Count > 0)
                        ColumnChart.Update(chart, stackedAreaList[0].RenderAs, stackedAreaList);

                    chart.ChartArea.AttachEventsToolTipHref2DataSeries();

                    break;

                case RenderAs.StackedArea100:
                    List<DataSeries> stackedArea100List = (from ds in chart.Series where ds.RenderAs == RenderAs.StackedArea select ds).ToList();

                    if (stackedArea100List.Count > 0)
                        ColumnChart.Update(chart, stackedArea100List[0].RenderAs, stackedArea100List);

                    chart.ChartArea.AttachEventsToolTipHref2DataSeries();
                    break;

                case RenderAs.SectionFunnel: 
                case RenderAs.StreamLineFunnel:
                case RenderAs.Pyramid:
                   //renderedCanvas = FunnelChart.GetVisualObjectForFunnelChart(width, height, plotDetails, dataSeriesList4Rendering, chart, animationEnabled, true);
                    break;

                case RenderAs.Stock:
                    StockChart.Update(sender, property, newValue, isAXisChanged);
                    break;

                case RenderAs.CandleStick:
                    CandleStick.Update(sender, property, newValue, isAXisChanged);
                    break;
            }

            //chart.ChartArea.AttachScrollEvents();
        }
示例#50
0
        public static void Update(ObservableObject sender, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Boolean isDataPoint = sender.GetType().Equals(typeof(DataPoint));

            if (isDataPoint)
                UpdateDataPoint(sender as DataPoint, property, newValue);
            else
                UpdateDataSeries(sender as DataSeries, property, newValue);
        }
示例#51
0
        private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue, Boolean isAxisChanged)
        {
            Chart chart = dataPoint.Chart as Chart;
            DataSeries dataSeries = dataPoint.Parent;
            PlotGroup plotGroup = dataSeries.PlotGroup;
            Faces dsFaces = dataSeries.Faces;
            Faces dpFaces = dataPoint.Faces;
            Double dataPointWidth;

            if (dsFaces != null)
                ColumnChart.UpdateParentVisualCanvasSize(chart, dsFaces.Visual as Canvas);

            if (dpFaces != null && dpFaces.Visual != null)
                dataPointWidth = dpFaces.Visual.Width;
            else if (dsFaces == null)
                return;
            else
                dataPointWidth = CalculateDataPointWidth(dsFaces.Visual.Width, dsFaces.Visual.Height, chart);
            
            switch (property)
            {   
                case VcProperties.BorderThickness:
                      ApplyOrUpdateBorder(dataPoint, dataPointWidth);
                      ApplyOrRemoveBevel(dataPoint, dataPointWidth);
                    break;

                case VcProperties.BorderStyle:
                    ApplyOrUpdateBorder(dataPoint, dataPointWidth);
                    break;

                case VcProperties.BorderColor:
                    ApplyOrUpdateBorder(dataPoint, dataPointWidth);
                    break;

                case VcProperties.Bevel:
                    ApplyOrRemoveBevel(dataPoint, dataPointWidth);
                    break;

                case VcProperties.Color:
                case VcProperties.PriceUpColor:
                case VcProperties.PriceDownColor:
                    ApplyOrUpdateColorForACandleStick(dataPoint);
                    break;
                    
                case VcProperties.Cursor:
                    dataPoint.SetCursor2DataPointVisualFaces();
                    break;

                case VcProperties.Href:
                    dataPoint.SetHref2DataPointVisualFaces();
                    break;

                case VcProperties.HrefTarget:
                    dataPoint.SetHref2DataPointVisualFaces();
                    break;

                case VcProperties.LabelBackground:
                case VcProperties.LabelEnabled:
                case VcProperties.LabelFontColor:
                case VcProperties.LabelFontFamily:
                case VcProperties.LabelFontStyle:
                case VcProperties.LabelFontSize:
                case VcProperties.LabelFontWeight:
                case VcProperties.LabelStyle:
                case VcProperties.LabelText:
                    CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                    break;


                case VcProperties.LegendText:
                    chart.InvokeRender();
                    break;

                case VcProperties.LightingEnabled:
                    ApplyOrUpdateColorForACandleStick(dataPoint);
                    break;

                //case VcProperties.MarkerBorderColor:
                //case VcProperties.MarkerBorderThickness:
                //case VcProperties.MarkerColor:
                //case VcProperties.MarkerEnabled:
                //case VcProperties.MarkerScale:
                //case VcProperties.MarkerSize:
                //case VcProperties.MarkerType:
                case VcProperties.ShadowEnabled:
                    ApplyOrRemoveShadow(dataPoint, dataPointWidth);
                    break;

                case VcProperties.Opacity:
                    dpFaces.Visual.Opacity = dataSeries.Opacity * dataPoint.Opacity;
                    break;

                case VcProperties.ShowInLegend:
                    chart.InvokeRender();
                    break;
                case VcProperties.ToolTipText:
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    break;

                case VcProperties.XValueFormatString:
                case VcProperties.YValueFormatString:
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                    break;

                case VcProperties.XValueType:
                    chart.InvokeRender();
                    break;

                case VcProperties.Enabled:
                    CreateOrUpdateACandleStick(dataPoint, dsFaces.Visual as Canvas, dsFaces.LabelCanvas, dsFaces.Visual.Width, dsFaces.Visual.Height, dataPointWidth);
                    break;

                case VcProperties.XValue:
                case VcProperties.YValues:
                    if (isAxisChanged)
                        UpdateDataSeries(dataSeries, property, newValue, isAxisChanged);
                    else
                    {
                        dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                        UpdateYValueAndXValuePosition(dataPoint, dsFaces.Visual.Width, dsFaces.Visual.Height, dpFaces.Visual.Width);
                        
                        if ((Boolean)dataPoint.LabelEnabled)
                            CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                    }

                    if (dataPoint.Parent.SelectionEnabled && dataPoint.Selected)
                        dataPoint.Select(true);
                    
                        break;
            }
        }
示例#52
0
        private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue)
        {
            if (property != VcProperties.Enabled)
            {
                if (dataPoint.Parent.Enabled == false || (Boolean)dataPoint.Enabled == false)
                {
                    return;
                }
            }

            Chart chart = dataPoint.Chart as Chart;

            if (chart == null)
                return;

            Marker marker = dataPoint.Marker;
            DataSeries dataSeries = dataPoint.Parent;
            PlotGroup plotGroup = dataSeries.PlotGroup;
            Double height = chart.ChartArea.ChartVisualCanvas.Height;
            Double width = chart.ChartArea.ChartVisualCanvas.Width;
            Double xPosition, yPosition;
            Canvas line2dLabelCanvas = null;

            xPosition = Graphics.ValueToPixelPosition(0, width, (Double)plotGroup.AxisX.InternalAxisMinimum, (Double)plotGroup.AxisX.InternalAxisMaximum, dataPoint.InternalXValue);
            yPosition = Graphics.ValueToPixelPosition(height, 0, (Double)plotGroup.AxisY.InternalAxisMinimum, (Double)plotGroup.AxisY.InternalAxisMaximum, dataPoint.InternalYValue);

            if (dataSeries.Faces != null)
            {
                line2dLabelCanvas = dataSeries.Faces.LabelCanvas as Canvas;
                ColumnChart.UpdateParentVisualCanvasSize(chart, line2dLabelCanvas);
            }

            switch (property)
            {
                case VcProperties.Color:
                    if (marker != null && (Boolean)dataPoint.MarkerEnabled)
                        marker.BorderColor = (dataPoint.GetValue(DataPoint.MarkerBorderColorProperty) as Brush == null) ? ((newValue != null) ? newValue as Brush : dataPoint.MarkerBorderColor) : dataPoint.MarkerBorderColor;
                    break;
                case VcProperties.Cursor:
                    dataPoint.SetCursor2DataPointVisualFaces();
                    break;

                case VcProperties.Href:
                case VcProperties.HrefTarget:
                    dataPoint.SetHref2DataPointVisualFaces();
                    break;

                case VcProperties.LabelBackground:
                    //if (marker != null)
                    //    marker.TextBackground = dataPoint.LabelBackground;
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    break;

                case VcProperties.LabelEnabled:
                    //if (marker.LabelEnabled == false)
                    //CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    //else
                    //    marker.LabelEnabled = (Boolean)dataPoint.LabelEnabled;
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    break;

                case VcProperties.LabelFontColor:
                    //if (marker != null)
                    //    marker.FontColor = dataPoint.LabelFontColor;
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    break;

                case VcProperties.LabelFontFamily:
                    //CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    // marker.FontFamily = dataPoint.LabelFontFamily;
                    break;

                case VcProperties.LabelFontStyle:
                    //CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    //marker.FontStyle = (FontStyle) dataPoint.LabelFontStyle;
                    break;

                case VcProperties.LabelFontSize:
                    //CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    // marker.FontSize = (Double) dataPoint.LabelFontSize;
                    break;

                case VcProperties.LabelFontWeight:
                    //if (marker != null)
                    //    marker.FontWeight = (FontWeight) dataPoint.LabelFontWeight;
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    break;

                case VcProperties.LabelStyle:
                    //CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    break;

                case VcProperties.LabelAngle:
                    //CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    break;

                case VcProperties.LabelText:
                    //CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    //marker.Text = dataPoint.TextParser(dataPoint.LabelText);
                    break;

                case VcProperties.LegendText:
                    chart.InvokeRender();
                    break;

                case VcProperties.LightingEnabled:
                    break;

                case VcProperties.MarkerBorderColor:
                    if (marker == null)
                        LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    else
                    {
                        if ((Boolean)dataPoint.MarkerEnabled)
                            marker.BorderColor = dataPoint.MarkerBorderColor;
                    }

                    break;
                case VcProperties.MarkerBorderThickness:
                    LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    // marker.BorderThickness = dataPoint.MarkerBorderThickness.Value.Left;

                    break;

                case VcProperties.MarkerColor:
                    if (marker != null && (Boolean)dataPoint.MarkerEnabled)
                        marker.MarkerFillColor = dataPoint.MarkerColor;
                    break;

                case VcProperties.MarkerEnabled:
                    LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);

                    //if((Boolean)dataPoint.MarkerEnabled)
                    //    ShowDataPointMarker(dataPoint);
                    //else
                    //    HideDataPointMarker(dataPoint);
                    break;

                case VcProperties.MarkerScale:
                case VcProperties.MarkerSize:
                case VcProperties.MarkerType:
                case VcProperties.ShadowEnabled:
                    //Double y = Graphics.ValueToPixelPosition(plotGroup.AxisY.Height, 0, plotGroup.AxisY.InternalAxisMinimum, plotGroup.AxisY.InternalAxisMaximum, dataPoint.InternalYValue);
                    //LineChart.GetMarkerForDataPoint(true, chart, y, dataPoint, dataPoint.InternalYValue > 0);
                    LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);

                    break;

                case VcProperties.Opacity:
                    if (marker != null)
                        marker.Visual.Opacity = (Double)dataPoint.Opacity * (Double)dataSeries.Opacity;
                    break;
                case VcProperties.ShowInLegend:
                    chart.InvokeRender();
                    break;
                case VcProperties.ToolTipText:
                case VcProperties.XValueFormatString:
                case VcProperties.YValueFormatString:
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    //CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
                    CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
                        ref line2dLabelCanvas, true);
                    break;
                case VcProperties.XValueType:
                    chart.InvokeRender();
                    break;

                case VcProperties.Enabled:
                    if ((Boolean)dataPoint.Parent.Enabled)
                        UpdateDataSeries(dataPoint, VcProperties.Enabled, newValue);
                    break;

                case VcProperties.XValue:
                    if (Double.IsNaN(dataPoint._oldYValue) || dataPoint.Faces == null) // Broken point of broken line
                        UpdateDataSeries(dataPoint.Parent, property, newValue);
                    else
                        UpdateXAndYValue(dataPoint, line2dLabelCanvas);
                    break;

                case VcProperties.YValue:
                case VcProperties.YValues:
                    if (Double.IsNaN(dataPoint._oldYValue) || Double.IsNaN(dataPoint.InternalYValue) || dataPoint.Faces == null) // Broken point of broken line
                        UpdateDataSeries(dataPoint.Parent, property, newValue);
                    else
                    {
                        //UpdateXAndYValue(dataPoint, ref line2dLabelCanvas);
                        chart.Dispatcher.BeginInvoke(new Action<DataPoint, Canvas>(UpdateXAndYValue), new object[] { dataPoint, line2dLabelCanvas });


                    }

                    break;
            }
        }
示例#53
0
 internal void InvokeUpdateVisual(VcProperties property, object newValue)
 {
     if (IsNotificationEnable)
     {
         if (Parent == null || !ValidatePartialUpdate(Parent.RenderAs, property))
             return;
         UpdateVisual(property, newValue, false);
        // Chart.Dispatcher.BeginInvoke(new Action<VcProperties, object>(UpdateVisual), new object[] { property, newValue });
     }
 }