CRAIG MUTH
CRAIG MUTH

Reputation: 1

Select values from cells for data labels, using openpyxl

I have a python script that creates an Excel workbook with two data sheets and a line chart created from that data.

The first data sheet has 5 columns:

The second data sheet has three columns:

The three series from the first sheet create a line chart with the roll out date on the category axis.
The series from the second sheet puts points on the chart to identify the peaks that are Outliers (as described above), which I want to be labelled with the serial number. I can get it to show the Y value (count), the X value (scheduled delivery date), or the series name on these points, but not the serial number.
After the chart is created I can select the point, "format data labels," then "value from cells" to get the results I want - but I want to find out if there is a way I can do that with python. That way I can use the script in a web app and users can generate the chart themselves any time they want it.

Currently I’m using the Openpyxl library to work with the spreadsheet.

The data needs to be sorted by delivery date and the serial numbers are non-sequential so the category needs to be the date.
I've tried showVal, showCatName, showSerName but they don't display the values I want.
I tried extracting the list of serial numbers for the outliers and assigning them to DataLabelList - but I can't get them to actually display on the chart.

Upvotes: -3

Views: 66

Answers (0)

Related Questions