After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 737815 - Graphs cannot be generated correctly
Graphs cannot be generated correctly
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: General
2.6.4
Other Windows
: Normal normal
: ---
Assigned To: gnucash-general-maint
gnucash-general-maint
: 738376 738910 738950 739236 739521 741053 741638 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-10-03 04:54 UTC by Kaliet
Modified: 2018-06-29 23:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
problem with bar chart (11.22 KB, image/png)
2014-10-10 15:10 UTC, Ron
  Details
stacked bar chart (19.75 KB, image/png)
2014-10-10 15:13 UTC, Ron
  Details
change loop condition in html-barchart.scm (932 bytes, patch)
2014-10-11 20:05 UTC, Carsten Rinke
none Details | Review
Screen showing Assets report. (81.68 KB, image/png)
2014-10-12 21:21 UTC, John Ralls
  Details
Stacked bars showing months transposed onto days of January (50.88 KB, image/png)
2014-10-19 21:37 UTC, Matt MacLeod
  Details

Description Kaliet 2014-10-03 04:54:44 UTC
Typical graphs generated in 2.6.3 are not generated correctly in 2.6.4.
The stacked columns of the graphs are all bunched up together.
Changing options does not help.
Problem easily reproducable.
Comment 1 Philipp 2014-10-06 18:31:52 UTC
I can reproduce it also with Ubuntu 14.04 after the latest update to Gnucash 2.6.4.
Comment 2 René Trumpa 2014-10-10 13:04:37 UTC
Same problem with 2.6.4 on my system (Debian Testing).
Comment 3 Ron 2014-10-10 15:10:36 UTC
Created attachment 288230 [details]
problem with bar chart
Comment 4 Ron 2014-10-10 15:13:00 UTC
Comment on attachment 288230 [details]
problem with bar chart

My observations on 
- For Assets and Liabilities, all bar charts just produce a blank page.

- For the income and expense bar charts, the stacked ones have gaps as shown in the attachment to my previous post, and in the non-stacked ones, the bars are too wide and obscure other bars. See attached Income/Expense chart for an example.
Comment 5 Ron 2014-10-10 15:13:58 UTC
Created attachment 288232 [details]
stacked bar chart
Comment 6 Geert Janssens 2014-10-11 15:43:08 UTC
I find only one commit between 2.6.3 and 2.6.4 that affects bar chart rendering:
https://github.com/Gnucash/gnucash/commit/88bfbb19a043949ca406d52036578ece27611ca4

This was a fix for bug 720934. It may be the cause of this regression but I haven't had time to dig deeper.
Comment 7 Geert Janssens 2014-10-11 15:49:34 UTC
Comment on attachment 288232 [details]
stacked bar chart

The "gaps" are actually the green and orange bars that are shifted on place to the right. Or the blue bar one position to the left, depending on how you want to see it.

There seems to be a date mapping issue in here.
Comment 8 Carsten Rinke 2014-10-11 20:05:50 UTC
Created attachment 288288 [details] [review]
change loop condition in html-barchart.scm

This patch should fix the issue with the gap and the mapping.

It works on my end - please let me know if it also works on yours.
Comment 9 Ron 2014-10-12 19:39:27 UTC
Getting closer.

That patch fixes the problem with 'jumbled' (horizontally offset) bar charts, but I still see the following problems at a glance:

1. No asset bar charts work - they still paint a blank canvas
2. Dates on bar charts are incorrect. For example, if I use the Expense bar chart for this year, in one month periods, I expect 12 bars labeled for each month, instead they are labeled 1-Jan-14 ... 12-Jan-14.
Comment 10 John Ralls 2014-10-12 21:21:05 UTC
Created attachment 288351 [details]
Screen showing Assets report.

I'm not seeing either problem in Win7, as can be seen from the attached. (I haven't applied Carsten's patch, so the bars are still offset.)
Comment 11 Philipp 2014-10-12 21:33:12 UTC
Here with Ubuntu 14.04 the patch looks also fixes some aspects of the horizontal offsets (not completely see below). Thank you so far!

I also have some more problems with bar charts at all: 

- The width of the bars is far too wide in the asset bar charts. It seems always to be fixed to 119(?) pixels or so, independent of the amount of bars visible or the width of the diagram (or interval chosen). So in case of a lot of bars, they all are overlapping and the result is really useless at the moment. 
- In the Income/Expense bar charts the width of the bars seems also not to be calculated correctly: with 4 months I have a width of 26 pixels for each bar, but with 22 months displayed I have a width of 38 pixels.
- In the Income/Expense bar charts the current/last month is on the very right side of the diagram, so mostly I can not see the rightest of the 3 bars for a month.
Comment 12 Geert Janssens 2014-10-13 14:19:03 UTC
(In reply to comment #10)
> Created an attachment (id=288351) [details]
> Screen showing Assets report.
> 
> I'm not seeing either problem in Win7, as can be seen from the attached. (I
> haven't applied Carsten's patch, so the bars are still offset.)

There are problems with both stacked and unstacked versions of the bar charts.

Your screenshot shows two of them in the stacked type bar charts:
1. All series but the first one are offset by one month. This is gets fixed with Carsten's patch.

2. The first and last bar are rendered partly outside of the charting area instead of fully. For the first bar, the left half is cut off, for the last bar the right half is cut off.

This second issue is a side effect of changing axis renderer from categoryAxis to dateAxis type. The dateAxisRenderer renders the bar at the tick. In the screenshot this can be seen on the bars the are rendered right on a grid line (and the tick is at the extension of the grid line).

The categoryAxisRenderer we used before renders the bars *between* the ticks and similarly puts the date labels (treated as "categories") in between the ticks as well.
Comment 13 Geert Janssens 2014-10-13 14:25:25 UTC
(In reply to comment #11)
> Here with Ubuntu 14.04 the patch looks also fixes some aspects of the
> horizontal offsets (not completely see below). Thank you so far!
> 
> I also have some more problems with bar charts at all: 
> 
> - The width of the bars is far too wide in the asset bar charts. It seems
> always to be fixed to 119(?) pixels or so, independent of the amount of bars
> visible or the width of the diagram (or interval chosen). So in case of a lot
> of bars, they all are overlapping and the result is really useless at the
> moment. 
> - In the Income/Expense bar charts the width of the bars seems also not to be
> calculated correctly: with 4 months I have a width of 26 pixels for each bar,
> but with 22 months displayed I have a width of 38 pixels.
> - In the Income/Expense bar charts the current/last month is on the very right
> side of the diagram, so mostly I can not see the rightest of the 3 bars for a
> month.

I can see this as well on Fedora.

This again is a side effect of using the dateAxisRenderer for the horizontal axis. Replacing it with a categoryAxisRenderer again fixes the problem at once.

It looks like the dateAxisRenderer was not meant to be used with a barchart.

Later today I will apply Carsten's patch and revert the axis type back to category. That will at least solve the bar position/size issues we have so far.

On the other hand that means bug 720934 will have to be reopened, because we loose the option to skip labels from the x-axis if there are too many. I believe though that issue is less serious than the visual inconsistencies we have created now.
Comment 14 Geert Janssens 2014-10-13 14:27:46 UTC
(In reply to comment #4)
> (From update of attachment 288230 [details])
> My observations on 
> - For Assets and Liabilities, all bar charts just produce a blank page.

While tweaking I sometimes got an empty chart. That is the chart is rendered with legend included but there's no data on it.

I never got a completely blank page though.

Did you also get a empty chart or really a blank page ?
Comment 15 Ron 2014-10-13 15:53:51 UTC
Yes, I see completely blank canvases for asset bar charts. This also seems to be true for budget bar charts, but I have not tested as thoroughly.

Ron

(In reply to comment #14)
> (In reply to comment #4)
> > (From update of attachment 288230 [details] [details])
> > My observations on 
> > - For Assets and Liabilities, all bar charts just produce a blank page.
> 
> While tweaking I sometimes got an empty chart. That is the chart is rendered
> with legend included but there's no data on it.
> 
> I never got a completely blank page though.
> 
> Did you also get a empty chart or really a blank page ?
Comment 16 Geert Janssens 2014-10-13 19:02:53 UTC
As said, I have pushed a commit to revert to the CategoryAxisRenderer instead of the DateAxisRenderer.

For those capable of rebuilding gnucash, please test and give your feedback.
Windows users can download the nightly build tomorrow (dated 2014-10-14) from
  http://code.gnucash.org/builds/win32/maint/
and test as well.

The changes are all in one single scm script file. So if you don't know how to build gnucash, you can still test if you like by downloading https://raw.githubusercontent.com/Gnucash/gnucash/maint/src/report/report-system/html-barchart.scm
and put it in
<your gnucash install dir>/share/gnucash/scm/
And restart gnucash.
Remember to back up the original html-barchart.scm you have in there first so you can revert to it.

Of note: even with this modified file I keep getting charts with an empty canvas. To show the bars, I have to zoom in (select a region of the chart) and zoom out again (double-click in the chart area). This seems to happen only with stacked barcharts.

Are others seeing this as well ?
Comment 17 Geert Janssens 2014-10-13 19:06:11 UTC
(In reply to comment #15)
> Yes, I see completely blank canvases for asset bar charts. This also seems to
> be true for budget bar charts, but I have not tested as thoroughly.
> 
> Ron
> 
So that sounds like an additional issue with the bar charts.

Is there anything in the trace file [1] ?

[1] http://wiki.gnucash.org/wiki/Tracefile
Comment 18 Ron 2014-10-14 10:00:47 UTC
With the new html-barchart.scm I have the same behaviour as you report. I seem to have correct bar charts after a zoom+unzoom.
Comment 19 Geert Janssens 2014-10-14 10:51:27 UTC
Thanks for the feedback. That brings us at least one step closer already.

What remains is to figure out why stacked bar charts only display after zoom+unzoom.
Comment 20 Matt MacLeod 2014-10-18 13:13:57 UTC
I'm seeing completely blank canvasses for two different net work charts on OS X (Mavericks), as well as screwed up stacked bars.  Haven't had the chance to try the patch yet.
Comment 21 John Ralls 2014-10-18 18:44:08 UTC
What's a "net work chart"?

Does zooming and unzooming force the charts to draw?
Comment 22 Matt MacLeod 2014-10-19 21:37:05 UTC
Sorry about that, I was typing quickly - I'm talking about two versions of the "Net Worth Barchart" (I have one on a month scale and one on a year scale). Zooming does not seem to do anything.

I'll also attach a screen grab of what my stacked bar chart for expenses is doing - it looks different than the others.  What seems to be happening is the year is being recognized correctly, the month is being set to January, and the numerical month is being subbed in for the numerical date (if I slowly hover over the bars I see entries up to 12-Jan-2013 and 10-Jan-2014.
Comment 23 Matt MacLeod 2014-10-19 21:37:47 UTC
Created attachment 288869 [details]
Stacked bars showing months transposed onto days of January
Comment 24 Mike Evans 2014-10-21 08:53:59 UTC
*** Bug 738910 has been marked as a duplicate of this bug. ***
Comment 25 Geert Janssens 2014-10-21 10:51:26 UTC
(In reply to comment #20)
> I'm seeing completely blank canvasses for two different net work charts on OS X
> (Mavericks), as well as screwed up stacked bars.  Haven't had the chance to try
> the patch yet.

Can you try the patch ? The blank canvasses were from before the patch. I also expect your stacked bar charts to be resolved by it.
Comment 26 Geert Janssens 2014-10-21 15:19:33 UTC
I have just pushed an additional change to the file referred to above. With this change the empty canvas issue should be fixed.

The root cause appears to be a bug in the jqplot library (unfixed in the latest stable version of that library):
https://bitbucket.org/cleonello/jqplot/issue/587/charts-disappear-by-enabling-stackseries

My change works around this bug.

Can some of the affected people confirm this is now fixed ?
Either by downloading tomorrow's nightly build, or by copying the patched file directly into your gnucash installation as explained in comment 16.
Comment 27 Geert Janssens 2014-10-21 16:55:34 UTC
*** Bug 738950 has been marked as a duplicate of this bug. ***
Comment 28 Philipp 2014-10-21 18:12:42 UTC
I can confirm that all looks fine with the newest html-barcharts.scm file!

Thank you for fixing!
Comment 29 Ron 2014-10-21 18:47:03 UTC
The latest patch seems to work fine for me. I'll play around with it a bit later today and post any issues.

Thanks for all the effort. It's appreciated.
Comment 30 Matt MacLeod 2014-10-21 19:18:06 UTC
Applying the patch manually and/or replacing the file on OS X in GnuCash.app/Contents/Resources/share/gnucash/scm isn't having an effect for me (still blank canvases for Net Worth Barchart, and the stacked bars look like the attached screenshot).  Not sure if that's not where it's looking, or if the patch isn't working.

I'm just prepping for an overseas assignment, so unfortunately I'm not going to have too much more time to fiddle.
Comment 31 Geert Janssens 2014-10-21 19:27:47 UTC
(In reply to comment #30)
> Applying the patch manually and/or replacing the file on OS X in
> GnuCash.app/Contents/Resources/share/gnucash/scm isn't having an effect for me
> (still blank canvases for Net Worth Barchart, and the stacked bars look like
> the attached screenshot).  Not sure if that's not where it's looking, or if the
> patch isn't working.
> 
> I'm just prepping for an overseas assignment, so unfortunately I'm not going to
> have too much more time to fiddle.

Ok, it looks like you are hitting yet another issue. What you didn't mention was if this worked in gnucash 2.6.3. And secondly can you check the gnucash trace [1] file for any error messages ? You should check this file right after you have run gnucash and generated the failing net worth charts.

[1] http://wiki.gnucash.org/wiki/Tracefile
Comment 32 Geert Janssens 2014-10-21 19:28:35 UTC
@Ron, Philipp: thanks for testing and confirming this fix works for you.
Comment 33 Matt MacLeod 2014-10-21 19:37:15 UTC
This was working for me on Gnucash 2.6.3 and versions back to the 1.x days.

For each Net Worth bar char I get the error:

MESSG <> console message: undefined @0: TypeError: 'undefined' is not a function

Which seems to be related to the following function:

  function formatTooltip(str, seriesIndex, pointIndex) {
      if (options.axes.xaxis.ticks[pointIndex] !== undefined)
          x = options.axes.xaxis.ticks[pointIndex];
      else
          x = pointIndex;
      y = data[seriesIndex][pointIndex][1].toFixed(2);
      return options.series[seriesIndex].label + ' ' + x + '<br><b>' + y + '</b>';
  }
Comment 34 Geert Janssens 2014-10-21 20:03:45 UTC
I can't reproduce this unfortunately...

Are you willing to provide me with the report saved to html ? If you don't want to attach it to this bug report for privacy reasons (which I would understand) you can send it to me in private as well.
Comment 35 Geert Janssens 2014-10-21 20:04:50 UTC
Oh, and if you do, please generate the report with the option "Show table" enabled. That gives me something to compare the chart with the data it should be working on.
Comment 36 Geert Janssens 2014-11-21 09:46:55 UTC
*** Bug 739521 has been marked as a duplicate of this bug. ***
Comment 37 Geert Janssens 2014-11-21 09:47:48 UTC
*** Bug 739236 has been marked as a duplicate of this bug. ***
Comment 38 Geert Janssens 2014-12-03 08:32:37 UTC
*** Bug 741053 has been marked as a duplicate of this bug. ***
Comment 39 Geert Janssens 2014-12-17 10:57:18 UTC
*** Bug 741638 has been marked as a duplicate of this bug. ***
Comment 40 Geert Janssens 2015-02-08 19:02:47 UTC
*** Bug 738376 has been marked as a duplicate of this bug. ***
Comment 41 Oliver C. 2015-03-01 15:30:33 UTC
The bug persists in GnuCash 2.6.5. I'm using the tar ball available at gnucash.org (This copy was built from rev 23d0f79+ on 2015-02-24.) I've also applied the change to html-barchart.scm proposed in comment 16. Still, all but one coloured rectangles are replaced to the right. 

Besides, the bar are displayed centered on their respective date on the x-axis, instead of filling up the period between two dates.

Are you still interested in the html output? (I suppose you mean file -> save as -> xml?!)
Comment 42 Geert Janssens 2015-03-01 16:15:16 UTC
(In reply to Oliver C. from comment #41)
> The bug persists in GnuCash 2.6.5. I'm using the tar ball available at
> gnucash.org (This copy was built from rev 23d0f79+ on 2015-02-24.) I've also
> applied the change to html-barchart.scm proposed in comment 16. Still, all
> but one coloured rectangles are replaced to the right. 
> 
> Besides, the bar are displayed centered on their respective date on the
> x-axis, instead of filling up the period between two dates.
> 
> Are you still interested in the html output? (I suppose you mean file ->
> save as -> xml?!)
No, that would be File->Export->Export Report


However I'd be surprised this would still happen in gnucash 2.6.5. The code responsible for it has been completely reverted.

To rule out an obsolete guile compile cache can you remove the contents of
$HOME/.cache/guile
and try again ?
Comment 43 Oliver C. 2015-03-01 17:21:01 UTC
yes, that fixed it. Thanks a lot!
Comment 44 Geert Janssens 2015-04-04 08:52:25 UTC
(In reply to mmacleod from comment #30)
> Applying the patch manually and/or replacing the file on OS X in
> GnuCash.app/Contents/Resources/share/gnucash/scm isn't having an effect for
> me (still blank canvases for Net Worth Barchart, and the stacked bars look
> like the attached screenshot).  Not sure if that's not where it's looking,
> or if the patch isn't working.
> 
> I'm just prepping for an overseas assignment, so unfortunately I'm not going
> to have too much more time to fiddle.

mmacleod: are you still having this issue with the most recent gnucash release (2.6.6-3) ?
Comment 45 Matt MacLeod 2015-04-08 15:34:16 UTC
Hi Geert,

I just returned home to my OS X machine after several months away, and was unable to get 2.6.6-4 to recognize my accounts file (separate issue).  I installed 2.6.5-6 instead, and it loaded - and this particular bug has gone away.  

Thanks!

Matt
Comment 46 Geert Janssens 2015-04-14 07:59:29 UTC
Thank you for reporting back. I'll close this bug now.
Comment 47 John Ralls 2018-06-29 23:34:32 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=737815. Please update any external references or bookmarks.