Вход Регистрация
Файл: templates/backend/default/assets/plugins/jquery-ricksaw-chart/js/Rickshaw.Graph.Axis.X.js
Строк: 77
<?php
Rickshaw
.namespace('Rickshaw.Graph.Axis.X');

Rickshaw.Graph.Axis.= function(args) {

    var 
self this;
    var 
berthRate 0.10;

    
this.initialize = function(args) {

        
this.graph args.graph;
        
this.orientation args.orientation || 'top';

        
this.pixelsPerTick args.pixelsPerTick || 75;
        if (
args.ticksthis.staticTicks args.ticks;
        if (
args.tickValuesthis.tickValues args.tickValues;

        
this.tickSize args.tickSize || 4;
        
this.ticksTreatment args.ticksTreatment || 'plain';

        if (
args.element) {

            
this.element args.element;
            
this._discoverSize(args.elementargs);

            
this.vis d3.select(args.element)
                .
append("svg:svg")
                .
attr('height'this.height)
                .
attr('width'this.width)
                .
attr('class''rickshaw_graph x_axis_d3');

            
this.element this.vis[0][0];
            
this.element.style.position 'relative';

            
this.setSize({ widthargs.widthheightargs.height });

        } else {
            
this.vis this.graph.vis;
        }

        
this.graph.onUpdate( function() { self.render() } );
    };

    
this.setSize = function(args) {

        
args args || {};
        if (!
this.element) return;

        
this._discoverSize(this.element.parentNodeargs);

        
this.vis
            
.attr('height'this.height)
            .
attr('width'this.width * (berthRate));

        var 
berth Math.floor(this.width berthRate 2);
        
this.element.style.left = -berth 'px';
    };

    
this.render = function() {

        if (
this.graph.width !== this._renderWidththis.setSize({ autotrue });

        var 
axis d3.svg.axis().scale(this.graph.x).orient(this.orientation);
        
axis.tickFormatargs.tickFormat || function(x) { return } );
        if (
this.tickValuesaxis.tickValues(this.tickValues);

        
this.ticks this.staticTicks || Math.floor(this.graph.width this.pixelsPerTick);

        var 
berth Math.floor(this.width berthRate 2) || 0;
        var 
transform;

        if (
this.orientation == 'top') {
            var 
yOffset this.height || this.graph.height;
            
transform 'translate(' berth ',' yOffset ')';
        } else {
            
transform 'translate(' berth ', 0)';
        }

        if (
this.element) {
            
this.vis.selectAll('*').remove();
        }

        
this.vis
            
.append("svg:g")
            .
attr("class", ["x_ticks_d3"this.ticksTreatment].join(" "))
            .
attr("transform"transform)
            .
call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(this.tickSize));

        var 
gridSize = (this.orientation == 'bottom' : -1) * this.graph.height;

        
this.graph.vis
            
.append("svg:g")
            .
attr("class""x_grid_d3")
            .
call(axis.ticks(this.ticks).tickSubdivide(0).tickSize(gridSize));

        
this._renderHeight this.graph.height;
    };

    
this._discoverSize = function(elementargs) {

        if (
typeof window !== 'undefined') {

            var 
style window.getComputedStyle(elementnull);
            var 
elementHeight parseInt(style.getPropertyValue('height'), 10);

            if (!
args.auto) {
                var 
elementWidth parseInt(style.getPropertyValue('width'), 10);
            }
        }

        
this.width = (args.width || elementWidth || this.graph.width) * (berthRate);
        
this.height args.height || elementHeight || 40;
    };

    
this.initialize(args);
};
?>
Онлайн: 2
Реклама