Please remember that this library is under heavy development. What does that mean? Well, some functions work differently than others, some important features are missing, some functions have restrictions. If you have wishes for the library or ideas, please do not wait and contact me at grillen at abendstille dot at.
erm... sorry for the ugly layout. i allready asked a friend of mine to give it a nice style...
This document intends to be a Tutorial and an API to learn how to use the OFC-JS-Library. But sorry, i have to commit, i have not so much time left atm, so the api has to wait. i posted some examples, if you have other questions please read the js-files - i tried to do good comments in JavaDoc-style... ok - they may be not consistent but they exist for _every_ method.
To use the JS-library you have to make sure 3 golden rules:
The last four depend on what types you want to use. Look inside data.js to see what all of them can and inside the specific class to se what you can do with the different charttypes. Sorry for the time beeing i had no time for writing classes for HLC and Scatter. If you want to make a dotted line you take Line.js.
var o = OFC.getChart('chart');
o.emptyDataList();
o.xlabels = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m"];
o.set('y_max', 9);
var b = new Bar();
b.values = [1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3];
var c = new Bar('fade');
c.values = [3, 4, 8, 5, 7, 1, 2, 3, 1, 6, 4, 4, 3];
o.addData(b);
o.addData(c);
o.redraw(); var o = OFC.getChart('chart');
// 3d, fill, glass, fade can go here or nothing
var b = new Bar('3d');
b.xAxis3D = 5;
o.convertAll(b);
o.redraw() var o = OFC.getChart('chart');
// hollow, dot can go here or nothing
var l = new Line('hollow');
o.convert(o.getData(0), l);
o.redraw() var o = new OFC('chart');
// hash access to colors:
o.colorScheme.set('background', '#FFFFFF'); // background
o.colorScheme.set('text', '#000000'); // labels and text
o.colorScheme.set('axis', '#000000'); // axis color
o.colorScheme.set('grid', '#330000'); // grid color
// WARNING: this depends on the type!
var d = o.getData(0);
switch (d.getType()) {
case 'area': // line and area allowed
case 'line': // line allowed
case 'pie': // line and labels allowed
// data is also allowed, but its an array!
d.colors.set('line', '#33CCFF');
break;
case 'bar': // inner and border allowed
d.colors.set('inner', '#33CCFF');
break;
}
o.redraw() var o = OFC.getChart('chart');
o.setTitle('The power of OFC', '{font-size:20px; color:#FF0000}');
o.setLegend('x', 'in the morning...', 10, '#CC0000');
o.setLegend('y', "you won't\r\nremember a thing...", 10, '#0000CC');
o.redraw()