Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

XlsxWriter chart without the explanation textbox?

Hei! I want to make a cleaner look on a train analyze project.

Have this Excel speardsheet:Excel charts with explanation text box

I want to show the chart without the -Serie1 text box.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Some of the code in action:

df.to_excel(writer, sheet_name='Year_sheet', startrow=1, header=False, index=False)
workbook = writer.book
workbook = writer.book
worksheet1 = writer.sheets['Year_sheet']
chart_weight = workbook.add_chart({'type': 'line'})
chart_weight.add_series({'values': '=Year_sheet!$B$2:$B$13'})
chart_weight.set_x_axis({'name': 'Months'})
worksheet1.insert_chart('A16', chart_weight) 
chart_weight.set_title({'name': 'Gross tonnage'})
writer.save()

There will be severalcharts so it’s essential to save horisontal space an get rid the -Serie1 text on all charts. Hope you have some tips on how to solve this issue

>Solution :

According to the docs:

you should be able to remove the legend with this function :

chart.set_legend({'none': True})

or

chart.set_legend({'position': 'none'})
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading