worksheet_insert_chart

@brief Insert a chart object into a worksheet.

@param worksheet Pointer to a lxw_worksheet instance to be updated. @param row The zero indexed row number. @param col The zero indexed column number. @param chart A #lxw_chart object created via workbook_add_chart().

@return A #lxw_error code.

The %worksheet_insert_chart() can be used to insert a chart into a worksheet. The chart object must be created first using the workbook_add_chart() function and configured using the @ref chart.h functions.

@code // Create a chart object. lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_LINE);

// Add a data series to the chart. chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$6");

// Insert the chart into the worksheet worksheet_insert_chart(worksheet, 0, 2, chart); @endcode

@image html chart_working.png

More...

Detailed Description

**Note:**

A chart may only be inserted into a worksheet once. If several similar charts are required then each one must be created separately with %worksheet_insert_chart().

Meta