C# PowerPoint文件中的图表轴

C# PowerPoint文件中的图表轴,c#,charts,powerpoint,gembox-spreadsheet,gembox-presentation,C#,Charts,Powerpoint,Gembox Spreadsheet,Gembox Presentation,我正在使用GemBox.Presentation(连同GemBox.Spreadsheet)在PPTX文件中创建一个图表(属于ComboCharttype)。我正在使用示例中的代码,并添加了示例的一些部分 这就是我到目前为止所做的: var presentation = new PresentationDocument(); var slide = presentation.Slides.AddNew(SlideLayoutType.Custom); var chart = slide.Cont

我正在使用GemBox.Presentation(连同GemBox.Spreadsheet)在PPTX文件中创建一个图表(属于
ComboChart
type)。我正在使用示例中的代码,并添加了示例的一些部分

这就是我到目前为止所做的:

var presentation = new PresentationDocument();
var slide = presentation.Slides.AddNew(SlideLayoutType.Custom);
var chart = slide.Content.AddChart(GemBox.Presentation.ChartType.Combo, 25, 25, 300, 500);
var comboChart = (ComboChart)chart.ExcelChart;
var worksheet = comboChart.Worksheet;

worksheet.Cells["A1"].Value = "Name";
worksheet.Cells["A2"].Value = "John Doe";
worksheet.Cells["A3"].Value = "Fred Nurk";

worksheet.Cells["B1"].Value = "Salary";
worksheet.Cells["B2"].Value = 4023;
worksheet.Cells["B3"].Value = 3263;

worksheet.Cells["C1"].Value = "Max";
worksheet.Cells["C2"].Value = 4500;
worksheet.Cells["C3"].Value = 4300;

worksheet.Cells["D1"].Value = "Min";
worksheet.Cells["D2"].Value = 3000;
worksheet.Cells["D3"].Value = 2800;

comboChart.CategoryLabelsReference = "A2:A3";

var salaryChart = comboChart.Add(GemBox.Spreadsheet.Charts.ChartType.Column);
salaryChart.Series.Add("=B1", "B2:B3");

var minMaxChart = comboChart.Add(GemBox.Spreadsheet.Charts.ChartType.Line);
minMaxChart.Series.Add("=C1", "C2:C3");
minMaxChart.Series.Add("=D1", "D2:D3");

presentation.Save("output.pptx");
这就是我得到的:

现在我的问题是,我找不到任何方法来访问和格式化类别轴和垂直轴

我尝试使用
chart
comboChart
salaryChart
minMaxChart
对象,但它们都没有任何轴属性


比如说,如何设置轴标题?

要设置组合图表的轴,您需要使用其中一个包含图表的轴,因此
salaryChart
minMaxChart

现在,在它们上看不到任何轴属性的原因是它们属于基本类型(
ExcelChart
)。您需要将它们强制转换为派生类型,如下所示:

var salaryChart = (ColumnChart)comboChart.Add(GemBox.Spreadsheet.Charts.ChartType.Column);
salaryChart.Series.Add("=B1", "B2:B3");

salaryChart.Axes.Horizontal.Title.Text = "My Categories";
salaryChart.Axes.Vertical.Title.Text = "My Values";