GNOME Bugzilla – Bug 347462
can't change the number of slices in the expense piechart
Last modified: 2018-06-29 21:09:33 UTC
Please describe the problem: When I attempt to change the number of slices in the expense piechart, I receive an error. Steps to reproduce: 1. Open gnucash. 2. Select Reports->Income & Expenses->Expense Piechart 3. Click the "Options" button. 4. Select the "Display" tab. 5. Change the value for "Maximum Slices." 6. Click "Apply" or "OK." Actual results: The pie chart disappears and the following message is displayed: Report error An error occurred while running the report. Expected results: The number of slices in the pie chart should have changed. Does this happen every time? Yes. Other information: Once I change the number of slices, the only way to get the report to be displayed again is to close the report and open it again. Even if I open the Options widow again and click the "Defaults" button, the error message is still displayed after I click "Apply." Thus, the error doesn't seem to be caused by selecting a specific number of slices; merely changing the default value of 7 to any other value triggers the error.
gnucash writes some errors on the terminal if the report has an error. Can you please start gnucash from the command line in a terminal window, and copy the error output to here? Thanks.
See below. [ebair@ericwork ~]$ gnucash & [1] 6112 [ebair@ericwork ~]$ gnucash: [M] "Found Finance::Quote version ""1.10" In unknown file: ?: 18* [#<procedure #f ()>] In /usr/share/gnucash/guile-modules/gnucash/main.scm: 162: 19* [lazy-catch #t #<procedure #f ()> #<procedure dumper (key . args)>] In unknown file: ?: 20* [#<procedure #f ()>] In /usr/share/gnucash/guile-modules/gnucash/main.scm: 163: 21* [apply #<procedure #f ()> ()] In unknown file: ?: 22 [#<procedure #f ()>] In /usr/share/gnucash/scm/report.scm: ... 442: 23 (set! html (gnc:report-render-html report #t)) 442: 24* [gnc:report-render-html # #t] 407: 25 (if (and (not #) (gnc:report-ctext report)) (gnc:report-ctext report) ...) 415: 26 (let ((template #) (doc #f)) (set! doc (if template # #f)) doc) 418: 27* (set! doc (if template (let* # # # ...) #f)) 418: 28* (if template (let* # # # ...) #f) 419: 29 (let* (# # # ...) (gnc:html-document-set-style-sheet! doc stylesheet) ...) 421: 30* [#<procedure #f #> #] In /usr/share/gnucash/guile-modules/gnucash/report/account-piecharts.scm: 475: 31 [piechart-renderer # "Expense Accounts" # ...] In unknown file: ... ?: 32 (letrec (# # # #) (if # # #) (gnc:report-finished) ...) In /usr/share/gnucash/guile-modules/gnucash/report/account-piecharts.scm: 304: 33* (if (not #) (begin # # # ...) (gnc:html-document-add-object! document #)) 305: 34 (begin (set! work-to-do #) (set! combined #) (if # #) ...) 330: 35* (if (> (length combined) max-slices) (let* (# # #) (set! combined #) ...)) 331: 36 (let* ((start #) (finish #) (sum #)) (set! combined (append start #)) ...) 331: 37* [list-head ((5561.93 #) (5250.0 #) (4517.92 #) (4483.65 #) ...) 9.0] /usr/share/gnucash/guile-modules/gnucash/report/account-piecharts.scm:331:31: In procedure list-head in expression (take combined (- max-slices 1)): /usr/share/gnucash/guile-modules/gnucash/report/account-piecharts.scm:331:31: Wrong type (expecting exact integer): 9.0 In unknown file: ?: 15* [#<procedure #f ()>] In /usr/share/gnucash/guile-modules/gnucash/main.scm: 162: 16* [lazy-catch #t #<procedure #f ()> #<procedure dumper (key . args)>] In unknown file: ?: 17* [#<procedure #f ()>] In /usr/share/gnucash/guile-modules/gnucash/main.scm: 163: 18* [apply #<procedure #f ()> ()] In unknown file: ?: 19 [#<procedure #f ()>] In /usr/share/gnucash/scm/report.scm: ... 442: 20 (set! html (gnc:report-render-html report #t)) 442: 21* [gnc:report-render-html # #t] 407: 22 (if (and (not #) (gnc:report-ctext report)) (gnc:report-ctext report) ...) 415: 23 (let ((template #) (doc #f)) (set! doc (if template # #f)) doc) 418: 24* (set! doc (if template (let* # # # ...) #f)) 418: 25* (if template (let* # # # ...) #f) 419: 26 (let* (# # # ...) (gnc:html-document-set-style-sheet! doc stylesheet) ...) 421: 27* [#<procedure #f #> #] In /usr/share/gnucash/guile-modules/gnucash/report/account-piecharts.scm: 475: 28 [piechart-renderer # "Expense Accounts" # ...] In unknown file: ... ?: 29 (letrec (# # # #) (if # # #) (gnc:report-finished) ...) In /usr/share/gnucash/guile-modules/gnucash/report/account-piecharts.scm: 304: 30* (if (not #) (begin # # # ...) (gnc:html-document-add-object! document #)) 305: 31 (begin (set! work-to-do #) (set! combined #) (if # #) ...) 330: 32* (if (> (length combined) max-slices) (let* (# # #) (set! combined #) ...)) 331: 33 (let* ((start #) (finish #) (sum #)) (set! combined (append start #)) ...) 331: 34* [list-head ((5561.93 #) (5250.0 #) (4517.92 #) (4483.65 #) ...) 9.0] /usr/share/gnucash/guile-modules/gnucash/report/account-piecharts.scm:331:31: In procedure list-head in expression (take combined (- max-slices 1)): /usr/share/gnucash/guile-modules/gnucash/report/account-piecharts.scm:331:31: Wrong type (expecting exact integer): 9.0
Created attachment 69157 [details] [review] Patch to /usr/share/gnucash/guile-modules/gnucash/report/account-piecharts.scm The following simple patch fixes the problem on my machine. For some reason max-slices is being treated as a float rather than an integer. If I simply convert it to an integer using this patch, the error disappears.
Today I noticed that I am encountering a nearly identical problem when I try to change the number of bars in a barchart. I would guess that this is broken in several other reports as well. I could easily write patches for all the reports that are affected, but it looks like the patch I submitted earlier for account-piecharts.scm has never been committed. Did I submit this patch correctly? Do I need to do something else in order to get the patch committed to cvs? I'm happy to write some more patches for this issue, I just don't want to waste my time if they're not going to be committed...
I'm still having this problem in version 2.0.2. Did I do something wrong when I submitted this patch? This is a trivial bug to fix; I've simply applied the patch myself to the appropriate scm files each time a new version of gnucash is released. However, every time I install a new version of gnucash, my patch hasn't been applied, so I have to apply it again myself. If submitting a patch via bugzilla like I did above isn't the correct way to do this, please let me know where I should send the patch. (This is the first time I've ever contributed a patch to gnucash or any other gnome project, so I don't really know the procedure.) And if there is something wrong with the patch I submitted, please let me know so that I can fix it. Otherwise, can someone please commit the patch so that this bug is finally fixed? Thanks!
The patch has been committed to trunk by hampton: http://svn.gnucash.org/trac/changeset/15088 There was a short discussion of it in the thread starting @ https://lists.gnucash.org/pipermail/gnucash-devel/2006-November/019098.html The commit on trunk does not affect the 2.0.x releases, but it is marked for a backport. So I add this bug to our umbrella bug. Your patch looks good, but next time try to do it from the top-level directory, i.e. the one containing src (i had to learn that one too ;-)
Backported into 2.0 as r15137. Will be fixed in 2.0.3
Actually, this same issue occurs if you try to change the number of bars in a bar chart. I should have submitted a patch for that as well, but I never did. I'm going to repoen this bug temporarily until I submit the patch (and until the patch is applied).
Oh, I do not think you need to. Look at the first link in #6, there is clearly a fix in category-barchart.scm :) Closing again ;-)
You're right. Sorry, I didn't see that.
*** Bug 383535 has been marked as a duplicate of this bug. ***
*** Bug 385245 has been marked as a duplicate of this bug. ***
*** Bug 396727 has been marked as a duplicate of this bug. ***
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=347462. Please update any external references or bookmarks.