Skip to content

Commit 2bc2488

Browse files
committed
chore(version): bump to v0.7.8
1 parent 09423b6 commit 2bc2488

13 files changed

+220
-172
lines changed

.bmp.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
version: 0.7.7
2+
version: 0.7.8
33
commit: 'chore(version): bump to v%.%.%'
44
files:
55
src/core.js: 'version: "%.%.%"'

c3.css

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
}
6464

6565
/*-- Point --*/
66+
.c3-circle {
67+
fill: currentColor;
68+
}
69+
6670
.c3-circle._expanded_ {
6771
stroke-width: 1px;
6872
stroke: white;

c3.js

+98-81
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @license C3.js v0.7.7 | (c) C3 Team and other contributors | http://c3js.org/ */
1+
/* @license C3.js v0.7.8 | (c) C3 Team and other contributors | http://c3js.org/ */
22
(function (global, factory) {
33
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
44
typeof define === 'function' && define.amd ? define(factory) :
@@ -94,6 +94,92 @@
9494
})(Chart.prototype, this, this);
9595
}
9696

97+
var asHalfPixel = function asHalfPixel(n) {
98+
return Math.ceil(n) + 0.5;
99+
};
100+
var ceil10 = function ceil10(v) {
101+
return Math.ceil(v / 10) * 10;
102+
};
103+
var diffDomain = function diffDomain(d) {
104+
return d[1] - d[0];
105+
};
106+
var getOption = function getOption(options, key, defaultValue) {
107+
return isDefined(options[key]) ? options[key] : defaultValue;
108+
};
109+
var getPathBox = function getPathBox(path) {
110+
var box = getBBox(path),
111+
items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)],
112+
minX = items[0].x,
113+
minY = Math.min(items[0].y, items[1].y);
114+
return {
115+
x: minX,
116+
y: minY,
117+
width: box.width,
118+
height: box.height
119+
};
120+
};
121+
var getBBox = function getBBox(element) {
122+
try {
123+
return element.getBBox();
124+
} catch (ignore) {
125+
// Firefox will throw an exception if getBBox() is called whereas the
126+
// element is rendered with display:none
127+
// See https://github.com/c3js/c3/issues/2692
128+
// The previous code was using `getBoundingClientRect` which was returning
129+
// everything at 0 in this case so let's reproduce this behavior here.
130+
return {
131+
x: 0,
132+
y: 0,
133+
width: 0,
134+
height: 0
135+
};
136+
}
137+
};
138+
var hasValue = function hasValue(dict, value) {
139+
var found = false;
140+
Object.keys(dict).forEach(function (key) {
141+
if (dict[key] === value) {
142+
found = true;
143+
}
144+
});
145+
return found;
146+
};
147+
var isArray = function isArray(o) {
148+
return Array.isArray(o);
149+
};
150+
var isDefined = function isDefined(v) {
151+
return typeof v !== 'undefined';
152+
};
153+
var isEmpty = function isEmpty(o) {
154+
return typeof o === 'undefined' || o === null || isString(o) && o.length === 0 || _typeof(o) === 'object' && Object.keys(o).length === 0;
155+
};
156+
var isFunction = function isFunction(o) {
157+
return typeof o === 'function';
158+
};
159+
var isNumber = function isNumber(o) {
160+
return typeof o === 'number';
161+
};
162+
var isString = function isString(o) {
163+
return typeof o === 'string';
164+
};
165+
var isUndefined = function isUndefined(v) {
166+
return typeof v === 'undefined';
167+
};
168+
var isValue = function isValue(v) {
169+
return v || v === 0;
170+
};
171+
var notEmpty = function notEmpty(o) {
172+
return !isEmpty(o);
173+
};
174+
var sanitise = function sanitise(str) {
175+
return typeof str === 'string' ? str.replace(/</g, '&lt;').replace(/>/g, '&gt;') : str;
176+
};
177+
var flattenArray = function flattenArray(arr) {
178+
var _ref;
179+
180+
return Array.isArray(arr) ? (_ref = []).concat.apply(_ref, _toConsumableArray(arr)) : [];
181+
};
182+
97183
function AxisInternal(component, params) {
98184
var internal = this;
99185
internal.component = component;
@@ -197,7 +283,7 @@
197283
tick.select('text').text(function (d) {
198284
return internal.textFormatted(d);
199285
}).each(function (d) {
200-
var box = this.getBBox(),
286+
var box = getBBox(this),
201287
text = internal.textFormatted(d),
202288
h = box.height,
203289
w = text ? box.width / text.length : undefined;
@@ -660,75 +746,6 @@
660746
INCLUDED: '_included_'
661747
};
662748

663-
var asHalfPixel = function asHalfPixel(n) {
664-
return Math.ceil(n) + 0.5;
665-
};
666-
var ceil10 = function ceil10(v) {
667-
return Math.ceil(v / 10) * 10;
668-
};
669-
var diffDomain = function diffDomain(d) {
670-
return d[1] - d[0];
671-
};
672-
var getOption = function getOption(options, key, defaultValue) {
673-
return isDefined(options[key]) ? options[key] : defaultValue;
674-
};
675-
var getPathBox = function getPathBox(path) {
676-
var box = path.getBBox(),
677-
items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)],
678-
minX = items[0].x,
679-
minY = Math.min(items[0].y, items[1].y);
680-
return {
681-
x: minX,
682-
y: minY,
683-
width: box.width,
684-
height: box.height
685-
};
686-
};
687-
var hasValue = function hasValue(dict, value) {
688-
var found = false;
689-
Object.keys(dict).forEach(function (key) {
690-
if (dict[key] === value) {
691-
found = true;
692-
}
693-
});
694-
return found;
695-
};
696-
var isArray = function isArray(o) {
697-
return Array.isArray(o);
698-
};
699-
var isDefined = function isDefined(v) {
700-
return typeof v !== 'undefined';
701-
};
702-
var isEmpty = function isEmpty(o) {
703-
return typeof o === 'undefined' || o === null || isString(o) && o.length === 0 || _typeof(o) === 'object' && Object.keys(o).length === 0;
704-
};
705-
var isFunction = function isFunction(o) {
706-
return typeof o === 'function';
707-
};
708-
var isNumber = function isNumber(o) {
709-
return typeof o === 'number';
710-
};
711-
var isString = function isString(o) {
712-
return typeof o === 'string';
713-
};
714-
var isUndefined = function isUndefined(v) {
715-
return typeof v === 'undefined';
716-
};
717-
var isValue = function isValue(v) {
718-
return v || v === 0;
719-
};
720-
var notEmpty = function notEmpty(o) {
721-
return !isEmpty(o);
722-
};
723-
var sanitise = function sanitise(str) {
724-
return typeof str === 'string' ? str.replace(/</g, '&lt;').replace(/>/g, '&gt;') : str;
725-
};
726-
var flattenArray = function flattenArray(arr) {
727-
var _ref;
728-
729-
return Array.isArray(arr) ? (_ref = []).concat.apply(_ref, _toConsumableArray(arr)) : [];
730-
};
731-
732749
var Axis = function Axis(owner) {
733750
_classCallCheck(this, Axis);
734751

@@ -1090,7 +1107,7 @@
10901107
dummy = $$.d3.select('body').append('div').classed('c3', true);
10911108
svg = dummy.append("svg").style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0), svg.append('g').call(axis).each(function () {
10921109
$$.d3.select(this).selectAll('text').each(function () {
1093-
var box = this.getBBox();
1110+
var box = getBBox(this);
10941111

10951112
if (maxWidth < box.width) {
10961113
maxWidth = box.width;
@@ -1199,7 +1216,7 @@
11991216
};
12001217

12011218
var c3 = {
1202-
version: "0.7.7",
1219+
version: "0.7.8",
12031220
chart: {
12041221
fn: Chart.prototype,
12051222
internal: {
@@ -7393,7 +7410,7 @@
73937410
$$.selectChart.select('svg').selectAll('.dummy').data([min, max]).enter().append('text').text(function (d) {
73947411
return $$.dataLabelFormat(d.id)(d);
73957412
}).each(function (d, i) {
7396-
lengths[i] = this.getBBox()[key] * paddingCoef;
7413+
lengths[i] = getBBox(this)[key] * paddingCoef;
73977414
}).remove();
73987415
return lengths;
73997416
};
@@ -9439,7 +9456,7 @@
94399456
return false;
94409457
}
94419458

9442-
var box = that.getBBox(),
9459+
var box = getBBox(that),
94439460
seg0 = that.pathSegList.getItem(0),
94449461
seg1 = that.pathSegList.getItem(1),
94459462
x = Math.min(seg0.x, seg1.x),
@@ -9952,15 +9969,15 @@
99529969
ChartInternal.prototype.updateCircle = function (cx, cy) {
99539970
var $$ = this;
99549971
var mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle).data($$.lineOrScatterOrStanfordData.bind($$));
9955-
var mainCircleEnter = mainCircle.enter().append("circle").attr('shape-rendering', 'crispEdges').attr("class", $$.classCircle.bind($$)).attr("cx", cx).attr("cy", cy).attr("r", $$.pointR.bind($$)).style("fill", $$.isStanfordGraphType() ? $$.getStanfordPointColor.bind($$) : $$.color);
9972+
var mainCircleEnter = mainCircle.enter().append("circle").attr('shape-rendering', $$.isStanfordGraphType() ? 'crispEdges' : '').attr("class", $$.classCircle.bind($$)).attr("cx", cx).attr("cy", cy).attr("r", $$.pointR.bind($$)).style("color", $$.isStanfordGraphType() ? $$.getStanfordPointColor.bind($$) : $$.color);
99569973
$$.mainCircle = mainCircleEnter.merge(mainCircle).style("opacity", $$.isStanfordGraphType() ? 1 : $$.initialOpacityForCircle.bind($$));
99579974
mainCircle.exit().style("opacity", 0);
99589975
};
99599976

99609977
ChartInternal.prototype.redrawCircle = function (cx, cy, withTransition, transition) {
99619978
var $$ = this,
99629979
selectedCircles = $$.main.selectAll('.' + CLASS.selectedCircle);
9963-
return [(withTransition ? $$.mainCircle.transition(transition) : $$.mainCircle).style('opacity', this.opacityForCircle.bind($$)).style("fill", $$.isStanfordGraphType() ? $$.getStanfordPointColor.bind($$) : $$.color).attr("cx", cx).attr("cy", cy), (withTransition ? selectedCircles.transition(transition) : selectedCircles).attr("cx", cx).attr("cy", cy)];
9980+
return [(withTransition ? $$.mainCircle.transition(transition) : $$.mainCircle).style('opacity', this.opacityForCircle.bind($$)).style("color", $$.isStanfordGraphType() ? $$.getStanfordPointColor.bind($$) : $$.color).attr("cx", cx).attr("cy", cy), (withTransition ? selectedCircles.transition(transition) : selectedCircles).attr("cx", cx).attr("cy", cy)];
99649981
};
99659982

99669983
ChartInternal.prototype.circleX = function (d) {
@@ -10523,7 +10540,7 @@
1052310540
font = this.d3.select(element).style('font'),
1052410541
rect;
1052510542
svg.selectAll('.dummy').data([text]).enter().append('text').classed(cls ? cls : "", true).style('font', font).text(text).each(function () {
10526-
rect = this.getBBox();
10543+
rect = getBBox(this);
1052710544
});
1052810545
dummy.remove();
1052910546
return rect;
@@ -10543,7 +10560,7 @@
1054310560

1054410561
ChartInternal.prototype.getXForText = function (points, d, textElement) {
1054510562
var $$ = this,
10546-
box = textElement.getBBox(),
10563+
box = getBBox(textElement),
1054710564
xPos,
1054810565
padding;
1054910566

@@ -10568,7 +10585,7 @@
1056810585

1056910586
ChartInternal.prototype.getYForText = function (points, d, textElement) {
1057010587
var $$ = this,
10571-
box = textElement.getBBox(),
10588+
box = getBBox(textElement),
1057210589
yPos;
1057310590

1057410591
if ($$.config.axis_rotated) {
@@ -10708,7 +10725,7 @@
1070810725

1070910726
ChartInternal.prototype.xForColorScale = function () {
1071010727
var $$ = this;
10711-
return $$.config.stanford_padding.right + $$.colorScale.node().getBBox().width;
10728+
return $$.config.stanford_padding.right + getBBox($$.colorScale.node()).width;
1071210729
};
1071310730

1071410731
ChartInternal.prototype.getColorScalePadding = function () {

c3.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

c3.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

component.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "c3",
33
"repo": "masayuki0812/c3",
44
"description": "A D3-based reusable chart library",
5-
"version": "0.7.7",
5+
"version": "0.7.8",
66
"keywords": [],
77
"dependencies": {
88
"mbostock/d3": "v5.0.0"

docs/css/c3.css

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
}
6464

6565
/*-- Point --*/
66+
.c3-circle {
67+
fill: currentColor;
68+
}
69+
6670
.c3-circle._expanded_ {
6771
stroke-width: 1px;
6872
stroke: white;

0 commit comments

Comments
 (0)