Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

X-Y Graphs with GUI Composer

Hi,

I want to plot an X-Y graph with 3 series on GUI composer. From what I see, the Scatter Plot graph can only go up to 2 series? Is there a way to bypass this limitation?

Thanks,

Myriam

  • Hi Myriam,

    All the resources in GUI composer are limited and cannot be further modified by the user (until introduced by TI themselves).

    Regards,

    Gautam

  • Hi Myriam,

    To workaround the UI limitation, you can create two GUI Vars and have them bind to your target arrays. In the onPropertyChanged handler of the two GUI Vars, add these two javascript calls to update the graph.

    Note that _setSeriesN is an internal function and can change for future version of the GC library.

    function onArray3_xPropertyChanged( propertyName, newValue, oldValue) {
    dijit.byId('SP_Widget')._setSeriesN(newValue, 2, true);
    }

    function onArray3_yPropertyChanged( propertyName, newValue, oldValue) {
    dijit.byId('SP_Widget')._setSeriesN(newValue, 2, false);
    }

    SP_Widget is the ID of your graph widget. The last argument (true/false) is to specify the x array and y array.

    Regards,
    Patrick

  • Hi Patrick,

    The graph itself does not seem to work, even before I do the modification. What variable type does it take? I have tried with floats and integers. I cannot manage to plot any series. However, when I look into the debugger, the variables my gaph is binded to have the correct values. 

    Would you have any idea of why it is doing that?

    Thanks,

    Myriam

  • Each series of the x-y graph accept 2 integer arrays.

    Patrick

  • Hi Patrick,

    I am now able to plot two arrays, but I get the following message when I try to run the code with the GUI variables binded to the graph to get the third serie:

    Error: File:/gc/maqetta_preview/Interface/InterfaceGraphiqueSource.json
    ReferenceError: onArray3yPropertyChanged is not defined

    What did I do wrong?

    Here is the code for my GUI variables: 

    /*
    * This file is provided for custom JavaScript logic that your HTML files might need.
    * GUI Composer includes this JavaScript file by default within HTML pages authored in GUI Composer.
    */
    require(["dojo/ready"], function(ready){
    ready(function(){
    // logic that requires that Dojo is fully initialized should go here

    });
    });

    function onArray3yPropertyChanged( propertyName, newValue, oldValue) {
    // var t = $TI.GUIVars;
    // get value from another GUI variable
    // var v2 = t.getValue('prop2');
    // var v3 = newValue + v2;
    //
    // set value to another GUI variable
    // t.setValue('prop3', v3);
    //
    // set value to a widget
    // dijit.byId('widget1').set('checked', v3);
    dijit.byId('widget_216')._setSeriesN(newValue, 2, false);
    }

    function onArray3xPropertyChanged( propertyName, newValue, oldValue) {
    // var t = $TI.GUIVars;
    // get value from another GUI variable
    // var v2 = t.getValue('prop2');
    // var v3 = newValue + v2;
    //
    // set value to another GUI variable
    // t.setValue('prop3', v3);
    //
    // set value to a widget
    // dijit.byId('widget1').set('checked', v3);
    dijit.byId('widget_216')._setSeriesN(newValue, 2, true);
    }

    And here is the section of the .json file

    {
    "propertyName": "Array3y",
    "serverBindName": "yc",
    "widgetId": "prop",
    "options": {
    "onPropertyChanged": "onArray3yPropertyChanged",
    "dataType": "Long"
    }
    },


    {
    "propertyName": "Array3x",
    "serverBindName": "xc",
    "widgetId": "prop",
    "options": {
    "onPropertyChanged": "onArray3xPropertyChanged",
    "dataType": "Long"
    }
    }
    ]}

    Thanks,

    Myriam

  • I found a way to use only 2 arrays finally. Thanks!

  • Hi, 

    I need the answer to this second question as well. I am seeing the same issue "JSON File Error" with a text widget. 

    Thanks, 

    -Randy