Skip to content

Instantly share code, notes, and snippets.

@jzaefferer
Created May 22, 2012 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jzaefferer/5552abdf24227e5f7cb6 to your computer and use it in GitHub Desktop.
Save jzaefferer/5552abdf24227e5f7cb6 to your computer and use it in GitHub Desktop.
var graph = new Rickshaw.Graph( {
element: document.querySelector("#boxes-stats"),
renderer: 'area',
stroke: true,
width: $("ul.content-listing").width() - 20,
height: 400,
max: yMax,
padding: {
top: 0.05,
bottom: 0.05
},
series: [{
color: '#48c019',
data: dataBoxesFree,
name: 'free Process'
}, {
color: '#f98508',
data: dataBoxes,
name: 'Processes'
}]
});
graph.render();
//Update graph size on windows resize
$(window).off('resize.graph').on('resize.graph', function() {
graph.update({
width: $("li.edit-billing").width(),
height: 400
});
var slider = new Rickshaw.Graph.RangeSlider({
graph: graph,
element: $('#slider')
});
});
var hoverDetail = new Rickshaw.Graph.HoverDetail( {
graph: graph,
yFormatter: function(y) {
if (y > 1) {
return y + 1;
} else {
return y;
}
}
});
var yAxis = new Rickshaw.Graph.Axis.Y({
graph: graph,
tickFormat: function(y) {
if (y < 1 && y !== 0) {
y = '';
}
return y;
}
});
yAxis.render();
var xAxis = new Rickshaw.Graph.Axis.Time({
graph: graph
});
xAxis.render();
var slider = new Rickshaw.Graph.RangeSlider({
graph: graph,
element: $('#slider')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment