本文整理汇总了C#中Chart.Location方法的典型用法代码示例。如果您正苦于以下问题:C# Chart.Location方法的具体用法?C# Chart.Location怎么用?C# Chart.Location使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chart
的用法示例。
在下文中一共展示了Chart.Location方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetAxiesStyle
/// <summary>
/// 设置柱状图样式
/// </summary>
/// <param name="chart">需要设置的图表</param>
/// <param name="endRow">行数</param>
public void SetAxiesStyle(Chart chart, int endRow, float chartWidth)
{
//设置柱状图的样式
chart.AutoScaling = true;
chart.Elevation = 15;
chart.Rotation = 20;
chart.RightAngleAxes = true;
chart.HeightPercent = 100;
chart.ChartArea.Font.Size = 10;
//设置X轴标签的样式
Axis axis = (Axis)chart.Axes(Microsoft.Office.Interop.Excel.XlAxisType.xlCategory, Microsoft.Office.Interop.Excel.XlAxisGroup.xlPrimary);
axis.TickLabelSpacing = 1;
axis.TickMarkSpacing = 1;
axis.TickLabels.Offset = 200;
axis.TickLabels.Orientation = Microsoft.Office.Interop.Excel.XlTickLabelOrientation.xlTickLabelOrientationDownward;
//axis.TickLabels.Orientation = Microsoft.Office.Interop.Excel.XlTickLabelOrientation.xlTickLabelOrientationVertical;
chart.Location(XlChartLocation.xlLocationAsObject, MyworkSheet.Name);
Range oResizeRange = (Range)MyworkSheet.Rows.get_Item(endRow + 2, Missing.Value);
MyworkSheet.Shapes.Item("Chart 1").Top = (float)(double)oResizeRange.Top; //调图表的位置上边距
oResizeRange = (Range)MyworkSheet.Columns.get_Item(6, Missing.Value); //调图表的位置左边距
MyworkSheet.Shapes.Item("Chart 1").Left = 0;
MyworkSheet.Shapes.Item("Chart 1").Width = chartWidth; //调图表的宽度
MyworkSheet.Shapes.Item("Chart 1").Height = 300; //调图表的高度
//MyworkSheet.Shapes.Item("Chart 1").Chart.ChartArea.Width = 600;
}