Charts in .xlsx files created with python via openpyxl (https://openpyxl.readthedocs.io/en/stable/) are displayed wrong.
Steps to Reproduce:
1. Create .xlsx file using python. for example:
from openpyxl import Workbook
from openpyxl.chart import BarChart, Reference
wb = Workbook()
ws = wb.active
for i in range(10):
# drawing a graph
values = Reference(ws, min_col=1, min_row=1, max_col=1, max_row=10)
chart = BarChart()
chart.title = "Chart"
chart.y_axis.title = 'Size'
chart.x_axis.title = 'Test Number'
2. open "Barchart.xlsx" with Microsoft Excel
3. open "Barchart.xlsx" with LibreOffice Calc and see what's wrong
The representation of the chart is wrong in LO Calc
It should look like opened with MS Excel
User Profile Reset: No
I tested this with different Versions up to 7.0.2
Created attachment 166699 [details]
Microsoft vs OpenOffce vs LibreOffice
The representation of the chart in different Office Suites:
MS Excel (left) - OpenOffice Calc (middle) - LibreOffice Calc (right)
MS and OO can show the chart properly, LO can't
Build ID: a9bad3ef281c825bf57437a1b5154e413d7f18cd
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: zh-CN (zh_CN.UTF-8); 界面: zh-CN
Set to NEW.
Created attachment 166737 [details]
This is the bar chart created with the python script as suggested by the bug reporter.
The differently colored data points happen because of the c:varyColors property is missing from the generated file.
Opening this in Excel 2013 and saving it saves the tag as <c:varyColors val="0"/>
so the default value - if omitted - must be 0.
Calc opens the Excel-saved version without differently colored data points.
So the default value - if omitted - must be changed to 0, since currently Calc assumes a value of 1.
Another problem with the example file is the horizontal (category) axis label being incorrectly rotated; we already have bug #126133 about that.
Tünde Tóth committed a patch related to this issue.
It has been pushed to "master":
tdf#137734 Chart OOXML import: fix variable color charts
It will be available in 7.1.0.
The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
Created attachment 167005 [details]
Seems to work now.
Version: 18.104.22.168.alpha1+ (x64)
Build ID: a689cf1672e89cb78fbcfa14c505850927e71f58
CPU threads: 4; OS: Windows 10.0 Build 17134; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Thanks for fixing!