本文整理汇总了C#中Visifire.Charts.DataPoint.AttachToolTip方法的典型用法代码示例。如果您正苦于以下问题:C# DataPoint.AttachToolTip方法的具体用法?C# DataPoint.AttachToolTip怎么用?C# DataPoint.AttachToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Visifire.Charts.DataPoint
的用法示例。
在下文中一共展示了DataPoint.AttachToolTip方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: 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);
}
示例3: 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;
}
示例4: 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;
}
示例5: CreateOrUpdateMarker4HorizontalChart
/// <summary>
/// Returns marker for DataPoint
/// </summary>
/// <param name="chart">Chart</param>
/// <param name="barParams">Bar parameters</param>
/// <param name="dataPoint">DataPoint</param>
/// <param name="left">Left position of MarkerCanvas</param>
/// <param name="top">Top position</param>
/// <returns>Marker canvas</returns>
internal static void CreateOrUpdateMarker4HorizontalChart(Chart chart, Canvas labelCanvas, DataPoint dataPoint, Double left, Double top, Boolean isPositive, Double depth3d)
{
if (dataPoint.Faces == null)
return;
Canvas barVisual = dataPoint.Faces.Visual as Canvas;
ColumnChart.CleanUpMarkerAndLabel(dataPoint, labelCanvas);
if ((Boolean)dataPoint.MarkerEnabled)
{
Size markerSize = new Size(dataPoint.MarkerSize.Value, dataPoint.MarkerSize.Value);
String labelText = "";// (Boolean)dataPoint.LabelEnabled ? dataPoint.TextParser(dataPoint.LabelText) : "";
Marker marker = ColumnChart.CreateNewMarker(dataPoint, markerSize, labelText);
dataPoint.Marker = marker;
if (!(Boolean)dataPoint.MarkerEnabled)
{
marker.MarkerFillColor = Graphics.TRANSPARENT_BRUSH;
marker.BorderColor = Graphics.TRANSPARENT_BRUSH;
}
Point markerPosition = new Point();
if (isPositive)
if (chart.View3D)
markerPosition = new Point(barVisual.Width, barVisual.Height / 2);
else
markerPosition = new Point(barVisual.Width, barVisual.Height / 2);
else
if (chart.View3D)
markerPosition = new Point(0, barVisual.Height / 2);
else
markerPosition = new Point(0, barVisual.Height / 2);
//SetMarkerPosition(chart, dataPoint, isPositive, labelText, markerSize, left, top, markerPosition);
//marker.FontColor = Chart.CalculateDataPointLabelFontColor(chart, dataPoint, dataPoint.LabelFontColor, (dataPoint.YValue == 0) ? LabelStyles.OutSide : (LabelStyles) dataPoint.LabelStyle);
marker.Tag = new ElementData() { Element = dataPoint };
marker.CreateVisual();
marker.AddToParent(labelCanvas, left + markerPosition.X, top + markerPosition.Y, new Point(0.5, 0.5));
if (marker != null && marker.Visual != null && !chart.IndicatorEnabled)
dataPoint.AttachToolTip(chart, dataPoint, marker.Visual);
}
if ((Boolean)dataPoint.LabelEnabled)
{
Double right = left + barVisual.Width;
CreateLabel(chart, new Size(barVisual.Width, barVisual.Height), isPositive, dataPoint.IsTopOfStack, dataPoint, left, top, right, labelCanvas);
if (dataPoint.LabelVisual != null && !chart.IndicatorEnabled)
dataPoint.AttachToolTip(chart, dataPoint, dataPoint.LabelVisual);
}
}
示例6: 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();
}
示例7: 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();
}
示例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: 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();
}
示例10: 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);
}
示例11: 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);
}