LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Axis scaling in labwindows for excel graph

I'm plotting an excel scatter graph onto my user interface with activeX controls. I have tried to use the SetChartAxisAttribute function from Excel Report to set the minimum values on the graph and specify the exact type of graph that I want, but the function does not seem to work. Does anyone know why this is happening?
0 Kudos
Message 1 of 8
(5,228 Views)
Hello jlenoach,
 
Thank you for contacting National Instruments. I do not have an answer for this issue yet but I will update the post as soon as I find out more about how to approach the problem.
Regards,
Ben M
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(5,195 Views)

Hello jlenoach,

I have been unable to duplicate the problem.  Can you please post your code or enough of your code to duplicate the problem?

Regards,
Ben M
Applications Engineer
National Instruments
0 Kudos
Message 3 of 8
(5,173 Views)
Ive tried it a bunch of different ways, but here is what I have right now

ExcelRpt_GetWorksheetFromIndex(workbookHandle,1,&rawDataWorkSheetHandle);
ExcelRpt_SetWorksheetAttribute(rawDataWorkSheetHandle,ER_WS_ATTR_NAME,"Analysis Data");
ExcelRpt_WriteDataFromTableControl (rawDataWorkSheetHandle, location,
                                            panelHandle2, PANEL2_TABLE);
           
ExcelRpt_ChartAddtoWorksheet (rawDataWorkSheetHandle, 0, 0,
                                                   7.0*69, 4.0*74, &chartHandle);
           
ExcelRpt_SetChartAttribute (chartHandle,ER_CH_ATTR_CHART_SIZE_WITH_WINDOW,0);
           
location = "A2:K42";   
               
ExcelRpt_ChartWizard (chartHandle, rawDataWorkSheetHandle, location, ExRConst_GalleryXYScatter,
                                          ExRConst_Columns, 0, 0, 0, 1, "Data", "Z position", "Hall Probe", NULL);
   
ExcelRpt_SetChartAxisAttribute (chartHandle, ExRConst_Value,
                                            ExRConst_Primary,
                                            ER_CH_ATTR_MINIMUM_SCALE_IS_AUTO,
                                            ExRConst_False);
                                         
ExcelRpt_SetChartAxisAttribute (chartHandle, ExRConst_Value,
                                                          ExRConst_Primary,
                                                          ER_CH_ATTR_MINIMUM_SCALE,
                                                          100);
           
ExcelRpt_ChartSetSourceRange (chartHandle, rawDataWorkSheetHandle,
                                          location);
0 Kudos
Message 4 of 8
(5,152 Views)

Hello jlenoach,

I am still unable to duplicate the same behaviour that you are describing.  I have attached a working example which uses the same functions to successfully accomplish updates to a chart in excel.  Please let me know if you have any other questions.

Regards,
Ben M
Applications Engineer
National Instruments
0 Kudos
Message 5 of 8
(5,120 Views)

Hi.

 

I am facing a similar issue.

I have tested the attached peace of code.

 

It works fine to set the min on Y Axis.

 

What should I do to make the same thing on X Axis ?

 

Tried to replace ExRConst_Primary by ExRConst_Secondary ... But it fails...

 

Working under CVI 8.5.

 

Thanks

 

0 Kudos
Message 6 of 8
(4,037 Views)

Not sure about that but ExRConst_Secondary refers probably to the secondary Y-axis (the one shown on the right of the graph).

You will probably have success by setting Axis type parameter to ExRConst_Category.

I cannot test at the moment as I don't have Excel installed on this machine.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 8
(4,032 Views)

Thanks, works fine Smiley LOL

 

Chris

 

0 Kudos
Message 8 of 8
(4,024 Views)