Developed by: CZ.NIC

Latest version: OGRA Git repository

OGRA library

Example: Change URL of imported library

For using OGRA in offline mode you have to download all required graphical libraries of third parties and import them, before initialization of OGRA. OGRA is checking namespace for required libraries during it's initialization. If required names are not defined, OGRA will try to download all required libraries from preset URLs. You can also overrite these preset URLs.

HTML:

Import OGRA and create element for future chart.

<script type="text/javascript" src="https://gitlab.labs.nic.cz/labs/ogra/raw/master/ogra.js"></script>

<div id="my_chart"></div>

Javascript:

Prepare your data and create chart.

var data = {"cols":[{"label":"Year", "type":"string"},{"label":"Sales", "type":"number"},{"label":"Expenses", "type":"number"}],"rows":[{"c":[{"v":"2004"},{"v":1000},{"v":400}]},{"c":[{"v":"2005"},{"v":1170},{"v":460}]},{"c":[{"v":"2006"},{"v":660},{"v":1120}]},{"c":[{"v":"2007"},{"v":1030},{"v":540}]}]};			
	
// We want to use different version of jQuery.
Ogra.URL_JQUERY = "https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js";

/* Preset URLs
Ogra.URL_JQUERY ="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";
Ogra.URL_GOOGLE = "//www.google.com/jsapi";
Ogra.URL_DYGRAPHS = "//dygraphs.com/dygraph-combined.js";
Ogra.URL_HIGH = "//raw.github.com/highslide-software/highcharts.com/master/js/highcharts.src.js";
Ogra.URL_FLOT = "//raw.github.com/paradoxxxzero/flot/28f2377382b3af97c82cb3ebc081140b49fa9579/jquery.flot.js";
Ogra.URL_FLOT_PIE = "//raw.github.com/flot/flot/master/jquery.flot.pie.js";
*/

Ogra.graph("my_chart", data, "column", "high", {} );

Result:

Edit in jsFiddle

More examples


CZ.NIC

© 2013 CZ.NIC