本文整理汇总了C#中Microsoft.Office.Interop.Visio.DrawPolyline方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Visio.DrawPolyline方法的具体用法?C# Microsoft.Office.Interop.Visio.DrawPolyline怎么用?C# Microsoft.Office.Interop.Visio.DrawPolyline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Office.Interop.Visio
的用法示例。
在下文中一共展示了Microsoft.Office.Interop.Visio.DrawPolyline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public void Render(IVisio.Page page)
{
this.TotalMarginWidth = this.Rectangle.Width*(0.10);
int num_points = this.DataPoints.Count;
double bar_spacing = num_points > 1 ? (this.Rectangle.Width-this.TotalBarWidth)/num_points : 0.0;
// Calculate min & max which will be used many times later
double max = this.DataPoints.Select(i => i.Value).Max();
double min = this.DataPoints.Select(i => i.Value).Min();
var range = ChartUtil.GetValueRangeDistance(min, max);
// Determine the leftmost part of the drawing area
double base_x = this.Rectangle.Left + (this.TotalMarginWidth / 2.0);
// Determine the baseline height a.k.a the y axis location
double base_y = this.Rectangle.Bottom;
if (min < 0.0)
{
// if the min value is negative then we have to "raise" the baseline to accomodate it
base_y += System.Math.Abs(this.Rectangle.Height * (min / range));
}
var category_axis_start_point = new Drawing.Point(this.Rectangle.Left, base_y);
var category_axis_end_point = new Drawing.Point(this.Rectangle.Right, base_y);
var category_axis_shape = page.DrawLine(category_axis_start_point, category_axis_end_point);
double cur_x = base_x;
var points = new List<Drawing.Point>();
for (int i = 0; i < this.DataPoints.Count; i++)
{
if (i == 0)
{
points.Add( new Drawing.Point(cur_x,base_y));
}
var p = this.DataPoints[i];
var value_height = System.Math.Abs(this.Rectangle.Height*(p.Value/range));
if (p.Value >= 0.0)
{
points.Add(new Drawing.Point(cur_x, base_y+value_height));
}
else
{
points.Add(new Drawing.Point(cur_x , base_y - value_height));
}
if (i == this.DataPoints.Count - 1)
{
points.Add(new Drawing.Point(cur_x, base_y));
}
cur_x += bar_spacing;
}
points.Add(new Drawing.Point(base_x, base_y));
var area_shape = page.DrawPolyline(points);
var allshapes = this.DataPoints.Select(dp => dp.VisioShape).Where(s => s != null).ToList();
allshapes.Add(category_axis_shape);
ChartUtil.GroupShapesIfNeeded(page, allshapes);
}