Skip to content

Commit

Permalink
chore(version): bump to v0.7.11
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k committed Oct 4, 2019
1 parent 7549220 commit 52f1822
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .bmp.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 0.7.10
version: 0.7.11
commit: 'chore(version): bump to v%.%.%'
files:
src/core.js: 'version: "%.%.%"'
Expand Down
66 changes: 49 additions & 17 deletions c3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* @license C3.js v0.7.10 | (c) C3 Team and other contributors | http://c3js.org/ */
/* @license C3.js v0.7.11 | (c) C3 Team and other contributors | http://c3js.org/ */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -1232,7 +1232,7 @@
};

var c3 = {
version: "0.7.10",
version: "0.7.11",
chart: {
fn: Chart.prototype,
internal: {
Expand Down Expand Up @@ -7562,6 +7562,30 @@
return $$.findClosest(candidates, pos, $$.dist.bind($$));
}
};
/**
* Find the closest point from the x value or undefined if none satisfies conditions.
*
* @param {Array} targets
* @param {Array} x A value on X axis
* @return {Object|undefined}
*/


ChartInternal.prototype.findClosestFromTargetsByX = function (targets, x) {
var closest;
var diff;
targets.forEach(function (t) {
t.values.forEach(function (d) {
var newDiff = Math.abs(x - d.x);

if (diff === undefined || newDiff < diff) {
closest = d;
diff = newDiff;
}
});
});
return closest;
};
/**
* Using given compute distance method, returns the closest data point from the
* given position.
Expand Down Expand Up @@ -8632,15 +8656,7 @@

var isHoveringDataPoint = function isHoveringDataPoint(mouse, closest) {
return closest && ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity);
}; // converts 'x' position (in pixel) to category index


var maxDataCount = $$.getMaxDataCount();
var xEventScale = d3.scaleQuantize() // use X range (in pixel) as domain
.domain([0, config.axis_rotated ? $$.height : $$.width]) // 0 to N evenly distributed
.range(maxDataCount ? Array.apply(null, {
length: maxDataCount
}).map(Function.call, Number) : [0]);
};

var withName = function withName(d) {
return d ? $$.addName(Object.assign({}, d)) : null;
Expand Down Expand Up @@ -8698,14 +8714,30 @@
var selectedData;

if (showSingleDataPoint) {
if (!closest) {
return mouseout();
if (closest) {
selectedData = [closest];
}

selectedData = [closest];
} else {
var mouseX = config.axis_rotated ? mouse[1] : mouse[0];
selectedData = $$.filterByIndex(targetsToShow, xEventScale(mouseX));
var closestByX;

if (closest) {
// reuse closest value
closestByX = closest;
} else {
// try to find the closest value by X values from the mouse position
var mouseX = config.axis_rotated ? mouse[1] : mouse[0];
closestByX = $$.findClosestFromTargetsByX(targetsToShow, $$.x.invert(mouseX));
} // highlight all data for this 'x' value


if (closestByX) {
selectedData = $$.filterByX(targetsToShow, closestByX.x);
}
} // ensure we have data to show


if (!selectedData || selectedData.length === 0) {
return mouseout();
} // inject names for each point


Expand Down
4 changes: 2 additions & 2 deletions c3.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "c3",
"repo": "masayuki0812/c3",
"description": "A D3-based reusable chart library",
"version": "0.7.10",
"version": "0.7.11",
"keywords": [],
"dependencies": {
"mbostock/d3": "v5.0.0"
Expand Down
4 changes: 4 additions & 0 deletions docs/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@

%h3 Change Log
%ul
%li
<a href="https://github.com/c3js/c3/releases/tag/v0.7.11">v0.7.11</a><span class="gray">&nbsp;-&nbsp;2019-10-04</span>
%ul
%li Bug fixes.
%li
<a href="https://github.com/c3js/c3/releases/tag/v0.7.10">v0.7.10</a><span class="gray">&nbsp;-&nbsp;2019-10-02</span>
%ul
Expand Down
66 changes: 49 additions & 17 deletions docs/js/c3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* @license C3.js v0.7.10 | (c) C3 Team and other contributors | http://c3js.org/ */
/* @license C3.js v0.7.11 | (c) C3 Team and other contributors | http://c3js.org/ */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -1232,7 +1232,7 @@
};

var c3 = {
version: "0.7.10",
version: "0.7.11",
chart: {
fn: Chart.prototype,
internal: {
Expand Down Expand Up @@ -7562,6 +7562,30 @@
return $$.findClosest(candidates, pos, $$.dist.bind($$));
}
};
/**
* Find the closest point from the x value or undefined if none satisfies conditions.
*
* @param {Array} targets
* @param {Array} x A value on X axis
* @return {Object|undefined}
*/


ChartInternal.prototype.findClosestFromTargetsByX = function (targets, x) {
var closest;
var diff;
targets.forEach(function (t) {
t.values.forEach(function (d) {
var newDiff = Math.abs(x - d.x);

if (diff === undefined || newDiff < diff) {
closest = d;
diff = newDiff;
}
});
});
return closest;
};
/**
* Using given compute distance method, returns the closest data point from the
* given position.
Expand Down Expand Up @@ -8632,15 +8656,7 @@

var isHoveringDataPoint = function isHoveringDataPoint(mouse, closest) {
return closest && ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity);
}; // converts 'x' position (in pixel) to category index


var maxDataCount = $$.getMaxDataCount();
var xEventScale = d3.scaleQuantize() // use X range (in pixel) as domain
.domain([0, config.axis_rotated ? $$.height : $$.width]) // 0 to N evenly distributed
.range(maxDataCount ? Array.apply(null, {
length: maxDataCount
}).map(Function.call, Number) : [0]);
};

var withName = function withName(d) {
return d ? $$.addName(Object.assign({}, d)) : null;
Expand Down Expand Up @@ -8698,14 +8714,30 @@
var selectedData;

if (showSingleDataPoint) {
if (!closest) {
return mouseout();
if (closest) {
selectedData = [closest];
}

selectedData = [closest];
} else {
var mouseX = config.axis_rotated ? mouse[1] : mouse[0];
selectedData = $$.filterByIndex(targetsToShow, xEventScale(mouseX));
var closestByX;

if (closest) {
// reuse closest value
closestByX = closest;
} else {
// try to find the closest value by X values from the mouse position
var mouseX = config.axis_rotated ? mouse[1] : mouse[0];
closestByX = $$.findClosestFromTargetsByX(targetsToShow, $$.x.invert(mouseX));
} // highlight all data for this 'x' value


if (closestByX) {
selectedData = $$.filterByX(targetsToShow, closestByX.x);
}
} // ensure we have data to show


if (!selectedData || selectedData.length === 0) {
return mouseout();
} // inject names for each point


Expand Down
4 changes: 2 additions & 2 deletions docs/js/c3.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c3",
"version": "0.7.10",
"version": "0.7.11",
"description": "D3-based reusable chart library",
"main": "c3.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from './util';

var c3 = {
version: "0.7.10",
version: "0.7.11",
chart: {
fn: Chart.prototype,
internal: {
Expand Down

0 comments on commit 52f1822

Please sign in to comment.