Skip to content

Commit

Permalink
basic setup for row/col
Browse files Browse the repository at this point in the history
  • Loading branch information
kanitw committed Nov 29, 2014
1 parent 500d289 commit 39034c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -179,7 +179,7 @@

// controls for each visual encoding variable
var ctrl = main.selectAll("div.enc")
.data(["x","y","size","color","alpha","shape","text"])
.data(["x","y","row","col","size","color","alpha","shape","text"])
.enter().append("div").attr("class", "enc");

ctrl.append("span").attr("class","label").text(function(d) { return d; });
Expand Down
16 changes: 14 additions & 2 deletions src/vegalite.js
Expand Up @@ -22,6 +22,8 @@ var INDEX = "index";

var X = "x";
var Y = "y";
var ROW = "row";
var COL = "col";
var SIZE = "size";
var SHAPE = "shape";
var COLOR = "color";
Expand Down Expand Up @@ -442,6 +444,16 @@ function scale_range(s, enc) {
s.round = true;
s.nice = true;
break;
case ROW:
s.bandWidth = enc.config("rowHeight");
s.round = true;
s.nice = true;
break;
case COL:
s.bandWidth = enc.config("colWidth");
s.round = true;
s.nice = true;
break;
case SIZE:
if (enc.is("bar")) {
s.range = [3, enc.config("bandSize")];
Expand Down Expand Up @@ -489,7 +501,7 @@ function markdef(mark, enc) {

function groupdef(name) {
return {
name: name,
_name: name,
type: "group",
properties: {
enter: {
Expand All @@ -513,7 +525,7 @@ function template(enc) {
height: enc.config("height"),
padding: "auto",
data: [data],
marks: [groupdef("root")]
marks: [groupdef("cell")]
};
}

Expand Down

0 comments on commit 39034c5

Please sign in to comment.