GNOME Bugzilla – Bug 726449
Budget Barchart does not show up if running sum is selected
Last modified: 2018-06-29 23:28:23 UTC
When starting the Budget Barchart Report a white empty scree is returned. Go to the report options, deactivate the running sum, try again, the the bar chart is coming up as expected - without the running sum, of course.
Created attachment 272052 [details] [review] patch to be applied on top of GnuCash 2.6.2 For the running sum the chart is extended with a subtitle. The subtitle composition includes a backslash character. After taking out the backslash character the bar chart comes up as expected. As I do no see the need and the benefit for this character, I simply propose to delete it. This is what the patch is doing. Apart from that, I took the freedom to insert a footer for revision handling and showing a time stamp for the report creation.
Comment on attachment 272052 [details] [review] patch to be applied on top of GnuCash 2.6.2 Thank you for your report. The "backslash character" is not just a backslash - it's \n, which means a newline. I agree it's probably not correct to add it like this in a report. The original author's intention no doubt was to put the Act string on a new line. The proper way to do so would have been by adding a <br/> html tag. I don't use the report so I'll leave it up to you which way is better. I have some issue with the added footer though. I can't imagine it would be desirable in all cases to add this information. I can see it useful in some circumstances but I don't want to enforce this at all times. Can you make this addition optional, please ? Thank you.
Created attachment 272193 [details] [review] Patch to be applied on GnuCash 2.6.2 or later Hi Geert, no problem. See new attachment, the report footprint is now optional. But: I tried - <br/> - </br> - <br> and none of these versions took effect, they where all just added as plain text. Seems to be more complex than I currently can grasp. I would prefer to shift this line break issue to a later point of time by creating another bug for it.
Created attachment 272706 [details] [review] patch to be applied on top of GnuCash 2.6.2 Hi Geert, I think now I found the place to make it work as before, see attach patch.
Created attachment 272707 [details] [review] patch to be applied on top of GnuCash 2.6.2 - version 2 however, I think this versions provides better readability feel free to choose :-)
Comment on attachment 272707 [details] [review] patch to be applied on top of GnuCash 2.6.2 - version 2 Thank you for your patch(es). You may think I'm doing this intentionally but... I have a small remark. Your patch drops the call to jqplot-escape-string on the substring. I can follow this because it is the only way to preserve the br html tag to pass. This does put the burden of generating a javascript compatible string for the subtitle on the calling script. This means the calling script should make sure the generated subtitle doesn't contain any unescaped quotes or backslashes. Otherwise we're opening the gates again for bug 721768. Can you double-check that none of the reports that call gnc:html-barchart-set-subtitle can unintentionally create subtitles containing the above illegal characters ? The safest way to do so is probably to wrap all variables in a jqplot-escape-string. Like in your patch example: (string-append "Bgt:" (jqplot-escape-string (number->string bgt-sum)) "<br /> Act:" (jqplot-escape-string (number->string act-sum))))) You may have to load to proper scm module to get access to this function. In addition, please add a big fat warning to the definition of gnc:html-barchart-set-subtitle to explain it will not be escaped like the title and labels will be.
Created attachment 273739 [details] [review] Patch to be applied on GnuCash 2.6.3 or later - version 3 Hi Geert, I hope this is somewhat close to what you have mind.
Comment on attachment 273739 [details] [review] Patch to be applied on GnuCash 2.6.3 or later - version 3 Thanks Carsten. Applied in https://github.com/Gnucash/gnucash/commit/5baa87bf
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=726449. Please update any external references or bookmarks.