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.0.2 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.1 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.0 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.0pre6 lib/picky-statistics/application/javascripts/full_live.js
picky-statistics-4.0.0pre5 lib/picky-statistics/application/javascripts/full_live.js