当前位置: 首页>>代码示例>>C#>>正文


C# DataPoint.TextParser方法代码示例

本文整理汇总了C#中Visifire.Charts.DataPoint.TextParser方法的典型用法代码示例。如果您正苦于以下问题:C# DataPoint.TextParser方法的具体用法?C# DataPoint.TextParser怎么用?C# DataPoint.TextParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Visifire.Charts.DataPoint的用法示例。


在下文中一共展示了DataPoint.TextParser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateStackedBarVisual


//.........这里部分代码省略.........
                if (absoluteSum != 0)
                {
                    if (plotGroup.AxisY.Logarithmic)
                    {
                        percentYValue = Math.Log((dataPoint.InternalYValue / absoluteSum * 100), plotGroup.AxisY.LogarithmBase);
                    }
                    else
                        percentYValue = (dataPoint.InternalYValue / absoluteSum * 100);
                }
            }
            else
                percentYValue = dataPoint.InternalYValue;


            if (isPositive)
            {
                if(plotGroup.AxisY.Logarithmic)
                    right = ColumnChart.CalculatePositionOfDataPointForLogAxis(dataPoint, columnCanvas.Width, plotGroup, listOfDataPointsInXValue, absoluteSum);
                else
                    right = Graphics.ValueToPixelPosition(0, columnCanvas.Width, (Double)plotGroup.AxisY.InternalAxisMinimum, (Double)plotGroup.AxisY.InternalAxisMaximum, percentYValue + prevSum);
            }
            else
                left = Graphics.ValueToPixelPosition(0, columnCanvas.Width, (Double)plotGroup.AxisY.InternalAxisMinimum, (Double)plotGroup.AxisY.InternalAxisMaximum, percentYValue + prevSum);

            Double barWidth = Math.Abs(right - left);

            prevSum += percentYValue;
            // barParams.Size = new Size(barWidth, finalHeight);

            Faces bar;
            Panel barVisual = null;

            if ((dataPoint.Chart as Chart).View3D)
            {
                bar = ColumnChart.Get3DColumn(dataPoint, barWidth, finalHeight, depth3d, dataPoint.Color, null, null, null, (Boolean)dataPoint.LightingEnabled,
                    (BorderStyles)dataPoint.BorderStyle, dataPoint.BorderColor, dataPoint.BorderThickness.Left);
               
                barVisual = bar.Visual as Panel;
                barVisual.SetValue(Canvas.ZIndexProperty, GetStackedBarZIndex(chart.ChartArea.PlotAreaCanvas.Height, left, top, columnCanvas.Width, columnCanvas.Height, (dataPoint.InternalYValue > 0), PositiveOrNegativeZIndex));

                dataPoint.Faces = bar;
                if (!VisifireControl.IsMediaEffectsEnabled)
                    ColumnChart.ApplyOrRemoveShadow4XBAP(dataPoint, true, false);
            }
            else
            {
                bar = ColumnChart.Get2DColumn(dataPoint, barWidth, finalHeight, true, isTopOFStack);
                barVisual = bar.Visual as Panel;
                dataPoint.Faces = bar;
            }

            if (VisifireControl.IsMediaEffectsEnabled)
                ApplyOrRemoveShadow(chart, dataPoint);

            dataPoint.Faces.LabelCanvas = labelCanvas;

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

            columnCanvas.Children.Add(barVisual);

            dataPoint.IsTopOfStack = isTopOFStack;

            CreateOrUpdateMarker4HorizontalChart(dataPoint.Chart as Chart, labelCanvas, dataPoint, left, top, isPositive, depth3d);

            //labelCanvas.Children.Add(CreateMarker(chart, barParams, dataPoint, left, top));

            // Apply animation
            if (animationEnabled)
            {
                if (dataPoint.Parent.Storyboard == null)
                    dataPoint.Parent.Storyboard = new Storyboard();

                currentDataSeries = dataPoint.Parent;

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

            if (isPositive)
                left = right;
            else
                right = left;

            if (isPositive)
                dataPoint._visualPosition = new Point(right, top + finalHeight / 2);
            else
                dataPoint._visualPosition = new Point(left, top + finalHeight / 2);

            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.Visual);
            dataPoint.AttachHref(chart, dataPoint.Faces.Visual, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
            
            dataPoint.SetCursor2DataPointVisualFaces();
        }
开发者ID:zhangzy0193,项目名称:visifire,代码行数:101,代码来源:BarChart.cs

示例2: UpdateDataPoint


//.........这里部分代码省略.........
                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;
            }
        }
开发者ID:zhangzy0193,项目名称:visifire,代码行数:101,代码来源:StepLineChart.cs

示例3: UpdateDataPoint


//.........这里部分代码省略.........
            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 = (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);
                    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.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)
                            CandleStick.CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
                    }

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

                    break;
            }
        }
开发者ID:zhangzy0193,项目名称:visifire,代码行数:101,代码来源:StockChart.cs

示例4: CreateOrUpdateAPointDataPoint

        // 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;
//.........这里部分代码省略.........
开发者ID:zhangzy0193,项目名称:visifire,代码行数:101,代码来源:PointChart.cs

示例5: CreateLabel

        /// <summary>
        /// Creates a new label for a DataPoint
        /// </summary>
        /// <param name="dataPoint">DataPoint</param>
        /// <returns>Grid</returns>
        private static Canvas CreateLabel(DataPoint dataPoint)
        {
            TextBlock textBlock = new TextBlock()
            {
                FontFamily = dataPoint.LabelFontFamily,
                FontSize = (Double)dataPoint.LabelFontSize,
                FontStyle = (FontStyle)dataPoint.LabelFontStyle,
                FontWeight = (FontWeight)dataPoint.LabelFontWeight,
                Foreground = Chart.CalculateDataPointLabelFontColor((dataPoint.Chart as Chart), dataPoint, dataPoint.LabelFontColor, (LabelStyles)dataPoint.LabelStyle),
                Text = dataPoint.TextParser(dataPoint.LabelText),
                Tag = new ElementData() { Element = dataPoint }
            };

            Size textBlockSize = Graphics.CalculateVisualSize(textBlock);
            if (textBlockSize.Width == 0 && textBlockSize.Width == 0)
            {
                textBlockSize.Width = textBlock.ActualWidth;
                textBlockSize.Height = textBlock.ActualHeight;
            }

            Canvas visual = new Canvas() { Height = textBlockSize.Height, Width = textBlockSize.Width, Background = dataPoint.LabelBackground, Tag = new ElementData() { Element = dataPoint } };

            visual.Opacity = dataPoint.InternalOpacity * dataPoint.Parent.InternalOpacity;

            visual.Children.Add(textBlock);

            dataPoint.LabelVisual = visual;

            return visual;
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:35,代码来源:PieChart.cs

示例6: GetMarkerForDataPoint

        /// <summary>
        /// Returns marker for DataPoint
        /// </summary>
        /// <param name="chart">Chart</param>
        /// <param name="position">Marker position</param>
        /// <param name="dataPoint">DataPoint</param>
        /// <param name="isPositive">Whether YValue is positive or negative</param>
        /// <returns>Marker</returns>
        internal static Marker GetMarkerForDataPoint(Boolean reCreate, Chart chart, Double plotWidth, Double plotHeight, Double yPosition, DataPoint dataPoint, Boolean isPositive)
        {
            String labelText;

            if (dataPoint.Parent.RenderAs == RenderAs.Spline || dataPoint.Parent.RenderAs == RenderAs.Line || dataPoint.Parent.RenderAs == RenderAs.StepLine)
                labelText = "";
            else
                labelText = (Boolean)dataPoint.LabelEnabled ? dataPoint.TextParser(dataPoint.LabelText) : "";

            Boolean markerBevel = false;

            if (reCreate)
            {
                //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);

                //    marker.MarkerType = (MarkerTypes)dataPoint.MarkerType;
                //    marker.ScaleFactor = (Double)dataPoint.MarkerScale;
                //    marker.MarkerSize = new Size((Double)dataPoint.MarkerSize, (Double)dataPoint.MarkerSize);
                //    marker.Bevel = false;
                //    marker.MarkerFillColor = dataPoint.MarkerColor;
                //    marker.Text = labelText;

                //}
                //else
                {
                    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);
                }
            }
            else
            {   
                Marker marker = dataPoint.Marker;

                marker.MarkerType = (MarkerTypes)dataPoint.MarkerType;
                marker.ScaleFactor = (Double)dataPoint.MarkerScale;
                marker.MarkerSize = new Size((Double)dataPoint.MarkerSize, (Double)dataPoint.MarkerSize);
                marker.Bevel = false;
                marker.MarkerFillColor = dataPoint.MarkerColor;
                marker.Text = labelText;
                marker.TextAlignmentX = AlignmentX.Center;
                marker.TextAlignmentY = AlignmentY.Center;
            }

            ApplyMarkerProperties(dataPoint);

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

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

                    if (isPositive)
                    {
                        dataPoint.Marker.TextAlignmentX = AlignmentX.Center;
                        dataPoint.Marker.TextAlignmentY = AlignmentY.Top;
                    }
                    else
                    {
                        dataPoint.Marker.TextAlignmentX = AlignmentX.Center;
                        dataPoint.Marker.TextAlignmentY = AlignmentY.Bottom;
                    }

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

                dataPoint.Marker.CreateVisual();

                if (Double.IsNaN(dataPoint.LabelAngle) || dataPoint.LabelAngle == 0)
//.........这里部分代码省略.........
开发者ID:zhangzy0193,项目名称:visifire,代码行数:101,代码来源:LineChart.cs

示例7: CreateLabelForDataPoint

        /// <summary>
        /// Create labels for DataPoint
        /// </summary>
        /// <param name="dataPoint">DataPoint</param>
        /// <returns>Border</returns>
        private static Border CreateLabelForDataPoint(DataPoint dataPoint, Boolean isStreamLine, Int32 sliceIndex)
        {
            Title title = new Title()
            {
                IsNotificationEnable = false,
                Chart = dataPoint.Chart,
                Text = dataPoint.TextParser(dataPoint.LabelText),
                InternalFontSize = (Double)dataPoint.LabelFontSize,
                InternalFontColor = (isStreamLine && sliceIndex == 0) ? Chart.CalculateDataPointLabelFontColor(dataPoint.Chart as Chart, dataPoint, null, LabelStyles.OutSide) : Chart.CalculateDataPointLabelFontColor(dataPoint.Chart as Chart, dataPoint, dataPoint.LabelFontColor, (LabelStyles)dataPoint.LabelStyle),
                InternalFontFamily = dataPoint.LabelFontFamily,
                InternalFontStyle = (FontStyle)dataPoint.LabelFontStyle,
                InternalFontWeight = (FontWeight)dataPoint.LabelFontWeight,
                InternalBackground = dataPoint.LabelBackground
            };

            // If its a StreamLine funnel then default size of the Title should be a bit bigger 
            if (isStreamLine && sliceIndex == 0 && dataPoint.GetValue(DataPoint.LabelFontSizeProperty) == null && dataPoint.Parent.GetValue(DataPoint.LabelFontSizeProperty) == null)
            {
                title.InternalFontSize = 11.5;
            }

            title.CreateVisualObject(new ElementData() { Element = dataPoint });

            if (!(Boolean)dataPoint.LabelEnabled)
                title.Visual.Visibility = Visibility.Collapsed;

            return title.Visual;
        }
开发者ID:zhangzy0193,项目名称:visifire,代码行数:33,代码来源:FunnelChart.cs

示例8: CreateColumnDataPointVisual


//.........这里部分代码省略.........
            }
            else
            {   
                bottom = Graphics.ValueToPixelPosition(parentCanvas.Height, 0, (Double)plotGroup.AxisY.InternalAxisMinimum, (Double)plotGroup.AxisY.InternalAxisMaximum, Double.IsNaN(dataPoint.InternalYValue) ? 0 : dataPoint.InternalYValue);
                top = Graphics.ValueToPixelPosition(parentCanvas.Height, 0, (Double)plotGroup.AxisY.InternalAxisMinimum, (Double)plotGroup.AxisY.InternalAxisMaximum, limitingYValue);

                if (plotGroup.AxisY.AxisMinimum != null && limitingYValue>0 && dataPoint.InternalYValue < limitingYValue && chart.View3D)
                {
                    top = bottom = bottom + 100;
                }
            }

            columnHeight = Math.Abs(top - bottom);

            if(columnHeight < dataPoint.Parent.MinPointHeight)
            {
                if (dataPoint.InternalYValue == 0)
                {   
                    if (plotGroup.AxisY.InternalAxisMaximum <= 0)
                        bottom += (dataPoint.Parent.MinPointHeight - columnHeight);
                    else
                        top -= (dataPoint.Parent.MinPointHeight - columnHeight);
                }
                else if (isPositive)
                    top -= (dataPoint.Parent.MinPointHeight - columnHeight);
                else
                    bottom += (dataPoint.Parent.MinPointHeight - columnHeight);
                    
                columnHeight = dataPoint.Parent.MinPointHeight;
            }

            columnVisualSize = new Size(widthOfAcolumn, columnHeight);

            Faces columnFaces = null;
            Panel columnVisual = null;

            if (chart.View3D)
            {
                columnFaces = Get3DColumn(dataPoint, widthOfAcolumn, columnHeight, depth3D, dataPoint.Color, null, null, null, (Boolean)dataPoint.LightingEnabled,
                    (BorderStyles)dataPoint.BorderStyle, dataPoint.BorderColor, dataPoint.BorderThickness.Left);
                columnVisual = columnFaces.Visual as Panel;
                columnVisual.SetValue(Canvas.ZIndexProperty, GetColumnZIndex(left, top, (dataPoint.InternalYValue > 0)));
                
                dataPoint.Faces = columnFaces;

                if (!VisifireControl.IsMediaEffectsEnabled)
                    ColumnChart.ApplyOrRemoveShadow4XBAP(dataPoint, false, false);

            }   
            else
            {   
                columnFaces = Get2DColumn(dataPoint, widthOfAcolumn, columnHeight, false, false);
                columnVisual = columnFaces.Visual as Panel;
            }

            dataPoint.Faces = columnFaces;

            if (VisifireControl.IsMediaEffectsEnabled)
                ColumnChart.ApplyOrRemoveShadow(chart, dataPoint);

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

            parentCanvas.Children.Add(columnVisual);

            dataPoint.IsTopOfStack = true;

            CreateOrUpdateMarker4VerticalChart(dataPoint, labelCanvas, columnVisualSize, left, top);

            if(isPositive)
                dataPoint._visualPosition = new Point(left + columnVisualSize.Width / 2, top);
            else
                dataPoint._visualPosition = new Point(left + columnVisualSize.Width / 2, bottom);

            // Apply animation
            if (animationEnabled)
            {
                if (dataPoint.Parent.Storyboard == null)
                    dataPoint.Parent.Storyboard = new Storyboard();

                currentDataSeries = dataPoint.Parent;
                //dataPoint.Parent.Storyboard.Stop();

                // Apply animation to the data points dataSeriesIndex.e to the rectangles that form the columns
                dataPoint.Parent.Storyboard = ApplyColumnChartAnimation(currentDataSeries, columnVisual, dataPoint.Parent.Storyboard, isPositive, 1, new Double[] { 0, 1 }, new Double[] { 0, 1 }, dataPoint.Parent.RenderAs);

            }

            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.Visual);
            //dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Faces.VisualComponents);
            dataPoint.AttachHref(chart, dataPoint.Faces.Visual, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
            //dataPoint.AttachHref(chart, dataPoint.Faces.VisualComponents, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
            dataPoint.SetCursor2DataPointVisualFaces();
            chart._toolTip.Hide();
        }
开发者ID:zhangzy0193,项目名称:visifire,代码行数:101,代码来源:ColumnChart.cs

示例9: CreateLabel

        /// <summary>
        /// Returns label for DataPoint
        /// </summary>
        /// <param name="chart"></param>
        /// <param name="columnParams"></param>
        /// <param name="dataPoint"></param>
        /// <param name="canvasLeft"></param>
        /// <param name="canvasTop"></param>
        /// <returns></returns>
        private static void CreateLabel(Chart chart, Size columnVisualSize, Boolean isPositive, Boolean isTopOfStack, DataPoint dataPoint, Double canvasLeft, Double canvasTop, ref Canvas labelCanvas)
        {
            if (dataPoint.Faces == null)
                return;          

            if ((Boolean)dataPoint.LabelEnabled && !String.IsNullOrEmpty(dataPoint.LabelText))
            {
                LabelStyles autoLabelStyle = (LabelStyles)dataPoint.LabelStyle;

                if (isPositive || dataPoint.YValue == 0)
                    isPositive = true;

                // Calculate proper position for Canvas top
                if (isPositive)
                    canvasTop -= 6;
                else
                    canvasTop -= 8;

                Double angle = 0;

                Title tb = new Title()
                {   
                    Text = dataPoint.TextParser(dataPoint.LabelText),
                    InternalFontFamily = dataPoint.LabelFontFamily,
                    InternalFontSize = dataPoint.LabelFontSize.Value,
                    InternalFontWeight = (FontWeight)dataPoint.LabelFontWeight,
                    InternalFontStyle = (FontStyle)dataPoint.LabelFontStyle,
                    InternalBackground = dataPoint.LabelBackground,
                    InternalFontColor = Chart.CalculateDataPointLabelFontColor(dataPoint.Chart as Chart, dataPoint, dataPoint.LabelFontColor, autoLabelStyle),
                    Padding = new Thickness(0.1, 0.1, 0.1, 0.1),
                    Tag = new ElementData() { Element = dataPoint }
                };

                tb.CreateVisualObject(new ElementData() { Element = dataPoint });

                Double labelLeft = 0;
                Double labelTop = 0;
                Double outsideGap = 4;
                Double insideGap = 6;

                if (Double.IsNaN(dataPoint.LabelAngle) || dataPoint.LabelAngle == 0)
                {
                    Boolean isVertical = false;
                    if (columnVisualSize.Width < tb.TextBlockDesiredSize.Width)
                    {
                        tb.Visual.RenderTransformOrigin = new Point(0, 0.5);
                        tb.Visual.RenderTransform = new RotateTransform()
                        {
                            CenterX = 0,
                            CenterY = 0,
                            Angle = -90
                        };

                        isVertical = true;
                    }
                    else
                        isVertical = false;

                    if (!dataPoint.IsLabelStyleSet && !dataPoint.Parent.IsLabelStyleSet && !isTopOfStack && dataPoint.Parent.RenderAs != RenderAs.Column)
                    {
                        autoLabelStyle = LabelStyles.Inside;
                    }

                    if (dataPoint.Parent.RenderAs == RenderAs.StackedColumn100 && chart.View3D
                        && isTopOfStack)
                    {
                        if (!dataPoint.IsLabelStyleSet && !dataPoint.Parent.IsLabelStyleSet && !isVertical && tb.TextBlockDesiredSize.Height >= columnVisualSize.Height)
                            autoLabelStyle = LabelStyles.OutSide;
                    }

                    CalculateAutoPlacement(chart.View3D, dataPoint, columnVisualSize, isPositive, autoLabelStyle, ref labelLeft, ref labelTop, ref angle,
                        canvasLeft, canvasTop, isVertical, insideGap, outsideGap, tb, isTopOfStack);

                    tb.Visual.SetValue(Canvas.LeftProperty, labelLeft);
                    tb.Visual.SetValue(Canvas.TopProperty, labelTop);

                    tb.Visual.RenderTransformOrigin = new Point(0, 0.5);
                    tb.Visual.RenderTransform = new RotateTransform()
                    {
                        CenterX = 0,
                        CenterY = 0,
                        Angle = angle
                    };
                    
                    Double depth3D = chart.ChartArea.PLANK_DEPTH / chart.PlotDetails.Layer3DCount * (chart.View3D ? 1 : 0);

                    if (!dataPoint.IsLabelStyleSet && !dataPoint.Parent.IsLabelStyleSet)
                    {
                        if (isPositive)
                        {   
                            if (isVertical)
//.........这里部分代码省略.........
开发者ID:zhangzy0193,项目名称:visifire,代码行数:101,代码来源:ColumnChart.cs

示例10: GetMarkerForDataPoint

        /// <summary>
        /// Get Marker for DataPoint
        /// </summary>
        /// <param name="chart">Chart</param>
        /// <param name="dataPoint">DataPoint</param>
        /// <param name="position">position of the marker</param>
        /// <param name="isPositive">Whether DataPoint Value is positive or negative</param>
        /// <returns>Marker</returns>
        internal static Marker GetMarkerForDataPoint(Chart chart, Double height, Boolean isTopOfStack, DataPoint dataPoint, Double position, bool isPositive)
        {
            if ((Boolean)dataPoint.MarkerEnabled || (Boolean)dataPoint.LabelEnabled)
            {
                Size markerSize = (Boolean)dataPoint.MarkerEnabled ? new Size((Double)dataPoint.MarkerSize, (Double)dataPoint.MarkerSize) : new Size(0, 0);
                String labelText = (Boolean)dataPoint.LabelEnabled ? dataPoint.TextParser(dataPoint.LabelText) : "";

                dataPoint.Marker = CreateNewMarker(chart, dataPoint, markerSize, labelText);

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

                        if (isPositive)
                        {
                            dataPoint.Marker.TextAlignmentX = AlignmentX.Center;
                            dataPoint.Marker.TextAlignmentY = AlignmentY.Top;
                        }
                        else
                        {
                            dataPoint.Marker.TextAlignmentX = AlignmentX.Center;
                            dataPoint.Marker.TextAlignmentY = AlignmentY.Bottom;
                        }

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

                    dataPoint.Marker.CreateVisual();

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

                        if (isPositive)
                        {
                            if (dataPoint.LabelStyle == LabelStyles.OutSide && !dataPoint.IsLabelStyleSet && !dataPoint.Parent.IsLabelStyleSet)
                            {
                                if (!isTopOfStack)
                                {
                                    if (position + dataPoint.Marker.TextBlockSize.Height > height)
                                        dataPoint.Marker.TextAlignmentY = AlignmentY.Top;
                                    else
                                        dataPoint.Marker.TextAlignmentY = AlignmentY.Bottom;
                                }
                                else
                                {
                                    //if (position < dataPoint.Marker.MarkerActualSize.Height || dataPoint.LabelStyle == LabelStyles.Inside)
                                    if (position - dataPoint.Marker.MarkerActualSize.Height - dataPoint.Marker.MarkerSize.Height / 2 < 0 || dataPoint.LabelStyle == LabelStyles.Inside)
                                        dataPoint.Marker.TextAlignmentY = AlignmentY.Bottom;
                                    else
                                        dataPoint.Marker.TextAlignmentY = AlignmentY.Top;
                                }
                            }
                            else if (dataPoint.LabelStyle == LabelStyles.OutSide)
                                dataPoint.Marker.TextAlignmentY = AlignmentY.Top;
                            else
                                dataPoint.Marker.TextAlignmentY = AlignmentY.Bottom;
                        }
                        else
                        {
                            if (dataPoint.LabelStyle == LabelStyles.OutSide && !dataPoint.IsLabelStyleSet && !dataPoint.Parent.IsLabelStyleSet)
                            {
                                if (!isTopOfStack)
                                    dataPoint.Marker.TextAlignmentY = AlignmentY.Top;
                                else
                                {
                                    if (position + dataPoint.Marker.MarkerActualSize.Height + dataPoint.Marker.MarkerSize.Height / 2 > chart.PlotArea.BorderElement.Height || dataPoint.LabelStyle == LabelStyles.Inside)
                                        dataPoint.Marker.TextAlignmentY = AlignmentY.Top;
                                    else
                                        dataPoint.Marker.TextAlignmentY = AlignmentY.Bottom;
                                }
                            }
                            else if (dataPoint.LabelStyle == LabelStyles.OutSide)
                                dataPoint.Marker.TextAlignmentY = AlignmentY.Bottom;
                            else
                                dataPoint.Marker.TextAlignmentY = AlignmentY.Top;
                        }

                    }
                }

                dataPoint.Marker.CreateVisual();

                return dataPoint.Marker;
            }

            return null;
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:99,代码来源:AreaChart.cs

示例11: CreateOrUpdateAStockDataPoint

        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);
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:67,代码来源:StockChart.cs

示例12: UpdateDataPoint


//.........这里部分代码省略.........
                    break;

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

                case VcProperties.LabelStyle:
                    LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref labelCanvas, out xPosition, out yPosition);
                    break;

                case VcProperties.LabelText:
                    LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref labelCanvas, out xPosition, out yPosition);
                    //marker.Text = dataPoint.TextParser(dataPoint.LabelText);
                    break;

                case VcProperties.LabelAngle:
                    LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref labelCanvas, out xPosition, out yPosition);
                    //marker.Text = dataPoint.TextParser(dataPoint.LabelText);
                    break;

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

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

                    //marker.BorderColor = dataPoint.MarkerBorderColor;
                    break;
                case VcProperties.MarkerBorderThickness:
                    LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref labelCanvas, 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 labelCanvas, 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 labelCanvas, out xPosition, out yPosition);
                    break;

              

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

                case VcProperties.ToolTipText:
                case VcProperties.XValueFormatString:
                case VcProperties.YValueFormatString:
                    dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                    LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref labelCanvas, out xPosition, out yPosition);
                    break;

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

                case VcProperties.Enabled:
                    UpdateDataSeries(dataSeries, property, newValue);
                    break;

                case VcProperties.XValue:
                    UpdateDataSeries(dataSeries, property, newValue);
                    break;

                case VcProperties.YValue:

                    if (isAxisChanged || dataPoint._oldYValue > 0 && dataPoint.InternalYValue < 0 || dataPoint._oldYValue < 0 && dataPoint.InternalYValue > 0)
                        UpdateDataSeries(dataSeries, property, newValue);
                    else
                    {
                        dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
                        UpdateVisualForYValue4AreaChart(chart, dataPoint, isAxisChanged);
                        //chart.Dispatcher.BeginInvoke(new Action<Chart, DataPoint, Boolean>(UpdateVisualForYValue4AreaChart), new object[] { chart, dataPoint, isAxisChanged});

                    }

                    chart._toolTip.Hide();
                    // chart.Dispatcher.BeginInvoke(new Action<DataPoint>(UpdateXAndYValue), new object[]{dataPoint});

                    break;
            }
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:101,代码来源:AreaChart.cs

示例13: UpdateXAndYValue


//.........这里部分代码省略.........
                    Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Top)"));
                    Storyboard.SetTargetName(da, (String)marker.GetValue(FrameworkElement.NameProperty));

                    storyBorad.Children.Add(da);
                }

                #endregion

                #region Attach Animation with Label

                FrameworkElement label = dataPoint.LabelVisual;

                if (label != null)
                {
                    // Animation for (Canvas.Top) property
                    DoubleAnimation da = new DoubleAnimation()
                    {
                        From = dataPoint._oldLabelPosition.X,
                        To = newLabelPosition.X,
                        Duration = new Duration(new TimeSpan(0, 0, 1)),
                        SpeedRatio = 2
                    };

                    Storyboard.SetTarget(da, label);
                    Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Left)"));
                    Storyboard.SetTargetName(da, (String)label.GetValue(FrameworkElement.NameProperty));

                    storyBorad.Children.Add(da);

                    // Animation for (Canvas.Top) property
                    da = new DoubleAnimation()
                    {
                        From = dataPoint._oldLabelPosition.Y,
                        To = newLabelPosition.Y,
                        Duration = new Duration(new TimeSpan(0, 0, 1)),
                        SpeedRatio = 2
                    };

                    Storyboard.SetTarget(da, label);
                    Storyboard.SetTargetProperty(da, new PropertyPath("(Canvas.Top)"));
                    Storyboard.SetTargetName(da, (String)label.GetValue(FrameworkElement.NameProperty));

                    storyBorad.Children.Add(da);

                }

                #endregion

                dataPoint.Storyboard = storyBorad;
#if WPF
                if (lineSeg != null)
                    (target as LineSegment).BeginAnimation(LineSegment.PointProperty, pointAnimation);
                else
                    (target as PathFigure).BeginAnimation(PathFigure.StartPointProperty, pointAnimation);
#endif
                // Start the animation
                storyBorad.Begin();
            }

            //chart.ChartArea.ChartVisualCanvas.Background = new SolidColorBrush(Colors.Blue);
            dataSeries.Faces.Visual.Width = chart.ChartArea.ChartVisualCanvas.Width;
            dataSeries.Faces.Visual.Height = chart.ChartArea.ChartVisualCanvas.Height;

            dataSeries.Faces.LabelCanvas.Width = chart.ChartArea.ChartVisualCanvas.Width;
            dataSeries.Faces.LabelCanvas.Height = chart.ChartArea.ChartVisualCanvas.Height;

            // Update ToolTip Text
            dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
            
            if(dataSeries._movingMarker != null)
                dataSeries._movingMarker.Visibility = Visibility.Collapsed;
            
            chart._toolTip.Hide();

            if (dataSeries.Faces != null)
            {
                RectangleGeometry clipRectangle = new RectangleGeometry();

                Double depth3d = chart.ChartArea.PLANK_DEPTH / (chart.PlotDetails.Layer3DCount == 0 ? 1 : chart.PlotDetails.Layer3DCount) * (chart.View3D ? 1 : 0);

                Double clipLeft = 0;
                Double clipTop = -depth3d - 4;
                Double clipWidth = width + depth3d;
                Double clipHeight = height + depth3d + chart.ChartArea.PLANK_THICKNESS + 10;

                AreaChart.GetClipCoordinates(chart, ref clipLeft, ref clipTop, ref clipWidth, ref clipHeight, dataSeries.PlotGroup.MinimumX, dataSeries.PlotGroup.MaximumX);

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

                if (dataSeries.Faces.LabelCanvas != null && dataSeries.Faces.LabelCanvas.Parent != null)
                    (dataSeries.Faces.LabelCanvas.Parent as Canvas).Clip = clipRectangle;

                clipRectangle = new RectangleGeometry();
                clipRectangle.Rect = new Rect(0, -depth3d - 4, width + depth3d, height + chart.ChartArea.PLANK_DEPTH + chart.ChartArea.PLANK_THICKNESS + 10);

                if (dataSeries.Faces.Visual != null)
                    (dataSeries.Faces.Visual.Parent as Canvas).Clip = clipRectangle;
            }

        }
开发者ID:tdhieu,项目名称:openvss,代码行数:101,代码来源:LineChart.cs

示例14: CreateLabelForDataPoint

        /// <summary>
        /// Create labels for DataPoint
        /// </summary>
        /// <param name="dataPoint">DataPoint</param>
        /// <returns>Border</returns>
        private static Border CreateLabelForDataPoint(DataPoint dataPoint, Int32 sliceIndex)
        {
            Title title = new Title()
            {
                IsNotificationEnable = false,
                Chart = dataPoint.Chart,
                Text = dataPoint.TextParser(dataPoint.LabelText),
                InternalFontSize = (Double)dataPoint.LabelFontSize,
                InternalFontColor = Chart.CalculateDataPointLabelFontColor(dataPoint.Chart as Chart, dataPoint, dataPoint.LabelFontColor, (LabelStyles)dataPoint.LabelStyle),
                InternalFontFamily = dataPoint.LabelFontFamily,
                InternalFontStyle = (FontStyle)dataPoint.LabelFontStyle,
                InternalFontWeight = (FontWeight)dataPoint.LabelFontWeight,
                InternalBackground = dataPoint.LabelBackground
            };

            title.CreateVisualObject(new ElementData() { Element = dataPoint });

            if (!(Boolean)dataPoint.LabelEnabled)
                title.Visual.Visibility = Visibility.Collapsed;

            return title.Visual;
        }
开发者ID:zhangzy0193,项目名称:visifire,代码行数:27,代码来源:PyramidChart.cs

示例15: CreateLabel

        /// <summary>
        /// Returns label for DataPoint
        /// </summary>
        /// <param name="chart"></param>
        /// <param name="barParams"></param>
        /// <param name="dataPoint"></param>
        /// <param name="canvasLeft"></param>
        /// <param name="canvasTop"></param>
        /// <param name="canvasRight"></param>
        /// <returns></returns>
        private static void CreateLabel(Chart chart, Size barVisualSize, Boolean isPositive, Boolean isTopOfStack, DataPoint dataPoint,
            Double canvasLeft, Double canvasTop, Double canvasRight, Canvas labelCanvas)
        {
            if (dataPoint.Faces == null)
                return;

            LabelStyles autoLabelStyle = (LabelStyles)dataPoint.LabelStyle;

            if (isPositive || dataPoint.YValue == 0)
                isPositive = true;

            // Calculate proper position for Canvas top
            canvasTop -= 7;

            Double angle = 0;

            if ((Boolean)dataPoint.LabelEnabled && !String.IsNullOrEmpty(dataPoint.LabelText))
            {
                Title tb = new Title()
                {
                    Text = dataPoint.TextParser(dataPoint.LabelText),
                    InternalFontFamily = dataPoint.LabelFontFamily,
                    InternalFontSize = dataPoint.LabelFontSize.Value,
                    InternalFontWeight = (FontWeight)dataPoint.LabelFontWeight,
                    InternalFontStyle = (FontStyle)dataPoint.LabelFontStyle,
                    InternalBackground = dataPoint.LabelBackground,
                    InternalFontColor = Chart.CalculateDataPointLabelFontColor(dataPoint.Chart as Chart, dataPoint, dataPoint.LabelFontColor, autoLabelStyle),
                    Tag = new ElementData() { Element = dataPoint }

                };

                tb.CreateVisualObject(new ElementData() { Element = dataPoint });

                Double labelTop = 0;
                Double labelLeft = 0;

                Double outsideGap = (chart.View3D ? 5 : 3);
                Double insideGap = (chart.View3D ? 4 : 3);

                if (Double.IsNaN(dataPoint.LabelAngle) || dataPoint.LabelAngle == 0)
                {
                    Boolean isVertical = false;

                    if (!dataPoint.IsLabelStyleSet && !dataPoint.Parent.IsLabelStyleSet && !isTopOfStack && dataPoint.Parent.RenderAs != RenderAs.Bar)
                    {
                        autoLabelStyle = LabelStyles.Inside;
                    }

                    CalculateAutoPlacement(chart.View3D, dataPoint, barVisualSize, isPositive, autoLabelStyle, ref labelLeft, ref labelTop, ref angle,
                        canvasLeft, canvasTop, canvasRight, isVertical, insideGap, outsideGap, tb);

                    tb.Visual.SetValue(Canvas.LeftProperty, labelLeft);
                    tb.Visual.SetValue(Canvas.TopProperty, labelTop);

                    tb.Visual.RenderTransformOrigin = new Point(0, 0.5);
                    tb.Visual.RenderTransform = new RotateTransform()
                    {
                        CenterX = 0,
                        CenterY = 0,
                        Angle = angle
                    };

                    if (!dataPoint.IsLabelStyleSet && !dataPoint.Parent.IsLabelStyleSet)
                    {
                        if (isPositive)
                        {
                            if (labelLeft + tb.TextBlockDesiredSize.Width > chart.PlotArea.BorderElement.Width)
                                autoLabelStyle = LabelStyles.Inside;
                        }
                        else
                        {
                            if (labelLeft < 0)
                                autoLabelStyle = LabelStyles.Inside;
                        }
                    }

                    if (autoLabelStyle != dataPoint.LabelStyle)
                    {
                        CalculateAutoPlacement(chart.View3D, dataPoint, barVisualSize, isPositive, autoLabelStyle, ref labelLeft, ref labelTop, ref angle,
                        canvasLeft, canvasTop, canvasRight, isVertical, insideGap, outsideGap, tb);

                        tb.Visual.SetValue(Canvas.LeftProperty, labelLeft);
                        tb.Visual.SetValue(Canvas.TopProperty, labelTop);
                    }

                    if (chart.SmartLabelEnabled)
                    {
                        if (dataPoint.Parent.RenderAs == RenderAs.StackedBar || dataPoint.Parent.RenderAs == RenderAs.StackedBar100)
                        {
                            if (!isVertical)
//.........这里部分代码省略.........
开发者ID:zhangzy0193,项目名称:visifire,代码行数:101,代码来源:BarChart.cs


注:本文中的Visifire.Charts.DataPoint.TextParser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。