本文整理汇总了C#中Visifire.Charts.DataPoint.SetCursor2DataPointVisualFaces方法的典型用法代码示例。如果您正苦于以下问题:C# DataPoint.SetCursor2DataPointVisualFaces方法的具体用法?C# DataPoint.SetCursor2DataPointVisualFaces怎么用?C# DataPoint.SetCursor2DataPointVisualFaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Visifire.Charts.DataPoint
的用法示例。
在下文中一共展示了DataPoint.SetCursor2DataPointVisualFaces方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateDataPoint
private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue)
{
if (property != VcProperties.Enabled)
{
if (dataPoint.Parent.Enabled == false || (Boolean)dataPoint.Enabled == false)
{
return;
}
}
Chart chart = dataPoint.Chart as Chart;
if (chart == null)
return;
Marker marker = dataPoint.Marker;
DataSeries dataSeries = dataPoint.Parent;
PlotGroup plotGroup = dataSeries.PlotGroup;
Double height = chart.ChartArea.ChartVisualCanvas.Height;
Double width = chart.ChartArea.ChartVisualCanvas.Width;
Double xPosition, yPosition;
Canvas line2dLabelCanvas = null;
xPosition = Graphics.ValueToPixelPosition(0, width, (Double)plotGroup.AxisX.InternalAxisMinimum, (Double)plotGroup.AxisX.InternalAxisMaximum, dataPoint.InternalXValue);
yPosition = Graphics.ValueToPixelPosition(height, 0, (Double)plotGroup.AxisY.InternalAxisMinimum, (Double)plotGroup.AxisY.InternalAxisMaximum, dataPoint.InternalYValue);
if (dataSeries.Faces != null)
{
line2dLabelCanvas = dataSeries.Faces.LabelCanvas as Canvas;
ColumnChart.UpdateParentVisualCanvasSize(chart, line2dLabelCanvas);
}
switch (property)
{
case VcProperties.Color:
if (marker != null && (Boolean)dataPoint.MarkerEnabled)
marker.BorderColor = (dataPoint.GetValue(DataPoint.MarkerBorderColorProperty) as Brush == null) ? ((newValue != null) ? newValue as Brush : dataPoint.MarkerBorderColor) : dataPoint.MarkerBorderColor;
break;
case VcProperties.Cursor:
dataPoint.SetCursor2DataPointVisualFaces();
break;
case VcProperties.Href:
case VcProperties.HrefTarget:
dataPoint.SetHref2DataPointVisualFaces();
break;
case VcProperties.LabelBackground:
//if (marker != null)
// marker.TextBackground = dataPoint.LabelBackground;
CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
ref line2dLabelCanvas, true);
break;
case VcProperties.LabelEnabled:
//if (marker.LabelEnabled == false)
//CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
//else
// marker.LabelEnabled = (Boolean)dataPoint.LabelEnabled;
CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
ref line2dLabelCanvas, true);
break;
case VcProperties.LabelFontColor:
//if (marker != null)
// marker.FontColor = dataPoint.LabelFontColor;
CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
ref line2dLabelCanvas, true);
break;
case VcProperties.LabelFontFamily:
//CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
ref line2dLabelCanvas, true);
// marker.FontFamily = dataPoint.LabelFontFamily;
break;
case VcProperties.LabelFontStyle:
//CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
ref line2dLabelCanvas, true);
//marker.FontStyle = (FontStyle) dataPoint.LabelFontStyle;
break;
case VcProperties.LabelFontSize:
//CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
ref line2dLabelCanvas, true);
// marker.FontSize = (Double) dataPoint.LabelFontSize;
break;
case VcProperties.LabelFontWeight:
//if (marker != null)
// marker.FontWeight = (FontWeight) dataPoint.LabelFontWeight;
CreateLabel4LineDataPoint(dataPoint, width, height, dataPoint.InternalYValue >= 0, xPosition, yPosition,
ref line2dLabelCanvas, true);
break;
case VcProperties.LabelStyle:
//CreateMarkerAForLineDataPoint(dataPoint, width, height, ref line2dLabelCanvas, out xPosition, out yPosition);
//.........这里部分代码省略.........
示例2: 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();
}
示例3: 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);
}
示例4: GetMarkerForDataPoint
//.........这里部分代码省略.........
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)
{
dataPoint.Marker.TextAlignmentX = AlignmentX.Center;
if (isPositive)
{
if (dataPoint.LabelStyle == LabelStyles.OutSide && !dataPoint.IsLabelStyleSet && !dataPoint.Parent.IsLabelStyleSet)
{
//if (position < dataPoint.Marker.MarkerActualSize.Height || dataPoint.LabelStyle == LabelStyles.Inside)
if (yPosition - 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 (yPosition + 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.Control = chart;
dataPoint.Marker.Tag = new ElementData() { Element = dataPoint };
dataPoint.Marker.CreateVisual();
dataPoint.Marker.Visual.Opacity = (Double)dataPoint.Opacity * (Double)dataPoint.Parent.Opacity;
ApplyDefaultInteractivityForMarker(dataPoint);
//dataPoint.AttachEvent2DataPointVisualFaces(dataPoint);
ObservableObject.AttachEvents2Visual(dataPoint, dataPoint, dataPoint.Marker.Visual);
//dataPoint.AttachEvent2DataPointVisualFaces(dataPoint.Parent);
ObservableObject.AttachEvents2Visual(dataPoint.Parent, dataPoint, dataPoint.Marker.Visual);
dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
if(!chart.IndicatorEnabled)
dataPoint.AttachToolTip(chart, dataPoint, dataPoint.Marker.Visual);
dataPoint.AttachHref(chart, dataPoint.Marker.Visual, dataPoint.Href, (HrefTargets)dataPoint.HrefTarget);
dataPoint.SetCursor2DataPointVisualFaces();
return dataPoint.Marker;
}
示例5: GetMarkerForDataPoint
/// <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;
}
示例6: 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();
}
示例7: 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();
}
示例8: 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);
}
示例9: UpdateDataPoint
private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue, Boolean isAxisChanged)
{
Chart chart = dataPoint.Chart as Chart;
DataSeries dataSeries = dataPoint.Parent;
PlotGroup plotGroup = dataSeries.PlotGroup;
Faces dsFaces = dataSeries.Faces;
Faces dpFaces = dataPoint.Faces;
Double dataPointWidth;
if (dsFaces != null)
ColumnChart.UpdateParentVisualCanvasSize(chart, dsFaces.Visual as Canvas);
if (dpFaces != null && dpFaces.Visual != null)
dataPointWidth = dpFaces.Visual.Width;
else if (dsFaces == null)
return;
else
dataPointWidth = CalculateDataPointWidth(dsFaces.Visual.Width, dsFaces.Visual.Height, chart);
switch (property)
{
case VcProperties.BorderThickness:
ApplyOrUpdateBorder(dataPoint, dataPointWidth);
ApplyOrRemoveBevel(dataPoint, dataPointWidth);
break;
case VcProperties.BorderStyle:
ApplyOrUpdateBorder(dataPoint, dataPointWidth);
break;
case VcProperties.BorderColor:
ApplyOrUpdateBorder(dataPoint, dataPointWidth);
break;
case VcProperties.Bevel:
ApplyOrRemoveBevel(dataPoint, dataPointWidth);
break;
case VcProperties.Color:
case VcProperties.PriceUpColor:
case VcProperties.PriceDownColor:
ApplyOrUpdateColorForACandleStick(dataPoint);
break;
case VcProperties.Cursor:
dataPoint.SetCursor2DataPointVisualFaces();
break;
case VcProperties.Href:
dataPoint.SetHref2DataPointVisualFaces();
break;
case VcProperties.HrefTarget:
dataPoint.SetHref2DataPointVisualFaces();
break;
case VcProperties.LabelBackground:
case VcProperties.LabelEnabled:
case VcProperties.LabelFontColor:
case VcProperties.LabelFontFamily:
case VcProperties.LabelFontStyle:
case VcProperties.LabelFontSize:
case VcProperties.LabelFontWeight:
case VcProperties.LabelStyle:
case VcProperties.LabelText:
CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
break;
case VcProperties.LegendText:
chart.InvokeRender();
break;
case VcProperties.LightingEnabled:
ApplyOrUpdateColorForACandleStick(dataPoint);
break;
//case VcProperties.MarkerBorderColor:
//case VcProperties.MarkerBorderThickness:
//case VcProperties.MarkerColor:
//case VcProperties.MarkerEnabled:
//case VcProperties.MarkerScale:
//case VcProperties.MarkerSize:
//case VcProperties.MarkerType:
case VcProperties.ShadowEnabled:
ApplyOrRemoveShadow(dataPoint, dataPointWidth);
break;
case VcProperties.Opacity:
dpFaces.Visual.Opacity = dataSeries.Opacity * dataPoint.Opacity;
break;
case VcProperties.ShowInLegend:
chart.InvokeRender();
break;
case VcProperties.ToolTipText:
dataPoint._parsedToolTipText = dataPoint.TextParser(dataPoint.ToolTipText);
break;
case VcProperties.XValueFormatString:
//.........这里部分代码省略.........
示例10: 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();
}
示例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);
}
示例12: UpdateDataPoint
//.........这里部分代码省略.........
(dataPoint.Faces.Area3DLeftFace.LeftFace as Path).Opacity = opacity;
if (dataPoint.Faces.Area3DRightTopFace != null)
(dataPoint.Faces.Area3DRightTopFace.TopFace as Path).Opacity = opacity;
if (dataPoint.Faces.Area3DLeftTopFace != null)
(dataPoint.Faces.Area3DLeftTopFace.TopFace as Path).Opacity = opacity;
if (dataPoint.Faces.Area3DRightFace != null)
(dataPoint.Faces.Area3DRightFace.RightFace as Path).Opacity = opacity;
}
break;
case VcProperties.BorderColor:
case VcProperties.BorderStyle:
case VcProperties.BorderThickness:
if (faces != null)
{
if (dataPoint.Faces.Area3DLeftFace != null)
ApplyBorderProperties(dataPoint.Faces.Area3DLeftFace.LeftFace as Path, dataSeries);
if (dataPoint.Faces.Area3DRightTopFace != null)
ApplyBorderProperties(dataPoint.Faces.Area3DRightTopFace.TopFace as Path, dataSeries);
if (dataPoint.Faces.Area3DLeftTopFace != null)
ApplyBorderProperties(dataPoint.Faces.Area3DLeftTopFace.TopFace as Path, dataSeries);
if (dataPoint.Faces.Area3DRightFace != null)
ApplyBorderProperties(dataPoint.Faces.Area3DRightFace.RightFace as Path, dataSeries);
}
break;
case VcProperties.Cursor:
dataPoint.SetCursor2DataPointVisualFaces();
break;
case VcProperties.Href:
case VcProperties.HrefTarget:
dataPoint.SetHref2DataPointVisualFaces();
break;
case VcProperties.LabelBackground:
LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref labelCanvas, out xPosition, out yPosition);
marker.TextBackground = dataPoint.LabelBackground;
break;
case VcProperties.LabelEnabled:
LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref labelCanvas, out xPosition, out yPosition);
break;
case VcProperties.LabelFontColor:
marker.FontColor = dataPoint.LabelFontColor;
break;
case VcProperties.LabelFontFamily:
LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref labelCanvas, out xPosition, out yPosition);
// marker.FontFamily = dataPoint.LabelFontFamily;
break;
case VcProperties.LabelFontStyle:
LineChart.CreateMarkerAForLineDataPoint(dataPoint, width, height, ref labelCanvas, out xPosition, out yPosition);
//marker.FontStyle = (FontStyle) dataPoint.LabelFontStyle;
break;
case VcProperties.LabelFontSize:
示例13: UpdateDataPoint
private static void UpdateDataPoint(DataPoint dataPoint, VcProperties property, object newValue, Boolean isAxisChanged)
{
Chart chart = dataPoint.Chart as Chart;
if (chart == null)
return;
DataSeries dataSeries = dataPoint.Parent;
PlotGroup plotGroup = dataSeries.PlotGroup;
Faces dsFaces = dataSeries.Faces;
Faces dpFaces = dataPoint.Faces;
Double dataPointWidth;
if (dsFaces != null)
ColumnChart.UpdateParentVisualCanvasSize(chart, dsFaces.Visual as Canvas);
if (dpFaces != null && dpFaces.Visual != null)
dataPointWidth = dpFaces.Visual.Width;
else if (dsFaces == null)
return;
else
dataPointWidth = CandleStick.CalculateDataPointWidth(dsFaces.Visual.Width, dsFaces.Visual.Height, chart);
if (property == VcProperties.Enabled || (dpFaces == null && (property == VcProperties.XValue || property == VcProperties.YValues)))
{
CreateOrUpdateAStockDataPoint(dataPoint, dsFaces.Visual as Canvas, dsFaces.LabelCanvas, dsFaces.Visual.Width, dsFaces.Visual.Height, dataPointWidth);
return;
}
if (dpFaces == null)
return;
Canvas dataPointVisual = dpFaces.Visual as Canvas; // DataPoint visual canvas
Line highLowLine = dpFaces.VisualComponents[0] as Line; // HighLowline
Line closeLine = dpFaces.VisualComponents[1] as Line; // Closeline
Line openLine = dpFaces.VisualComponents[2] as Line; // Openline
switch (property)
{
case VcProperties.BorderThickness:
case VcProperties.BorderStyle:
ApplyBorderProperties(dataPoint, highLowLine, openLine, closeLine, dataPointWidth);
break;
case VcProperties.Color:
ApplyOrUpdateColorForAStockDp(dataPoint, highLowLine, openLine, closeLine);
break;
case VcProperties.Cursor:
dataPoint.SetCursor2DataPointVisualFaces();
break;
case VcProperties.Href:
dataPoint.SetHref2DataPointVisualFaces();
break;
case VcProperties.HrefTarget:
dataPoint.SetHref2DataPointVisualFaces();
break;
case VcProperties.LabelBackground:
case VcProperties.LabelEnabled:
case VcProperties.LabelFontColor:
case VcProperties.LabelFontFamily:
case VcProperties.LabelFontStyle:
case VcProperties.LabelFontSize:
case VcProperties.LabelFontWeight:
case VcProperties.LabelStyle:
case VcProperties.LabelText:
CandleStick.CreateAndPositionLabel(dsFaces.LabelCanvas, dataPoint);
break;
case VcProperties.LegendText:
chart.InvokeRender();
break;
case VcProperties.LightingEnabled:
ApplyOrUpdateColorForAStockDp(dataPoint, highLowLine, openLine, closeLine);
break;
//case VcProperties.MarkerBorderColor:
//case VcProperties.MarkerBorderThickness:
//case VcProperties.MarkerColor:
//case VcProperties.MarkerEnabled:
//case VcProperties.MarkerScale:
//case VcProperties.MarkerSize:
//case VcProperties.MarkerType:
case VcProperties.ShadowEnabled:
ApplyOrUpdateShadow(dataPoint, dataPointVisual, highLowLine, openLine, closeLine, dataPointWidth);
break;
case VcProperties.Opacity:
dpFaces.Visual.Opacity = (Double)dataSeries.Opacity * (Double)dataPoint.Opacity;
break;
case VcProperties.ShowInLegend:
chart.InvokeRender();
break;
//.........这里部分代码省略.........
示例14: 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);
}