Browse Source

Apply fix for .class - #537 #447

pull/590/head
Masayuki Tanaka 10 years ago
parent
commit
60fc19a243
  1. 12
      c3.js
  2. 6
      c3.min.js
  3. 4
      src/api.region.js
  4. 2
      src/class.js
  5. 6
      src/grid.js

12
c3.js

@ -3221,7 +3221,7 @@
.data(config.grid_x_lines); .data(config.grid_x_lines);
// enter // enter
xgridLine = $$.xgridLines.enter().append('g') xgridLine = $$.xgridLines.enter().append('g')
.attr("class", function (d) { return CLASS.xgridLine + (d.class ? ' ' + d.class : ''); }); .attr("class", function (d) { return CLASS.xgridLine + (d['class'] ? ' ' + d['class'] : ''); });
xgridLine.append('line') xgridLine.append('line')
.style("opacity", 0); .style("opacity", 0);
xgridLine.append('text') xgridLine.append('text')
@ -3246,7 +3246,7 @@
.data(config.grid_y_lines); .data(config.grid_y_lines);
// enter // enter
ygridLine = $$.ygridLines.enter().append('g') ygridLine = $$.ygridLines.enter().append('g')
.attr("class", function (d) { return CLASS.ygridLine + (d.class ? ' ' + d.class : ''); }); .attr("class", function (d) { return CLASS.ygridLine + (d['class'] ? ' ' + d['class'] : ''); });
ygridLine.append('line') ygridLine.append('line')
.style("opacity", 0); .style("opacity", 0);
ygridLine.append('text') ygridLine.append('text')
@ -3339,7 +3339,7 @@
return params ? function (line) { return params ? function (line) {
var found = false; var found = false;
[].concat(params).forEach(function (param) { [].concat(params).forEach(function (param) {
if ((('value' in param && line.value === params.value) || ('class' in param && line.class === params.class))) { if ((('value' in param && line.value === params.value) || ('class' in param && line['class'] === params['class']))) {
found = true; found = true;
} }
}); });
@ -5259,7 +5259,7 @@
return this.classShapes(d) + this.generateClass(CLASS.areas, d.id); return this.classShapes(d) + this.generateClass(CLASS.areas, d.id);
}; };
c3_chart_internal_fn.classRegion = function (d, i) { c3_chart_internal_fn.classRegion = function (d, i) {
return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : ''); return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d['class'] : '');
}; };
c3_chart_internal_fn.classEvent = function (d) { c3_chart_internal_fn.classEvent = function (d) {
return this.generateClass(CLASS.eventRect, d.index); return this.generateClass(CLASS.eventRect, d.index);
@ -5955,10 +5955,10 @@
config.regions = config.regions.filter(function (region) { config.regions = config.regions.filter(function (region) {
var found = false; var found = false;
if (!region.class) { if (!region['class']) {
return true; return true;
} }
region.class.split(' ').forEach(function (c) { region['class'].split(' ').forEach(function (c) {
if (classes.indexOf(c) >= 0) { found = true; } if (classes.indexOf(c) >= 0) { found = true; }
}); });
return !found; return !found;

6
c3.min.js vendored

File diff suppressed because one or more lines are too long

4
src/api.region.js

@ -27,10 +27,10 @@ c3_chart_fn.regions.remove = function (options) {
config.regions = config.regions.filter(function (region) { config.regions = config.regions.filter(function (region) {
var found = false; var found = false;
if (!region.class) { if (!region['class']) {
return true; return true;
} }
region.class.split(' ').forEach(function (c) { region['class'].split(' ').forEach(function (c) {
if (classes.indexOf(c) >= 0) { found = true; } if (classes.indexOf(c) >= 0) { found = true; }
}); });
return !found; return !found;

2
src/class.js

@ -119,7 +119,7 @@ c3_chart_internal_fn.classAreas = function (d) {
return this.classShapes(d) + this.generateClass(CLASS.areas, d.id); return this.classShapes(d) + this.generateClass(CLASS.areas, d.id);
}; };
c3_chart_internal_fn.classRegion = function (d, i) { c3_chart_internal_fn.classRegion = function (d, i) {
return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : ''); return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d['class'] : '');
}; };
c3_chart_internal_fn.classEvent = function (d) { c3_chart_internal_fn.classEvent = function (d) {
return this.generateClass(CLASS.eventRect, d.index); return this.generateClass(CLASS.eventRect, d.index);

6
src/grid.js

@ -84,7 +84,7 @@ c3_chart_internal_fn.redrawGrid = function (duration, withY) {
.data(config.grid_x_lines); .data(config.grid_x_lines);
// enter // enter
xgridLine = $$.xgridLines.enter().append('g') xgridLine = $$.xgridLines.enter().append('g')
.attr("class", function (d) { return CLASS.xgridLine + (d.class ? ' ' + d.class : ''); }); .attr("class", function (d) { return CLASS.xgridLine + (d['class'] ? ' ' + d['class'] : ''); });
xgridLine.append('line') xgridLine.append('line')
.style("opacity", 0); .style("opacity", 0);
xgridLine.append('text') xgridLine.append('text')
@ -109,7 +109,7 @@ c3_chart_internal_fn.redrawGrid = function (duration, withY) {
.data(config.grid_y_lines); .data(config.grid_y_lines);
// enter // enter
ygridLine = $$.ygridLines.enter().append('g') ygridLine = $$.ygridLines.enter().append('g')
.attr("class", function (d) { return CLASS.ygridLine + (d.class ? ' ' + d.class : ''); }); .attr("class", function (d) { return CLASS.ygridLine + (d['class'] ? ' ' + d['class'] : ''); });
ygridLine.append('line') ygridLine.append('line')
.style("opacity", 0); .style("opacity", 0);
ygridLine.append('text') ygridLine.append('text')
@ -202,7 +202,7 @@ c3_chart_internal_fn.getGridFilterToRemove = function (params) {
return params ? function (line) { return params ? function (line) {
var found = false; var found = false;
[].concat(params).forEach(function (param) { [].concat(params).forEach(function (param) {
if ((('value' in param && line.value === params.value) || ('class' in param && line.class === params.class))) { if ((('value' in param && line.value === params.value) || ('class' in param && line['class'] === params['class']))) {
found = true; found = true;
} }
}); });

Loading…
Cancel
Save