Browse Source

Fixed bug with regions not working correctly after load() with time series

pull/688/head
Mariusz Kierski 10 years ago
parent
commit
d2d878905f
  1. 8
      c3.js
  2. 2
      c3.min.js
  3. 8
      src/region.js

8
c3.js

@ -4758,7 +4758,7 @@
if (d.axis === 'y' || d.axis === 'y2') { if (d.axis === 'y' || d.axis === 'y2') {
xPos = config.axis_rotated ? ('start' in d ? yScale(d.start) : 0) : 0; xPos = config.axis_rotated ? ('start' in d ? yScale(d.start) : 0) : 0;
} else { } else {
xPos = config.axis_rotated ? 0 : ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0); xPos = config.axis_rotated ? 0 : ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start).valueOf() : d.start) : 0);
} }
return xPos; return xPos;
}; };
@ -4768,7 +4768,7 @@
if (d.axis === 'y' || d.axis === 'y2') { if (d.axis === 'y' || d.axis === 'y2') {
yPos = config.axis_rotated ? 0 : ('end' in d ? yScale(d.end) : 0); yPos = config.axis_rotated ? 0 : ('end' in d ? yScale(d.end) : 0);
} else { } else {
yPos = config.axis_rotated ? ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0) : 0; yPos = config.axis_rotated ? ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start).valueOf() : d.start) : 0) : 0;
} }
return yPos; return yPos;
}; };
@ -4778,7 +4778,7 @@
if (d.axis === 'y' || d.axis === 'y2') { if (d.axis === 'y' || d.axis === 'y2') {
end = config.axis_rotated ? ('end' in d ? yScale(d.end) : $$.width) : $$.width; end = config.axis_rotated ? ('end' in d ? yScale(d.end) : $$.width) : $$.width;
} else { } else {
end = config.axis_rotated ? $$.width : ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.width); end = config.axis_rotated ? $$.width : ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end).valueOf() : d.end) : $$.width);
} }
return end < start ? 0 : end - start; return end < start ? 0 : end - start;
}; };
@ -4788,7 +4788,7 @@
if (d.axis === 'y' || d.axis === 'y2') { if (d.axis === 'y' || d.axis === 'y2') {
end = config.axis_rotated ? $$.height : ('start' in d ? yScale(d.start) : $$.height); end = config.axis_rotated ? $$.height : ('start' in d ? yScale(d.start) : $$.height);
} else { } else {
end = config.axis_rotated ? ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.height) : $$.height; end = config.axis_rotated ? ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end).valueOf() : d.end) : $$.height) : $$.height;
} }
return end < start ? 0 : end - start; return end < start ? 0 : end - start;
}; };

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

8
src/region.js

@ -39,7 +39,7 @@ c3_chart_internal_fn.regionX = function (d) {
if (d.axis === 'y' || d.axis === 'y2') { if (d.axis === 'y' || d.axis === 'y2') {
xPos = config.axis_rotated ? ('start' in d ? yScale(d.start) : 0) : 0; xPos = config.axis_rotated ? ('start' in d ? yScale(d.start) : 0) : 0;
} else { } else {
xPos = config.axis_rotated ? 0 : ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0); xPos = config.axis_rotated ? 0 : ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start).valueOf() : d.start) : 0);
} }
return xPos; return xPos;
}; };
@ -49,7 +49,7 @@ c3_chart_internal_fn.regionY = function (d) {
if (d.axis === 'y' || d.axis === 'y2') { if (d.axis === 'y' || d.axis === 'y2') {
yPos = config.axis_rotated ? 0 : ('end' in d ? yScale(d.end) : 0); yPos = config.axis_rotated ? 0 : ('end' in d ? yScale(d.end) : 0);
} else { } else {
yPos = config.axis_rotated ? ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0) : 0; yPos = config.axis_rotated ? ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start).valueOf() : d.start) : 0) : 0;
} }
return yPos; return yPos;
}; };
@ -59,7 +59,7 @@ c3_chart_internal_fn.regionWidth = function (d) {
if (d.axis === 'y' || d.axis === 'y2') { if (d.axis === 'y' || d.axis === 'y2') {
end = config.axis_rotated ? ('end' in d ? yScale(d.end) : $$.width) : $$.width; end = config.axis_rotated ? ('end' in d ? yScale(d.end) : $$.width) : $$.width;
} else { } else {
end = config.axis_rotated ? $$.width : ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.width); end = config.axis_rotated ? $$.width : ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end).valueOf() : d.end) : $$.width);
} }
return end < start ? 0 : end - start; return end < start ? 0 : end - start;
}; };
@ -69,7 +69,7 @@ c3_chart_internal_fn.regionHeight = function (d) {
if (d.axis === 'y' || d.axis === 'y2') { if (d.axis === 'y' || d.axis === 'y2') {
end = config.axis_rotated ? $$.height : ('start' in d ? yScale(d.start) : $$.height); end = config.axis_rotated ? $$.height : ('start' in d ? yScale(d.start) : $$.height);
} else { } else {
end = config.axis_rotated ? ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.height) : $$.height; end = config.axis_rotated ? ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end).valueOf() : d.end) : $$.height) : $$.height;
} }
return end < start ? 0 : end - start; return end < start ? 0 : end - start;
}; };

Loading…
Cancel
Save