diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a38058ab..463b74ae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.10.1](https://github.com/naver/billboard.js/compare/1.10.0...1.10.1) (2019-08-09) + + +### Bug Fixes + +* **interaction:** Fix on eventRect generation ([3dd9439](https://github.com/naver/billboard.js/commit/3dd9439)), closes [#1019](https://github.com/naver/billboard.js/issues/1019) + # [1.10.0](https://github.com/naver/billboard.js/compare/1.9.5...1.10.0) (2019-08-07) diff --git a/config/deploy.sh b/config/deploy.sh index 242075df2..4b12c3408 100644 --- a/config/deploy.sh +++ b/config/deploy.sh @@ -41,4 +41,7 @@ mkdir release/$DIST_TAG cp -r doc dist release/$DIST_TAG # push to github pages -npx gh-pages --dist $DIST_FOLDER --dest $DEST_FOLDER --add --remote $DEST_REMOTE --message $COMMIT_MESSAGE +# Use fixed gh-pages version, due to the bug from the latest 2.1.0 +# https://travis-ci.org/naver/billboard.js/jobs/568700732#L1172 +# https://github.com/tschaub/gh-pages/issues/308 +npx gh-pages@2.0.1 --dist $DIST_FOLDER --dest $DEST_FOLDER --add --remote $DEST_REMOTE --message $COMMIT_MESSAGE diff --git a/jsdoc.json b/jsdoc.json index 5f9f79cac..73c6dba69 100644 --- a/jsdoc.json +++ b/jsdoc.json @@ -44,7 +44,7 @@ "typedefs": true, "private": false, "scripts": [ - "../doc.css" + "../../../css/doc.css" ], "menu":{ "Examples": { diff --git a/package-lock.json b/package-lock.json index 8ded8f7d4..c57b6aa74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "billboard.js", - "version": "1.10.0", + "version": "1.10.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1957caaab..9a6207661 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "billboard.js", - "version": "1.10.0", + "version": "1.10.1", "description": "Re-usable easy interface JavaScript chart library, based on D3 v4+", "homepage": "http://naver.github.io/billboard.js/", "main": "dist/billboard.js", @@ -27,7 +27,8 @@ "jsdoc:cmd": "jsdoc -c jsdoc.json" }, "sideEffects": [ - "dist/**/*.css" + "dist/**/*.css", + "src/**/*.js" ], "husky": { "hooks": { diff --git a/spec/interactions/interaction-spec.js b/spec/interactions/interaction-spec.js index 7b45b7e19..ec721d2b2 100644 --- a/spec/interactions/interaction-spec.js +++ b/spec/interactions/interaction-spec.js @@ -127,6 +127,46 @@ describe("INTERACTION", () => { }); }); + describe("timeseries #3", () => { + before(() => { + args = { + data: { + x: "x", + json: { + Temperature:["29.39", "29.7", "29.37", "28.87", "28.62"], + x:["01-01-2015 00:00", "02-01-2015 00:00", "03-01-2015 00:00", "04-01-2015 00:00", "05-01-2015 00:00"] + }, + type: "area", + xFormat: "%m-%d-%Y %H:%M" + }, + axis: { + x: { + tick: { + fit: false + }, + type: "timeseries" + } + } + }; + }); + + it("check if rect element generated correctly", () => { + const rect = chart.$.main.selectAll(`.${CLASS.eventRectsSingle} rect`); + let lastX = 0; + + expect(rect.size()).to.be.equal(args.data.json.x.length); + + rect.each(function(d, i) { + const x = +this.getAttribute("x"); + + expect(+this.getAttribute("x")).to.be.above(lastX); + expect(+this.getAttribute("width")).to.be.above(0); + + lastX = x; + }); + }); + }); + describe("indexed", () => { before(() => { args = { diff --git a/src/config/Options.js b/src/config/Options.js index d6866d527..c42d01ab4 100644 --- a/src/config/Options.js +++ b/src/config/Options.js @@ -2421,6 +2421,9 @@ export default class Options { /** * Show or hide y2 axis. + * - **NOTE**: + * - When set to `false` will not generate y2 axis node. In this case, all 'y2' axis related functionality won't work properly. + * - If need to use 'y2' related options while y2 isn't visible, set the value `true` and control visibility by css display property. * @name axis․y2․show * @memberof Options * @type {Boolean} diff --git a/src/data/data.js b/src/data/data.js index 2cd556563..8f70ddfe6 100644 --- a/src/data/data.js +++ b/src/data/data.js @@ -193,8 +193,15 @@ extend(ChartInternal.prototype, { updateXs() { const $$ = this; + const targets = $$.data.targets; - $$.xs = $$.axis.getTickValues("x") || []; + if (targets.length) { + $$.xs = []; + + targets[0].values.forEach(v => { + $$.xs[v.index] = v.x; + }); + } }, getPrevX(i) { diff --git a/src/interactions/interaction.js b/src/interactions/interaction.js index c9439eae8..b3fe76f55 100644 --- a/src/interactions/interaction.js +++ b/src/interactions/interaction.js @@ -61,9 +61,11 @@ extend(ChartInternal.prototype, { .merge(eventRectUpdate); } else { // Set data and update $$.eventRect - const xAxisTickValues = $$.flowing ? + let xAxisTickValues = $$.axis.getTickValues("x"); + + xAxisTickValues = ($$.flowing || !xAxisTickValues || config.axis_x_tick_count) ? $$.getMaxDataCountTarget($$.data.targets).values : - ($$.axis.getTickValues("x") || []).map((x, index) => ({x, index})); + xAxisTickValues.map((x, index) => ({x, index})); eventRects.datum(xAxisTickValues);