getArguments: function()

in jspwiki-war/src/main/scripts/behaviors/GraphBar.js [152:197]


    getArguments: function( args ){

        var options = this.options,
            p, min, max, size;

        args = args.split("-");
        options.barName = args.shift(); //first param is optional barName
        min = options.offset;
        max = min + options.size;

        while( args.length ){

            p = args.shift().toLowerCase();

            if( p == "vertical" ){ options.isHorizontal = false; }
            else if( p == "gauge" ){ options.isGauge = true; }
            else if( p == "progress" ){ options.isProgress = true; }
            else if( p == "inside" ){ options.textInside = true; }

            else if( p == "striped" ){ options.gbGroup += "." + p; }
            else if( p == "active" ){ options.gbGroup += ".striped." + p; }
            else if( p.test(/success|info|warning|danger/ )){ options.gbBar += ".progress-bar-" + p; }

            else if( !p.indexOf("minv") /*index==0*/){ options.minv = p.slice(4).toInt(); }
            else if( !p.indexOf("maxv") /*index==0*/){ options.maxv = p.slice(4).toInt(); }

            else if( !p.indexOf("min") /*index==0*/){ min = p.slice(3).toInt(); }
            else if( !p.indexOf("max") /*index==0*/){ max = p.slice(3).toInt(); }
            else if( p != "" ){

                p = new Color(p);
                if( p.hex ){
                    if( !options.color1 ){ options.color1 = p; }
                    else if( !options.color2 ){ options.color2 = p; }
                }

            }
        }

        size = max - min;
        options.offset = (size > 0) ? min : max;
        options.size = size.abs();
        //console.log(max, min,size,options)

        return options;
    },