Adding new graphs

Max Spivak's Avatar

Max Spivak

01 May, 2017 06:12 AM

I'm writing an extension that shows a graph of all credit card monthly balances for some timeframe, say a year going back. Is there a way to add a new graph in the Graphs & Reports section?

Thx,
Max

  1. Support Staff 1 Posted by Henry on 02 May, 2017 07:09 PM

    Henry's Avatar

    Hi Max,

    You are able to change and memorize a graph and you will have it in the graphs & reports section. More on that here.

    Henry
    Infinite Kind Support

  2. 2 Posted by dwg on 02 May, 2017 10:38 PM

    dwg's Avatar

    Henry,

    I believe that Max would like to add graphs that his extension generates to the side bar, not a modified version of the existing inbuilt graph.

  3. 3 Posted by Max Spivak on 03 May, 2017 06:14 AM

    Max Spivak's Avatar

    Hi Henry,

    My extension generates its own custom graph. I would like to add it to the side bar among the provided graphs. Is this possible?

    Thx,
    Max

  4. Support Staff 4 Posted by Sean Reilly on 03 May, 2017 11:14 AM

    Sean Reilly's Avatar

    Hi Max,

    We don't have an official API for this (though we should!) but it may be possible, even if difficult. You can try registering an entry for a "memorised" instance of your graph in the same way that the built-in graph/report code does it. The sidebar items are based on a ReportSpec object (http://infinitekind.com/dev/apidoc/com/infinitekind/moneydance/mode...) which you can create and setup with the class name for your graph as well as the settings/parameters. Your graph generator will need to subclass com.moneydance.apps.md.view.gui.GraphReportGenerator which is probably the trickiest part as that isn't a part of the public API. Once you have your GraphReportGenerator subclass that returns a GraphSet object from the generate() method, you create a ReportSpec to reference it. Then on that ReportSpec object do the following:

    • call setParameter("rpt_gen", yourClassName) where yourClassName is the full package and name of your GraphReportGenerator subclass.
    • call setMemorized(true)
    • call setName("whatever you like")
    • call setReportParameters(SyncRecord parameters) with the parameters that should be passed to your GraphGreportGenerator (things like date ranges, etc) when it is invoked

    when finished, call .syncItem() on your report spec and it should automatically appear in the sidebar.

    Hope this works!

    Sean Reilly
    Developer, The Infinite Kind
    http://infinitekind.com

  5. 5 Posted by Max Spivak on 03 May, 2017 04:35 PM

    Max Spivak's Avatar

    Thank you. I will try this.

    ///Max

  6. Henry closed this discussion on 28 May, 2017 01:13 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac