LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

activex excel chart and series

Hey Sruli,

I think even if you use the insert object command, you are still going to have to create a series, and set the values somehow.  I think you will run into the same limitation we were before.  I still think if you have a lot of values the best solution is to programmatically write the arrays to a sheet in Excel, and then reference those cells in your graph so you would not be manually entering anything.  It could all be done through ActiveX.  Hope this helps!

Pat P.
Software Engineer
National Instruments
Message 11 of 14
(1,757 Views)

Using sruly's method, we can create correct scatter chart type fo the data.

Does anyone know how to add titles for the chart and axes afterwords?

0 Kudos
Message 12 of 14
(1,474 Views)

Hi -

 

I think you will find the following Developer Zone Tutorial: Generating Microsoft Excel Reports with LabWindows/CVI very useful for setting the attributes of a graph. Specifically, the section on Adding a Graph to the Microsoft Excel Report outlines the details for customizing Microsoft Excel graphs.

 

-Adri

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 13 of 14
(1,454 Views)

Thanks for pointing out this link to me.

 

For some reason, both ExcelRpt_ChartWizard() and Excel_ChartChartWizard()
cannot create correct XYScatter plot (first column = x axis values, 
second column = y axis values).

I had to modify the "excelreportdemo.c" by using these functions to
create the chart that I want:

 

----------------------------------------------------------------------------------------------------------
        ExcelRpt_ChartAddtoWorksheet (worksheetHandle, 200.0, 7.0, 4.0*72, 4.0*72, &chartHandle ) ;
        ExcelRpt_ChartActivate (chartHandle);
        ExcelRpt_ChartSetSourceRange (chartHandle, worksheetHandle, "B2:C7" ) ;      
            
        ExcelRpt_SetChartAttribute (chartHandle, ER_CH_ATTR_CHART_TYPE,  PlotType ) ;
        ExcelRpt_SetChartAttribute (chartHandle, ER_CH_ATTR_CHART_PLOT_BY,  ExRConst_Columns ) ;
        ExcelRpt_SetChartAttribute (chartHandle, ER_CH_ATTR_CHART_TITLE,  "ChartTitle" ) ;
        ExcelRpt_SetChartAttribute (chartHandle, ER_CH_ATTR_PLOTAREA_COLOR, 0xffff00 ) ;     //yellow background
       
        ExcelRpt_SetChartAxisAttribute (chartHandle, ExRConst_Category,
                                        ExRConst_Primary,
                                        ER_CH_ATTR_AXIS_TITLE, "X axis" ) ;     //Category = X-axis
        ExcelRpt_SetChartAxisAttribute (chartHandle, ExRConst_Value,
                                        ExRConst_Primary,
                                        ER_CH_ATTR_AXIS_TITLE, "Y axis" ) ;     //Values = Y-axis
----------------------------------------------------------------------------------------------------------

Message Edited by dcl9000 on 03-10-2009 04:37 PM
0 Kudos
Message 14 of 14
(1,440 Views)