本文整理匯總了C#中Chart.Axes方法的典型用法代碼示例。如果您正苦於以下問題:C# Chart.Axes方法的具體用法?C# Chart.Axes怎麽用?C# Chart.Axes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Chart
的用法示例。
在下文中一共展示了Chart.Axes方法的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;
}