So, I tried to figure it out for a while, but it seems that they will not go anywhere. I am creating an Excel spreadsheet using C #. My table contains a chart. I can do everything with the EXCEPT diagram to change the X-Axis labels. I tried everything I can find, but nothing works.
Excel.ChartObjects xlChart = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing);
Excel.ChartObject myChart = (Excel.ChartObject)xlChart.Add(1420, 660, 320, 180);
Excel.Chart chartPage = myChart.Chart;
chartPage.ChartType = Excel.XlChartType.xlXYScatterLines;
chartPage.HasTitle = true;
chartPage.ChartTitle.Text = "Title Text";
chartPage.HasLegend = false;
var yAxis = (Excel.Axis)chartPage.Axes(Excel.XlAxisType.xlValue,Excel.XlAxisGroup.xlPrimary);
yAxis.HasTitle = true;
yAxis.AxisTitle.Text = "Y-Axis Title text";
yAxis.MaximumScale = 20;
yAxis.AxisTitle.Orientation = Excel.XlOrientation.xlUpward;
Excel.Range Data_Range = xlWorkSheet.get_Range("A10", "C10");
Excel.Range XVal_Range = xlWorkSheet.get_Range("A1", "C1");
var x_labels = new List<string>() { "Val1", "Val2", "Val3" };
Excel.SeriesCollection oSeriesCollection = (Excel.SeriesCollection)myChart.Chart.SeriesCollection(misValue);
Excel.Series Data = oSeriesCollection.NewSeries();
Data.Values = Data_Range;
Data.Name = "Plot Data";
Excel.Axis valueAxis = (Excel.Axis)chartPage.Axes(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary);
every time it just displays with default numbers ... I'm at a loss
source
share