Set the Values Format Code of Chart Series

Possible Usage Scenarios

You can set the values format code of chart series using the Series.values_format_code property. This property is not only useful for a series that is based on a range inside the worksheet but also works well for series created with an array of values.

Set the Values Format Code of Chart Series

The following sample code adds a series to an empty chart that previously had no series. It adds the series using an array of values. After adding the series, it formats it with the code $#,##0 using the Series.values_format_code property, and the number 10000 becomes $10,000. The screenshot shows the effect of the code on the sample Excel file and the output Excel file after execution.

todo:image_alt_text

Sample Code