New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remember charts size #339

Closed
hsoft opened this Issue Jun 22, 2013 · 15 comments

Comments

Projects
None yet
1 participant
@hsoft
Owner

hsoft commented Jun 22, 2013

From e-mail:

However, moneyGuru still resets the pie charts and column sizes. This wasn’t the case with earlier versions. The bug appeared around the same time as the other one. Basically, I prefer to see the pie charts stacked up with the income on top of the expenses.

The size for charts were never remembered, but still, it should be.

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

Mmmm... I could do this quick and easy by duplicating the save/restore code in each GUI layer, but that would increase moneyGuru's technical debt. Moreover, the save/restore data wouldn't be document-dependent unless I hack something (which would even further increase the TD).

I think that the core should ideally handle this save/restore by making all charts send down their size (something that is already done with Chart.set_view_size(), which is used for dynamic pie chart pies count). Then, the core could save these values on document close. Then it would be a matter of adding a new Chart's view call to tell the GUI view to restore the view size (that would be called on document open).

However, there's an extra difficulty: The Double View mechanism used for pie charts (so that we have 2 pie charts in the net worth and P&L views). These are entirely implemented in the 2 GUI layers and are unknown to the core. For the sizes to be able to be restored properly, I would first have to push the Double View logic down to the core.

This would mean that I would end up with a single view/widget in the core that manages its drawing coordinates so that it knows that the asset pie chart is drawn at the top and the liability pie chart is drawn at the bottom.

But that can't really work unless I give more "drawing power" to the core. Right now, the GUI layer has the complete initiative over how the drawing is done. All the chart does is to supply ready-to-draw data. In PdfMasher, I've done a good job of inverting the drawing control down to the core. I should do the same in moneyGuru.

Whew! That's a lot of work just for that small feature! Again, I'm all against over-engineering and all, but the quick & dirty way is too hacky, especially when the time will come to make these save/restore document-dependent.

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [1d2c70029fc6]) [#339] First foray into pushing chart drawing to the core.

The title of the pie charts is now drawn in the core.
https://bitbucket.org/hsoft/moneyguru/changeset/1d2c70029fc6/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [29301446e19f]) [#339] Pushed pie drawing in the pie charts to the core.
https://bitbucket.org/hsoft/moneyguru/changeset/29301446e19f/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [c404ed3e9300]) [#339] Pushed the rest of pie chart drawing down to the core.
https://bitbucket.org/hsoft/moneyguru/changeset/c404ed3e9300/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [503c815e0d6d]) [#339] Added font and gradient cache in GUI layers' chart controller.
https://bitbucket.org/hsoft/moneyguru/changeset/503c815e0d6d/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [408a9fa08a1c]) [#339] Instead of a simple ColorIndex, introduced the concept of PenID and BrushID in chart drawing.

This gives more flexibility to presentation, a flexibility which will be needed for the next chart to be pushed down to the core, the bar graph.
https://bitbucket.org/hsoft/moneyguru/changeset/408a9fa08a1c/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [641ba006e3eb]) [#339] Pushed bar chart drawing to the core.
https://bitbucket.org/hsoft/moneyguru/changeset/641ba006e3eb/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [179592ea2970]) [#339] Pushed balance graph and axis overlay drawing down to the core.
https://bitbucket.org/hsoft/moneyguru/changeset/179592ea2970/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [3299b66d0d3b]) [#339] Pushed graph axis, tickmarks, labels and title drawing down to the core.

That was a bit messy because previously, all graph drawing were made inside a transform (and under Qt, a Y-scale inversion). I removed that and made all point translation explicit in drawing code. That's a bit ugly, but I hope to make it look a bit better soon.
https://bitbucket.org/hsoft/moneyguru/changeset/3299b66d0d3b/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [aa94b3e0c0f5]) [#339] Cleaned up cocoa's chart interfaces now that all data-fetching-from-model methods aren't used anymore.

That removed quite a bit of cruft. MGGraph having become entirely irrelevant, could be removed.
https://bitbucket.org/hsoft/moneyguru/changeset/aa94b3e0c0f5/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [90a7e00bf5f1]) [#339] Minor chart drawing adjustments and code cleanup.
https://bitbucket.org/hsoft/moneyguru/changeset/90a7e00bf5f1/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [39dc0ce6e74d]) [#339] Merged the two pie charts in networth and profit view.

This one pie chart per view now manages the double-pie drawing logic. This lead to a lot of simplification on the Cocoa side, but it also required a lot of changes in the chart printing logic because the old logic of painting the view directly in the print view wouldn't work (it relied on NSView copying, which can't work since the drawing is now made in the core and that copying a view in Cocoa doesn't result in copying a chart in the core).
https://bitbucket.org/hsoft/moneyguru/changeset/39dc0ce6e74d/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [60ea2bb48e5b]) [#339] Fixed pie chart crashes when it tried to draw itself when it had no data to display.
https://bitbucket.org/hsoft/moneyguru/changeset/60ea2bb48e5b/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [7263344da746]) [#339] Fixed a visual glitch in Qt's pie slice drawing.
https://bitbucket.org/hsoft/moneyguru/changeset/7263344da746/

@hsoft

This comment has been minimized.

Owner

hsoft commented Jun 22, 2013

(from [b75f96ded49b]) [#339 state:fixed] Save and restore chart sizes.

Whew, that was a lot more work than I would have thought first...
https://bitbucket.org/hsoft/moneyguru/changeset/b75f96ded49b/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment