added return jqplot to client to add/remove attributes. Added animation after redraw

@TODO: Write a "The Jit" wrapper too
master
Steve L. Nyemba 9 years ago
parent 73c9f26efb
commit c0dcf5132d

@ -1,9 +1,11 @@
/** /**
* This is a charting wrapper, it is designed to simplify the interface to d3 * This is a charting wrapper, it is designed to simplify the interface to d3
* dependencies: * dependencies:
* - jqplot.js charting library http://d3js.org for documentation and more * - jqplot.js charting library http://jqplot.org for documentation and more
* - utils.js has utilities and design patterns used for internal purposes * - utils.js has utilities and design patterns used for internal purposes
* - dom.js creates legend objects * - dom.js creates legend objects
*
* @TODO: Find a way to mix & match charts. Some people think it's visually appealing.
*/ */
if(!jx){ if(!jx){
@ -58,6 +60,7 @@ jx.jqplot.init = function(){
jx.jqplot.line = {} jx.jqplot.line = {}
jx.jqplot.line.options= function(){ jx.jqplot.line.options= function(){
var options = { var options = {
animateReplot:true,
series:[{showMarker:true}], series:[{showMarker:true}],
grid:{ grid:{
drawGridLines:false, drawGridLines:false,
@ -113,13 +116,14 @@ jx.jqplot.line.render = function(id,series,labels,lnames){
options.legend.placement = 'outsideGrid' options.legend.placement = 'outsideGrid'
options.series = lnames; options.series = lnames;
} }
$.jqplot(id,series,options) return $.jqplot(id,series,options)
} }
jx.jqplot.bar = {} jx.jqplot.bar = {}
jx.jqplot.bar.options = function(){ jx.jqplot.bar.options = function(){
var options = { var options = {
animateReplot:true,
grid:{ grid:{
background:'white', background:'white',
drawGridLines:false, drawGridLines:false,
@ -180,7 +184,7 @@ jx.jqplot.bar.render = function(id,series,labels,lnames){
options.axes.xaxis.ticks = labels ; options.axes.xaxis.ticks = labels ;
options.legend.show = true options.legend.show = true
options.series = lnames; options.series = lnames;
$.jqplot(id, series,options) return $.jqplot(id, series,options)
} }
jx.jqplot.stackedBar = {} jx.jqplot.stackedBar = {}
@ -195,13 +199,14 @@ jx.jqplot.stackedBar.render = function(id,series,label,lnames){
options.stackSeries= true, options.stackSeries= true,
// options.seriesDefaults.label = lnames[0]; // options.seriesDefaults.label = lnames[0];
options.seriesDefaults.pointLabels.show= false; options.seriesDefaults.pointLabels.show= false;
$.jqplot(id, series,options) return $.jqplot(id, series,options)
} }
jx.jqplot.donut = {} jx.jqplot.donut = {}
jx.jqplot.donut.options= function(){ jx.jqplot.donut.options= function(){
var options = { var options = {
animateReplot:true,
grid:{ grid:{
drawGridLines:false, drawGridLines:false,
background:'transparent', background:'transparent',
@ -231,5 +236,5 @@ jx.jqplot.donut.options= function(){
jx.jqplot.donut.render = function(id,series){ jx.jqplot.donut.render = function(id,series){
jx.dom.set.value(id,'') jx.dom.set.value(id,'')
var options = jx.jqplot.donut.options() ; var options = jx.jqplot.donut.options() ;
$.jqplot(id,series,options) return $.jqplot(id,series,options)
} }

Loading…
Cancel
Save