Bug 65788 - problems with .svg exported from Calc charts
Summary: problems with .svg exported from Calc charts
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
4.0.3.3 release
Hardware: x86-64 (AMD64) All
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:5.0.0 target:4.4.5
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-15 13:46 UTC by fdes
Modified: 2020-04-13 05:31 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
a sample zipped file with ods, odg and svg (34.01 KB, application/zip)
2013-06-15 13:46 UTC, fdes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fdes 2013-06-15 13:46:46 UTC
Created attachment 80869 [details]
a sample zipped file with ods, odg and svg

when I export as svg a chart which has been pasted from Calc the resulting svg has two major problems:

1) if I open it with Inkscape the title of the Y axis loses its orientation, but this could be an Inkscape bug

2) if I open it with LibreOffice Draw the result is really weird

I have attached a zip file with 4 files: a calc sheet with a chart (01.ods), the pasted chart as odg (02.odg), the exported svg (03.svg) and finally the odg produced by opening the svg again with LibreOffice Draw (04.odg)
Comment 1 Thomas van der Meulen [retired] 2013-06-20 15:53:07 UTC
Thank you for your bug report, I can reproduce this bug running LibreOffice Version: 4.1.0.1
Build ID: 1b3956717a60d6ac35b133d7b0a0f5eb55e9155 on Mac osx 10.8.4. 

the y-axis is also lost wen I open it with Safari.
Comment 2 Dennis Roczek 2013-11-17 11:04:07 UTC
SVG and PNG exported with 4.1.3.2

https://wiki.documentfoundation.org/images/b/ba/Coverity_scan_analysis_results_bar.svg

and

https://wiki.documentfoundation.org/images/3/31/Coverity_scan_analysis_results_bar.png

As you can see (also not in the source code) the description of the bars aren't included.

Moreover stylesheets should be used as many code is multiple times included.

Example ODS can be found here https://wiki.documentfoundation.org/File:Coverity_scan_analysis_results.ods
Comment 3 Dennis Roczek 2013-11-17 11:38:42 UTC
OK: the source code solution for the axis was found:

original (in my coverity example)

 <text class="TextShape"><tspan class="TextParagraph" font-family="Arial" font-size="318px" font-weight="400" transform="translate(1330,10312) rotate(-90) translate(-1330,-10312)"><tspan class="TextPosition" x="1330" y="10312"><tspan fill="rgb(0,0,0)" stroke="none"># of &quot;outstanding defects&quot;</tspan></tspan></tspan></text>

and the solution
 <text class="TextShape" transform="translate(1330,10312) rotate(-90) translate(-1330,-10312)"><tspan class="TextParagraph" font-family="Arial" font-size="318px" font-weight="400"><tspan class="TextPosition" x="1330" y="10312"><tspan fill="rgb(0,0,0)" stroke="none"># of &quot;outstanding defects&quot;</tspan></tspan></tspan></text>

the problem is that the code is "correct", but sadly the translate and rotate is "added" in the wrong object (tspan instead of text)

This is actually an EasyHack now (at least that part)
Comment 4 Dennis Roczek 2013-11-17 14:31:40 UTC
@Tomaz Vajngerl I put you as assigned, please correct if wrong; I saw your contributions at bug #60137 

I believe the problem is in line 1425
http://cgit.freedesktop.org/libreoffice/core/tree/filter/source/svg/svgwriter.cxx?id=9bc0ca091b7037f7c8f4782103a81b7287bc1de3#n1425

or better saying in line 1374 as this is the function opening the tspan element.
http://cgit.freedesktop.org/libreoffice/core/tree/filter/source/svg/svgwriter.cxx?id=9bc0ca091b7037f7c8f4782103a81b7287bc1de3#n1374


So I hope that codepointers help everybody. ;-)
Comment 5 Tomaz Vajngerl 2013-11-17 21:55:56 UTC
Hi,

Actually I never worked on SVG export - only on the export functionality (which is independent of the actual export format) so I don't know if I am the right man for this job. 

Regards, Tomaž
Comment 6 Anonymous Helper 2014-04-28 09:22:42 UTC
For now it seems that putting the transform element into the right object per hand does the job.
Unfortunately nobody seems to be working on this.

thb, you said in bug 57215 you had currently no bandwidth to fix it properly, but it seems there are not so many people able to fix it at all. Just as a reminder, if you have some more bandwidth :)
Thanks so far everyone.
Comment 7 Owen Genat (retired) 2014-07-20 11:03:27 UTC
(In reply to comment #0)
> 2) if I open it with LibreOffice Draw the result is really weird

Just for clarity, the black background of the exported SVG (when again opened in Draw) is reported separately in bug 48632.
Comment 8 Commit Notification 2015-02-19 09:18:28 UTC
Chr. Rossmanith committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=cacc3a0e7f7b04240daf63b45e457428388f4929

tdf#65788: svg export - put transform attribute into text element

It will be available in 4.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 V Stuart Foote 2015-03-24 22:31:48 UTC
The -90 text rotation is now correctly rendered during SVG export. XML of the SVG has rotation in TextShape, rather than TextParagraph within tspan.
Comment 10 Commit Notification 2015-06-01 07:10:15 UTC
Chr. Rossmanith committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=cefea9d05085bfc0e485fae5d927544a9e07739c&h=libreoffice-4-4

tdf#65788: svg export - put transform attribute into text element

It will be available in 4.4.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.