1 Reply Latest reply on Dec 7, 2017 4:35 AM by drichter RSS
    drichter Explorer

    Rickshaw Widget error in Combined.7.2.1-b71.20160815.034519.00564.js

    Hey guys,

     

    I try to implement a widget which will use rickshaw. My widget is realy simple currently:

     

    TW.Runtime.Widgets.simpleRickshaw = function () {
    
        this.renderHtml = function () {
            
            var rickshowCode = this.getProperty("RickshawCode");
    
            var html =  '<div class="widget-content widget-simpleRickshaw">' +
                            '<script type="text/javascript" src="../Common/extensions/iSAX_Rickshaw/ui/simpleRickshaw/include/d3/d3.min.js"></script>' +
                            '<script type="text/javascript" src="../Common/extensions/iSAX_Rickshaw/ui/simpleRickshaw/include/rickshaw/rickshaw.min.js"></script>' +
                            '<link type="text/css" href="../Common/extensions/iSAX_Rickshaw/ui/simpleRickshaw/include/rickshaw/rickshaw.min.css" />' +
    
                            '<div id="chart"></div>' +
    
                            '<script>' +
                                rickshowCode +
                            '</script>' +
                        '</div>';
    
            TW.log.debug("html:" + html);
    
            return html;
        };
    
        this.afterRender = function() {
    
        };
    
        this.updateProperty = function(){
    
        };
    
        TW.log.debug("simpleRickshaw");
    
    };
    

     

     

    RickshowCode is a property of the widget where I insert the sample code of rickshaw:

     

    var graph = new Rickshaw.Graph( {
        element: document.querySelector("#chart"), 
        width: 300, 
        height: 200, 
        series: [{
            color: 'steelblue',
            data: [ 
                { x: 0, y: 40 }, 
                { x: 1, y: 49 }, 
                { x: 2, y: 38 }, 
                { x: 3, y: 30 }, 
                { x: 4, y: 32 } ]
        }]
    });
    
    graph.render();
    

     

     

    If I test the widget with this code, I get an error in log:

     

    15:35:15 INFO - trying to delete TW.mashupCache[mashupName]

    15:35:15 INFO - deleted TW.mashupCache[mashupName] 

    15:35:16 DEBUG - simpleRickshaw 

    15:35:16 DEBUG - html:<div class="widget-content widget-simpleRickshaw"><script type="text/javascript" src="../Common/extensions/iSAX_Rickshaw/ui/simpleRickshaw/include/d3/d3.min.js"></script><script type="text/javascript" src="../Common/extensions/iSAX_Rickshaw/ui/simpleRickshaw/include/rickshaw/rickshaw.min.js"></script><link type="text/css" href="../Common/extensions/iSAX_Rickshaw/ui/simpleRickshaw/include/rickshaw/rickshaw.min.css" /><div id="chart"></div><script>var graph = new Rickshaw.Graph({ series: [ { data: [ { x: 0, y: 2 }, { x: 1, y: 4 }, { x: 2, y: 4 }]}], renderer: 'area', element: document.querySelector('#chart') }); graph.render();</script></div> 

    15:35:16 ERROR - An error occurred while calling simpleRickshaw::renderHtml, Id = "simpleRickshaw-17". Exception: nodes[0] is undefined on line number 3 in file Combined.7.2.1-b71.20160815.034519.00564.js line 634 > eval

     

    Line 3 is the starting point of the combined...js and line 634 is the first line of jquery-1.11.0.min.js.

     

    I'm not realy sure what the problem is and how to fix it.