我尝试在c#的excel图表中创建辅助轴。我试试这段代码 -
Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing);
Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 300, 250);
Excel.Chart chartPage = myChart.Chart;
chartRange = xlWorkSheet.get_Range("C2", GetLetterFromNum(columns.Length - 1 + Convert.ToInt32(NumCust.Text)) + Convert.ToString(rowIndex));
TimeRange = xlWorkSheet.get_Range("A2", "A" + Convert.ToString(rowIndex));
SecondryRange = xlWorkSheet.get_Range("B2", "B" + Convert.ToString(rowIndex));
chartPage.SetSourceData(chartRange, misValue);
chartPage.SeriesCollection(1).XValues = TimeRange;
chartPage.SeriesCollection(1).YAxisType = AxisType.Primary;
chartPage.SeriesCollection(1).YAxisType = AxisType.Secondary;
但是压缩层无法识别“AxisType”命令, 但我总是收到错误信息
当前上下文中不存在名称“AxisType”
我找不到我做错的事情......