ICC-Profile

 view release on metacpan or  search on metacpan

lib/ICC/Javascripts/rgraph/RGraph.svg.common.core.js  view on Meta::CPAN

            cx:    options.cx,
            cy:    options.cy,
            r:     options.r,
            angle: options.end
        });

        var diff = ma.abs(options.end - options.start);
        
        // Initial values
        var largeArc = '0';
        var sweep    = '0';

        //TODO Put various options here for the correct combination of flags to use
        if (!options.anticlockwise) {
            if (diff > RG.SVG.TRIG.PI) {
                largeArc = '1';
                sweep    = '1';
            } else {
                largeArc = '0';
                sweep    = '1';
            }
        } else {
            if (diff > RG.SVG.TRIG.PI) {
                largeArc = '1';
                sweep    = '0';
            } else {
                largeArc = '0';
                sweep    = '0';
            }
        }

        if (typeof options.lineto === 'boolean' && options.lineto === false) {
            var d = [
                "M", start.x, start.y,
                "A", options.r, options.r, 0, largeArc, sweep, end.x, end.y
            ];
        } else {
            var d = [
                "L", start.x, start.y,
                "A", options.r, options.r, 0, largeArc, sweep, end.x, end.y
            ];
        }

        if (options.array === true) {
            return d;
        } else {
            return d.join(" ");
        }
    };








    /**
    * This function gets the end point (X/Y coordinates) of a given radius.
    * You pass it the center X/Y and the radius and this function will return
    * the endpoint X/Y coordinates.
    * 
    * @param number cx    The center X coord
    * @param number cy    The center Y coord
    * @param number r     The length of the radius
    * @param number angle The anle to use
    */
    RG.SVG.TRIG.getRadiusEndPoint = function (opt)
    {
        // Allow for two arguments style
        if (arguments.length === 1) {

            var angle = opt.angle,
                r     = opt.r;

        } else if (arguments.length === 4) {

            var angle = arguments[0],
                r     = arguments[1];
        }

        var x = ma.cos(angle) * r,
            y = ma.sin(angle) * r;

        return [x, y];
    };








    /**
    * This function draws the title. This function also draws the subtitle.
    */
    RG.SVG.drawTitle = function (obj)
    {
        var prop                   = obj.properties,
            valign                 = 'bottom',
            originalTitleX         = prop.titleX,
            originalTitleY         = prop.titleY,
            originalTitleSubtitleX = prop.titleSubtitleX,
            originalTitleSubtitleY = prop.titleSubtitleY;
        
        if (typeof originalTitleX === 'string')         originalTitleX.replace(/^\+/,'');
        if (typeof originalTitleY === 'string')         originalTitleY.replace(/^\+/,'');
        if (typeof originalTitleSubtitleX === 'string') originalTitleSubtitleX.replace(/^\+/,'');
        if (typeof originalTitleSubtitleY === 'string') originalTitleSubtitleY.replace(/^\+/,'');

        //
        // The Pie chart title should default to being above the centerx
        //
        if (obj.type === 'pie') {
            if (RG.SVG.isNull(prop.titleX)) {
                prop.titleX         = obj.centerx;
                prop.titleSubtitleX = obj.centerx;
            }

            if (RG.SVG.isNull(prop.titleY)) {



( run in 0.933 second using v1.01-cache-2.11-cpan-524268b4103 )