Skip to content

Commit

Permalink
toggling groups
Browse files Browse the repository at this point in the history
  • Loading branch information
mwasiluk committed Sep 8, 2016
1 parent f4534d3 commit 5f63300
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
20 changes: 11 additions & 9 deletions dist/odc-d3.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/odc-d3.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/odc-d3.min.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions src/histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ export class Histogram extends Chart{
if (colorValue && typeof colorValue === 'string' || colorValue instanceof String){
this.plot.color = colorValue;
}else if(this.plot.colorCategory){
var domain = Object.getOwnPropertyNames(d3.map(this.data, d => this.config.groups.value.call(this.config, d))['_']);
self.plot.colorCategory.domain(domain);
if(this.config.groups){
var domain = Object.getOwnPropertyNames(d3.map(this.data, d => this.config.groups.value.call(this.config, d))['_']);
self.plot.colorCategory.domain(domain);
}

this.plot.color = d => self.plot.colorCategory(d.key);
}

Expand Down
3 changes: 1 addition & 2 deletions src/scatterplot-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ export class ScatterPlotMatrix extends Chart {


function plotSubplot(p) {
console.log('plotSubplot');
var plot = self.plot;
plot.subplots.push(p);
var cell = d3.select(this);
Expand Down Expand Up @@ -297,7 +296,7 @@ export class ScatterPlotMatrix extends Chart {
.style("left", (d3.event.pageX + 5) + "px")
.style("top", (d3.event.pageY - 28) + "px");

var group = self.config.groups.value(d);
var group = self.config.groups ? self.config.groups.value(d) : false;
if(group || group===0 ){
html+="<br/>";
var label = self.config.groups.label;
Expand Down
4 changes: 2 additions & 2 deletions src/scatterplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class ScatterPlotConfig extends ChartConfig{
};
dot = {
radius: 2,
color: d => this.groups.value(d, this.groups.key), // string or function returning color's value for color scale
color: d => this.groups ? this.groups.value(d, this.groups.key) : '', // string or function returning color's value for color scale
d3ColorCategory: 'category10'
};
transition= true;
Expand Down Expand Up @@ -255,7 +255,7 @@ export class ScatterPlot extends Chart{
.duration(200)
.style("opacity", .9);
var html = "(" + plot.x.value(d) + ", " + plot.y.value(d) + ")";
var group = self.config.groups.value(d, self.config.groups.key);
var group = self.config.groups ? self.config.groups.value(d, self.config.groups.key) : null;
if (group || group === 0) {
html += "<br/>";
var label = self.config.groups.label;
Expand Down

0 comments on commit 5f63300

Please sign in to comment.