Sha256: 50699b033cac62bacd67cea3b93d45cd3dcd7d354c0c80ca290d07425ba58d73

Contents?: true

Size: 1.12 KB

Versions: 25

Compression:

Stored size: 1.12 KB

Contents

function addOne(ary, thing) {
  ary.push({ x: Date.now(), y: thing });
  if (ary.length > 100) {
    ary.shift();
  }
}

function add(data, full, live) {
  var total = full + live;
  addOne(data[0], full/total);
  addOne(data[1], live/total);
}

var data = [ [], [] ];
add(data, 1, 1);

var palette = new Rickshaw.Color.Palette( { scheme: 'spectrum2000' } );

palette.color();
palette.color();
palette.color();
palette.color();

var graph = new Rickshaw.Graph( {
  element: document.querySelector('#full_live_graph.stats .graph'),
  width: 900,
  height: 150,
  renderer: 'stack',
  offset: 'expand',
  series: [
    {
      color: palette.color(),
      data: data[0],
      name: 'Full'
    }, {
      color: palette.color(),
      data: data[1],
      name: 'Live'
    }
  ]
} );

var legend = new Rickshaw.Graph.Legend( {
	graph: graph,
	element: document.querySelector('#full_live_graph.stats .legend')
});

new Rickshaw.Graph.Behavior.Series.Highlight( {
	graph: graph,
	legend: legend
});

// new Rickshaw.Graph.HoverDetail( {
//  graph: graph
// });

updateNewFullLive = function(full, live) {
  add(data, full, live);
  graph.update();
};

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
picky-statistics-4.5.0 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.4.2 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.4.1 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.4.0 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.3.2 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.3.1 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.3.0 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.2.4 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.2.3 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.2.2 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.2.1 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.2.0 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.1.0 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.9 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.8 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.7 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.6 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.5 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.4 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.3 lib/picky-statistics/application/javascripts/full_live.js