Hello,
I have question on Excel chart axis. When I draw chart on X-axis I get values 1,2,3,4,5,etc... But i want to put my own Series from list i have made. And I don't know how, please help me....
The list with my values is:
List<string> Dates = new List<string>();
The code is functional and i get exactly what i want except Values on X-axis. :(
The code is for drawing chart is:
object nemaVr = System.Reflection.Missing.Value; Excel.Application EXL = new Excel.ApplicationClass();
Excel.Workbook WRKBOOK = EXL.Workbooks.Add(nemaVr);
Excel.Worksheet WRKSHT = (Excel.Worksheet)WRKBOOK.Worksheets.get_Item(1); Excel.Range range; Excel.ChartObjects graphs = (Excel.ChartObjects)WRKSHT.ChartObjects(nemaVr); Excel.ChartObject graphIncome = (Excel.ChartObject)grafovi.Add(10, 80, 300, 300); Excel.Chart grafProp = graphIncome.Chart; range = WRKSHT.get_Range("A:A", nemaVr); grafProp.SetSourceData(range, nemaVr); //Data source grafProp.ChartType = Excel.XlChartType.xl3DArea; //Type grafProp.HasTitle = false; //Title? grafPage.ChartTitle.Text = "Prihodi / Troškovi"; //Title Excel.Axis xAxis; //X Axis xAxis = (Excel.Axis)grafPage.Axes(Excel.XlAxisType.xlSeriesAxis, Excel.XlAxisGroup.xlPrimary);
//The unknown code to me (I suppose) should go here WRKBOOK.Close(true, nemaVr, nemaVr); EXL.Quit();