Skip to content

Instantly share code, notes, and snippets.

@tonysm
Created May 23, 2012 16:31
Show Gist options
  • Save tonysm/2776233 to your computer and use it in GitHub Desktop.
Save tonysm/2776233 to your computer and use it in GitHub Desktop.
var line = new RGraph.Line('chart1', charts.data);
line.Set('chart.labels', this.labels);
line.Set('chart.linewidth', 3);
line.Set('chart.key', charts.keys);
line.Set('chart.colors', charts.colors);
line.Set('chart.contextmenu', [
['Zoom', RGraph.Zoom],
['Edit', function(){
RGraph.Reset( line.canvas );
RGraph.Clear( line.canvas );
RGraph.ObjectRegistry.Clear( line.canvas );
line.Set('chart.annotatable', !(line.Get('chart.annotatable')));
line.Draw();
}],
['Colors', RGraph.Showpalette],
['Clear', function () {
RGraph.Reset( line.canvas );
RGraph.Clear( line.canvas );
RGraph.ObjectRegistry.Clear( line.canvas );
line.Draw();
}]
]);
line.Set('chart.zoom.hdir', 'left');
line.Set('chart.zoom.factor', 1.3);
line.Set('chart.scale.formatter', comparativoAnoFormatter);
line.Set('chart.outofbounds', true);
line.Set('chart.zoom.vdir', 'left');
line.Set('chart.title', '');
line.Set('chart.gutter.right', 20);
line.Set('chart.gutter.left', 50);
line.Set('chart.gutter.bottom', 20);
line.Set('chart.background.grid.autofit', true);
line.Draw();
var element = document.getElementById('chart2');
...
var bar2 = new RGraph.Bar('chart2', realizados);
bar2.Set('chart.colors', ['#8EBCDA']);
bar2.Set('chart.strokestyle', 'rgba(0,0,0,0)');
bar2.Set('chart.noendxtick', true);
bar2.Set('chart.gutter.left', 50);
bar2.Set('chart.labels', labels);
bar2.Set('chart.tooltips', labelsRealizado);
var line = new RGraph.Line('chart2', previstos);
line.Set('chart.tickmarks', 'circle');
line.Set('chart.colors', ['#15428B']);
line.Set('chart.contextmenu', [
['Zoom', RGraph.Zoom],
['Edit', function(){
RGraph.Reset( element );
RGraph.Clear( element );
RGraph.ObjectRegistry.Clear( element );
line.Set('chart.annotatable', !(line.Get('chart.annotatable')));
combo.Draw();
}],
['Clear', function () {
RGraph.Reset( element );
RGraph.Clear( element );
RGraph.ObjectRegistry.Clear( element );
combo.Draw();
}]
]);
line.Set('chart.zoom.hdir', 'center');
line.Set('chart.annotatable', false);
line.Set('chart.scale.formatter', comparativoAnoFormatter);
line.Set('chart.zoom.vdir', 'center');
line.Set('chart.linewidth', 5);
line.Set('chart.tooltips', labelsPrevisto);
var combo = new RGraph.CombinedChart(bar2, line);
combo.Draw();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment