Results 1 to 5 of 5

Thread: Charts

  1. #1
    Junior Member
    Join Date
    Jul 2015
    Posts
    12

    Charts

    I am looking for an explanation or tutorial on using charts. I am trying to create a vertical bar chart based on table from a virtual table.

    In the demo apps, there is demo app for charts. In that demo the chart has a data panel that I don't seem to get in my test app. I assume I am doing something wrong. [I created a web app and desktop app to test if that was the issue; it was not]

    So, in a web app how do I create a chart with dynamic data from a vt_table?

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,181
    Blog Entries
    22
    You can use {...} macros in many places where you would normally specify a comma separated list of values. This {...} macro can contain a custom procedure that is called to substitute the value returned from it. Typically in the case of charts it should return a comma separated list.

    e.g.

    {getSomeData(args,...)}

    These {...} macros can be also specified as part of page headers, section headers, section footers etc.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Junior Member
    Join Date
    Jul 2015
    Posts
    12
    Followup to that is.... What are macros? Is there somewhere that explains them? I couldn't find anything. I see in the scripting primer that functions can call macros. But I don't see anywhere that defines macros. Are they commands?

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,181
    Blog Entries
    22
    Just search for "macros" in the advanced search at the top left of the forums.

    Macros are not commands. They are used to substitute expressions into an attribute.

    For example.

    Let's say you have a section header caption like this.

    Customer is {customers.name}

    Then as the section header is updated as you navigate between records the caption will display the current customer name.

    These {...} macros can be used in the attributes for UI elements so that the value is dynamic and context sensitive to the current data you are viewing.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  5. #5
    Junior Member
    Join Date
    Jul 2015
    Posts
    12
    So what I think I have learned is that macros are custom functions that the developer creates.

    An Example:
    Section type is chart. (If it is a gadget, the gadget inherits the function file from the section itself.)
    Under Settings
    Choose your scripting language of choice
    Find the custom library field. Click the ellipses.
    It will create file called something like lib_{PAGENAME]_section2.js or lib_{PAGENAME]_section2.prg

    in that file create a function. For example

    function myData(){
    strData = "1,2,3,4,5";
    return strData;
    }

    This will create a function that returns "1,2,3,4,5"

    In the field where you want to use that data, for example as the Data of the chart or maybe the title,
    enter {myData()}

    If it is working, you will see the chart change itself. If the chart disappears or the title changes to {myData()} it is because it can't find the function or something is wrong with the function.

    I had better success using files that ended in .prg regardless of the scripting language used. I don't know why.

    That is what I have learned so far. Hope it helps.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us