Skip to content

Commit

Permalink
#48 setting group as axis through _findGroups
Browse files Browse the repository at this point in the history
  • Loading branch information
tracend committed Jul 20, 2013
1 parent d6c0c09 commit d373029
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 20 deletions.
4 changes: 2 additions & 2 deletions build/cloudvisio-min.js

Large diffs are not rendered by default.

33 changes: 24 additions & 9 deletions build/cloudvisio.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @name cloudvisio - 0.6.0 (Sat, 20 Jul 2013 08:39:29 GMT)
// @name cloudvisio - 0.6.0 (Sat, 20 Jul 2013 20:10:26 GMT)
// @url https://github.com/makesites/cloudvisio

// @author makesites
Expand Down Expand Up @@ -676,14 +676,6 @@ Cloudvisio.prototype.group = function(){
// update the existing data
this.data( data[i], opt);
}
// check if the selected layout "needs" a group
var axis = this.axis();
if( axis.group === false ){
// select the query key as the group axis
this.axis(id);
this._axis.group = id;
}


/*
// reset models if needed
Expand Down Expand Up @@ -1479,6 +1471,8 @@ Cloudvisio.prototype.update = function(){
Cloudvisio.prototype.ready = function( layout ){
// fallback (not needed?)
//layout = layout || this.options.layout;
// check if the selected layout "needs" a group
this._findGroups();
// process query amounts
this.amount();
// prerequisite - we need to have some data set...
Expand Down Expand Up @@ -1615,6 +1609,27 @@ Cloudvisio.prototype._findType = function( key, data ){
return type;
};

// get the type of the selected field
Cloudvisio.prototype._findGroups = function( key, data ){

var axis = this.axis();
var queries = this.queries();
// first see if we have a group "need"
if( axis.group === false ){
for( var i in queries ){
if(queries[i].type == "group"){
// select the query key as the group axis
this.axis(i);
this._axis.group = i;
// one group is enough?
break;
}
}
}

};


// define the color spectrum
Cloudvisio.prototype.colors = function( colors ){
if (!arguments.length) return this.options.colors;
Expand Down
8 changes: 0 additions & 8 deletions lib/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ Cloudvisio.prototype.group = function(){
// update the existing data
this.data( data[i], opt);
}
// check if the selected layout "needs" a group
var axis = this.axis();
if( axis.group === false ){
// select the query key as the group axis
this.axis(id);
this._axis.group = id;
}


/*
// reset models if needed
Expand Down
24 changes: 23 additions & 1 deletion lib/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Cloudvisio.prototype.update = function(){
Cloudvisio.prototype.ready = function( layout ){
// fallback (not needed?)
//layout = layout || this.options.layout;
// check if the selected layout "needs" a group
this._findGroups();
// process query amounts
this.amount();
// prerequisite - we need to have some data set...
Expand Down Expand Up @@ -171,4 +173,24 @@ Cloudvisio.prototype._findType = function( key, data ){
type = itype;
}
return type;
};
};

// get the type of the selected field
Cloudvisio.prototype._findGroups = function( key, data ){

var axis = this.axis();
var queries = this.queries();
// first see if we have a group "need"
if( axis.group === false ){
for( var i in queries ){
if(queries[i].type == "group"){
// select the query key as the group axis
this.axis(i);
this._axis.group = i;
// one group is enough?
break;
}
}
}

};

0 comments on commit d373029

Please sign in to comment.