Пример #1
0
        private static void CreateOrUpdateAPointDataPoint(Canvas bubleChartCanvas, DataPoint dataPoint, Double minimumZVal, Double maximumZVal, Double plotWidth, Double plotHeight)
        {
            Faces dpFaces = dataPoint.Faces;

            // Remove preexisting dataPoint visual and label visual
            if (dpFaces != null && dpFaces.Visual != null && bubleChartCanvas == dpFaces.Visual.Parent)
            {
                bubleChartCanvas.Children.Remove(dataPoint.Faces.Visual);
                // dpFaces = null;
            }

            dataPoint.Faces = null;

            if (Double.IsNaN(dataPoint.InternalYValue) || (dataPoint.Enabled == false))
            {
                return;
            }

            Chart chart = dataPoint.Chart as Chart;

            PlotGroup plotGroup = dataPoint.Parent.PlotGroup;

            Canvas dataPointVisual = new Canvas();

            Faces bubbleFaces = new Faces();

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

            Brush markerColor = dataPoint.Color;

            markerColor = (chart.View3D ? Graphics.Get3DBrushLighting(markerColor, (Boolean)dataPoint.LightingEnabled) : ((Boolean)dataPoint.LightingEnabled ? Graphics.GetLightingEnabledBrush(markerColor, "Linear", null) : markerColor));

            String labelText = (Boolean)dataPoint.LabelEnabled ? dataPoint.TextParser(dataPoint.LabelText) : "";

            Marker marker = new Marker((MarkerTypes)dataPoint.MarkerType, 1, new Size(6, 6), false, markerColor, labelText);

            dataPoint.Marker = marker;

            ApplyZValue(dataPoint, minimumZVal, maximumZVal, plotWidth, plotHeight);

            marker.ShadowEnabled = (Boolean)dataPoint.ShadowEnabled;

            if (dataPoint.BorderColor != null)
            {
                marker.BorderColor = dataPoint.BorderColor;
            }

            marker.TextBackground  = dataPoint.LabelBackground;
            marker.BorderThickness = ((Thickness)dataPoint.MarkerBorderThickness).Left;
            marker.TextAlignmentX  = AlignmentX.Center;
            marker.TextAlignmentY  = AlignmentY.Center;
            marker.Tag             = new ElementData()
            {
                Element = dataPoint
            };

            Double gap = ((Double)dataPoint.MarkerScale * (Double)dataPoint.MarkerSize) / 2;

            if (!String.IsNullOrEmpty(labelText))
            {
                marker.FontColor      = Chart.CalculateDataPointLabelFontColor(chart, dataPoint, dataPoint.LabelFontColor, LabelStyles.OutSide);
                marker.FontSize       = (Double)dataPoint.LabelFontSize;
                marker.FontWeight     = (FontWeight)dataPoint.LabelFontWeight;
                marker.FontFamily     = dataPoint.LabelFontFamily;
                marker.FontStyle      = (FontStyle)dataPoint.LabelFontStyle;
                marker.TextBackground = dataPoint.LabelBackground;

                marker.TextAlignmentX = AlignmentX.Center;
                marker.TextAlignmentY = AlignmentY.Center;

                if (!Double.IsNaN(dataPoint.LabelAngle) && dataPoint.LabelAngle != 0)
                {
                    marker.LabelAngle      = dataPoint.LabelAngle;
                    marker.TextOrientation = Orientation.Vertical;

                    marker.TextAlignmentX = AlignmentX.Center;
                    marker.TextAlignmentY = AlignmentY.Center;

                    marker.LabelStyle = (LabelStyles)dataPoint.LabelStyle;
                }

                marker.CreateVisual();

                if (Double.IsNaN(dataPoint.LabelAngle) || dataPoint.LabelAngle == 0)
                {
                    if (yPosition - gap < 0 && (yPosition - marker.TextBlockSize.Height / 2) < 0)
                    {
                        marker.TextAlignmentY = AlignmentY.Bottom;
                    }
                    else if (yPosition + gap > plotHeight && (yPosition + marker.TextBlockSize.Height / 2) > plotHeight)
                    {
                        marker.TextAlignmentY = AlignmentY.Top;
                    }

                    if (xPosition - gap < 0 && (xPosition - marker.TextBlockSize.Width / 2) < 0)
                    {
                        marker.TextAlignmentX = AlignmentX.Right;
                    }
                    else if (xPosition + gap > plotWidth && (xPosition + marker.TextBlockSize.Width / 2) > plotWidth)
                    {
                        marker.TextAlignmentX = AlignmentX.Left;
                    }
                }
            }

            marker.PixelLavelShadow = false; // pixelLavelShadow;
            marker.CreateVisual();

            UpdateBubblePositionAccording2XandYValue(dataPoint, plotWidth, plotHeight, false, 0, 0);
            bubleChartCanvas.Children.Add(marker.Visual);

            bubbleFaces.Parts.Add(marker.MarkerShape);
            bubbleFaces.VisualComponents.Add(marker.Visual);
            bubbleFaces.BorderElements.Add(marker.MarkerShape);

            bubbleFaces.Visual = marker.Visual;
            dataPoint.Faces    = bubbleFaces;

            dataPoint.Faces.Visual.Opacity = dataPoint.Opacity * dataPoint.Parent.Opacity;
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint);
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint.Parent);
            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
            dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Faces.VisualComponents);
            dataPoint.AttachHref(chart, dataPoint.Faces.VisualComponents, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
            dataPoint.SetCursor2DataPointVisualFaces();

            if (dataPoint.Parent.SelectionEnabled && dataPoint.Selected)
            {
                dataPoint.Select(true);
            }
        }
Пример #2
0
        /// <summary>
        /// Get marker for DataPoint
        /// </summary>
        /// <param name="chart"></param>
        /// <param name="plotWidth"></param>
        /// <param name="plotHeight"></param>
        /// <param name="yPosition"></param>
        /// <param name="dataPoint"></param>
        /// <param name="isPositionTop"></param>
        /// <returns></returns>
        private static Marker GetMarkerForDataPoint(Chart chart, Double plotWidth, Double plotHeight, Double yPosition, DataPoint dataPoint, Boolean isPositionTop)
        {
            String labelText = (Boolean)dataPoint.LabelEnabled ? dataPoint.TextParser(dataPoint.LabelText) : "";

            Boolean markerBevel = false;

            Marker marker = dataPoint.Marker;

            if (marker != null && marker.Visual != null)
            {
                Panel parent = marker.Visual.Parent as Panel;

                if (parent != null)
                {
                    parent.Children.Remove(marker.Visual);
                }
            }

            dataPoint.Marker = new Marker((MarkerTypes)dataPoint.MarkerType,
                                          (Double)dataPoint.MarkerScale,
                                          new Size((Double)dataPoint.MarkerSize, (Double)dataPoint.MarkerSize),
                                          markerBevel,
                                          dataPoint.MarkerColor,
                                          labelText);

            LineChart.ApplyMarkerProperties(dataPoint);

            if ((Boolean)dataPoint.LabelEnabled && !String.IsNullOrEmpty(labelText))
            {
                LineChart.ApplyLabelProperties(dataPoint);

                if (!Double.IsNaN(dataPoint.LabelAngle) && dataPoint.LabelAngle != 0)
                {
                    dataPoint.Marker.LabelAngle      = dataPoint.LabelAngle;
                    dataPoint.Marker.TextOrientation = Orientation.Vertical;

                    SetPositionForDataPointLabel(chart, isPositionTop, dataPoint, yPosition);

                    dataPoint.Marker.LabelStyle = (LabelStyles)dataPoint.LabelStyle;
                }

                dataPoint.Marker.CreateVisual();

                if (Double.IsNaN(dataPoint.LabelAngle) || dataPoint.LabelAngle == 0)
                {
                    dataPoint.Marker.TextAlignmentX = AlignmentX.Center;

                    SetPositionForDataPointLabel(chart, isPositionTop, dataPoint, yPosition);
                }
            }

            dataPoint.Marker.Control = chart;

            dataPoint.Marker.Tag = new ElementData()
            {
                Element = dataPoint
            };

            dataPoint.Marker.CreateVisual();

            dataPoint.Marker.Visual.Opacity = (Double)dataPoint.Opacity * (Double)dataPoint.Parent.Opacity;

            LineChart.ApplyDefaultInteractivityForMarker(dataPoint);

            ObservableObject.AttachEvents2Visual(dataPoint, dataPoint, dataPoint.Marker.Visual);
            ObservableObject.AttachEvents2Visual(dataPoint.Parent, dataPoint, dataPoint.Marker.Visual);
            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
            dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Marker.Visual);
            dataPoint.AttachHref(chart, dataPoint.Marker.Visual, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
            dataPoint.SetCursor2DataPointVisualFaces();
            return(dataPoint.Marker);
        }
Пример #3
0
        internal static void CreateOrUpdateAStockDataPoint(DataPoint dataPoint, Canvas stockChartCanvas, Canvas labelCanvas, Double canvasWidth, Double canvasHeight, Double dataPointWidth)
        {
            Faces dpFaces = dataPoint.Faces;

            // Remove preexisting dataPoint visual and label visual
            if (dpFaces != null && dpFaces.Visual != null && stockChartCanvas == dpFaces.Visual.Parent)
            {
                stockChartCanvas.Children.Remove(dataPoint.Faces.Visual);
            }

            // Remove preexisting label visual
            if (dataPoint.LabelVisual != null && dataPoint.LabelVisual.Parent == labelCanvas)
            {
                labelCanvas.Children.Remove(dataPoint.LabelVisual);
            }

            dataPoint.Faces = null;

            if (dataPoint.YValues == null || dataPoint.Enabled == false)
            {
                return;
            }

            // Initialize DataPoint faces
            dataPoint.Faces = new Faces();

            // Creating ElementData for Tag
            ElementData tagElement = new ElementData()
            {
                Element = dataPoint
            };

            // Create DataPoint Visual
            Canvas dataPointVisual = new Canvas();          // Create DataPoint Visual
            Line   highLow         = new Line()
            {
                Tag = tagElement
            };                                              // Create High and Low Line
            Line closeLine = new Line()
            {
                Tag = tagElement
            };                                                  // Create Close Line
            Line openLine = new Line()
            {
                Tag = tagElement
            };                                                  // Create Close Line

            dataPoint.Faces.Visual = dataPointVisual;

            // Add VisualComponents
            dataPoint.Faces.VisualComponents.Add(highLow);
            dataPoint.Faces.VisualComponents.Add(openLine);
            dataPoint.Faces.VisualComponents.Add(closeLine);

            // Add Border elements
            dataPoint.Faces.BorderElements.Add(highLow);
            dataPoint.Faces.BorderElements.Add(openLine);
            dataPoint.Faces.BorderElements.Add(closeLine);

            dataPoint.Faces.Visual = dataPointVisual;
            stockChartCanvas.Children.Add(dataPointVisual);

            UpdateYValueAndXValuePosition(dataPoint, canvasWidth, canvasHeight, dataPointWidth);
            ApplyBorderProperties(dataPoint, highLow, openLine, closeLine, dataPointWidth);
            ApplyOrUpdateColorForAStockDp(dataPoint, highLow, openLine, closeLine);

            // Add VisualComponents to visual
            dataPointVisual.Children.Add(highLow);
            dataPointVisual.Children.Add(openLine);
            dataPointVisual.Children.Add(closeLine);

            // Attach tooltip, events, href etc
            dataPointVisual.Opacity = dataPoint.Parent.Opacity * dataPoint.Opacity;
            Chart chart = dataPoint.Chart as Chart;

            dataPoint.SetCursor2DataPointVisualFaces();
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint);
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint.Parent);
            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
            dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Faces.VisualComponents);
            dataPoint.AttachHref(chart, dataPoint.Faces.VisualComponents, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
        }
Пример #4
0
        /// <summary>
        /// Create or update a CandleStick
        /// </summary>
        /// <param name="dataPoint"></param>
        /// <param name="seriesCanvas"></param>
        /// <param name="labelCanvas"></param>
        /// <param name="canvasWidth"></param>
        /// <param name="canvasHeight"></param>
        /// <param name="dataPointWidth"></param>
        internal static void CreateOrUpdateACandleStick(DataPoint dataPoint, Canvas candleStickCanvas, Canvas labelCanvas, Double canvasWidth, Double canvasHeight, Double dataPointWidth)
        {
            Faces dpFaces = dataPoint.Faces;

            // Remove preexisting dataPoint visual and label visual
            if (dpFaces != null && dpFaces.Visual != null && candleStickCanvas == dpFaces.Visual.Parent)
            {
                candleStickCanvas.Children.Remove(dataPoint.Faces.Visual);
                //dpFaces = null;
            }

            // Remove preexisting label visual
            if (dataPoint.LabelVisual != null && dataPoint.LabelVisual.Parent == labelCanvas)
            {
                labelCanvas.Children.Remove(dataPoint.LabelVisual);
                //dataPoint.LabelVisual = null;
            }

            dataPoint.Faces = null;

            if (dataPoint.InternalYValues == null || dataPoint.Enabled == false)
            {
                return;
            }

            // Creating ElementData for Tag
            ElementData tagElement = new ElementData()
            {
                Element = dataPoint
            };

            // Initialize DataPoint faces
            dataPoint.Faces = new Faces();

            // Create DataPoint Visual
            Canvas dataPointVisual = new Canvas();

            dataPoint.Faces.Visual = dataPointVisual;

            // Create High and Low Line
            Line highLowLine = new Line()
            {
                Tag = tagElement
            };

            dataPoint.Faces.Parts.Add(highLowLine);
            dataPoint.Faces.VisualComponents.Add(highLowLine);
            dataPointVisual.Children.Add(highLowLine);

            /* Create Open-Close Rectangle
             * Math.Max is used to make sure that the rectangle is visible
             * even when the difference between high and low is 0 */
            Rectangle openCloseRect = new Rectangle()
            {
                Tag = tagElement
            };

            dataPoint.Faces.VisualComponents.Add(openCloseRect);
            dataPoint.Faces.BorderElements.Add(openCloseRect);
            dataPointVisual.Children.Add(openCloseRect);

            UpdateYValueAndXValuePosition(dataPoint, canvasWidth, canvasHeight, dataPointWidth);

            // Add dataPointVisual to seriesCanvas
            candleStickCanvas.Children.Add(dataPointVisual);

            CreateAndPositionLabel(labelCanvas, dataPoint);

            dataPointVisual.Opacity = (Double)dataPoint.Parent.Opacity * (Double)dataPoint.Opacity;

            Chart chart = dataPoint.Chart as Chart;

            dataPoint.SetCursor2DataPointVisualFaces();
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint);
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint.Parent);
            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
            if (!chart.IndicatorEnabled)
            {
                dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Faces.VisualComponents);

                if (dataPoint.LabelVisual != null)
                {
                    dataPoint.AttachToolTip(chart, dataPoint, dataPoint.LabelVisual);
                }
            }
            dataPoint.AttachHref(chart, dataPoint.Faces.VisualComponents, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
        }
Пример #5
0
        /// <summary>
        /// Creates visual object for a StackedColumn
        /// </summary>
        /// <param name="isPositive">Whether the DataPoint YValue is greater than or equals to 0.</param>
        /// <param name="columnCanvas"></param>
        /// <param name="labelCanvas"></param>
        /// <param name="dataPoint"></param>
        /// <param name="isTopOFStack"></param>
        /// <param name="left"></param>
        /// <param name="top"></param>
        /// <param name="bottom"></param>
        /// <param name="columnWidth"></param>
        /// <param name="depth3d"></param>
        /// <param name="prevSum"></param>
        /// <param name="positiveOrNegativeIndex"></param>
        /// <param name="animationEnabled"></param>
        private static void CreateStackedColumnVisual(Boolean isPositive, Canvas columnCanvas, Canvas labelCanvas,
                                                      DataPoint dataPoint, Boolean isTopOFStack, Double left, ref Double top, ref Double bottom, Double columnWidth,
                                                      Double columnHeight, Double depth3d, ref Int32 positiveOrNegativeIndex, Boolean animationEnabled,
                                                      Double animationBeginTime)
        {
            PlotGroup plotGroup = dataPoint.Parent.PlotGroup;
            Chart     chart     = dataPoint.Chart as Chart;

            Faces column;
            Panel columnVisual = null;

            dataPoint.Parent.Faces = new Faces {
                Visual = columnCanvas, LabelCanvas = labelCanvas
            };

            if (chart.View3D)
            {
                column = ColumnChart.Get3DColumn(dataPoint, columnWidth, columnHeight, depth3d, dataPoint.Color, null, null, null, (Boolean)dataPoint.LightingEnabled,
                                                 (BorderStyles)dataPoint.BorderStyle, dataPoint.BorderColor, dataPoint.BorderThickness.Left);
                columnVisual = column.Visual as Panel;
                columnVisual.SetValue(Canvas.ZIndexProperty, ColumnChart.GetStackedColumnZIndex(left, top, (dataPoint.InternalYValue > 0), positiveOrNegativeIndex));
                dataPoint.Faces = column;
                ColumnChart.ApplyOrRemoveShadow(dataPoint, true, false);
            }
            else
            {
                column       = ColumnChart.Get2DColumn(dataPoint, columnWidth, columnHeight, true, false);
                columnVisual = column.Visual as Panel;
            }

            dataPoint.Faces             = column;
            dataPoint.Faces.LabelCanvas = labelCanvas;

            columnVisual.SetValue(Canvas.LeftProperty, left);
            columnVisual.SetValue(Canvas.TopProperty, top);

            columnCanvas.Children.Add(columnVisual);

            dataPoint.IsTopOfStack = isTopOFStack;

            CreateOrUpdateMarker4VerticalChart(dataPoint, labelCanvas, new Size(columnVisual.Width, columnVisual.Height),
                                               left, top);

            // labelCanvas.Children.Add(GetMarker(chart, columnParams, dataPoint, left, top));

            DataSeries currentDataSeries;

            // Apply animation
            if (animationEnabled)
            {
                currentDataSeries = dataPoint.Parent;

                if (currentDataSeries.Storyboard == null)
                {
                    currentDataSeries.Storyboard = new Storyboard();
                }

                // Apply animation to the data points dataSeriesIndex.e to the rectangles that form the columns
                currentDataSeries.Storyboard = ApplyStackedColumnChartAnimation(currentDataSeries, columnVisual, dataPoint.Parent.Storyboard, animationBeginTime, 0.5);
            }

            if (isPositive)
            {
                bottom = top;
            }
            else
            {
                top = bottom;
            }

            dataPoint.Faces.Visual.Opacity = dataPoint.Opacity * dataPoint.Parent.Opacity;
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint);
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint.Parent);
            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
            //dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Faces.VisualComponents);
            //dataPoint.AttachHref(chart, dataPoint.Faces.VisualComponents, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);

            dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Faces.Visual);
            dataPoint.AttachHref(chart, dataPoint.Faces.Visual, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);

            dataPoint.SetCursor2DataPointVisualFaces();
        }
Пример #6
0
        // Canvas bubleChartCanvas, DataPoint dataPoint, Double minimumZVal, Double maximumZVal, Double plotWidth, Double plotHeight
        private static void CreateOrUpdateAPointDataPoint(Canvas pointChartCanvas, DataPoint dataPoint, Double plotAreaWidth, Double plotAreaHeight)
        {
            Faces dpFaces = dataPoint.Faces;

            // Remove preexisting dataPoint visual and label visual
            if (dpFaces != null && dpFaces.Visual != null && pointChartCanvas == dpFaces.Visual.Parent)
            {
                pointChartCanvas.Children.Remove(dataPoint.Faces.Visual);
                //dpFaces = null;
            }

            dataPoint.Faces = null;
            dpFaces         = new Faces();

            if (Double.IsNaN(dataPoint.InternalYValue) || (dataPoint.Enabled == false))
            {
                return;
            }

            Chart     chart     = dataPoint.Chart as Chart;
            PlotGroup plotGroup = dataPoint.Parent.PlotGroup;

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

            Brush markerColor = dataPoint.Color;

            //markerColor = (chart.View3D ? Graphics.GetLightingEnabledBrush3D(markerColor) :
            //    ((Boolean)dataPoint.LightingEnabled ? Graphics.GetLightingEnabledBrush(markerColor, "Linear", null) : markerColor));

            markerColor = (chart.View3D ? Graphics.Get3DBrushLighting(dataPoint.Color, (Boolean)dataPoint.LightingEnabled) :
                           ((Boolean)dataPoint.LightingEnabled ? Graphics.GetLightingEnabledBrush(markerColor, "Linear", null) : markerColor));

            Size    markerSize  = new Size((Double)dataPoint.MarkerSize, (Double)dataPoint.MarkerSize);
            Boolean markerBevel = false;
            String  labelText   = (Boolean)dataPoint.LabelEnabled ? dataPoint.TextParser(dataPoint.LabelText) : "";
            Marker  marker      = new Marker((MarkerTypes)dataPoint.MarkerType, (Double)dataPoint.MarkerScale, markerSize, markerBevel, markerColor, labelText);

            marker.Tag = new ElementData()
            {
                Element = dataPoint
            };

            marker.ShadowEnabled = (Boolean)dataPoint.ShadowEnabled;

            if (!VisifireControl.IsMediaEffectsEnabled)
            {
                marker.PixelLavelShadow = false;
            }
            else
            {
                marker.PixelLavelShadow = true;
            }

            marker.MarkerSize = new Size((Double)dataPoint.MarkerSize, (Double)dataPoint.MarkerSize);

            if (marker.MarkerType != MarkerTypes.Cross)
            {
                if (dataPoint.BorderColor != null)
                {
                    marker.BorderColor = dataPoint.BorderColor;
                }
            }
            else
            {
                marker.BorderColor = markerColor;
            }
            marker.BorderThickness = ((Thickness)dataPoint.MarkerBorderThickness).Left;

            if (!String.IsNullOrEmpty(labelText))
            {
                marker.FontColor      = Chart.CalculateDataPointLabelFontColor(chart, dataPoint, dataPoint.LabelFontColor, LabelStyles.OutSide);
                marker.FontSize       = (Double)dataPoint.LabelFontSize;
                marker.FontWeight     = (FontWeight)dataPoint.LabelFontWeight;
                marker.FontFamily     = dataPoint.LabelFontFamily;
                marker.FontStyle      = (FontStyle)dataPoint.LabelFontStyle;
                marker.TextBackground = dataPoint.LabelBackground;

                marker.TextAlignmentX = AlignmentX.Center;
                marker.TextAlignmentY = AlignmentY.Center;

                if (!Double.IsNaN(dataPoint.LabelAngle) && dataPoint.LabelAngle != 0)
                {
                    marker.LabelAngle      = dataPoint.LabelAngle;
                    marker.TextOrientation = Orientation.Vertical;

                    marker.TextAlignmentX = AlignmentX.Center;
                    marker.TextAlignmentY = AlignmentY.Center;

                    marker.LabelStyle = (LabelStyles)dataPoint.LabelStyle;
                }

                marker.CreateVisual();

                if (Double.IsNaN(dataPoint.LabelAngle) || dataPoint.LabelAngle == 0)
                {
                    if ((yPosition - marker.TextBlockSize.Height / 2) < 0)
                    {
                        marker.TextAlignmentY = AlignmentY.Bottom;
                    }
                    else if ((yPosition + marker.TextBlockSize.Height / 2) > plotAreaHeight)
                    {
                        marker.TextAlignmentY = AlignmentY.Top;
                    }

                    if ((xPosition - marker.TextBlockSize.Width / 2) < 0)
                    {
                        marker.TextAlignmentX = AlignmentX.Right;
                    }
                    else if ((xPosition + marker.TextBlockSize.Width / 2) > plotAreaWidth)
                    {
                        marker.TextAlignmentX = AlignmentX.Left;
                    }
                }
            }

            //marker.LabelEnabled =(Boolean) dataPoint.LabelEnabled;
            //marker.TextBackground = dataPoint.LabelBackground;
            //marker.FontColor = Chart.CalculateDataPointLabelFontColor(chart, dataPoint, dataPoint.LabelFontColor, LabelStyles.OutSide);
            //marker.FontSize = (Double)dataPoint.LabelFontSize;
            //marker.FontWeight = (FontWeight)dataPoint.LabelFontWeight;
            //marker.FontFamily = dataPoint.LabelFontFamily;
            //marker.FontStyle = (FontStyle)dataPoint.LabelFontStyle;

            //marker.TextAlignmentX = AlignmentX.Center;
            //marker.TextAlignmentY = AlignmentY.Center;

            marker.CreateVisual();

            marker.Visual.Opacity = (Double)dataPoint.Opacity * (Double)dataPoint.Parent.Opacity;

            marker.AddToParent(pointChartCanvas, xPosition, yPosition, new Point(0.5, 0.5));

            dataPoint._visualPosition = new Point(xPosition, yPosition);

            dpFaces.VisualComponents.Add(marker.Visual);
            dpFaces.Visual = marker.Visual;

            dpFaces.BorderElements.Add(marker.MarkerShape);

            dataPoint.Marker = marker;
            dataPoint.Faces  = dpFaces;

            dataPoint.Faces.Visual.Opacity = (Double)dataPoint.Opacity * (Double)dataPoint.Parent.Opacity;
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint);
            dataPoint.AttachEvent2DataPointVisualFaces(dataPoint.Parent);
            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
            if (!chart.IndicatorEnabled)
            {
                dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Faces.VisualComponents);
            }
            dataPoint.AttachHref(chart, dataPoint.Faces.VisualComponents, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
            dataPoint.SetCursor2DataPointVisualFaces();

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