03-23-2018 07:53 AM
I am trying to create charts for a program I am making. I create an instance of excel, create 4 worksheets(1 for each unit I am testing) within a single workbook. I write data to each sheet based on which unit I am reading. After the program reaches it end I attempt to create graphs. I create an empty chart and use the chartwizard to format and create the graphs. There are instances when I test less than 4 units and for the sheets that have no unit the graph formatting working fine, but for the sheets that actually have data saved the chart is not formatted at all. Below is my code for creating the graphs.
char ChartRange[100000];
sprintf(ChartRange, "A1:L%d", writeline);
/// REGION START Create Graphs
/// REGION START UUT1
ExcelRpt_SetCellRangeAttribute(UUT1, "A:A", ER_CR_ATTR_NUMBER_FORMAT, "m/d/yyyy h:mm:ss");
FmtOut("# ");
Delay(1);
ExcelRpt_ChartAddtoWorksheet(UUT1,650,1,750,500,&UUT1chart);
FmtOut("# ");
Delay(1);
ExcelRpt_SetChartAttribute(UUT1chart, ER_CH_ATTR_LEGEND_POSITION,-4107);
FmtOut("# ");
Delay(1);
ExcelRpt_SetChartAttribute(UUT1chart, ER_CH_ATTR_CHART_SIZE_WITH_WINDOW,1);
FmtOut("# ");
Delay(1);
ExcelRpt_ChartWizard(UUT1chart,UUT1,ChartRange,ExRConst_XYScatterLinesNoMarkers,0,0,1,1,1,SerNo[0],NULL,NULL,NULL);
FmtOut("# ");
/// REGION END
NOTE: the delays were an attempt to give CVI time to format everything properly.
NOTE: if I put a break point on the ChartWizard line the graph is made fine.
03-26-2018 05:29 PM
Hi!
Did you try to use the example that is call excelreportdemo.cws? you can find it if you go to help, find the example and type excel.
04-06-2018 09:11 AM
I was able to get chartwizard working and then when i made some unrelated updates to my code it stopped working. I am just making the graphs and formatting them line by line.
04-09-2018 09:49 AM
Hi!
So, did you try the example code and modify it for your needs?
What updates did you make?