render: function(selector) {
    this._element = slick.find(selector);
    var outerWidth = this._element.offsetWidth;
    this._width = outerWidth - this._hMargin * 2;
    this._height = this._aspect * outerWidth - this._vMargin * 2;
    dom.setAttribute(this._element, "style", "height:" + this._aspect * outerWidth + "px;");
    
    this._x = d3.scale.ordinal()
      .domain(this._series.times())
      .rangeRoundBands([0, this._width], 0.1);
    
    this._axisX = d3.time.scale()
      .range([0, this._width])
      .domain([this._series.startTime(), this._series.endTime()]);
    
    this._y = d3.scale.linear()
      .range([0, this._height])
      .domain([0, 1]);

    this._axisY = d3.scale.linear()
      .range([0, this._height])
      .domain([1, 0]);

    this._svg = d3.select(this._element).append("svg")
      .attr("width", this._width + 2 * this._hMargin)
      .attr("height", this._height + 2 * this._vMargin)
      .append("g")
      .attr("transform", "translate(" + this._hMargin + "," + this._vMargin + ")");

    this._container = this._svg.append("g");

    this._renderAxes();
    this._renderChunks();
  },
  render: function(selector) {
    this._element = slick.find(selector);
    var outerWidth = this._element.offsetWidth;
    this._width = outerWidth - this._hMargin * 2;
    this._height = this._aspect * outerWidth - this._vMargin * 2;
    dom.setAttribute(this._element, "style", "height:" + this._aspect * outerWidth + "px;");

    this._x = d3.time.scale()
      .range([0, this._width])
      .domain([this._series.startTime(), this._series.endTime()]);

    this._y = d3.scale.linear()
      .range([0, this._height])
      .domain([this._series.maxOfSeries().value(), 0]);

    this._svg = d3.select(this._element).append("svg")
      .attr("width", this._width + 2 * this._hMargin)
      .attr("height", this._height + 2 * this._vMargin)
      .append("g")
      .attr("transform", "translate(" + this._hMargin + "," + this._vMargin + ")");

    this._container = this._svg.append("g");

    this._renderAxes();
    this._renderLine();
    if(this._points) this._renderPoints();
    if(this._mouseOver) this._setupListeners();
  },
  render: function(selector) {
    this._element = slick.find(selector);
    var width = this._element.offsetWidth;
    var height = this._scale * width;
    dom.setAttribute(this._element, "style", "height:" + height  + "px;");
    this._yScale = this._yScale.range([0, height]);

    var svg = d3.select(this._element).append("svg")
      .attr("width", width)
      .attr("height", height)
      .append("g");
    var barWidth =  width / this._statistics.size() - this._margin;
    var bar = svg.selectAll(".bar")
      .data(this._statistics.series())
      .enter().append("g")
      .attr("transform", bind(this, function(d, i) { 
        return "translate(" + i * (barWidth + this._margin) + ",0)";
      }));
    
    bar.append("rect")
      .attr("y", bind(this, function(d) { return height - this._yScale(d.value()); }))
      .attr("height", bind(this, function(d) { return this._yScale(d.value()); }))
      .attr("width", barWidth)
      .attr("fill", function(d) { return d.color(); });
  }
 _showBackButton: function() {
   var backButtonContainer = slick.find(this._backButtonSelector);
   var link = document.createElement("a");
   dom.text(link, "\u00AB Back");
   dom.setAttribute(link, "href", "#");
   events.on(link, "click", bind(this, function(event) {
     event.preventDefault(); 
     this._app.sendMessage("countrySelected", null);
   }));
   backButtonContainer.appendChild(link);
 },
 names.forEach(function (name) {
     dom.setAttribute(match, name, value);
 });
 getMatches(el, selector).forEach(function (match) {
     dom.setAttribute(match, binding.name, value);
 });
Esempio n. 7
0
 _closeToggleMenu: function(){
     dom.setAttribute(this.header, 'style', '');
     dom.removeClass(this.header, 'Header--open');
     TweenMax.to(window, 1, {scrollTo:{y:0}});
 },
function setAttributes(el, attrs) {
    for (var name in attrs) {
        dom.setAttribute(el, name, attrs[name]);
    }
}