本文整理汇总了C#中Visifire.Charts.DataPoint.AttachEvent2DataPointVisualFaces方法的典型用法代码示例。如果您正苦于以下问题:C# DataPoint.AttachEvent2DataPointVisualFaces方法的具体用法?C# DataPoint.AttachEvent2DataPointVisualFaces怎么用?C# DataPoint.AttachEvent2DataPointVisualFaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Visifire.Charts.DataPoint
的用法示例。
在下文中一共展示了DataPoint.AttachEvent2DataPointVisualFaces方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateOrUpdateAPointDataPoint
//.........这里部分代码省略.........
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);
}
示例2: CreateBarDataPointVisual
//.........这里部分代码省略.........
}
Double columnWidth = Math.Abs(left - right);
if (columnWidth < dataPoint.Parent.MinPointHeight)
{
if (dataPoint.InternalYValue == 0)
{
if (plotGroup.AxisY.InternalAxisMaximum <= 0)
left -= (dataPoint.Parent.MinPointHeight - columnWidth);
else
right += (dataPoint.Parent.MinPointHeight - columnWidth);
}
else if (isPositive)
right += (dataPoint.Parent.MinPointHeight - columnWidth);
else
left -= (dataPoint.Parent.MinPointHeight - columnWidth);
columnWidth = dataPoint.Parent.MinPointHeight;
}
Double columnHeight = CalculateHeightOfEachColumn(ref top, heightPerBar, height);
if (columnHeight < 0)
return;
Faces column;
Panel columnVisual = null;
if (chart.View3D)
{
// column = Get3DBar(barParams);
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, GetBarZIndex(left, top, height, dataPoint.InternalYValue > 0));
dataPoint.Faces = column;
if (!VisifireControl.IsMediaEffectsEnabled)
ColumnChart.ApplyOrRemoveShadow4XBAP(dataPoint, false, false);
}
else
{
// column = Get2DBar(barParams);
column = ColumnChart.Get2DColumn(dataPoint, columnWidth, columnHeight, false, false);
columnVisual = column.Visual as Panel;
dataPoint.Faces = column;
}
if (VisifireControl.IsMediaEffectsEnabled)
ApplyOrRemoveShadow(chart, dataPoint);
dataPoint.Faces.LabelCanvas = labelCanvas;
dataPoint.Parent.Faces = new Faces() { Visual = columnCanvas, LabelCanvas = labelCanvas };
columnVisual.SetValue(Canvas.LeftProperty, left);
columnVisual.SetValue(Canvas.TopProperty, top);
columnCanvas.Children.Add(columnVisual);
dataPoint.IsTopOfStack = true;
CreateOrUpdateMarker4HorizontalChart(chart, labelCanvas, dataPoint, left, top, isPositive, depth3d);
if (isPositive)
dataPoint._visualPosition = new Point(right, top + columnHeight / 2);
else
dataPoint._visualPosition = new Point(left, top + columnHeight / 2);
dataPoint.Faces.LabelCanvas = labelCanvas;
// Apply animation
if (animationEnabled)
{
if (dataPoint.Parent.Storyboard == null)
dataPoint.Parent.Storyboard = new Storyboard();
currentDataSeries = dataPoint.Parent;
// Apply animation to the bars
dataPoint.Parent.Storyboard = ApplyBarChartAnimation(columnVisual, dataPoint.Parent.Storyboard, isPositive);
}
dataPoint.Faces.Visual.Opacity = (Double)dataPoint.Opacity * (Double)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);
if(!chart.IndicatorEnabled)
dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Faces.Visual);
dataPoint.AttachHref(chart, dataPoint.Faces.Visual, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
dataPoint.SetCursor2DataPointVisualFaces();
}
示例3: CreateStackedColumnVisual
/// <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();
}
示例4: 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();
}
示例5: CreateOrUpdateACandleStick
/// <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.YValues == 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 = 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);
}
示例6: 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();
}
示例7: 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);
}
示例8: CreateOrUpdateAPointDataPoint
//.........这里部分代码省略.........
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);
}