From 3e63ee559d27077f9e09efde967bd4d7d30d75d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86ndrew=20Rininsland?= Date: Fri, 16 Sep 2016 00:52:34 +0100 Subject: [PATCH] Tidying up code, all tests now broken. :( --- .eslintrc | 6 + .jshintrc | 31 - c3.js | 541 ++++----- c3.js.map | 1 + es6_modules/axis/axis.js | 471 -------- es6_modules/axis/c3.axis.js | 351 ------ es6_modules/axis/index.js | 41 - es6_modules/chart/api.axis.js | 81 -- es6_modules/chart/api.category.js | 36 - es6_modules/chart/api.chart.js | 64 - es6_modules/chart/api.color.js | 26 - es6_modules/chart/api.data.js | 53 - es6_modules/chart/api.flow.js | 164 --- es6_modules/chart/api.focus.js | 81 -- es6_modules/chart/api.grid.js | 56 - es6_modules/chart/api.group.js | 28 - es6_modules/chart/api.legend.js | 34 - es6_modules/chart/api.load.js | 82 -- es6_modules/chart/api.region.js | 63 - es6_modules/chart/api.selection.js | 77 -- es6_modules/chart/api.show.js | 71 -- es6_modules/chart/api.tooltip.js | 60 - es6_modules/chart/api.transform.js | 26 - es6_modules/chart/api.x.js | 38 - es6_modules/chart/api.zoom.js | 77 -- es6_modules/chart/index.js | 78 -- karma.conf.js | 21 +- npm-debug.log | 45 + package.json | 6 +- rollup.config.js | 2 +- spec/c3-helper.js | 8 +- src/axis/axis.js | 199 +++- src/axis/c3.axis.js | 103 +- src/axis/index.js | 24 + src/chart/api.axis.js | 17 +- src/chart/api.category.js | 6 +- src/chart/api.chart.js | 11 +- src/chart/api.color.js | 4 +- src/chart/api.data.js | 19 +- src/chart/api.flow.js | 9 +- src/chart/api.focus.js | 12 +- src/chart/api.grid.js | 18 +- src/chart/api.group.js | 8 +- src/chart/api.legend.js | 10 +- src/chart/api.load.js | 8 +- src/chart/api.region.js | 29 +- src/chart/api.selection.js | 29 +- src/chart/api.show.js | 27 +- src/chart/api.tooltip.js | 35 +- src/chart/api.transform.js | 23 +- src/chart/api.x.js | 26 +- src/chart/api.zoom.js | 43 +- src/chart/index.js | 57 +- src/chartinternal/arc.js | 435 ------- src/chartinternal/cache.js | 16 - src/chartinternal/category.js | 4 - src/chartinternal/class.js | 175 --- src/chartinternal/clip.js | 58 - src/chartinternal/color.js | 46 - src/chartinternal/config.js | 266 ----- src/chartinternal/data.convert.js | 227 ---- src/chartinternal/data.js | 370 ------ src/chartinternal/data.load.js | 88 -- src/chartinternal/domain.js | 235 ---- src/chartinternal/drag.js | 81 -- src/chartinternal/flow.js | 155 --- src/chartinternal/format.js | 42 - src/chartinternal/grid.js | 240 ---- src/chartinternal/index.js | 1039 ----------------- src/chartinternal/interaction.js | 400 ------- src/chartinternal/legend.js | 337 ------ src/chartinternal/region.js | 88 -- src/chartinternal/scale.js | 89 -- src/chartinternal/selection.js | 79 -- src/chartinternal/shape.bar.js | 121 -- src/chartinternal/shape.js | 82 -- src/chartinternal/shape.line.js | 384 ------ src/chartinternal/size.js | 115 -- src/chartinternal/subchart.js | 205 ---- src/chartinternal/text.js | 124 -- src/chartinternal/title.js | 31 - src/chartinternal/tooltip.js | 136 --- src/chartinternal/transform.js | 10 - src/chartinternal/type.js | 94 -- src/chartinternal/ua.js | 8 - src/chartinternal/util.js | 49 - src/chartinternal/zoom.js | 75 -- src/head.js | 8 - es6_modules/rollup.entry.js => src/index.js | 2 +- {es6_modules => src}/internals/arc.js | 0 {es6_modules => src}/internals/cache.js | 0 {es6_modules => src}/internals/category.js | 0 {es6_modules => src}/internals/class.js | 0 {es6_modules => src}/internals/clip.js | 0 {es6_modules => src}/internals/color.js | 0 {es6_modules => src}/internals/config.js | 0 .../internals/data.convert.js | 0 {es6_modules => src}/internals/data.js | 0 {es6_modules => src}/internals/data.load.js | 0 {es6_modules => src}/internals/domain.js | 7 + {es6_modules => src}/internals/drag.js | 3 + {es6_modules => src}/internals/flow.js | 6 + {es6_modules => src}/internals/format.js | 2 + {es6_modules => src}/internals/grid.js | 3 + {es6_modules => src}/internals/index.js | 0 {es6_modules => src}/internals/interaction.js | 2 + {es6_modules => src}/internals/legend.js | 7 + {es6_modules => src}/internals/region.js | 3 + {es6_modules => src}/internals/scale.js | 0 {es6_modules => src}/internals/selection.js | 2 + {es6_modules => src}/internals/shape.bar.js | 0 {es6_modules => src}/internals/shape.js | 0 {es6_modules => src}/internals/shape.line.js | 0 {es6_modules => src}/internals/size.js | 0 {es6_modules => src}/internals/subchart.js | 0 {es6_modules => src}/internals/text.js | 0 {es6_modules => src}/internals/title.js | 0 {es6_modules => src}/internals/tooltip.js | 0 {es6_modules => src}/internals/transform.js | 0 {es6_modules => src}/internals/type.js | 0 {es6_modules => src}/internals/ua.js | 0 {es6_modules => src}/internals/util.js | 0 {es6_modules => src}/internals/zoom.js | 0 src/polyfill.js | 842 ------------- src/tail.js | 17 - 125 files changed, 948 insertions(+), 9296 deletions(-) delete mode 100644 .jshintrc create mode 100644 c3.js.map delete mode 100644 es6_modules/axis/axis.js delete mode 100644 es6_modules/axis/c3.axis.js delete mode 100644 es6_modules/axis/index.js delete mode 100644 es6_modules/chart/api.axis.js delete mode 100644 es6_modules/chart/api.category.js delete mode 100644 es6_modules/chart/api.chart.js delete mode 100644 es6_modules/chart/api.color.js delete mode 100644 es6_modules/chart/api.data.js delete mode 100644 es6_modules/chart/api.flow.js delete mode 100644 es6_modules/chart/api.focus.js delete mode 100644 es6_modules/chart/api.grid.js delete mode 100644 es6_modules/chart/api.group.js delete mode 100644 es6_modules/chart/api.legend.js delete mode 100644 es6_modules/chart/api.load.js delete mode 100644 es6_modules/chart/api.region.js delete mode 100644 es6_modules/chart/api.selection.js delete mode 100644 es6_modules/chart/api.show.js delete mode 100644 es6_modules/chart/api.tooltip.js delete mode 100644 es6_modules/chart/api.transform.js delete mode 100644 es6_modules/chart/api.x.js delete mode 100644 es6_modules/chart/api.zoom.js delete mode 100644 es6_modules/chart/index.js create mode 100644 npm-debug.log delete mode 100644 src/chartinternal/arc.js delete mode 100644 src/chartinternal/cache.js delete mode 100644 src/chartinternal/category.js delete mode 100644 src/chartinternal/class.js delete mode 100644 src/chartinternal/clip.js delete mode 100644 src/chartinternal/color.js delete mode 100644 src/chartinternal/config.js delete mode 100644 src/chartinternal/data.convert.js delete mode 100644 src/chartinternal/data.js delete mode 100644 src/chartinternal/data.load.js delete mode 100644 src/chartinternal/domain.js delete mode 100644 src/chartinternal/drag.js delete mode 100644 src/chartinternal/flow.js delete mode 100644 src/chartinternal/format.js delete mode 100644 src/chartinternal/grid.js delete mode 100644 src/chartinternal/index.js delete mode 100644 src/chartinternal/interaction.js delete mode 100644 src/chartinternal/legend.js delete mode 100644 src/chartinternal/region.js delete mode 100644 src/chartinternal/scale.js delete mode 100644 src/chartinternal/selection.js delete mode 100644 src/chartinternal/shape.bar.js delete mode 100644 src/chartinternal/shape.js delete mode 100644 src/chartinternal/shape.line.js delete mode 100644 src/chartinternal/size.js delete mode 100644 src/chartinternal/subchart.js delete mode 100644 src/chartinternal/text.js delete mode 100644 src/chartinternal/title.js delete mode 100644 src/chartinternal/tooltip.js delete mode 100644 src/chartinternal/transform.js delete mode 100644 src/chartinternal/type.js delete mode 100644 src/chartinternal/ua.js delete mode 100644 src/chartinternal/util.js delete mode 100644 src/chartinternal/zoom.js delete mode 100644 src/head.js rename es6_modules/rollup.entry.js => src/index.js (95%) rename {es6_modules => src}/internals/arc.js (100%) rename {es6_modules => src}/internals/cache.js (100%) rename {es6_modules => src}/internals/category.js (100%) rename {es6_modules => src}/internals/class.js (100%) rename {es6_modules => src}/internals/clip.js (100%) rename {es6_modules => src}/internals/color.js (100%) rename {es6_modules => src}/internals/config.js (100%) rename {es6_modules => src}/internals/data.convert.js (100%) rename {es6_modules => src}/internals/data.js (100%) rename {es6_modules => src}/internals/data.load.js (100%) rename {es6_modules => src}/internals/domain.js (99%) rename {es6_modules => src}/internals/drag.js (97%) rename {es6_modules => src}/internals/flow.js (98%) rename {es6_modules => src}/internals/format.js (98%) rename {es6_modules => src}/internals/grid.js (99%) rename {es6_modules => src}/internals/index.js (100%) rename {es6_modules => src}/internals/interaction.js (99%) rename {es6_modules => src}/internals/legend.js (99%) rename {es6_modules => src}/internals/region.js (98%) rename {es6_modules => src}/internals/scale.js (100%) rename {es6_modules => src}/internals/selection.js (99%) rename {es6_modules => src}/internals/shape.bar.js (100%) rename {es6_modules => src}/internals/shape.js (100%) rename {es6_modules => src}/internals/shape.line.js (100%) rename {es6_modules => src}/internals/size.js (100%) rename {es6_modules => src}/internals/subchart.js (100%) rename {es6_modules => src}/internals/text.js (100%) rename {es6_modules => src}/internals/title.js (100%) rename {es6_modules => src}/internals/tooltip.js (100%) rename {es6_modules => src}/internals/transform.js (100%) rename {es6_modules => src}/internals/type.js (100%) rename {es6_modules => src}/internals/ua.js (100%) rename {es6_modules => src}/internals/util.js (100%) rename {es6_modules => src}/internals/zoom.js (100%) delete mode 100644 src/polyfill.js delete mode 100644 src/tail.js diff --git a/.eslintrc b/.eslintrc index e2e3aac..65dce24 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,9 @@ { "extends": "airbnb-base", + "env": { + "browser": true, + "node": true + }, "rules": { "indent": ["error", 4], "no-var": "error", @@ -37,5 +41,7 @@ "no-restricted-syntax": 0, "guard-for-in": 0, "max-lines": 0, + "vars-on-top": 0, + "no-unused-vars": 0, } } diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 9b4294c..0000000 --- a/.jshintrc +++ /dev/null @@ -1,31 +0,0 @@ -{ - "bitwise": true, - "eqeqeq": true, - "curly": true, - "strict": true, - "trailing": true, - "white": true, - "maxlen": 210, - "undef": true, - "unused": true, - "indent": 4, - - "eqnull": true, - "expr": true, - "newcap": false, - "loopfunc": true, - "bitwise": false, - - "browser": true, - - "globals": { - "jasmine": false, - "describe": false, - "beforeEach": false, - "beforeAll": false, - "it": false, - "expect": false, - "d3": false - } - -} diff --git a/c3.js b/c3.js index eafe2fa..c7e6bb7 100644 --- a/c3.js +++ b/c3.js @@ -7,8 +7,8 @@ d3 = 'default' in d3 ? d3['default'] : d3; var tickTextCharSize = void 0; -function c3_axis(d3$$1, params) { - var scale = d3$$1.scale.linear(); +function c3_axis(params) { + var scale = d3.scale.linear(); var orient = 'bottom'; var innerTickSize = 6; var tickPadding = 3; @@ -90,11 +90,11 @@ function c3_axis(d3$$1, params) { return size; } function transitionise(selection) { - return params.withoutTransition ? selection : d3$$1.transition(selection); + return params.withoutTransition ? selection : d3.transition(selection); } function axis(g) { g.each(function () { - var g = axis.g = d3$$1.select(this); + var g = axis.g = d3.select(this); var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = copyScale(); @@ -446,15 +446,15 @@ Axis$$1.prototype.init = function init() { var $$ = this.owner; var config = $$.config; var main = $$.main; - $$.axes.x = main.append('g').attr('class', CLASS$1.axis + ' ' + CLASS$1.axisX).attr('clip-path', $$.clipPathForXAxis).attr('transform', $$.getTranslate('x')).style('visibility', config.axis_x_show ? 'visible' : 'hidden'); - $$.axes.x.append('text').attr('class', CLASS$1.axisXLabel).attr('transform', config.axis_rotated ? 'rotate(-90)' : '').style('text-anchor', this.textAnchorForXAxisLabel.bind(this)); - $$.axes.y = main.append('g').attr('class', CLASS$1.axis + ' ' + CLASS$1.axisY).attr('clip-path', config.axis_y_inner ? '' : $$.clipPathForYAxis).attr('transform', $$.getTranslate('y')).style('visibility', config.axis_y_show ? 'visible' : 'hidden'); - $$.axes.y.append('text').attr('class', CLASS$1.axisYLabel).attr('transform', config.axis_rotated ? '' : 'rotate(-90)').style('text-anchor', this.textAnchorForYAxisLabel.bind(this)); + $$.axes.x = main.append('g').attr('class', CLASS.axis + ' ' + CLASS.axisX).attr('clip-path', $$.clipPathForXAxis).attr('transform', $$.getTranslate('x')).style('visibility', config.axis_x_show ? 'visible' : 'hidden'); + $$.axes.x.append('text').attr('class', CLASS.axisXLabel).attr('transform', config.axis_rotated ? 'rotate(-90)' : '').style('text-anchor', this.textAnchorForXAxisLabel.bind(this)); + $$.axes.y = main.append('g').attr('class', CLASS.axis + ' ' + CLASS.axisY).attr('clip-path', config.axis_y_inner ? '' : $$.clipPathForYAxis).attr('transform', $$.getTranslate('y')).style('visibility', config.axis_y_show ? 'visible' : 'hidden'); + $$.axes.y.append('text').attr('class', CLASS.axisYLabel).attr('transform', config.axis_rotated ? '' : 'rotate(-90)').style('text-anchor', this.textAnchorForYAxisLabel.bind(this)); - $$.axes.y2 = main.append('g').attr('class', CLASS$1.axis + ' ' + CLASS$1.axisY2) + $$.axes.y2 = main.append('g').attr('class', CLASS.axis + ' ' + CLASS.axisY2) // clip-path? .attr('transform', $$.getTranslate('y2')).style('visibility', config.axis_y2_show ? 'visible' : 'hidden'); - $$.axes.y2.append('text').attr('class', CLASS$1.axisY2Label).attr('transform', config.axis_rotated ? '' : 'rotate(-90)').style('text-anchor', this.textAnchorForY2AxisLabel.bind(this)); + $$.axes.y2.append('text').attr('class', CLASS.axisY2Label).attr('transform', config.axis_rotated ? '' : 'rotate(-90)').style('text-anchor', this.textAnchorForY2AxisLabel.bind(this)); }; Axis$$1.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) { var $$ = this.owner; @@ -467,7 +467,7 @@ Axis$$1.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickVa tickTextRotate: withoutRotateTickText ? 0 : config.axis_x_tick_rotate, withoutTransition: withoutTransition }; - var axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient); + var axis = c3_axis(axisParams).scale(scale).orient(orient); if ($$.isTimeSeries() && tickValues && typeof tickValues !== 'function') { tickValues = tickValues.map(function (v) { @@ -479,7 +479,7 @@ Axis$$1.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickVa axis.tickFormat(tickFormat).tickValues(tickValues); if ($$.isCategorized()) { axis.tickCentered(config.axis_x_tick_centered); - if (isEmpty$1(config.axis_x_tick_culling)) { + if (isEmpty$$1(config.axis_x_tick_culling)) { config.axis_x_tick_culling = false; } } @@ -509,7 +509,7 @@ Axis$$1.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickVa withoutTransition: withoutTransition, tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate }; - var axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat); + var axis = c3_axis(axisParams).scale(scale).orient(orient).tickFormat(tickFormat); if ($$.isTimeSeriesY()) { axis.ticks($$.d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval); } else { @@ -745,16 +745,16 @@ Axis$$1.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecomput Axis$$1.prototype.updateLabels = function updateLabels(withTransition) { var $$ = this.owner; - var axisXLabel = $$.main.select('.' + CLASS$1.axisX + ' .' + CLASS$1.axisXLabel); - var axisYLabel = $$.main.select('.' + CLASS$1.axisY + ' .' + CLASS$1.axisYLabel); - var axisY2Label = $$.main.select('.' + CLASS$1.axisY2 + ' .' + CLASS$1.axisY2Label); + var axisXLabel = $$.main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel); + var axisYLabel = $$.main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel); + var axisY2Label = $$.main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label); (withTransition ? axisXLabel.transition() : axisXLabel).attr('x', this.xForXAxisLabel.bind(this)).attr('dx', this.dxForXAxisLabel.bind(this)).attr('dy', this.dyForXAxisLabel.bind(this)).text(this.textForXAxisLabel.bind(this)); (withTransition ? axisYLabel.transition() : axisYLabel).attr('x', this.xForYAxisLabel.bind(this)).attr('dx', this.dxForYAxisLabel.bind(this)).attr('dy', this.dyForYAxisLabel.bind(this)).text(this.textForYAxisLabel.bind(this)); (withTransition ? axisY2Label.transition() : axisY2Label).attr('x', this.xForY2AxisLabel.bind(this)).attr('dx', this.dxForY2AxisLabel.bind(this)).attr('dy', this.dyForY2AxisLabel.bind(this)).text(this.textForY2AxisLabel.bind(this)); }; Axis$$1.prototype.getPadding = function getPadding(padding, key, defaultValue, domainLength) { var p = typeof padding === 'number' ? padding : padding[key]; - if (!isValue$1(p)) { + if (!isValue$$1(p)) { return defaultValue; } if (padding.unit === 'ratio') { @@ -865,7 +865,7 @@ function inherit(base, derived) { return derived; } -var CLASS$1 = { +var CLASS = { target: 'c3-target', chart: 'c3-chart', chartLine: 'c3-chart-line', @@ -946,88 +946,88 @@ var generateClass = function generateClass(prefix, targetId) { return ' ' + prefix + ' ' + prefix + this.getTargetSelectorSuffix(targetId); }; var classText = function classText(d) { - return this.generateClass(CLASS$1.text, d.index); + return this.generateClass(CLASS.text, d.index); }; var classTexts = function classTexts(d) { - return this.generateClass(CLASS$1.texts, d.id); + return this.generateClass(CLASS.texts, d.id); }; var classShape = function classShape(d) { - return this.generateClass(CLASS$1.shape, d.index); + return this.generateClass(CLASS.shape, d.index); }; var classShapes = function classShapes(d) { - return this.generateClass(CLASS$1.shapes, d.id); + return this.generateClass(CLASS.shapes, d.id); }; var classLine = function classLine(d) { - return this.classShape(d) + this.generateClass(CLASS$1.line, d.id); + return this.classShape(d) + this.generateClass(CLASS.line, d.id); }; var classLines = function classLines(d) { - return this.classShapes(d) + this.generateClass(CLASS$1.lines, d.id); + return this.classShapes(d) + this.generateClass(CLASS.lines, d.id); }; var classCircle = function classCircle(d) { - return this.classShape(d) + this.generateClass(CLASS$1.circle, d.index); + return this.classShape(d) + this.generateClass(CLASS.circle, d.index); }; var classCircles = function classCircles(d) { - return this.classShapes(d) + this.generateClass(CLASS$1.circles, d.id); + return this.classShapes(d) + this.generateClass(CLASS.circles, d.id); }; var classBar = function classBar(d) { - return this.classShape(d) + this.generateClass(CLASS$1.bar, d.index); + return this.classShape(d) + this.generateClass(CLASS.bar, d.index); }; var classBars = function classBars(d) { - return this.classShapes(d) + this.generateClass(CLASS$1.bars, d.id); + return this.classShapes(d) + this.generateClass(CLASS.bars, d.id); }; var classArc = function classArc(d) { - return this.classShape(d.data) + this.generateClass(CLASS$1.arc, d.data.id); + return this.classShape(d.data) + this.generateClass(CLASS.arc, d.data.id); }; var classArcs = function classArcs(d) { - return this.classShapes(d.data) + this.generateClass(CLASS$1.arcs, d.data.id); + return this.classShapes(d.data) + this.generateClass(CLASS.arcs, d.data.id); }; var classArea = function classArea(d) { - return this.classShape(d) + this.generateClass(CLASS$1.area, d.id); + return this.classShape(d) + this.generateClass(CLASS.area, d.id); }; var classAreas = function classAreas(d) { - return this.classShapes(d) + this.generateClass(CLASS$1.areas, d.id); + return this.classShapes(d) + this.generateClass(CLASS.areas, d.id); }; var classRegion = function classRegion(d, i) { - return this.generateClass(CLASS$1.region, i) + ' ' + ('class' in d ? d.class : ''); + return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : ''); }; var classEvent = function classEvent(d) { - return this.generateClass(CLASS$1.eventRect, d.index); + return this.generateClass(CLASS.eventRect, d.index); }; var classTarget = function classTarget(id) { var $$ = this; var additionalClassSuffix = $$.config.data_classes[id], additionalClass = ''; if (additionalClassSuffix) { - additionalClass = ' ' + CLASS$1.target + '-' + additionalClassSuffix; + additionalClass = ' ' + CLASS.target + '-' + additionalClassSuffix; } - return $$.generateClass(CLASS$1.target, id) + additionalClass; + return $$.generateClass(CLASS.target, id) + additionalClass; }; var classFocus = function classFocus(d) { return this.classFocused(d) + this.classDefocused(d); }; var classFocused = function classFocused(d) { - return ' ' + (this.focusedTargetIds.indexOf(d.id) >= 0 ? CLASS$1.focused : ''); + return ' ' + (this.focusedTargetIds.indexOf(d.id) >= 0 ? CLASS.focused : ''); }; var classDefocused = function classDefocused(d) { - return ' ' + (this.defocusedTargetIds.indexOf(d.id) >= 0 ? CLASS$1.defocused : ''); + return ' ' + (this.defocusedTargetIds.indexOf(d.id) >= 0 ? CLASS.defocused : ''); }; var classChartText = function classChartText(d) { - return CLASS$1.chartText + this.classTarget(d.id); + return CLASS.chartText + this.classTarget(d.id); }; var classChartLine = function classChartLine(d) { - return CLASS$1.chartLine + this.classTarget(d.id); + return CLASS.chartLine + this.classTarget(d.id); }; var classChartBar = function classChartBar(d) { - return CLASS$1.chartBar + this.classTarget(d.id); + return CLASS.chartBar + this.classTarget(d.id); }; var classChartArc = function classChartArc(d) { - return CLASS$1.chartArc + this.classTarget(d.data.id); + return CLASS.chartArc + this.classTarget(d.data.id); }; var getTargetSelectorSuffix = function getTargetSelectorSuffix(targetId) { return targetId || targetId === 0 ? ('-' + targetId).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g, '-') : ''; }; var selectorTarget = function selectorTarget(id, prefix) { - return (prefix || '') + '.' + CLASS$1.target + this.getTargetSelectorSuffix(id); + return (prefix || '') + '.' + CLASS.target + this.getTargetSelectorSuffix(id); }; var selectorTargets = function selectorTargets(ids, prefix) { var $$ = this; @@ -1037,7 +1037,7 @@ var selectorTargets = function selectorTargets(ids, prefix) { }) : null; }; var selectorLegend = function selectorLegend(id) { - return '.' + CLASS$1.legendItem + this.getTargetSelectorSuffix(id); + return '.' + CLASS.legendItem + this.getTargetSelectorSuffix(id); }; var selectorLegends = function selectorLegends(ids) { var $$ = this; @@ -1046,7 +1046,7 @@ var selectorLegends = function selectorLegends(ids) { }) : null; }; -var isValue$2 = function isValue$2(v) { +var isValue$1 = function isValue$1(v) { return v || v === 0; }; var isFunction$1 = function isFunction$1(o) { @@ -1058,7 +1058,7 @@ var isString$1 = function isString$1(o) { var isUndefined$1 = function isUndefined$1(v) { return typeof v === 'undefined'; }; -var isDefined$2 = function isDefined$2(v) { +var isDefined$1 = function isDefined$1(v) { return typeof v !== 'undefined'; }; var ceil10$1 = function ceil10$1(v) { @@ -1067,17 +1067,17 @@ var ceil10$1 = function ceil10$1(v) { var asHalfPixel$1 = function asHalfPixel$1(n) { return Math.ceil(n) + 0.5; }; -var diffDomain$2 = function diffDomain$2(d) { +var diffDomain$1 = function diffDomain$1(d) { return d[1] - d[0]; }; -var isEmpty$2 = function isEmpty$2(o) { +var isEmpty$1 = function isEmpty$1(o) { return typeof o === 'undefined' || o === null || isString$1(o) && o.length === 0 || (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && Object.keys(o).length === 0; }; -var notEmpty$2 = function notEmpty$2(o) { - isEmpty$2(o); +var notEmpty$1 = function notEmpty$1(o) { + isEmpty$1(o); }; -var getOption$2 = function getOption$2(options, key, defaultValue) { - return isDefined$2(options[key]) ? options[key] : defaultValue; +var getOption$1 = function getOption$1(options, key, defaultValue) { + return isDefined$1(options[key]) ? options[key] : defaultValue; }; var hasValue$1 = function hasValue$1(dict, value) { var found = false; @@ -1091,6 +1091,14 @@ var hasValue$1 = function hasValue$1(dict, value) { var sanitise$1 = function sanitise$1(str) { return typeof str === 'string' ? str.replace(//g, '>') : str; }; +var getPathBox$1 = function getPathBox$1(path) { + var box = path.getBoundingClientRect(), + items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)], + minX = items[0].x, + minY = Math.min(items[0].y, items[1].y); + + return { x: minX, y: minY, width: box.width, height: box.height }; +}; var initPie = function initPie() { var $$ = this, @@ -1274,7 +1282,7 @@ var expandArc = function expandArc(targetIds) { targetIds = $$.mapToTargetIds(targetIds); - $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS$1.chartArc)).each(function (d) { + $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS.chartArc)).each(function (d) { if (!$$.shouldExpand(d.data.id)) { return; } @@ -1295,10 +1303,10 @@ var unexpandArc = function unexpandArc(targetIds) { targetIds = $$.mapToTargetIds(targetIds); - $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS$1.chartArc)).selectAll('path').transition().duration(function (d) { + $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS.chartArc)).selectAll('path').transition().duration(function (d) { return $$.expandDuration(d.data.id); }).attr('d', $$.svgArc); - $$.svg.selectAll('.' + CLASS$1.arc).style('opacity', 1); + $$.svg.selectAll('.' + CLASS.arc).style('opacity', 1); }; var expandDuration = function expandDuration(id) { @@ -1367,7 +1375,7 @@ var updateTargetsForArc = function updateTargetsForArc(targets) { classChartArc$$1 = $$.classChartArc.bind($$), classArcs$$1 = $$.classArcs.bind($$), classFocus$$1 = $$.classFocus.bind($$); - mainPieUpdate = main.select('.' + CLASS$1.chartArcs).selectAll('.' + CLASS$1.chartArc).data($$.pie(targets)).attr('class', function (d) { + mainPieUpdate = main.select('.' + CLASS.chartArcs).selectAll('.' + CLASS.chartArc).data($$.pie(targets)).attr('class', function (d) { return classChartArc$$1(d) + classFocus$$1(d.data); }); mainPieEnter = mainPieUpdate.enter().append('g').attr('class', classChartArc$$1); @@ -1379,8 +1387,8 @@ var updateTargetsForArc = function updateTargetsForArc(targets) { var initArc = function initArc() { var $$ = this; - $$.arcs = $$.main.select('.' + CLASS$1.chart).append('g').attr('class', CLASS$1.chartArcs).attr('transform', $$.getTranslate('arc')); - $$.arcs.append('text').attr('class', CLASS$1.chartArcsTitle).style('text-anchor', 'middle').text($$.getArcTitle()); + $$.arcs = $$.main.select('.' + CLASS.chart).append('g').attr('class', CLASS.chartArcs).attr('transform', $$.getTranslate('arc')); + $$.arcs.append('text').attr('class', CLASS.chartArcsTitle).style('text-anchor', 'middle').text($$.getArcTitle()); }; var redrawArc = function redrawArc(duration, durationForExit, withTransform) { @@ -1389,7 +1397,7 @@ var redrawArc = function redrawArc(duration, durationForExit, withTransform) { config = $$.config, main = $$.main, mainArc = void 0; - mainArc = main.selectAll('.' + CLASS$1.arcs).selectAll('.' + CLASS$1.arc).data($$.arcData.bind($$)); + mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc).data($$.arcData.bind($$)); mainArc.enter().append('path').attr('class', $$.classArc.bind($$)).style('fill', function (d) { return $$.color(d.data); }).style('cursor', function (d) { @@ -1491,17 +1499,17 @@ var redrawArc = function redrawArc(duration, durationForExit, withTransform) { $$.transiting = false; }); mainArc.exit().transition().duration(durationForExit).style('opacity', 0).remove(); - main.selectAll('.' + CLASS$1.chartArc).select('text').style('opacity', 0).attr('class', function (d) { - return $$.isGaugeType(d.data) ? CLASS$1.gaugeValue : ''; + main.selectAll('.' + CLASS.chartArc).select('text').style('opacity', 0).attr('class', function (d) { + return $$.isGaugeType(d.data) ? CLASS.gaugeValue : ''; }).text($$.textForArcLabel.bind($$)).attr('transform', $$.transformForArcLabel.bind($$)).style('font-size', function (d) { return $$.isGaugeType(d.data) ? Math.round($$.radius / 5) + 'px' : ''; }).transition().duration(duration).style('opacity', function (d) { return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? 1 : 0; }); - main.select('.' + CLASS$1.chartArcsTitle).style('opacity', $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0); + main.select('.' + CLASS.chartArcsTitle).style('opacity', $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0); if ($$.hasType('gauge')) { - $$.arcs.select('.' + CLASS$1.chartArcsBackground).attr('d', function () { + $$.arcs.select('.' + CLASS.chartArcsBackground).attr('d', function () { var d = { data: [{ value: config.gauge_max }], startAngle: config.gauge_startingAngle, @@ -1509,18 +1517,18 @@ var redrawArc = function redrawArc(duration, durationForExit, withTransform) { }; return $$.getArc(d, true, true); }); - $$.arcs.select('.' + CLASS$1.chartArcsGaugeUnit).attr('dy', '.75em').text(config.gauge_label_show ? config.gauge_units : ''); - $$.arcs.select('.' + CLASS$1.chartArcsGaugeMin).attr('dx', -1 * ($$.innerRadius + ($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2)) + 'px').attr('dy', '1.2em').text(config.gauge_label_show ? config.gauge_min : ''); - $$.arcs.select('.' + CLASS$1.chartArcsGaugeMax).attr('dx', $$.innerRadius + ($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2) + 'px').attr('dy', '1.2em').text(config.gauge_label_show ? config.gauge_max : ''); + $$.arcs.select('.' + CLASS.chartArcsGaugeUnit).attr('dy', '.75em').text(config.gauge_label_show ? config.gauge_units : ''); + $$.arcs.select('.' + CLASS.chartArcsGaugeMin).attr('dx', -1 * ($$.innerRadius + ($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2)) + 'px').attr('dy', '1.2em').text(config.gauge_label_show ? config.gauge_min : ''); + $$.arcs.select('.' + CLASS.chartArcsGaugeMax).attr('dx', $$.innerRadius + ($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2) + 'px').attr('dy', '1.2em').text(config.gauge_label_show ? config.gauge_max : ''); } }; var initGauge = function initGauge() { var arcs = this.arcs; if (this.hasType('gauge')) { - arcs.append('path').attr('class', CLASS$1.chartArcsBackground); - arcs.append('text').attr('class', CLASS$1.chartArcsGaugeUnit).style('text-anchor', 'middle').style('pointer-events', 'none'); - arcs.append('text').attr('class', CLASS$1.chartArcsGaugeMin).style('text-anchor', 'middle').style('pointer-events', 'none'); - arcs.append('text').attr('class', CLASS$1.chartArcsGaugeMax).style('text-anchor', 'middle').style('pointer-events', 'none'); + arcs.append('path').attr('class', CLASS.chartArcsBackground); + arcs.append('text').attr('class', CLASS.chartArcsGaugeUnit).style('text-anchor', 'middle').style('pointer-events', 'none'); + arcs.append('text').attr('class', CLASS.chartArcsGaugeMin).style('text-anchor', 'middle').style('pointer-events', 'none'); + arcs.append('text').attr('class', CLASS.chartArcsGaugeMax).style('text-anchor', 'middle').style('pointer-events', 'none'); } }; var getGaugeLabelHeight = function getGaugeLabelHeight() { @@ -1620,7 +1628,7 @@ var generateColor = function generateColor() { config = $$.config, d3$$1 = $$.d3, colors = config.data_colors, - pattern = notEmpty$2(config.color_pattern) ? config.color_pattern : d3$$1.scale.category10().range(), + pattern = notEmpty$1(config.color_pattern) ? config.color_pattern : d3$$1.scale.category10().range(), callback = config.data_color, ids = []; @@ -1655,7 +1663,7 @@ var generateLevelColor = function generateLevelColor() { asValue = threshold.unit === 'value', values = threshold.values && threshold.values.length ? threshold.values : [], max = threshold.max || 100; - return notEmpty$2(config.color_threshold) ? function (value) { + return notEmpty$1(config.color_threshold) ? function (value) { var i = void 0, v = void 0, color = colors[colors.length - 1]; @@ -1943,7 +1951,7 @@ var loadConfig = function loadConfig(config) { keys = key.split('_'); read = find(); // console.log("CONFIG : ", key, read); - if (isDefined$2(read)) { + if (isDefined$1(read)) { this_config[key] = read; } }); @@ -2094,7 +2102,7 @@ var convertDataToTargets = function convertDataToTargets(data, appendXs) { if (xs.indexOf(xKey) >= 0) { $$.data.xs[id] = (appendXs && $$.data.xs[id] ? $$.data.xs[id] : []).concat(data.map(function (d) { return d[xKey]; - }).filter(isValue$2).map(function (rawX, i) { + }).filter(isValue$1).map(function (rawX, i) { return $$.generateTargetX(rawX, id, i); })); } @@ -2103,7 +2111,7 @@ var convertDataToTargets = function convertDataToTargets(data, appendXs) { $$.data.xs[id] = $$.getOtherTargetXs(); } // if not included in input data, find from preloaded data - else if (notEmpty$2(config.data_xs)) { + else if (notEmpty$1(config.data_xs)) { $$.data.xs[id] = $$.getXValuesOfXKey(xKey, $$.data.targets); } // MEMO: if no x included, use same x of current will be used @@ -2151,7 +2159,7 @@ var convertDataToTargets = function convertDataToTargets(data, appendXs) { } return { x: x, value: value, id: convertedId }; }).filter(function (v) { - return isDefined$2(v.x); + return isDefined$1(v.x); }) }; }); @@ -2200,7 +2208,7 @@ var convertDataToTargets = function convertDataToTargets(data, appendXs) { var isX = function isX(key) { var $$ = this, config = $$.config; - return config.data_x && key === config.data_x || notEmpty$2(config.data_xs) && hasValue$1(config.data_xs, key); + return config.data_x && key === config.data_x || notEmpty$1(config.data_xs) && hasValue$1(config.data_xs, key); }; var isNotX = function isNotX(key) { return !this.isX(key); @@ -2208,12 +2216,12 @@ var isNotX = function isNotX(key) { var getXKey = function getXKey(id) { var $$ = this, config = $$.config; - return config.data_x ? config.data_x : notEmpty$2(config.data_xs) ? config.data_xs[id] : null; + return config.data_x ? config.data_x : notEmpty$1(config.data_xs) ? config.data_xs[id] : null; }; var getXValuesOfXKey = function getXValuesOfXKey(key, targets) { var $$ = this, xValues = void 0, - ids = targets && notEmpty$2(targets) ? $$.mapToIds(targets) : []; + ids = targets && notEmpty$1(targets) ? $$.mapToIds(targets) : []; ids.forEach(function (id) { if ($$.getXKey(id) === key) { xValues = $$.data.xs[id]; @@ -2228,7 +2236,7 @@ var getIndexByX = function getIndexByX(x) { }; var getXValue = function getXValue(id, i) { var $$ = this; - return id in $$.data.xs && $$.data.xs[id] && isValue$2($$.data.xs[id][i]) ? $$.data.xs[id][i] : i; + return id in $$.data.xs && $$.data.xs[id] && isValue$1($$.data.xs[id][i]) ? $$.data.xs[id][i] : i; }; var getOtherTargetXs = function getOtherTargetXs() { var $$ = this, @@ -2251,7 +2259,7 @@ var hasMultipleX = function hasMultipleX(xs) { })).size() > 1; }; var isMultipleX = function isMultipleX() { - return notEmpty$2(this.config.data_xs) || !this.config.data_xSort || this.hasType('scatter'); + return notEmpty$1(this.config.data_xs) || !this.config.data_xSort || this.hasType('scatter'); }; var addName = function addName(data) { var $$ = this, @@ -2291,7 +2299,7 @@ var generateTargetX = function generateTargetX(rawX, id, index) { if ($$.isTimeSeries()) { x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index)); } else if ($$.isCustomX() && !$$.isCategorized()) { - x = isValue$2(rawX) ? +rawX : $$.getXValue(id, index); + x = isValue$1(rawX) ? +rawX : $$.getXValue(id, index); } else { x = index; } @@ -2487,7 +2495,7 @@ var filterByX = function filterByX(targets, x) { }; var filterRemoveNull = function filterRemoveNull(data) { return data.filter(function (d) { - return isValue$2(d.value); + return isValue$1(d.value); }); }; var filterByXDomain = function filterByXDomain(targets, xDomain) { @@ -2505,7 +2513,7 @@ var hasDataLabel = function hasDataLabel() { var config = this.config; if (typeof config.data_labels === 'boolean' && config.data_labels) { return true; - } else if (_typeof(config.data_labels) === 'object' && notEmpty$2(config.data_labels)) { + } else if (_typeof(config.data_labels) === 'object' && notEmpty$1(config.data_labels)) { return true; } return false; @@ -2567,7 +2575,7 @@ var findClosest = function findClosest(values, pos) { values.filter(function (v) { return v && $$.isBarType(v.id); }).forEach(function (v) { - var shape = $$.main.select('.' + CLASS$1.bars + $$.getTargetSelectorSuffix(v.id) + ' .' + CLASS$1.bar + '-' + v.index).node(); + var shape = $$.main.select('.' + CLASS.bars + $$.getTargetSelectorSuffix(v.id) + ' .' + CLASS.bar + '-' + v.index).node(); if (!closest && $$.isWithinBar(shape)) { closest = v; } @@ -2711,7 +2719,7 @@ var unload = function unload(targetIds, done) { $$.withoutFadeIn[id] = false; // Remove target's elements if ($$.legend) { - $$.legend.selectAll('.' + CLASS$1.legendItem + $$.getTargetSelectorSuffix(id)).remove(); + $$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove(); } // Remove target $$.data.targets = $$.data.targets.filter(function (t) { @@ -2841,8 +2849,8 @@ var getYDomain = function getYDomain(targets, axisId, xDomain) { showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated; // MEMO: avoid inverting domain unexpectedly - yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? yDomainMin < yMax ? yDomainMin : yMax - 10 : yDomainMin; - yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? yMin < yDomainMax ? yDomainMax : yMin + 10 : yDomainMax; + yDomainMin = isValue$1(yMin) ? yMin : isValue$1(yMax) ? yDomainMin < yMax ? yDomainMin : yMax - 10 : yDomainMin; + yDomainMax = isValue$1(yMax) ? yMax : isValue$1(yMin) ? yMin < yDomainMax ? yDomainMax : yMin + 10 : yDomainMax; if (yTargets.length === 0) { // use current domain if target of axisId is none @@ -2863,7 +2871,7 @@ var getYDomain = function getYDomain(targets, axisId, xDomain) { isAllNegative = yDomainMin <= 0 && yDomainMax <= 0; // Cancel zerobased if axis_*_min / axis_*_max specified - if (isValue(yMin) && isAllPositive || isValue(yMax) && isAllNegative) { + if (isValue$1(yMin) && isAllPositive || isValue$1(yMax) && isAllNegative) { isZeroBased = false; } @@ -2888,7 +2896,7 @@ var getYDomain = function getYDomain(targets, axisId, xDomain) { // add padding for data label if (showHorizontalDataLabel) { lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, 'width'); - diff = diffDomain($$.y.range()); + diff = diffDomain$1($$.y.range()); ratio = [lengths[0] / diff, lengths[1] / diff]; padding_top += domainLength * (ratio[1] / (1 - ratio[0] - ratio[1])); padding_bottom += domainLength * (ratio[0] / (1 - ratio[0] - ratio[1])); @@ -2897,11 +2905,11 @@ var getYDomain = function getYDomain(targets, axisId, xDomain) { padding_top += $$.axis.convertPixelsToAxisPadding(lengths[1], domainLength); padding_bottom += $$.axis.convertPixelsToAxisPadding(lengths[0], domainLength); } - if (axisId === 'y' && notEmpty(config.axis_y_padding)) { + if (axisId === 'y' && notEmpty$1(config.axis_y_padding)) { padding_top = $$.axis.getPadding(config.axis_y_padding, 'top', padding_top, domainLength); padding_bottom = $$.axis.getPadding(config.axis_y_padding, 'bottom', padding_bottom, domainLength); } - if (axisId === 'y2' && notEmpty(config.axis_y2_padding)) { + if (axisId === 'y2' && notEmpty$1(config.axis_y2_padding)) { padding_top = $$.axis.getPadding(config.axis_y2_padding, 'top', padding_top, domainLength); padding_bottom = $$.axis.getPadding(config.axis_y2_padding, 'bottom', padding_bottom, domainLength); } @@ -2920,7 +2928,7 @@ var getYDomain = function getYDomain(targets, axisId, xDomain) { var getXDomainMin = function getXDomainMin(targets) { var $$ = this, config = $$.config; - return isDefined(config.axis_x_min) ? $$.isTimeSeries() ? this.parseDate(config.axis_x_min) : config.axis_x_min : $$.d3.min(targets, function (t) { + return isDefined$1(config.axis_x_min) ? $$.isTimeSeries() ? this.parseDate(config.axis_x_min) : config.axis_x_min : $$.d3.min(targets, function (t) { return $$.d3.min(t.values, function (v) { return v.x; }); @@ -2929,7 +2937,7 @@ var getXDomainMin = function getXDomainMin(targets) { var getXDomainMax = function getXDomainMax(targets) { var $$ = this, config = $$.config; - return isDefined(config.axis_x_max) ? $$.isTimeSeries() ? this.parseDate(config.axis_x_max) : config.axis_x_max : $$.d3.max(targets, function (t) { + return isDefined$1(config.axis_x_max) ? $$.isTimeSeries() ? this.parseDate(config.axis_x_max) : config.axis_x_max : $$.d3.max(targets, function (t) { return $$.d3.max(t.values, function (v) { return v.x; }); @@ -2951,9 +2959,9 @@ var getXDomainPadding = function getXDomainPadding(domain) { } else { padding = diff * 0.01; } - if (_typeof(config.axis_x_padding) === 'object' && notEmpty(config.axis_x_padding)) { - paddingLeft = isValue(config.axis_x_padding.left) ? config.axis_x_padding.left : padding; - paddingRight = isValue(config.axis_x_padding.right) ? config.axis_x_padding.right : padding; + if (_typeof(config.axis_x_padding) === 'object' && notEmpty$1(config.axis_x_padding)) { + paddingLeft = isValue$1(config.axis_x_padding.left) ? config.axis_x_padding.left : padding; + paddingRight = isValue$1(config.axis_x_padding.right) ? config.axis_x_padding.right : padding; } else if (typeof config.axis_x_padding === 'number') { paddingLeft = paddingRight = config.axis_x_padding; } else { @@ -3088,7 +3096,7 @@ var drag = function drag(mouse) { toggle = $$.togglePoint; isWithin = minX < _x && _x < maxX && minY < _y && _y < maxY; } else if (shape.classed(CLASS.bar)) { - box = getPathBox(this); + box = getPathBox$1(this); _x = box.x; _y = box.y; _w = box.width; @@ -3202,7 +3210,7 @@ var generateFlow = function generateFlow(args) { flowEnd = $$.getValueOnIndex($$.data.targets[0].values, $$.data.targets[0].values.length - 1); translateX = $$.x(flowStart.x) - $$.x(flowEnd.x); } else { - translateX = diffDomain(domain) / 2; + translateX = diffDomain$1(domain) / 2; } } } else if (flow.orgDataCount === 1 || (flowStart && flowStart.x) === (flowEnd && flowEnd.x)) { @@ -3214,7 +3222,7 @@ var generateFlow = function generateFlow(args) { translateX = $$.x(flowStart.x) - $$.x(flowEnd.x); } } - scaleX = diffDomain(orgDomain) / diffDomain(domain); + scaleX = diffDomain$1(orgDomain) / diffDomain$1(domain); transform = 'translate(' + translateX + ',0) scale(' + scaleX + ',1)'; $$.hideXGridFocus(); @@ -3295,7 +3303,7 @@ var y2Format = function y2Format(v) { return format(v); }; var defaultValueFormat = function defaultValueFormat(v) { - return isValue(v) ? +v : ''; + return isValue$1(v) ? +v : ''; }; var defaultArcValueFormat = function defaultArcValueFormat(v, ratio) { return (ratio * 100).toFixed(1) + '%'; @@ -3305,7 +3313,7 @@ var dataLabelFormat = function dataLabelFormat(targetId) { data_labels = $$.config.data_labels, format = void 0, defaultFormat = function defaultFormat(v) { - return isValue(v) ? +v : ''; + return isValue$1(v) ? +v : ''; }; // find format according to axis id if (typeof data_labels.format === 'function') { @@ -3472,7 +3480,7 @@ var showXGridFocus = function showXGridFocus(selectedData) { var $$ = this, config = $$.config, dataToShow = selectedData.filter(function (d) { - return d && isValue(d.value); + return d && isValue$1(d.value); }), focusEl = $$.main.selectAll('line.' + CLASS.xgridFocus), xx = $$.xx.bind($$); @@ -3540,9 +3548,9 @@ var removeGridLines = function removeGridLines(params, forX) { toShow = function toShow(line) { return !toRemove(line); }, - classLines = forX ? CLASS.xgridLines : CLASS.ygridLines, - classLine = forX ? CLASS.xgridLine : CLASS.ygridLine; - $$.main.select('.' + classLines).selectAll('.' + classLine).filter(toRemove).transition().duration(config.transition_duration).style('opacity', 0).remove(); + classLines$$1 = forX ? CLASS.xgridLines : CLASS.ygridLines, + classLine$$1 = forX ? CLASS.xgridLine : CLASS.ygridLine; + $$.main.select('.' + classLines$$1).selectAll('.' + classLine$$1).filter(toRemove).transition().duration(config.transition_duration).style('opacity', 0).remove(); if (forX) { config.grid_x_lines = config.grid_x_lines.filter(toShow); } else { @@ -4080,7 +4088,7 @@ var showLegend = function showLegend(targetIds) { var hideLegend = function hideLegend(targetIds) { var $$ = this, config = $$.config; - if (config.legend_show && isEmpty(targetIds)) { + if (config.legend_show && isEmpty$1(targetIds)) { config.legend_show = false; $$.legend.style('visibility', 'hidden'); } @@ -4125,12 +4133,12 @@ var updateLegend = function updateLegend(targetIds, options, transitions) { // Skip elements when their name is set to null targetIds = targetIds.filter(function (id) { - return !isDefined(config.data_names[id]) || config.data_names[id] !== null; + return !isDefined$1(config.data_names[id]) || config.data_names[id] !== null; }); options = options || {}; - withTransition = getOption(options, 'withTransition', true); - withTransitionForTransform = getOption(options, 'withTransitionForTransform', true); + withTransition = getOption$1(options, 'withTransition', true); + withTransitionForTransform = getOption$1(options, 'withTransitionForTransform', true); function getTextBox(textElement, id) { if (!$$.legendItemTextBox[id]) { @@ -4295,7 +4303,7 @@ var updateLegend = function updateLegend(targetIds, options, transitions) { } }); l.append('text').text(function (id) { - return isDefined(config.data_names[id]) ? config.data_names[id] : id; + return isDefined$1(config.data_names[id]) ? config.data_names[id] : id; }).each(function (id, i) { updatePositions(this, id, i); }).style('pointer-events', 'none').attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200).attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendText); @@ -4309,7 +4317,7 @@ var updateLegend = function updateLegend(targetIds, options, transitions) { } texts = $$.legend.selectAll('text').data(targetIds).text(function (id) { - return isDefined(config.data_names[id]) ? config.data_names[id] : id; + return isDefined$1(config.data_names[id]) ? config.data_names[id] : id; }) // MEMO: needed for update .each(function (id, i) { updatePositions(this, id, i); @@ -4378,7 +4386,7 @@ var redrawRegion = function redrawRegion(withTransition) { w = $$.regionWidth.bind($$), h = $$.regionHeight.bind($$); return [(withTransition ? regions.transition() : regions).attr('x', x).attr('y', y).attr('width', w).attr('height', h).style('fill-opacity', function (d) { - return isValue(d.opacity) ? d.opacity : 0.1; + return isValue$1(d.opacity) ? d.opacity : 0.1; })]; }; var regionX = function regionX(d) { @@ -4626,7 +4634,7 @@ var toggleShape = function toggleShape(that, d, i) { var initBar = function initBar() { var $$ = this; - $$.main.select('.' + CLASS$1.chart).append('g').attr('class', CLASS$1.chartBars); + $$.main.select('.' + CLASS.chart).append('g').attr('class', CLASS.chartBars); }; var updateTargetsForBar = function updateTargetsForBar(targets) { var $$ = this, @@ -4636,7 +4644,7 @@ var updateTargetsForBar = function updateTargetsForBar(targets) { classChartBar$$1 = $$.classChartBar.bind($$), classBars$$1 = $$.classBars.bind($$), classFocus$$1 = $$.classFocus.bind($$); - mainBarUpdate = $$.main.select('.' + CLASS$1.chartBars).selectAll('.' + CLASS$1.chartBar).data(targets).attr('class', function (d) { + mainBarUpdate = $$.main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar).data(targets).attr('class', function (d) { return classChartBar$$1(d) + classFocus$$1(d); }); mainBarEnter = mainBarUpdate.enter().append('g').attr('class', classChartBar$$1).style('opacity', 0).style('pointer-events', 'none'); @@ -4653,7 +4661,7 @@ var updateBar = function updateBar(durationForExit) { color = function color(d) { return $$.color(d.id); }; - $$.mainBar = $$.main.selectAll('.' + CLASS$1.bars).selectAll('.' + CLASS$1.bar).data(barData); + $$.mainBar = $$.main.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar).data(barData); $$.mainBar.enter().append('path').attr('class', classBar$$1).style('stroke', color).style('fill', color); $$.mainBar.style('opacity', initialOpacity); $$.mainBar.exit().transition().duration(durationForExit).style('opacity', 0).remove(); @@ -4669,18 +4677,18 @@ var getBarW = function getBarW(axis, barTargetsNum) { }; var getBars = function getBars(i, id) { var $$ = this; - return (id ? $$.main.selectAll('.' + CLASS$1.bars + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS$1.bar + (isValue$2(i) ? '-' + i : '')); + return (id ? $$.main.selectAll('.' + CLASS.bars + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.bar + (isValue$1(i) ? '-' + i : '')); }; var expandBars = function expandBars(i, id, reset) { var $$ = this; if (reset) { $$.unexpandBars(); } - $$.getBars(i, id).classed(CLASS$1.EXPANDED, true); + $$.getBars(i, id).classed(CLASS.EXPANDED, true); }; var unexpandBars = function unexpandBars(i) { var $$ = this; - $$.getBars(i).classed(CLASS$1.EXPANDED, false); + $$.getBars(i).classed(CLASS.EXPANDED, false); }; var generateDrawBar = function generateDrawBar(barIndices, isSub) { var $$ = this, @@ -4826,7 +4834,7 @@ var isWithinShape = function isWithinShape(that, d) { } else if (that.nodeName === 'circle') { isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScale(d.id)(d.value)) : $$.isWithinCircle(that, $$.pointSelectR(d) * 1.5); } else if (that.nodeName === 'path') { - isWithin = shape.classed(CLASS$1.bar) ? $$.isWithinBar(that) : true; + isWithin = shape.classed(CLASS.bar) ? $$.isWithinBar(that) : true; } return isWithin; }; @@ -4839,7 +4847,7 @@ var getInterpolate = function getInterpolate(d) { var initLine = function initLine() { var $$ = this; - $$.main.select('.' + CLASS$1.chart).append('g').attr('class', CLASS$1.chartLines); + $$.main.select('.' + CLASS.chart).append('g').attr('class', CLASS.chartLines); }; var updateTargetsForLine = function updateTargetsForLine(targets) { var $$ = this, @@ -4851,7 +4859,7 @@ var updateTargetsForLine = function updateTargetsForLine(targets) { classAreas$$1 = $$.classAreas.bind($$), classCircles$$1 = $$.classCircles.bind($$), classFocus$$1 = $$.classFocus.bind($$); - mainLineUpdate = $$.main.select('.' + CLASS$1.chartLines).selectAll('.' + CLASS$1.chartLine).data(targets).attr('class', function (d) { + mainLineUpdate = $$.main.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine).data(targets).attr('class', function (d) { return classChartLine$$1(d) + classFocus$$1(d); }); mainLineEnter = mainLineUpdate.enter().append('g').attr('class', classChartLine$$1).style('opacity', 0).style('pointer-events', 'none'); @@ -4861,14 +4869,14 @@ var updateTargetsForLine = function updateTargetsForLine(targets) { mainLineEnter.append('g').attr('class', classAreas$$1); // Circles for each data point on lines mainLineEnter.append('g').attr('class', function (d) { - return $$.generateClass(CLASS$1.selectedCircles, d.id); + return $$.generateClass(CLASS.selectedCircles, d.id); }); mainLineEnter.append('g').attr('class', classCircles$$1).style('cursor', function (d) { return config.data_selection_isselectable(d) ? 'pointer' : null; }); // Update date for selected circles targets.forEach(function (t) { - $$.main.selectAll('.' + CLASS$1.selectedCircles + $$.getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS$1.selectedCircle).each(function (d) { + $$.main.selectAll('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS.selectedCircle).each(function (d) { d.value = t.values[d.index].value; }); }); @@ -4877,7 +4885,7 @@ var updateTargetsForLine = function updateTargetsForLine(targets) { }; var updateLine = function updateLine(durationForExit) { var $$ = this; - $$.mainLine = $$.main.selectAll('.' + CLASS$1.lines).selectAll('.' + CLASS$1.line).data($$.lineData.bind($$)); + $$.mainLine = $$.main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line).data($$.lineData.bind($$)); $$.mainLine.enter().append('path').attr('class', $$.classLine.bind($$)).style('stroke', $$.color); $$.mainLine.style('opacity', $$.initialOpacity.bind($$)).style('shape-rendering', function (d) { return $$.isStepType(d) ? 'crispEdges' : ''; @@ -4991,7 +4999,7 @@ var lineWithRegions = function lineWithRegions(d, x, y, _regions) { } // Check start/end of regions - if (isDefined$2(_regions)) { + if (isDefined$1(_regions)) { for (i = 0; i < _regions.length; i++) { regions[i] = {}; if (isUndefined$1(_regions[i].start)) { @@ -5079,7 +5087,7 @@ var lineWithRegions = function lineWithRegions(d, x, y, _regions) { var updateArea = function updateArea(durationForExit) { var $$ = this, d3$$1 = $$.d3; - $$.mainArea = $$.main.selectAll('.' + CLASS$1.areas).selectAll('.' + CLASS$1.area).data($$.lineData.bind($$)); + $$.mainArea = $$.main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area).data($$.lineData.bind($$)); $$.mainArea.enter().append('path').attr('class', $$.classArea.bind($$)).style('fill', $$.color).style('opacity', function () { $$.orgAreaOpacity = +d3$$1.select(this).style('opacity');return 0; }); @@ -5164,13 +5172,13 @@ var generateGetAreaPoints = function generateGetAreaPoints(areaIndices, isSub) { var updateCircle = function updateCircle() { var $$ = this; - $$.mainCircle = $$.main.selectAll('.' + CLASS$1.circles).selectAll('.' + CLASS$1.circle).data($$.lineOrScatterData.bind($$)); + $$.mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle).data($$.lineOrScatterData.bind($$)); $$.mainCircle.enter().append('circle').attr('class', $$.classCircle.bind($$)).attr('r', $$.pointR.bind($$)).style('fill', $$.color); $$.mainCircle.style('opacity', $$.initialOpacityForCircle.bind($$)); $$.mainCircle.exit().remove(); }; var redrawCircle = function redrawCircle(cx, cy, withTransition) { - var selectedCircles = this.main.selectAll('.' + CLASS$1.selectedCircle); + var selectedCircles = this.main.selectAll('.' + CLASS.selectedCircle); return [(withTransition ? this.mainCircle.transition(Math.random().toString()) : this.mainCircle).style('opacity', this.opacityForCircle.bind(this)).style('fill', this.color).attr('cx', cx).attr('cy', cy), (withTransition ? selectedCircles.transition(Math.random().toString()) : selectedCircles).attr('cx', cx).attr('cy', cy)]; }; var circleX = function circleX(d) { @@ -5193,7 +5201,7 @@ var updateCircleY = function updateCircleY() { }; var getCircles = function getCircles(i, id) { var $$ = this; - return (id ? $$.main.selectAll('.' + CLASS$1.circles + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS$1.circle + (isValue$2(i) ? '-' + i : '')); + return (id ? $$.main.selectAll('.' + CLASS.circles + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.circle + (isValue$1(i) ? '-' + i : '')); }; var expandCircles = function expandCircles(i, id, reset) { var $$ = this, @@ -5201,14 +5209,14 @@ var expandCircles = function expandCircles(i, id, reset) { if (reset) { $$.unexpandCircles(); } - $$.getCircles(i, id).classed(CLASS$1.EXPANDED, true).attr('r', r); + $$.getCircles(i, id).classed(CLASS.EXPANDED, true).attr('r', r); }; var unexpandCircles = function unexpandCircles(i) { var $$ = this, r = $$.pointR.bind($$); $$.getCircles(i).filter(function () { - return $$.d3.select(this).classed(CLASS$1.EXPANDED); - }).classed(CLASS$1.EXPANDED, false).attr('r', r); + return $$.d3.select(this).classed(CLASS.EXPANDED); + }).classed(CLASS.EXPANDED, false).attr('r', r); }; var pointR = function pointR(d) { var $$ = this, @@ -5251,7 +5259,7 @@ var getCurrentHeight = function getCurrentHeight() { var getCurrentPaddingTop = function getCurrentPaddingTop() { var $$ = this, config = $$.config, - padding = isValue$2(config.padding_top) ? config.padding_top : 0; + padding = isValue$1(config.padding_top) ? config.padding_top : 0; if ($$.title && $$.title.node()) { padding += $$.getTitlePadding(); } @@ -5259,12 +5267,12 @@ var getCurrentPaddingTop = function getCurrentPaddingTop() { }; var getCurrentPaddingBottom = function getCurrentPaddingBottom() { var config = this.config; - return isValue$2(config.padding_bottom) ? config.padding_bottom : 0; + return isValue$1(config.padding_bottom) ? config.padding_bottom : 0; }; var getCurrentPaddingLeft = function getCurrentPaddingLeft(withoutRecompute) { var $$ = this, config = $$.config; - if (isValue$2(config.padding_left)) { + if (isValue$1(config.padding_left)) { return config.padding_left; } else if (config.axis_rotated) { return !config.axis_x_show ? 1 : Math.max(ceil10$1($$.getAxisWidthByAxisId('x', withoutRecompute)), 40); @@ -5280,7 +5288,7 @@ var getCurrentPaddingRight = function getCurrentPaddingRight() { config = $$.config, defaultPadding = 10, legendWidthOnRight = $$.isLegendRight ? $$.getLegendWidth() + 20 : 0; - if (isValue$2(config.padding_right)) { + if (isValue$1(config.padding_right)) { return config.padding_right + 1; // 1 is needed not to hide tick line } else if (config.axis_rotated) { return defaultPadding + legendWidthOnRight; @@ -5324,7 +5332,7 @@ var getSvgLeft = function getSvgLeft(withoutRecompute) { var $$ = this, config = $$.config, hasLeftAxisRect = config.axis_rotated || !config.axis_rotated && !config.axis_y_inner, - leftAxisClass = config.axis_rotated ? CLASS$1.axisX : CLASS$1.axisY, + leftAxisClass = config.axis_rotated ? CLASS.axisX : CLASS.axisY, leftAxis = $$.main.select('.' + leftAxisClass).node(), svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : { right: 0 }, chartRect = $$.selectChart.node().getBoundingClientRect(), @@ -5377,7 +5385,7 @@ var initBrush = function initBrush() { }); $$.brush.update = function () { if ($$.context) { - $$.context.select('.' + CLASS$1.brush).call(this); + $$.context.select('.' + CLASS.brush).call(this); } return this; }; @@ -5394,20 +5402,20 @@ var initSubchart = function initSubchart() { context.style('visibility', visibility); // Define g for chart area - context.append('g').attr('clip-path', $$.clipPathForSubchart).attr('class', CLASS$1.chart); + context.append('g').attr('clip-path', $$.clipPathForSubchart).attr('class', CLASS.chart); // Define g for bar chart area - context.select('.' + CLASS$1.chart).append('g').attr('class', CLASS$1.chartBars); + context.select('.' + CLASS.chart).append('g').attr('class', CLASS.chartBars); // Define g for line chart area - context.select('.' + CLASS$1.chart).append('g').attr('class', CLASS$1.chartLines); + context.select('.' + CLASS.chart).append('g').attr('class', CLASS.chartLines); // Add extent rect for Brush - context.append('g').attr('clip-path', $$.clipPath).attr('class', CLASS$1.brush).call($$.brush); + context.append('g').attr('clip-path', $$.clipPath).attr('class', CLASS.brush).call($$.brush); // ATTENTION: This must be called AFTER chart added // Add Axis - $$.axes.subx = context.append('g').attr('class', CLASS$1.axisX).attr('transform', $$.getTranslate('subx')).attr('clip-path', config.axis_rotated ? '' : $$.clipPathForXAxis).style('visibility', config.subchart_axis_x_show ? visibility : 'hidden'); + $$.axes.subx = context.append('g').attr('class', CLASS.axisX).attr('transform', $$.getTranslate('subx')).attr('clip-path', config.axis_rotated ? '' : $$.clipPathForXAxis).style('visibility', config.subchart_axis_x_show ? visibility : 'hidden'); }; var updateTargetsForSubchart = function updateTargetsForSubchart(targets) { var $$ = this, @@ -5425,13 +5433,13 @@ var updateTargetsForSubchart = function updateTargetsForSubchart(targets) { if (config.subchart_show) { // -- Bar --// - contextBarUpdate = context.select('.' + CLASS$1.chartBars).selectAll('.' + CLASS$1.chartBar).data(targets).attr('class', classChartBar$$1); + contextBarUpdate = context.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar).data(targets).attr('class', classChartBar$$1); contextBarEnter = contextBarUpdate.enter().append('g').style('opacity', 0).attr('class', classChartBar$$1); // Bars for each data contextBarEnter.append('g').attr('class', classBars$$1); // -- Line --// - contextLineUpdate = context.select('.' + CLASS$1.chartLines).selectAll('.' + CLASS$1.chartLine).data(targets).attr('class', classChartLine$$1); + contextLineUpdate = context.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine).data(targets).attr('class', classChartLine$$1); contextLineEnter = contextLineUpdate.enter().append('g').style('opacity', 0).attr('class', classChartLine$$1); // Lines for each data contextLineEnter.append('g').attr('class', classLines$$1); @@ -5439,12 +5447,12 @@ var updateTargetsForSubchart = function updateTargetsForSubchart(targets) { contextLineEnter.append('g').attr('class', classAreas$$1); // -- Brush --// - context.selectAll('.' + CLASS$1.brush + ' rect').attr(config.axis_rotated ? 'width' : 'height', config.axis_rotated ? $$.width2 : $$.height2); + context.selectAll('.' + CLASS.brush + ' rect').attr(config.axis_rotated ? 'width' : 'height', config.axis_rotated ? $$.width2 : $$.height2); } }; var updateBarForSubchart = function updateBarForSubchart(durationForExit) { var $$ = this; - $$.contextBar = $$.context.selectAll('.' + CLASS$1.bars).selectAll('.' + CLASS$1.bar).data($$.barData.bind($$)); + $$.contextBar = $$.context.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar).data($$.barData.bind($$)); $$.contextBar.enter().append('path').attr('class', $$.classBar.bind($$)).style('stroke', 'none').style('fill', $$.color); $$.contextBar.style('opacity', $$.initialOpacity.bind($$)); $$.contextBar.exit().transition().duration(durationForExit).style('opacity', 0).remove(); @@ -5454,7 +5462,7 @@ var redrawBarForSubchart = function redrawBarForSubchart(drawBarOnSub, withTrans }; var updateLineForSubchart = function updateLineForSubchart(durationForExit) { var $$ = this; - $$.contextLine = $$.context.selectAll('.' + CLASS$1.lines).selectAll('.' + CLASS$1.line).data($$.lineData.bind($$)); + $$.contextLine = $$.context.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line).data($$.lineData.bind($$)); $$.contextLine.enter().append('path').attr('class', $$.classLine.bind($$)).style('stroke', $$.color); $$.contextLine.style('opacity', $$.initialOpacity.bind($$)); $$.contextLine.exit().transition().duration(durationForExit).style('opacity', 0).remove(); @@ -5465,7 +5473,7 @@ var redrawLineForSubchart = function redrawLineForSubchart(drawLineOnSub, withTr var updateAreaForSubchart = function updateAreaForSubchart(durationForExit) { var $$ = this, d3$$1 = $$.d3; - $$.contextArea = $$.context.selectAll('.' + CLASS$1.areas).selectAll('.' + CLASS$1.area).data($$.lineData.bind($$)); + $$.contextArea = $$.context.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area).data($$.lineData.bind($$)); $$.contextArea.enter().append('path').attr('class', $$.classArea.bind($$)).style('fill', $$.color).style('opacity', function () { $$.orgAreaOpacity = +d3$$1.select(this).style('opacity');return 0; }); @@ -5530,7 +5538,7 @@ var transformContext = function transformContext(withTransition, transitions) { if (transitions && transitions.axisSubX) { subXAxis = transitions.axisSubX; } else { - subXAxis = $$.context.select('.' + CLASS$1.axisX); + subXAxis = $$.context.select('.' + CLASS.axisX); if (withTransition) { subXAxis = subXAxis.transition(); } @@ -5550,7 +5558,7 @@ var getDefaultExtent = function getDefaultExtent() { var initText = function initText() { var $$ = this; - $$.main.select('.' + CLASS$1.chart).append('g').attr('class', CLASS$1.chartTexts); + $$.main.select('.' + CLASS.chart).append('g').attr('class', CLASS.chartTexts); $$.mainText = $$.d3.selectAll([]); }; var updateTargetsForText = function updateTargetsForText(targets) { @@ -5560,7 +5568,7 @@ var updateTargetsForText = function updateTargetsForText(targets) { classChartText$$1 = $$.classChartText.bind($$), classTexts$$1 = $$.classTexts.bind($$), classFocus$$1 = $$.classFocus.bind($$); - mainTextUpdate = $$.main.select('.' + CLASS$1.chartTexts).selectAll('.' + CLASS$1.chartText).data(targets).attr('class', function (d) { + mainTextUpdate = $$.main.select('.' + CLASS.chartTexts).selectAll('.' + CLASS.chartText).data(targets).attr('class', function (d) { return classChartText$$1(d) + classFocus$$1(d); }); mainTextEnter = mainTextUpdate.enter().append('g').attr('class', classChartText$$1).style('opacity', 0).style('pointer-events', 'none'); @@ -5571,7 +5579,7 @@ var updateText = function updateText(durationForExit) { config = $$.config, barOrLineData = $$.barOrLineData.bind($$), classText$$1 = $$.classText.bind($$); - $$.mainText = $$.main.selectAll('.' + CLASS$1.texts).selectAll('.' + CLASS$1.text).data(barOrLineData); + $$.mainText = $$.main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text).data(barOrLineData); $$.mainText.enter().append('text').attr('class', classText$$1).attr('text-anchor', function (d) { return config.axis_rotated ? d.value < 0 ? 'end' : 'start' : 'middle'; }).style('stroke', 'none').style('fill', function (d) { @@ -5694,7 +5702,7 @@ var initTooltip = function initTooltip() { var $$ = this, config = $$.config, i = void 0; - $$.tooltip = $$.selectChart.style('position', 'relative').append('div').attr('class', CLASS$1.tooltipContainer).style('position', 'absolute').style('pointer-events', 'none').style('display', 'none'); + $$.tooltip = $$.selectChart.style('position', 'relative').append('div').attr('class', CLASS.tooltipContainer).style('position', 'absolute').style('pointer-events', 'none').style('display', 'none'); // Show tooltip if needed if (config.tooltip_init_show) { if ($$.isTimeSeries() && isString$1(config.tooltip_init_x)) { @@ -5828,7 +5836,7 @@ var showTooltip = function showTooltip(selectedData, element) { position = void 0; var forArc = $$.hasArcType(), dataToShow = selectedData.filter(function (d) { - return d && isValue$2(d.value); + return d && isValue$1(d.value); }), positionFunction = config.tooltip_position || c3_chart_internal_fn.tooltipPosition; if (dataToShow.length === 0 || !config.tooltip_show) { @@ -5999,7 +6007,7 @@ var initZoom = function initZoom() { return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])]; }; $$.zoom.updateScaleExtent = function () { - var ratio = diffDomain$2($$.x.orgDomain()) / diffDomain$2($$.getZoomDomain()), + var ratio = diffDomain$1($$.x.orgDomain()) / diffDomain$1($$.getZoomDomain()), extent = this.orgScaleExtent(); this.scaleExtent([extent[0] * ratio, extent[1] * ratio]); return this; @@ -6016,8 +6024,8 @@ var getZoomDomain = function getZoomDomain() { var updateZoom = function updateZoom() { var $$ = this, z = $$.config.zoom_enabled ? $$.zoom : function () {}; - $$.main.select('.' + CLASS$1.zoomRect).call(z).on('dblclick.zoom', null); - $$.main.selectAll('.' + CLASS$1.eventRect).call(z).on('dblclick.zoom', null); + $$.main.select('.' + CLASS.zoomRect).call(z).on('dblclick.zoom', null); + $$.main.selectAll('.' + CLASS.eventRect).call(z).on('dblclick.zoom', null); }; var redrawForZoom = function redrawForZoom() { var $$ = this, @@ -6056,15 +6064,15 @@ var redrawForZoom = function redrawForZoom() { * This file is seriously in need of some reorganization. */ -var isValue$1 = isValue$2; +var isValue$$1 = isValue$1; var isFunction$$1 = isFunction$1; var isString$$1 = isString$1; var isUndefined$$1 = isUndefined$1; -var isDefined$1 = isDefined$2; +var isDefined$$1 = isDefined$1; var asHalfPixel$$1 = asHalfPixel$1; -var isEmpty$1 = isEmpty$2; -var notEmpty$1 = notEmpty$2; -var getOption$1 = getOption$2; +var isEmpty$$1 = isEmpty$1; +var notEmpty$$1 = notEmpty$1; +var getOption$$1 = getOption$1; function ChartInternal(api) { var $$ = this; $$.d3 = d3; @@ -6311,7 +6319,7 @@ c3_chart_internal_fn.initWithData = function (data) { /* -- Main Region --*/ // text when empty - main.append('text').attr('class', CLASS$1.text + ' ' + CLASS$1.empty).attr('text-anchor', 'middle') // horizontal centering of text at x position in all browsers. + main.append('text').attr('class', CLASS.text + ' ' + CLASS.empty).attr('text-anchor', 'middle') // horizontal centering of text at x position in all browsers. .attr('dominant-baseline', 'middle'); // vertical centering of text at y position in all browsers, except IE. // Regions @@ -6321,7 +6329,7 @@ c3_chart_internal_fn.initWithData = function (data) { $$.initGrid(); // Define g for chart area - main.append('g').attr('clip-path', $$.clipPath).attr('class', CLASS$1.chart); + main.append('g').attr('clip-path', $$.clipPath).attr('class', CLASS.chart); // Grid lines if (config.grid_lines_front) { @@ -6336,7 +6344,7 @@ c3_chart_internal_fn.initWithData = function (data) { // if zoom privileged, insert rect to forefront // TODO: is this needed? - main.insert('rect', config.zoom_privileged ? null : 'g.' + CLASS$1.regions).attr('class', CLASS$1.zoomRect).attr('width', $$.width).attr('height', $$.height).style('opacity', 0).on('dblclick.zoom', null); + main.insert('rect', config.zoom_privileged ? null : 'g.' + CLASS.regions).attr('class', CLASS.zoomRect).attr('width', $$.width).attr('height', $$.height).style('opacity', 0).on('dblclick.zoom', null); // Set default extent if defined if (config.axis_x_extent) { @@ -6501,7 +6509,7 @@ c3_chart_internal_fn.updateTargets = function (targets) { }; c3_chart_internal_fn.showTargets = function () { var $$ = this; - $$.svg.selectAll('.' + CLASS$1.target).filter(function (d) { + $$.svg.selectAll('.' + CLASS.target).filter(function (d) { return $$.isTargetToShow(d.id); }).transition().duration($$.config.transition_duration).style('opacity', 1); }; @@ -6548,19 +6556,19 @@ c3_chart_internal_fn.redraw = function (options, transitions) { cy = void 0; options = options || {}; - withY = getOption$1(options, 'withY', true); - withSubchart = getOption$1(options, 'withSubchart', true); - withTransition = getOption$1(options, 'withTransition', true); - withTransform = getOption$1(options, 'withTransform', false); - withUpdateXDomain = getOption$1(options, 'withUpdateXDomain', false); - withUpdateOrgXDomain = getOption$1(options, 'withUpdateOrgXDomain', false); - withTrimXDomain = getOption$1(options, 'withTrimXDomain', true); - withUpdateXAxis = getOption$1(options, 'withUpdateXAxis', withUpdateXDomain); - withLegend = getOption$1(options, 'withLegend', false); - withEventRect = getOption$1(options, 'withEventRect', true); - withDimension = getOption$1(options, 'withDimension', true); - withTransitionForExit = getOption$1(options, 'withTransitionForExit', withTransition); - withTransitionForAxis = getOption$1(options, 'withTransitionForAxis', withTransition); + withY = getOption$$1(options, 'withY', true); + withSubchart = getOption$$1(options, 'withSubchart', true); + withTransition = getOption$$1(options, 'withTransition', true); + withTransform = getOption$$1(options, 'withTransform', false); + withUpdateXDomain = getOption$$1(options, 'withUpdateXDomain', false); + withUpdateOrgXDomain = getOption$$1(options, 'withUpdateOrgXDomain', false); + withTrimXDomain = getOption$$1(options, 'withTrimXDomain', true); + withUpdateXAxis = getOption$$1(options, 'withUpdateXAxis', withUpdateXDomain); + withLegend = getOption$$1(options, 'withLegend', false); + withEventRect = getOption$$1(options, 'withEventRect', true); + withDimension = getOption$$1(options, 'withDimension', true); + withTransitionForExit = getOption$$1(options, 'withTransitionForExit', withTransition); + withTransitionForAxis = getOption$$1(options, 'withTransitionForAxis', withTransition); duration = withTransition ? config.transition_duration : 0; durationForExit = withTransitionForExit ? duration : 0; @@ -6621,14 +6629,14 @@ c3_chart_internal_fn.redraw = function (options, transitions) { break; } } - $$.svg.selectAll('.' + CLASS$1.axisX + ' .tick text').each(function (e) { + $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { var index = tickValues.indexOf(e); if (index >= 0) { d3$$1.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); } }); } else { - $$.svg.selectAll('.' + CLASS$1.axisX + ' .tick text').style('display', 'block'); + $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block'); } } @@ -6649,7 +6657,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) { $$.updateXgridFocus(); // Data empty label positioning and text. - main.select('text.' + CLASS$1.text + '.' + CLASS$1.empty).attr('x', $$.width / 2).attr('y', $$.height / 2).text(config.data_empty_label_text).transition().style('opacity', targetsToShow.length ? 0 : 1); + main.select('text.' + CLASS.text + '.' + CLASS.empty).attr('x', $$.width / 2).attr('y', $$.height / 2).text(config.data_empty_label_text).transition().style('opacity', targetsToShow.length ? 0 : 1); // grid $$.updateGrid(duration); @@ -6686,7 +6694,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) { } // circles for select - main.selectAll('.' + CLASS$1.selectedCircles).filter($$.isBarType.bind($$)).selectAll('circle').remove(); + main.selectAll('.' + CLASS.selectedCircles).filter($$.isBarType.bind($$)).selectAll('circle').remove(); // event rects will redrawn when flow called if (config.interaction_enabled && !options.flow && withEventRect) { @@ -6770,14 +6778,14 @@ c3_chart_internal_fn.updateAndRedraw = function (options) { transitions = void 0; options = options || {}; // same with redraw - options.withTransition = getOption$1(options, 'withTransition', true); - options.withTransform = getOption$1(options, 'withTransform', false); - options.withLegend = getOption$1(options, 'withLegend', false); + options.withTransition = getOption$$1(options, 'withTransition', true); + options.withTransform = getOption$$1(options, 'withTransform', false); + options.withLegend = getOption$$1(options, 'withLegend', false); // NOT same with redraw options.withUpdateXDomain = true; options.withUpdateOrgXDomain = true; options.withTransitionForExit = false; - options.withTransitionForTransform = getOption$1(options, 'withTransitionForTransform', options.withTransition); + options.withTransitionForTransform = getOption$$1(options, 'withTransitionForTransform', options.withTransition); // MEMO: this needs to be called before updateLegend and it means this ALWAYS needs to be called) $$.updateSizes(); // MEMO: called in updateLegend in redraw if withLegend @@ -6810,7 +6818,7 @@ c3_chart_internal_fn.isCategorized = function () { c3_chart_internal_fn.isCustomX = function () { var $$ = this, config = $$.config; - return !$$.isTimeSeries() && (config.data_x || notEmpty$1(config.data_xs)); + return !$$.isTimeSeries() && (config.data_x || notEmpty$$1(config.data_xs)); }; c3_chart_internal_fn.isTimeSeriesY = function () { @@ -6857,7 +6865,7 @@ c3_chart_internal_fn.initialOpacityForCircle = function (d) { }; c3_chart_internal_fn.opacityForCircle = function (d) { var opacity = this.config.point_show ? 1 : 0; - return isValue$1(d.value) ? this.isScatterType(d) ? 0.5 : opacity : 0; + return isValue$$1(d.value) ? this.isScatterType(d) ? 0.5 : opacity : 0; }; c3_chart_internal_fn.opacityForText = function () { return this.hasDataLabel() ? 1 : 0; @@ -6892,7 +6900,7 @@ c3_chart_internal_fn.transformMain = function (withTransition, transitions) { if (transitions && transitions.axisX) { xAxis = transitions.axisX; } else { - xAxis = $$.main.select('.' + CLASS$1.axisX); + xAxis = $$.main.select('.' + CLASS.axisX); if (withTransition) { xAxis = xAxis.transition(); } @@ -6900,7 +6908,7 @@ c3_chart_internal_fn.transformMain = function (withTransition, transitions) { if (transitions && transitions.axisY) { yAxis = transitions.axisY; } else { - yAxis = $$.main.select('.' + CLASS$1.axisY); + yAxis = $$.main.select('.' + CLASS.axisY); if (withTransition) { yAxis = yAxis.transition(); } @@ -6908,7 +6916,7 @@ c3_chart_internal_fn.transformMain = function (withTransition, transitions) { if (transitions && transitions.axisY2) { y2Axis = transitions.axisY2; } else { - y2Axis = $$.main.select('.' + CLASS$1.axisY2); + y2Axis = $$.main.select('.' + CLASS.axisY2); if (withTransition) { y2Axis = y2Axis.transition(); } @@ -6917,7 +6925,7 @@ c3_chart_internal_fn.transformMain = function (withTransition, transitions) { xAxis.attr('transform', $$.getTranslate('x')); yAxis.attr('transform', $$.getTranslate('y')); y2Axis.attr('transform', $$.getTranslate('y2')); - $$.main.select('.' + CLASS$1.chartArcs).attr('transform', $$.getTranslate('arc')); + $$.main.select('.' + CLASS.chartArcs).attr('transform', $$.getTranslate('arc')); }; c3_chart_internal_fn.transformAll = function (withTransition, transitions) { var $$ = this; @@ -6938,7 +6946,7 @@ c3_chart_internal_fn.updateSvgSize = function () { $$.svg.select('#' + $$.clipIdForXAxis).select('rect').attr('x', $$.getXAxisClipX.bind($$)).attr('y', $$.getXAxisClipY.bind($$)).attr('width', $$.getXAxisClipWidth.bind($$)).attr('height', $$.getXAxisClipHeight.bind($$)); $$.svg.select('#' + $$.clipIdForYAxis).select('rect').attr('x', $$.getYAxisClipX.bind($$)).attr('y', $$.getYAxisClipY.bind($$)).attr('width', $$.getYAxisClipWidth.bind($$)).attr('height', $$.getYAxisClipHeight.bind($$)); $$.svg.select('#' + $$.clipIdForSubchart).select('rect').attr('width', $$.width).attr('height', brush.size() ? brush.attr('height') : 0); - $$.svg.select('.' + CLASS$1.zoomRect).attr('width', $$.width).attr('height', $$.height); + $$.svg.select('.' + CLASS.zoomRect).attr('width', $$.width).attr('height', $$.height); // MEMO: parent div's height will be bigger than svg when $$.selectChart.style('max-height', $$.currentHeight + 'px'); }; @@ -7168,7 +7176,7 @@ c3_chart_internal_fn.hasCaches = hasCaches; c3_chart_internal_fn.addCache = addCache; c3_chart_internal_fn.getCaches = getCaches; c3_chart_internal_fn.categoryName = categoryName; -c3_chart_internal_fn.CLASS = CLASS$1; +c3_chart_internal_fn.CLASS = CLASS; c3_chart_internal_fn.generateClass = generateClass; c3_chart_internal_fn.classText = classText; c3_chart_internal_fn.classTexts = classTexts; @@ -7490,13 +7498,13 @@ axis.max = function (max) { config = $$.config; if (arguments.length) { if ((typeof max === 'undefined' ? 'undefined' : _typeof(max)) === 'object') { - if (isValue$1(max.x)) { + if (isValue$$1(max.x)) { config.axis_x_max = max.x; } - if (isValue$1(max.y)) { + if (isValue$$1(max.y)) { config.axis_y_max = max.y; } - if (isValue$1(max.y2)) { + if (isValue$$1(max.y2)) { config.axis_y2_max = max.y2; } } else { @@ -7516,13 +7524,13 @@ axis.min = function (min) { config = $$.config; if (arguments.length) { if ((typeof min === 'undefined' ? 'undefined' : _typeof(min)) === 'object') { - if (isValue$1(min.x)) { + if (isValue$$1(min.x)) { config.axis_x_min = min.x; } - if (isValue$1(min.y)) { + if (isValue$$1(min.y)) { config.axis_y_min = min.y; } - if (isValue$1(min.y2)) { + if (isValue$$1(min.y2)) { config.axis_y2_min = min.y2; } } else { @@ -7539,10 +7547,10 @@ axis.min = function (min) { }; axis.range = function (range) { if (arguments.length) { - if (isDefined$1(range.max)) { + if (isDefined$$1(range.max)) { this.axis.max(range.max); } - if (isDefined$1(range.min)) { + if (isDefined$$1(range.min)) { this.axis.min(range.min); } } else { @@ -7766,7 +7774,7 @@ var flow = function flow(args) { baseValue = baseTarget.values[0]; // Update length to flow if needed - if (isDefined$1(args.to)) { + if (isDefined$$1(args.to)) { length = 0; to = $$.isTimeSeries() ? $$.parseDate(args.to) : args.to; baseTarget.values.forEach(function (v) { @@ -7774,7 +7782,7 @@ var flow = function flow(args) { length++; } }); - } else if (isDefined$1(args.length)) { + } else if (isDefined$$1(args.length)) { length = args.length; } @@ -7807,7 +7815,7 @@ var flow = function flow(args) { flow: { index: baseValue.index, length: length, - duration: isValue$1(args.duration) ? args.duration : $$.config.transition_duration, + duration: isValue$$1(args.duration) ? args.duration : $$.config.transition_duration, done: args.done, orgDataCount: orgDataCount }, @@ -7825,7 +7833,7 @@ var focus = function focus(targetIds) { targetIds = $$.mapToTargetIds(targetIds); candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))), this.revert(); this.defocus(); - candidates.classed(CLASS$1.focused, true).classed(CLASS$1.defocused, false); + candidates.classed(CLASS.focused, true).classed(CLASS.defocused, false); if ($$.hasArcType()) { $$.expandArc(targetIds); } @@ -7842,7 +7850,7 @@ var defocus = function defocus(targetIds) { candidates = void 0; targetIds = $$.mapToTargetIds(targetIds); - candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))), candidates.classed(CLASS$1.focused, false).classed(CLASS$1.defocused, true); + candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))), candidates.classed(CLASS.focused, false).classed(CLASS.defocused, true); if ($$.hasArcType()) { $$.unexpandArc(targetIds); } @@ -7861,15 +7869,15 @@ var revert = function revert(targetIds) { targetIds = $$.mapToTargetIds(targetIds); candidates = $$.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets - candidates.classed(CLASS$1.focused, false).classed(CLASS$1.defocused, false); + candidates.classed(CLASS.focused, false).classed(CLASS.defocused, false); if ($$.hasArcType()) { $$.unexpandArc(targetIds); } if ($$.config.legend_show) { $$.showLegend(targetIds.filter($$.isLegendToShow.bind($$))); $$.legend.selectAll($$.selectorLegends(targetIds)).filter(function () { - return $$.d3.select(this).classed(CLASS$1.legendItemFocused); - }).classed(CLASS$1.legendItemFocused, false); + return $$.d3.select(this).classed(CLASS.legendItemFocused); + }).classed(CLASS.legendItemFocused, false); } $$.focusedTargetIds = []; @@ -8041,9 +8049,9 @@ regions.remove = function (options) { options = options || {}; duration = $$.getOption(options, 'duration', config.transition_duration); - classes = $$.getOption(options, 'classes', [CLASS$1.region]); + classes = $$.getOption(options, 'classes', [CLASS.region]); - regions = $$.main.select('.' + CLASS$1.regions).selectAll(classes.map(function (c) { + regions = $$.main.select('.' + CLASS.regions).selectAll(classes.map(function (c) { return '.' + c; })); (duration ? regions.transition().duration(duration) : regions).style('opacity', 0).remove(); @@ -8067,8 +8075,8 @@ regions.remove = function (options) { var selected = function selected(targetId) { var $$ = this.internal, d3$$1 = $$.d3; - return d3$$1.merge($$.main.selectAll('.' + CLASS$1.shapes + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS$1.shape).filter(function () { - return d3$$1.select(this).classed(CLASS$1.SELECTED); + return d3$$1.merge($$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape).filter(function () { + return d3$$1.select(this).classed(CLASS.SELECTED); }).map(function (d) { return d.map(function (d) { var data = d.__data__;return data.data ? data.data : data; @@ -8083,24 +8091,24 @@ var select = function select(ids, indices, resetOther) { if (!config.data_selection_enabled) { return; } - $$.main.selectAll('.' + CLASS$1.shapes).selectAll('.' + CLASS$1.shape).each(function (d, i) { + $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { var shape = d3$$1.select(this), id = d.data ? d.data.id : d.id, toggle = $$.getToggle(this, d).bind($$), isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, - isSelected = shape.classed(CLASS$1.SELECTED); + isSelected = shape.classed(CLASS.SELECTED); // line/area selection not supported yet - if (shape.classed(CLASS$1.line) || shape.classed(CLASS$1.area)) { + if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) { return; } if (isTargetId && isTargetIndex) { if (config.data_selection_isselectable(d) && !isSelected) { - toggle(true, shape.classed(CLASS$1.SELECTED, true), d, i); + toggle(true, shape.classed(CLASS.SELECTED, true), d, i); } - } else if (isDefined$1(resetOther) && resetOther) { + } else if (isDefined$$1(resetOther) && resetOther) { if (isSelected) { - toggle(false, shape.classed(CLASS$1.SELECTED, false), d, i); + toggle(false, shape.classed(CLASS.SELECTED, false), d, i); } } }); @@ -8113,21 +8121,21 @@ var unselect = function unselect(ids, indices) { if (!config.data_selection_enabled) { return; } - $$.main.selectAll('.' + CLASS$1.shapes).selectAll('.' + CLASS$1.shape).each(function (d, i) { + $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { var shape = d3$$1.select(this), id = d.data ? d.data.id : d.id, toggle = $$.getToggle(this, d).bind($$), isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0, - isSelected = shape.classed(CLASS$1.SELECTED); + isSelected = shape.classed(CLASS.SELECTED); // line/area selection not supported yet - if (shape.classed(CLASS$1.line) || shape.classed(CLASS$1.area)) { + if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) { return; } if (isTargetId && isTargetIndex) { if (config.data_selection_isselectable(d)) { if (isSelected) { - toggle(false, shape.classed(CLASS$1.SELECTED, false), d, i); + toggle(false, shape.classed(CLASS.SELECTED, false), d, i); } } } @@ -8204,7 +8212,7 @@ tooltip.show = function (args) { index = null; } else { // TODO: when tooltip_grouped = false - index = isValue$1(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x); + index = isValue$$1(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x); } } else if (typeof args.x !== 'undefined') { index = $$.getIndexByX(args.x); @@ -8301,10 +8309,10 @@ zoom.min = function (min) { zoom.range = function (range) { if (arguments.length) { - if (isDefined$1(range.max)) { + if (isDefined$$1(range.max)) { this.domain.max(range.max); } - if (isDefined$1(range.min)) { + if (isDefined$$1(range.min)) { this.domain.min(range.min); } } else { @@ -8315,7 +8323,7 @@ zoom.range = function (range) { } }; -var c3_chart_fn$1 = void 0; +var c3_chart_fn = void 0; function Chart(config) { var $$ = this.internal = new ChartInternal(this); @@ -8333,42 +8341,42 @@ function Chart(config) { bindThis(fn[key], target[key], argThis); } }); - })(c3_chart_fn$1, this, this); + })(c3_chart_fn, this, this); } -c3_chart_fn$1 = Chart.prototype; - -c3_chart_fn$1.axis = axis; -c3_chart_fn$1.category = category; -c3_chart_fn$1.categories = categories; -c3_chart_fn$1.resize = resize; -c3_chart_fn$1.flush = flush; -c3_chart_fn$1.destroy = destroy; -c3_chart_fn$1.color = color; -c3_chart_fn$1.data = data; -c3_chart_fn$1.flow = flow; -c3_chart_fn$1.focus = focus; -c3_chart_fn$1.defocus = defocus; -c3_chart_fn$1.revert = revert; -c3_chart_fn$1.xgrids = xgrids; -c3_chart_fn$1.ygrids = ygrids; -c3_chart_fn$1.groups = groups; -c3_chart_fn$1.legend = legend; -c3_chart_fn$1.load = load$1; -c3_chart_fn$1.unload = unload$1; -c3_chart_fn$1.regions = regions; -c3_chart_fn$1.selected = selected; -c3_chart_fn$1.select = select; -c3_chart_fn$1.unselect = unselect; -c3_chart_fn$1.show = show; -c3_chart_fn$1.hide = hide; -c3_chart_fn$1.toggle = toggle; -c3_chart_fn$1.tooltip = tooltip; -c3_chart_fn$1.transform = transform; -c3_chart_fn$1.x = x; -c3_chart_fn$1.xs = xs; -c3_chart_fn$1.zoom = zoom; -c3_chart_fn$1.unzoom = unzoom; +c3_chart_fn = Chart.prototype; + +c3_chart_fn.axis = axis; +c3_chart_fn.category = category; +c3_chart_fn.categories = categories; +c3_chart_fn.resize = resize; +c3_chart_fn.flush = flush; +c3_chart_fn.destroy = destroy; +c3_chart_fn.color = color; +c3_chart_fn.data = data; +c3_chart_fn.flow = flow; +c3_chart_fn.focus = focus; +c3_chart_fn.defocus = defocus; +c3_chart_fn.revert = revert; +c3_chart_fn.xgrids = xgrids; +c3_chart_fn.ygrids = ygrids; +c3_chart_fn.groups = groups; +c3_chart_fn.legend = legend; +c3_chart_fn.load = load$1; +c3_chart_fn.unload = unload$1; +c3_chart_fn.regions = regions; +c3_chart_fn.selected = selected; +c3_chart_fn.select = select; +c3_chart_fn.unselect = unselect; +c3_chart_fn.show = show; +c3_chart_fn.hide = hide; +c3_chart_fn.toggle = toggle; +c3_chart_fn.tooltip = tooltip; +c3_chart_fn.transform = transform; +c3_chart_fn.x = x; +c3_chart_fn.xs = xs; +c3_chart_fn.zoom = zoom; +c3_chart_fn.unzoom = unzoom; /** * C3.js @@ -8398,4 +8406,5 @@ exports.chart = chart; Object.defineProperty(exports, '__esModule', { value: true }); -}))); \ No newline at end of file +}))); +//# sourceMappingURL=c3.js.map diff --git a/c3.js.map b/c3.js.map new file mode 100644 index 0000000..1f15c25 --- /dev/null +++ b/c3.js.map @@ -0,0 +1 @@ +{"version":3,"file":null,"sources":["src/axis/c3.axis.js","src/axis/axis.js","src/axis/index.js","src/internals/class.js","src/internals/util.js","src/internals/arc.js","src/internals/cache.js","src/internals/category.js","src/internals/clip.js","src/internals/color.js","src/internals/config.js","src/internals/data.convert.js","src/internals/data.js","src/internals/data.load.js","src/internals/domain.js","src/internals/drag.js","src/internals/flow.js","src/internals/format.js","src/internals/grid.js","src/internals/interaction.js","src/internals/legend.js","src/internals/region.js","src/internals/scale.js","src/internals/selection.js","src/internals/shape.bar.js","src/internals/shape.js","src/internals/shape.line.js","src/internals/size.js","src/internals/subchart.js","src/internals/text.js","src/internals/title.js","src/internals/tooltip.js","src/internals/transform.js","src/internals/type.js","src/internals/ua.js","src/internals/zoom.js","src/internals/index.js","src/chart/api.axis.js","src/chart/api.category.js","src/chart/api.chart.js","src/chart/api.color.js","src/chart/api.data.js","src/chart/api.flow.js","src/chart/api.focus.js","src/chart/api.grid.js","src/chart/api.group.js","src/chart/api.legend.js","src/chart/api.load.js","src/chart/api.region.js","src/chart/api.selection.js","src/chart/api.show.js","src/chart/api.tooltip.js","src/chart/api.transform.js","src/chart/api.x.js","src/chart/api.zoom.js","src/chart/index.js","src/rollup.entry.js"],"sourcesContent":["import d3 from 'd3';\n\nlet tickTextCharSize;\nfunction c3_axis(params) {\n let scale = d3.scale.linear();\n let orient = 'bottom';\n const innerTickSize = 6;\n const tickPadding = 3;\n let tickValues = null;\n let tickFormat;\n let tickArguments;\n\n let tickOffset = 0;\n let tickCulling = true;\n let tickCentered;\n\n params = params || {};\n\n const outerTickSize = params.withOuterTick ? 6 : 0;\n\n function axisX(selection, x) {\n selection.attr('transform', d => 'translate(' + Math.ceil(x(d) + tickOffset) + ', 0)');\n }\n function axisY(selection, y) {\n selection.attr('transform', d => 'translate(0,' + Math.ceil(y(d)) + ')');\n }\n function scaleExtent(domain) {\n const start = domain[0];\n const stop = domain[domain.length - 1];\n return start < stop ? [start, stop] : [stop, start];\n }\n function generateTicks(scale) { // eslint-disable-line no-shadow\n let i;\n const ticks = [];\n if (scale.ticks) {\n return scale.ticks.apply(scale, tickArguments);\n }\n const domain = scale.domain();\n for (i = Math.ceil(domain[0]); i < domain[1]; i++) {\n ticks.push(i);\n }\n if (ticks.length > 0 && ticks[0] > 0) {\n ticks.unshift(ticks[0] - (ticks[1] - ticks[0]));\n }\n return ticks;\n }\n function copyScale() {\n const newScale = scale.copy();\n let domain;\n if (params.isCategory) {\n domain = scale.domain();\n newScale.domain([domain[0], domain[1] - 1]);\n }\n return newScale;\n }\n function textFormatted(v) {\n const formatted = tickFormat ? tickFormat(v) : v;\n return typeof formatted !== 'undefined' ? formatted : '';\n }\n function getSizeFor1Char(tick) {\n if (tickTextCharSize) {\n return tickTextCharSize;\n }\n const size = {\n h: 11.5,\n w: 5.5,\n };\n tick.select('text').text(textFormatted).each(function (d) {\n let box = this.getBoundingClientRect(),\n text = textFormatted(d),\n h = box.height,\n w = text ? (box.width / text.length) : undefined;\n if (h && w) {\n size.h = h;\n size.w = w;\n }\n }).text('');\n tickTextCharSize = size;\n return size;\n }\n function transitionise(selection) {\n return params.withoutTransition ? selection : d3.transition(selection);\n }\n function axis(g) {\n g.each(function () {\n const g = axis.g = d3.select(this);\n\n let scale0 = this.__chart__ || scale,\n scale1 = this.__chart__ = copyScale();\n\n let ticks = tickValues || generateTicks(scale1),\n tick = g.selectAll('.tick').data(ticks, scale1),\n tickEnter = tick.enter().insert('g', '.domain').attr('class', 'tick').style('opacity', 1e-6),\n // MEMO: No exit transition. The reason is this transition affects max tick width\n // calculation because old tick will be included in the ticks.\n tickExit = tick.exit().remove(),\n tickUpdate = transitionise(tick).style('opacity', 1),\n tickTransform,\n tickX,\n tickY;\n\n let range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()),\n path = g.selectAll('.domain').data([0]),\n pathUpdate = (path.enter().append('path').attr('class', 'domain'), transitionise(path));\n tickEnter.append('line');\n tickEnter.append('text');\n\n let lineEnter = tickEnter.select('line'),\n lineUpdate = tickUpdate.select('line'),\n textEnter = tickEnter.select('text'),\n textUpdate = tickUpdate.select('text');\n\n if (params.isCategory) {\n tickOffset = Math.ceil((scale1(1) - scale1(0)) / 2);\n tickX = tickCentered ? 0 : tickOffset;\n tickY = tickCentered ? tickOffset : 0;\n } else {\n tickOffset = tickX = 0;\n }\n\n let text,\n tspan,\n sizeFor1Char = getSizeFor1Char(g.select('.tick')),\n counts = [];\n\n let tickLength = Math.max(innerTickSize, 0) + tickPadding,\n isVertical = orient === 'left' || orient === 'right';\n\n // this should be called only when category axis\n function splitTickText(d, maxWidth) {\n let tickText = textFormatted(d),\n subtext,\n spaceIndex,\n textWidth,\n splitted = [];\n\n if (Object.prototype.toString.call(tickText) === '[object Array]') {\n return tickText;\n }\n\n if (!maxWidth || maxWidth <= 0) {\n maxWidth = isVertical ? 95 :\n params.isCategory ?\n (Math.ceil(scale1(ticks[1]) - scale1(ticks[0])) - 12) : 110;\n }\n\n function split(splitted, text) {\n spaceIndex = undefined;\n for (let i = 1; i < text.length; i++) {\n if (text.charAt(i) === ' ') {\n spaceIndex = i;\n }\n subtext = text.substr(0, i + 1);\n textWidth = sizeFor1Char.w * subtext.length;\n // if text width gets over tick width, split by space index or crrent index\n if (maxWidth < textWidth) {\n return split(\n splitted.concat(text.substr(0, spaceIndex || i)),\n text.slice(spaceIndex ? spaceIndex + 1 : i)\n );\n }\n }\n return splitted.concat(text);\n }\n\n return split(splitted, tickText + '');\n }\n\n function tspanDy(d, i) {\n let dy = sizeFor1Char.h;\n if (i === 0) {\n if (orient === 'left' || orient === 'right') {\n dy = -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3);\n } else {\n dy = '.71em';\n }\n }\n return dy;\n }\n\n function tickSize(d) {\n const tickPosition = scale(d) + (tickCentered ? 0 : tickOffset);\n return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0;\n }\n\n text = tick.select('text');\n tspan = text.selectAll('tspan')\n .data((d, i) => {\n const splitted = params.tickMultiline ?\n splitTickText(d, params.tickWidth) :\n [].concat(textFormatted(d));\n counts[i] = splitted.length;\n return splitted.map(s => ({ index: i, splitted: s }));\n });\n tspan.enter().append('tspan');\n tspan.exit().remove();\n tspan.text(d => d.splitted);\n\n const rotate = params.tickTextRotate;\n\n function textAnchorForText(rotate) {\n if (!rotate) {\n return 'middle';\n }\n return rotate > 0 ? 'start' : 'end';\n }\n function textTransform(rotate) {\n if (!rotate) {\n return '';\n }\n return 'rotate(' + rotate + ')';\n }\n function dxForText(rotate) {\n if (!rotate) {\n return 0;\n }\n return 8 * Math.sin(Math.PI * (rotate / 180));\n }\n function yForText(rotate) {\n if (!rotate) {\n return tickLength;\n }\n return 11.5 - 2.5 * (rotate / 15) * (rotate > 0 ? 1 : -1);\n }\n\n switch (orient) {\n case 'bottom':\n {\n tickTransform = axisX;\n lineEnter.attr('y2', innerTickSize);\n textEnter.attr('y', tickLength);\n lineUpdate.attr('x1', tickX).attr('x2', tickX).attr('y2', tickSize);\n textUpdate.attr('x', 0).attr('y', yForText(rotate))\n .style('text-anchor', textAnchorForText(rotate))\n .attr('transform', textTransform(rotate));\n tspan.attr('x', 0).attr('dy', tspanDy).attr('dx', dxForText(rotate));\n pathUpdate.attr('d', 'M' + range[0] + ',' + outerTickSize + 'V0H' + range[1] + 'V' + outerTickSize);\n break;\n }\n case 'top':\n {\n // TODO: rotated tick text\n tickTransform = axisX;\n lineEnter.attr('y2', -innerTickSize);\n textEnter.attr('y', -tickLength);\n lineUpdate.attr('x2', 0).attr('y2', -innerTickSize);\n textUpdate.attr('x', 0).attr('y', -tickLength);\n text.style('text-anchor', 'middle');\n tspan.attr('x', 0).attr('dy', '0em');\n pathUpdate.attr('d', 'M' + range[0] + ',' + -outerTickSize + 'V0H' + range[1] + 'V' + -outerTickSize);\n break;\n }\n case 'left':\n {\n tickTransform = axisY;\n lineEnter.attr('x2', -innerTickSize);\n textEnter.attr('x', -tickLength);\n lineUpdate.attr('x2', -innerTickSize).attr('y1', tickY).attr('y2', tickY);\n textUpdate.attr('x', -tickLength).attr('y', tickOffset);\n text.style('text-anchor', 'end');\n tspan.attr('x', -tickLength).attr('dy', tspanDy);\n pathUpdate.attr('d', 'M' + -outerTickSize + ',' + range[0] + 'H0V' + range[1] + 'H' + -outerTickSize);\n break;\n }\n case 'right':\n {\n tickTransform = axisY;\n lineEnter.attr('x2', innerTickSize);\n textEnter.attr('x', tickLength);\n lineUpdate.attr('x2', innerTickSize).attr('y2', 0);\n textUpdate.attr('x', tickLength).attr('y', 0);\n text.style('text-anchor', 'start');\n tspan.attr('x', tickLength).attr('dy', tspanDy);\n pathUpdate.attr('d', 'M' + outerTickSize + ',' + range[0] + 'H0V' + range[1] + 'H' + outerTickSize);\n break;\n }\n default:\n break;\n }\n if (scale1.rangeBand) {\n let x = scale1,\n dx = x.rangeBand() / 2;\n scale0 = scale1 = function (d) {\n return x(d) + dx;\n };\n } else if (scale0.rangeBand) {\n scale0 = scale1;\n } else {\n tickExit.call(tickTransform, scale1);\n }\n tickEnter.call(tickTransform, scale0);\n tickUpdate.call(tickTransform, scale1);\n });\n }\n axis.scale = function (x) {\n if (!arguments.length) { return scale; }\n scale = x;\n return axis;\n };\n axis.orient = function (x) {\n if (!arguments.length) { return orient; }\n orient = x in { top: 1, right: 1, bottom: 1, left: 1 } ? x + '' : 'bottom';\n return axis;\n };\n axis.tickFormat = function (format) {\n if (!arguments.length) { return tickFormat; }\n tickFormat = format;\n return axis;\n };\n axis.tickCentered = function (isCentered) {\n if (!arguments.length) { return tickCentered; }\n tickCentered = isCentered;\n return axis;\n };\n axis.tickOffset = function () {\n return tickOffset;\n };\n axis.tickInterval = function () {\n let interval,\n length;\n if (params.isCategory) {\n interval = tickOffset * 2;\n } else {\n length = axis.g.select('path.domain').node().getTotalLength() - outerTickSize * 2;\n interval = length / axis.g.selectAll('line').size();\n }\n return interval === Infinity ? 0 : interval;\n };\n axis.ticks = function (...args) {\n if (!arguments.length) { return tickArguments; }\n tickArguments = args;\n return axis;\n };\n axis.tickCulling = function (culling) {\n if (!arguments.length) { return tickCulling; }\n tickCulling = culling;\n return axis;\n };\n axis.tickValues = function (x) {\n if (typeof x === 'function') {\n tickValues = function () {\n return x(scale.domain());\n };\n } else {\n if (!arguments.length) { return tickValues; }\n tickValues = x;\n }\n return axis;\n };\n return axis;\n}\n\nexport default c3_axis;\n","import * as d3 from 'd3';\n\nimport {\n CLASS,\n isValue,\n isFunction,\n isString,\n isEmpty,\n} from '../internals/index';\n\nimport { inherit, API } from './index';\nimport c3_axis from './c3.axis';\n\nfunction Axis(owner) {\n API.call(this, owner);\n}\n\ninherit(API, Axis);\n\nAxis.prototype.init = function init() {\n const $$ = this.owner;\n const config = $$.config;\n const main = $$.main;\n $$.axes.x = main.append('g')\n .attr('class', CLASS.axis + ' ' + CLASS.axisX)\n .attr('clip-path', $$.clipPathForXAxis)\n .attr('transform', $$.getTranslate('x'))\n .style('visibility', config.axis_x_show ? 'visible' : 'hidden');\n $$.axes.x.append('text')\n .attr('class', CLASS.axisXLabel)\n .attr('transform', config.axis_rotated ? 'rotate(-90)' : '')\n .style('text-anchor', this.textAnchorForXAxisLabel.bind(this));\n $$.axes.y = main.append('g')\n .attr('class', CLASS.axis + ' ' + CLASS.axisY)\n .attr('clip-path', config.axis_y_inner ? '' : $$.clipPathForYAxis)\n .attr('transform', $$.getTranslate('y'))\n .style('visibility', config.axis_y_show ? 'visible' : 'hidden');\n $$.axes.y.append('text')\n .attr('class', CLASS.axisYLabel)\n .attr('transform', config.axis_rotated ? '' : 'rotate(-90)')\n .style('text-anchor', this.textAnchorForYAxisLabel.bind(this));\n\n $$.axes.y2 = main.append('g')\n .attr('class', CLASS.axis + ' ' + CLASS.axisY2)\n // clip-path?\n .attr('transform', $$.getTranslate('y2'))\n .style('visibility', config.axis_y2_show ? 'visible' : 'hidden');\n $$.axes.y2.append('text')\n .attr('class', CLASS.axisY2Label)\n .attr('transform', config.axis_rotated ? '' : 'rotate(-90)')\n .style('text-anchor', this.textAnchorForY2AxisLabel.bind(this));\n};\nAxis.prototype.getXAxis = function getXAxis(\n scale,\n orient,\n tickFormat,\n tickValues,\n withOuterTick,\n withoutTransition,\n withoutRotateTickText) {\n const $$ = this.owner;\n const config = $$.config;\n const axisParams = {\n isCategory: $$.isCategorized(),\n withOuterTick,\n tickMultiline: config.axis_x_tick_multiline,\n tickWidth: config.axis_x_tick_width,\n tickTextRotate: withoutRotateTickText ? 0 : config.axis_x_tick_rotate,\n withoutTransition,\n };\n const axis = c3_axis(axisParams).scale(scale).orient(orient);\n\n if ($$.isTimeSeries() && tickValues && typeof tickValues !== 'function') {\n tickValues = tickValues.map(v => $$.parseDate(v));\n }\n\n // Set tick\n axis.tickFormat(tickFormat).tickValues(tickValues);\n if ($$.isCategorized()) {\n axis.tickCentered(config.axis_x_tick_centered);\n if (isEmpty(config.axis_x_tick_culling)) {\n config.axis_x_tick_culling = false;\n }\n }\n\n return axis;\n};\nAxis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) {\n const $$ = this.owner;\n const config = $$.config;\n let tickValues;\n if (config.axis_x_tick_fit || config.axis_x_tick_count) {\n tickValues = this.generateTickValues(\n $$.mapTargetsToUniqueXs(targets),\n config.axis_x_tick_count,\n $$.isTimeSeries()\n );\n }\n if (axis) {\n axis.tickValues(tickValues);\n } else {\n $$.xAxis.tickValues(tickValues);\n $$.subXAxis.tickValues(tickValues);\n }\n return tickValues;\n};\nAxis.prototype.getYAxis = function getYAxis(scale,\n orient,\n tickFormat,\n tickValues,\n withOuterTick,\n withoutTransition,\n withoutRotateTickText) {\n const $$ = this.owner;\n const config = $$.config;\n const axisParams = {\n withOuterTick,\n withoutTransition,\n tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate,\n };\n const axis = c3_axis(axisParams).scale(scale).orient(orient).tickFormat(tickFormat);\n if ($$.isTimeSeriesY()) {\n axis.ticks($$.d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);\n } else {\n axis.tickValues(tickValues);\n }\n return axis;\n};\nAxis.prototype.getId = function getId(id) {\n const config = this.owner.config;\n return id in config.data_axes ? config.data_axes[id] : 'y';\n};\nAxis.prototype.getXAxisTickFormat = function getXAxisTickFormat() {\n const $$ = this.owner;\n const config = $$.config;\n let format = $$.isTimeSeries() ? // eslint-disable-line no-nested-ternary\n $$.defaultAxisTimeFormat :\n $$.isCategorized() ?\n $$.categoryName :\n function (v) { return v < 0 ? v.toFixed(0) : v; };\n if (config.axis_x_tick_format) {\n if (isFunction(config.axis_x_tick_format)) {\n format = config.axis_x_tick_format;\n } else if ($$.isTimeSeries()) {\n format = function (date) {\n return date ? $$.axisTimeFormat(config.axis_x_tick_format)(date) : '';\n };\n }\n }\n return isFunction(format) ? function (v) { return format.call($$, v); } : format;\n};\nAxis.prototype.getTickValues = function getTickValues(tickValues, axis) {\n return tickValues ? tickValues : // eslint-disable-line no-nested-ternary,no-unneeded-ternary\n axis ? axis.tickValues() : undefined;\n};\nAxis.prototype.getXAxisTickValues = function getXAxisTickValues() {\n return this.getTickValues(this.owner.config.axis_x_tick_values, this.owner.xAxis);\n};\nAxis.prototype.getYAxisTickValues = function getYAxisTickValues() {\n return this.getTickValues(this.owner.config.axis_y_tick_values, this.owner.yAxis);\n};\nAxis.prototype.getY2AxisTickValues = function getY2AxisTickValues() {\n return this.getTickValues(this.owner.config.axis_y2_tick_values, this.owner.y2Axis);\n};\nAxis.prototype.getLabelOptionByAxisId = function getLabelOptionByAxisId(axisId) {\n const $$ = this.owner;\n const config = $$.config;\n let option;\n if (axisId === 'y') {\n option = config.axis_y_label;\n } else if (axisId === 'y2') {\n option = config.axis_y2_label;\n } else if (axisId === 'x') {\n option = config.axis_x_label;\n }\n return option;\n};\nAxis.prototype.getLabelText = function getLabelText(axisId) {\n const option = this.getLabelOptionByAxisId(axisId);\n return isString(option) ? option : option ? option.text : null; // eslint-disable-line no-nested-ternary,max-len\n};\nAxis.prototype.setLabelText = function setLabelText(axisId, text) {\n const $$ = this.owner;\n const config = $$.config;\n const option = this.getLabelOptionByAxisId(axisId);\n if (isString(option)) {\n if (axisId === 'y') {\n config.axis_y_label = text;\n } else if (axisId === 'y2') {\n config.axis_y2_label = text;\n } else if (axisId === 'x') {\n config.axis_x_label = text;\n }\n } else if (option) {\n option.text = text;\n }\n};\nAxis.prototype.getLabelPosition = function getLabelPosition(axisId, defaultPosition) {\n const option = this.getLabelOptionByAxisId(axisId);\n const position = (option && typeof option === 'object' && option.position) ? option.position : defaultPosition;\n return {\n isInner: position.indexOf('inner') >= 0,\n isOuter: position.indexOf('outer') >= 0,\n isLeft: position.indexOf('left') >= 0,\n isCenter: position.indexOf('center') >= 0,\n isRight: position.indexOf('right') >= 0,\n isTop: position.indexOf('top') >= 0,\n isMiddle: position.indexOf('middle') >= 0,\n isBottom: position.indexOf('bottom') >= 0,\n };\n};\nAxis.prototype.getXAxisLabelPosition = function getXAxisLabelPosition() {\n return this.getLabelPosition('x', this.owner.config.axis_rotated ? 'inner-top' : 'inner-right');\n};\nAxis.prototype.getYAxisLabelPosition = function getYAxisLabelPosition() {\n return this.getLabelPosition('y', this.owner.config.axis_rotated ? 'inner-right' : 'inner-top');\n};\nAxis.prototype.getY2AxisLabelPosition = function getY2AxisLabelPosition() {\n return this.getLabelPosition('y2', this.owner.config.axis_rotated ? 'inner-right' : 'inner-top');\n};\nAxis.prototype.getLabelPositionById = function getLabelPositionById(id) {\n return id === 'y2' ? this.getY2AxisLabelPosition() :\n id === 'y' ? this.getYAxisLabelPosition() : this.getXAxisLabelPosition();\n};\nAxis.prototype.textForXAxisLabel = function textForXAxisLabel() {\n return this.getLabelText('x');\n};\nAxis.prototype.textForYAxisLabel = function textForYAxisLabel() {\n return this.getLabelText('y');\n};\nAxis.prototype.textForY2AxisLabel = function textForY2AxisLabel() {\n return this.getLabelText('y2');\n};\nAxis.prototype.xForAxisLabel = function xForAxisLabel(forHorizontal, position) {\n const $$ = this.owner;\n if (forHorizontal) {\n return position.isLeft ? 0 : position.isCenter ? $$.width / 2 : $$.width;\n } else {\n return position.isBottom ? -$$.height : position.isMiddle ? -$$.height / 2 : 0;\n }\n};\nAxis.prototype.dxForAxisLabel = function dxForAxisLabel(forHorizontal, position) {\n if (forHorizontal) {\n return position.isLeft ? '0.5em' : position.isRight ? '-0.5em' : '0';\n } else {\n return position.isTop ? '-0.5em' : position.isBottom ? '0.5em' : '0';\n }\n};\nAxis.prototype.textAnchorForAxisLabel = function textAnchorForAxisLabel(forHorizontal, position) {\n if (forHorizontal) {\n return position.isLeft ? 'start' : position.isCenter ? 'middle' : 'end';\n } else {\n return position.isBottom ? 'start' : position.isMiddle ? 'middle' : 'end';\n }\n};\nAxis.prototype.xForXAxisLabel = function xForXAxisLabel() {\n return this.xForAxisLabel(!this.owner.config.axis_rotated, this.getXAxisLabelPosition());\n};\nAxis.prototype.xForYAxisLabel = function xForYAxisLabel() {\n return this.xForAxisLabel(this.owner.config.axis_rotated, this.getYAxisLabelPosition());\n};\nAxis.prototype.xForY2AxisLabel = function xForY2AxisLabel() {\n return this.xForAxisLabel(this.owner.config.axis_rotated, this.getY2AxisLabelPosition());\n};\nAxis.prototype.dxForXAxisLabel = function dxForXAxisLabel() {\n return this.dxForAxisLabel(!this.owner.config.axis_rotated, this.getXAxisLabelPosition());\n};\nAxis.prototype.dxForYAxisLabel = function dxForYAxisLabel() {\n return this.dxForAxisLabel(this.owner.config.axis_rotated, this.getYAxisLabelPosition());\n};\nAxis.prototype.dxForY2AxisLabel = function dxForY2AxisLabel() {\n return this.dxForAxisLabel(this.owner.config.axis_rotated, this.getY2AxisLabelPosition());\n};\nAxis.prototype.dyForXAxisLabel = function dyForXAxisLabel() {\n const $$ = this.owner;\n const config = $$.config;\n const position = this.getXAxisLabelPosition();\n if (config.axis_rotated) {\n return position.isInner ? '1.2em' : -25 - this.getMaxTickWidth('x');\n } else {\n return position.isInner ? '-0.5em' : config.axis_x_height ? config.axis_x_height - 10 : '3em';\n }\n};\nAxis.prototype.dyForYAxisLabel = function dyForYAxisLabel() {\n const $$ = this.owner;\n const position = this.getYAxisLabelPosition();\n if ($$.config.axis_rotated) {\n return position.isInner ? '-0.5em' : '3em';\n } else {\n return position.isInner ? '1.2em' : -10 - ($$.config.axis_y_inner ? 0 : (this.getMaxTickWidth('y') + 10));\n }\n};\nAxis.prototype.dyForY2AxisLabel = function dyForY2AxisLabel() {\n const $$ = this.owner;\n const position = this.getY2AxisLabelPosition();\n if ($$.config.axis_rotated) {\n return position.isInner ? '1.2em' : '-2.2em';\n } else {\n return position.isInner ? '-0.5em' : 15 + ($$.config.axis_y2_inner ? 0 : (this.getMaxTickWidth('y2') + 15));\n }\n};\nAxis.prototype.textAnchorForXAxisLabel = function textAnchorForXAxisLabel() {\n const $$ = this.owner;\n return this.textAnchorForAxisLabel(!$$.config.axis_rotated, this.getXAxisLabelPosition());\n};\nAxis.prototype.textAnchorForYAxisLabel = function textAnchorForYAxisLabel() {\n const $$ = this.owner;\n return this.textAnchorForAxisLabel($$.config.axis_rotated, this.getYAxisLabelPosition());\n};\nAxis.prototype.textAnchorForY2AxisLabel = function textAnchorForY2AxisLabel() {\n const $$ = this.owner;\n return this.textAnchorForAxisLabel($$.config.axis_rotated, this.getY2AxisLabelPosition());\n};\nAxis.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) {\n const $$ = this.owner;\n const config = $$.config;\n let maxWidth = 0;\n let targetsToShow;\n let scale;\n let axis;\n let dummy;\n let svg;\n if (withoutRecompute && $$.currentMaxTickWidths[id]) {\n return $$.currentMaxTickWidths[id];\n }\n if ($$.svg) {\n targetsToShow = $$.filterTargetsToShow($$.data.targets);\n if (id === 'y') {\n scale = $$.y.copy().domain($$.getYDomain(targetsToShow, 'y'));\n axis = this.getYAxis(\n scale,\n $$.yOrient,\n config.axis_y_tick_format,\n $$.yAxisTickValues,\n false,\n true,\n true\n );\n } else if (id === 'y2') {\n scale = $$.y2.copy().domain($$.getYDomain(targetsToShow, 'y2'));\n axis = this.getYAxis(\n scale,\n $$.y2Orient,\n config.axis_y2_tick_format,\n $$.y2AxisTickValues,\n false,\n true,\n true\n );\n } else {\n scale = $$.x.copy().domain($$.getXDomain(targetsToShow));\n axis = this.getXAxis(\n scale,\n $$.xOrient,\n $$.xAxisTickFormat,\n $$.xAxisTickValues,\n false,\n true,\n true\n );\n this.updateXAxisTickValues(targetsToShow, axis);\n }\n dummy = $$.d3.select('body').append('div').classed('c3', true);\n svg = dummy.append('svg')\n .style('visibility', 'hidden')\n .style('position', 'fixed')\n .style('top', 0)\n .style('left', 0);\n svg.append('g').call(axis).each(function () {\n $$.d3.select(this).selectAll('text').each(function () {\n const box = this.getBoundingClientRect();\n if (maxWidth < box.width) { maxWidth = box.width; }\n });\n dummy.remove();\n });\n }\n $$.currentMaxTickWidths[id] = maxWidth <= 0 ? $$.currentMaxTickWidths[id] : maxWidth;\n return $$.currentMaxTickWidths[id];\n};\n\nAxis.prototype.updateLabels = function updateLabels(withTransition) {\n const $$ = this.owner;\n const axisXLabel = $$.main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel);\n const axisYLabel = $$.main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel);\n const axisY2Label = $$.main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label);\n (withTransition ? axisXLabel.transition() : axisXLabel)\n .attr('x', this.xForXAxisLabel.bind(this))\n .attr('dx', this.dxForXAxisLabel.bind(this))\n .attr('dy', this.dyForXAxisLabel.bind(this))\n .text(this.textForXAxisLabel.bind(this));\n (withTransition ? axisYLabel.transition() : axisYLabel)\n .attr('x', this.xForYAxisLabel.bind(this))\n .attr('dx', this.dxForYAxisLabel.bind(this))\n .attr('dy', this.dyForYAxisLabel.bind(this))\n .text(this.textForYAxisLabel.bind(this));\n (withTransition ? axisY2Label.transition() : axisY2Label)\n .attr('x', this.xForY2AxisLabel.bind(this))\n .attr('dx', this.dxForY2AxisLabel.bind(this))\n .attr('dy', this.dyForY2AxisLabel.bind(this))\n .text(this.textForY2AxisLabel.bind(this));\n};\nAxis.prototype.getPadding = function getPadding(padding, key, defaultValue, domainLength) {\n const p = typeof padding === 'number' ? padding : padding[key];\n if (!isValue(p)) {\n return defaultValue;\n }\n if (padding.unit === 'ratio') {\n return padding[key] * domainLength;\n }\n // assume padding is pixels if unit is not specified\n return this.convertPixelsToAxisPadding(p, domainLength);\n};\nAxis.prototype.convertPixelsToAxisPadding = function convertPixelsToAxisPadding(pixels, domainLength) { // eslint-disable-line max-len\n const $$ = this.owner;\n const length = $$.config.axis_rotated ? $$.width : $$.height;\n return domainLength * (pixels / length);\n};\nAxis.prototype.generateTickValues = function generateTickValues(values, tickCount, forTimeSeries) {\n let tickValues = values;\n let targetCount;\n let start;\n let end;\n let count;\n let interval;\n let i;\n let tickValue;\n if (tickCount) {\n targetCount = isFunction(tickCount) ? tickCount() : tickCount;\n // compute ticks according to tickCount\n if (targetCount === 1) {\n tickValues = [values[0]];\n } else if (targetCount === 2) {\n tickValues = [values[0], values[values.length - 1]];\n } else if (targetCount > 2) {\n count = targetCount - 2;\n start = values[0];\n end = values[values.length - 1];\n interval = (end - start) / (count + 1);\n // re-construct unique values\n tickValues = [start];\n for (i = 0; i < count; i++) {\n tickValue = +start + interval * (i + 1);\n tickValues.push(forTimeSeries ? new Date(tickValue) : tickValue);\n }\n tickValues.push(end);\n }\n }\n if (!forTimeSeries) { tickValues = tickValues.sort((a, b) => a - b); }\n return tickValues;\n};\nAxis.prototype.generateTransitions = function generateTransitions(duration) {\n let $$ = this.owner;\n let axes = $$.axes;\n return {\n axisX: duration ? axes.x.transition().duration(duration) : axes.x,\n axisY: duration ? axes.y.transition().duration(duration) : axes.y,\n axisY2: duration ? axes.y2.transition().duration(duration) : axes.y2,\n axisSubX: duration ? axes.subx.transition().duration(duration) : axes.subx,\n };\n};\nAxis.prototype.redraw = function redraw(transitions, isHidden) {\n const $$ = this.owner;\n $$.axes.x.style('opacity', isHidden ? 0 : 1);\n $$.axes.y.style('opacity', isHidden ? 0 : 1);\n $$.axes.y2.style('opacity', isHidden ? 0 : 1);\n $$.axes.subx.style('opacity', isHidden ? 0 : 1);\n transitions.axisX.call($$.xAxis);\n transitions.axisY.call($$.yAxis);\n transitions.axisY2.call($$.y2Axis);\n transitions.axisSubX.call($$.subXAxis);\n};\n\nexport default Axis;\n","// import {\n// CLASS,\n// isValue,\n// isFunction,\n// isString,\n// isUndefined,\n// isDefined,\n// ceil10,\n// asHalfPixel,\n// diffDomain,\n// isEmpty,\n// notEmpty,\n// getOption,\n// hasValue,\n// sanitise,\n// getPathBox,\n// ChartInternal } from '../chartinternal';\n\nimport Axis from './axis';\n\nfunction API(owner) {\n this.owner = owner;\n}\n\n/* eslint-disable */\nfunction inherit(base, derived) {\n if (Object.create) {\n derived.prototype = Object.create(base.prototype);\n } else {\n const f = function f() {};\n f.prototype = base.prototype;\n derived.prototype = new f();\n }\n\n derived.prototype.constructor = derived;\n\n return derived;\n}\n/* eslint-enable */\n\nexport { API, inherit, Axis };\n","const CLASS = {\n target: 'c3-target',\n chart: 'c3-chart',\n chartLine: 'c3-chart-line',\n chartLines: 'c3-chart-lines',\n chartBar: 'c3-chart-bar',\n chartBars: 'c3-chart-bars',\n chartText: 'c3-chart-text',\n chartTexts: 'c3-chart-texts',\n chartArc: 'c3-chart-arc',\n chartArcs: 'c3-chart-arcs',\n chartArcsTitle: 'c3-chart-arcs-title',\n chartArcsBackground: 'c3-chart-arcs-background',\n chartArcsGaugeUnit: 'c3-chart-arcs-gauge-unit',\n chartArcsGaugeMax: 'c3-chart-arcs-gauge-max',\n chartArcsGaugeMin: 'c3-chart-arcs-gauge-min',\n selectedCircle: 'c3-selected-circle',\n selectedCircles: 'c3-selected-circles',\n eventRect: 'c3-event-rect',\n eventRects: 'c3-event-rects',\n eventRectsSingle: 'c3-event-rects-single',\n eventRectsMultiple: 'c3-event-rects-multiple',\n zoomRect: 'c3-zoom-rect',\n brush: 'c3-brush',\n focused: 'c3-focused',\n defocused: 'c3-defocused',\n region: 'c3-region',\n regions: 'c3-regions',\n title: 'c3-title',\n tooltipContainer: 'c3-tooltip-container',\n tooltip: 'c3-tooltip',\n tooltipName: 'c3-tooltip-name',\n shape: 'c3-shape',\n shapes: 'c3-shapes',\n line: 'c3-line',\n lines: 'c3-lines',\n bar: 'c3-bar',\n bars: 'c3-bars',\n circle: 'c3-circle',\n circles: 'c3-circles',\n arc: 'c3-arc',\n arcs: 'c3-arcs',\n area: 'c3-area',\n areas: 'c3-areas',\n empty: 'c3-empty',\n text: 'c3-text',\n texts: 'c3-texts',\n gaugeValue: 'c3-gauge-value',\n grid: 'c3-grid',\n gridLines: 'c3-grid-lines',\n xgrid: 'c3-xgrid',\n xgrids: 'c3-xgrids',\n xgridLine: 'c3-xgrid-line',\n xgridLines: 'c3-xgrid-lines',\n xgridFocus: 'c3-xgrid-focus',\n ygrid: 'c3-ygrid',\n ygrids: 'c3-ygrids',\n ygridLine: 'c3-ygrid-line',\n ygridLines: 'c3-ygrid-lines',\n axis: 'c3-axis',\n axisX: 'c3-axis-x',\n axisXLabel: 'c3-axis-x-label',\n axisY: 'c3-axis-y',\n axisYLabel: 'c3-axis-y-label',\n axisY2: 'c3-axis-y2',\n axisY2Label: 'c3-axis-y2-label',\n legendBackground: 'c3-legend-background',\n legendItem: 'c3-legend-item',\n legendItemEvent: 'c3-legend-item-event',\n legendItemTile: 'c3-legend-item-tile',\n legendItemHidden: 'c3-legend-item-hidden',\n legendItemFocused: 'c3-legend-item-focused',\n dragarea: 'c3-dragarea',\n EXPANDED: '_expanded_',\n SELECTED: '_selected_',\n INCLUDED: '_included_',\n};\nconst generateClass = function (prefix, targetId) {\n return ' ' + prefix + ' ' + prefix + this.getTargetSelectorSuffix(targetId);\n};\nconst classText = function (d) {\n return this.generateClass(CLASS.text, d.index);\n};\nconst classTexts = function (d) {\n return this.generateClass(CLASS.texts, d.id);\n};\nconst classShape = function (d) {\n return this.generateClass(CLASS.shape, d.index);\n};\nconst classShapes = function (d) {\n return this.generateClass(CLASS.shapes, d.id);\n};\nconst classLine = function (d) {\n return this.classShape(d) + this.generateClass(CLASS.line, d.id);\n};\nconst classLines = function (d) {\n return this.classShapes(d) + this.generateClass(CLASS.lines, d.id);\n};\nconst classCircle = function (d) {\n return this.classShape(d) + this.generateClass(CLASS.circle, d.index);\n};\nconst classCircles = function (d) {\n return this.classShapes(d) + this.generateClass(CLASS.circles, d.id);\n};\nconst classBar = function (d) {\n return this.classShape(d) + this.generateClass(CLASS.bar, d.index);\n};\nconst classBars = function (d) {\n return this.classShapes(d) + this.generateClass(CLASS.bars, d.id);\n};\nconst classArc = function (d) {\n return this.classShape(d.data) + this.generateClass(CLASS.arc, d.data.id);\n};\nconst classArcs = function (d) {\n return this.classShapes(d.data) + this.generateClass(CLASS.arcs, d.data.id);\n};\nconst classArea = function (d) {\n return this.classShape(d) + this.generateClass(CLASS.area, d.id);\n};\nconst classAreas = function (d) {\n return this.classShapes(d) + this.generateClass(CLASS.areas, d.id);\n};\nconst classRegion = function (d, i) {\n return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : '');\n};\nconst classEvent = function (d) {\n return this.generateClass(CLASS.eventRect, d.index);\n};\nconst classTarget = function (id) {\n const $$ = this;\n let additionalClassSuffix = $$.config.data_classes[id], additionalClass = '';\n if (additionalClassSuffix) {\n additionalClass = ' ' + CLASS.target + '-' + additionalClassSuffix;\n }\n return $$.generateClass(CLASS.target, id) + additionalClass;\n};\nconst classFocus = function (d) {\n return this.classFocused(d) + this.classDefocused(d);\n};\nconst classFocused = function (d) {\n return ' ' + (this.focusedTargetIds.indexOf(d.id) >= 0 ? CLASS.focused : '');\n};\nconst classDefocused = function (d) {\n return ' ' + (this.defocusedTargetIds.indexOf(d.id) >= 0 ? CLASS.defocused : '');\n};\nconst classChartText = function (d) {\n return CLASS.chartText + this.classTarget(d.id);\n};\nconst classChartLine = function (d) {\n return CLASS.chartLine + this.classTarget(d.id);\n};\nconst classChartBar = function (d) {\n return CLASS.chartBar + this.classTarget(d.id);\n};\nconst classChartArc = function (d) {\n return CLASS.chartArc + this.classTarget(d.data.id);\n};\nconst getTargetSelectorSuffix = function (targetId) {\n return targetId || targetId === 0 ? ('-' + targetId).replace(/[\\s?!@#$%^&*()_=+,.<>'\":;\\[\\]\\/|~`{}\\\\]/g, '-') : '';\n};\nconst selectorTarget = function (id, prefix) {\n return (prefix || '') + '.' + CLASS.target + this.getTargetSelectorSuffix(id);\n};\nconst selectorTargets = function (ids, prefix) {\n const $$ = this;\n ids = ids || [];\n return ids.length ? ids.map((id) => { return $$.selectorTarget(id, prefix); }) : null;\n};\nconst selectorLegend = function (id) {\n return '.' + CLASS.legendItem + this.getTargetSelectorSuffix(id);\n};\nconst selectorLegends = function (ids) {\n const $$ = this;\n return ids && ids.length ? ids.map((id) => { return $$.selectorLegend(id); }) : null;\n};\n\nexport {\n CLASS,\n generateClass,\n classText,\n classTexts,\n classShape,\n classShapes,\n classLine,\n classLines,\n classCircle,\n classCircles,\n classBar,\n classBars,\n classArc,\n classArcs,\n classArea,\n classAreas,\n classRegion,\n classEvent,\n classTarget,\n classFocus,\n classFocused,\n classDefocused,\n classChartText,\n classChartLine,\n classChartBar,\n classChartArc,\n getTargetSelectorSuffix,\n selectorTarget,\n selectorTargets,\n selectorLegend,\n selectorLegends,\n};\n","const isValue = function (v) {\n return v || v === 0;\n },\n isFunction = function (o) {\n return typeof o === 'function';\n },\n isString = function (o) {\n return typeof o === 'string';\n },\n isUndefined = function (v) {\n return typeof v === 'undefined';\n },\n isDefined = function (v) {\n return typeof v !== 'undefined';\n },\n ceil10 = function (v) {\n return Math.ceil(v / 10) * 10;\n },\n asHalfPixel = function (n) {\n return Math.ceil(n) + 0.5;\n },\n diffDomain = function (d) {\n return d[1] - d[0];\n },\n isEmpty = function (o) {\n return typeof o === 'undefined' || o === null || (isString(o) && o.length === 0) || (typeof o === 'object' && Object.keys(o).length === 0);\n },\n notEmpty = function (o) {\n isEmpty(o);\n },\n getOption = function (options, key, defaultValue) {\n return isDefined(options[key]) ? options[key] : defaultValue;\n },\n hasValue = function (dict, value) {\n let found = false;\n Object.keys(dict).forEach((key) => {\n if (dict[key] === value) { found = true; }\n });\n return found;\n },\n sanitise = function (str) {\n return typeof str === 'string' ? str.replace(//g, '>') : str;\n },\n getPathBox = function (path) {\n let box = path.getBoundingClientRect(),\n items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)],\n minX = items[0].x, minY = Math.min(items[0].y, items[1].y);\n\n return { x: minX, y: minY, width: box.width, height: box.height };\n };\n\nexport {\n isValue,\n isFunction,\n isString,\n isUndefined,\n isDefined,\n ceil10,\n asHalfPixel,\n diffDomain,\n isEmpty,\n notEmpty,\n getOption,\n hasValue,\n sanitise,\n getPathBox,\n};\n","import { CLASS } from './class';\nimport { isFunction } from './util';\n\nconst initPie = function () {\n let $$ = this, d3 = $$.d3, config = $$.config;\n $$.pie = d3.layout.pie().value((d) => {\n return d.values.reduce((a, b) => { return a + b.value; }, 0);\n });\n if (!config.data_order) {\n $$.pie.sort(null);\n }\n};\n\nconst updateRadius = function () {\n let $$ = this, config = $$.config,\n w = config.gauge_width || config.donut_width;\n $$.radiusExpanded = Math.min($$.arcWidth, $$.arcHeight) / 2;\n $$.radius = $$.radiusExpanded * 0.95;\n $$.innerRadiusRatio = w ? ($$.radius - w) / $$.radius : 0.6;\n $$.innerRadius = $$.hasType('donut') || $$.hasType('gauge') ? $$.radius * $$.innerRadiusRatio : 0;\n};\n\nconst updateArc = function () {\n const $$ = this;\n $$.svgArc = $$.getSvgArc();\n $$.svgArcExpanded = $$.getSvgArcExpanded();\n $$.svgArcExpandedSub = $$.getSvgArcExpanded(0.98);\n};\n\nconst updateAngle = function (d) {\n let $$ = this, config = $$.config,\n found = false, index = 0,\n gMin, gMax, gTic, gValue;\n\n if (!config) {\n return null;\n }\n\n $$.pie($$.filterTargetsToShow($$.data.targets)).forEach((t) => {\n if (!found && t.data.id === d.data.id) {\n found = true;\n d = t;\n d.index = index;\n }\n index++;\n });\n if (isNaN(d.startAngle)) {\n d.startAngle = 0;\n }\n if (isNaN(d.endAngle)) {\n d.endAngle = d.startAngle;\n }\n if ($$.isGaugeType(d.data)) {\n gMin = config.gauge_min;\n gMax = config.gauge_max;\n gTic = (Math.PI * (config.gauge_fullCircle ? 2 : 1)) / (gMax - gMin);\n gValue = d.value < gMin ? 0 : d.value < gMax ? d.value - gMin : (gMax - gMin);\n d.startAngle = config.gauge_startingAngle;\n d.endAngle = d.startAngle + gTic * gValue;\n }\n return found ? d : null;\n};\n\nconst getSvgArc = function () {\n let $$ = this,\n arc = $$.d3.svg.arc().outerRadius($$.radius).innerRadius($$.innerRadius),\n newArc = function (d, withoutUpdate) {\n let updated;\n if (withoutUpdate) { return arc(d); } // for interpolate\n updated = $$.updateAngle(d);\n return updated ? arc(updated) : 'M 0 0';\n };\n // TODO: extends all function\n newArc.centroid = arc.centroid;\n return newArc;\n};\n\nconst getSvgArcExpanded = function (rate) {\n let $$ = this,\n arc = $$.d3.svg.arc().outerRadius($$.radiusExpanded * (rate ? rate : 1)).innerRadius($$.innerRadius);\n return function (d) {\n const updated = $$.updateAngle(d);\n return updated ? arc(updated) : 'M 0 0';\n };\n};\n\nconst getArc = function (d, withoutUpdate, force) {\n return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : 'M 0 0';\n};\n\n\nconst transformForArcLabel = function (d) {\n let $$ = this, config = $$.config,\n updated = $$.updateAngle(d), c, x, y, h, ratio, translate = '';\n if (updated && !$$.hasType('gauge')) {\n c = this.svgArc.centroid(updated);\n x = isNaN(c[0]) ? 0 : c[0];\n y = isNaN(c[1]) ? 0 : c[1];\n h = Math.sqrt(x * x + y * y);\n if ($$.hasType('donut') && config.donut_label_ratio) {\n ratio = isFunction(config.donut_label_ratio) ? config.donut_label_ratio(d, $$.radius, h) : config.donut_label_ratio;\n } else if ($$.hasType('pie') && config.pie_label_ratio) {\n ratio = isFunction(config.pie_label_ratio) ? config.pie_label_ratio(d, $$.radius, h) : config.pie_label_ratio;\n } else {\n ratio = $$.radius && h ? (36 / $$.radius > 0.375 ? 1.175 - 36 / $$.radius : 0.8) * $$.radius / h : 0;\n }\n translate = 'translate(' + (x * ratio) + ',' + (y * ratio) + ')';\n }\n return translate;\n};\n\nconst getArcRatio = function (d) {\n let $$ = this,\n config = $$.config,\n whole = Math.PI * ($$.hasType('gauge') && !config.gauge_fullCircle ? 1 : 2);\n return d ? (d.endAngle - d.startAngle) / whole : null;\n};\n\nconst convertToArcData = function (d) {\n return this.addName({\n id: d.data.id,\n value: d.value,\n ratio: this.getArcRatio(d),\n index: d.index,\n });\n};\n\nconst textForArcLabel = function (d) {\n let $$ = this,\n updated, value, ratio, id, format;\n if (!$$.shouldShowArcLabel()) { return ''; }\n updated = $$.updateAngle(d);\n value = updated ? updated.value : null;\n ratio = $$.getArcRatio(updated);\n id = d.data.id;\n if (!$$.hasType('gauge') && !$$.meetsArcLabelThreshold(ratio)) { return ''; }\n format = $$.getArcLabelFormat();\n return format ? format(value, ratio, id) : $$.defaultArcValueFormat(value, ratio);\n};\n\nconst expandArc = function (targetIds) {\n let $$ = this, interval;\n\n // MEMO: avoid to cancel transition\n if ($$.transiting) {\n interval = window.setInterval(() => {\n if (!$$.transiting) {\n window.clearInterval(interval);\n if ($$.legend.selectAll('.c3-legend-item-focused').size() > 0) {\n $$.expandArc(targetIds);\n }\n }\n }, 10);\n return;\n }\n\n targetIds = $$.mapToTargetIds(targetIds);\n\n $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS.chartArc)).each(function (d) {\n if (!$$.shouldExpand(d.data.id)) { return; }\n $$.d3.select(this).selectAll('path')\n .transition().duration($$.expandDuration(d.data.id))\n .attr('d', $$.svgArcExpanded)\n .transition().duration($$.expandDuration(d.data.id) * 2)\n .attr('d', $$.svgArcExpandedSub)\n .each((d) => {\n if ($$.isDonutType(d.data)) {\n // callback here\n }\n });\n });\n};\n\nconst unexpandArc = function (targetIds) {\n const $$ = this;\n\n if ($$.transiting) { return; }\n\n targetIds = $$.mapToTargetIds(targetIds);\n\n $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS.chartArc)).selectAll('path')\n .transition().duration((d) => {\n return $$.expandDuration(d.data.id);\n })\n .attr('d', $$.svgArc);\n $$.svg.selectAll('.' + CLASS.arc)\n .style('opacity', 1);\n};\n\nconst expandDuration = function (id) {\n let $$ = this, config = $$.config;\n\n if ($$.isDonutType(id)) {\n return config.donut_expand_duration;\n } else if ($$.isGaugeType(id)) {\n return config.gauge_expand_duration;\n } else if ($$.isPieType(id)) {\n return config.pie_expand_duration;\n } else {\n return 50;\n }\n};\n\nconst shouldExpand = function (id) {\n let $$ = this, config = $$.config;\n return ($$.isDonutType(id) && config.donut_expand) ||\n ($$.isGaugeType(id) && config.gauge_expand) ||\n ($$.isPieType(id) && config.pie_expand);\n};\n\nconst shouldShowArcLabel = function () {\n let $$ = this, config = $$.config, shouldShow = true;\n if ($$.hasType('donut')) {\n shouldShow = config.donut_label_show;\n } else if ($$.hasType('pie')) {\n shouldShow = config.pie_label_show;\n }\n // when gauge, always true\n return shouldShow;\n};\n\nconst meetsArcLabelThreshold = function (ratio) {\n let $$ = this, config = $$.config,\n threshold = $$.hasType('donut') ? config.donut_label_threshold : config.pie_label_threshold;\n return ratio >= threshold;\n};\n\nconst getArcLabelFormat = function () {\n let $$ = this, config = $$.config,\n format = config.pie_label_format;\n if ($$.hasType('gauge')) {\n format = config.gauge_label_format;\n } else if ($$.hasType('donut')) {\n format = config.donut_label_format;\n }\n return format;\n};\n\nconst getArcTitle = function () {\n const $$ = this;\n return $$.hasType('donut') ? $$.config.donut_title : '';\n};\n\nconst updateTargetsForArc = function (targets) {\n let $$ = this, main = $$.main,\n mainPieUpdate, mainPieEnter,\n classChartArc = $$.classChartArc.bind($$),\n classArcs = $$.classArcs.bind($$),\n classFocus = $$.classFocus.bind($$);\n mainPieUpdate = main.select('.' + CLASS.chartArcs).selectAll('.' + CLASS.chartArc)\n .data($$.pie(targets))\n .attr('class', (d) => { return classChartArc(d) + classFocus(d.data); });\n mainPieEnter = mainPieUpdate.enter().append('g')\n .attr('class', classChartArc);\n mainPieEnter.append('g')\n .attr('class', classArcs);\n mainPieEnter.append('text')\n .attr('dy', $$.hasType('gauge') ? '-.1em' : '.35em')\n .style('opacity', 0)\n .style('text-anchor', 'middle')\n .style('pointer-events', 'none');\n // MEMO: can not keep same color..., but not bad to update color in redraw\n // mainPieUpdate.exit().remove();\n};\n\nconst initArc = function () {\n const $$ = this;\n $$.arcs = $$.main.select('.' + CLASS.chart).append('g')\n .attr('class', CLASS.chartArcs)\n .attr('transform', $$.getTranslate('arc'));\n $$.arcs.append('text')\n .attr('class', CLASS.chartArcsTitle)\n .style('text-anchor', 'middle')\n .text($$.getArcTitle());\n};\n\nconst redrawArc = function (duration, durationForExit, withTransform) {\n let $$ = this, d3 = $$.d3, config = $$.config, main = $$.main,\n mainArc;\n mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc)\n .data($$.arcData.bind($$));\n mainArc.enter().append('path')\n .attr('class', $$.classArc.bind($$))\n .style('fill', (d) => { return $$.color(d.data); })\n .style('cursor', (d) => { return config.interaction_enabled && config.data_selection_isselectable(d) ? 'pointer' : null; })\n .style('opacity', 0)\n .each(function (d) {\n if ($$.isGaugeType(d.data)) {\n d.startAngle = d.endAngle = config.gauge_startingAngle;\n }\n this._current = d;\n });\n mainArc\n .attr('transform', (d) => { return !$$.isGaugeType(d.data) && withTransform ? 'scale(0)' : ''; })\n .style('opacity', function (d) { return d === this._current ? 0 : 1; })\n .on('mouseover', config.interaction_enabled ? function (d) {\n let updated, arcData;\n if ($$.transiting) { // skip while transiting\n return;\n }\n updated = $$.updateAngle(d);\n if (updated) {\n arcData = $$.convertToArcData(updated);\n // transitions\n $$.expandArc(updated.data.id);\n $$.api.focus(updated.data.id);\n $$.toggleFocusLegend(updated.data.id, true);\n $$.config.data_onmouseover(arcData, this);\n }\n } : null)\n .on('mousemove', config.interaction_enabled ? function (d) {\n let updated = $$.updateAngle(d), arcData, selectedData;\n if (updated) {\n arcData = $$.convertToArcData(updated),\n selectedData = [arcData];\n $$.showTooltip(selectedData, this);\n }\n } : null)\n .on('mouseout', config.interaction_enabled ? function (d) {\n let updated, arcData;\n if ($$.transiting) { // skip while transiting\n return;\n }\n updated = $$.updateAngle(d);\n if (updated) {\n arcData = $$.convertToArcData(updated);\n // transitions\n $$.unexpandArc(updated.data.id);\n $$.api.revert();\n $$.revertLegend();\n $$.hideTooltip();\n $$.config.data_onmouseout(arcData, this);\n }\n } : null)\n .on('click', config.interaction_enabled ? function (d, i) {\n let updated = $$.updateAngle(d), arcData;\n if (updated) {\n arcData = $$.convertToArcData(updated);\n if ($$.toggleShape) {\n $$.toggleShape(this, arcData, i);\n }\n $$.config.data_onclick.call($$.api, arcData, this);\n }\n } : null)\n .each(() => { $$.transiting = true; })\n .transition().duration(duration)\n .attrTween('d', function (d) {\n let updated = $$.updateAngle(d), interpolate;\n if (!updated) {\n return function () { return 'M 0 0'; };\n }\n // if (this._current === d) {\n // this._current = {\n // startAngle: Math.PI*2,\n // endAngle: Math.PI*2,\n // };\n // }\n if (isNaN(this._current.startAngle)) {\n this._current.startAngle = 0;\n }\n if (isNaN(this._current.endAngle)) {\n this._current.endAngle = this._current.startAngle;\n }\n interpolate = d3.interpolate(this._current, updated);\n this._current = interpolate(0);\n return function (t) {\n const interpolated = interpolate(t);\n interpolated.data = d.data; // data.id will be updated by interporator\n return $$.getArc(interpolated, true);\n };\n })\n .attr('transform', withTransform ? 'scale(1)' : '')\n .style('fill', (d) => {\n return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data.id);\n }) // Where gauge reading color would receive customization.\n .style('opacity', 1)\n .call($$.endall, () => {\n $$.transiting = false;\n });\n mainArc.exit().transition().duration(durationForExit)\n .style('opacity', 0)\n .remove();\n main.selectAll('.' + CLASS.chartArc).select('text')\n .style('opacity', 0)\n .attr('class', (d) => { return $$.isGaugeType(d.data) ? CLASS.gaugeValue : ''; })\n .text($$.textForArcLabel.bind($$))\n .attr('transform', $$.transformForArcLabel.bind($$))\n .style('font-size', (d) => { return $$.isGaugeType(d.data) ? Math.round($$.radius / 5) + 'px' : ''; })\n .transition().duration(duration)\n .style('opacity', (d) => { return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? 1 : 0; });\n main.select('.' + CLASS.chartArcsTitle)\n .style('opacity', $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0);\n\n if ($$.hasType('gauge')) {\n $$.arcs.select('.' + CLASS.chartArcsBackground)\n .attr('d', () => {\n const d = {\n data: [{ value: config.gauge_max }],\n startAngle: config.gauge_startingAngle,\n endAngle: -1 * config.gauge_startingAngle,\n };\n return $$.getArc(d, true, true);\n });\n $$.arcs.select('.' + CLASS.chartArcsGaugeUnit)\n .attr('dy', '.75em')\n .text(config.gauge_label_show ? config.gauge_units : '');\n $$.arcs.select('.' + CLASS.chartArcsGaugeMin)\n .attr('dx', -1 * ($$.innerRadius + (($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2))) + 'px')\n .attr('dy', '1.2em')\n .text(config.gauge_label_show ? config.gauge_min : '');\n $$.arcs.select('.' + CLASS.chartArcsGaugeMax)\n .attr('dx', $$.innerRadius + (($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2)) + 'px')\n .attr('dy', '1.2em')\n .text(config.gauge_label_show ? config.gauge_max : '');\n }\n};\nconst initGauge = function () {\n const arcs = this.arcs;\n if (this.hasType('gauge')) {\n arcs.append('path')\n .attr('class', CLASS.chartArcsBackground);\n arcs.append('text')\n .attr('class', CLASS.chartArcsGaugeUnit)\n .style('text-anchor', 'middle')\n .style('pointer-events', 'none');\n arcs.append('text')\n .attr('class', CLASS.chartArcsGaugeMin)\n .style('text-anchor', 'middle')\n .style('pointer-events', 'none');\n arcs.append('text')\n .attr('class', CLASS.chartArcsGaugeMax)\n .style('text-anchor', 'middle')\n .style('pointer-events', 'none');\n }\n};\nconst getGaugeLabelHeight = function () {\n return this.config.gauge_label_show ? 20 : 0;\n};\n\nexport {\n initPie,\n updateRadius,\n updateArc,\n updateAngle,\n getSvgArc,\n getSvgArcExpanded,\n getArc,\n transformForArcLabel,\n getArcRatio,\n convertToArcData,\n textForArcLabel,\n expandArc,\n unexpandArc,\n expandDuration,\n shouldExpand,\n shouldShowArcLabel,\n meetsArcLabelThreshold,\n getArcLabelFormat,\n getArcTitle,\n updateTargetsForArc,\n initArc,\n redrawArc,\n initGauge,\n getGaugeLabelHeight,\n};\n","const hasCaches = function (ids) {\n for (let i = 0; i < ids.length; i++) {\n if (!(ids[i] in this.cache)) { return false; }\n }\n return true;\n};\n\nconst addCache = function (id, target) {\n this.cache[id] = this.cloneTarget(target);\n};\n\nconst getCaches = function (ids) {\n let targets = [], i;\n for (i = 0; i < ids.length; i++) {\n if (ids[i] in this.cache) { targets.push(this.cloneTarget(this.cache[ids[i]])); }\n }\n return targets;\n};\n\nexport {\n hasCaches,\n addCache,\n getCaches,\n};\n","const categoryName = function (i) {\n const config = this.config;\n return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i;\n};\n\nexport { categoryName };\n","const getClipPath = function (id) {\n const isIE9 = window.navigator.appVersion.toLowerCase().indexOf('msie 9.') >= 0;\n return 'url(' + (isIE9 ? '' : document.URL.split('#')[0]) + '#' + id + ')';\n};\nconst appendClip = function (parent, id) {\n return parent.append('clipPath').attr('id', id).append('rect');\n};\nconst getAxisClipX = function (forHorizontal) {\n // axis line width + padding for left\n const left = Math.max(30, this.margin.left);\n return forHorizontal ? -(1 + left) : -(left - 1);\n};\nconst getAxisClipY = function (forHorizontal) {\n return forHorizontal ? -20 : -this.margin.top;\n};\nconst getXAxisClipX = function () {\n const $$ = this;\n return $$.getAxisClipX(!$$.config.axis_rotated);\n};\nconst getXAxisClipY = function () {\n const $$ = this;\n return $$.getAxisClipY(!$$.config.axis_rotated);\n};\nconst getYAxisClipX = function () {\n const $$ = this;\n return $$.config.axis_y_inner ? -1 : $$.getAxisClipX($$.config.axis_rotated);\n};\nconst getYAxisClipY = function () {\n const $$ = this;\n return $$.getAxisClipY($$.config.axis_rotated);\n};\nconst getAxisClipWidth = function (forHorizontal) {\n let $$ = this,\n left = Math.max(30, $$.margin.left),\n right = Math.max(30, $$.margin.right);\n // width + axis line width + padding for left/right\n return forHorizontal ? $$.width + 2 + left + right : $$.margin.left + 20;\n};\nconst getAxisClipHeight = function (forHorizontal) {\n // less than 20 is not enough to show the axis label 'outer' without legend\n return (forHorizontal ? this.margin.bottom : (this.margin.top + this.height)) + 20;\n};\nconst getXAxisClipWidth = function () {\n const $$ = this;\n return $$.getAxisClipWidth(!$$.config.axis_rotated);\n};\nconst getXAxisClipHeight = function () {\n const $$ = this;\n return $$.getAxisClipHeight(!$$.config.axis_rotated);\n};\nconst getYAxisClipWidth = function () {\n const $$ = this;\n return $$.getAxisClipWidth($$.config.axis_rotated) + ($$.config.axis_y_inner ? 20 : 0);\n};\nconst getYAxisClipHeight = function () {\n const $$ = this;\n return $$.getAxisClipHeight($$.config.axis_rotated);\n};\n\nexport {\n getClipPath,\n appendClip,\n getAxisClipX,\n getAxisClipY,\n getXAxisClipX,\n getXAxisClipY,\n getYAxisClipX,\n getYAxisClipY,\n getAxisClipWidth,\n getAxisClipHeight,\n getXAxisClipWidth,\n getXAxisClipHeight,\n getYAxisClipWidth,\n getYAxisClipHeight,\n};\n","import {\n notEmpty,\n} from './util';\n\nconst generateColor = function () {\n let $$ = this, config = $$.config, d3 = $$.d3,\n colors = config.data_colors,\n pattern = notEmpty(config.color_pattern) ? config.color_pattern : d3.scale.category10().range(),\n callback = config.data_color,\n ids = [];\n\n return function (d) {\n let id = d.id || (d.data && d.data.id) || d, color;\n\n // if callback function is provided\n if (colors[id] instanceof Function) {\n color = colors[id](d);\n }\n // if specified, choose that color\n else if (colors[id]) {\n color = colors[id];\n }\n // if not specified, choose from pattern\n else {\n if (ids.indexOf(id) < 0) { ids.push(id); }\n color = pattern[ids.indexOf(id) % pattern.length];\n colors[id] = color;\n }\n return callback instanceof Function ? callback(color, d) : color;\n };\n};\nconst generateLevelColor = function () {\n let $$ = this, config = $$.config,\n colors = config.color_pattern,\n threshold = config.color_threshold,\n asValue = threshold.unit === 'value',\n values = threshold.values && threshold.values.length ? threshold.values : [],\n max = threshold.max || 100;\n return notEmpty(config.color_threshold) ? function (value) {\n let i, v, color = colors[colors.length - 1];\n for (i = 0; i < values.length; i++) {\n v = asValue ? value : (value * 100 / max);\n if (v < values[i]) {\n color = colors[i];\n break;\n }\n }\n return color;\n } : null;\n};\n\nexport {\n generateColor,\n generateLevelColor\n};\n","import { isDefined } from './util';\n\nconst getDefaultConfig = function () {\n const config = {\n bindto: '#chart',\n svg_classname: undefined,\n size_width: undefined,\n size_height: undefined,\n padding_left: undefined,\n padding_right: undefined,\n padding_top: undefined,\n padding_bottom: undefined,\n resize_auto: true,\n zoom_enabled: false,\n zoom_extent: undefined,\n zoom_privileged: false,\n zoom_rescale: false,\n zoom_onzoom() {},\n zoom_onzoomstart() {},\n zoom_onzoomend() {},\n zoom_x_min: undefined,\n zoom_x_max: undefined,\n interaction_brighten: true,\n interaction_enabled: true,\n onmouseover() {},\n onmouseout() {},\n onresize() {},\n onresized() {},\n oninit() {},\n onrendered() {},\n transition_duration: 350,\n data_x: undefined,\n data_xs: {},\n data_xFormat: '%Y-%m-%d',\n data_xLocaltime: true,\n data_xSort: true,\n data_idConverter(id) { return id; },\n data_names: {},\n data_classes: {},\n data_groups: [],\n data_axes: {},\n data_type: undefined,\n data_types: {},\n data_labels: {},\n data_order: 'desc',\n data_regions: {},\n data_color: undefined,\n data_colors: {},\n data_hide: false,\n data_filter: undefined,\n data_selection_enabled: false,\n data_selection_grouped: false,\n data_selection_isselectable() { return true; },\n data_selection_multiple: true,\n data_selection_draggable: false,\n data_onclick() {},\n data_onmouseover() {},\n data_onmouseout() {},\n data_onselected() {},\n data_onunselected() {},\n data_url: undefined,\n data_headers: undefined,\n data_json: undefined,\n data_rows: undefined,\n data_columns: undefined,\n data_mimeType: undefined,\n data_keys: undefined,\n // configuration for no plot-able data supplied.\n data_empty_label_text: '',\n // subchart\n subchart_show: false,\n subchart_size_height: 60,\n subchart_axis_x_show: true,\n subchart_onbrush() {},\n // color\n color_pattern: [],\n color_threshold: {},\n // legend\n legend_show: true,\n legend_hide: false,\n legend_position: 'bottom',\n legend_inset_anchor: 'top-left',\n legend_inset_x: 10,\n legend_inset_y: 0,\n legend_inset_step: undefined,\n legend_item_onclick: undefined,\n legend_item_onmouseover: undefined,\n legend_item_onmouseout: undefined,\n legend_equally: false,\n legend_padding: 0,\n legend_item_tile_width: 10,\n legend_item_tile_height: 10,\n // axis\n axis_rotated: false,\n axis_x_show: true,\n axis_x_type: 'indexed',\n axis_x_localtime: true,\n axis_x_categories: [],\n axis_x_tick_centered: false,\n axis_x_tick_format: undefined,\n axis_x_tick_culling: {},\n axis_x_tick_culling_max: 10,\n axis_x_tick_count: undefined,\n axis_x_tick_fit: true,\n axis_x_tick_values: null,\n axis_x_tick_rotate: 0,\n axis_x_tick_outer: true,\n axis_x_tick_multiline: true,\n axis_x_tick_width: null,\n axis_x_max: undefined,\n axis_x_min: undefined,\n axis_x_padding: {},\n axis_x_height: undefined,\n axis_x_extent: undefined,\n axis_x_label: {},\n axis_y_show: true,\n axis_y_type: undefined,\n axis_y_max: undefined,\n axis_y_min: undefined,\n axis_y_inverted: false,\n axis_y_center: undefined,\n axis_y_inner: undefined,\n axis_y_label: {},\n axis_y_tick_format: undefined,\n axis_y_tick_outer: true,\n axis_y_tick_values: null,\n axis_y_tick_rotate: 0,\n axis_y_tick_count: undefined,\n axis_y_tick_time_value: undefined,\n axis_y_tick_time_interval: undefined,\n axis_y_padding: {},\n axis_y_default: undefined,\n axis_y2_show: false,\n axis_y2_max: undefined,\n axis_y2_min: undefined,\n axis_y2_inverted: false,\n axis_y2_center: undefined,\n axis_y2_inner: undefined,\n axis_y2_label: {},\n axis_y2_tick_format: undefined,\n axis_y2_tick_outer: true,\n axis_y2_tick_values: null,\n axis_y2_tick_count: undefined,\n axis_y2_padding: {},\n axis_y2_default: undefined,\n // grid\n grid_x_show: false,\n grid_x_type: 'tick',\n grid_x_lines: [],\n grid_y_show: false,\n // not used\n // grid_y_type: 'tick',\n grid_y_lines: [],\n grid_y_ticks: 10,\n grid_focus_show: true,\n grid_lines_front: true,\n // point - point of each data\n point_show: true,\n point_r: 2.5,\n point_sensitivity: 10,\n point_focus_expand_enabled: true,\n point_focus_expand_r: undefined,\n point_select_r: undefined,\n // line\n line_connectNull: false,\n line_step_type: 'step',\n // bar\n bar_width: undefined,\n bar_width_ratio: 0.6,\n bar_width_max: undefined,\n bar_zerobased: true,\n // area\n area_zerobased: true,\n area_above: false,\n // pie\n pie_label_show: true,\n pie_label_format: undefined,\n pie_label_threshold: 0.05,\n pie_label_ratio: undefined,\n pie_expand: {},\n pie_expand_duration: 50,\n // gauge\n gauge_fullCircle: false,\n gauge_label_show: true,\n gauge_label_format: undefined,\n gauge_min: 0,\n gauge_max: 100,\n gauge_startingAngle: -1 * Math.PI / 2,\n gauge_units: undefined,\n gauge_width: undefined,\n gauge_expand: {},\n gauge_expand_duration: 50,\n // donut\n donut_label_show: true,\n donut_label_format: undefined,\n donut_label_threshold: 0.05,\n donut_label_ratio: undefined,\n donut_width: undefined,\n donut_title: '',\n donut_expand: {},\n donut_expand_duration: 50,\n // spline\n spline_interpolation_type: 'cardinal',\n // region - region to change style\n regions: [],\n // tooltip - show when mouseover on each data\n tooltip_show: true,\n tooltip_grouped: true,\n tooltip_format_title: undefined,\n tooltip_format_name: undefined,\n tooltip_format_value: undefined,\n tooltip_position: undefined,\n tooltip_contents(d, defaultTitleFormat, defaultValueFormat, color) {\n return this.getTooltipContent ? this.getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) : '';\n },\n tooltip_init_show: false,\n tooltip_init_x: 0,\n tooltip_init_position: { top: '0px', left: '50px' },\n tooltip_onshow() {},\n tooltip_onhide() {},\n // title\n title_text: undefined,\n title_padding: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n },\n title_position: 'top-center',\n // TouchEvent configuration\n touch_tap_radius: 20, // touch movement must be less than this to be a 'tap'\n touch_tap_delay: 500, //clicks are suppressed for this many ms after a tap\n };\n\n Object.keys(this.additionalConfig).forEach(function (key) {\n config[key] = this.additionalConfig[key];\n }, this);\n\n return config;\n};\nconst additionalConfig = {};\n\nconst loadConfig = function (config) {\n let this_config = this.config, target, keys, read;\n function find() {\n const key = keys.shift();\n// console.log(\"key =>\", key, \", target =>\", target);\n if (key && target && typeof target === 'object' && key in target) {\n target = target[key];\n return find();\n }\n else if (!key) {\n return target;\n }\n else {\n return undefined;\n }\n }\n Object.keys(this_config).forEach((key) => {\n target = config;\n keys = key.split('_');\n read = find();\n// console.log(\"CONFIG : \", key, read);\n if (isDefined(read)) {\n this_config[key] = read;\n }\n });\n};\n\nexport {\n getDefaultConfig,\n additionalConfig,\n loadConfig,\n};\n","import {\n isUndefined,\n isValue,\n notEmpty,\n isDefined,\n} from './util';\n\nconst convertUrlToData = function (url, mimeType, headers, keys, done) {\n let $$ = this, type = mimeType ? mimeType : 'csv';\n const req = $$.d3.xhr(url);\n if (headers) {\n Object.keys(headers).forEach((header) => {\n req.header(header, headers[header]);\n });\n }\n req.get((error, data) => {\n let d;\n if (!data) {\n throw new Error(error.responseURL + ' ' + error.status + ' (' + error.statusText + ')');\n }\n if (type === 'json') {\n d = $$.convertJsonToData(JSON.parse(data.response), keys);\n } else if (type === 'tsv') {\n d = $$.convertTsvToData(data.response);\n } else {\n d = $$.convertCsvToData(data.response);\n }\n done.call($$, d);\n });\n};\nconst convertXsvToData = function (xsv, parser) {\n let rows = parser.parseRows(xsv), d;\n if (rows.length === 1) {\n d = [{}];\n rows[0].forEach((id) => {\n d[0][id] = null;\n });\n } else {\n d = parser.parse(xsv);\n }\n return d;\n};\nconst convertCsvToData = function (csv) {\n return this.convertXsvToData(csv, this.d3.csv);\n};\nconst convertTsvToData = function (tsv) {\n return this.convertXsvToData(tsv, this.d3.tsv);\n};\nconst convertJsonToData = function (json, keys) {\n let $$ = this,\n new_rows = [], targetKeys, data;\n if (keys) { // when keys specified, json would be an array that includes objects\n if (keys.x) {\n targetKeys = keys.value.concat(keys.x);\n $$.config.data_x = keys.x;\n } else {\n targetKeys = keys.value;\n }\n new_rows.push(targetKeys);\n json.forEach((o) => {\n const new_row = [];\n targetKeys.forEach((key) => {\n // convert undefined to null because undefined data will be removed in convertDataToTargets()\n let v = $$.findValueInJson(o, key);\n if (isUndefined(v)) {\n v = null;\n }\n new_row.push(v);\n });\n new_rows.push(new_row);\n });\n data = $$.convertRowsToData(new_rows);\n } else {\n Object.keys(json).forEach((key) => {\n new_rows.push([key].concat(json[key]));\n });\n data = $$.convertColumnsToData(new_rows);\n }\n return data;\n};\nconst findValueInJson = function (object, path) {\n path = path.replace(/\\[(\\w+)\\]/g, '.$1'); // convert indexes to properties (replace [] with .)\n path = path.replace(/^\\./, ''); // strip a leading dot\n const pathArray = path.split('.');\n for (let i = 0; i < pathArray.length; ++i) {\n const k = pathArray[i];\n if (k in object) {\n object = object[k];\n } else {\n return;\n }\n }\n return object;\n};\nconst convertRowsToData = function (rows) {\n let keys = rows[0], new_row = {}, new_rows = [], i, j;\n for (i = 1; i < rows.length; i++) {\n new_row = {};\n for (j = 0; j < rows[i].length; j++) {\n if (isUndefined(rows[i][j])) {\n throw new Error('Source data is missing a component at (' + i + ',' + j + ')!');\n }\n new_row[keys[j]] = rows[i][j];\n }\n new_rows.push(new_row);\n }\n return new_rows;\n};\nconst convertColumnsToData = function (columns) {\n let new_rows = [], i, j, key;\n for (i = 0; i < columns.length; i++) {\n key = columns[i][0];\n for (j = 1; j < columns[i].length; j++) {\n if (isUndefined(new_rows[j - 1])) {\n new_rows[j - 1] = {};\n }\n if (isUndefined(columns[i][j])) {\n throw new Error('Source data is missing a component at (' + i + ',' + j + ')!');\n }\n new_rows[j - 1][key] = columns[i][j];\n }\n }\n return new_rows;\n};\nconst convertDataToTargets = function (data, appendXs) {\n let $$ = this, config = $$.config,\n ids = $$.d3.keys(data[0]).filter($$.isNotX, $$),\n xs = $$.d3.keys(data[0]).filter($$.isX, $$),\n targets;\n\n // save x for update data by load when custom x and c3.x API\n ids.forEach((id) => {\n const xKey = $$.getXKey(id);\n\n if ($$.isCustomX() || $$.isTimeSeries()) {\n // if included in input data\n if (xs.indexOf(xKey) >= 0) {\n $$.data.xs[id] = (appendXs && $$.data.xs[id] ? $$.data.xs[id] : []).concat(\n data.map((d) => { return d[xKey]; })\n .filter(isValue)\n .map((rawX, i) => { return $$.generateTargetX(rawX, id, i); })\n );\n }\n // if not included in input data, find from preloaded data of other id's x\n else if (config.data_x) {\n $$.data.xs[id] = $$.getOtherTargetXs();\n }\n // if not included in input data, find from preloaded data\n else if (notEmpty(config.data_xs)) {\n $$.data.xs[id] = $$.getXValuesOfXKey(xKey, $$.data.targets);\n }\n // MEMO: if no x included, use same x of current will be used\n } else {\n $$.data.xs[id] = data.map((d, i) => { return i; });\n }\n });\n\n\n // check x is defined\n ids.forEach((id) => {\n if (!$$.data.xs[id]) {\n throw new Error('x is not defined for id = \"' + id + '\".');\n }\n });\n\n // convert to target\n targets = ids.map((id, index) => {\n const convertedId = config.data_idConverter(id);\n return {\n id: convertedId,\n id_org: id,\n values: data.map((d, i) => {\n let xKey = $$.getXKey(id), rawX = d[xKey],\n value = d[id] !== null && !isNaN(d[id]) ? +d[id] : null, x;\n // use x as categories if custom x and categorized\n if ($$.isCustomX() && $$.isCategorized() && index === 0 && !isUndefined(rawX)) {\n if (index === 0 && i === 0) {\n config.axis_x_categories = [];\n }\n x = config.axis_x_categories.indexOf(rawX);\n if (x === -1) {\n x = config.axis_x_categories.length;\n config.axis_x_categories.push(rawX);\n }\n } else {\n x = $$.generateTargetX(rawX, id, i);\n }\n // mark as x = undefined if value is undefined and filter to remove after mapped\n if (isUndefined(d[id]) || $$.data.xs[id].length <= i) {\n x = undefined;\n }\n return { x, value, id: convertedId };\n }).filter((v) => { return isDefined(v.x); }),\n };\n });\n\n // finish targets\n targets.forEach((t) => {\n let i;\n // sort values by its x\n if (config.data_xSort) {\n t.values = t.values.sort((v1, v2) => {\n let x1 = v1.x || v1.x === 0 ? v1.x : Infinity,\n x2 = v2.x || v2.x === 0 ? v2.x : Infinity;\n return x1 - x2;\n });\n }\n // indexing each value\n i = 0;\n t.values.forEach((v) => {\n v.index = i++;\n });\n // this needs to be sorted because its index and value.index is identical\n $$.data.xs[t.id].sort((v1, v2) => {\n return v1 - v2;\n });\n });\n\n // cache information about values\n $$.hasNegativeValue = $$.hasNegativeValueInTargets(targets);\n $$.hasPositiveValue = $$.hasPositiveValueInTargets(targets);\n\n // set target types\n if (config.data_type) {\n $$.setTargetType($$.mapToIds(targets).filter((id) => { return !(id in config.data_types); }), config.data_type);\n }\n\n // cache as original id keyed\n targets.forEach((d) => {\n $$.addCache(d.id_org, d);\n });\n\n return targets;\n};\n\nexport {\n convertUrlToData,\n convertXsvToData,\n convertCsvToData,\n convertTsvToData,\n convertJsonToData,\n findValueInJson,\n convertRowsToData,\n convertColumnsToData,\n convertDataToTargets,\n};\n","import {\n notEmpty,\n hasValue,\n isValue,\n isFunction,\n} from './util';\n\nimport { CLASS } from './class';\n\nconst isX = function (key) {\n let $$ = this, config = $$.config;\n return (config.data_x && key === config.data_x) || (notEmpty(config.data_xs) && hasValue(config.data_xs, key));\n};\nconst isNotX = function (key) {\n return !this.isX(key);\n};\nconst getXKey = function (id) {\n let $$ = this, config = $$.config;\n return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null;\n};\nconst getXValuesOfXKey = function (key, targets) {\n let $$ = this,\n xValues, ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : [];\n ids.forEach((id) => {\n if ($$.getXKey(id) === key) {\n xValues = $$.data.xs[id];\n }\n });\n return xValues;\n};\nconst getIndexByX = function (x) {\n let $$ = this,\n data = $$.filterByX($$.data.targets, x);\n return data.length ? data[0].index : null;\n};\nconst getXValue = function (id, i) {\n const $$ = this;\n return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i;\n};\nconst getOtherTargetXs = function () {\n let $$ = this,\n idsForX = Object.keys($$.data.xs);\n return idsForX.length ? $$.data.xs[idsForX[0]] : null;\n};\nconst getOtherTargetX = function (index) {\n const xs = this.getOtherTargetXs();\n return xs && index < xs.length ? xs[index] : null;\n};\nconst addXs = function (xs) {\n const $$ = this;\n Object.keys(xs).forEach((id) => {\n $$.config.data_xs[id] = xs[id];\n });\n};\nconst hasMultipleX = function (xs) {\n return this.d3.set(Object.keys(xs).map((id) => { return xs[id]; })).size() > 1;\n};\nconst isMultipleX = function () {\n return notEmpty(this.config.data_xs) || !this.config.data_xSort || this.hasType('scatter');\n};\nconst addName = function (data) {\n let $$ = this, name;\n if (data) {\n name = $$.config.data_names[data.id];\n data.name = name !== undefined ? name : data.id;\n }\n return data;\n};\nconst getValueOnIndex = function (values, index) {\n const valueOnIndex = values.filter((v) => { return v.index === index; });\n return valueOnIndex.length ? valueOnIndex[0] : null;\n};\nconst updateTargetX = function (targets, x) {\n const $$ = this;\n targets.forEach((t) => {\n t.values.forEach((v, i) => {\n v.x = $$.generateTargetX(x[i], t.id, i);\n });\n $$.data.xs[t.id] = x;\n });\n};\nconst updateTargetXs = function (targets, xs) {\n const $$ = this;\n targets.forEach((t) => {\n if (xs[t.id]) {\n $$.updateTargetX([t], xs[t.id]);\n }\n });\n};\nconst generateTargetX = function (rawX, id, index) {\n let $$ = this, x;\n if ($$.isTimeSeries()) {\n x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index));\n }\n else if ($$.isCustomX() && !$$.isCategorized()) {\n x = isValue(rawX) ? +rawX : $$.getXValue(id, index);\n }\n else {\n x = index;\n }\n return x;\n};\nconst cloneTarget = function (target) {\n return {\n id: target.id,\n id_org: target.id_org,\n values: target.values.map((d) => {\n return { x: d.x, value: d.value, id: d.id };\n }),\n };\n};\nconst updateXs = function () {\n const $$ = this;\n if ($$.data.targets.length) {\n $$.xs = [];\n $$.data.targets[0].values.forEach((v) => {\n $$.xs[v.index] = v.x;\n });\n }\n};\nconst getPrevX = function (i) {\n const x = this.xs[i - 1];\n return typeof x !== 'undefined' ? x : null;\n};\nconst getNextX = function (i) {\n const x = this.xs[i + 1];\n return typeof x !== 'undefined' ? x : null;\n};\nconst getMaxDataCount = function () {\n const $$ = this;\n return $$.d3.max($$.data.targets, (t) => { return t.values.length; });\n};\nconst getMaxDataCountTarget = function (targets) {\n let length = targets.length, max = 0, maxTarget;\n if (length > 1) {\n targets.forEach((t) => {\n if (t.values.length > max) {\n maxTarget = t;\n max = t.values.length;\n }\n });\n } else {\n maxTarget = length ? targets[0] : null;\n }\n return maxTarget;\n};\nconst getEdgeX = function (targets) {\n const $$ = this;\n return !targets.length ? [0, 0] : [\n $$.d3.min(targets, (t) => { return t.values[0].x; }),\n $$.d3.max(targets, (t) => { return t.values[t.values.length - 1].x; }),\n ];\n};\nconst mapToIds = function (targets) {\n return targets.map((d) => { return d.id; });\n};\nconst mapToTargetIds = function (ids) {\n const $$ = this;\n return ids ? [].concat(ids) : $$.mapToIds($$.data.targets);\n};\nconst hasTarget = function (targets, id) {\n let ids = this.mapToIds(targets), i;\n for (i = 0; i < ids.length; i++) {\n if (ids[i] === id) {\n return true;\n }\n }\n return false;\n};\nconst isTargetToShow = function (targetId) {\n return this.hiddenTargetIds.indexOf(targetId) < 0;\n};\nconst isLegendToShow = function (targetId) {\n return this.hiddenLegendIds.indexOf(targetId) < 0;\n};\nconst filterTargetsToShow = function (targets) {\n const $$ = this;\n return targets.filter((t) => { return $$.isTargetToShow(t.id); });\n};\nconst mapTargetsToUniqueXs = function (targets) {\n const $$ = this;\n let xs = $$.d3.set($$.d3.merge(targets.map((t) => { return t.values.map((v) => { return +v.x; }); }))).values();\n xs = $$.isTimeSeries() ? xs.map((x) => { return new Date(+x); }) : xs.map((x) => { return +x; });\n return xs.sort((a, b) => { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; });\n};\nconst addHiddenTargetIds = function (targetIds) {\n this.hiddenTargetIds = this.hiddenTargetIds.concat(targetIds);\n};\nconst removeHiddenTargetIds = function (targetIds) {\n this.hiddenTargetIds = this.hiddenTargetIds.filter((id) => { return targetIds.indexOf(id) < 0; });\n};\nconst addHiddenLegendIds = function (targetIds) {\n this.hiddenLegendIds = this.hiddenLegendIds.concat(targetIds);\n};\nconst removeHiddenLegendIds = function (targetIds) {\n this.hiddenLegendIds = this.hiddenLegendIds.filter((id) => { return targetIds.indexOf(id) < 0; });\n};\nconst getValuesAsIdKeyed = function (targets) {\n const ys = {};\n targets.forEach((t) => {\n ys[t.id] = [];\n t.values.forEach((v) => {\n ys[t.id].push(v.value);\n });\n });\n return ys;\n};\nconst checkValueInTargets = function (targets, checker) {\n let ids = Object.keys(targets), i, j, values;\n for (i = 0; i < ids.length; i++) {\n values = targets[ids[i]].values;\n for (j = 0; j < values.length; j++) {\n if (checker(values[j].value)) {\n return true;\n }\n }\n }\n return false;\n};\nconst hasNegativeValueInTargets = function (targets) {\n return this.checkValueInTargets(targets, (v) => { return v < 0; });\n};\nconst hasPositiveValueInTargets = function (targets) {\n return this.checkValueInTargets(targets, (v) => { return v > 0; });\n};\nconst isOrderDesc = function () {\n const config = this.config;\n return typeof (config.data_order) === 'string' && config.data_order.toLowerCase() === 'desc';\n};\nconst isOrderAsc = function () {\n const config = this.config;\n return typeof (config.data_order) === 'string' && config.data_order.toLowerCase() === 'asc';\n};\nconst orderTargets = function (targets) {\n let $$ = this, config = $$.config, orderAsc = $$.isOrderAsc(), orderDesc = $$.isOrderDesc();\n if (orderAsc || orderDesc) {\n targets.sort((t1, t2) => {\n const reducer = function (p, c) { return p + Math.abs(c.value); };\n let t1Sum = t1.values.reduce(reducer, 0),\n t2Sum = t2.values.reduce(reducer, 0);\n return orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;\n });\n } else if (isFunction(config.data_order)) {\n targets.sort(config.data_order);\n } // TODO: accept name array for order\n return targets;\n};\nconst filterByX = function (targets, x) {\n return this.d3.merge(targets.map((t) => { return t.values; })).filter((v) => { return v.x - x === 0; });\n};\nconst filterRemoveNull = function (data) {\n return data.filter((d) => { return isValue(d.value); });\n};\nconst filterByXDomain = function (targets, xDomain) {\n return targets.map((t) => {\n return {\n id: t.id,\n id_org: t.id_org,\n values: t.values.filter((v) => {\n return xDomain[0] <= v.x && v.x <= xDomain[1];\n }),\n };\n });\n};\nconst hasDataLabel = function () {\n const config = this.config;\n if (typeof config.data_labels === 'boolean' && config.data_labels) {\n return true;\n } else if (typeof config.data_labels === 'object' && notEmpty(config.data_labels)) {\n return true;\n }\n return false;\n};\nconst getDataLabelLength = function (min, max, key) {\n let $$ = this,\n lengths = [0, 0], paddingCoef = 1.3;\n $$.selectChart.select('svg').selectAll('.dummy')\n .data([min, max])\n .enter().append('text')\n .text((d) => { return $$.dataLabelFormat(d.id)(d); })\n .each(function (d, i) {\n lengths[i] = this.getBoundingClientRect()[key] * paddingCoef;\n })\n .remove();\n return lengths;\n};\nconst isNoneArc = function (d) {\n return this.hasTarget(this.data.targets, d.id);\n};\nconst isArc = function (d) {\n return 'data' in d && this.hasTarget(this.data.targets, d.data.id);\n};\nconst findSameXOfValues = function (values, index) {\n let i, targetX = values[index].x, sames = [];\n for (i = index - 1; i >= 0; i--) {\n if (targetX !== values[i].x) { break; }\n sames.push(values[i]);\n }\n for (i = index; i < values.length; i++) {\n if (targetX !== values[i].x) { break; }\n sames.push(values[i]);\n }\n return sames;\n};\n\nconst findClosestFromTargets = function (targets, pos) {\n let $$ = this, candidates;\n\n // map to array of closest points of each target\n candidates = targets.map((target) => {\n return $$.findClosest(target.values, pos);\n });\n\n // decide closest point and return\n return $$.findClosest(candidates, pos);\n};\nconst findClosest = function (values, pos) {\n let $$ = this, minDist = $$.config.point_sensitivity, closest;\n\n // find mouseovering bar\n values.filter((v) => { return v && $$.isBarType(v.id); }).forEach((v) => {\n const shape = $$.main.select('.' + CLASS.bars + $$.getTargetSelectorSuffix(v.id) + ' .' + CLASS.bar + '-' + v.index).node();\n if (!closest && $$.isWithinBar(shape)) {\n closest = v;\n }\n });\n\n // find closest point from non-bar\n values.filter((v) => { return v && !$$.isBarType(v.id); }).forEach((v) => {\n const d = $$.dist(v, pos);\n if (d < minDist) {\n minDist = d;\n closest = v;\n }\n });\n\n return closest;\n};\nconst dist = function (data, pos) {\n let $$ = this, config = $$.config,\n xIndex = config.axis_rotated ? 1 : 0,\n yIndex = config.axis_rotated ? 0 : 1,\n y = $$.circleY(data, data.index),\n x = $$.x(data.x);\n return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2));\n};\nconst convertValuesToStep = function (values) {\n let converted = [].concat(values), i;\n\n if (!this.isCategorized()) {\n return values;\n }\n\n for (i = values.length + 1; 0 < i; i--) {\n converted[i] = converted[i - 1];\n }\n\n converted[0] = {\n x: converted[0].x - 1,\n value: converted[0].value,\n id: converted[0].id,\n };\n converted[values.length + 1] = {\n x: converted[values.length].x + 1,\n value: converted[values.length].value,\n id: converted[values.length].id,\n };\n\n return converted;\n};\nconst updateDataAttributes = function (name, attrs) {\n let $$ = this, config = $$.config, current = config['data_' + name];\n if (typeof attrs === 'undefined') { return current; }\n Object.keys(attrs).forEach((id) => {\n current[id] = attrs[id];\n });\n $$.redraw({ withLegend: true });\n return current;\n};\n\nexport {\n isX,\n isNotX,\n getXKey,\n getXValuesOfXKey,\n getIndexByX,\n getXValue,\n getOtherTargetXs,\n getOtherTargetX,\n addXs,\n hasMultipleX,\n isMultipleX,\n addName,\n getValueOnIndex,\n updateTargetX,\n updateTargetXs,\n generateTargetX,\n cloneTarget,\n updateXs,\n getPrevX,\n getNextX,\n getMaxDataCount,\n getMaxDataCountTarget,\n getEdgeX,\n mapToIds,\n mapToTargetIds,\n hasTarget,\n isTargetToShow,\n isLegendToShow,\n filterTargetsToShow,\n mapTargetsToUniqueXs,\n addHiddenTargetIds,\n removeHiddenTargetIds,\n addHiddenLegendIds,\n removeHiddenLegendIds,\n getValuesAsIdKeyed,\n checkValueInTargets,\n hasNegativeValueInTargets,\n hasPositiveValueInTargets,\n isOrderDesc,\n isOrderAsc,\n orderTargets,\n filterByX,\n filterRemoveNull,\n filterByXDomain,\n hasDataLabel,\n getDataLabelLength,\n isNoneArc,\n isArc,\n findSameXOfValues,\n findClosestFromTargets,\n findClosest,\n dist,\n convertValuesToStep,\n updateDataAttributes,\n};\n","import { CLASS } from './class';\n\nconst load = function (targets, args) {\n const $$ = this;\n if (targets) {\n // filter loading targets if needed\n if (args.filter) {\n targets = targets.filter(args.filter);\n }\n // set type if args.types || args.type specified\n if (args.type || args.types) {\n targets.forEach((t) => {\n const type = args.types && args.types[t.id] ? args.types[t.id] : args.type;\n $$.setTargetType(t.id, type);\n });\n }\n // Update/Add data\n $$.data.targets.forEach((d) => {\n for (let i = 0; i < targets.length; i++) {\n if (d.id === targets[i].id) {\n d.values = targets[i].values;\n targets.splice(i, 1);\n break;\n }\n }\n });\n $$.data.targets = $$.data.targets.concat(targets); // add remained\n }\n\n // Set targets\n $$.updateTargets($$.data.targets);\n\n // Redraw with new targets\n $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true });\n\n if (args.done) { args.done(); }\n};\nconst loadFromArgs = function (args) {\n const $$ = this;\n if (args.data) {\n $$.load($$.convertDataToTargets(args.data), args);\n }\n else if (args.url) {\n $$.convertUrlToData(args.url, args.mimeType, args.headers, args.keys, (data) => {\n $$.load($$.convertDataToTargets(data), args);\n });\n }\n else if (args.json) {\n $$.load($$.convertDataToTargets($$.convertJsonToData(args.json, args.keys)), args);\n }\n else if (args.rows) {\n $$.load($$.convertDataToTargets($$.convertRowsToData(args.rows)), args);\n }\n else if (args.columns) {\n $$.load($$.convertDataToTargets($$.convertColumnsToData(args.columns)), args);\n }\n else {\n $$.load(null, args);\n }\n};\nconst unload = function (targetIds, done) {\n const $$ = this;\n if (!done) {\n done = function () {};\n }\n // filter existing target\n targetIds = targetIds.filter((id) => { return $$.hasTarget($$.data.targets, id); });\n // If no target, call done and return\n if (!targetIds || targetIds.length === 0) {\n done();\n return;\n }\n $$.svg.selectAll(targetIds.map((id) => { return $$.selectorTarget(id); }))\n .transition()\n .style('opacity', 0)\n .remove()\n .call($$.endall, done);\n targetIds.forEach((id) => {\n // Reset fadein for future load\n $$.withoutFadeIn[id] = false;\n // Remove target's elements\n if ($$.legend) {\n $$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove();\n }\n // Remove target\n $$.data.targets = $$.data.targets.filter((t) => {\n return t.id !== id;\n });\n });\n};\n\nexport {\n load,\n loadFromArgs,\n unload,\n};\n","import {\n isValue,\n diffDomain,\n notEmpty,\n isDefined,\n} from './util';\n\nconst getYDomainMin = function (targets) {\n let $$ = this, config = $$.config,\n ids = $$.mapToIds(targets), ys = $$.getValuesAsIdKeyed(targets),\n j, k, baseId, idsInGroup, id, hasNegativeValue;\n if (config.data_groups.length > 0) {\n hasNegativeValue = $$.hasNegativeValueInTargets(targets);\n for (j = 0; j < config.data_groups.length; j++) {\n // Determine baseId\n idsInGroup = config.data_groups[j].filter((id) => { return ids.indexOf(id) >= 0; });\n if (idsInGroup.length === 0) { continue; }\n baseId = idsInGroup[0];\n // Consider negative values\n if (hasNegativeValue && ys[baseId]) {\n ys[baseId].forEach((v, i) => {\n ys[baseId][i] = v < 0 ? v : 0;\n });\n }\n // Compute min\n for (k = 1; k < idsInGroup.length; k++) {\n id = idsInGroup[k];\n if (!ys[id]) { continue; }\n ys[id].forEach((v, i) => {\n if ($$.axis.getId(id) === $$.axis.getId(baseId) && ys[baseId] && !(hasNegativeValue && +v > 0)) {\n ys[baseId][i] += +v;\n }\n });\n }\n }\n }\n return $$.d3.min(Object.keys(ys).map((key) => { return $$.d3.min(ys[key]); }));\n};\nconst getYDomainMax = function (targets) {\n let $$ = this, config = $$.config,\n ids = $$.mapToIds(targets), ys = $$.getValuesAsIdKeyed(targets),\n j, k, baseId, idsInGroup, id, hasPositiveValue;\n if (config.data_groups.length > 0) {\n hasPositiveValue = $$.hasPositiveValueInTargets(targets);\n for (j = 0; j < config.data_groups.length; j++) {\n // Determine baseId\n idsInGroup = config.data_groups[j].filter((id) => { return ids.indexOf(id) >= 0; });\n if (idsInGroup.length === 0) { continue; }\n baseId = idsInGroup[0];\n // Consider positive values\n if (hasPositiveValue && ys[baseId]) {\n ys[baseId].forEach((v, i) => {\n ys[baseId][i] = v > 0 ? v : 0;\n });\n }\n // Compute max\n for (k = 1; k < idsInGroup.length; k++) {\n id = idsInGroup[k];\n if (!ys[id]) { continue; }\n ys[id].forEach((v, i) => {\n if ($$.axis.getId(id) === $$.axis.getId(baseId) && ys[baseId] && !(hasPositiveValue && +v < 0)) {\n ys[baseId][i] += +v;\n }\n });\n }\n }\n }\n return $$.d3.max(Object.keys(ys).map((key) => { return $$.d3.max(ys[key]); }));\n};\nconst getYDomain = function (targets, axisId, xDomain) {\n let $$ = this, config = $$.config,\n targetsByAxisId = targets.filter((t) => { return $$.axis.getId(t.id) === axisId; }),\n yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId,\n yMin = axisId === 'y2' ? config.axis_y2_min : config.axis_y_min,\n yMax = axisId === 'y2' ? config.axis_y2_max : config.axis_y_max,\n yDomainMin = $$.getYDomainMin(yTargets),\n yDomainMax = $$.getYDomainMax(yTargets),\n domain, domainLength, padding, padding_top, padding_bottom,\n center = axisId === 'y2' ? config.axis_y2_center : config.axis_y_center,\n yDomainAbs, lengths, diff, ratio, isAllPositive, isAllNegative,\n isZeroBased = ($$.hasType('bar', yTargets) && config.bar_zerobased) || ($$.hasType('area', yTargets) && config.area_zerobased),\n isInverted = axisId === 'y2' ? config.axis_y2_inverted : config.axis_y_inverted,\n showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated,\n showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated;\n\n // MEMO: avoid inverting domain unexpectedly\n yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? (yDomainMin < yMax ? yDomainMin : yMax - 10) : yDomainMin;\n yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? (yMin < yDomainMax ? yDomainMax : yMin + 10) : yDomainMax;\n\n if (yTargets.length === 0) { // use current domain if target of axisId is none\n return axisId === 'y2' ? $$.y2.domain() : $$.y.domain();\n }\n if (isNaN(yDomainMin)) { // set minimum to zero when not number\n yDomainMin = 0;\n }\n if (isNaN(yDomainMax)) { // set maximum to have same value as yDomainMin\n yDomainMax = yDomainMin;\n }\n if (yDomainMin === yDomainMax) {\n yDomainMin < 0 ? yDomainMax = 0 : yDomainMin = 0;\n }\n isAllPositive = yDomainMin >= 0 && yDomainMax >= 0;\n isAllNegative = yDomainMin <= 0 && yDomainMax <= 0;\n\n // Cancel zerobased if axis_*_min / axis_*_max specified\n if ((isValue(yMin) && isAllPositive) || (isValue(yMax) && isAllNegative)) {\n isZeroBased = false;\n }\n\n // Bar/Area chart should be 0-based if all positive|negative\n if (isZeroBased) {\n if (isAllPositive) { yDomainMin = 0; }\n if (isAllNegative) { yDomainMax = 0; }\n }\n\n domainLength = Math.abs(yDomainMax - yDomainMin);\n padding = padding_top = padding_bottom = domainLength * 0.1;\n\n if (typeof center !== 'undefined') {\n yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax));\n yDomainMax = center + yDomainAbs;\n yDomainMin = center - yDomainAbs;\n }\n // add padding for data label\n if (showHorizontalDataLabel) {\n lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, 'width');\n diff = diffDomain($$.y.range());\n ratio = [lengths[0] / diff, lengths[1] / diff];\n padding_top += domainLength * (ratio[1] / (1 - ratio[0] - ratio[1]));\n padding_bottom += domainLength * (ratio[0] / (1 - ratio[0] - ratio[1]));\n } else if (showVerticalDataLabel) {\n lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, 'height');\n padding_top += $$.axis.convertPixelsToAxisPadding(lengths[1], domainLength);\n padding_bottom += $$.axis.convertPixelsToAxisPadding(lengths[0], domainLength);\n }\n if (axisId === 'y' && notEmpty(config.axis_y_padding)) {\n padding_top = $$.axis.getPadding(config.axis_y_padding, 'top', padding_top, domainLength);\n padding_bottom = $$.axis.getPadding(config.axis_y_padding, 'bottom', padding_bottom, domainLength);\n }\n if (axisId === 'y2' && notEmpty(config.axis_y2_padding)) {\n padding_top = $$.axis.getPadding(config.axis_y2_padding, 'top', padding_top, domainLength);\n padding_bottom = $$.axis.getPadding(config.axis_y2_padding, 'bottom', padding_bottom, domainLength);\n }\n // Bar/Area chart should be 0-based if all positive|negative\n if (isZeroBased) {\n if (isAllPositive) { padding_bottom = yDomainMin; }\n if (isAllNegative) { padding_top = -yDomainMax; }\n }\n domain = [yDomainMin - padding_bottom, yDomainMax + padding_top];\n return isInverted ? domain.reverse() : domain;\n};\nconst getXDomainMin = function (targets) {\n let $$ = this, config = $$.config;\n return isDefined(config.axis_x_min) ?\n ($$.isTimeSeries() ? this.parseDate(config.axis_x_min) : config.axis_x_min) :\n $$.d3.min(targets, (t) => { return $$.d3.min(t.values, (v) => { return v.x; }); });\n};\nconst getXDomainMax = function (targets) {\n let $$ = this, config = $$.config;\n return isDefined(config.axis_x_max) ?\n ($$.isTimeSeries() ? this.parseDate(config.axis_x_max) : config.axis_x_max) :\n $$.d3.max(targets, (t) => { return $$.d3.max(t.values, (v) => { return v.x; }); });\n};\nconst getXDomainPadding = function (domain) {\n let $$ = this, config = $$.config,\n diff = domain[1] - domain[0],\n maxDataCount, padding, paddingLeft, paddingRight;\n if ($$.isCategorized()) {\n padding = 0;\n } else if ($$.hasType('bar')) {\n maxDataCount = $$.getMaxDataCount();\n padding = maxDataCount > 1 ? (diff / (maxDataCount - 1)) / 2 : 0.5;\n } else {\n padding = diff * 0.01;\n }\n if (typeof config.axis_x_padding === 'object' && notEmpty(config.axis_x_padding)) {\n paddingLeft = isValue(config.axis_x_padding.left) ? config.axis_x_padding.left : padding;\n paddingRight = isValue(config.axis_x_padding.right) ? config.axis_x_padding.right : padding;\n } else if (typeof config.axis_x_padding === 'number') {\n paddingLeft = paddingRight = config.axis_x_padding;\n } else {\n paddingLeft = paddingRight = padding;\n }\n return { left: paddingLeft, right: paddingRight };\n};\nconst getXDomain = function (targets) {\n let $$ = this,\n xDomain = [$$.getXDomainMin(targets), $$.getXDomainMax(targets)],\n firstX = xDomain[0], lastX = xDomain[1],\n padding = $$.getXDomainPadding(xDomain),\n min = 0, max = 0;\n // show center of x domain if min and max are the same\n if ((firstX - lastX) === 0 && !$$.isCategorized()) {\n if ($$.isTimeSeries()) {\n firstX = new Date(firstX.getTime() * 0.5);\n lastX = new Date(lastX.getTime() * 1.5);\n } else {\n firstX = firstX === 0 ? 1 : (firstX * 0.5);\n lastX = lastX === 0 ? -1 : (lastX * 1.5);\n }\n }\n if (firstX || firstX === 0) {\n min = $$.isTimeSeries() ? new Date(firstX.getTime() - padding.left) : firstX - padding.left;\n }\n if (lastX || lastX === 0) {\n max = $$.isTimeSeries() ? new Date(lastX.getTime() + padding.right) : lastX + padding.right;\n }\n return [min, max];\n};\nconst updateXDomain = function (targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {\n let $$ = this, config = $$.config;\n\n if (withUpdateOrgXDomain) {\n $$.x.domain(domain ? domain : $$.d3.extent($$.getXDomain(targets)));\n $$.orgXDomain = $$.x.domain();\n if (config.zoom_enabled) { $$.zoom.scale($$.x).updateScaleExtent(); }\n $$.subX.domain($$.x.domain());\n if ($$.brush) { $$.brush.scale($$.subX); }\n }\n if (withUpdateXDomain) {\n $$.x.domain(domain ? domain : (!$$.brush || $$.brush.empty()) ? $$.orgXDomain : $$.brush.extent());\n if (config.zoom_enabled) { $$.zoom.scale($$.x).updateScaleExtent(); }\n }\n\n // Trim domain when too big by zoom mousemove event\n if (withTrim) { $$.x.domain($$.trimXDomain($$.x.orgDomain())); }\n\n return $$.x.domain();\n};\nconst trimXDomain = function (domain) {\n let zoomDomain = this.getZoomDomain(),\n min = zoomDomain[0], max = zoomDomain[1];\n if (domain[0] <= min) {\n domain[1] = +domain[1] + (min - domain[0]);\n domain[0] = min;\n }\n if (max <= domain[1]) {\n domain[0] = +domain[0] - (domain[1] - max);\n domain[1] = max;\n }\n return domain;\n};\n\nexport {\n getYDomainMin,\n getYDomainMax,\n getYDomain,\n getXDomainMin,\n getXDomainMax,\n getXDomainPadding,\n getXDomain,\n updateXDomain,\n trimXDomain,\n};\n","import { CLASS } from './class';\nimport { getPathBox } from './util';\n\nconst drag = function (mouse) {\n let $$ = this, config = $$.config, main = $$.main, d3 = $$.d3;\n let sx, sy, mx, my, minX, maxX, minY, maxY;\n\n if ($$.hasArcType()) { return; }\n if (!config.data_selection_enabled) { return; } // do nothing if not selectable\n if (config.zoom_enabled && !$$.zoom.altDomain) { return; } // skip if zoomable because of conflict drag dehavior\n if (!config.data_selection_multiple) { return; } // skip when single selection because drag is used for multiple selection\n\n sx = $$.dragStart[0];\n sy = $$.dragStart[1];\n mx = mouse[0];\n my = mouse[1];\n minX = Math.min(sx, mx);\n maxX = Math.max(sx, mx);\n minY = (config.data_selection_grouped) ? $$.margin.top : Math.min(sy, my);\n maxY = (config.data_selection_grouped) ? $$.height : Math.max(sy, my);\n\n main.select('.' + CLASS.dragarea)\n .attr('x', minX)\n .attr('y', minY)\n .attr('width', maxX - minX)\n .attr('height', maxY - minY);\n // TODO: binary search when multiple xs\n main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape)\n .filter((d) => { return config.data_selection_isselectable(d); })\n .each(function (d, i) {\n let shape = d3.select(this),\n isSelected = shape.classed(CLASS.SELECTED),\n isIncluded = shape.classed(CLASS.INCLUDED),\n _x, _y, _w, _h, toggle, isWithin = false, box;\n if (shape.classed(CLASS.circle)) {\n _x = shape.attr('cx') * 1;\n _y = shape.attr('cy') * 1;\n toggle = $$.togglePoint;\n isWithin = minX < _x && _x < maxX && minY < _y && _y < maxY;\n }\n else if (shape.classed(CLASS.bar)) {\n box = getPathBox(this);\n _x = box.x;\n _y = box.y;\n _w = box.width;\n _h = box.height;\n toggle = $$.togglePath;\n isWithin = !(maxX < _x || _x + _w < minX) && !(maxY < _y || _y + _h < minY);\n } else {\n // line/area selection not supported yet\n return;\n }\n if (isWithin ^ isIncluded) {\n shape.classed(CLASS.INCLUDED, !isIncluded);\n // TODO: included/unincluded callback here\n shape.classed(CLASS.SELECTED, !isSelected);\n toggle.call($$, !isSelected, shape, d, i);\n }\n });\n};\n\nconst dragstart = function (mouse) {\n let $$ = this, config = $$.config;\n if ($$.hasArcType()) { return; }\n if (!config.data_selection_enabled) { return; } // do nothing if not selectable\n $$.dragStart = mouse;\n $$.main.select('.' + CLASS.chart).append('rect')\n .attr('class', CLASS.dragarea)\n .style('opacity', 0.1);\n $$.dragging = true;\n};\n\nconst dragend = function () {\n let $$ = this, config = $$.config;\n if ($$.hasArcType()) { return; }\n if (!config.data_selection_enabled) { return; } // do nothing if not selectable\n $$.main.select('.' + CLASS.dragarea)\n .transition().duration(100)\n .style('opacity', 0)\n .remove();\n $$.main.selectAll('.' + CLASS.shape)\n .classed(CLASS.INCLUDED, false);\n $$.dragging = false;\n};\n\nexport {\n drag,\n dragstart,\n dragend,\n};\n","import {\n diffDomain,\n} from './util';\n\nimport { CLASS } from './class';\n\nconst generateFlow = function (args) {\n let $$ = this,\n config = $$.config,\n d3 = $$.d3;\n\n return function () {\n let targets = args.targets,\n flow = args.flow,\n drawBar = args.drawBar,\n drawLine = args.drawLine,\n drawArea = args.drawArea,\n cx = args.cx,\n cy = args.cy,\n xv = args.xv,\n xForText = args.xForText,\n yForText = args.yForText,\n duration = args.duration;\n\n let translateX, scaleX = 1,\n transform,\n flowIndex = flow.index,\n flowLength = flow.length,\n flowStart = $$.getValueOnIndex($$.data.targets[0].values, flowIndex),\n flowEnd = $$.getValueOnIndex($$.data.targets[0].values, flowIndex + flowLength),\n orgDomain = $$.x.domain(),\n domain,\n durationForFlow = flow.duration || duration,\n done = flow.done || function () {},\n wait = $$.generateWait();\n\n let xgrid = $$.xgrid || d3.selectAll([]),\n xgridLines = $$.xgridLines || d3.selectAll([]),\n mainRegion = $$.mainRegion || d3.selectAll([]),\n mainText = $$.mainText || d3.selectAll([]),\n mainBar = $$.mainBar || d3.selectAll([]),\n mainLine = $$.mainLine || d3.selectAll([]),\n mainArea = $$.mainArea || d3.selectAll([]),\n mainCircle = $$.mainCircle || d3.selectAll([]);\n\n // set flag\n $$.flowing = true;\n\n // remove head data after rendered\n $$.data.targets.forEach((d) => {\n d.values.splice(0, flowLength);\n });\n\n // update x domain to generate axis elements for flow\n domain = $$.updateXDomain(targets, true, true);\n // update elements related to x scale\n if ($$.updateXGrid) { $$.updateXGrid(true); }\n\n // generate transform to flow\n if (!flow.orgDataCount) { // if empty\n if ($$.data.targets[0].values.length !== 1) {\n translateX = $$.x(orgDomain[0]) - $$.x(domain[0]);\n } else {\n if ($$.isTimeSeries()) {\n flowStart = $$.getValueOnIndex($$.data.targets[0].values, 0);\n flowEnd = $$.getValueOnIndex($$.data.targets[0].values, $$.data.targets[0].values.length - 1);\n translateX = $$.x(flowStart.x) - $$.x(flowEnd.x);\n } else {\n translateX = diffDomain(domain) / 2;\n }\n }\n } else if (flow.orgDataCount === 1 || (flowStart && flowStart.x) === (flowEnd && flowEnd.x)) {\n translateX = $$.x(orgDomain[0]) - $$.x(domain[0]);\n } else {\n if ($$.isTimeSeries()) {\n translateX = ($$.x(orgDomain[0]) - $$.x(domain[0]));\n } else {\n translateX = ($$.x(flowStart.x) - $$.x(flowEnd.x));\n }\n }\n scaleX = (diffDomain(orgDomain) / diffDomain(domain));\n transform = 'translate(' + translateX + ',0) scale(' + scaleX + ',1)';\n\n $$.hideXGridFocus();\n\n d3.transition().ease('linear').duration(durationForFlow).each(() => {\n wait.add($$.axes.x.transition().call($$.xAxis));\n wait.add(mainBar.transition().attr('transform', transform));\n wait.add(mainLine.transition().attr('transform', transform));\n wait.add(mainArea.transition().attr('transform', transform));\n wait.add(mainCircle.transition().attr('transform', transform));\n wait.add(mainText.transition().attr('transform', transform));\n wait.add(mainRegion.filter($$.isRegionOnX).transition().attr('transform', transform));\n wait.add(xgrid.transition().attr('transform', transform));\n wait.add(xgridLines.transition().attr('transform', transform));\n })\n .call(wait, () => {\n let i, shapes = [],\n texts = [],\n eventRects = [];\n\n // remove flowed elements\n if (flowLength) {\n for (i = 0; i < flowLength; i++) {\n shapes.push('.' + CLASS.shape + '-' + (flowIndex + i));\n texts.push('.' + CLASS.text + '-' + (flowIndex + i));\n eventRects.push('.' + CLASS.eventRect + '-' + (flowIndex + i));\n }\n $$.svg.selectAll('.' + CLASS.shapes).selectAll(shapes).remove();\n $$.svg.selectAll('.' + CLASS.texts).selectAll(texts).remove();\n $$.svg.selectAll('.' + CLASS.eventRects).selectAll(eventRects).remove();\n $$.svg.select('.' + CLASS.xgrid).remove();\n }\n\n // draw again for removing flowed elements and reverting attr\n xgrid\n .attr('transform', null)\n .attr($$.xgridAttr);\n xgridLines\n .attr('transform', null);\n xgridLines.select('line')\n .attr('x1', config.axis_rotated ? 0 : xv)\n .attr('x2', config.axis_rotated ? $$.width : xv);\n xgridLines.select('text')\n .attr('x', config.axis_rotated ? $$.width : 0)\n .attr('y', xv);\n mainBar\n .attr('transform', null)\n .attr('d', drawBar);\n mainLine\n .attr('transform', null)\n .attr('d', drawLine);\n mainArea\n .attr('transform', null)\n .attr('d', drawArea);\n mainCircle\n .attr('transform', null)\n .attr('cx', cx)\n .attr('cy', cy);\n mainText\n .attr('transform', null)\n .attr('x', xForText)\n .attr('y', yForText)\n .style('fill-opacity', $$.opacityForText.bind($$));\n mainRegion\n .attr('transform', null);\n mainRegion.select('rect').filter($$.isRegionOnX)\n .attr('x', $$.regionX.bind($$))\n .attr('width', $$.regionWidth.bind($$));\n\n if (config.interaction_enabled) {\n $$.redrawEventRect();\n }\n\n // callback for end of flow\n done();\n\n $$.flowing = false;\n });\n };\n};\n\nexport { generateFlow };\n","import { isValue } from './util';\n\nconst getYFormat = function (forArc) {\n let $$ = this,\n formatForY = forArc && !$$.hasType('gauge') ? $$.defaultArcValueFormat : $$.yFormat,\n formatForY2 = forArc && !$$.hasType('gauge') ? $$.defaultArcValueFormat : $$.y2Format;\n return function (v, ratio, id) {\n const format = $$.axis.getId(id) === 'y2' ? formatForY2 : formatForY;\n return format.call($$, v, ratio);\n };\n};\nconst yFormat = function (v) {\n let $$ = this, config = $$.config,\n format = config.axis_y_tick_format ? config.axis_y_tick_format : $$.defaultValueFormat;\n return format(v);\n};\nconst y2Format = function (v) {\n let $$ = this, config = $$.config,\n format = config.axis_y2_tick_format ? config.axis_y2_tick_format : $$.defaultValueFormat;\n return format(v);\n};\nconst defaultValueFormat = function (v) {\n return isValue(v) ? +v : '';\n};\nconst defaultArcValueFormat = function (v, ratio) {\n return (ratio * 100).toFixed(1) + '%';\n};\nconst dataLabelFormat = function (targetId) {\n let $$ = this, data_labels = $$.config.data_labels,\n format, defaultFormat = function (v) { return isValue(v) ? +v : ''; };\n // find format according to axis id\n if (typeof data_labels.format === 'function') {\n format = data_labels.format;\n } else if (typeof data_labels.format === 'object') {\n if (data_labels.format[targetId]) {\n format = data_labels.format[targetId] === true ? defaultFormat : data_labels.format[targetId];\n } else {\n format = function () { return ''; };\n }\n } else {\n format = defaultFormat;\n }\n return format;\n};\n\nexport {\n getYFormat,\n yFormat,\n y2Format,\n defaultValueFormat,\n defaultArcValueFormat,\n dataLabelFormat,\n};\n","import { CLASS } from './class';\nimport { isValue } from './util';\n\nconst initGrid = function () {\n let $$ = this, config = $$.config, d3 = $$.d3;\n $$.grid = $$.main.append('g')\n .attr('clip-path', $$.clipPathForGrid)\n .attr('class', CLASS.grid);\n if (config.grid_x_show) {\n $$.grid.append('g').attr('class', CLASS.xgrids);\n }\n if (config.grid_y_show) {\n $$.grid.append('g').attr('class', CLASS.ygrids);\n }\n if (config.grid_focus_show) {\n $$.grid.append('g')\n .attr('class', CLASS.xgridFocus)\n .append('line')\n .attr('class', CLASS.xgridFocus);\n }\n $$.xgrid = d3.selectAll([]);\n if (!config.grid_lines_front) { $$.initGridLines(); }\n};\nconst initGridLines = function () {\n let $$ = this, d3 = $$.d3;\n $$.gridLines = $$.main.append('g')\n .attr('clip-path', $$.clipPathForGrid)\n .attr('class', CLASS.grid + ' ' + CLASS.gridLines);\n $$.gridLines.append('g').attr('class', CLASS.xgridLines);\n $$.gridLines.append('g').attr('class', CLASS.ygridLines);\n $$.xgridLines = d3.selectAll([]);\n};\nconst updateXGrid = function (withoutUpdate) {\n let $$ = this, config = $$.config, d3 = $$.d3,\n xgridData = $$.generateGridData(config.grid_x_type, $$.x),\n tickOffset = $$.isCategorized() ? $$.xAxis.tickOffset() : 0;\n\n $$.xgridAttr = config.axis_rotated ? {\n 'x1': 0,\n 'x2': $$.width,\n 'y1': function (d) { return $$.x(d) - tickOffset; },\n 'y2': function (d) { return $$.x(d) - tickOffset; },\n } : {\n 'x1': function (d) { return $$.x(d) + tickOffset; },\n 'x2': function (d) { return $$.x(d) + tickOffset; },\n 'y1': 0,\n 'y2': $$.height,\n };\n\n $$.xgrid = $$.main.select('.' + CLASS.xgrids).selectAll('.' + CLASS.xgrid)\n .data(xgridData);\n $$.xgrid.enter().append('line').attr('class', CLASS.xgrid);\n if (!withoutUpdate) {\n $$.xgrid.attr($$.xgridAttr)\n .style('opacity', function () { return +d3.select(this).attr(config.axis_rotated ? 'y1' : 'x1') === (config.axis_rotated ? $$.height : 0) ? 0 : 1; });\n }\n $$.xgrid.exit().remove();\n};\n\nconst updateYGrid = function () {\n let $$ = this, config = $$.config,\n gridValues = $$.yAxis.tickValues() || $$.y.ticks(config.grid_y_ticks);\n $$.ygrid = $$.main.select('.' + CLASS.ygrids).selectAll('.' + CLASS.ygrid)\n .data(gridValues);\n $$.ygrid.enter().append('line')\n .attr('class', CLASS.ygrid);\n $$.ygrid.attr('x1', config.axis_rotated ? $$.y : 0)\n .attr('x2', config.axis_rotated ? $$.y : $$.width)\n .attr('y1', config.axis_rotated ? 0 : $$.y)\n .attr('y2', config.axis_rotated ? $$.height : $$.y);\n $$.ygrid.exit().remove();\n $$.smoothLines($$.ygrid, 'grid');\n};\n\nconst gridTextAnchor = function (d) {\n return d.position ? d.position : 'end';\n};\nconst gridTextDx = function (d) {\n return d.position === 'start' ? 4 : d.position === 'middle' ? 0 : -4;\n};\nconst xGridTextX = function (d) {\n return d.position === 'start' ? -this.height : d.position === 'middle' ? -this.height / 2 : 0;\n};\nconst yGridTextX = function (d) {\n return d.position === 'start' ? 0 : d.position === 'middle' ? this.width / 2 : this.width;\n};\nconst updateGrid = function (duration) {\n let $$ = this, main = $$.main, config = $$.config,\n xgridLine, ygridLine, yv;\n\n // hide if arc type\n $$.grid.style('visibility', $$.hasArcType() ? 'hidden' : 'visible');\n\n main.select('line.' + CLASS.xgridFocus).style('visibility', 'hidden');\n if (config.grid_x_show) {\n $$.updateXGrid();\n }\n $$.xgridLines = main.select('.' + CLASS.xgridLines).selectAll('.' + CLASS.xgridLine)\n .data(config.grid_x_lines);\n // enter\n xgridLine = $$.xgridLines.enter().append('g')\n .attr('class', (d) => { return CLASS.xgridLine + (d.class ? ' ' + d.class : ''); });\n xgridLine.append('line')\n .style('opacity', 0);\n xgridLine.append('text')\n .attr('text-anchor', $$.gridTextAnchor)\n .attr('transform', config.axis_rotated ? '' : 'rotate(-90)')\n .attr('dx', $$.gridTextDx)\n .attr('dy', -5)\n .style('opacity', 0);\n // udpate\n // done in d3.transition() of the end of this function\n // exit\n $$.xgridLines.exit().transition().duration(duration)\n .style('opacity', 0)\n .remove();\n\n // Y-Grid\n if (config.grid_y_show) {\n $$.updateYGrid();\n }\n $$.ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine)\n .data(config.grid_y_lines);\n // enter\n ygridLine = $$.ygridLines.enter().append('g')\n .attr('class', (d) => { return CLASS.ygridLine + (d.class ? ' ' + d.class : ''); });\n ygridLine.append('line')\n .style('opacity', 0);\n ygridLine.append('text')\n .attr('text-anchor', $$.gridTextAnchor)\n .attr('transform', config.axis_rotated ? 'rotate(-90)' : '')\n .attr('dx', $$.gridTextDx)\n .attr('dy', -5)\n .style('opacity', 0);\n // update\n yv = $$.yv.bind($$);\n $$.ygridLines.select('line')\n .transition().duration(duration)\n .attr('x1', config.axis_rotated ? yv : 0)\n .attr('x2', config.axis_rotated ? yv : $$.width)\n .attr('y1', config.axis_rotated ? 0 : yv)\n .attr('y2', config.axis_rotated ? $$.height : yv)\n .style('opacity', 1);\n $$.ygridLines.select('text')\n .transition().duration(duration)\n .attr('x', config.axis_rotated ? $$.xGridTextX.bind($$) : $$.yGridTextX.bind($$))\n .attr('y', yv)\n .text((d) => { return d.text; })\n .style('opacity', 1);\n // exit\n $$.ygridLines.exit().transition().duration(duration)\n .style('opacity', 0)\n .remove();\n};\nconst redrawGrid = function (withTransition) {\n let $$ = this, config = $$.config, xv = $$.xv.bind($$),\n lines = $$.xgridLines.select('line'),\n texts = $$.xgridLines.select('text');\n return [\n (withTransition ? lines.transition() : lines)\n .attr('x1', config.axis_rotated ? 0 : xv)\n .attr('x2', config.axis_rotated ? $$.width : xv)\n .attr('y1', config.axis_rotated ? xv : 0)\n .attr('y2', config.axis_rotated ? xv : $$.height)\n .style('opacity', 1),\n (withTransition ? texts.transition() : texts)\n .attr('x', config.axis_rotated ? $$.yGridTextX.bind($$) : $$.xGridTextX.bind($$))\n .attr('y', xv)\n .text((d) => { return d.text; })\n .style('opacity', 1),\n ];\n};\nconst showXGridFocus = function (selectedData) {\n let $$ = this, config = $$.config,\n dataToShow = selectedData.filter((d) => { return d && isValue(d.value); }),\n focusEl = $$.main.selectAll('line.' + CLASS.xgridFocus),\n xx = $$.xx.bind($$);\n if (!config.tooltip_show) { return; }\n // Hide when scatter plot exists\n if ($$.hasType('scatter') || $$.hasArcType()) { return; }\n focusEl\n .style('visibility', 'visible')\n .data([dataToShow[0]])\n .attr(config.axis_rotated ? 'y1' : 'x1', xx)\n .attr(config.axis_rotated ? 'y2' : 'x2', xx);\n $$.smoothLines(focusEl, 'grid');\n};\nconst hideXGridFocus = function () {\n this.main.select('line.' + CLASS.xgridFocus).style('visibility', 'hidden');\n};\nconst updateXgridFocus = function () {\n let $$ = this, config = $$.config;\n $$.main.select('line.' + CLASS.xgridFocus)\n .attr('x1', config.axis_rotated ? 0 : -10)\n .attr('x2', config.axis_rotated ? $$.width : -10)\n .attr('y1', config.axis_rotated ? -10 : 0)\n .attr('y2', config.axis_rotated ? -10 : $$.height);\n};\nconst generateGridData = function (type, scale) {\n let $$ = this,\n gridData = [], xDomain, firstYear, lastYear, i,\n tickNum = $$.main.select('.' + CLASS.axisX).selectAll('.tick').size();\n if (type === 'year') {\n xDomain = $$.getXDomain();\n firstYear = xDomain[0].getFullYear();\n lastYear = xDomain[1].getFullYear();\n for (i = firstYear; i <= lastYear; i++) {\n gridData.push(new Date(i + '-01-01 00:00:00'));\n }\n } else {\n gridData = scale.ticks(10);\n if (gridData.length > tickNum) { // use only int\n gridData = gridData.filter((d) => { return ('' + d).indexOf('.') < 0; });\n }\n }\n return gridData;\n};\nconst getGridFilterToRemove = function (params) {\n return params ? function (line) {\n let found = false;\n [].concat(params).forEach((param) => {\n if ((('value' in param && line.value === param.value) || ('class' in param && line.class === param.class))) {\n found = true;\n }\n });\n return found;\n } : function () { return true; };\n};\nconst removeGridLines = function (params, forX) {\n let $$ = this, config = $$.config,\n toRemove = $$.getGridFilterToRemove(params),\n toShow = function (line) { return !toRemove(line); },\n classLines = forX ? CLASS.xgridLines : CLASS.ygridLines,\n classLine = forX ? CLASS.xgridLine : CLASS.ygridLine;\n $$.main.select('.' + classLines).selectAll('.' + classLine).filter(toRemove)\n .transition().duration(config.transition_duration)\n .style('opacity', 0).remove();\n if (forX) {\n config.grid_x_lines = config.grid_x_lines.filter(toShow);\n } else {\n config.grid_y_lines = config.grid_y_lines.filter(toShow);\n }\n};\n\nexport {\n initGrid,\n initGridLines,\n updateXGrid,\n updateYGrid,\n gridTextAnchor,\n gridTextDx,\n xGridTextX,\n yGridTextX,\n updateGrid,\n redrawGrid,\n showXGridFocus,\n hideXGridFocus,\n updateXgridFocus,\n generateGridData,\n getGridFilterToRemove,\n removeGridLines,\n};\n","import { CLASS } from './class';\n\nconst initEventRect = function () {\n const $$ = this;\n $$.main.select('.' + CLASS.chart).append('g')\n .attr('class', CLASS.eventRects)\n .style('fill-opacity', 0);\n};\nconst redrawEventRect = function () {\n let $$ = this, config = $$.config,\n eventRectUpdate, maxDataCountTarget,\n isMultipleX = $$.isMultipleX();\n\n // rects for mouseover\n const eventRects = $$.main.select('.' + CLASS.eventRects)\n .style('cursor', config.zoom_enabled ? config.axis_rotated ? 'ns-resize' : 'ew-resize' : null)\n .classed(CLASS.eventRectsMultiple, isMultipleX)\n .classed(CLASS.eventRectsSingle, !isMultipleX);\n\n // clear old rects\n eventRects.selectAll('.' + CLASS.eventRect).remove();\n\n // open as public variable\n $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect);\n\n if (isMultipleX) {\n eventRectUpdate = $$.eventRect.data([0]);\n // enter : only one rect will be added\n $$.generateEventRectsForMultipleXs(eventRectUpdate.enter());\n // update\n $$.updateEventRect(eventRectUpdate);\n // exit : not needed because always only one rect exists\n }\n else {\n // Set data and update $$.eventRect\n maxDataCountTarget = $$.getMaxDataCountTarget($$.data.targets);\n eventRects.datum(maxDataCountTarget ? maxDataCountTarget.values : []);\n $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect);\n eventRectUpdate = $$.eventRect.data((d) => { return d; });\n // enter\n $$.generateEventRectsForSingleX(eventRectUpdate.enter());\n // update\n $$.updateEventRect(eventRectUpdate);\n // exit\n eventRectUpdate.exit().remove();\n }\n};\nconst updateEventRect = function (eventRectUpdate) {\n let $$ = this, config = $$.config,\n x, y, w, h, rectW, rectX;\n\n // set update selection if null\n eventRectUpdate = eventRectUpdate || $$.eventRect.data((d) => { return d; });\n\n if ($$.isMultipleX()) {\n // TODO: rotated not supported yet\n x = 0;\n y = 0;\n w = $$.width;\n h = $$.height;\n }\n else {\n if (($$.isCustomX() || $$.isTimeSeries()) && !$$.isCategorized()) {\n // update index for x that is used by prevX and nextX\n $$.updateXs();\n\n rectW = function (d) {\n let prevX = $$.getPrevX(d.index), nextX = $$.getNextX(d.index);\n\n // if there this is a single data point make the eventRect full width (or height)\n if (prevX === null && nextX === null) {\n return config.axis_rotated ? $$.height : $$.width;\n }\n\n if (prevX === null) { prevX = $$.x.domain()[0]; }\n if (nextX === null) { nextX = $$.x.domain()[1]; }\n\n return Math.max(0, ($$.x(nextX) - $$.x(prevX)) / 2);\n };\n rectX = function (d) {\n let prevX = $$.getPrevX(d.index), nextX = $$.getNextX(d.index),\n thisX = $$.data.xs[d.id][d.index];\n\n // if there this is a single data point position the eventRect at 0\n if (prevX === null && nextX === null) {\n return 0;\n }\n\n if (prevX === null) { prevX = $$.x.domain()[0]; }\n\n return ($$.x(thisX) + $$.x(prevX)) / 2;\n };\n } else {\n rectW = $$.getEventRectWidth();\n rectX = function (d) {\n return $$.x(d.x) - (rectW / 2);\n };\n }\n x = config.axis_rotated ? 0 : rectX;\n y = config.axis_rotated ? rectX : 0;\n w = config.axis_rotated ? $$.width : rectW;\n h = config.axis_rotated ? rectW : $$.height;\n }\n\n eventRectUpdate\n .attr('class', $$.classEvent.bind($$))\n .attr('x', x)\n .attr('y', y)\n .attr('width', w)\n .attr('height', h);\n};\nconst generateEventRectsForSingleX = function (eventRectEnter) {\n let $$ = this, d3 = $$.d3, config = $$.config,\n tap = false, tapX;\n\n function click(shape, d) {\n let index = d.index;\n if ($$.hasArcType() || !$$.toggleShape) { return; }\n if ($$.cancelClick) {\n $$.cancelClick = false;\n return;\n }\n if ($$.isStepType(d) && config.line_step_type === 'step-after' && d3.mouse(shape)[0] < $$.x($$.getXValue(d.id, index))) {\n index -= 1;\n }\n $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {\n if (config.data_selection_grouped || $$.isWithinShape(this, d)) {\n $$.toggleShape(this, d, index);\n $$.config.data_onclick.call($$.api, d, this);\n }\n });\n }\n\n eventRectEnter.append('rect')\n .attr('class', $$.classEvent.bind($$))\n .style('cursor', config.data_selection_enabled && config.data_selection_grouped ? 'pointer' : null)\n .on('mouseover', (d) => {\n const index = d.index;\n\n if ($$.dragging || $$.flowing) { return; } // do nothing while dragging/flowing\n if ($$.hasArcType()) { return; }\n\n // Expand shapes for selection\n if (config.point_focus_expand_enabled) { $$.expandCircles(index, null, true); }\n $$.expandBars(index, null, true);\n\n // Call event handler\n $$.main.selectAll('.' + CLASS.shape + '-' + index).each((d) => {\n config.data_onmouseover.call($$.api, d);\n });\n })\n .on('mouseout', (d) => {\n const index = d.index;\n if (!$$.config) { return; } // chart is destroyed\n if ($$.hasArcType()) { return; }\n $$.hideXGridFocus();\n $$.hideTooltip();\n // Undo expanded shapes\n $$.unexpandCircles();\n $$.unexpandBars();\n // Call event handler\n $$.main.selectAll('.' + CLASS.shape + '-' + index).each((d) => {\n config.data_onmouseout.call($$.api, d);\n });\n })\n .on('mousemove', function (d) {\n let selectedData, index = d.index,\n eventRect = $$.svg.select('.' + CLASS.eventRect + '-' + index);\n\n if ($$.dragging || $$.flowing) { return; } // do nothing while dragging/flowing\n if ($$.hasArcType()) { return; }\n\n if ($$.isStepType(d) && $$.config.line_step_type === 'step-after' && d3.mouse(this)[0] < $$.x($$.getXValue(d.id, index))) {\n index -= 1;\n }\n\n // Show tooltip\n selectedData = $$.filterTargetsToShow($$.data.targets).map((t) => {\n return $$.addName($$.getValueOnIndex(t.values, index));\n });\n\n if (config.tooltip_grouped) {\n $$.showTooltip(selectedData, this);\n $$.showXGridFocus(selectedData);\n }\n\n if (config.tooltip_grouped && (!config.data_selection_enabled || config.data_selection_grouped)) {\n return;\n }\n\n $$.main.selectAll('.' + CLASS.shape + '-' + index)\n .each(function () {\n d3.select(this).classed(CLASS.EXPANDED, true);\n if (config.data_selection_enabled) {\n eventRect.style('cursor', config.data_selection_grouped ? 'pointer' : null);\n }\n if (!config.tooltip_grouped) {\n $$.hideXGridFocus();\n $$.hideTooltip();\n if (!config.data_selection_grouped) {\n $$.unexpandCircles(index);\n $$.unexpandBars(index);\n }\n }\n })\n .filter(function (d) {\n return $$.isWithinShape(this, d);\n })\n .each(function (d) {\n if (config.data_selection_enabled && (config.data_selection_grouped || config.data_selection_isselectable(d))) {\n eventRect.style('cursor', 'pointer');\n }\n if (!config.tooltip_grouped) {\n $$.showTooltip([d], this);\n $$.showXGridFocus([d]);\n if (config.point_focus_expand_enabled) { $$.expandCircles(index, d.id, true); }\n $$.expandBars(index, d.id, true);\n }\n });\n })\n .on('click', function (d) {\n // click event was simulated via a 'tap' touch event, cancel regular click\n if (tap) {\n return;\n }\n\n click(this, d);\n })\n .on('touchstart', (d) => {\n // store current X selection for comparison during touch end event\n tapX = d.x;\n })\n .on('touchend', function (d) {\n const finalX = d.x;\n\n // If end is not the same as the start, event doesn't count as a tap\n if (tapX !== finalX) {\n return;\n }\n\n\n click(this, d);\n\n // indictate tap event fired to prevent click;\n tap = true;\n setTimeout(() => { tap = false; }, config.touch_tap_delay);\n })\n\n .call(\n config.data_selection_draggable && $$.drag ? (\n d3.behavior.drag().origin(Object)\n .on('drag', function () { $$.drag(d3.mouse(this)); })\n .on('dragstart', function () { $$.dragstart(d3.mouse(this)); })\n .on('dragend', () => { $$.dragend(); })\n ) : () => {}\n );\n};\n\nconst generateEventRectsForMultipleXs = function (eventRectEnter) {\n let $$ = this, d3 = $$.d3, config = $$.config,\n tap = false, tapX, tapY;\n\n function mouseout() {\n $$.svg.select('.' + CLASS.eventRect).style('cursor', null);\n $$.hideXGridFocus();\n $$.hideTooltip();\n $$.unexpandCircles();\n $$.unexpandBars();\n }\n\n function click(shape) {\n const targetsToShow = $$.filterTargetsToShow($$.data.targets);\n let mouse, closest;\n if ($$.hasArcType(targetsToShow)) { return; }\n\n mouse = d3.mouse(shape);\n closest = $$.findClosestFromTargets(targetsToShow, mouse);\n if (!closest) { return; }\n // select if selection enabled\n if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {\n $$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(closest.id)).selectAll('.' + CLASS.shape + '-' + closest.index).each(function () {\n if (config.data_selection_grouped || $$.isWithinShape(this, closest)) {\n $$.toggleShape(this, closest, closest.index);\n $$.config.data_onclick.call($$.api, closest, this);\n }\n });\n }\n }\n\n eventRectEnter.append('rect')\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', $$.width)\n .attr('height', $$.height)\n .attr('class', CLASS.eventRect)\n .on('mouseout', () => {\n if (!$$.config) { return; } // chart is destroyed\n if ($$.hasArcType()) { return; }\n mouseout();\n })\n .on('mousemove', function () {\n const targetsToShow = $$.filterTargetsToShow($$.data.targets);\n let mouse, closest, sameXData, selectedData;\n\n if ($$.dragging) { return; } // do nothing when dragging\n if ($$.hasArcType(targetsToShow)) { return; }\n\n mouse = d3.mouse(this);\n closest = $$.findClosestFromTargets(targetsToShow, mouse);\n\n if ($$.mouseover && (!closest || closest.id !== $$.mouseover.id)) {\n config.data_onmouseout.call($$.api, $$.mouseover);\n $$.mouseover = undefined;\n }\n\n if (!closest) {\n mouseout();\n return;\n }\n\n if ($$.isScatterType(closest) || !config.tooltip_grouped) {\n sameXData = [closest];\n } else {\n sameXData = $$.filterByX(targetsToShow, closest.x);\n }\n\n // show tooltip when cursor is close to some point\n selectedData = sameXData.map((d) => {\n return $$.addName(d);\n });\n $$.showTooltip(selectedData, this);\n\n // expand points\n if (config.point_focus_expand_enabled) {\n $$.expandCircles(closest.index, closest.id, true);\n }\n $$.expandBars(closest.index, closest.id, true);\n\n // Show xgrid focus line\n $$.showXGridFocus(selectedData);\n\n // Show cursor as pointer if point is close to mouse position\n if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {\n $$.svg.select('.' + CLASS.eventRect).style('cursor', 'pointer');\n if (!$$.mouseover) {\n config.data_onmouseover.call($$.api, closest);\n $$.mouseover = closest;\n }\n }\n })\n .on('click', function () {\n // click event was simulated via a 'tap' touch event, cancel regular click\n if (tap) {\n return;\n }\n\n click(this);\n })\n .on('touchstart', function () {\n const mouse = d3.mouse(this);\n // store starting coordinates for distance comparision during touch end event\n tapX = mouse[0];\n tapY = mouse[1];\n })\n .on('touchend', function () {\n let mouse = d3.mouse(this),\n x = mouse[0],\n y = mouse[1];\n\n // If end is too far from start, event doesn't count as a tap\n if (Math.abs(x - tapX) > config.touch_tap_radius || Math.abs(y - tapY) > config.touch_tap_radius) {\n return;\n }\n\n click(this);\n\n // indictate tap event fired to prevent click;\n tap = true;\n setTimeout(() => { tap = false; }, config.touch_tap_delay);\n })\n .call(\n config.data_selection_draggable && $$.drag ? (\n d3.behavior.drag().origin(Object)\n .on('drag', function () { $$.drag(d3.mouse(this)); })\n .on('dragstart', function () { $$.dragstart(d3.mouse(this)); })\n .on('dragend', () => { $$.dragend(); })\n ) : () => {}\n );\n};\nconst dispatchEvent = function (type, index, mouse) {\n let $$ = this,\n selector = '.' + CLASS.eventRect + (!$$.isMultipleX() ? '-' + index : ''),\n eventRect = $$.main.select(selector).node(),\n box = eventRect.getBoundingClientRect(),\n x = box.left + (mouse ? mouse[0] : 0),\n y = box.top + (mouse ? mouse[1] : 0),\n event = document.createEvent('MouseEvents');\n\n event.initMouseEvent(type, true, true, window, 0, x, y, x, y,\n false, false, false, false, 0, null);\n eventRect.dispatchEvent(event);\n};\n\nexport {\n initEventRect,\n redrawEventRect,\n updateEventRect,\n generateEventRectsForSingleX,\n generateEventRectsForMultipleXs,\n dispatchEvent,\n};\n","import { CLASS } from './class';\nimport {\n isEmpty,\n isDefined,\n getOption,\n} from './util';\n\nconst initLegend = function () {\n const $$ = this;\n $$.legendItemTextBox = {};\n $$.legendHasRendered = false;\n $$.legend = $$.svg.append('g').attr('transform', $$.getTranslate('legend'));\n if (!$$.config.legend_show) {\n $$.legend.style('visibility', 'hidden');\n $$.hiddenLegendIds = $$.mapToIds($$.data.targets);\n return;\n }\n // MEMO: call here to update legend box and tranlate for all\n // MEMO: translate will be upated by this, so transform not needed in updateLegend()\n $$.updateLegendWithDefaults();\n};\nconst updateLegendWithDefaults = function () {\n const $$ = this;\n $$.updateLegend($$.mapToIds($$.data.targets), { withTransform: false, withTransitionForTransform: false, withTransition: false });\n};\nconst updateSizeForLegend = function (legendHeight, legendWidth) {\n let $$ = this, config = $$.config, insetLegendPosition = {\n top: $$.isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : $$.currentHeight - legendHeight - $$.getCurrentPaddingBottom() - config.legend_inset_y,\n left: $$.isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + 0.5 : $$.currentWidth - legendWidth - $$.getCurrentPaddingRight() - config.legend_inset_x + 0.5,\n };\n\n $$.margin3 = {\n top: $$.isLegendRight ? 0 : $$.isLegendInset ? insetLegendPosition.top : $$.currentHeight - legendHeight,\n right: NaN,\n bottom: 0,\n left: $$.isLegendRight ? $$.currentWidth - legendWidth : $$.isLegendInset ? insetLegendPosition.left : 0,\n };\n};\nconst transformLegend = function (withTransition) {\n const $$ = this;\n (withTransition ? $$.legend.transition() : $$.legend).attr('transform', $$.getTranslate('legend'));\n};\nconst updateLegendStep = function (step) {\n this.legendStep = step;\n};\nconst updateLegendItemWidth = function (w) {\n this.legendItemWidth = w;\n};\nconst updateLegendItemHeight = function (h) {\n this.legendItemHeight = h;\n};\nconst getLegendWidth = function () {\n const $$ = this;\n return $$.config.legend_show ? $$.isLegendRight || $$.isLegendInset ? $$.legendItemWidth * ($$.legendStep + 1) : $$.currentWidth : 0;\n};\nconst getLegendHeight = function () {\n let $$ = this, h = 0;\n if ($$.config.legend_show) {\n if ($$.isLegendRight) {\n h = $$.currentHeight;\n } else {\n h = Math.max(20, $$.legendItemHeight) * ($$.legendStep + 1);\n }\n }\n return h;\n};\nconst opacityForLegend = function (legendItem) {\n return legendItem.classed(CLASS.legendItemHidden) ? null : 1;\n};\nconst opacityForUnfocusedLegend = function (legendItem) {\n return legendItem.classed(CLASS.legendItemHidden) ? null : 0.3;\n};\nconst toggleFocusLegend = function (targetIds, focus) {\n const $$ = this;\n targetIds = $$.mapToTargetIds(targetIds);\n $$.legend.selectAll('.' + CLASS.legendItem)\n .filter((id) => { return targetIds.indexOf(id) >= 0; })\n .classed(CLASS.legendItemFocused, focus)\n .transition().duration(100)\n .style('opacity', function () {\n const opacity = focus ? $$.opacityForLegend : $$.opacityForUnfocusedLegend;\n return opacity.call($$, $$.d3.select(this));\n });\n};\nconst revertLegend = function () {\n let $$ = this, d3 = $$.d3;\n $$.legend.selectAll('.' + CLASS.legendItem)\n .classed(CLASS.legendItemFocused, false)\n .transition().duration(100)\n .style('opacity', function () { return $$.opacityForLegend(d3.select(this)); });\n};\nconst showLegend = function (targetIds) {\n let $$ = this, config = $$.config;\n if (!config.legend_show) {\n config.legend_show = true;\n $$.legend.style('visibility', 'visible');\n if (!$$.legendHasRendered) {\n $$.updateLegendWithDefaults();\n }\n }\n $$.removeHiddenLegendIds(targetIds);\n $$.legend.selectAll($$.selectorLegends(targetIds))\n .style('visibility', 'visible')\n .transition()\n .style('opacity', function () { return $$.opacityForLegend($$.d3.select(this)); });\n};\nconst hideLegend = function (targetIds) {\n let $$ = this, config = $$.config;\n if (config.legend_show && isEmpty(targetIds)) {\n config.legend_show = false;\n $$.legend.style('visibility', 'hidden');\n }\n $$.addHiddenLegendIds(targetIds);\n $$.legend.selectAll($$.selectorLegends(targetIds))\n .style('opacity', 0)\n .style('visibility', 'hidden');\n};\nconst clearLegendItemTextBoxCache = function () {\n this.legendItemTextBox = {};\n};\nconst updateLegend = function (targetIds, options, transitions) {\n let $$ = this, config = $$.config;\n let xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect, x1ForLegendTile, x2ForLegendTile, yForLegendTile;\n let paddingTop = 4, paddingRight = 10, maxWidth = 0, maxHeight = 0, posMin = 10, tileWidth = config.legend_item_tile_width + 5;\n let l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0;\n let withTransition, withTransitionForTransform;\n let texts, rects, tiles, background;\n\n // Skip elements when their name is set to null\n targetIds = targetIds.filter((id) => {\n return !isDefined(config.data_names[id]) || config.data_names[id] !== null;\n });\n\n options = options || {};\n withTransition = getOption(options, 'withTransition', true);\n withTransitionForTransform = getOption(options, 'withTransitionForTransform', true);\n\n function getTextBox(textElement, id) {\n if (!$$.legendItemTextBox[id]) {\n $$.legendItemTextBox[id] = $$.getTextRect(textElement.textContent, CLASS.legendItem, textElement);\n }\n return $$.legendItemTextBox[id];\n }\n\n function updatePositions(textElement, id, index) {\n let reset = index === 0, isLast = index === targetIds.length - 1,\n box = getTextBox(textElement, id),\n itemWidth = box.width + tileWidth + (isLast && !($$.isLegendRight || $$.isLegendInset) ? 0 : paddingRight) + config.legend_padding,\n itemHeight = box.height + paddingTop,\n itemLength = $$.isLegendRight || $$.isLegendInset ? itemHeight : itemWidth,\n areaLength = $$.isLegendRight || $$.isLegendInset ? $$.getLegendHeight() : $$.getLegendWidth(),\n margin, maxLength;\n\n // MEMO: care about condifion of step, totalLength\n function updateValues(id, withoutStep) {\n if (!withoutStep) {\n margin = (areaLength - totalLength - itemLength) / 2;\n if (margin < posMin) {\n margin = (areaLength - itemLength) / 2;\n totalLength = 0;\n step++;\n }\n }\n steps[id] = step;\n margins[step] = $$.isLegendInset ? 10 : margin;\n offsets[id] = totalLength;\n totalLength += itemLength;\n }\n\n if (reset) {\n totalLength = 0;\n step = 0;\n maxWidth = 0;\n maxHeight = 0;\n }\n\n if (config.legend_show && !$$.isLegendToShow(id)) {\n widths[id] = heights[id] = steps[id] = offsets[id] = 0;\n return;\n }\n\n widths[id] = itemWidth;\n heights[id] = itemHeight;\n\n if (!maxWidth || itemWidth >= maxWidth) { maxWidth = itemWidth; }\n if (!maxHeight || itemHeight >= maxHeight) { maxHeight = itemHeight; }\n maxLength = $$.isLegendRight || $$.isLegendInset ? maxHeight : maxWidth;\n\n if (config.legend_equally) {\n Object.keys(widths).forEach((id) => { widths[id] = maxWidth; });\n Object.keys(heights).forEach((id) => { heights[id] = maxHeight; });\n margin = (areaLength - maxLength * targetIds.length) / 2;\n if (margin < posMin) {\n totalLength = 0;\n step = 0;\n targetIds.forEach((id) => { updateValues(id); });\n }\n else {\n updateValues(id, true);\n }\n } else {\n updateValues(id);\n }\n }\n\n if ($$.isLegendInset) {\n step = config.legend_inset_step ? config.legend_inset_step : targetIds.length;\n $$.updateLegendStep(step);\n }\n\n if ($$.isLegendRight) {\n xForLegend = function (id) { return maxWidth * steps[id]; };\n yForLegend = function (id) { return margins[steps[id]] + offsets[id]; };\n } else if ($$.isLegendInset) {\n xForLegend = function (id) { return maxWidth * steps[id] + 10; };\n yForLegend = function (id) { return margins[steps[id]] + offsets[id]; };\n } else {\n xForLegend = function (id) { return margins[steps[id]] + offsets[id]; };\n yForLegend = function (id) { return maxHeight * steps[id]; };\n }\n xForLegendText = function (id, i) { return xForLegend(id, i) + 4 + config.legend_item_tile_width; };\n yForLegendText = function (id, i) { return yForLegend(id, i) + 9; };\n xForLegendRect = function (id, i) { return xForLegend(id, i); };\n yForLegendRect = function (id, i) { return yForLegend(id, i) - 5; };\n x1ForLegendTile = function (id, i) { return xForLegend(id, i) - 2; };\n x2ForLegendTile = function (id, i) { return xForLegend(id, i) - 2 + config.legend_item_tile_width; };\n yForLegendTile = function (id, i) { return yForLegend(id, i) + 4; };\n\n // Define g for legend area\n l = $$.legend.selectAll('.' + CLASS.legendItem)\n .data(targetIds)\n .enter().append('g')\n .attr('class', (id) => { return $$.generateClass(CLASS.legendItem, id); })\n .style('visibility', (id) => { return $$.isLegendToShow(id) ? 'visible' : 'hidden'; })\n .style('cursor', 'pointer')\n .on('click', (id) => {\n if (config.legend_item_onclick) {\n config.legend_item_onclick.call($$, id);\n } else {\n if ($$.d3.event.altKey) {\n $$.api.hide();\n $$.api.show(id);\n } else {\n $$.api.toggle(id);\n $$.isTargetToShow(id) ? $$.api.focus(id) : $$.api.revert();\n }\n }\n })\n .on('mouseover', function (id) {\n if (config.legend_item_onmouseover) {\n config.legend_item_onmouseover.call($$, id);\n }\n else {\n $$.d3.select(this).classed(CLASS.legendItemFocused, true);\n if (!$$.transiting && $$.isTargetToShow(id)) {\n $$.api.focus(id);\n }\n }\n })\n .on('mouseout', function (id) {\n if (config.legend_item_onmouseout) {\n config.legend_item_onmouseout.call($$, id);\n }\n else {\n $$.d3.select(this).classed(CLASS.legendItemFocused, false);\n $$.api.revert();\n }\n });\n l.append('text')\n .text((id) => { return isDefined(config.data_names[id]) ? config.data_names[id] : id; })\n .each(function (id, i) { updatePositions(this, id, i); })\n .style('pointer-events', 'none')\n .attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200)\n .attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendText);\n l.append('rect')\n .attr('class', CLASS.legendItemEvent)\n .style('fill-opacity', 0)\n .attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendRect : -200)\n .attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendRect);\n l.append('line')\n .attr('class', CLASS.legendItemTile)\n .style('stroke', $$.color)\n .style('pointer-events', 'none')\n .attr('x1', $$.isLegendRight || $$.isLegendInset ? x1ForLegendTile : -200)\n .attr('y1', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendTile)\n .attr('x2', $$.isLegendRight || $$.isLegendInset ? x2ForLegendTile : -200)\n .attr('y2', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendTile)\n .attr('stroke-width', config.legend_item_tile_height);\n\n // Set background for inset legend\n background = $$.legend.select('.' + CLASS.legendBackground + ' rect');\n if ($$.isLegendInset && maxWidth > 0 && background.size() === 0) {\n background = $$.legend.insert('g', '.' + CLASS.legendItem)\n .attr('class', CLASS.legendBackground)\n .append('rect');\n }\n\n texts = $$.legend.selectAll('text')\n .data(targetIds)\n .text((id) => { return isDefined(config.data_names[id]) ? config.data_names[id] : id; }) // MEMO: needed for update\n .each(function (id, i) { updatePositions(this, id, i); });\n (withTransition ? texts.transition() : texts)\n .attr('x', xForLegendText)\n .attr('y', yForLegendText);\n\n rects = $$.legend.selectAll('rect.' + CLASS.legendItemEvent)\n .data(targetIds);\n (withTransition ? rects.transition() : rects)\n .attr('width', (id) => { return widths[id]; })\n .attr('height', (id) => { return heights[id]; })\n .attr('x', xForLegendRect)\n .attr('y', yForLegendRect);\n\n tiles = $$.legend.selectAll('line.' + CLASS.legendItemTile)\n .data(targetIds);\n (withTransition ? tiles.transition() : tiles)\n .style('stroke', $$.color)\n .attr('x1', x1ForLegendTile)\n .attr('y1', yForLegendTile)\n .attr('x2', x2ForLegendTile)\n .attr('y2', yForLegendTile);\n\n if (background) {\n (withTransition ? background.transition() : background)\n .attr('height', $$.getLegendHeight() - 12)\n .attr('width', maxWidth * (step + 1) + 10);\n }\n\n // toggle legend state\n $$.legend.selectAll('.' + CLASS.legendItem)\n .classed(CLASS.legendItemHidden, (id) => { return !$$.isTargetToShow(id); });\n\n // Update all to reflect change of legend\n $$.updateLegendItemWidth(maxWidth);\n $$.updateLegendItemHeight(maxHeight);\n $$.updateLegendStep(step);\n // Update size and scale\n $$.updateSizes();\n $$.updateScales();\n $$.updateSvgSize();\n // Update g positions\n $$.transformAll(withTransitionForTransform, transitions);\n $$.legendHasRendered = true;\n};\n\nexport {\n initLegend,\n updateLegendWithDefaults,\n updateSizeForLegend,\n transformLegend,\n updateLegendStep,\n updateLegendItemWidth,\n updateLegendItemHeight,\n getLegendWidth,\n getLegendHeight,\n opacityForLegend,\n opacityForUnfocusedLegend,\n toggleFocusLegend,\n revertLegend,\n showLegend,\n hideLegend,\n clearLegendItemTextBoxCache,\n updateLegend,\n};\n","import { CLASS } from './class';\nimport { isValue } from './util';\n\nconst initRegion = function () {\n const $$ = this;\n $$.region = $$.main.append('g')\n .attr('clip-path', $$.clipPath)\n .attr('class', CLASS.regions);\n};\nconst updateRegion = function (duration) {\n let $$ = this, config = $$.config;\n\n // hide if arc type\n $$.region.style('visibility', $$.hasArcType() ? 'hidden' : 'visible');\n\n $$.mainRegion = $$.main.select('.' + CLASS.regions).selectAll('.' + CLASS.region)\n .data(config.regions);\n $$.mainRegion.enter().append('g')\n .append('rect')\n .style('fill-opacity', 0);\n $$.mainRegion\n .attr('class', $$.classRegion.bind($$));\n $$.mainRegion.exit().transition().duration(duration)\n .style('opacity', 0)\n .remove();\n};\nconst redrawRegion = function (withTransition) {\n let $$ = this,\n regions = $$.mainRegion.selectAll('rect').each(function () {\n // data is binded to g and it's not transferred to rect (child node) automatically,\n // then data of each rect has to be updated manually.\n // TODO: there should be more efficient way to solve this?\n const parentData = $$.d3.select(this.parentNode).datum();\n $$.d3.select(this).datum(parentData);\n }),\n x = $$.regionX.bind($$),\n y = $$.regionY.bind($$),\n w = $$.regionWidth.bind($$),\n h = $$.regionHeight.bind($$);\n return [\n (withTransition ? regions.transition() : regions)\n .attr('x', x)\n .attr('y', y)\n .attr('width', w)\n .attr('height', h)\n .style('fill-opacity', (d) => { return isValue(d.opacity) ? d.opacity : 0.1; }),\n ];\n};\nconst regionX = function (d) {\n let $$ = this, config = $$.config,\n xPos, yScale = d.axis === 'y' ? $$.y : $$.y2;\n if (d.axis === 'y' || d.axis === 'y2') {\n xPos = config.axis_rotated ? ('start' in d ? yScale(d.start) : 0) : 0;\n } else {\n xPos = config.axis_rotated ? 0 : ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0);\n }\n return xPos;\n};\nconst regionY = function (d) {\n let $$ = this, config = $$.config,\n yPos, yScale = d.axis === 'y' ? $$.y : $$.y2;\n if (d.axis === 'y' || d.axis === 'y2') {\n yPos = config.axis_rotated ? 0 : ('end' in d ? yScale(d.end) : 0);\n } else {\n yPos = config.axis_rotated ? ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0) : 0;\n }\n return yPos;\n};\nconst regionWidth = function (d) {\n let $$ = this, config = $$.config,\n start = $$.regionX(d), end, yScale = d.axis === 'y' ? $$.y : $$.y2;\n if (d.axis === 'y' || d.axis === 'y2') {\n end = config.axis_rotated ? ('end' in d ? yScale(d.end) : $$.width) : $$.width;\n } else {\n end = config.axis_rotated ? $$.width : ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.width);\n }\n return end < start ? 0 : end - start;\n};\nconst regionHeight = function (d) {\n let $$ = this, config = $$.config,\n start = this.regionY(d), end, yScale = d.axis === 'y' ? $$.y : $$.y2;\n if (d.axis === 'y' || d.axis === 'y2') {\n end = config.axis_rotated ? $$.height : ('start' in d ? yScale(d.start) : $$.height);\n } else {\n end = config.axis_rotated ? ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.height) : $$.height;\n }\n return end < start ? 0 : end - start;\n};\nconst isRegionOnX = function (d) {\n return !d.axis || d.axis === 'x';\n};\n\nexport {\n initRegion,\n updateRegion,\n redrawRegion,\n regionX,\n regionY,\n regionWidth,\n regionHeight,\n isRegionOnX,\n};\n","const getScale = function (min, max, forTimeseries) {\n return (forTimeseries ? this.d3.time.scale() : this.d3.scale.linear()).range([min, max]);\n};\nconst getX = function (min, max, domain, offset) {\n let $$ = this,\n scale = $$.getScale(min, max, $$.isTimeSeries()),\n _scale = domain ? scale.domain(domain) : scale, key;\n // Define customized scale if categorized axis\n if ($$.isCategorized()) {\n offset = offset || function () { return 0; };\n scale = function (d, raw) {\n const v = _scale(d) + offset(d);\n return raw ? v : Math.ceil(v);\n };\n } else {\n scale = function (d, raw) {\n const v = _scale(d);\n return raw ? v : Math.ceil(v);\n };\n }\n // define functions\n for (key in _scale) {\n scale[key] = _scale[key];\n }\n scale.orgDomain = function () {\n return _scale.domain();\n };\n // define custom domain() for categorized axis\n if ($$.isCategorized()) {\n scale.domain = function (domain) {\n if (!arguments.length) {\n domain = this.orgDomain();\n return [domain[0], domain[1] + 1];\n }\n _scale.domain(domain);\n return scale;\n };\n }\n return scale;\n};\nconst getY = function (min, max, domain) {\n const scale = this.getScale(min, max, this.isTimeSeriesY());\n if (domain) { scale.domain(domain); }\n return scale;\n};\nconst getYScale = function (id) {\n return this.axis.getId(id) === 'y2' ? this.y2 : this.y;\n};\nconst getSubYScale = function (id) {\n return this.axis.getId(id) === 'y2' ? this.subY2 : this.subY;\n};\nconst updateScales = function () {\n let $$ = this, config = $$.config,\n forInit = !$$.x;\n // update edges\n $$.xMin = config.axis_rotated ? 1 : 0;\n $$.xMax = config.axis_rotated ? $$.height : $$.width;\n $$.yMin = config.axis_rotated ? 0 : $$.height;\n $$.yMax = config.axis_rotated ? $$.width : 1;\n $$.subXMin = $$.xMin;\n $$.subXMax = $$.xMax;\n $$.subYMin = config.axis_rotated ? 0 : $$.height2;\n $$.subYMax = config.axis_rotated ? $$.width2 : 1;\n // update scales\n $$.x = $$.getX($$.xMin, $$.xMax, forInit ? undefined : $$.x.orgDomain(), () => { return $$.xAxis.tickOffset(); });\n $$.y = $$.getY($$.yMin, $$.yMax, forInit ? config.axis_y_default : $$.y.domain());\n $$.y2 = $$.getY($$.yMin, $$.yMax, forInit ? config.axis_y2_default : $$.y2.domain());\n $$.subX = $$.getX($$.xMin, $$.xMax, $$.orgXDomain, (d) => { return d % 1 ? 0 : $$.subXAxis.tickOffset(); });\n $$.subY = $$.getY($$.subYMin, $$.subYMax, forInit ? config.axis_y_default : $$.subY.domain());\n $$.subY2 = $$.getY($$.subYMin, $$.subYMax, forInit ? config.axis_y2_default : $$.subY2.domain());\n // update axes\n $$.xAxisTickFormat = $$.axis.getXAxisTickFormat();\n $$.xAxisTickValues = $$.axis.getXAxisTickValues();\n $$.yAxisTickValues = $$.axis.getYAxisTickValues();\n $$.y2AxisTickValues = $$.axis.getY2AxisTickValues();\n\n $$.xAxis = $$.axis.getXAxis($$.x, $$.xOrient, $$.xAxisTickFormat, $$.xAxisTickValues, config.axis_x_tick_outer);\n $$.subXAxis = $$.axis.getXAxis($$.subX, $$.subXOrient, $$.xAxisTickFormat, $$.xAxisTickValues, config.axis_x_tick_outer);\n $$.yAxis = $$.axis.getYAxis($$.y, $$.yOrient, config.axis_y_tick_format, $$.yAxisTickValues, config.axis_y_tick_outer);\n $$.y2Axis = $$.axis.getYAxis($$.y2, $$.y2Orient, config.axis_y2_tick_format, $$.y2AxisTickValues, config.axis_y2_tick_outer);\n\n // Set initialized scales to brush and zoom\n if (!forInit) {\n if ($$.brush) { $$.brush.scale($$.subX); }\n if (config.zoom_enabled) { $$.zoom.scale($$.x); }\n }\n // update for arc\n if ($$.updateArc) { $$.updateArc(); }\n};\n\nexport {\n getScale,\n getX,\n getY,\n getYScale,\n getSubYScale,\n updateScales,\n};\n","import { CLASS } from './class';\n\nconst selectPoint = function (target, d, i) {\n let $$ = this, config = $$.config,\n cx = (config.axis_rotated ? $$.circleY : $$.circleX).bind($$),\n cy = (config.axis_rotated ? $$.circleX : $$.circleY).bind($$),\n r = $$.pointSelectR.bind($$);\n config.data_onselected.call($$.api, d, target.node());\n // add selected-circle on low layer g\n $$.main.select('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS.selectedCircle + '-' + i)\n .data([d])\n .enter().append('circle')\n .attr('class', () => { return $$.generateClass(CLASS.selectedCircle, i); })\n .attr('cx', cx)\n .attr('cy', cy)\n .attr('stroke', () => { return $$.color(d); })\n .attr('r', (d) => { return $$.pointSelectR(d) * 1.4; })\n .transition().duration(100)\n .attr('r', r);\n};\nconst unselectPoint = function (target, d, i) {\n const $$ = this;\n $$.config.data_onunselected.call($$.api, d, target.node());\n // remove selected-circle from low layer g\n $$.main.select('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS.selectedCircle + '-' + i)\n .transition().duration(100).attr('r', 0)\n .remove();\n};\nconst togglePoint = function (selected, target, d, i) {\n selected ? this.selectPoint(target, d, i) : this.unselectPoint(target, d, i);\n};\nconst selectPath = function (target, d) {\n const $$ = this;\n $$.config.data_onselected.call($$, d, target.node());\n if ($$.config.interaction_brighten) {\n target.transition().duration(100)\n .style('fill', () => { return $$.d3.rgb($$.color(d)).brighter(0.75); });\n }\n};\nconst unselectPath = function (target, d) {\n const $$ = this;\n $$.config.data_onunselected.call($$, d, target.node());\n if ($$.config.interaction_brighten) {\n target.transition().duration(100)\n .style('fill', () => { return $$.color(d); });\n }\n};\nconst togglePath = function (selected, target, d, i) {\n selected ? this.selectPath(target, d, i) : this.unselectPath(target, d, i);\n};\nconst getToggle = function (that, d) {\n let $$ = this, toggle;\n if (that.nodeName === 'circle') {\n if ($$.isStepType(d)) {\n // circle is hidden in step chart, so treat as within the click area\n toggle = function () {}; // TODO: how to select step chart?\n } else {\n toggle = $$.togglePoint;\n }\n }\n else if (that.nodeName === 'path') {\n toggle = $$.togglePath;\n }\n return toggle;\n};\nconst toggleShape = function (that, d, i) {\n let $$ = this, d3 = $$.d3, config = $$.config,\n shape = d3.select(that), isSelected = shape.classed(CLASS.SELECTED),\n toggle = $$.getToggle(that, d).bind($$);\n\n if (config.data_selection_enabled && config.data_selection_isselectable(d)) {\n if (!config.data_selection_multiple) {\n $$.main.selectAll('.' + CLASS.shapes + (config.data_selection_grouped ? $$.getTargetSelectorSuffix(d.id) : '')).selectAll('.' + CLASS.shape).each(function (d, i) {\n const shape = d3.select(this);\n if (shape.classed(CLASS.SELECTED)) { toggle(false, shape.classed(CLASS.SELECTED, false), d, i); }\n });\n }\n shape.classed(CLASS.SELECTED, !isSelected);\n toggle(!isSelected, shape, d, i);\n }\n};\n\nexport {\n selectPoint,\n unselectPoint,\n togglePoint,\n selectPath,\n unselectPath,\n togglePath,\n getToggle,\n toggleShape,\n};\n","import { CLASS } from './class';\nimport { isValue } from './util';\n\nconst initBar = function () {\n const $$ = this;\n $$.main.select('.' + CLASS.chart).append('g')\n .attr('class', CLASS.chartBars);\n};\nconst updateTargetsForBar = function (targets) {\n let $$ = this, config = $$.config,\n mainBarUpdate, mainBarEnter,\n classChartBar = $$.classChartBar.bind($$),\n classBars = $$.classBars.bind($$),\n classFocus = $$.classFocus.bind($$);\n mainBarUpdate = $$.main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar)\n .data(targets)\n .attr('class', (d) => { return classChartBar(d) + classFocus(d); });\n mainBarEnter = mainBarUpdate.enter().append('g')\n .attr('class', classChartBar)\n .style('opacity', 0)\n .style('pointer-events', 'none');\n // Bars for each data\n mainBarEnter.append('g')\n .attr('class', classBars)\n .style('cursor', (d) => { return config.data_selection_isselectable(d) ? 'pointer' : null; });\n};\nconst updateBar = function (durationForExit) {\n let $$ = this,\n barData = $$.barData.bind($$),\n classBar = $$.classBar.bind($$),\n initialOpacity = $$.initialOpacity.bind($$),\n color = function (d) { return $$.color(d.id); };\n $$.mainBar = $$.main.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar)\n .data(barData);\n $$.mainBar.enter().append('path')\n .attr('class', classBar)\n .style('stroke', color)\n .style('fill', color);\n $$.mainBar\n .style('opacity', initialOpacity);\n $$.mainBar.exit().transition().duration(durationForExit)\n .style('opacity', 0)\n .remove();\n};\nconst redrawBar = function (drawBar, withTransition) {\n return [\n (withTransition ? this.mainBar.transition(Math.random().toString()) : this.mainBar)\n .attr('d', drawBar)\n .style('fill', this.color)\n .style('opacity', 1),\n ];\n};\nconst getBarW = function (axis, barTargetsNum) {\n let $$ = this, config = $$.config,\n w = typeof config.bar_width === 'number' ? config.bar_width : barTargetsNum ? (axis.tickInterval() * config.bar_width_ratio) / barTargetsNum : 0;\n return config.bar_width_max && w > config.bar_width_max ? config.bar_width_max : w;\n};\nconst getBars = function (i, id) {\n const $$ = this;\n return (id ? $$.main.selectAll('.' + CLASS.bars + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : ''));\n};\nconst expandBars = function (i, id, reset) {\n const $$ = this;\n if (reset) { $$.unexpandBars(); }\n $$.getBars(i, id).classed(CLASS.EXPANDED, true);\n};\nconst unexpandBars = function (i) {\n const $$ = this;\n $$.getBars(i).classed(CLASS.EXPANDED, false);\n};\nconst generateDrawBar = function (barIndices, isSub) {\n let $$ = this, config = $$.config,\n getPoints = $$.generateGetBarPoints(barIndices, isSub);\n return function (d, i) {\n // 4 points that make a bar\n const points = getPoints(d, i);\n\n // switch points if axis is rotated, not applicable for sub chart\n const indexX = config.axis_rotated ? 1 : 0;\n const indexY = config.axis_rotated ? 0 : 1;\n\n const path = 'M ' + points[0][indexX] + ',' + points[0][indexY] + ' ' +\n 'L' + points[1][indexX] + ',' + points[1][indexY] + ' ' +\n 'L' + points[2][indexX] + ',' + points[2][indexY] + ' ' +\n 'L' + points[3][indexX] + ',' + points[3][indexY] + ' ' +\n 'z';\n\n return path;\n };\n};\nconst generateGetBarPoints = function (barIndices, isSub) {\n let $$ = this,\n axis = isSub ? $$.subXAxis : $$.xAxis,\n barTargetsNum = barIndices.__max__ + 1,\n barW = $$.getBarW(axis, barTargetsNum),\n barX = $$.getShapeX(barW, barTargetsNum, barIndices, !!isSub),\n barY = $$.getShapeY(!!isSub),\n barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub),\n yScale = isSub ? $$.getSubYScale : $$.getYScale;\n return function (d, i) {\n let y0 = yScale.call($$, d.id)(0),\n offset = barOffset(d, i) || y0, // offset is for stacked bar chart\n posX = barX(d), posY = barY(d);\n // fix posY not to overflow opposite quadrant\n if ($$.config.axis_rotated) {\n if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; }\n }\n // 4 points that make a bar\n return [\n [posX, offset],\n [posX, posY - (y0 - offset)],\n [posX + barW, posY - (y0 - offset)],\n [posX + barW, offset],\n ];\n };\n};\nconst isWithinBar = function (that) {\n let mouse = this.d3.mouse(that), box = that.getBoundingClientRect(),\n seg0 = that.pathSegList.getItem(0), seg1 = that.pathSegList.getItem(1),\n x = Math.min(seg0.x, seg1.x), y = Math.min(seg0.y, seg1.y),\n w = box.width, h = box.height, offset = 2,\n sx = x - offset, ex = x + w + offset, sy = y + h + offset, ey = y - offset;\n return sx < mouse[0] && mouse[0] < ex && ey < mouse[1] && mouse[1] < sy;\n};\n\nexport {\n initBar,\n updateTargetsForBar,\n updateBar,\n redrawBar,\n getBarW,\n getBars,\n expandBars,\n unexpandBars,\n generateDrawBar,\n generateGetBarPoints,\n isWithinBar,\n};\n","import { CLASS } from './class';\nimport { isUndefined } from './util';\n\nconst getShapeIndices = function (typeFilter) {\n let $$ = this, config = $$.config,\n indices = {}, i = 0, j, k;\n $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$)).forEach((d) => {\n for (j = 0; j < config.data_groups.length; j++) {\n if (config.data_groups[j].indexOf(d.id) < 0) { continue; }\n for (k = 0; k < config.data_groups[j].length; k++) {\n if (config.data_groups[j][k] in indices) {\n indices[d.id] = indices[config.data_groups[j][k]];\n break;\n }\n }\n }\n if (isUndefined(indices[d.id])) { indices[d.id] = i++; }\n });\n indices.__max__ = i - 1;\n return indices;\n};\nconst getShapeX = function (offset, targetsNum, indices, isSub) {\n let $$ = this, scale = isSub ? $$.subX : $$.x;\n return function (d) {\n const index = d.id in indices ? indices[d.id] : 0;\n return d.x || d.x === 0 ? scale(d.x) - offset * (targetsNum / 2 - index) : 0;\n };\n};\nconst getShapeY = function (isSub) {\n const $$ = this;\n return function (d) {\n const scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id);\n return scale(d.value);\n };\n};\nconst getShapeOffset = function (typeFilter, indices, isSub) {\n let $$ = this,\n targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))),\n targetIds = targets.map((t) => { return t.id; });\n return function (d, i) {\n let scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id),\n y0 = scale(0), offset = y0;\n targets.forEach((t) => {\n const values = $$.isStepType(d) ? $$.convertValuesToStep(t.values) : t.values;\n if (t.id === d.id || indices[t.id] !== indices[d.id]) { return; }\n if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id)) {\n // check if the x values line up\n if (typeof values[i] === 'undefined' || +values[i].x !== +d.x) { // \"+\" for timeseries\n // if not, try to find the value that does line up\n i = -1;\n values.forEach((v, j) => {\n if (v.x === d.x) {\n i = j;\n }\n });\n }\n if (i in values && values[i].value * d.value >= 0) {\n offset += scale(values[i].value) - y0;\n }\n }\n });\n return offset;\n };\n};\nconst isWithinShape = function (that, d) {\n let $$ = this,\n shape = $$.d3.select(that), isWithin;\n if (!$$.isTargetToShow(d.id)) {\n isWithin = false;\n }\n else if (that.nodeName === 'circle') {\n isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScale(d.id)(d.value)) : $$.isWithinCircle(that, $$.pointSelectR(d) * 1.5);\n }\n else if (that.nodeName === 'path') {\n isWithin = shape.classed(CLASS.bar) ? $$.isWithinBar(that) : true;\n }\n return isWithin;\n};\n\n\nconst getInterpolate = function (d) {\n let $$ = this,\n interpolation = $$.isInterpolationType($$.config.spline_interpolation_type) ? $$.config.spline_interpolation_type : 'cardinal';\n return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? $$.config.line_step_type : 'linear';\n};\n\nexport {\n getShapeIndices,\n getShapeX,\n getShapeY,\n getShapeOffset,\n isWithinShape,\n getInterpolate,\n};\n","import { CLASS } from './class';\nimport { isDefined, isUndefined, isValue, isFunction } from './util';\n\nconst initLine = function () {\n const $$ = this;\n $$.main.select('.' + CLASS.chart).append('g')\n .attr('class', CLASS.chartLines);\n};\nconst updateTargetsForLine = function (targets) {\n let $$ = this, config = $$.config,\n mainLineUpdate, mainLineEnter,\n classChartLine = $$.classChartLine.bind($$),\n classLines = $$.classLines.bind($$),\n classAreas = $$.classAreas.bind($$),\n classCircles = $$.classCircles.bind($$),\n classFocus = $$.classFocus.bind($$);\n mainLineUpdate = $$.main.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine)\n .data(targets)\n .attr('class', (d) => { return classChartLine(d) + classFocus(d); });\n mainLineEnter = mainLineUpdate.enter().append('g')\n .attr('class', classChartLine)\n .style('opacity', 0)\n .style('pointer-events', 'none');\n // Lines for each data\n mainLineEnter.append('g')\n .attr('class', classLines);\n // Areas\n mainLineEnter.append('g')\n .attr('class', classAreas);\n // Circles for each data point on lines\n mainLineEnter.append('g')\n .attr('class', (d) => { return $$.generateClass(CLASS.selectedCircles, d.id); });\n mainLineEnter.append('g')\n .attr('class', classCircles)\n .style('cursor', (d) => { return config.data_selection_isselectable(d) ? 'pointer' : null; });\n // Update date for selected circles\n targets.forEach((t) => {\n $$.main.selectAll('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS.selectedCircle).each((d) => {\n d.value = t.values[d.index].value;\n });\n });\n // MEMO: can not keep same color...\n // mainLineUpdate.exit().remove();\n};\nconst updateLine = function (durationForExit) {\n const $$ = this;\n $$.mainLine = $$.main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line)\n .data($$.lineData.bind($$));\n $$.mainLine.enter().append('path')\n .attr('class', $$.classLine.bind($$))\n .style('stroke', $$.color);\n $$.mainLine\n .style('opacity', $$.initialOpacity.bind($$))\n .style('shape-rendering', (d) => { return $$.isStepType(d) ? 'crispEdges' : ''; })\n .attr('transform', null);\n $$.mainLine.exit().transition().duration(durationForExit)\n .style('opacity', 0)\n .remove();\n};\nconst redrawLine = function (drawLine, withTransition) {\n return [\n (withTransition ? this.mainLine.transition(Math.random().toString()) : this.mainLine)\n .attr('d', drawLine)\n .style('stroke', this.color)\n .style('opacity', 1),\n ];\n};\nconst generateDrawLine = function (lineIndices, isSub) {\n let $$ = this, config = $$.config,\n line = $$.d3.svg.line(),\n getPoints = $$.generateGetLinePoints(lineIndices, isSub),\n yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale,\n xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); },\n yValue = function (d, i) {\n return config.data_groups.length > 0 ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)(d.value);\n };\n\n line = config.axis_rotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue);\n if (!config.line_connectNull) { line = line.defined((d) => { return d.value != null; }); }\n return function (d) {\n let values = config.line_connectNull ? $$.filterRemoveNull(d.values) : d.values,\n x = isSub ? $$.x : $$.subX, y = yScaleGetter.call($$, d.id), x0 = 0, y0 = 0, path;\n if ($$.isLineType(d)) {\n if (config.data_regions[d.id]) {\n path = $$.lineWithRegions(values, x, y, config.data_regions[d.id]);\n } else {\n if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); }\n path = line.interpolate($$.getInterpolate(d))(values);\n }\n } else {\n if (values[0]) {\n x0 = x(values[0].x);\n y0 = y(values[0].value);\n }\n path = config.axis_rotated ? 'M ' + y0 + ' ' + x0 : 'M ' + x0 + ' ' + y0;\n }\n return path ? path : 'M 0 0';\n };\n};\nconst generateGetLinePoints = function (lineIndices, isSub) { // partial duplication of generateGetBarPoints\n let $$ = this, config = $$.config,\n lineTargetsNum = lineIndices.__max__ + 1,\n x = $$.getShapeX(0, lineTargetsNum, lineIndices, !!isSub),\n y = $$.getShapeY(!!isSub),\n lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, !!isSub),\n yScale = isSub ? $$.getSubYScale : $$.getYScale;\n return function (d, i) {\n let y0 = yScale.call($$, d.id)(0),\n offset = lineOffset(d, i) || y0, // offset is for stacked area chart\n posX = x(d), posY = y(d);\n // fix posY not to overflow opposite quadrant\n if (config.axis_rotated) {\n if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; }\n }\n // 1 point that marks the line position\n return [\n [posX, posY - (y0 - offset)],\n [posX, posY - (y0 - offset)], // needed for compatibility\n [posX, posY - (y0 - offset)], // needed for compatibility\n [posX, posY - (y0 - offset)], // needed for compatibility\n ];\n };\n};\n\n\nconst lineWithRegions = function (d, x, y, _regions) {\n let $$ = this, config = $$.config,\n prev = -1, i, j,\n s = 'M', sWithRegion,\n xp, yp, dx, dy, dd, diff, diffx2,\n xOffset = $$.isCategorized() ? 0.5 : 0,\n xValue, yValue,\n regions = [];\n\n function isWithinRegions(x, regions) {\n let i;\n for (i = 0; i < regions.length; i++) {\n if (regions[i].start < x && x <= regions[i].end) { return true; }\n }\n return false;\n }\n\n // Check start/end of regions\n if (isDefined(_regions)) {\n for (i = 0; i < _regions.length; i++) {\n regions[i] = {};\n if (isUndefined(_regions[i].start)) {\n regions[i].start = d[0].x;\n } else {\n regions[i].start = $$.isTimeSeries() ? $$.parseDate(_regions[i].start) : _regions[i].start;\n }\n if (isUndefined(_regions[i].end)) {\n regions[i].end = d[d.length - 1].x;\n } else {\n regions[i].end = $$.isTimeSeries() ? $$.parseDate(_regions[i].end) : _regions[i].end;\n }\n }\n }\n\n // Set scales\n xValue = config.axis_rotated ? function (d) { return y(d.value); } : function (d) { return x(d.x); };\n yValue = config.axis_rotated ? function (d) { return x(d.x); } : function (d) { return y(d.value); };\n\n // Define svg generator function for region\n function generateM(points) {\n return 'M' + points[0][0] + ' ' + points[0][1] + ' ' + points[1][0] + ' ' + points[1][1];\n }\n if ($$.isTimeSeries()) {\n sWithRegion = function (d0, d1, j, diff) {\n let x0 = d0.x.getTime(), x_diff = d1.x - d0.x,\n xv0 = new Date(x0 + x_diff * j),\n xv1 = new Date(x0 + x_diff * (j + diff)),\n points;\n if (config.axis_rotated) {\n points = [[y(yp(j)), x(xv0)], [y(yp(j + diff)), x(xv1)]];\n } else {\n points = [[x(xv0), y(yp(j))], [x(xv1), y(yp(j + diff))]];\n }\n return generateM(points);\n };\n } else {\n sWithRegion = function (d0, d1, j, diff) {\n let points;\n if (config.axis_rotated) {\n points = [[y(yp(j), true), x(xp(j))], [y(yp(j + diff), true), x(xp(j + diff))]];\n } else {\n points = [[x(xp(j), true), y(yp(j))], [x(xp(j + diff), true), y(yp(j + diff))]];\n }\n return generateM(points);\n };\n }\n\n // Generate\n for (i = 0; i < d.length; i++) {\n // Draw as normal\n if (isUndefined(regions) || !isWithinRegions(d[i].x, regions)) {\n s += ' ' + xValue(d[i]) + ' ' + yValue(d[i]);\n }\n // Draw with region // TODO: Fix for horizotal charts\n else {\n xp = $$.getScale(d[i - 1].x + xOffset, d[i].x + xOffset, $$.isTimeSeries());\n yp = $$.getScale(d[i - 1].value, d[i].value);\n\n dx = x(d[i].x) - x(d[i - 1].x);\n dy = y(d[i].value) - y(d[i - 1].value);\n dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));\n diff = 2 / dd;\n diffx2 = diff * 2;\n\n for (j = diff; j <= 1; j += diffx2) {\n s += sWithRegion(d[i - 1], d[i], j, diff);\n }\n }\n prev = d[i].x;\n }\n\n return s;\n};\n\n\nconst updateArea = function (durationForExit) {\n let $$ = this, d3 = $$.d3;\n $$.mainArea = $$.main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area)\n .data($$.lineData.bind($$));\n $$.mainArea.enter().append('path')\n .attr('class', $$.classArea.bind($$))\n .style('fill', $$.color)\n .style('opacity', function () { $$.orgAreaOpacity = +d3.select(this).style('opacity'); return 0; });\n $$.mainArea\n .style('opacity', $$.orgAreaOpacity);\n $$.mainArea.exit().transition().duration(durationForExit)\n .style('opacity', 0)\n .remove();\n};\nconst redrawArea = function (drawArea, withTransition) {\n return [\n (withTransition ? this.mainArea.transition(Math.random().toString()) : this.mainArea)\n .attr('d', drawArea)\n .style('fill', this.color)\n .style('opacity', this.orgAreaOpacity),\n ];\n};\nconst generateDrawArea = function (areaIndices, isSub) {\n let $$ = this, config = $$.config, area = $$.d3.svg.area(),\n getPoints = $$.generateGetAreaPoints(areaIndices, isSub),\n yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale,\n xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); },\n value0 = function (d, i) {\n return config.data_groups.length > 0 ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)($$.getAreaBaseValue(d.id));\n },\n value1 = function (d, i) {\n return config.data_groups.length > 0 ? getPoints(d, i)[1][1] : yScaleGetter.call($$, d.id)(d.value);\n };\n\n area = config.axis_rotated ? area.x0(value0).x1(value1).y(xValue) : area.x(xValue).y0(config.area_above ? 0 : value0).y1(value1);\n if (!config.line_connectNull) {\n area = area.defined((d) => { return d.value !== null; });\n }\n\n return function (d) {\n let values = config.line_connectNull ? $$.filterRemoveNull(d.values) : d.values,\n x0 = 0, y0 = 0, path;\n if ($$.isAreaType(d)) {\n if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); }\n path = area.interpolate($$.getInterpolate(d))(values);\n } else {\n if (values[0]) {\n x0 = $$.x(values[0].x);\n y0 = $$.getYScale(d.id)(values[0].value);\n }\n path = config.axis_rotated ? 'M ' + y0 + ' ' + x0 : 'M ' + x0 + ' ' + y0;\n }\n return path ? path : 'M 0 0';\n };\n};\nconst getAreaBaseValue = function () {\n return 0;\n};\nconst generateGetAreaPoints = function (areaIndices, isSub) { // partial duplication of generateGetBarPoints\n let $$ = this, config = $$.config,\n areaTargetsNum = areaIndices.__max__ + 1,\n x = $$.getShapeX(0, areaTargetsNum, areaIndices, !!isSub),\n y = $$.getShapeY(!!isSub),\n areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, !!isSub),\n yScale = isSub ? $$.getSubYScale : $$.getYScale;\n return function (d, i) {\n let y0 = yScale.call($$, d.id)(0),\n offset = areaOffset(d, i) || y0, // offset is for stacked area chart\n posX = x(d), posY = y(d);\n // fix posY not to overflow opposite quadrant\n if (config.axis_rotated) {\n if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; }\n }\n // 1 point that marks the area position\n return [\n [posX, offset],\n [posX, posY - (y0 - offset)],\n [posX, posY - (y0 - offset)], // needed for compatibility\n [posX, offset], // needed for compatibility\n ];\n };\n};\n\n\nconst updateCircle = function () {\n const $$ = this;\n $$.mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle)\n .data($$.lineOrScatterData.bind($$));\n $$.mainCircle.enter().append('circle')\n .attr('class', $$.classCircle.bind($$))\n .attr('r', $$.pointR.bind($$))\n .style('fill', $$.color);\n $$.mainCircle\n .style('opacity', $$.initialOpacityForCircle.bind($$));\n $$.mainCircle.exit().remove();\n};\nconst redrawCircle = function (cx, cy, withTransition) {\n const selectedCircles = this.main.selectAll('.' + CLASS.selectedCircle);\n return [\n (withTransition ? this.mainCircle.transition(Math.random().toString()) : this.mainCircle)\n .style('opacity', this.opacityForCircle.bind(this))\n .style('fill', this.color)\n .attr('cx', cx)\n .attr('cy', cy),\n (withTransition ? selectedCircles.transition(Math.random().toString()) : selectedCircles)\n .attr('cx', cx)\n .attr('cy', cy),\n ];\n};\nconst circleX = function (d) {\n return d.x || d.x === 0 ? this.x(d.x) : null;\n};\nconst updateCircleY = function () {\n let $$ = this, lineIndices, getPoints;\n if ($$.config.data_groups.length > 0) {\n lineIndices = $$.getShapeIndices($$.isLineType),\n getPoints = $$.generateGetLinePoints(lineIndices);\n $$.circleY = function (d, i) {\n return getPoints(d, i)[0][1];\n };\n } else {\n $$.circleY = function (d) {\n return $$.getYScale(d.id)(d.value);\n };\n }\n};\nconst getCircles = function (i, id) {\n const $$ = this;\n return (id ? $$.main.selectAll('.' + CLASS.circles + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.circle + (isValue(i) ? '-' + i : ''));\n};\nconst expandCircles = function (i, id, reset) {\n let $$ = this,\n r = $$.pointExpandedR.bind($$);\n if (reset) { $$.unexpandCircles(); }\n $$.getCircles(i, id)\n .classed(CLASS.EXPANDED, true)\n .attr('r', r);\n};\nconst unexpandCircles = function (i) {\n let $$ = this,\n r = $$.pointR.bind($$);\n $$.getCircles(i)\n .filter(function () { return $$.d3.select(this).classed(CLASS.EXPANDED); })\n .classed(CLASS.EXPANDED, false)\n .attr('r', r);\n};\nconst pointR = function (d) {\n let $$ = this, config = $$.config;\n return $$.isStepType(d) ? 0 : (isFunction(config.point_r) ? config.point_r(d) : config.point_r);\n};\nconst pointExpandedR = function (d) {\n let $$ = this, config = $$.config;\n return config.point_focus_expand_enabled ? (config.point_focus_expand_r ? config.point_focus_expand_r : $$.pointR(d) * 1.75) : $$.pointR(d);\n};\nconst pointSelectR = function (d) {\n let $$ = this, config = $$.config;\n return isFunction(config.point_select_r) ? config.point_select_r(d) : ((config.point_select_r) ? config.point_select_r : $$.pointR(d) * 4);\n};\nconst isWithinCircle = function (that, r) {\n let d3 = this.d3,\n mouse = d3.mouse(that), d3_this = d3.select(that),\n cx = +d3_this.attr('cx'), cy = +d3_this.attr('cy');\n return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < r;\n};\nconst isWithinStep = function (that, y) {\n return Math.abs(y - this.d3.mouse(that)[1]) < 30;\n};\n\nexport {\n initLine,\n updateTargetsForLine,\n updateLine,\n redrawLine,\n generateDrawLine,\n generateGetLinePoints,\n lineWithRegions,\n updateArea,\n redrawArea,\n generateDrawArea,\n getAreaBaseValue,\n generateGetAreaPoints,\n updateCircle,\n redrawCircle,\n circleX,\n updateCircleY,\n getCircles,\n expandCircles,\n unexpandCircles,\n pointR,\n pointExpandedR,\n pointSelectR,\n isWithinCircle,\n isWithinStep,\n};\n","import { isValue, ceil10 } from './util';\nimport { CLASS } from './class';\n\nconst getCurrentWidth = function () {\n let $$ = this, config = $$.config;\n return config.size_width ? config.size_width : $$.getParentWidth();\n};\nconst getCurrentHeight = function () {\n let $$ = this, config = $$.config,\n h = config.size_height ? config.size_height : $$.getParentHeight();\n return h > 0 ? h : 320 / ($$.hasType('gauge') && !config.gauge_fullCircle ? 2 : 1);\n};\nconst getCurrentPaddingTop = function () {\n let $$ = this,\n config = $$.config,\n padding = isValue(config.padding_top) ? config.padding_top : 0;\n if ($$.title && $$.title.node()) {\n padding += $$.getTitlePadding();\n }\n return padding;\n};\nconst getCurrentPaddingBottom = function () {\n const config = this.config;\n return isValue(config.padding_bottom) ? config.padding_bottom : 0;\n};\nconst getCurrentPaddingLeft = function (withoutRecompute) {\n let $$ = this, config = $$.config;\n if (isValue(config.padding_left)) {\n return config.padding_left;\n } else if (config.axis_rotated) {\n return !config.axis_x_show ? 1 : Math.max(ceil10($$.getAxisWidthByAxisId('x', withoutRecompute)), 40);\n } else if (!config.axis_y_show || config.axis_y_inner) { // && !config.axis_rotated\n return $$.axis.getYAxisLabelPosition().isOuter ? 30 : 1;\n } else {\n return ceil10($$.getAxisWidthByAxisId('y', withoutRecompute));\n }\n};\nconst getCurrentPaddingRight = function () {\n let $$ = this, config = $$.config,\n defaultPadding = 10, legendWidthOnRight = $$.isLegendRight ? $$.getLegendWidth() + 20 : 0;\n if (isValue(config.padding_right)) {\n return config.padding_right + 1; // 1 is needed not to hide tick line\n } else if (config.axis_rotated) {\n return defaultPadding + legendWidthOnRight;\n } else if (!config.axis_y2_show || config.axis_y2_inner) { // && !config.axis_rotated\n return 2 + legendWidthOnRight + ($$.axis.getY2AxisLabelPosition().isOuter ? 20 : 0);\n } else {\n return ceil10($$.getAxisWidthByAxisId('y2')) + legendWidthOnRight;\n }\n};\n\nconst getParentRectValue = function (key) {\n let parent = this.selectChart.node(), v;\n while (parent && parent.tagName !== 'BODY') {\n try {\n v = parent.getBoundingClientRect()[key];\n } catch (e) {\n if (key === 'width') {\n // In IE in certain cases getBoundingClientRect\n // will cause an \"unspecified error\"\n v = parent.offsetWidth;\n }\n }\n if (v) {\n break;\n }\n parent = parent.parentNode;\n }\n return v;\n};\nconst getParentWidth = function () {\n return this.getParentRectValue('width');\n};\nconst getParentHeight = function () {\n const h = this.selectChart.style('height');\n return h.indexOf('px') > 0 ? +h.replace('px', '') : 0;\n};\n\n\nconst getSvgLeft = function (withoutRecompute) {\n let $$ = this, config = $$.config,\n hasLeftAxisRect = config.axis_rotated || (!config.axis_rotated && !config.axis_y_inner),\n leftAxisClass = config.axis_rotated ? CLASS.axisX : CLASS.axisY,\n leftAxis = $$.main.select('.' + leftAxisClass).node(),\n svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : { right: 0 },\n chartRect = $$.selectChart.node().getBoundingClientRect(),\n hasArc = $$.hasArcType(),\n svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute));\n return svgLeft > 0 ? svgLeft : 0;\n};\n\n\nconst getAxisWidthByAxisId = function (id, withoutRecompute) {\n let $$ = this, position = $$.axis.getLabelPositionById(id);\n return $$.axis.getMaxTickWidth(id, withoutRecompute) + (position.isInner ? 20 : 40);\n};\nconst getHorizontalAxisHeight = function (axisId) {\n let $$ = this, config = $$.config, h = 30;\n if (axisId === 'x' && !config.axis_x_show) { return 8; }\n if (axisId === 'x' && config.axis_x_height) { return config.axis_x_height; }\n if (axisId === 'y' && !config.axis_y_show) {\n return config.legend_show && !$$.isLegendRight && !$$.isLegendInset ? 10 : 1;\n }\n if (axisId === 'y2' && !config.axis_y2_show) { return $$.rotated_padding_top; }\n // Calculate x axis height when tick rotated\n if (axisId === 'x' && !config.axis_rotated && config.axis_x_tick_rotate) {\n h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - config.axis_x_tick_rotate) / 180);\n }\n // Calculate y axis height when tick rotated\n if (axisId === 'y' && config.axis_rotated && config.axis_y_tick_rotate) {\n h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - config.axis_y_tick_rotate) / 180);\n }\n return h + ($$.axis.getLabelPositionById(axisId).isInner ? 0 : 10) + (axisId === 'y2' ? -10 : 0);\n};\n\nconst getEventRectWidth = function () {\n return Math.max(0, this.xAxis.tickInterval());\n};\n\nexport {\n getCurrentWidth,\n getCurrentHeight,\n getCurrentPaddingTop,\n getCurrentPaddingBottom,\n getCurrentPaddingLeft,\n getCurrentPaddingRight,\n getParentRectValue,\n getParentWidth,\n getParentHeight,\n getSvgLeft,\n getAxisWidthByAxisId,\n getHorizontalAxisHeight,\n getEventRectWidth,\n};\n","import { CLASS } from './class';\nimport { isFunction } from './util';\n\nconst initBrush = function () {\n let $$ = this, d3 = $$.d3;\n $$.brush = d3.svg.brush().on('brush', () => { $$.redrawForBrush(); });\n $$.brush.update = function () {\n if ($$.context) { $$.context.select('.' + CLASS.brush).call(this); }\n return this;\n };\n $$.brush.scale = function (scale) {\n return $$.config.axis_rotated ? this.y(scale) : this.x(scale);\n };\n};\nconst initSubchart = function () {\n let $$ = this, config = $$.config,\n context = $$.context = $$.svg.append('g').attr('transform', $$.getTranslate('context')),\n visibility = config.subchart_show ? 'visible' : 'hidden';\n\n context.style('visibility', visibility);\n\n // Define g for chart area\n context.append('g')\n .attr('clip-path', $$.clipPathForSubchart)\n .attr('class', CLASS.chart);\n\n // Define g for bar chart area\n context.select('.' + CLASS.chart).append('g')\n .attr('class', CLASS.chartBars);\n\n // Define g for line chart area\n context.select('.' + CLASS.chart).append('g')\n .attr('class', CLASS.chartLines);\n\n // Add extent rect for Brush\n context.append('g')\n .attr('clip-path', $$.clipPath)\n .attr('class', CLASS.brush)\n .call($$.brush);\n\n // ATTENTION: This must be called AFTER chart added\n // Add Axis\n $$.axes.subx = context.append('g')\n .attr('class', CLASS.axisX)\n .attr('transform', $$.getTranslate('subx'))\n .attr('clip-path', config.axis_rotated ? '' : $$.clipPathForXAxis)\n .style('visibility', config.subchart_axis_x_show ? visibility : 'hidden');\n};\nconst updateTargetsForSubchart = function (targets) {\n let $$ = this, context = $$.context, config = $$.config,\n contextLineEnter, contextLineUpdate, contextBarEnter, contextBarUpdate,\n classChartBar = $$.classChartBar.bind($$),\n classBars = $$.classBars.bind($$),\n classChartLine = $$.classChartLine.bind($$),\n classLines = $$.classLines.bind($$),\n classAreas = $$.classAreas.bind($$);\n\n if (config.subchart_show) {\n // -- Bar --//\n contextBarUpdate = context.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar)\n .data(targets)\n .attr('class', classChartBar);\n contextBarEnter = contextBarUpdate.enter().append('g')\n .style('opacity', 0)\n .attr('class', classChartBar);\n // Bars for each data\n contextBarEnter.append('g')\n .attr('class', classBars);\n\n // -- Line --//\n contextLineUpdate = context.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine)\n .data(targets)\n .attr('class', classChartLine);\n contextLineEnter = contextLineUpdate.enter().append('g')\n .style('opacity', 0)\n .attr('class', classChartLine);\n // Lines for each data\n contextLineEnter.append('g')\n .attr('class', classLines);\n // Area\n contextLineEnter.append('g')\n .attr('class', classAreas);\n\n // -- Brush --//\n context.selectAll('.' + CLASS.brush + ' rect')\n .attr(config.axis_rotated ? 'width' : 'height', config.axis_rotated ? $$.width2 : $$.height2);\n }\n};\nconst updateBarForSubchart = function (durationForExit) {\n const $$ = this;\n $$.contextBar = $$.context.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar)\n .data($$.barData.bind($$));\n $$.contextBar.enter().append('path')\n .attr('class', $$.classBar.bind($$))\n .style('stroke', 'none')\n .style('fill', $$.color);\n $$.contextBar\n .style('opacity', $$.initialOpacity.bind($$));\n $$.contextBar.exit().transition().duration(durationForExit)\n .style('opacity', 0)\n .remove();\n};\nconst redrawBarForSubchart = function (drawBarOnSub, withTransition, duration) {\n (withTransition ? this.contextBar.transition(Math.random().toString()).duration(duration) : this.contextBar)\n .attr('d', drawBarOnSub)\n .style('opacity', 1);\n};\nconst updateLineForSubchart = function (durationForExit) {\n const $$ = this;\n $$.contextLine = $$.context.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line)\n .data($$.lineData.bind($$));\n $$.contextLine.enter().append('path')\n .attr('class', $$.classLine.bind($$))\n .style('stroke', $$.color);\n $$.contextLine\n .style('opacity', $$.initialOpacity.bind($$));\n $$.contextLine.exit().transition().duration(durationForExit)\n .style('opacity', 0)\n .remove();\n};\nconst redrawLineForSubchart = function (drawLineOnSub, withTransition, duration) {\n (withTransition ? this.contextLine.transition(Math.random().toString()).duration(duration) : this.contextLine)\n .attr('d', drawLineOnSub)\n .style('opacity', 1);\n};\nconst updateAreaForSubchart = function (durationForExit) {\n let $$ = this, d3 = $$.d3;\n $$.contextArea = $$.context.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area)\n .data($$.lineData.bind($$));\n $$.contextArea.enter().append('path')\n .attr('class', $$.classArea.bind($$))\n .style('fill', $$.color)\n .style('opacity', function () { $$.orgAreaOpacity = +d3.select(this).style('opacity'); return 0; });\n $$.contextArea\n .style('opacity', 0);\n $$.contextArea.exit().transition().duration(durationForExit)\n .style('opacity', 0)\n .remove();\n};\nconst redrawAreaForSubchart = function (drawAreaOnSub, withTransition, duration) {\n (withTransition ? this.contextArea.transition(Math.random().toString()).duration(duration) : this.contextArea)\n .attr('d', drawAreaOnSub)\n .style('fill', this.color)\n .style('opacity', this.orgAreaOpacity);\n};\nconst redrawSubchart = function (withSubchart, transitions, duration, durationForExit, areaIndices, barIndices, lineIndices) {\n let $$ = this, d3 = $$.d3, config = $$.config,\n drawAreaOnSub, drawBarOnSub, drawLineOnSub;\n\n $$.context.style('visibility', config.subchart_show ? 'visible' : 'hidden');\n\n // subchart\n if (config.subchart_show) {\n // reflect main chart to extent on subchart if zoomed\n if (d3.event && d3.event.type === 'zoom') {\n $$.brush.extent($$.x.orgDomain()).update();\n }\n // update subchart elements if needed\n if (withSubchart) {\n // extent rect\n if (!$$.brush.empty()) {\n $$.brush.extent($$.x.orgDomain()).update();\n }\n // setup drawer - MEMO: this must be called after axis updated\n drawAreaOnSub = $$.generateDrawArea(areaIndices, true);\n drawBarOnSub = $$.generateDrawBar(barIndices, true);\n drawLineOnSub = $$.generateDrawLine(lineIndices, true);\n\n $$.updateBarForSubchart(duration);\n $$.updateLineForSubchart(duration);\n $$.updateAreaForSubchart(duration);\n\n $$.redrawBarForSubchart(drawBarOnSub, duration, duration);\n $$.redrawLineForSubchart(drawLineOnSub, duration, duration);\n $$.redrawAreaForSubchart(drawAreaOnSub, duration, duration);\n }\n }\n};\nconst redrawForBrush = function () {\n let $$ = this, x = $$.x;\n $$.redraw({\n withTransition: false,\n withY: $$.config.zoom_rescale,\n withSubchart: false,\n withUpdateXDomain: true,\n withDimension: false,\n });\n $$.config.subchart_onbrush.call($$.api, x.orgDomain());\n};\nconst transformContext = function (withTransition, transitions) {\n let $$ = this, subXAxis;\n if (transitions && transitions.axisSubX) {\n subXAxis = transitions.axisSubX;\n } else {\n subXAxis = $$.context.select('.' + CLASS.axisX);\n if (withTransition) { subXAxis = subXAxis.transition(); }\n }\n $$.context.attr('transform', $$.getTranslate('context'));\n subXAxis.attr('transform', $$.getTranslate('subx'));\n};\nconst getDefaultExtent = function () {\n let $$ = this, config = $$.config,\n extent = isFunction(config.axis_x_extent) ? config.axis_x_extent($$.getXDomain($$.data.targets)) : config.axis_x_extent;\n if ($$.isTimeSeries()) {\n extent = [$$.parseDate(extent[0]), $$.parseDate(extent[1])];\n }\n return extent;\n};\n\nexport {\n initBrush,\n initSubchart,\n updateTargetsForSubchart,\n updateBarForSubchart,\n redrawBarForSubchart,\n updateLineForSubchart,\n redrawLineForSubchart,\n updateAreaForSubchart,\n redrawAreaForSubchart,\n redrawSubchart,\n redrawForBrush,\n transformContext,\n getDefaultExtent,\n};\n","import { CLASS } from './class';\n\nconst initText = function () {\n const $$ = this;\n $$.main.select('.' + CLASS.chart).append('g')\n .attr('class', CLASS.chartTexts);\n $$.mainText = $$.d3.selectAll([]);\n};\nconst updateTargetsForText = function (targets) {\n let $$ = this, mainTextUpdate, mainTextEnter,\n classChartText = $$.classChartText.bind($$),\n classTexts = $$.classTexts.bind($$),\n classFocus = $$.classFocus.bind($$);\n mainTextUpdate = $$.main.select('.' + CLASS.chartTexts).selectAll('.' + CLASS.chartText)\n .data(targets)\n .attr('class', (d) => { return classChartText(d) + classFocus(d); });\n mainTextEnter = mainTextUpdate.enter().append('g')\n .attr('class', classChartText)\n .style('opacity', 0)\n .style('pointer-events', 'none');\n mainTextEnter.append('g')\n .attr('class', classTexts);\n};\nconst updateText = function (durationForExit) {\n let $$ = this, config = $$.config,\n barOrLineData = $$.barOrLineData.bind($$),\n classText = $$.classText.bind($$);\n $$.mainText = $$.main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text)\n .data(barOrLineData);\n $$.mainText.enter().append('text')\n .attr('class', classText)\n .attr('text-anchor', (d) => { return config.axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; })\n .style('stroke', 'none')\n .style('fill', (d) => { return $$.color(d); })\n .style('fill-opacity', 0);\n $$.mainText\n .text((d, i, j) => { return $$.dataLabelFormat(d.id)(d.value, d.id, i, j); });\n $$.mainText.exit()\n .transition().duration(durationForExit)\n .style('fill-opacity', 0)\n .remove();\n};\nconst redrawText = function (xForText, yForText, forFlow, withTransition) {\n return [\n (withTransition ? this.mainText.transition() : this.mainText)\n .attr('x', xForText)\n .attr('y', yForText)\n .style('fill', this.color)\n .style('fill-opacity', forFlow ? 0 : this.opacityForText.bind(this)),\n ];\n};\nconst getTextRect = function (text, cls, element) {\n let dummy = this.d3.select('body').append('div').classed('c3', true),\n svg = dummy.append('svg').style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0),\n font = this.d3.select(element).style('font'),\n rect;\n svg.selectAll('.dummy')\n .data([text])\n .enter().append('text')\n .classed(cls ? cls : '', true)\n .style('font', font)\n .text(text)\n .each(function () { rect = this.getBoundingClientRect(); });\n dummy.remove();\n return rect;\n};\nconst generateXYForText = function (areaIndices, barIndices, lineIndices, forX) {\n let $$ = this,\n getAreaPoints = $$.generateGetAreaPoints(areaIndices, false),\n getBarPoints = $$.generateGetBarPoints(barIndices, false),\n getLinePoints = $$.generateGetLinePoints(lineIndices, false),\n getter = forX ? $$.getXForText : $$.getYForText;\n return function (d, i) {\n const getPoints = $$.isAreaType(d) ? getAreaPoints : $$.isBarType(d) ? getBarPoints : getLinePoints;\n return getter.call($$, getPoints(d, i), d, this);\n };\n};\nconst getXForText = function (points, d, textElement) {\n let $$ = this,\n box = textElement.getBoundingClientRect(), xPos, padding;\n if ($$.config.axis_rotated) {\n padding = $$.isBarType(d) ? 4 : 6;\n xPos = points[2][1] + padding * (d.value < 0 ? -1 : 1);\n } else {\n xPos = $$.hasType('bar') ? (points[2][0] + points[0][0]) / 2 : points[0][0];\n }\n // show labels regardless of the domain if value is null\n if (d.value === null) {\n if (xPos > $$.width) {\n xPos = $$.width - box.width;\n } else if (xPos < 0) {\n xPos = 4;\n }\n }\n return xPos;\n};\nconst getYForText = function (points, d, textElement) {\n let $$ = this,\n box = textElement.getBoundingClientRect(),\n yPos;\n if ($$.config.axis_rotated) {\n yPos = (points[0][0] + points[2][0] + box.height * 0.6) / 2;\n } else {\n yPos = points[2][1];\n if (d.value < 0 || (d.value === 0 && !$$.hasPositiveValue)) {\n yPos += box.height;\n if ($$.isBarType(d) && $$.isSafari()) {\n yPos -= 3;\n }\n else if (!$$.isBarType(d) && $$.isChrome()) {\n yPos += 3;\n }\n } else {\n yPos += $$.isBarType(d) ? -3 : -6;\n }\n }\n // show labels regardless of the domain if value is null\n if (d.value === null && !$$.config.axis_rotated) {\n if (yPos < box.height) {\n yPos = box.height;\n } else if (yPos > this.height) {\n yPos = this.height - 4;\n }\n }\n return yPos;\n};\n\nexport {\n initText,\n updateTargetsForText,\n updateText,\n redrawText,\n getTextRect,\n generateXYForText,\n getXForText,\n getYForText,\n};\n","const initTitle = function () {\n const $$ = this;\n $$.title = $$.svg.append('text')\n .text($$.config.title_text)\n .attr('class', $$.CLASS.title);\n};\nconst redrawTitle = function () {\n const $$ = this;\n $$.title\n .attr('x', $$.xForTitle.bind($$))\n .attr('y', $$.yForTitle.bind($$));\n};\nconst xForTitle = function () {\n let $$ = this, config = $$.config, position = config.title_position || 'left', x;\n if (position.indexOf('right') >= 0) {\n x = $$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width - config.title_padding.right;\n } else if (position.indexOf('center') >= 0) {\n x = ($$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width) / 2;\n } else { // left\n x = config.title_padding.left;\n }\n return x;\n};\nconst yForTitle = function () {\n const $$ = this;\n return $$.config.title_padding.top + $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).height;\n};\nconst getTitlePadding = function () {\n const $$ = this;\n return $$.yForTitle() + $$.config.title_padding.bottom;\n};\n\nexport {\n initTitle,\n redrawTitle,\n xForTitle,\n yForTitle,\n getTitlePadding,\n};\n","import { isString, sanitise, isValue } from './util';\nimport { CLASS } from './class';\nimport { c3_chart_internal_fn } from './index';\n\nconst initTooltip = function () {\n let $$ = this, config = $$.config, i;\n $$.tooltip = $$.selectChart\n .style('position', 'relative')\n .append('div')\n .attr('class', CLASS.tooltipContainer)\n .style('position', 'absolute')\n .style('pointer-events', 'none')\n .style('display', 'none');\n // Show tooltip if needed\n if (config.tooltip_init_show) {\n if ($$.isTimeSeries() && isString(config.tooltip_init_x)) {\n config.tooltip_init_x = $$.parseDate(config.tooltip_init_x);\n for (i = 0; i < $$.data.targets[0].values.length; i++) {\n if (($$.data.targets[0].values[i].x - config.tooltip_init_x) === 0) { break; }\n }\n config.tooltip_init_x = i;\n }\n $$.tooltip.html(config.tooltip_contents.call($$, $$.data.targets.map((d) => {\n return $$.addName(d.values[config.tooltip_init_x]);\n }), $$.axis.getXAxisTickFormat(), $$.getYFormat($$.hasArcType()), $$.color));\n $$.tooltip.style('top', config.tooltip_init_position.top)\n .style('left', config.tooltip_init_position.left)\n .style('display', 'block');\n }\n};\nconst getTooltipContent = function (d, defaultTitleFormat, defaultValueFormat, color) {\n let $$ = this, config = $$.config,\n titleFormat = config.tooltip_format_title || defaultTitleFormat,\n nameFormat = config.tooltip_format_name || function (name) { return name; },\n valueFormat = config.tooltip_format_value || defaultValueFormat,\n text, i, title, value, name, bgcolor,\n orderAsc = $$.isOrderAsc();\n\n if (config.data_groups.length === 0) {\n d.sort((a, b) => {\n let v1 = a ? a.value : null, v2 = b ? b.value : null;\n return orderAsc ? v1 - v2 : v2 - v1;\n });\n } else {\n const ids = $$.orderTargets($$.data.targets).map((i) => {\n return i.id;\n });\n d.sort((a, b) => {\n let v1 = a ? a.value : null, v2 = b ? b.value : null;\n if (v1 > 0 && v2 > 0) {\n v1 = a ? ids.indexOf(a.id) : null;\n v2 = b ? ids.indexOf(b.id) : null;\n }\n return orderAsc ? v1 - v2 : v2 - v1;\n });\n }\n\n for (i = 0; i < d.length; i++) {\n if (!(d[i] && (d[i].value || d[i].value === 0))) { continue; }\n\n if (!text) {\n title = sanitise(titleFormat ? titleFormat(d[i].x) : d[i].x);\n text = \"\" + (title || title === 0 ? \"' : '');\n }\n\n value = sanitise(valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index, d));\n if (value !== undefined) {\n // Skip elements when their name is set to null\n if (d[i].name === null) { continue; }\n name = sanitise(nameFormat(d[i].name, d[i].ratio, d[i].id, d[i].index));\n bgcolor = $$.levelColor ? $$.levelColor(d[i].value) : color(d[i].id);\n\n text += \"\";\n text += \"';\n text += \"';\n text += '';\n }\n }\n return text + '
\" + title + '
\" + name + '\" + value + '
';\n};\nconst tooltipPosition = function (dataToShow, tWidth, tHeight, element) {\n let $$ = this, config = $$.config, d3 = $$.d3;\n let svgLeft, tooltipLeft, tooltipRight, tooltipTop, chartRight;\n let forArc = $$.hasArcType(),\n mouse = d3.mouse(element);\n // Determin tooltip position\n if (forArc) {\n tooltipLeft = (($$.width - ($$.isLegendRight ? $$.getLegendWidth() : 0)) / 2) + mouse[0];\n tooltipTop = ($$.height / 2) + mouse[1] + 20;\n } else {\n svgLeft = $$.getSvgLeft(true);\n if (config.axis_rotated) {\n tooltipLeft = svgLeft + mouse[0] + 100;\n tooltipRight = tooltipLeft + tWidth;\n chartRight = $$.currentWidth - $$.getCurrentPaddingRight();\n tooltipTop = $$.x(dataToShow[0].x) + 20;\n } else {\n tooltipLeft = svgLeft + $$.getCurrentPaddingLeft(true) + $$.x(dataToShow[0].x) + 20;\n tooltipRight = tooltipLeft + tWidth;\n chartRight = svgLeft + $$.currentWidth - $$.getCurrentPaddingRight();\n tooltipTop = mouse[1] + 15;\n }\n\n if (tooltipRight > chartRight) {\n // 20 is needed for Firefox to keep tooltip width\n tooltipLeft -= tooltipRight - chartRight + 20;\n }\n if (tooltipTop + tHeight > $$.currentHeight) {\n tooltipTop -= tHeight + 30;\n }\n }\n if (tooltipTop < 0) {\n tooltipTop = 0;\n }\n return { top: tooltipTop, left: tooltipLeft };\n};\nconst showTooltip = function (selectedData, element) {\n let $$ = this, config = $$.config;\n let tWidth, tHeight, position;\n let forArc = $$.hasArcType(),\n dataToShow = selectedData.filter((d) => { return d && isValue(d.value); }),\n positionFunction = config.tooltip_position || c3_chart_internal_fn.tooltipPosition;\n if (dataToShow.length === 0 || !config.tooltip_show) {\n return;\n }\n $$.tooltip.html(config.tooltip_contents.call($$, selectedData, $$.axis.getXAxisTickFormat(), $$.getYFormat(forArc), $$.color)).style('display', 'block');\n\n // Get tooltip dimensions\n tWidth = $$.tooltip.property('offsetWidth');\n tHeight = $$.tooltip.property('offsetHeight');\n\n position = positionFunction.call(this, dataToShow, tWidth, tHeight, element);\n // Set tooltip\n $$.tooltip\n .style('top', position.top + 'px')\n .style('left', position.left + 'px');\n};\nconst hideTooltip = function () {\n this.tooltip.style('display', 'none');\n};\n\nexport {\n initTooltip,\n getTooltipContent,\n tooltipPosition,\n showTooltip,\n hideTooltip,\n};\n","const transformTo = function (targetIds, type, optionsForRedraw) {\n let $$ = this,\n withTransitionForAxis = !$$.hasArcType(),\n options = optionsForRedraw || { withTransitionForAxis };\n options.withTransitionForTransform = false;\n $$.transiting = false;\n $$.setTargetType(targetIds, type);\n $$.updateTargets($$.data.targets); // this is needed when transforming to arc\n $$.updateAndRedraw(options);\n};\n\nexport { transformTo };\n","import { isString } from './util';\n\nconst setTargetType = function (targetIds, type) {\n let $$ = this, config = $$.config;\n $$.mapToTargetIds(targetIds).forEach((id) => {\n $$.withoutFadeIn[id] = (type === config.data_types[id]);\n config.data_types[id] = type;\n });\n if (!targetIds) {\n config.data_type = type;\n }\n};\nconst hasType = function (type, targets) {\n let $$ = this, types = $$.config.data_types, has = false;\n targets = targets || $$.data.targets;\n if (targets && targets.length) {\n targets.forEach((target) => {\n const t = types[target.id];\n if ((t && t.indexOf(type) >= 0) || (!t && type === 'line')) {\n has = true;\n }\n });\n } else if (Object.keys(types).length) {\n Object.keys(types).forEach((id) => {\n if (types[id] === type) { has = true; }\n });\n } else {\n has = $$.config.data_type === type;\n }\n return has;\n};\nconst hasArcType = function (targets) {\n return this.hasType('pie', targets) || this.hasType('donut', targets) || this.hasType('gauge', targets);\n};\nconst isLineType = function (d) {\n let config = this.config, id = isString(d) ? d : d.id;\n return !config.data_types[id] || ['line', 'spline', 'area', 'area-spline', 'step', 'area-step'].indexOf(config.data_types[id]) >= 0;\n};\nconst isStepType = function (d) {\n const id = isString(d) ? d : d.id;\n return ['step', 'area-step'].indexOf(this.config.data_types[id]) >= 0;\n};\nconst isSplineType = function (d) {\n const id = isString(d) ? d : d.id;\n return ['spline', 'area-spline'].indexOf(this.config.data_types[id]) >= 0;\n};\nconst isAreaType = function (d) {\n const id = isString(d) ? d : d.id;\n return ['area', 'area-spline', 'area-step'].indexOf(this.config.data_types[id]) >= 0;\n};\nconst isBarType = function (d) {\n const id = isString(d) ? d : d.id;\n return this.config.data_types[id] === 'bar';\n};\nconst isScatterType = function (d) {\n const id = isString(d) ? d : d.id;\n return this.config.data_types[id] === 'scatter';\n};\nconst isPieType = function (d) {\n const id = isString(d) ? d : d.id;\n return this.config.data_types[id] === 'pie';\n};\nconst isGaugeType = function (d) {\n const id = isString(d) ? d : d.id;\n return this.config.data_types[id] === 'gauge';\n};\nconst isDonutType = function (d) {\n const id = isString(d) ? d : d.id;\n return this.config.data_types[id] === 'donut';\n};\nconst isArcType = function (d) {\n return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d);\n};\nconst lineData = function (d) {\n return this.isLineType(d) ? [d] : [];\n};\nconst arcData = function (d) {\n return this.isArcType(d.data) ? [d] : [];\n};\n/* not used\n function scatterData(d) {\n return isScatterType(d) ? d.values : [];\n }\n */\nconst barData = function (d) {\n return this.isBarType(d) ? d.values : [];\n};\nconst lineOrScatterData = function (d) {\n return this.isLineType(d) || this.isScatterType(d) ? d.values : [];\n};\nconst barOrLineData = function (d) {\n return this.isBarType(d) || this.isLineType(d) ? d.values : [];\n};\nconst isInterpolationType = function (type) {\n return ['linear', 'linear-closed', 'basis', 'basis-open', 'basis-closed', 'bundle', 'cardinal', 'cardinal-open', 'cardinal-closed', 'monotone'].indexOf(type) >= 0;\n};\n\nexport {\n setTargetType,\n hasType,\n hasArcType,\n isLineType,\n isStepType,\n isSplineType,\n isAreaType,\n isBarType,\n isScatterType,\n isPieType,\n isGaugeType,\n isDonutType,\n isArcType,\n lineData,\n arcData,\n barData,\n lineOrScatterData,\n barOrLineData,\n isInterpolationType,\n};\n","const isSafari = function () {\n const ua = window.navigator.userAgent;\n return ua.indexOf('Safari') >= 0 && ua.indexOf('Chrome') < 0;\n};\nconst isChrome = function () {\n const ua = window.navigator.userAgent;\n return ua.indexOf('Chrome') >= 0;\n};\n\nexport { isSafari, isChrome };\n","import { diffDomain } from './util';\nimport { CLASS } from './class';\n\nconst initZoom = function () {\n let $$ = this, d3 = $$.d3, config = $$.config, startEvent;\n\n $$.zoom = d3.behavior.zoom()\n .on('zoomstart', () => {\n startEvent = d3.event.sourceEvent;\n $$.zoom.altDomain = d3.event.sourceEvent.altKey ? $$.x.orgDomain() : null;\n config.zoom_onzoomstart.call($$.api, d3.event.sourceEvent);\n })\n .on('zoom', () => {\n $$.redrawForZoom.call($$);\n })\n .on('zoomend', () => {\n const event = d3.event.sourceEvent;\n // if click, do nothing. otherwise, click interaction will be canceled.\n if (event && startEvent.clientX === event.clientX && startEvent.clientY === event.clientY) {\n return;\n }\n $$.redrawEventRect();\n $$.updateZoom();\n config.zoom_onzoomend.call($$.api, $$.x.orgDomain());\n });\n $$.zoom.scale = function (scale) {\n return config.axis_rotated ? this.y(scale) : this.x(scale);\n };\n $$.zoom.orgScaleExtent = function () {\n const extent = config.zoom_extent ? config.zoom_extent : [1, 10];\n return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])];\n };\n $$.zoom.updateScaleExtent = function () {\n let ratio = diffDomain($$.x.orgDomain()) / diffDomain($$.getZoomDomain()),\n extent = this.orgScaleExtent();\n this.scaleExtent([extent[0] * ratio, extent[1] * ratio]);\n return this;\n };\n};\nconst getZoomDomain = function () {\n let $$ = this, config = $$.config, d3 = $$.d3,\n min = d3.min([$$.orgXDomain[0], config.zoom_x_min]),\n max = d3.max([$$.orgXDomain[1], config.zoom_x_max]);\n return [min, max];\n};\nconst updateZoom = function () {\n let $$ = this, z = $$.config.zoom_enabled ? $$.zoom : function () {};\n $$.main.select('.' + CLASS.zoomRect).call(z).on('dblclick.zoom', null);\n $$.main.selectAll('.' + CLASS.eventRect).call(z).on('dblclick.zoom', null);\n};\nconst redrawForZoom = function () {\n let $$ = this, d3 = $$.d3, config = $$.config, zoom = $$.zoom, x = $$.x;\n if (!config.zoom_enabled) {\n return;\n }\n if ($$.filterTargetsToShow($$.data.targets).length === 0) {\n return;\n }\n if (d3.event.sourceEvent.type === 'mousemove' && zoom.altDomain) {\n x.domain(zoom.altDomain);\n zoom.scale(x).updateScaleExtent();\n return;\n }\n if ($$.isCategorized() && x.orgDomain()[0] === $$.orgXDomain[0]) {\n x.domain([$$.orgXDomain[0] - 1e-10, x.orgDomain()[1]]);\n }\n $$.redraw({\n withTransition: false,\n withY: config.zoom_rescale,\n withSubchart: false,\n withEventRect: false,\n withDimension: false,\n });\n if (d3.event.sourceEvent.type === 'mousemove') {\n $$.cancelClick = true;\n }\n config.zoom_onzoom.call($$.api, x.orgDomain());\n};\n\nexport {\n initZoom,\n getZoomDomain,\n updateZoom,\n redrawForZoom,\n};\n","/**\n * This file is seriously in need of some reorganization.\n */\n\nimport d3 from 'd3';\nimport { Axis } from '../axis/index';\n\nimport {\n initPie,\n updateRadius,\n updateArc,\n updateAngle,\n getSvgArc,\n getSvgArcExpanded,\n getArc,\n transformForArcLabel,\n getArcRatio,\n convertToArcData,\n textForArcLabel,\n expandArc,\n unexpandArc,\n expandDuration,\n shouldExpand,\n shouldShowArcLabel,\n meetsArcLabelThreshold,\n getArcLabelFormat,\n getArcTitle,\n updateTargetsForArc,\n initArc,\n redrawArc,\n initGauge,\n getGaugeLabelHeight,\n} from './arc';\n\nimport {\n hasCaches,\n addCache,\n getCaches,\n} from './cache';\n\nimport { categoryName } from './category';\n\nimport {\n CLASS,\n generateClass,\n classText,\n classTexts,\n classShape,\n classShapes,\n classLine,\n classLines,\n classCircle,\n classCircles,\n classBar,\n classBars,\n classArc,\n classArcs,\n classArea,\n classAreas,\n classRegion,\n classEvent,\n classTarget,\n classFocus,\n classFocused,\n classDefocused,\n classChartText,\n classChartLine,\n classChartBar,\n classChartArc,\n getTargetSelectorSuffix,\n selectorTarget,\n selectorTargets,\n selectorLegend,\n selectorLegends,\n} from './class';\n\nimport {\n getClipPath,\n appendClip,\n getAxisClipX,\n getAxisClipY,\n getXAxisClipX,\n getXAxisClipY,\n getYAxisClipX,\n getYAxisClipY,\n getAxisClipWidth,\n getAxisClipHeight,\n getXAxisClipWidth,\n getXAxisClipHeight,\n getYAxisClipWidth,\n getYAxisClipHeight,\n} from './clip';\n\nimport {\n generateColor,\n generateLevelColor\n} from './color';\n\nimport {\n getDefaultConfig,\n additionalConfig,\n loadConfig,\n} from './config';\n\nimport {\n convertUrlToData,\n convertXsvToData,\n convertCsvToData,\n convertTsvToData,\n convertJsonToData,\n findValueInJson,\n convertRowsToData,\n convertColumnsToData,\n convertDataToTargets,\n} from './data.convert';\n\nimport {\n isX,\n isNotX,\n getXKey,\n getXValuesOfXKey,\n getIndexByX,\n getXValue,\n getOtherTargetXs,\n getOtherTargetX,\n addXs,\n hasMultipleX,\n isMultipleX,\n addName,\n getValueOnIndex,\n updateTargetX,\n updateTargetXs,\n generateTargetX,\n cloneTarget,\n updateXs,\n getPrevX,\n getNextX,\n getMaxDataCount,\n getMaxDataCountTarget,\n getEdgeX,\n mapToIds,\n mapToTargetIds,\n hasTarget,\n isTargetToShow,\n isLegendToShow,\n filterTargetsToShow,\n mapTargetsToUniqueXs,\n addHiddenTargetIds,\n removeHiddenTargetIds,\n addHiddenLegendIds,\n removeHiddenLegendIds,\n getValuesAsIdKeyed,\n checkValueInTargets,\n hasNegativeValueInTargets,\n hasPositiveValueInTargets,\n isOrderDesc,\n isOrderAsc,\n orderTargets,\n filterByX,\n filterRemoveNull,\n filterByXDomain,\n hasDataLabel,\n getDataLabelLength,\n isNoneArc,\n isArc,\n findSameXOfValues,\n findClosestFromTargets,\n findClosest,\n dist,\n convertValuesToStep,\n updateDataAttributes,\n} from './data';\n\nimport {\n load,\n loadFromArgs,\n unload,\n} from './data.load';\n\nimport {\n getYDomainMin,\n getYDomainMax,\n getYDomain,\n getXDomainMin,\n getXDomainMax,\n getXDomainPadding,\n getXDomain,\n updateXDomain,\n trimXDomain,\n} from './domain';\n\nimport {\n drag,\n dragstart,\n dragend,\n} from './drag';\n\nimport { generateFlow } from './flow';\n\nimport {\n getYFormat,\n yFormat,\n y2Format,\n defaultValueFormat,\n defaultArcValueFormat,\n dataLabelFormat,\n} from './format';\n\nimport {\n initGrid,\n initGridLines,\n updateXGrid,\n updateYGrid,\n gridTextAnchor,\n gridTextDx,\n xGridTextX,\n yGridTextX,\n updateGrid,\n redrawGrid,\n showXGridFocus,\n hideXGridFocus,\n updateXgridFocus,\n generateGridData,\n getGridFilterToRemove,\n removeGridLines,\n} from './grid';\n\nimport {\n initEventRect,\n redrawEventRect,\n updateEventRect,\n generateEventRectsForSingleX,\n generateEventRectsForMultipleXs,\n dispatchEvent,\n} from './interaction';\n\nimport {\n initLegend,\n updateLegendWithDefaults,\n updateSizeForLegend,\n transformLegend,\n updateLegendStep,\n updateLegendItemWidth,\n updateLegendItemHeight,\n getLegendWidth,\n getLegendHeight,\n opacityForLegend,\n opacityForUnfocusedLegend,\n toggleFocusLegend,\n revertLegend,\n showLegend,\n hideLegend,\n clearLegendItemTextBoxCache,\n updateLegend,\n} from './legend';\n\nimport {\n initRegion,\n updateRegion,\n redrawRegion,\n regionX,\n regionY,\n regionWidth,\n regionHeight,\n isRegionOnX,\n} from './region';\n\nimport {\n getScale,\n getX,\n getY,\n getYScale,\n getSubYScale,\n updateScales,\n} from './scale';\n\nimport {\n selectPoint,\n unselectPoint,\n togglePoint,\n selectPath,\n unselectPath,\n togglePath,\n getToggle,\n toggleShape,\n} from './selection';\n\nimport {\n initBar,\n updateTargetsForBar,\n updateBar,\n redrawBar,\n getBarW,\n getBars,\n expandBars,\n unexpandBars,\n generateDrawBar,\n generateGetBarPoints,\n isWithinBar,\n} from './shape.bar';\n\nimport {\n getShapeIndices,\n getShapeX,\n getShapeY,\n getShapeOffset,\n isWithinShape,\n getInterpolate,\n} from './shape';\n\nimport {\n initLine,\n updateTargetsForLine,\n updateLine,\n redrawLine,\n generateDrawLine,\n generateGetLinePoints,\n lineWithRegions,\n updateArea,\n redrawArea,\n generateDrawArea,\n getAreaBaseValue,\n generateGetAreaPoints,\n updateCircle,\n redrawCircle,\n circleX,\n updateCircleY,\n getCircles,\n expandCircles,\n unexpandCircles,\n pointR,\n pointExpandedR,\n pointSelectR,\n isWithinCircle,\n isWithinStep,\n} from './shape.line';\n\nimport {\n getCurrentWidth,\n getCurrentHeight,\n getCurrentPaddingTop,\n getCurrentPaddingBottom,\n getCurrentPaddingLeft,\n getCurrentPaddingRight,\n getParentRectValue,\n getParentWidth,\n getParentHeight,\n getSvgLeft,\n getAxisWidthByAxisId,\n getHorizontalAxisHeight,\n getEventRectWidth,\n} from './size';\n\nimport {\n initBrush,\n initSubchart,\n updateTargetsForSubchart,\n updateBarForSubchart,\n redrawBarForSubchart,\n updateLineForSubchart,\n redrawLineForSubchart,\n updateAreaForSubchart,\n redrawAreaForSubchart,\n redrawSubchart,\n redrawForBrush,\n transformContext,\n getDefaultExtent,\n} from './subchart';\n\nimport {\n initText,\n updateTargetsForText,\n updateText,\n redrawText,\n getTextRect,\n generateXYForText,\n getXForText,\n getYForText,\n} from './text';\n\nimport {\n initTitle,\n redrawTitle,\n xForTitle,\n yForTitle,\n getTitlePadding,\n} from './title';\n\nimport {\n initTooltip,\n getTooltipContent,\n tooltipPosition,\n showTooltip,\n hideTooltip,\n} from './tooltip';\n\nimport { transformTo } from './transform';\n\nimport {\n setTargetType,\n hasType,\n hasArcType,\n isLineType,\n isStepType,\n isSplineType,\n isAreaType,\n isBarType,\n isScatterType,\n isPieType,\n isGaugeType,\n isDonutType,\n isArcType,\n lineData,\n arcData,\n barData,\n lineOrScatterData,\n barOrLineData,\n isInterpolationType,\n} from './type';\n\nimport {\n isSafari,\n isChrome\n} from './ua';\n\nimport {\n initZoom,\n getZoomDomain,\n updateZoom,\n redrawForZoom,\n} from './zoom';\n\nimport * as util from './util';\n\nexport const {\n isValue,\n isFunction,\n isString,\n isUndefined,\n isDefined,\n ceil10,\n asHalfPixel,\n diffDomain,\n isEmpty,\n notEmpty,\n getOption,\n hasValue,\n sanitise,\n getPathBox,\n} = util;\n\n// Start ChartInternal!!!!\nfunction ChartInternal(api) {\n const $$ = this;\n $$.d3 = d3;\n $$.api = api;\n $$.config = $$.getDefaultConfig();\n $$.data = {};\n $$.cache = {};\n $$.axes = {};\n}\n\nconst c3_chart_internal_fn = ChartInternal.prototype;\n\nc3_chart_internal_fn.beforeInit = function () {\n // can do something\n};\nc3_chart_internal_fn.afterInit = function () {\n // can do something\n};\nc3_chart_internal_fn.init = function () {\n let $$ = this,\n config = $$.config;\n\n $$.initParams();\n\n if (config.data_url) {\n $$.convertUrlToData(config.data_url, config.data_mimeType, config.data_headers, config.data_keys, $$.initWithData);\n } else if (config.data_json) {\n $$.initWithData($$.convertJsonToData(config.data_json, config.data_keys));\n } else if (config.data_rows) {\n $$.initWithData($$.convertRowsToData(config.data_rows));\n } else if (config.data_columns) {\n $$.initWithData($$.convertColumnsToData(config.data_columns));\n } else {\n throw Error('url or json or rows or columns is required.');\n }\n};\n\nc3_chart_internal_fn.initParams = function () {\n let $$ = this,\n d3 = $$.d3,\n config = $$.config;\n\n // MEMO: clipId needs to be unique because it conflicts when multiple charts exist\n $$.clipId = 'c3-' + (+new Date()) + '-clip',\n $$.clipIdForXAxis = $$.clipId + '-xaxis',\n $$.clipIdForYAxis = $$.clipId + '-yaxis',\n $$.clipIdForGrid = $$.clipId + '-grid',\n $$.clipIdForSubchart = $$.clipId + '-subchart',\n $$.clipPath = $$.getClipPath($$.clipId),\n $$.clipPathForXAxis = $$.getClipPath($$.clipIdForXAxis),\n $$.clipPathForYAxis = $$.getClipPath($$.clipIdForYAxis);\n $$.clipPathForGrid = $$.getClipPath($$.clipIdForGrid),\n $$.clipPathForSubchart = $$.getClipPath($$.clipIdForSubchart),\n\n $$.dragStart = null;\n $$.dragging = false;\n $$.flowing = false;\n $$.cancelClick = false;\n $$.mouseover = false;\n $$.transiting = false;\n\n $$.color = $$.generateColor();\n $$.levelColor = $$.generateLevelColor();\n\n $$.dataTimeFormat = config.data_xLocaltime ? d3.time.format : d3.time.format.utc;\n $$.axisTimeFormat = config.axis_x_localtime ? d3.time.format : d3.time.format.utc;\n $$.defaultAxisTimeFormat = $$.axisTimeFormat.multi([\n ['.%L', function (d) {\n return d.getMilliseconds();\n }],\n [':%S', function (d) {\n return d.getSeconds();\n }],\n ['%I:%M', function (d) {\n return d.getMinutes();\n }],\n ['%I %p', function (d) {\n return d.getHours();\n }],\n ['%-m/%-d', function (d) {\n return d.getDay() && d.getDate() !== 1;\n }],\n ['%-m/%-d', function (d) {\n return d.getDate() !== 1;\n }],\n ['%-m/%-d', function (d) {\n return d.getMonth();\n }],\n ['%Y/%-m/%-d', function () {\n return true;\n }],\n ]);\n\n $$.hiddenTargetIds = [];\n $$.hiddenLegendIds = [];\n $$.focusedTargetIds = [];\n $$.defocusedTargetIds = [];\n\n $$.xOrient = config.axis_rotated ? 'left' : 'bottom';\n $$.yOrient = config.axis_rotated ? (config.axis_y_inner ? 'top' : 'bottom') : (config.axis_y_inner ? 'right' : 'left');\n $$.y2Orient = config.axis_rotated ? (config.axis_y2_inner ? 'bottom' : 'top') : (config.axis_y2_inner ? 'left' : 'right');\n $$.subXOrient = config.axis_rotated ? 'left' : 'bottom';\n\n $$.isLegendRight = config.legend_position === 'right';\n $$.isLegendInset = config.legend_position === 'inset';\n $$.isLegendTop = config.legend_inset_anchor === 'top-left' || config.legend_inset_anchor === 'top-right';\n $$.isLegendLeft = config.legend_inset_anchor === 'top-left' || config.legend_inset_anchor === 'bottom-left';\n $$.legendStep = 0;\n $$.legendItemWidth = 0;\n $$.legendItemHeight = 0;\n\n $$.currentMaxTickWidths = {\n x: 0,\n y: 0,\n y2: 0,\n };\n\n $$.rotated_padding_left = 30;\n $$.rotated_padding_right = config.axis_rotated && !config.axis_x_show ? 0 : 30;\n $$.rotated_padding_top = 5;\n\n $$.withoutFadeIn = {};\n\n $$.intervalForObserveInserted = undefined;\n\n $$.axes.subx = d3.selectAll([]); // needs when excluding subchart.js\n};\n\nc3_chart_internal_fn.initChartElements = function () {\n if (this.initBar) { this.initBar(); }\n if (this.initLine) { this.initLine(); }\n if (this.initArc) { this.initArc(); }\n if (this.initGauge) { this.initGauge(); }\n if (this.initText) { this.initText(); }\n};\n\nc3_chart_internal_fn.initWithData = function (data) {\n let $$ = this,\n d3 = $$.d3,\n config = $$.config;\n let defs, main, binding = true;\n\n $$.axis = new Axis($$);\n\n if ($$.initPie) { $$.initPie(); }\n if ($$.initBrush) { $$.initBrush(); }\n if ($$.initZoom) { $$.initZoom(); }\n\n if (!config.bindto) {\n $$.selectChart = d3.selectAll([]);\n } else if (typeof config.bindto.node === 'function') {\n $$.selectChart = config.bindto;\n } else {\n $$.selectChart = d3.select(config.bindto);\n }\n if ($$.selectChart.empty()) {\n $$.selectChart = d3.select(document.createElement('div')).style('opacity', 0);\n $$.observeInserted($$.selectChart);\n binding = false;\n }\n $$.selectChart.html('').classed('c3', true);\n\n // Init data as targets\n $$.data.xs = {};\n $$.data.targets = $$.convertDataToTargets(data);\n\n if (config.data_filter) {\n $$.data.targets = $$.data.targets.filter(config.data_filter);\n }\n\n // Set targets to hide if needed\n if (config.data_hide) {\n $$.addHiddenTargetIds(config.data_hide === true ? $$.mapToIds($$.data.targets) : config.data_hide);\n }\n if (config.legend_hide) {\n $$.addHiddenLegendIds(config.legend_hide === true ? $$.mapToIds($$.data.targets) : config.legend_hide);\n }\n\n // when gauge, hide legend // TODO: fix\n if ($$.hasType('gauge')) {\n config.legend_show = false;\n }\n\n // Init sizes and scales\n $$.updateSizes();\n $$.updateScales();\n\n // Set domains for each scale\n $$.x.domain(d3.extent($$.getXDomain($$.data.targets)));\n $$.y.domain($$.getYDomain($$.data.targets, 'y'));\n $$.y2.domain($$.getYDomain($$.data.targets, 'y2'));\n $$.subX.domain($$.x.domain());\n $$.subY.domain($$.y.domain());\n $$.subY2.domain($$.y2.domain());\n\n // Save original x domain for zoom update\n $$.orgXDomain = $$.x.domain();\n\n // Set initialized scales to brush and zoom\n if ($$.brush) { $$.brush.scale($$.subX); }\n if (config.zoom_enabled) { $$.zoom.scale($$.x); }\n\n /* -- Basic Elements --*/\n\n // Define svgs\n $$.svg = $$.selectChart.append('svg')\n .style('overflow', 'hidden')\n .on('mouseenter', () => {\n return config.onmouseover.call($$);\n })\n .on('mouseleave', () => {\n return config.onmouseout.call($$);\n });\n\n if ($$.config.svg_classname) {\n $$.svg.attr('class', $$.config.svg_classname);\n }\n\n // Define defs\n defs = $$.svg.append('defs');\n $$.clipChart = $$.appendClip(defs, $$.clipId);\n $$.clipXAxis = $$.appendClip(defs, $$.clipIdForXAxis);\n $$.clipYAxis = $$.appendClip(defs, $$.clipIdForYAxis);\n $$.clipGrid = $$.appendClip(defs, $$.clipIdForGrid);\n $$.clipSubchart = $$.appendClip(defs, $$.clipIdForSubchart);\n $$.updateSvgSize();\n\n // Define regions\n main = $$.main = $$.svg.append('g').attr('transform', $$.getTranslate('main'));\n\n if ($$.initSubchart) { $$.initSubchart(); }\n if ($$.initTooltip) { $$.initTooltip(); }\n if ($$.initLegend) { $$.initLegend(); }\n if ($$.initTitle) { $$.initTitle(); }\n\n /* -- Main Region --*/\n\n // text when empty\n main.append('text')\n .attr('class', CLASS.text + ' ' + CLASS.empty)\n .attr('text-anchor', 'middle') // horizontal centering of text at x position in all browsers.\n .attr('dominant-baseline', 'middle'); // vertical centering of text at y position in all browsers, except IE.\n\n // Regions\n $$.initRegion();\n\n // Grids\n $$.initGrid();\n\n // Define g for chart area\n main.append('g')\n .attr('clip-path', $$.clipPath)\n .attr('class', CLASS.chart);\n\n // Grid lines\n if (config.grid_lines_front) { $$.initGridLines(); }\n\n // Cover whole with rects for events\n $$.initEventRect();\n\n // Define g for chart\n $$.initChartElements();\n\n // if zoom privileged, insert rect to forefront\n // TODO: is this needed?\n main.insert('rect', config.zoom_privileged ? null : 'g.' + CLASS.regions)\n .attr('class', CLASS.zoomRect)\n .attr('width', $$.width)\n .attr('height', $$.height)\n .style('opacity', 0)\n .on('dblclick.zoom', null);\n\n // Set default extent if defined\n if (config.axis_x_extent) { $$.brush.extent($$.getDefaultExtent()); }\n\n // Add Axis\n $$.axis.init();\n\n // Set targets\n $$.updateTargets($$.data.targets);\n\n // Draw with targets\n if (binding) {\n $$.updateDimension();\n $$.config.oninit.call($$);\n $$.redraw({\n withTransition: false,\n withTransform: true,\n withUpdateXDomain: true,\n withUpdateOrgXDomain: true,\n withTransitionForAxis: false,\n });\n }\n\n // Bind resize event\n $$.bindResize();\n\n // export element of the chart\n $$.api.element = $$.selectChart.node();\n};\n\nc3_chart_internal_fn.smoothLines = function (el, type) {\n const $$ = this;\n if (type === 'grid') {\n el.each(function () {\n let g = $$.d3.select(this),\n x1 = g.attr('x1'),\n x2 = g.attr('x2'),\n y1 = g.attr('y1'),\n y2 = g.attr('y2');\n g.attr({\n 'x1': Math.ceil(x1),\n 'x2': Math.ceil(x2),\n 'y1': Math.ceil(y1),\n 'y2': Math.ceil(y2),\n });\n });\n }\n};\n\n\nc3_chart_internal_fn.updateSizes = function () {\n let $$ = this,\n config = $$.config;\n let legendHeight = $$.legend ? $$.getLegendHeight() : 0,\n legendWidth = $$.legend ? $$.getLegendWidth() : 0,\n legendHeightForBottom = $$.isLegendRight || $$.isLegendInset ? 0 : legendHeight,\n hasArc = $$.hasArcType(),\n xAxisHeight = config.axis_rotated || hasArc ? 0 : $$.getHorizontalAxisHeight('x'),\n subchartHeight = config.subchart_show && !hasArc ? (config.subchart_size_height + xAxisHeight) : 0;\n\n $$.currentWidth = $$.getCurrentWidth();\n $$.currentHeight = $$.getCurrentHeight();\n\n // for main\n $$.margin = config.axis_rotated ? {\n top: $$.getHorizontalAxisHeight('y2') + $$.getCurrentPaddingTop(),\n right: hasArc ? 0 : $$.getCurrentPaddingRight(),\n bottom: $$.getHorizontalAxisHeight('y') + legendHeightForBottom + $$.getCurrentPaddingBottom(),\n left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft()),\n } : {\n top: 4 + $$.getCurrentPaddingTop(), // for top tick text\n right: hasArc ? 0 : $$.getCurrentPaddingRight(),\n bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),\n left: hasArc ? 0 : $$.getCurrentPaddingLeft(),\n };\n\n // for subchart\n $$.margin2 = config.axis_rotated ? {\n top: $$.margin.top,\n right: NaN,\n bottom: 20 + legendHeightForBottom,\n left: $$.rotated_padding_left,\n } : {\n top: $$.currentHeight - subchartHeight - legendHeightForBottom,\n right: NaN,\n bottom: xAxisHeight + legendHeightForBottom,\n left: $$.margin.left,\n };\n\n // for legend\n $$.margin3 = {\n top: 0,\n right: NaN,\n bottom: 0,\n left: 0,\n };\n if ($$.updateSizeForLegend) { $$.updateSizeForLegend(legendHeight, legendWidth); }\n\n $$.width = $$.currentWidth - $$.margin.left - $$.margin.right;\n $$.height = $$.currentHeight - $$.margin.top - $$.margin.bottom;\n if ($$.width < 0) { $$.width = 0; }\n if ($$.height < 0) { $$.height = 0; }\n\n $$.width2 = config.axis_rotated ? $$.margin.left - $$.rotated_padding_left - $$.rotated_padding_right : $$.width;\n $$.height2 = config.axis_rotated ? $$.height : $$.currentHeight - $$.margin2.top - $$.margin2.bottom;\n if ($$.width2 < 0) { $$.width2 = 0; }\n if ($$.height2 < 0) { $$.height2 = 0; }\n\n // for arc\n $$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0);\n $$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10);\n if ($$.hasType('gauge') && !config.gauge_fullCircle) {\n $$.arcHeight += $$.height - $$.getGaugeLabelHeight();\n }\n if ($$.updateRadius) { $$.updateRadius(); }\n\n if ($$.isLegendRight && hasArc) {\n $$.margin3.left = $$.arcWidth / 2 + $$.radiusExpanded * 1.1;\n }\n};\n\nc3_chart_internal_fn.updateTargets = function (targets) {\n const $$ = this;\n\n /* -- Main --*/\n\n // -- Text --//\n $$.updateTargetsForText(targets);\n\n // -- Bar --//\n $$.updateTargetsForBar(targets);\n\n // -- Line --//\n $$.updateTargetsForLine(targets);\n\n // -- Arc --//\n if ($$.hasArcType() && $$.updateTargetsForArc) { $$.updateTargetsForArc(targets); }\n\n /* -- Sub --*/\n\n if ($$.updateTargetsForSubchart) { $$.updateTargetsForSubchart(targets); }\n\n // Fade-in each chart\n $$.showTargets();\n};\nc3_chart_internal_fn.showTargets = function () {\n const $$ = this;\n $$.svg.selectAll('.' + CLASS.target).filter((d) => {\n return $$.isTargetToShow(d.id);\n })\n .transition().duration($$.config.transition_duration)\n .style('opacity', 1);\n};\n\nc3_chart_internal_fn.redraw = function (options, transitions) {\n let $$ = this,\n main = $$.main,\n d3 = $$.d3,\n config = $$.config;\n let areaIndices = $$.getShapeIndices($$.isAreaType),\n barIndices = $$.getShapeIndices($$.isBarType),\n lineIndices = $$.getShapeIndices($$.isLineType);\n let withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis,\n withTransform, withUpdateXDomain, withUpdateOrgXDomain, withTrimXDomain, withLegend,\n withEventRect, withDimension, withUpdateXAxis;\n const hideAxis = $$.hasArcType();\n let drawArea, drawBar, drawLine, xForText, yForText;\n let duration, durationForExit, durationForAxis;\n let waitForDraw, flow;\n let targetsToShow = $$.filterTargetsToShow($$.data.targets),\n tickValues, i, intervalForCulling, xDomainForZoom;\n let xv = $$.xv.bind($$),\n cx, cy;\n\n options = options || {};\n withY = getOption(options, 'withY', true);\n withSubchart = getOption(options, 'withSubchart', true);\n withTransition = getOption(options, 'withTransition', true);\n withTransform = getOption(options, 'withTransform', false);\n withUpdateXDomain = getOption(options, 'withUpdateXDomain', false);\n withUpdateOrgXDomain = getOption(options, 'withUpdateOrgXDomain', false);\n withTrimXDomain = getOption(options, 'withTrimXDomain', true);\n withUpdateXAxis = getOption(options, 'withUpdateXAxis', withUpdateXDomain);\n withLegend = getOption(options, 'withLegend', false);\n withEventRect = getOption(options, 'withEventRect', true);\n withDimension = getOption(options, 'withDimension', true);\n withTransitionForExit = getOption(options, 'withTransitionForExit', withTransition);\n withTransitionForAxis = getOption(options, 'withTransitionForAxis', withTransition);\n\n duration = withTransition ? config.transition_duration : 0;\n durationForExit = withTransitionForExit ? duration : 0;\n durationForAxis = withTransitionForAxis ? duration : 0;\n\n transitions = transitions || $$.axis.generateTransitions(durationForAxis);\n\n // update legend and transform each g\n if (withLegend && config.legend_show) {\n $$.updateLegend($$.mapToIds($$.data.targets), options, transitions);\n } else if (withDimension) {\n // need to update dimension (e.g. axis.y.tick.values) because y tick values should change\n // no need to update axis in it because they will be updated in redraw()\n $$.updateDimension(true);\n }\n\n // MEMO: needed for grids calculation\n if ($$.isCategorized() && targetsToShow.length === 0) {\n $$.x.domain([0, $$.axes.x.selectAll('.tick').size()]);\n }\n\n if (targetsToShow.length) {\n $$.updateXDomain(targetsToShow, withUpdateXDomain, withUpdateOrgXDomain, withTrimXDomain);\n if (!config.axis_x_tick_values) {\n tickValues = $$.axis.updateXAxisTickValues(targetsToShow);\n }\n } else {\n $$.xAxis.tickValues([]);\n $$.subXAxis.tickValues([]);\n }\n\n if (config.zoom_rescale && !options.flow) {\n xDomainForZoom = $$.x.orgDomain();\n }\n\n $$.y.domain($$.getYDomain(targetsToShow, 'y', xDomainForZoom));\n $$.y2.domain($$.getYDomain(targetsToShow, 'y2', xDomainForZoom));\n\n if (!config.axis_y_tick_values && config.axis_y_tick_count) {\n $$.yAxis.tickValues($$.axis.generateTickValues($$.y.domain(), config.axis_y_tick_count));\n }\n if (!config.axis_y2_tick_values && config.axis_y2_tick_count) {\n $$.y2Axis.tickValues($$.axis.generateTickValues($$.y2.domain(), config.axis_y2_tick_count));\n }\n\n // axes\n $$.axis.redraw(transitions, hideAxis);\n\n // Update axis label\n $$.axis.updateLabels(withTransition);\n\n // show/hide if manual culling needed\n if ((withUpdateXDomain || withUpdateXAxis) && targetsToShow.length) {\n if (config.axis_x_tick_culling && tickValues) {\n for (i = 1; i < tickValues.length; i++) {\n if (tickValues.length / i < config.axis_x_tick_culling_max) {\n intervalForCulling = i;\n break;\n }\n }\n $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) {\n const index = tickValues.indexOf(e);\n if (index >= 0) {\n d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block');\n }\n });\n } else {\n $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block');\n }\n }\n\n // setup drawer - MEMO: these must be called after axis updated\n drawArea = $$.generateDrawArea ? $$.generateDrawArea(areaIndices, false) : undefined;\n drawBar = $$.generateDrawBar ? $$.generateDrawBar(barIndices) : undefined;\n drawLine = $$.generateDrawLine ? $$.generateDrawLine(lineIndices, false) : undefined;\n xForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, true);\n yForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, false);\n\n // Update sub domain\n if (withY) {\n $$.subY.domain($$.getYDomain(targetsToShow, 'y'));\n $$.subY2.domain($$.getYDomain(targetsToShow, 'y2'));\n }\n\n // xgrid focus\n $$.updateXgridFocus();\n\n // Data empty label positioning and text.\n main.select('text.' + CLASS.text + '.' + CLASS.empty)\n .attr('x', $$.width / 2)\n .attr('y', $$.height / 2)\n .text(config.data_empty_label_text)\n .transition()\n .style('opacity', targetsToShow.length ? 0 : 1);\n\n // grid\n $$.updateGrid(duration);\n\n // rect for regions\n $$.updateRegion(duration);\n\n // bars\n $$.updateBar(durationForExit);\n\n // lines, areas and cricles\n $$.updateLine(durationForExit);\n $$.updateArea(durationForExit);\n $$.updateCircle();\n\n // text\n if ($$.hasDataLabel()) {\n $$.updateText(durationForExit);\n }\n\n // title\n if ($$.redrawTitle) { $$.redrawTitle(); }\n\n // arc\n if ($$.redrawArc) { $$.redrawArc(duration, durationForExit, withTransform); }\n\n // subchart\n if ($$.redrawSubchart) {\n $$.redrawSubchart(withSubchart, transitions, duration, durationForExit, areaIndices, barIndices, lineIndices);\n }\n\n // circles for select\n main.selectAll('.' + CLASS.selectedCircles)\n .filter($$.isBarType.bind($$))\n .selectAll('circle')\n .remove();\n\n // event rects will redrawn when flow called\n if (config.interaction_enabled && !options.flow && withEventRect) {\n $$.redrawEventRect();\n if ($$.updateZoom) { $$.updateZoom(); }\n }\n\n // update circleY based on updated parameters\n $$.updateCircleY();\n\n // generate circle x/y functions depending on updated params\n cx = ($$.config.axis_rotated ? $$.circleY : $$.circleX).bind($$);\n cy = ($$.config.axis_rotated ? $$.circleX : $$.circleY).bind($$);\n\n if (options.flow) {\n flow = $$.generateFlow({\n targets: targetsToShow,\n flow: options.flow,\n duration: options.flow.duration,\n drawBar,\n drawLine,\n drawArea,\n cx,\n cy,\n xv,\n xForText,\n yForText,\n });\n }\n\n if ((duration || flow) && $$.isTabVisible()) { // Only use transition if tab visible. See #938.\n // transition should be derived from one transition\n d3.transition().duration(duration).each(() => {\n const transitionsToWait = [];\n\n // redraw and gather transitions\n [\n $$.redrawBar(drawBar, true),\n $$.redrawLine(drawLine, true),\n $$.redrawArea(drawArea, true),\n $$.redrawCircle(cx, cy, true),\n $$.redrawText(xForText, yForText, options.flow, true),\n $$.redrawRegion(true),\n $$.redrawGrid(true),\n ].forEach((transitions) => {\n transitions.forEach((transition) => {\n transitionsToWait.push(transition);\n });\n });\n\n // Wait for end of transitions to call flow and onrendered callback\n waitForDraw = $$.generateWait();\n transitionsToWait.forEach((t) => {\n waitForDraw.add(t);\n });\n })\n .call(waitForDraw, () => {\n if (flow) {\n flow();\n }\n if (config.onrendered) {\n config.onrendered.call($$);\n }\n });\n } else {\n $$.redrawBar(drawBar);\n $$.redrawLine(drawLine);\n $$.redrawArea(drawArea);\n $$.redrawCircle(cx, cy);\n $$.redrawText(xForText, yForText, options.flow);\n $$.redrawRegion();\n $$.redrawGrid();\n if (config.onrendered) {\n config.onrendered.call($$);\n }\n }\n\n // update fadein condition\n $$.mapToIds($$.data.targets).forEach((id) => {\n $$.withoutFadeIn[id] = true;\n });\n};\n\nc3_chart_internal_fn.updateAndRedraw = function (options) {\n let $$ = this,\n config = $$.config,\n transitions;\n options = options || {};\n // same with redraw\n options.withTransition = getOption(options, 'withTransition', true);\n options.withTransform = getOption(options, 'withTransform', false);\n options.withLegend = getOption(options, 'withLegend', false);\n // NOT same with redraw\n options.withUpdateXDomain = true;\n options.withUpdateOrgXDomain = true;\n options.withTransitionForExit = false;\n options.withTransitionForTransform = getOption(options, 'withTransitionForTransform', options.withTransition);\n // MEMO: this needs to be called before updateLegend and it means this ALWAYS needs to be called)\n $$.updateSizes();\n // MEMO: called in updateLegend in redraw if withLegend\n if (!(options.withLegend && config.legend_show)) {\n transitions = $$.axis.generateTransitions(options.withTransitionForAxis ? config.transition_duration : 0);\n // Update scales\n $$.updateScales();\n $$.updateSvgSize();\n // Update g positions\n $$.transformAll(options.withTransitionForTransform, transitions);\n }\n // Draw with new sizes & scales\n $$.redraw(options, transitions);\n};\nc3_chart_internal_fn.redrawWithoutRescale = function () {\n this.redraw({\n withY: false,\n withSubchart: false,\n withEventRect: false,\n withTransitionForAxis: false,\n });\n};\n\nc3_chart_internal_fn.isTimeSeries = function () {\n return this.config.axis_x_type === 'timeseries';\n};\nc3_chart_internal_fn.isCategorized = function () {\n return this.config.axis_x_type.indexOf('categor') >= 0;\n};\nc3_chart_internal_fn.isCustomX = function () {\n let $$ = this,\n config = $$.config;\n return !$$.isTimeSeries() && (config.data_x || notEmpty(config.data_xs));\n};\n\nc3_chart_internal_fn.isTimeSeriesY = function () {\n return this.config.axis_y_type === 'timeseries';\n};\n\nc3_chart_internal_fn.getTranslate = function (target) {\n let $$ = this,\n config = $$.config,\n x, y;\n if (target === 'main') {\n x = asHalfPixel($$.margin.left);\n y = asHalfPixel($$.margin.top);\n } else if (target === 'context') {\n x = asHalfPixel($$.margin2.left);\n y = asHalfPixel($$.margin2.top);\n } else if (target === 'legend') {\n x = $$.margin3.left;\n y = $$.margin3.top;\n } else if (target === 'x') {\n x = 0;\n y = config.axis_rotated ? 0 : $$.height;\n } else if (target === 'y') {\n x = 0;\n y = config.axis_rotated ? $$.height : 0;\n } else if (target === 'y2') {\n x = config.axis_rotated ? 0 : $$.width;\n y = config.axis_rotated ? 1 : 0;\n } else if (target === 'subx') {\n x = 0;\n y = config.axis_rotated ? 0 : $$.height2;\n } else if (target === 'arc') {\n x = $$.arcWidth / 2;\n y = $$.arcHeight / 2;\n }\n return 'translate(' + x + ',' + y + ')';\n};\nc3_chart_internal_fn.initialOpacity = function (d) {\n return d.value !== null && this.withoutFadeIn[d.id] ? 1 : 0;\n};\nc3_chart_internal_fn.initialOpacityForCircle = function (d) {\n return d.value !== null && this.withoutFadeIn[d.id] ? this.opacityForCircle(d) : 0;\n};\nc3_chart_internal_fn.opacityForCircle = function (d) {\n const opacity = this.config.point_show ? 1 : 0;\n return isValue(d.value) ? (this.isScatterType(d) ? 0.5 : opacity) : 0;\n};\nc3_chart_internal_fn.opacityForText = function () {\n return this.hasDataLabel() ? 1 : 0;\n};\nc3_chart_internal_fn.xx = function (d) {\n return d ? this.x(d.x) : null;\n};\nc3_chart_internal_fn.xv = function (d) {\n let $$ = this,\n value = d.value;\n if ($$.isTimeSeries()) {\n value = $$.parseDate(d.value);\n } else if ($$.isCategorized() && typeof d.value === 'string') {\n value = $$.config.axis_x_categories.indexOf(d.value);\n }\n return Math.ceil($$.x(value));\n};\nc3_chart_internal_fn.yv = function (d) {\n let $$ = this,\n yScale = d.axis && d.axis === 'y2' ? $$.y2 : $$.y;\n return Math.ceil(yScale(d.value));\n};\nc3_chart_internal_fn.subxx = function (d) {\n return d ? this.subX(d.x) : null;\n};\n\nc3_chart_internal_fn.transformMain = function (withTransition, transitions) {\n let $$ = this,\n xAxis, yAxis, y2Axis;\n if (transitions && transitions.axisX) {\n xAxis = transitions.axisX;\n } else {\n xAxis = $$.main.select('.' + CLASS.axisX);\n if (withTransition) { xAxis = xAxis.transition(); }\n }\n if (transitions && transitions.axisY) {\n yAxis = transitions.axisY;\n } else {\n yAxis = $$.main.select('.' + CLASS.axisY);\n if (withTransition) { yAxis = yAxis.transition(); }\n }\n if (transitions && transitions.axisY2) {\n y2Axis = transitions.axisY2;\n } else {\n y2Axis = $$.main.select('.' + CLASS.axisY2);\n if (withTransition) { y2Axis = y2Axis.transition(); }\n }\n (withTransition ? $$.main.transition() : $$.main).attr('transform', $$.getTranslate('main'));\n xAxis.attr('transform', $$.getTranslate('x'));\n yAxis.attr('transform', $$.getTranslate('y'));\n y2Axis.attr('transform', $$.getTranslate('y2'));\n $$.main.select('.' + CLASS.chartArcs).attr('transform', $$.getTranslate('arc'));\n};\nc3_chart_internal_fn.transformAll = function (withTransition, transitions) {\n const $$ = this;\n $$.transformMain(withTransition, transitions);\n if ($$.config.subchart_show) { $$.transformContext(withTransition, transitions); }\n if ($$.legend) { $$.transformLegend(withTransition); }\n};\n\nc3_chart_internal_fn.updateSvgSize = function () {\n let $$ = this,\n brush = $$.svg.select('.c3-brush .background');\n $$.svg.attr('width', $$.currentWidth).attr('height', $$.currentHeight);\n $$.svg.selectAll(['#' + $$.clipId, '#' + $$.clipIdForGrid]).select('rect')\n .attr('width', $$.width)\n .attr('height', $$.height);\n $$.svg.select('#' + $$.clipIdForXAxis).select('rect')\n .attr('x', $$.getXAxisClipX.bind($$))\n .attr('y', $$.getXAxisClipY.bind($$))\n .attr('width', $$.getXAxisClipWidth.bind($$))\n .attr('height', $$.getXAxisClipHeight.bind($$));\n $$.svg.select('#' + $$.clipIdForYAxis).select('rect')\n .attr('x', $$.getYAxisClipX.bind($$))\n .attr('y', $$.getYAxisClipY.bind($$))\n .attr('width', $$.getYAxisClipWidth.bind($$))\n .attr('height', $$.getYAxisClipHeight.bind($$));\n $$.svg.select('#' + $$.clipIdForSubchart).select('rect')\n .attr('width', $$.width)\n .attr('height', brush.size() ? brush.attr('height') : 0);\n $$.svg.select('.' + CLASS.zoomRect)\n .attr('width', $$.width)\n .attr('height', $$.height);\n // MEMO: parent div's height will be bigger than svg when \n $$.selectChart.style('max-height', $$.currentHeight + 'px');\n};\n\n\nc3_chart_internal_fn.updateDimension = function (withoutAxis) {\n const $$ = this;\n if (!withoutAxis) {\n if ($$.config.axis_rotated) {\n $$.axes.x.call($$.xAxis);\n $$.axes.subx.call($$.subXAxis);\n } else {\n $$.axes.y.call($$.yAxis);\n $$.axes.y2.call($$.y2Axis);\n }\n }\n $$.updateSizes();\n $$.updateScales();\n $$.updateSvgSize();\n $$.transformAll(false);\n};\n\nc3_chart_internal_fn.observeInserted = function (selection) {\n let $$ = this,\n observer;\n if (typeof MutationObserver === 'undefined') {\n window.console.error('MutationObserver not defined.');\n return;\n }\n observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.type === 'childList' && mutation.previousSibling) {\n observer.disconnect();\n // need to wait for completion of load because size calculation requires the actual sizes determined after that completion\n $$.intervalForObserveInserted = window.setInterval(() => {\n // parentNode will NOT be null when completed\n if (selection.node().parentNode) {\n window.clearInterval($$.intervalForObserveInserted);\n $$.updateDimension();\n if ($$.brush) { $$.brush.update(); }\n $$.config.oninit.call($$);\n $$.redraw({\n withTransform: true,\n withUpdateXDomain: true,\n withUpdateOrgXDomain: true,\n withTransition: false,\n withTransitionForTransform: false,\n withLegend: true,\n });\n selection.transition().style('opacity', 1);\n }\n }, 10);\n }\n });\n });\n observer.observe(selection.node(), { attributes: true, childList: true, characterData: true });\n};\n\nc3_chart_internal_fn.bindResize = function () {\n let $$ = this,\n config = $$.config;\n\n $$.resizeFunction = $$.generateResize();\n\n $$.resizeFunction.add(() => {\n config.onresize.call($$);\n });\n if (config.resize_auto) {\n $$.resizeFunction.add(() => {\n if ($$.resizeTimeout !== undefined) {\n window.clearTimeout($$.resizeTimeout);\n }\n $$.resizeTimeout = window.setTimeout(() => {\n delete $$.resizeTimeout;\n $$.api.flush();\n }, 100);\n });\n }\n $$.resizeFunction.add(() => {\n config.onresized.call($$);\n });\n\n if (window.attachEvent) {\n window.attachEvent('onresize', $$.resizeFunction);\n } else if (window.addEventListener) {\n window.addEventListener('resize', $$.resizeFunction, false);\n } else {\n // fallback to this, if this is a very old browser\n let wrapper = window.onresize;\n if (!wrapper) {\n // create a wrapper that will call all charts\n wrapper = $$.generateResize();\n } else if (!wrapper.add || !wrapper.remove) {\n // there is already a handler registered, make sure we call it too\n wrapper = $$.generateResize();\n wrapper.add(window.onresize);\n }\n // add this graph to the wrapper, we will be removed if the user calls destroy\n wrapper.add($$.resizeFunction);\n window.onresize = wrapper;\n }\n};\n\nc3_chart_internal_fn.generateResize = function () {\n const resizeFunctions = [];\n\n function callResizeFunctions() {\n resizeFunctions.forEach((f) => {\n f();\n });\n }\n callResizeFunctions.add = function (f) {\n resizeFunctions.push(f);\n };\n callResizeFunctions.remove = function (f) {\n for (let i = 0; i < resizeFunctions.length; i++) {\n if (resizeFunctions[i] === f) {\n resizeFunctions.splice(i, 1);\n break;\n }\n }\n };\n return callResizeFunctions;\n};\n\nc3_chart_internal_fn.endall = function (transition, callback) {\n let n = 0;\n transition\n .each(() => { ++n; })\n .each('end', function () {\n if (!--n) { callback.apply(this, arguments); }\n });\n};\nc3_chart_internal_fn.generateWait = function () {\n let transitionsToWait = [],\n f = function (transition, callback) {\n const timer = setInterval(() => {\n let done = 0;\n transitionsToWait.forEach((t) => {\n if (t.empty()) {\n done += 1;\n return;\n }\n try {\n t.transition();\n } catch (e) {\n done += 1;\n }\n });\n if (done === transitionsToWait.length) {\n clearInterval(timer);\n if (callback) { callback(); }\n }\n }, 10);\n };\n f.add = function (transition) {\n transitionsToWait.push(transition);\n };\n return f;\n};\n\nc3_chart_internal_fn.parseDate = function (date) {\n let $$ = this,\n parsedDate;\n if (date instanceof Date) {\n parsedDate = date;\n } else if (typeof date === 'string') {\n parsedDate = $$.dataTimeFormat($$.config.data_xFormat).parse(date);\n } else if (typeof date === 'number' && !isNaN(date)) {\n parsedDate = new Date(+date);\n }\n if (!parsedDate || isNaN(+parsedDate)) {\n window.console.error(\"Failed to parse x '\" + date + \"' to Date object\");\n }\n return parsedDate;\n};\n\nc3_chart_internal_fn.isTabVisible = function () {\n let hidden;\n if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support\n hidden = 'hidden';\n } else if (typeof document.mozHidden !== 'undefined') {\n hidden = 'mozHidden';\n } else if (typeof document.msHidden !== 'undefined') {\n hidden = 'msHidden';\n } else if (typeof document.webkitHidden !== 'undefined') {\n hidden = 'webkitHidden';\n }\n\n return document[hidden] ? false : true;\n};\n\n// There might be a better way of doing this...\nc3_chart_internal_fn.isSafari = isSafari;\nc3_chart_internal_fn.isChrome = isChrome;\nc3_chart_internal_fn.initPie = initPie;\nc3_chart_internal_fn.updateRadius = updateRadius;\nc3_chart_internal_fn.updateArc = updateArc;\nc3_chart_internal_fn.updateAngle = updateAngle;\nc3_chart_internal_fn.getSvgArc = getSvgArc;\nc3_chart_internal_fn.getSvgArcExpanded = getSvgArcExpanded;\nc3_chart_internal_fn.getArc = getArc;\nc3_chart_internal_fn.transformForArcLabel = transformForArcLabel;\nc3_chart_internal_fn.getArcRatio = getArcRatio;\nc3_chart_internal_fn.convertToArcData = convertToArcData;\nc3_chart_internal_fn.textForArcLabel = textForArcLabel;\nc3_chart_internal_fn.expandArc = expandArc;\nc3_chart_internal_fn.unexpandArc = unexpandArc;\nc3_chart_internal_fn.expandDuration = expandDuration;\nc3_chart_internal_fn.shouldExpand = shouldExpand;\nc3_chart_internal_fn.shouldShowArcLabel = shouldShowArcLabel;\nc3_chart_internal_fn.meetsArcLabelThreshold = meetsArcLabelThreshold;\nc3_chart_internal_fn.getArcLabelFormat = getArcLabelFormat;\nc3_chart_internal_fn.getArcTitle = getArcTitle;\nc3_chart_internal_fn.updateTargetsForArc = updateTargetsForArc;\nc3_chart_internal_fn.initArc = initArc;\nc3_chart_internal_fn.redrawArc = redrawArc;\nc3_chart_internal_fn.initGauge = initGauge;\nc3_chart_internal_fn.getGaugeLabelHeight = getGaugeLabelHeight;\nc3_chart_internal_fn.hasCaches = hasCaches;\nc3_chart_internal_fn.addCache = addCache;\nc3_chart_internal_fn.getCaches = getCaches;\nc3_chart_internal_fn.categoryName = categoryName;\nc3_chart_internal_fn.CLASS = CLASS;\nc3_chart_internal_fn.generateClass = generateClass;\nc3_chart_internal_fn.classText = classText;\nc3_chart_internal_fn.classTexts = classTexts;\nc3_chart_internal_fn.classShape = classShape;\nc3_chart_internal_fn.classShapes = classShapes;\nc3_chart_internal_fn.classLine = classLine;\nc3_chart_internal_fn.classLines = classLines;\nc3_chart_internal_fn.classCircle = classCircle;\nc3_chart_internal_fn.classCircles = classCircles;\nc3_chart_internal_fn.classBar = classBar;\nc3_chart_internal_fn.classBars = classBars;\nc3_chart_internal_fn.classArc = classArc;\nc3_chart_internal_fn.classArcs = classArcs;\nc3_chart_internal_fn.classArea = classArea;\nc3_chart_internal_fn.classAreas = classAreas;\nc3_chart_internal_fn.classRegion = classRegion;\nc3_chart_internal_fn.classEvent = classEvent;\nc3_chart_internal_fn.classTarget = classTarget;\nc3_chart_internal_fn.classFocus = classFocus;\nc3_chart_internal_fn.classFocused = classFocused;\nc3_chart_internal_fn.classDefocused = classDefocused;\nc3_chart_internal_fn.classChartText = classChartText;\nc3_chart_internal_fn.classChartLine = classChartLine;\nc3_chart_internal_fn.classChartBar = classChartBar;\nc3_chart_internal_fn.classChartArc = classChartArc;\nc3_chart_internal_fn.getTargetSelectorSuffix = getTargetSelectorSuffix;\nc3_chart_internal_fn.selectorTarget = selectorTarget;\nc3_chart_internal_fn.selectorTargets = selectorTargets;\nc3_chart_internal_fn.selectorLegend = selectorLegend;\nc3_chart_internal_fn.selectorLegends = selectorLegends;\nc3_chart_internal_fn.getClipPath = getClipPath;\nc3_chart_internal_fn.appendClip = appendClip;\nc3_chart_internal_fn.getAxisClipX = getAxisClipX;\nc3_chart_internal_fn.getAxisClipY = getAxisClipY;\nc3_chart_internal_fn.getXAxisClipX = getXAxisClipX;\nc3_chart_internal_fn.getXAxisClipY = getXAxisClipY;\nc3_chart_internal_fn.getYAxisClipX = getYAxisClipX;\nc3_chart_internal_fn.getYAxisClipY = getYAxisClipY;\nc3_chart_internal_fn.getAxisClipWidth = getAxisClipWidth;\nc3_chart_internal_fn.getAxisClipHeight = getAxisClipHeight;\nc3_chart_internal_fn.getXAxisClipWidth = getXAxisClipWidth;\nc3_chart_internal_fn.getXAxisClipHeight = getXAxisClipHeight;\nc3_chart_internal_fn.getYAxisClipWidth = getYAxisClipWidth;\nc3_chart_internal_fn.getYAxisClipHeight = getYAxisClipHeight;\nc3_chart_internal_fn.generateColor = generateColor;\nc3_chart_internal_fn.generateLevelColor = generateLevelColor;\nc3_chart_internal_fn.getDefaultConfig = getDefaultConfig;\nc3_chart_internal_fn.additionalConfig = additionalConfig;\nc3_chart_internal_fn.loadConfig = loadConfig;\nc3_chart_internal_fn.convertUrlToData = convertUrlToData;\nc3_chart_internal_fn.convertXsvToData = convertXsvToData;\nc3_chart_internal_fn.convertCsvToData = convertCsvToData;\nc3_chart_internal_fn.convertTsvToData = convertTsvToData;\nc3_chart_internal_fn.convertJsonToData = convertJsonToData;\nc3_chart_internal_fn.findValueInJson = findValueInJson;\nc3_chart_internal_fn.convertRowsToData = convertRowsToData;\nc3_chart_internal_fn.convertColumnsToData = convertColumnsToData;\nc3_chart_internal_fn.convertDataToTargets = convertDataToTargets;\nc3_chart_internal_fn.isX = isX;\nc3_chart_internal_fn.isNotX = isNotX;\nc3_chart_internal_fn.getXKey = getXKey;\nc3_chart_internal_fn.getXValuesOfXKey = getXValuesOfXKey;\nc3_chart_internal_fn.getIndexByX = getIndexByX;\nc3_chart_internal_fn.getXValue = getXValue;\nc3_chart_internal_fn.getOtherTargetXs = getOtherTargetXs;\nc3_chart_internal_fn.getOtherTargetX = getOtherTargetX;\nc3_chart_internal_fn.addXs = addXs;\nc3_chart_internal_fn.hasMultipleX = hasMultipleX;\nc3_chart_internal_fn.isMultipleX = isMultipleX;\nc3_chart_internal_fn.addName = addName;\nc3_chart_internal_fn.getValueOnIndex = getValueOnIndex;\nc3_chart_internal_fn.updateTargetX = updateTargetX;\nc3_chart_internal_fn.updateTargetXs = updateTargetXs;\nc3_chart_internal_fn.generateTargetX = generateTargetX;\nc3_chart_internal_fn.cloneTarget = cloneTarget;\nc3_chart_internal_fn.updateXs = updateXs;\nc3_chart_internal_fn.getPrevX = getPrevX;\nc3_chart_internal_fn.getNextX = getNextX;\nc3_chart_internal_fn.getMaxDataCount = getMaxDataCount;\nc3_chart_internal_fn.getMaxDataCountTarget = getMaxDataCountTarget;\nc3_chart_internal_fn.getEdgeX = getEdgeX;\nc3_chart_internal_fn.mapToIds = mapToIds;\nc3_chart_internal_fn.mapToTargetIds = mapToTargetIds;\nc3_chart_internal_fn.hasTarget = hasTarget;\nc3_chart_internal_fn.isTargetToShow = isTargetToShow;\nc3_chart_internal_fn.isLegendToShow = isLegendToShow;\nc3_chart_internal_fn.filterTargetsToShow = filterTargetsToShow;\nc3_chart_internal_fn.mapTargetsToUniqueXs = mapTargetsToUniqueXs;\nc3_chart_internal_fn.addHiddenTargetIds = addHiddenTargetIds;\nc3_chart_internal_fn.removeHiddenTargetIds = removeHiddenTargetIds;\nc3_chart_internal_fn.addHiddenLegendIds = addHiddenLegendIds;\nc3_chart_internal_fn.removeHiddenLegendIds = removeHiddenLegendIds;\nc3_chart_internal_fn.getValuesAsIdKeyed = getValuesAsIdKeyed;\nc3_chart_internal_fn.checkValueInTargets = checkValueInTargets;\nc3_chart_internal_fn.hasNegativeValueInTargets = hasNegativeValueInTargets;\nc3_chart_internal_fn.hasPositiveValueInTargets = hasPositiveValueInTargets;\nc3_chart_internal_fn.isOrderDesc = isOrderDesc;\nc3_chart_internal_fn.isOrderAsc = isOrderAsc;\nc3_chart_internal_fn.orderTargets = orderTargets;\nc3_chart_internal_fn.filterByX = filterByX;\nc3_chart_internal_fn.filterRemoveNull = filterRemoveNull;\nc3_chart_internal_fn.filterByXDomain = filterByXDomain;\nc3_chart_internal_fn.hasDataLabel = hasDataLabel;\nc3_chart_internal_fn.getDataLabelLength = getDataLabelLength;\nc3_chart_internal_fn.isNoneArc = isNoneArc;\nc3_chart_internal_fn.isArc = isArc;\nc3_chart_internal_fn.findSameXOfValues = findSameXOfValues;\nc3_chart_internal_fn.findClosestFromTargets = findClosestFromTargets;\nc3_chart_internal_fn.findClosest = findClosest;\nc3_chart_internal_fn.dist = dist;\nc3_chart_internal_fn.convertValuesToStep = convertValuesToStep;\nc3_chart_internal_fn.updateDataAttributes = updateDataAttributes;\nc3_chart_internal_fn.load = load;\nc3_chart_internal_fn.loadFromArgs = loadFromArgs;\nc3_chart_internal_fn.unload = unload;\nc3_chart_internal_fn.getYDomainMin = getYDomainMin;\nc3_chart_internal_fn.getYDomainMax = getYDomainMax;\nc3_chart_internal_fn.getYDomain = getYDomain;\nc3_chart_internal_fn.getXDomainMin = getXDomainMin;\nc3_chart_internal_fn.getXDomainMax = getXDomainMax;\nc3_chart_internal_fn.getXDomainPadding = getXDomainPadding;\nc3_chart_internal_fn.getXDomain = getXDomain;\nc3_chart_internal_fn.updateXDomain = updateXDomain;\nc3_chart_internal_fn.trimXDomain = trimXDomain;\nc3_chart_internal_fn.drag = drag;\nc3_chart_internal_fn.dragstart = dragstart;\nc3_chart_internal_fn.dragend = dragend;\nc3_chart_internal_fn.generateFlow = generateFlow;\nc3_chart_internal_fn.getYFormat = getYFormat;\nc3_chart_internal_fn.yFormat = yFormat;\nc3_chart_internal_fn.y2Format = y2Format;\nc3_chart_internal_fn.defaultValueFormat = defaultValueFormat;\nc3_chart_internal_fn.defaultArcValueFormat = defaultArcValueFormat;\nc3_chart_internal_fn.dataLabelFormat = dataLabelFormat;\nc3_chart_internal_fn.initGrid = initGrid;\nc3_chart_internal_fn.initGridLines = initGridLines;\nc3_chart_internal_fn.updateXGrid = updateXGrid;\nc3_chart_internal_fn.updateYGrid = updateYGrid;\nc3_chart_internal_fn.gridTextAnchor = gridTextAnchor;\nc3_chart_internal_fn.gridTextDx = gridTextDx;\nc3_chart_internal_fn.xGridTextX = xGridTextX;\nc3_chart_internal_fn.yGridTextX = yGridTextX;\nc3_chart_internal_fn.updateGrid = updateGrid;\nc3_chart_internal_fn.redrawGrid = redrawGrid;\nc3_chart_internal_fn.showXGridFocus = showXGridFocus;\nc3_chart_internal_fn.hideXGridFocus = hideXGridFocus;\nc3_chart_internal_fn.updateXgridFocus = updateXgridFocus;\nc3_chart_internal_fn.generateGridData = generateGridData;\nc3_chart_internal_fn.getGridFilterToRemove = getGridFilterToRemove;\nc3_chart_internal_fn.removeGridLines = removeGridLines;\nc3_chart_internal_fn.initEventRect = initEventRect;\nc3_chart_internal_fn.redrawEventRect = redrawEventRect;\nc3_chart_internal_fn.updateEventRect = updateEventRect;\nc3_chart_internal_fn.generateEventRectsForSingleX = generateEventRectsForSingleX;\nc3_chart_internal_fn.generateEventRectsForMultipleXs = generateEventRectsForMultipleXs;\nc3_chart_internal_fn.dispatchEvent = dispatchEvent;\nc3_chart_internal_fn.initLegend = initLegend;\nc3_chart_internal_fn.updateLegendWithDefaults = updateLegendWithDefaults;\nc3_chart_internal_fn.updateSizeForLegend = updateSizeForLegend;\nc3_chart_internal_fn.transformLegend = transformLegend;\nc3_chart_internal_fn.updateLegendStep = updateLegendStep;\nc3_chart_internal_fn.updateLegendItemWidth = updateLegendItemWidth;\nc3_chart_internal_fn.updateLegendItemHeight = updateLegendItemHeight;\nc3_chart_internal_fn.getLegendWidth = getLegendWidth;\nc3_chart_internal_fn.getLegendHeight = getLegendHeight;\nc3_chart_internal_fn.opacityForLegend = opacityForLegend;\nc3_chart_internal_fn.opacityForUnfocusedLegend = opacityForUnfocusedLegend;\nc3_chart_internal_fn.toggleFocusLegend = toggleFocusLegend;\nc3_chart_internal_fn.revertLegend = revertLegend;\nc3_chart_internal_fn.showLegend = showLegend;\nc3_chart_internal_fn.hideLegend = hideLegend;\nc3_chart_internal_fn.clearLegendItemTextBoxCache = clearLegendItemTextBoxCache;\nc3_chart_internal_fn.updateLegend = updateLegend;\nc3_chart_internal_fn.initRegion = initRegion;\nc3_chart_internal_fn.updateRegion = updateRegion;\nc3_chart_internal_fn.redrawRegion = redrawRegion;\nc3_chart_internal_fn.regionX = regionX;\nc3_chart_internal_fn.regionY = regionY;\nc3_chart_internal_fn.regionWidth = regionWidth;\nc3_chart_internal_fn.regionHeight = regionHeight;\nc3_chart_internal_fn.isRegionOnX = isRegionOnX;\nc3_chart_internal_fn.getScale = getScale;\nc3_chart_internal_fn.getX = getX;\nc3_chart_internal_fn.getY = getY;\nc3_chart_internal_fn.getYScale = getYScale;\nc3_chart_internal_fn.getSubYScale = getSubYScale;\nc3_chart_internal_fn.updateScales = updateScales;\nc3_chart_internal_fn.selectPoint = selectPoint;\nc3_chart_internal_fn.unselectPoint = unselectPoint;\nc3_chart_internal_fn.togglePoint = togglePoint;\nc3_chart_internal_fn.selectPath = selectPath;\nc3_chart_internal_fn.unselectPath = unselectPath;\nc3_chart_internal_fn.togglePath = togglePath;\nc3_chart_internal_fn.getToggle = getToggle;\nc3_chart_internal_fn.toggleShape = toggleShape;\nc3_chart_internal_fn.initBar = initBar;\nc3_chart_internal_fn.updateTargetsForBar = updateTargetsForBar;\nc3_chart_internal_fn.updateBar = updateBar;\nc3_chart_internal_fn.redrawBar = redrawBar;\nc3_chart_internal_fn.getBarW = getBarW;\nc3_chart_internal_fn.getBars = getBars;\nc3_chart_internal_fn.expandBars = expandBars;\nc3_chart_internal_fn.unexpandBars = unexpandBars;\nc3_chart_internal_fn.generateDrawBar = generateDrawBar;\nc3_chart_internal_fn.generateGetBarPoints = generateGetBarPoints;\nc3_chart_internal_fn.isWithinBar = isWithinBar;\nc3_chart_internal_fn.getShapeIndices = getShapeIndices;\nc3_chart_internal_fn.getShapeX = getShapeX;\nc3_chart_internal_fn.getShapeY = getShapeY;\nc3_chart_internal_fn.getShapeOffset = getShapeOffset;\nc3_chart_internal_fn.isWithinShape = isWithinShape;\nc3_chart_internal_fn.getInterpolate = getInterpolate;\nc3_chart_internal_fn.initLine = initLine;\nc3_chart_internal_fn.updateTargetsForLine = updateTargetsForLine;\nc3_chart_internal_fn.updateLine = updateLine;\nc3_chart_internal_fn.redrawLine = redrawLine;\nc3_chart_internal_fn.generateDrawLine = generateDrawLine;\nc3_chart_internal_fn.generateGetLinePoints = generateGetLinePoints;\nc3_chart_internal_fn.lineWithRegions = lineWithRegions;\nc3_chart_internal_fn.updateArea = updateArea;\nc3_chart_internal_fn.redrawArea = redrawArea;\nc3_chart_internal_fn.generateDrawArea = generateDrawArea;\nc3_chart_internal_fn.getAreaBaseValue = getAreaBaseValue;\nc3_chart_internal_fn.generateGetAreaPoints = generateGetAreaPoints;\nc3_chart_internal_fn.updateCircle = updateCircle;\nc3_chart_internal_fn.redrawCircle = redrawCircle;\nc3_chart_internal_fn.circleX = circleX;\nc3_chart_internal_fn.updateCircleY = updateCircleY;\nc3_chart_internal_fn.getCircles = getCircles;\nc3_chart_internal_fn.expandCircles = expandCircles;\nc3_chart_internal_fn.unexpandCircles = unexpandCircles;\nc3_chart_internal_fn.pointR = pointR;\nc3_chart_internal_fn.pointExpandedR = pointExpandedR;\nc3_chart_internal_fn.pointSelectR = pointSelectR;\nc3_chart_internal_fn.isWithinCircle = isWithinCircle;\nc3_chart_internal_fn.isWithinStep = isWithinStep;\nc3_chart_internal_fn.getCurrentWidth = getCurrentWidth;\nc3_chart_internal_fn.getCurrentHeight = getCurrentHeight;\nc3_chart_internal_fn.getCurrentPaddingTop = getCurrentPaddingTop;\nc3_chart_internal_fn.getCurrentPaddingBottom = getCurrentPaddingBottom;\nc3_chart_internal_fn.getCurrentPaddingLeft = getCurrentPaddingLeft;\nc3_chart_internal_fn.getCurrentPaddingRight = getCurrentPaddingRight;\nc3_chart_internal_fn.getParentRectValue = getParentRectValue;\nc3_chart_internal_fn.getParentWidth = getParentWidth;\nc3_chart_internal_fn.getParentHeight = getParentHeight;\nc3_chart_internal_fn.getSvgLeft = getSvgLeft;\nc3_chart_internal_fn.getAxisWidthByAxisId = getAxisWidthByAxisId;\nc3_chart_internal_fn.getHorizontalAxisHeight = getHorizontalAxisHeight;\nc3_chart_internal_fn.getEventRectWidth = getEventRectWidth;\nc3_chart_internal_fn.initBrush = initBrush;\nc3_chart_internal_fn.initSubchart = initSubchart;\nc3_chart_internal_fn.updateTargetsForSubchart = updateTargetsForSubchart;\nc3_chart_internal_fn.updateBarForSubchart = updateBarForSubchart;\nc3_chart_internal_fn.redrawBarForSubchart = redrawBarForSubchart;\nc3_chart_internal_fn.updateLineForSubchart = updateLineForSubchart;\nc3_chart_internal_fn.redrawLineForSubchart = redrawLineForSubchart;\nc3_chart_internal_fn.updateAreaForSubchart = updateAreaForSubchart;\nc3_chart_internal_fn.redrawAreaForSubchart = redrawAreaForSubchart;\nc3_chart_internal_fn.redrawSubchart = redrawSubchart;\nc3_chart_internal_fn.redrawForBrush = redrawForBrush;\nc3_chart_internal_fn.transformContext = transformContext;\nc3_chart_internal_fn.getDefaultExtent = getDefaultExtent;\nc3_chart_internal_fn.initText = initText;\nc3_chart_internal_fn.updateTargetsForText = updateTargetsForText;\nc3_chart_internal_fn.updateText = updateText;\nc3_chart_internal_fn.redrawText = redrawText;\nc3_chart_internal_fn.getTextRect = getTextRect;\nc3_chart_internal_fn.generateXYForText = generateXYForText;\nc3_chart_internal_fn.getXForText = getXForText;\nc3_chart_internal_fn.getYForText = getYForText;\nc3_chart_internal_fn.initTitle = initTitle;\nc3_chart_internal_fn.redrawTitle = redrawTitle;\nc3_chart_internal_fn.xForTitle = xForTitle;\nc3_chart_internal_fn.yForTitle = yForTitle;\nc3_chart_internal_fn.getTitlePadding = getTitlePadding;\nc3_chart_internal_fn.initTooltip = initTooltip;\nc3_chart_internal_fn.getTooltipContent = getTooltipContent;\nc3_chart_internal_fn.tooltipPosition = tooltipPosition;\nc3_chart_internal_fn.showTooltip = showTooltip;\nc3_chart_internal_fn.hideTooltip = hideTooltip;\nc3_chart_internal_fn.transformTo = transformTo;\nc3_chart_internal_fn.setTargetType = setTargetType;\nc3_chart_internal_fn.hasType = hasType;\nc3_chart_internal_fn.hasArcType = hasArcType;\nc3_chart_internal_fn.isLineType = isLineType;\nc3_chart_internal_fn.isStepType = isStepType;\nc3_chart_internal_fn.isSplineType = isSplineType;\nc3_chart_internal_fn.isAreaType = isAreaType;\nc3_chart_internal_fn.isBarType = isBarType;\nc3_chart_internal_fn.isScatterType = isScatterType;\nc3_chart_internal_fn.isPieType = isPieType;\nc3_chart_internal_fn.isGaugeType = isGaugeType;\nc3_chart_internal_fn.isDonutType = isDonutType;\nc3_chart_internal_fn.isArcType = isArcType;\nc3_chart_internal_fn.lineData = lineData;\nc3_chart_internal_fn.arcData = arcData;\nc3_chart_internal_fn.barData = barData;\nc3_chart_internal_fn.lineOrScatterData = lineOrScatterData;\nc3_chart_internal_fn.barOrLineData = barOrLineData;\nc3_chart_internal_fn.isInterpolationType = isInterpolationType;\nc3_chart_internal_fn.initZoom = initZoom;\nc3_chart_internal_fn.getZoomDomain = getZoomDomain;\nc3_chart_internal_fn.updateZoom = updateZoom;\nc3_chart_internal_fn.redrawForZoom = redrawForZoom;\n\nexport { ChartInternal, c3_chart_internal_fn };\nexport { CLASS };\n","import {\n isValue,\n isDefined,\n} from '../internals/index';\n\nconst axis = function () {};\naxis.labels = function (labels) {\n const $$ = this.internal;\n if (arguments.length) {\n Object.keys(labels).forEach((axisId) => {\n $$.axis.setLabelText(axisId, labels[axisId]);\n });\n $$.axis.updateLabels();\n }\n // TODO: return some values?\n};\naxis.max = function (max) {\n let $$ = this.internal, config = $$.config;\n if (arguments.length) {\n if (typeof max === 'object') {\n if (isValue(max.x)) { config.axis_x_max = max.x; }\n if (isValue(max.y)) { config.axis_y_max = max.y; }\n if (isValue(max.y2)) { config.axis_y2_max = max.y2; }\n } else {\n config.axis_y_max = config.axis_y2_max = max;\n }\n $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true });\n } else {\n return {\n x: config.axis_x_max,\n y: config.axis_y_max,\n y2: config.axis_y2_max,\n };\n }\n};\naxis.min = function (min) {\n let $$ = this.internal, config = $$.config;\n if (arguments.length) {\n if (typeof min === 'object') {\n if (isValue(min.x)) { config.axis_x_min = min.x; }\n if (isValue(min.y)) { config.axis_y_min = min.y; }\n if (isValue(min.y2)) { config.axis_y2_min = min.y2; }\n } else {\n config.axis_y_min = config.axis_y2_min = min;\n }\n $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true });\n } else {\n return {\n x: config.axis_x_min,\n y: config.axis_y_min,\n y2: config.axis_y2_min,\n };\n }\n};\naxis.range = function (range) {\n if (arguments.length) {\n if (isDefined(range.max)) { this.axis.max(range.max); }\n if (isDefined(range.min)) { this.axis.min(range.min); }\n } else {\n return {\n max: this.axis.max(),\n min: this.axis.min(),\n };\n }\n};\n\nexport { axis };\n","const category = function (i, category) {\n let $$ = this.internal, config = $$.config;\n if (arguments.length > 1) {\n config.axis_x_categories[i] = category;\n $$.redraw();\n }\n return config.axis_x_categories[i];\n};\nconst categories = function (categories) {\n let $$ = this.internal, config = $$.config;\n if (!arguments.length) { return config.axis_x_categories; }\n config.axis_x_categories = categories;\n $$.redraw();\n return config.axis_x_categories;\n};\n\nexport { category, categories };\n","const resize = function (size) {\n let $$ = this.internal, config = $$.config;\n config.size_width = size ? size.width : null;\n config.size_height = size ? size.height : null;\n this.flush();\n};\n\nconst flush = function () {\n const $$ = this.internal;\n $$.updateAndRedraw({ withLegend: true, withTransition: false, withTransitionForTransform: false });\n};\n\nconst destroy = function () {\n const $$ = this.internal;\n\n window.clearInterval($$.intervalForObserveInserted);\n\n if ($$.resizeTimeout !== undefined) {\n window.clearTimeout($$.resizeTimeout);\n }\n\n if (window.detachEvent) {\n window.detachEvent('onresize', $$.resizeFunction);\n } else if (window.removeEventListener) {\n window.removeEventListener('resize', $$.resizeFunction);\n } else {\n const wrapper = window.onresize;\n // check if no one else removed our wrapper and remove our resizeFunction from it\n if (wrapper && wrapper.add && wrapper.remove) {\n wrapper.remove($$.resizeFunction);\n }\n }\n\n $$.selectChart.classed('c3', false).html('');\n\n // MEMO: this is needed because the reference of some elements will not be released,\n // then memory leak will happen.\n Object.keys($$).forEach((key) => {\n $$[key] = null;\n });\n\n return null;\n};\n\nexport { resize, flush, destroy };\n","// TODO: fix\nconst color = function (id) {\n const $$ = this.internal;\n return $$.color(id); // more patterns\n};\n\nexport { color };\n","const data = function (targetIds) {\n const targets = this.internal.data.targets;\n return typeof targetIds === 'undefined' ? targets : targets.filter((t) => {\n return [].concat(targetIds).indexOf(t.id) >= 0;\n });\n};\n\ndata.shown = function (targetIds) {\n return this.internal.filterTargetsToShow(this.data(targetIds));\n};\n\ndata.values = function (targetId) {\n let targets, values = null;\n if (targetId) {\n targets = this.data(targetId);\n values = targets[0] ? targets[0].values.map((d) => { return d.value; }) : null;\n }\n return values;\n};\n\ndata.names = function (names) {\n this.internal.clearLegendItemTextBoxCache();\n return this.internal.updateDataAttributes('names', names);\n};\n\ndata.colors = function (colors) {\n return this.internal.updateDataAttributes('colors', colors);\n};\n\ndata.axes = function (axes) {\n return this.internal.updateDataAttributes('axes', axes);\n};\n\nexport { data };\n","import {\n isValue,\n isDefined,\n} from '../internals/index';\n\nconst flow = function (args) {\n let $$ = this.internal,\n targets, data, notfoundIds = [],\n orgDataCount = $$.getMaxDataCount(),\n dataCount, domain, baseTarget, baseValue, length = 0,\n tail = 0,\n diff, to;\n\n if (args.json) {\n data = $$.convertJsonToData(args.json, args.keys);\n } else if (args.rows) {\n data = $$.convertRowsToData(args.rows);\n } else if (args.columns) {\n data = $$.convertColumnsToData(args.columns);\n } else {\n return;\n }\n targets = $$.convertDataToTargets(data, true);\n\n // Update/Add data\n $$.data.targets.forEach((t) => {\n let found = false,\n i, j;\n for (i = 0; i < targets.length; i++) {\n if (t.id === targets[i].id) {\n found = true;\n\n if (t.values[t.values.length - 1]) {\n tail = t.values[t.values.length - 1].index + 1;\n }\n length = targets[i].values.length;\n\n for (j = 0; j < length; j++) {\n targets[i].values[j].index = tail + j;\n if (!$$.isTimeSeries()) {\n targets[i].values[j].x = tail + j;\n }\n }\n t.values = t.values.concat(targets[i].values);\n\n targets.splice(i, 1);\n break;\n }\n }\n if (!found) { notfoundIds.push(t.id); }\n });\n\n // Append null for not found targets\n $$.data.targets.forEach((t) => {\n let i, j;\n for (i = 0; i < notfoundIds.length; i++) {\n if (t.id === notfoundIds[i]) {\n tail = t.values[t.values.length - 1].index + 1;\n for (j = 0; j < length; j++) {\n t.values.push({\n id: t.id,\n index: tail + j,\n x: $$.isTimeSeries() ? $$.getOtherTargetX(tail + j) : tail + j,\n value: null,\n });\n }\n }\n }\n });\n\n // Generate null values for new target\n if ($$.data.targets.length) {\n targets.forEach((t) => {\n let i, missing = [];\n for (i = $$.data.targets[0].values[0].index; i < tail; i++) {\n missing.push({\n id: t.id,\n index: i,\n x: $$.isTimeSeries() ? $$.getOtherTargetX(i) : i,\n value: null,\n });\n }\n t.values.forEach((v) => {\n v.index += tail;\n if (!$$.isTimeSeries()) {\n v.x += tail;\n }\n });\n t.values = missing.concat(t.values);\n });\n }\n $$.data.targets = $$.data.targets.concat(targets); // add remained\n\n // check data count because behavior needs to change when it's only one\n dataCount = $$.getMaxDataCount();\n baseTarget = $$.data.targets[0];\n baseValue = baseTarget.values[0];\n\n // Update length to flow if needed\n if (isDefined(args.to)) {\n length = 0;\n to = $$.isTimeSeries() ? $$.parseDate(args.to) : args.to;\n baseTarget.values.forEach((v) => {\n if (v.x < to) { length++; }\n });\n } else if (isDefined(args.length)) {\n length = args.length;\n }\n\n // If only one data, update the domain to flow from left edge of the chart\n if (!orgDataCount) {\n if ($$.isTimeSeries()) {\n if (baseTarget.values.length > 1) {\n diff = baseTarget.values[baseTarget.values.length - 1].x - baseValue.x;\n } else {\n diff = baseValue.x - $$.getXDomain($$.data.targets)[0];\n }\n } else {\n diff = 1;\n }\n domain = [baseValue.x - diff, baseValue.x];\n $$.updateXDomain(null, true, true, false, domain);\n } else if (orgDataCount === 1) {\n if ($$.isTimeSeries()) {\n diff = (baseTarget.values[baseTarget.values.length - 1].x - baseValue.x) / 2;\n domain = [new Date(+baseValue.x - diff), new Date(+baseValue.x + diff)];\n $$.updateXDomain(null, true, true, false, domain);\n }\n }\n\n // Set targets\n $$.updateTargets($$.data.targets);\n\n // Redraw with new targets\n $$.redraw({\n flow: {\n index: baseValue.index,\n length,\n duration: isValue(args.duration) ? args.duration : $$.config.transition_duration,\n done: args.done,\n orgDataCount,\n },\n withLegend: true,\n withTransition: orgDataCount > 1,\n withTrimXDomain: false,\n withUpdateXAxis: true,\n });\n};\n\nexport { flow };\n","import {\n CLASS,\n} from '../internals/index';\n\nconst focus = function (targetIds) {\n let $$ = this.internal, candidates;\n\n targetIds = $$.mapToTargetIds(targetIds);\n candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))),\n\n this.revert();\n this.defocus();\n candidates.classed(CLASS.focused, true).classed(CLASS.defocused, false);\n if ($$.hasArcType()) {\n $$.expandArc(targetIds);\n }\n $$.toggleFocusLegend(targetIds, true);\n\n $$.focusedTargetIds = targetIds;\n $$.defocusedTargetIds = $$.defocusedTargetIds.filter((id) => {\n return targetIds.indexOf(id) < 0;\n });\n};\n\nconst defocus = function (targetIds) {\n let $$ = this.internal, candidates;\n\n targetIds = $$.mapToTargetIds(targetIds);\n candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))),\n\n candidates.classed(CLASS.focused, false).classed(CLASS.defocused, true);\n if ($$.hasArcType()) {\n $$.unexpandArc(targetIds);\n }\n $$.toggleFocusLegend(targetIds, false);\n\n $$.focusedTargetIds = $$.focusedTargetIds.filter((id) => {\n return targetIds.indexOf(id) < 0;\n });\n $$.defocusedTargetIds = targetIds;\n};\n\nconst revert = function (targetIds) {\n let $$ = this.internal, candidates;\n\n targetIds = $$.mapToTargetIds(targetIds);\n candidates = $$.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets\n\n candidates.classed(CLASS.focused, false).classed(CLASS.defocused, false);\n if ($$.hasArcType()) {\n $$.unexpandArc(targetIds);\n }\n if ($$.config.legend_show) {\n $$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));\n $$.legend.selectAll($$.selectorLegends(targetIds))\n .filter(function () {\n return $$.d3.select(this).classed(CLASS.legendItemFocused);\n })\n .classed(CLASS.legendItemFocused, false);\n }\n\n $$.focusedTargetIds = [];\n $$.defocusedTargetIds = [];\n};\n\nexport { focus, defocus, revert };\n","const xgrids = function (grids) {\n let $$ = this.internal, config = $$.config;\n if (!grids) { return config.grid_x_lines; }\n config.grid_x_lines = grids;\n $$.redrawWithoutRescale();\n return config.grid_x_lines;\n};\n\nxgrids.add = function (grids) {\n const $$ = this.internal;\n return this.xgrids($$.config.grid_x_lines.concat(grids ? grids : []));\n};\n\nxgrids.remove = function (params) { // TODO: multiple\n const $$ = this.internal;\n $$.removeGridLines(params, true);\n};\n\nconst ygrids = function (grids) {\n let $$ = this.internal, config = $$.config;\n if (!grids) { return config.grid_y_lines; }\n config.grid_y_lines = grids;\n $$.redrawWithoutRescale();\n return config.grid_y_lines;\n};\n\nygrids.add = function (grids) {\n const $$ = this.internal;\n return this.ygrids($$.config.grid_y_lines.concat(grids ? grids : []));\n};\n\nygrids.remove = function (params) { // TODO: multiple\n const $$ = this.internal;\n $$.removeGridLines(params, false);\n};\n\nexport { xgrids, ygrids };\n","import {\n isUndefined,\n} from '../internals/index';\n\nconst groups = function (groups) {\n let $$ = this.internal, config = $$.config;\n if (isUndefined(groups)) { return config.data_groups; }\n config.data_groups = groups;\n $$.redraw();\n return config.data_groups;\n};\n\nexport { groups };\n","const legend = function () {};\n\nlegend.show = function (targetIds) {\n const $$ = this.internal;\n $$.showLegend($$.mapToTargetIds(targetIds));\n $$.updateAndRedraw({ withLegend: true });\n};\n\nlegend.hide = function (targetIds) {\n const $$ = this.internal;\n $$.hideLegend($$.mapToTargetIds(targetIds));\n $$.updateAndRedraw({ withLegend: true });\n};\n\nexport { legend };\n","import { c3_chart_fn } from './index';\n\nconst load = function (args) {\n let $$ = this.internal, config = $$.config;\n // update xs if specified\n if (args.xs) {\n $$.addXs(args.xs);\n }\n // update names if exists\n if ('names' in args) {\n c3_chart_fn.data.names.bind(this)(args.names);\n }\n // update classes if exists\n if ('classes' in args) {\n Object.keys(args.classes).forEach((id) => {\n config.data_classes[id] = args.classes[id];\n });\n }\n // update categories if exists\n if ('categories' in args && $$.isCategorized()) {\n config.axis_x_categories = args.categories;\n }\n // update axes if exists\n if ('axes' in args) {\n Object.keys(args.axes).forEach((id) => {\n config.data_axes[id] = args.axes[id];\n });\n }\n // update colors if exists\n if ('colors' in args) {\n Object.keys(args.colors).forEach((id) => {\n config.data_colors[id] = args.colors[id];\n });\n }\n // use cache if exists\n if ('cacheIds' in args && $$.hasCaches(args.cacheIds)) {\n $$.load($$.getCaches(args.cacheIds), args.done);\n return;\n }\n // unload if needed\n if ('unload' in args) {\n // TODO: do not unload if target will load (included in url/rows/columns)\n $$.unload($$.mapToTargetIds((typeof args.unload === 'boolean' && args.unload) ? null : args.unload), () => {\n $$.loadFromArgs(args);\n });\n } else {\n $$.loadFromArgs(args);\n }\n};\n\nconst unload = function (args) {\n const $$ = this.internal;\n args = args || {};\n if (args instanceof Array) {\n args = { ids: args };\n } else if (typeof args === 'string') {\n args = { ids: [args] };\n }\n $$.unload($$.mapToTargetIds(args.ids), () => {\n $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true });\n if (args.done) { args.done(); }\n });\n};\n\nexport { load, unload };\n","import {\n CLASS,\n isValue,\n isFunction,\n isString,\n isUndefined,\n isDefined,\n ceil10,\n asHalfPixel,\n diffDomain,\n isEmpty,\n notEmpty,\n getOption,\n hasValue,\n sanitise,\n getPathBox,\n ChartInternal\n} from '../internals/index';\n\nconst regions = function (regions) {\n let $$ = this.internal, config = $$.config;\n if (!regions) { return config.regions; }\n config.regions = regions;\n $$.redrawWithoutRescale();\n return config.regions;\n};\n\nregions.add = function (regions) {\n let $$ = this.internal, config = $$.config;\n if (!regions) { return config.regions; }\n config.regions = config.regions.concat(regions);\n $$.redrawWithoutRescale();\n return config.regions;\n};\n\nregions.remove = function (options) {\n let $$ = this.internal, config = $$.config,\n duration, classes, regions;\n\n options = options || {};\n duration = $$.getOption(options, 'duration', config.transition_duration);\n classes = $$.getOption(options, 'classes', [CLASS.region]);\n\n regions = $$.main.select('.' + CLASS.regions).selectAll(classes.map((c) => { return '.' + c; }));\n (duration ? regions.transition().duration(duration) : regions)\n .style('opacity', 0)\n .remove();\n\n config.regions = config.regions.filter((region) => {\n let found = false;\n if (!region.class) {\n return true;\n }\n region.class.split(' ').forEach((c) => {\n if (classes.indexOf(c) >= 0) { found = true; }\n });\n return !found;\n });\n\n return config.regions;\n};\n\nexport { regions };\n","import {\n CLASS,\n isValue,\n isFunction,\n isString,\n isUndefined,\n isDefined,\n ceil10,\n asHalfPixel,\n diffDomain,\n isEmpty,\n notEmpty,\n getOption,\n hasValue,\n sanitise,\n getPathBox,\n ChartInternal\n} from '../internals/index';\n\nconst selected = function (targetId) {\n let $$ = this.internal, d3 = $$.d3;\n return d3.merge(\n $$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape)\n .filter(function () { return d3.select(this).classed(CLASS.SELECTED); })\n .map((d) => { return d.map((d) => { const data = d.__data__; return data.data ? data.data : data; }); })\n );\n};\n\nconst select = function (ids, indices, resetOther) {\n let $$ = this.internal, d3 = $$.d3, config = $$.config;\n if (!config.data_selection_enabled) { return; }\n $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) {\n let shape = d3.select(this), id = d.data ? d.data.id : d.id,\n toggle = $$.getToggle(this, d).bind($$),\n isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,\n isTargetIndex = !indices || indices.indexOf(i) >= 0,\n isSelected = shape.classed(CLASS.SELECTED);\n // line/area selection not supported yet\n if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) {\n return;\n }\n if (isTargetId && isTargetIndex) {\n if (config.data_selection_isselectable(d) && !isSelected) {\n toggle(true, shape.classed(CLASS.SELECTED, true), d, i);\n }\n } else if (isDefined(resetOther) && resetOther) {\n if (isSelected) {\n toggle(false, shape.classed(CLASS.SELECTED, false), d, i);\n }\n }\n });\n};\n\nconst unselect = function (ids, indices) {\n let $$ = this.internal, d3 = $$.d3, config = $$.config;\n if (!config.data_selection_enabled) { return; }\n $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) {\n let shape = d3.select(this), id = d.data ? d.data.id : d.id,\n toggle = $$.getToggle(this, d).bind($$),\n isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,\n isTargetIndex = !indices || indices.indexOf(i) >= 0,\n isSelected = shape.classed(CLASS.SELECTED);\n // line/area selection not supported yet\n if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) {\n return;\n }\n if (isTargetId && isTargetIndex) {\n if (config.data_selection_isselectable(d)) {\n if (isSelected) {\n toggle(false, shape.classed(CLASS.SELECTED, false), d, i);\n }\n }\n }\n });\n};\n\nexport { selected, select, unselect };\n","import {\n CLASS,\n isValue,\n isFunction,\n isString,\n isUndefined,\n isDefined,\n ceil10,\n asHalfPixel,\n diffDomain,\n isEmpty,\n notEmpty,\n getOption,\n hasValue,\n sanitise,\n getPathBox,\n ChartInternal\n} from '../internals/index';\n\nconst show = function (targetIds, options) {\n let $$ = this.internal, targets;\n\n targetIds = $$.mapToTargetIds(targetIds);\n options = options || {};\n\n $$.removeHiddenTargetIds(targetIds);\n targets = $$.svg.selectAll($$.selectorTargets(targetIds));\n\n targets.transition()\n .style('opacity', 1, 'important')\n .call($$.endall, () => {\n targets.style('opacity', null).style('opacity', 1);\n });\n\n if (options.withLegend) {\n $$.showLegend(targetIds);\n }\n\n $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true });\n};\n\nconst hide = function (targetIds, options) {\n let $$ = this.internal, targets;\n\n targetIds = $$.mapToTargetIds(targetIds);\n options = options || {};\n\n $$.addHiddenTargetIds(targetIds);\n targets = $$.svg.selectAll($$.selectorTargets(targetIds));\n\n targets.transition()\n .style('opacity', 0, 'important')\n .call($$.endall, () => {\n targets.style('opacity', null).style('opacity', 0);\n });\n\n if (options.withLegend) {\n $$.hideLegend(targetIds);\n }\n\n $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true });\n};\n\nconst toggle = function (targetIds, options) {\n let that = this, $$ = this.internal;\n $$.mapToTargetIds(targetIds).forEach((targetId) => {\n $$.isTargetToShow(targetId) ? that.hide(targetId, options) : that.show(targetId, options);\n });\n};\n\nexport { show, hide, toggle };\n","import {\n CLASS,\n isValue,\n isFunction,\n isString,\n isUndefined,\n isDefined,\n ceil10,\n asHalfPixel,\n diffDomain,\n isEmpty,\n notEmpty,\n getOption,\n hasValue,\n sanitise,\n getPathBox,\n ChartInternal\n} from '../internals/index';\n\nconst tooltip = function () {};\n\ntooltip.show = function (args) {\n let $$ = this.internal, index, mouse;\n\n // determine mouse position on the chart\n if (args.mouse) {\n mouse = args.mouse;\n }\n\n // determine focus data\n if (args.data) {\n if ($$.isMultipleX()) {\n // if multiple xs, target point will be determined by mouse\n mouse = [$$.x(args.data.x), $$.getYScale(args.data.id)(args.data.value)];\n index = null;\n } else {\n // TODO: when tooltip_grouped = false\n index = isValue(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x);\n }\n } else if (typeof args.x !== 'undefined') {\n index = $$.getIndexByX(args.x);\n } else if (typeof args.index !== 'undefined') {\n index = args.index;\n }\n\n // emulate mouse events to show\n $$.dispatchEvent('mouseover', index, mouse);\n $$.dispatchEvent('mousemove', index, mouse);\n\n $$.config.tooltip_onshow.call($$, args.data);\n};\n\ntooltip.hide = function () {\n // TODO: get target data by checking the state of focus\n this.internal.dispatchEvent('mouseout', 0);\n\n this.internal.config.tooltip_onhide.call(this);\n};\n\nexport { tooltip };\n","import {\n CLASS,\n isValue,\n isFunction,\n isString,\n isUndefined,\n isDefined,\n ceil10,\n asHalfPixel,\n diffDomain,\n isEmpty,\n notEmpty,\n getOption,\n hasValue,\n sanitise,\n getPathBox,\n ChartInternal\n} from '../internals/index';\n\nconst transform = function (type, targetIds) {\n let $$ = this.internal,\n options = ['pie', 'donut'].indexOf(type) >= 0 ? { withTransform: true } : null;\n $$.transformTo(targetIds, type, options);\n};\n\nexport { transform };\n","import {\n CLASS,\n isValue,\n isFunction,\n isString,\n isUndefined,\n isDefined,\n ceil10,\n asHalfPixel,\n diffDomain,\n isEmpty,\n notEmpty,\n getOption,\n hasValue,\n sanitise,\n getPathBox,\n ChartInternal\n} from '../internals/index';\n\nconst x = function (x) {\n const $$ = this.internal;\n if (arguments.length) {\n $$.updateTargetX($$.data.targets, x);\n $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true });\n }\n return $$.data.xs;\n};\n\nconst xs = function (xs) {\n const $$ = this.internal;\n if (arguments.length) {\n $$.updateTargetXs($$.data.targets, xs);\n $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true });\n }\n return $$.data.xs;\n};\n\nexport { x, xs };\n","import {\n CLASS,\n isValue,\n isFunction,\n isString,\n isUndefined,\n isDefined,\n ceil10,\n asHalfPixel,\n diffDomain,\n isEmpty,\n notEmpty,\n getOption,\n hasValue,\n sanitise,\n getPathBox,\n ChartInternal\n} from '../internals/index';\n\nconst zoom = function (domain) {\n const $$ = this.internal;\n if (domain) {\n if ($$.isTimeSeries()) {\n domain = domain.map((x) => { return $$.parseDate(x); });\n }\n $$.brush.extent(domain);\n $$.redraw({ withUpdateXDomain: true, withY: $$.config.zoom_rescale });\n $$.config.zoom_onzoom.call(this, $$.x.orgDomain());\n }\n return $$.brush.extent();\n};\n\nconst unzoom = function () {\n const $$ = this.internal;\n $$.brush.clear().update();\n $$.redraw({ withUpdateXDomain: true });\n};\n\nzoom.enable = function (enabled) {\n const $$ = this.internal;\n $$.config.zoom_enabled = enabled;\n $$.updateAndRedraw();\n};\n\nzoom.max = function (max) {\n let $$ = this.internal, config = $$.config, d3 = $$.d3;\n if (max === 0 || max) {\n config.zoom_x_max = d3.max([$$.orgXDomain[1], max]);\n }\n else {\n return config.zoom_x_max;\n }\n};\n\nzoom.min = function (min) {\n let $$ = this.internal, config = $$.config, d3 = $$.d3;\n if (min === 0 || min) {\n config.zoom_x_min = d3.min([$$.orgXDomain[0], min]);\n }\n else {\n return config.zoom_x_min;\n }\n};\n\nzoom.range = function (range) {\n if (arguments.length) {\n if (isDefined(range.max)) { this.domain.max(range.max); }\n if (isDefined(range.min)) { this.domain.min(range.min); }\n } else {\n return {\n max: this.domain.max(),\n min: this.domain.min(),\n };\n }\n};\n\nexport { zoom, unzoom };\n","import { ChartInternal } from '../internals/index';\n\nimport { axis } from './api.axis';\nimport { category, categories } from './api.category';\nimport { resize, flush, destroy } from './api.chart';\nimport { color } from './api.color';\nimport { data } from './api.data';\nimport { flow } from './api.flow';\nimport { focus, defocus, revert } from './api.focus';\nimport { xgrids, ygrids } from './api.grid';\nimport { groups } from './api.group';\nimport { legend } from './api.legend';\nimport { load, unload } from './api.load';\nimport { regions } from './api.region';\nimport { selected, select, unselect } from './api.selection';\nimport { show, hide, toggle } from './api.show';\nimport { tooltip } from './api.tooltip';\nimport { transform } from './api.transform';\nimport { x, xs } from './api.x';\nimport { zoom, unzoom } from './api.zoom';\n\n\nlet c3_chart_fn;\n\nfunction Chart(config) {\n const $$ = this.internal = new ChartInternal(this);\n $$.loadConfig(config);\n\n $$.beforeInit(config);\n $$.init();\n $$.afterInit(config);\n\n // bind \"this\" to nested API\n (function bindThis(fn, target, argThis) {\n Object.keys(fn).forEach((key) => {\n target[key] = fn[key].bind(argThis);\n if (Object.keys(fn[key]).length > 0) {\n bindThis(fn[key], target[key], argThis);\n }\n });\n })(c3_chart_fn, this, this);\n}\n\nc3_chart_fn = Chart.prototype;\n\nc3_chart_fn.axis = axis;\nc3_chart_fn.category = category;\nc3_chart_fn.categories = categories;\nc3_chart_fn.resize = resize;\nc3_chart_fn.flush = flush;\nc3_chart_fn.destroy = destroy;\nc3_chart_fn.color = color;\nc3_chart_fn.data = data;\nc3_chart_fn.flow = flow;\nc3_chart_fn.focus = focus;\nc3_chart_fn.defocus = defocus;\nc3_chart_fn.revert = revert;\nc3_chart_fn.xgrids = xgrids;\nc3_chart_fn.ygrids = ygrids;\nc3_chart_fn.groups = groups;\nc3_chart_fn.legend = legend;\nc3_chart_fn.load = load;\nc3_chart_fn.unload = unload;\nc3_chart_fn.regions = regions;\nc3_chart_fn.selected = selected;\nc3_chart_fn.select = select;\nc3_chart_fn.unselect = unselect;\nc3_chart_fn.show = show;\nc3_chart_fn.hide = hide;\nc3_chart_fn.toggle = toggle;\nc3_chart_fn.tooltip = tooltip;\nc3_chart_fn.transform = transform;\nc3_chart_fn.x = x;\nc3_chart_fn.xs = xs;\nc3_chart_fn.zoom = zoom;\nc3_chart_fn.unzoom = unzoom;\n\nexport { Chart, c3_chart_fn };\n","/**\n * C3.js\n * (c) 2016 Masayuki Tanaka and the C3.js contributors (See package.json)\n * License: MIT\n */\n\nimport { ChartInternal } from './internals/index';\nimport { Chart } from './chart/index';\nimport { Axis } from './axis/index';\n\n\nconst version = '0.4.11';\n\nconst generate = function generate(config) {\n return new Chart(config);\n};\n\nconst chart = {\n fn: Chart.prototype,\n internal: {\n fn: ChartInternal.prototype,\n axis: {\n fn: Axis.prototype,\n },\n },\n};\n\nexport {\n version,\n generate,\n chart,\n};\n"],"names":["tickTextCharSize","c3_axis","params","scale","d3","linear","orient","innerTickSize","tickPadding","tickValues","tickFormat","tickArguments","tickOffset","tickCulling","tickCentered","outerTickSize","withOuterTick","axisX","selection","x","attr","Math","ceil","d","axisY","y","scaleExtent","domain","start","stop","length","generateTicks","i","ticks","apply","push","unshift","copyScale","newScale","copy","isCategory","textFormatted","v","formatted","getSizeFor1Char","tick","size","select","text","each","box","getBoundingClientRect","h","height","w","width","undefined","transitionise","withoutTransition","transition","axis","g","scale0","__chart__","scale1","selectAll","data","tickEnter","enter","insert","style","exit","remove","tickUpdate","tickTransform","tickX","tickY","range","rangeExtent","path","pathUpdate","append","lineEnter","lineUpdate","textEnter","textUpdate","tspan","sizeFor1Char","counts","tickLength","max","isVertical","splitTickText","maxWidth","tickText","subtext","spaceIndex","textWidth","splitted","Object","prototype","toString","call","split","charAt","substr","concat","slice","tspanDy","dy","index","tickSize","tickPosition","tickMultiline","tickWidth","map","s","rotate","tickTextRotate","textAnchorForText","textTransform","dxForText","sin","PI","yForText","rangeBand","dx","arguments","top","right","bottom","left","format","isCentered","tickInterval","interval","node","getTotalLength","Infinity","args","culling","Axis","owner","inherit","API","init","$$","config","main","axes","CLASS","clipPathForXAxis","getTranslate","axis_x_show","axisXLabel","axis_rotated","textAnchorForXAxisLabel","bind","axis_y_inner","clipPathForYAxis","axis_y_show","axisYLabel","textAnchorForYAxisLabel","y2","axisY2","axis_y2_show","axisY2Label","textAnchorForY2AxisLabel","getXAxis","withoutRotateTickText","axisParams","isCategorized","axis_x_tick_multiline","axis_x_tick_width","axis_x_tick_rotate","isTimeSeries","parseDate","axis_x_tick_centered","isEmpty","axis_x_tick_culling","updateXAxisTickValues","targets","axis_x_tick_fit","axis_x_tick_count","generateTickValues","mapTargetsToUniqueXs","xAxis","subXAxis","getYAxis","axis_y_tick_rotate","isTimeSeriesY","time","axis_y_tick_time_value","axis_y_tick_time_interval","getId","id","data_axes","getXAxisTickFormat","defaultAxisTimeFormat","categoryName","toFixed","axis_x_tick_format","isFunction","date","axisTimeFormat","getTickValues","getXAxisTickValues","axis_x_tick_values","getYAxisTickValues","axis_y_tick_values","yAxis","getY2AxisTickValues","axis_y2_tick_values","y2Axis","getLabelOptionByAxisId","axisId","option","axis_y_label","axis_y2_label","axis_x_label","getLabelText","isString","setLabelText","getLabelPosition","defaultPosition","position","indexOf","getXAxisLabelPosition","getYAxisLabelPosition","getY2AxisLabelPosition","getLabelPositionById","textForXAxisLabel","textForYAxisLabel","textForY2AxisLabel","xForAxisLabel","forHorizontal","isLeft","isCenter","isBottom","isMiddle","dxForAxisLabel","isRight","isTop","textAnchorForAxisLabel","xForXAxisLabel","xForYAxisLabel","xForY2AxisLabel","dxForXAxisLabel","dxForYAxisLabel","dxForY2AxisLabel","dyForXAxisLabel","isInner","getMaxTickWidth","axis_x_height","dyForYAxisLabel","dyForY2AxisLabel","axis_y2_inner","withoutRecompute","targetsToShow","dummy","svg","currentMaxTickWidths","filterTargetsToShow","getYDomain","yOrient","axis_y_tick_format","yAxisTickValues","y2Orient","axis_y2_tick_format","y2AxisTickValues","getXDomain","xOrient","xAxisTickFormat","xAxisTickValues","classed","updateLabels","withTransition","getPadding","padding","key","defaultValue","domainLength","p","isValue","unit","convertPixelsToAxisPadding","pixels","values","tickCount","forTimeSeries","targetCount","end","count","tickValue","Date","sort","a","b","generateTransitions","duration","subx","redraw","transitions","isHidden","axisSubX","base","derived","create","f","constructor","generateClass","prefix","targetId","getTargetSelectorSuffix","classText","classTexts","texts","classShape","shape","classShapes","shapes","classLine","line","classLines","lines","classCircle","circle","classCircles","circles","classBar","bar","classBars","bars","classArc","arc","classArcs","arcs","classArea","area","classAreas","areas","classRegion","region","class","classEvent","eventRect","classTarget","additionalClassSuffix","data_classes","additionalClass","target","classFocus","classFocused","classDefocused","focusedTargetIds","focused","defocusedTargetIds","defocused","classChartText","chartText","classChartLine","chartLine","classChartBar","chartBar","classChartArc","chartArc","replace","selectorTarget","selectorTargets","ids","selectorLegend","legendItem","selectorLegends","o","isUndefined","isDefined","ceil10","asHalfPixel","n","diffDomain","keys","notEmpty","getOption","options","hasValue","dict","value","found","forEach","sanitise","str","getPathBox","items","pathSegList","getItem","minX","minY","min","initPie","pie","layout","reduce","data_order","updateRadius","gauge_width","donut_width","radiusExpanded","arcWidth","arcHeight","radius","innerRadiusRatio","innerRadius","hasType","updateArc","svgArc","getSvgArc","svgArcExpanded","getSvgArcExpanded","svgArcExpandedSub","updateAngle","gMin","gMax","gTic","gValue","t","isNaN","startAngle","endAngle","isGaugeType","gauge_min","gauge_max","gauge_fullCircle","gauge_startingAngle","outerRadius","newArc","withoutUpdate","updated","centroid","rate","getArc","force","isArcType","transformForArcLabel","c","ratio","translate","sqrt","donut_label_ratio","pie_label_ratio","getArcRatio","whole","convertToArcData","addName","textForArcLabel","shouldShowArcLabel","meetsArcLabelThreshold","getArcLabelFormat","defaultArcValueFormat","expandArc","targetIds","transiting","window","setInterval","clearInterval","legend","mapToTargetIds","shouldExpand","expandDuration","isDonutType","unexpandArc","donut_expand_duration","gauge_expand_duration","isPieType","pie_expand_duration","donut_expand","gauge_expand","pie_expand","shouldShow","donut_label_show","pie_label_show","threshold","donut_label_threshold","pie_label_threshold","pie_label_format","gauge_label_format","donut_label_format","getArcTitle","donut_title","updateTargetsForArc","mainPieUpdate","mainPieEnter","chartArcs","initArc","chart","chartArcsTitle","redrawArc","durationForExit","withTransform","mainArc","arcData","color","interaction_enabled","data_selection_isselectable","_current","on","api","focus","toggleFocusLegend","data_onmouseover","selectedData","showTooltip","revert","revertLegend","hideTooltip","data_onmouseout","toggleShape","data_onclick","attrTween","interpolate","interpolated","levelColor","endall","gaugeValue","round","isTargetToShow","chartArcsBackground","chartArcsGaugeUnit","gauge_label_show","gauge_units","chartArcsGaugeMin","chartArcsGaugeMax","initGauge","getGaugeLabelHeight","hasCaches","cache","addCache","cloneTarget","getCaches","axis_x_categories","getClipPath","isIE9","navigator","appVersion","toLowerCase","document","URL","appendClip","parent","getAxisClipX","margin","getAxisClipY","getXAxisClipX","getXAxisClipY","getYAxisClipX","getYAxisClipY","getAxisClipWidth","getAxisClipHeight","getXAxisClipWidth","getXAxisClipHeight","getYAxisClipWidth","getYAxisClipHeight","generateColor","colors","data_colors","pattern","color_pattern","category10","callback","data_color","Function","generateLevelColor","color_threshold","asValue","getDefaultConfig","defaultTitleFormat","defaultValueFormat","getTooltipContent","additionalConfig","loadConfig","this_config","read","find","shift","convertUrlToData","url","mimeType","headers","done","type","req","xhr","header","get","error","Error","responseURL","status","statusText","convertJsonToData","JSON","parse","response","convertTsvToData","convertCsvToData","convertXsvToData","xsv","parser","rows","parseRows","csv","tsv","json","new_rows","targetKeys","data_x","new_row","findValueInJson","convertRowsToData","convertColumnsToData","object","pathArray","k","j","columns","convertDataToTargets","appendXs","filter","isNotX","xs","isX","xKey","getXKey","isCustomX","rawX","generateTargetX","getOtherTargetXs","data_xs","getXValuesOfXKey","convertedId","data_idConverter","data_xSort","v1","v2","x1","x2","hasNegativeValue","hasNegativeValueInTargets","hasPositiveValue","hasPositiveValueInTargets","data_type","setTargetType","mapToIds","data_types","id_org","xValues","getIndexByX","filterByX","getXValue","idsForX","getOtherTargetX","addXs","hasMultipleX","set","isMultipleX","name","data_names","getValueOnIndex","valueOnIndex","updateTargetX","updateTargetXs","updateXs","getPrevX","getNextX","getMaxDataCount","getMaxDataCountTarget","maxTarget","getEdgeX","hasTarget","hiddenTargetIds","isLegendToShow","hiddenLegendIds","merge","NaN","addHiddenTargetIds","removeHiddenTargetIds","addHiddenLegendIds","removeHiddenLegendIds","getValuesAsIdKeyed","ys","checkValueInTargets","checker","isOrderDesc","isOrderAsc","orderTargets","orderAsc","orderDesc","t1","t2","reducer","abs","t1Sum","t2Sum","filterRemoveNull","filterByXDomain","xDomain","hasDataLabel","data_labels","babelHelpers.typeof","getDataLabelLength","lengths","paddingCoef","selectChart","dataLabelFormat","isNoneArc","isArc","findSameXOfValues","targetX","sames","findClosestFromTargets","pos","candidates","findClosest","minDist","point_sensitivity","closest","isBarType","isWithinBar","dist","xIndex","yIndex","circleY","pow","convertValuesToStep","converted","updateDataAttributes","attrs","current","withLegend","load","types","splice","updateTargets","withUpdateOrgXDomain","withUpdateXDomain","loadFromArgs","unload","withoutFadeIn","getYDomainMin","baseId","idsInGroup","data_groups","getYDomainMax","targetsByAxisId","yTargets","yMin","axis_y2_min","axis_y_min","yMax","axis_y2_max","axis_y_max","yDomainMin","yDomainMax","padding_top","padding_bottom","center","axis_y2_center","axis_y_center","yDomainAbs","diff","isAllPositive","isAllNegative","isZeroBased","bar_zerobased","area_zerobased","isInverted","axis_y2_inverted","axis_y_inverted","showHorizontalDataLabel","showVerticalDataLabel","axis_y_padding","axis_y2_padding","reverse","getXDomainMin","axis_x_min","getXDomainMax","axis_x_max","getXDomainPadding","maxDataCount","paddingLeft","paddingRight","axis_x_padding","firstX","lastX","getTime","updateXDomain","withTrim","extent","orgXDomain","zoom_enabled","zoom","updateScaleExtent","subX","brush","empty","trimXDomain","orgDomain","zoomDomain","getZoomDomain","drag","mouse","sx","sy","mx","my","maxX","maxY","hasArcType","data_selection_enabled","altDomain","data_selection_multiple","dragStart","data_selection_grouped","dragarea","isSelected","SELECTED","isIncluded","INCLUDED","_x","_y","_w","_h","toggle","isWithin","togglePoint","togglePath","dragstart","dragging","dragend","generateFlow","flow","drawBar","drawLine","drawArea","cx","cy","xv","xForText","translateX","scaleX","transform","flowIndex","flowLength","flowStart","flowEnd","durationForFlow","wait","generateWait","xgrid","xgridLines","mainRegion","mainText","mainBar","mainLine","mainArea","mainCircle","flowing","updateXGrid","orgDataCount","hideXGridFocus","ease","add","isRegionOnX","eventRects","xgridAttr","opacityForText","regionX","regionWidth","redrawEventRect","getYFormat","forArc","formatForY","yFormat","formatForY2","y2Format","defaultFormat","initGrid","grid","clipPathForGrid","grid_x_show","xgrids","grid_y_show","ygrids","grid_focus_show","xgridFocus","grid_lines_front","initGridLines","gridLines","ygridLines","xgridData","generateGridData","grid_x_type","updateYGrid","gridValues","grid_y_ticks","ygrid","smoothLines","gridTextAnchor","gridTextDx","xGridTextX","yGridTextX","updateGrid","xgridLine","ygridLine","yv","grid_x_lines","grid_y_lines","redrawGrid","showXGridFocus","dataToShow","focusEl","xx","tooltip_show","updateXgridFocus","gridData","firstYear","lastYear","tickNum","getFullYear","getGridFilterToRemove","param","removeGridLines","forX","toRemove","toShow","transition_duration","initEventRect","eventRectUpdate","maxDataCountTarget","eventRectsMultiple","eventRectsSingle","generateEventRectsForMultipleXs","updateEventRect","datum","generateEventRectsForSingleX","rectW","rectX","prevX","nextX","thisX","getEventRectWidth","eventRectEnter","tap","tapX","click","cancelClick","isStepType","line_step_type","isWithinShape","point_focus_expand_enabled","expandCircles","expandBars","unexpandCircles","unexpandBars","tooltip_grouped","EXPANDED","finalX","touch_tap_delay","data_selection_draggable","behavior","origin","tapY","mouseout","sameXData","mouseover","isScatterType","touch_tap_radius","dispatchEvent","selector","event","createEvent","initMouseEvent","initLegend","legendItemTextBox","legendHasRendered","legend_show","updateLegendWithDefaults","updateLegend","withTransitionForTransform","updateSizeForLegend","legendHeight","legendWidth","insetLegendPosition","isLegendTop","getCurrentPaddingTop","legend_inset_y","currentHeight","getCurrentPaddingBottom","isLegendLeft","getCurrentPaddingLeft","legend_inset_x","currentWidth","getCurrentPaddingRight","margin3","isLegendRight","isLegendInset","transformLegend","updateLegendStep","step","legendStep","updateLegendItemWidth","legendItemWidth","updateLegendItemHeight","legendItemHeight","getLegendWidth","getLegendHeight","opacityForLegend","legendItemHidden","opacityForUnfocusedLegend","legendItemFocused","opacity","showLegend","hideLegend","clearLegendItemTextBoxCache","xForLegend","xForLegendText","xForLegendRect","yForLegend","yForLegendText","yForLegendRect","x1ForLegendTile","x2ForLegendTile","yForLegendTile","paddingTop","maxHeight","posMin","tileWidth","legend_item_tile_width","l","totalLength","offsets","widths","heights","margins","steps","rects","tiles","background","getTextBox","textElement","getTextRect","textContent","updatePositions","reset","isLast","itemWidth","legend_padding","itemHeight","itemLength","areaLength","maxLength","updateValues","withoutStep","legend_equally","legend_inset_step","legend_item_onclick","altKey","hide","show","legend_item_onmouseover","legend_item_onmouseout","legendItemEvent","legendItemTile","legend_item_tile_height","legendBackground","updateSizes","updateScales","updateSvgSize","transformAll","initRegion","clipPath","regions","updateRegion","redrawRegion","parentData","parentNode","regionY","regionHeight","xPos","yScale","yPos","getScale","forTimeseries","getX","offset","_scale","raw","getY","getYScale","getSubYScale","subY2","subY","forInit","xMin","xMax","subXMin","subXMax","subYMin","height2","subYMax","width2","axis_y_default","axis_y2_default","axis_x_tick_outer","subXOrient","axis_y_tick_outer","axis_y2_tick_outer","selectPoint","circleX","r","pointSelectR","data_onselected","selectedCircles","selectedCircle","unselectPoint","data_onunselected","selected","selectPath","interaction_brighten","rgb","brighter","unselectPath","getToggle","that","nodeName","initBar","chartBars","updateTargetsForBar","mainBarUpdate","mainBarEnter","updateBar","barData","initialOpacity","redrawBar","random","getBarW","barTargetsNum","bar_width","bar_width_ratio","bar_width_max","getBars","generateDrawBar","barIndices","isSub","getPoints","generateGetBarPoints","points","indexX","indexY","__max__","barW","barX","getShapeX","barY","getShapeY","barOffset","getShapeOffset","y0","posY","posX","seg0","seg1","ex","ey","getShapeIndices","typeFilter","indices","targetsNum","isWithinStep","isWithinCircle","getInterpolate","interpolation","isInterpolationType","spline_interpolation_type","isSplineType","initLine","chartLines","updateTargetsForLine","mainLineUpdate","mainLineEnter","updateLine","lineData","redrawLine","generateDrawLine","lineIndices","generateGetLinePoints","yScaleGetter","xValue","subxx","yValue","line_connectNull","defined","x0","isLineType","data_regions","lineWithRegions","lineTargetsNum","lineOffset","_regions","prev","sWithRegion","xp","yp","dd","diffx2","xOffset","isWithinRegions","generateM","d0","d1","x_diff","xv0","xv1","updateArea","orgAreaOpacity","redrawArea","generateDrawArea","areaIndices","generateGetAreaPoints","value0","getAreaBaseValue","value1","area_above","y1","isAreaType","areaTargetsNum","areaOffset","updateCircle","lineOrScatterData","pointR","initialOpacityForCircle","redrawCircle","opacityForCircle","updateCircleY","getCircles","pointExpandedR","point_r","point_focus_expand_r","point_select_r","d3_this","getCurrentWidth","size_width","getParentWidth","getCurrentHeight","size_height","getParentHeight","title","getTitlePadding","padding_left","getAxisWidthByAxisId","isOuter","defaultPadding","legendWidthOnRight","padding_right","getParentRectValue","tagName","e","offsetWidth","getSvgLeft","hasLeftAxisRect","leftAxisClass","leftAxis","svgRect","chartRect","hasArc","svgLeft","getHorizontalAxisHeight","rotated_padding_top","cos","initBrush","redrawForBrush","update","context","initSubchart","visibility","subchart_show","clipPathForSubchart","subchart_axis_x_show","updateTargetsForSubchart","contextLineEnter","contextLineUpdate","contextBarEnter","contextBarUpdate","updateBarForSubchart","contextBar","redrawBarForSubchart","drawBarOnSub","updateLineForSubchart","contextLine","redrawLineForSubchart","drawLineOnSub","updateAreaForSubchart","contextArea","redrawAreaForSubchart","drawAreaOnSub","redrawSubchart","withSubchart","zoom_rescale","subchart_onbrush","transformContext","getDefaultExtent","axis_x_extent","initText","chartTexts","updateTargetsForText","mainTextUpdate","mainTextEnter","updateText","barOrLineData","redrawText","forFlow","cls","element","font","rect","generateXYForText","getAreaPoints","getBarPoints","getLinePoints","getter","getXForText","getYForText","isSafari","isChrome","initTitle","title_text","redrawTitle","xForTitle","yForTitle","title_position","title_padding","initTooltip","tooltip","tooltipContainer","tooltip_init_show","tooltip_init_x","html","tooltip_contents","tooltip_init_position","titleFormat","tooltip_format_title","nameFormat","tooltip_format_name","valueFormat","tooltip_format_value","bgcolor","tooltipName","tooltipPosition","tWidth","tHeight","tooltipLeft","tooltipRight","tooltipTop","chartRight","positionFunction","tooltip_position","c3_chart_internal_fn","property","transformTo","optionsForRedraw","withTransitionForAxis","updateAndRedraw","has","ua","userAgent","initZoom","startEvent","sourceEvent","zoom_onzoomstart","redrawForZoom","clientX","clientY","updateZoom","zoom_onzoomend","orgScaleExtent","zoom_extent","zoom_x_min","zoom_x_max","z","zoomRect","zoom_onzoom","util","ChartInternal","beforeInit","afterInit","initParams","data_url","data_mimeType","data_headers","data_keys","initWithData","data_json","data_rows","data_columns","clipId","clipIdForXAxis","clipIdForYAxis","clipIdForGrid","clipIdForSubchart","dataTimeFormat","data_xLocaltime","utc","axis_x_localtime","multi","getMilliseconds","getSeconds","getMinutes","getHours","getDay","getDate","getMonth","legend_position","legend_inset_anchor","rotated_padding_left","rotated_padding_right","intervalForObserveInserted","initChartElements","defs","binding","bindto","createElement","observeInserted","data_filter","data_hide","legend_hide","onmouseover","onmouseout","svg_classname","clipChart","clipXAxis","clipYAxis","clipGrid","clipSubchart","zoom_privileged","updateDimension","oninit","bindResize","el","legendHeightForBottom","xAxisHeight","subchartHeight","subchart_size_height","margin2","showTargets","withY","withTransitionForExit","withTrimXDomain","withEventRect","withDimension","withUpdateXAxis","hideAxis","durationForAxis","waitForDraw","intervalForCulling","xDomainForZoom","axis_y_tick_count","axis_y2_tick_count","axis_x_tick_culling_max","data_empty_label_text","isTabVisible","transitionsToWait","onrendered","redrawWithoutRescale","axis_x_type","axis_y_type","point_show","transformMain","withoutAxis","observer","MutationObserver","console","mutations","mutation","previousSibling","disconnect","observe","attributes","childList","characterData","resizeFunction","generateResize","onresize","resize_auto","resizeTimeout","clearTimeout","setTimeout","flush","onresized","attachEvent","addEventListener","wrapper","resizeFunctions","callResizeFunctions","timer","parsedDate","data_xFormat","hidden","mozHidden","msHidden","webkitHidden","labels","internal","category","categories","resize","destroy","detachEvent","removeEventListener","shown","names","notfoundIds","dataCount","baseTarget","baseValue","tail","to","missing","defocus","grids","groups","classes","cacheIds","Array","__data__","resetOther","isTargetId","isTargetIndex","unselect","tooltip_onshow","tooltip_onhide","unzoom","clear","enable","enabled","c3_chart_fn","Chart","bindThis","fn","argThis","version","generate"],"mappings":";;;;;;;;AAEA,IAAIA,yBAAJ;AACA,SAASC,OAAT,CAAiBC,MAAjB,EAAyB;QACjBC,QAAQC,GAAGD,KAAH,CAASE,MAAT,EAAZ;QACIC,SAAS,QAAb;QACMC,gBAAgB,CAAtB;QACMC,cAAc,CAApB;QACIC,aAAa,IAAjB;QACIC,mBAAJ;QACIC,sBAAJ;;QAEIC,aAAa,CAAjB;QACIC,cAAc,IAAlB;QACIC,qBAAJ;;aAESZ,UAAU,EAAnB;;QAEMa,gBAAgBb,OAA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ADA;cAEA;YACF2wC,cAAc3wC,SADZ;cAEA;gBACEyC,QAAKzC;;;CALrB,CAUA;;;;;;;;"} \ No newline at end of file diff --git a/es6_modules/axis/axis.js b/es6_modules/axis/axis.js deleted file mode 100644 index fbec8f0..0000000 --- a/es6_modules/axis/axis.js +++ /dev/null @@ -1,471 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isEmpty, -} from '../internals/index'; - -import { inherit, API } from './index'; -import c3_axis from './c3.axis'; - -function Axis(owner) { - API.call(this, owner); -} - -inherit(API, Axis); - -Axis.prototype.init = function init() { - const $$ = this.owner; - const config = $$.config; - const main = $$.main; - $$.axes.x = main.append('g') - .attr('class', CLASS.axis + ' ' + CLASS.axisX) - .attr('clip-path', $$.clipPathForXAxis) - .attr('transform', $$.getTranslate('x')) - .style('visibility', config.axis_x_show ? 'visible' : 'hidden'); - $$.axes.x.append('text') - .attr('class', CLASS.axisXLabel) - .attr('transform', config.axis_rotated ? 'rotate(-90)' : '') - .style('text-anchor', this.textAnchorForXAxisLabel.bind(this)); - $$.axes.y = main.append('g') - .attr('class', CLASS.axis + ' ' + CLASS.axisY) - .attr('clip-path', config.axis_y_inner ? '' : $$.clipPathForYAxis) - .attr('transform', $$.getTranslate('y')) - .style('visibility', config.axis_y_show ? 'visible' : 'hidden'); - $$.axes.y.append('text') - .attr('class', CLASS.axisYLabel) - .attr('transform', config.axis_rotated ? '' : 'rotate(-90)') - .style('text-anchor', this.textAnchorForYAxisLabel.bind(this)); - - $$.axes.y2 = main.append('g') - .attr('class', CLASS.axis + ' ' + CLASS.axisY2) - // clip-path? - .attr('transform', $$.getTranslate('y2')) - .style('visibility', config.axis_y2_show ? 'visible' : 'hidden'); - $$.axes.y2.append('text') - .attr('class', CLASS.axisY2Label) - .attr('transform', config.axis_rotated ? '' : 'rotate(-90)') - .style('text-anchor', this.textAnchorForY2AxisLabel.bind(this)); -}; -Axis.prototype.getXAxis = function getXAxis( - scale, - orient, - tickFormat, - tickValues, - withOuterTick, - withoutTransition, - withoutRotateTickText) { - const $$ = this.owner; - const config = $$.config; - const axisParams = { - isCategory: $$.isCategorized(), - withOuterTick, - tickMultiline: config.axis_x_tick_multiline, - tickWidth: config.axis_x_tick_width, - tickTextRotate: withoutRotateTickText ? 0 : config.axis_x_tick_rotate, - withoutTransition, - }; - const axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient); - - if ($$.isTimeSeries() && tickValues && typeof tickValues !== 'function') { - tickValues = tickValues.map(v => $$.parseDate(v)); - } - - // Set tick - axis.tickFormat(tickFormat).tickValues(tickValues); - if ($$.isCategorized()) { - axis.tickCentered(config.axis_x_tick_centered); - if (isEmpty(config.axis_x_tick_culling)) { - config.axis_x_tick_culling = false; - } - } - - return axis; -}; -Axis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) { - const $$ = this.owner; - const config = $$.config; - let tickValues; - if (config.axis_x_tick_fit || config.axis_x_tick_count) { - tickValues = this.generateTickValues( - $$.mapTargetsToUniqueXs(targets), - config.axis_x_tick_count, - $$.isTimeSeries() - ); - } - if (axis) { - axis.tickValues(tickValues); - } else { - $$.xAxis.tickValues(tickValues); - $$.subXAxis.tickValues(tickValues); - } - return tickValues; -}; -Axis.prototype.getYAxis = function getYAxis(scale, - orient, - tickFormat, - tickValues, - withOuterTick, - withoutTransition, - withoutRotateTickText) { - const $$ = this.owner; - const config = $$.config; - const axisParams = { - withOuterTick, - withoutTransition, - tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate, - }; - const axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat); - if ($$.isTimeSeriesY()) { - axis.ticks($$.d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval); - } else { - axis.tickValues(tickValues); - } - return axis; -}; -Axis.prototype.getId = function getId(id) { - const config = this.owner.config; - return id in config.data_axes ? config.data_axes[id] : 'y'; -}; -Axis.prototype.getXAxisTickFormat = function getXAxisTickFormat() { - const $$ = this.owner; - const config = $$.config; - let format = $$.isTimeSeries() ? // eslint-disable-line no-nested-ternary - $$.defaultAxisTimeFormat : - $$.isCategorized() ? - $$.categoryName : - function (v) { return v < 0 ? v.toFixed(0) : v; }; - if (config.axis_x_tick_format) { - if (isFunction(config.axis_x_tick_format)) { - format = config.axis_x_tick_format; - } else if ($$.isTimeSeries()) { - format = function (date) { - return date ? $$.axisTimeFormat(config.axis_x_tick_format)(date) : ''; - }; - } - } - return isFunction(format) ? function (v) { return format.call($$, v); } : format; -}; -Axis.prototype.getTickValues = function getTickValues(tickValues, axis) { - return tickValues ? tickValues : // eslint-disable-line no-nested-ternary,no-unneeded-ternary - axis ? axis.tickValues() : undefined; -}; -Axis.prototype.getXAxisTickValues = function getXAxisTickValues() { - return this.getTickValues(this.owner.config.axis_x_tick_values, this.owner.xAxis); -}; -Axis.prototype.getYAxisTickValues = function getYAxisTickValues() { - return this.getTickValues(this.owner.config.axis_y_tick_values, this.owner.yAxis); -}; -Axis.prototype.getY2AxisTickValues = function getY2AxisTickValues() { - return this.getTickValues(this.owner.config.axis_y2_tick_values, this.owner.y2Axis); -}; -Axis.prototype.getLabelOptionByAxisId = function getLabelOptionByAxisId(axisId) { - const $$ = this.owner; - const config = $$.config; - let option; - if (axisId === 'y') { - option = config.axis_y_label; - } else if (axisId === 'y2') { - option = config.axis_y2_label; - } else if (axisId === 'x') { - option = config.axis_x_label; - } - return option; -}; -Axis.prototype.getLabelText = function getLabelText(axisId) { - const option = this.getLabelOptionByAxisId(axisId); - return isString(option) ? option : option ? option.text : null; // eslint-disable-line no-nested-ternary,max-len -}; -Axis.prototype.setLabelText = function setLabelText(axisId, text) { - const $$ = this.owner; - const config = $$.config; - const option = this.getLabelOptionByAxisId(axisId); - if (isString(option)) { - if (axisId === 'y') { - config.axis_y_label = text; - } else if (axisId === 'y2') { - config.axis_y2_label = text; - } else if (axisId === 'x') { - config.axis_x_label = text; - } - } else if (option) { - option.text = text; - } -}; -Axis.prototype.getLabelPosition = function getLabelPosition(axisId, defaultPosition) { - const option = this.getLabelOptionByAxisId(axisId); - const position = (option && typeof option === 'object' && option.position) ? option.position : defaultPosition; - return { - isInner: position.indexOf('inner') >= 0, - isOuter: position.indexOf('outer') >= 0, - isLeft: position.indexOf('left') >= 0, - isCenter: position.indexOf('center') >= 0, - isRight: position.indexOf('right') >= 0, - isTop: position.indexOf('top') >= 0, - isMiddle: position.indexOf('middle') >= 0, - isBottom: position.indexOf('bottom') >= 0, - }; -}; -Axis.prototype.getXAxisLabelPosition = function getXAxisLabelPosition() { - return this.getLabelPosition('x', this.owner.config.axis_rotated ? 'inner-top' : 'inner-right'); -}; -Axis.prototype.getYAxisLabelPosition = function getYAxisLabelPosition() { - return this.getLabelPosition('y', this.owner.config.axis_rotated ? 'inner-right' : 'inner-top'); -}; -Axis.prototype.getY2AxisLabelPosition = function getY2AxisLabelPosition() { - return this.getLabelPosition('y2', this.owner.config.axis_rotated ? 'inner-right' : 'inner-top'); -}; -Axis.prototype.getLabelPositionById = function getLabelPositionById(id) { - return id === 'y2' ? this.getY2AxisLabelPosition() : - id === 'y' ? this.getYAxisLabelPosition() : this.getXAxisLabelPosition(); -}; -Axis.prototype.textForXAxisLabel = function textForXAxisLabel() { - return this.getLabelText('x'); -}; -Axis.prototype.textForYAxisLabel = function textForYAxisLabel() { - return this.getLabelText('y'); -}; -Axis.prototype.textForY2AxisLabel = function textForY2AxisLabel() { - return this.getLabelText('y2'); -}; -Axis.prototype.xForAxisLabel = function xForAxisLabel(forHorizontal, position) { - const $$ = this.owner; - if (forHorizontal) { - return position.isLeft ? 0 : position.isCenter ? $$.width / 2 : $$.width; - } else { - return position.isBottom ? -$$.height : position.isMiddle ? -$$.height / 2 : 0; - } -}; -Axis.prototype.dxForAxisLabel = function dxForAxisLabel(forHorizontal, position) { - if (forHorizontal) { - return position.isLeft ? '0.5em' : position.isRight ? '-0.5em' : '0'; - } else { - return position.isTop ? '-0.5em' : position.isBottom ? '0.5em' : '0'; - } -}; -Axis.prototype.textAnchorForAxisLabel = function textAnchorForAxisLabel(forHorizontal, position) { - if (forHorizontal) { - return position.isLeft ? 'start' : position.isCenter ? 'middle' : 'end'; - } else { - return position.isBottom ? 'start' : position.isMiddle ? 'middle' : 'end'; - } -}; -Axis.prototype.xForXAxisLabel = function xForXAxisLabel() { - return this.xForAxisLabel(!this.owner.config.axis_rotated, this.getXAxisLabelPosition()); -}; -Axis.prototype.xForYAxisLabel = function xForYAxisLabel() { - return this.xForAxisLabel(this.owner.config.axis_rotated, this.getYAxisLabelPosition()); -}; -Axis.prototype.xForY2AxisLabel = function xForY2AxisLabel() { - return this.xForAxisLabel(this.owner.config.axis_rotated, this.getY2AxisLabelPosition()); -}; -Axis.prototype.dxForXAxisLabel = function dxForXAxisLabel() { - return this.dxForAxisLabel(!this.owner.config.axis_rotated, this.getXAxisLabelPosition()); -}; -Axis.prototype.dxForYAxisLabel = function dxForYAxisLabel() { - return this.dxForAxisLabel(this.owner.config.axis_rotated, this.getYAxisLabelPosition()); -}; -Axis.prototype.dxForY2AxisLabel = function dxForY2AxisLabel() { - return this.dxForAxisLabel(this.owner.config.axis_rotated, this.getY2AxisLabelPosition()); -}; -Axis.prototype.dyForXAxisLabel = function dyForXAxisLabel() { - const $$ = this.owner; - const config = $$.config; - const position = this.getXAxisLabelPosition(); - if (config.axis_rotated) { - return position.isInner ? '1.2em' : -25 - this.getMaxTickWidth('x'); - } else { - return position.isInner ? '-0.5em' : config.axis_x_height ? config.axis_x_height - 10 : '3em'; - } -}; -Axis.prototype.dyForYAxisLabel = function dyForYAxisLabel() { - const $$ = this.owner; - const position = this.getYAxisLabelPosition(); - if ($$.config.axis_rotated) { - return position.isInner ? '-0.5em' : '3em'; - } else { - return position.isInner ? '1.2em' : -10 - ($$.config.axis_y_inner ? 0 : (this.getMaxTickWidth('y') + 10)); - } -}; -Axis.prototype.dyForY2AxisLabel = function dyForY2AxisLabel() { - const $$ = this.owner; - const position = this.getY2AxisLabelPosition(); - if ($$.config.axis_rotated) { - return position.isInner ? '1.2em' : '-2.2em'; - } else { - return position.isInner ? '-0.5em' : 15 + ($$.config.axis_y2_inner ? 0 : (this.getMaxTickWidth('y2') + 15)); - } -}; -Axis.prototype.textAnchorForXAxisLabel = function textAnchorForXAxisLabel() { - const $$ = this.owner; - return this.textAnchorForAxisLabel(!$$.config.axis_rotated, this.getXAxisLabelPosition()); -}; -Axis.prototype.textAnchorForYAxisLabel = function textAnchorForYAxisLabel() { - const $$ = this.owner; - return this.textAnchorForAxisLabel($$.config.axis_rotated, this.getYAxisLabelPosition()); -}; -Axis.prototype.textAnchorForY2AxisLabel = function textAnchorForY2AxisLabel() { - const $$ = this.owner; - return this.textAnchorForAxisLabel($$.config.axis_rotated, this.getY2AxisLabelPosition()); -}; -Axis.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) { - const $$ = this.owner; - const config = $$.config; - let maxWidth = 0; - let targetsToShow; - let scale; - let axis; - let dummy; - let svg; - if (withoutRecompute && $$.currentMaxTickWidths[id]) { - return $$.currentMaxTickWidths[id]; - } - if ($$.svg) { - targetsToShow = $$.filterTargetsToShow($$.data.targets); - if (id === 'y') { - scale = $$.y.copy().domain($$.getYDomain(targetsToShow, 'y')); - axis = this.getYAxis( - scale, - $$.yOrient, - config.axis_y_tick_format, - $$.yAxisTickValues, - false, - true, - true - ); - } else if (id === 'y2') { - scale = $$.y2.copy().domain($$.getYDomain(targetsToShow, 'y2')); - axis = this.getYAxis( - scale, - $$.y2Orient, - config.axis_y2_tick_format, - $$.y2AxisTickValues, - false, - true, - true - ); - } else { - scale = $$.x.copy().domain($$.getXDomain(targetsToShow)); - axis = this.getXAxis( - scale, - $$.xOrient, - $$.xAxisTickFormat, - $$.xAxisTickValues, - false, - true, - true - ); - this.updateXAxisTickValues(targetsToShow, axis); - } - dummy = $$.d3.select('body').append('div').classed('c3', true); - svg = dummy.append('svg') - .style('visibility', 'hidden') - .style('position', 'fixed') - .style('top', 0) - .style('left', 0); - svg.append('g').call(axis).each(function () { - $$.d3.select(this).selectAll('text').each(function () { - const box = this.getBoundingClientRect(); - if (maxWidth < box.width) { maxWidth = box.width; } - }); - dummy.remove(); - }); - } - $$.currentMaxTickWidths[id] = maxWidth <= 0 ? $$.currentMaxTickWidths[id] : maxWidth; - return $$.currentMaxTickWidths[id]; -}; - -Axis.prototype.updateLabels = function updateLabels(withTransition) { - const $$ = this.owner; - const axisXLabel = $$.main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel); - const axisYLabel = $$.main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel); - const axisY2Label = $$.main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label); - (withTransition ? axisXLabel.transition() : axisXLabel) - .attr('x', this.xForXAxisLabel.bind(this)) - .attr('dx', this.dxForXAxisLabel.bind(this)) - .attr('dy', this.dyForXAxisLabel.bind(this)) - .text(this.textForXAxisLabel.bind(this)); - (withTransition ? axisYLabel.transition() : axisYLabel) - .attr('x', this.xForYAxisLabel.bind(this)) - .attr('dx', this.dxForYAxisLabel.bind(this)) - .attr('dy', this.dyForYAxisLabel.bind(this)) - .text(this.textForYAxisLabel.bind(this)); - (withTransition ? axisY2Label.transition() : axisY2Label) - .attr('x', this.xForY2AxisLabel.bind(this)) - .attr('dx', this.dxForY2AxisLabel.bind(this)) - .attr('dy', this.dyForY2AxisLabel.bind(this)) - .text(this.textForY2AxisLabel.bind(this)); -}; -Axis.prototype.getPadding = function getPadding(padding, key, defaultValue, domainLength) { - const p = typeof padding === 'number' ? padding : padding[key]; - if (!isValue(p)) { - return defaultValue; - } - if (padding.unit === 'ratio') { - return padding[key] * domainLength; - } - // assume padding is pixels if unit is not specified - return this.convertPixelsToAxisPadding(p, domainLength); -}; -Axis.prototype.convertPixelsToAxisPadding = function convertPixelsToAxisPadding(pixels, domainLength) { // eslint-disable-line max-len - const $$ = this.owner; - const length = $$.config.axis_rotated ? $$.width : $$.height; - return domainLength * (pixels / length); -}; -Axis.prototype.generateTickValues = function generateTickValues(values, tickCount, forTimeSeries) { - let tickValues = values; - let targetCount; - let start; - let end; - let count; - let interval; - let i; - let tickValue; - if (tickCount) { - targetCount = isFunction(tickCount) ? tickCount() : tickCount; - // compute ticks according to tickCount - if (targetCount === 1) { - tickValues = [values[0]]; - } else if (targetCount === 2) { - tickValues = [values[0], values[values.length - 1]]; - } else if (targetCount > 2) { - count = targetCount - 2; - start = values[0]; - end = values[values.length - 1]; - interval = (end - start) / (count + 1); - // re-construct unique values - tickValues = [start]; - for (i = 0; i < count; i++) { - tickValue = +start + interval * (i + 1); - tickValues.push(forTimeSeries ? new Date(tickValue) : tickValue); - } - tickValues.push(end); - } - } - if (!forTimeSeries) { tickValues = tickValues.sort((a, b) => a - b); } - return tickValues; -}; -Axis.prototype.generateTransitions = function generateTransitions(duration) { - let $$ = this.owner; - let axes = $$.axes; - return { - axisX: duration ? axes.x.transition().duration(duration) : axes.x, - axisY: duration ? axes.y.transition().duration(duration) : axes.y, - axisY2: duration ? axes.y2.transition().duration(duration) : axes.y2, - axisSubX: duration ? axes.subx.transition().duration(duration) : axes.subx, - }; -}; -Axis.prototype.redraw = function redraw(transitions, isHidden) { - const $$ = this.owner; - $$.axes.x.style('opacity', isHidden ? 0 : 1); - $$.axes.y.style('opacity', isHidden ? 0 : 1); - $$.axes.y2.style('opacity', isHidden ? 0 : 1); - $$.axes.subx.style('opacity', isHidden ? 0 : 1); - transitions.axisX.call($$.xAxis); - transitions.axisY.call($$.yAxis); - transitions.axisY2.call($$.y2Axis); - transitions.axisSubX.call($$.subXAxis); -}; - -export default Axis; diff --git a/es6_modules/axis/c3.axis.js b/es6_modules/axis/c3.axis.js deleted file mode 100644 index 2622f72..0000000 --- a/es6_modules/axis/c3.axis.js +++ /dev/null @@ -1,351 +0,0 @@ -let tickTextCharSize; -function c3_axis(d3, params) { - let scale = d3.scale.linear(); - let orient = 'bottom'; - const innerTickSize = 6; - const tickPadding = 3; - let tickValues = null; - let tickFormat; - let tickArguments; - - let tickOffset = 0; - let tickCulling = true; - let tickCentered; - - params = params || {}; - - const outerTickSize = params.withOuterTick ? 6 : 0; - - function axisX(selection, x) { - selection.attr('transform', d => 'translate(' + Math.ceil(x(d) + tickOffset) + ', 0)'); - } - function axisY(selection, y) { - selection.attr('transform', d => 'translate(0,' + Math.ceil(y(d)) + ')'); - } - function scaleExtent(domain) { - const start = domain[0]; - const stop = domain[domain.length - 1]; - return start < stop ? [start, stop] : [stop, start]; - } - function generateTicks(scale) { // eslint-disable-line no-shadow - let i; - const ticks = []; - if (scale.ticks) { - return scale.ticks.apply(scale, tickArguments); - } - const domain = scale.domain(); - for (i = Math.ceil(domain[0]); i < domain[1]; i++) { - ticks.push(i); - } - if (ticks.length > 0 && ticks[0] > 0) { - ticks.unshift(ticks[0] - (ticks[1] - ticks[0])); - } - return ticks; - } - function copyScale() { - const newScale = scale.copy(); - let domain; - if (params.isCategory) { - domain = scale.domain(); - newScale.domain([domain[0], domain[1] - 1]); - } - return newScale; - } - function textFormatted(v) { - const formatted = tickFormat ? tickFormat(v) : v; - return typeof formatted !== 'undefined' ? formatted : ''; - } - function getSizeFor1Char(tick) { - if (tickTextCharSize) { - return tickTextCharSize; - } - const size = { - h: 11.5, - w: 5.5, - }; - tick.select('text').text(textFormatted).each(function (d) { - let box = this.getBoundingClientRect(), - text = textFormatted(d), - h = box.height, - w = text ? (box.width / text.length) : undefined; - if (h && w) { - size.h = h; - size.w = w; - } - }).text(''); - tickTextCharSize = size; - return size; - } - function transitionise(selection) { - return params.withoutTransition ? selection : d3.transition(selection); - } - function axis(g) { - g.each(function () { - const g = axis.g = d3.select(this); - - let scale0 = this.__chart__ || scale, - scale1 = this.__chart__ = copyScale(); - - let ticks = tickValues || generateTicks(scale1), - tick = g.selectAll('.tick').data(ticks, scale1), - tickEnter = tick.enter().insert('g', '.domain').attr('class', 'tick').style('opacity', 1e-6), - // MEMO: No exit transition. The reason is this transition affects max tick width - // calculation because old tick will be included in the ticks. - tickExit = tick.exit().remove(), - tickUpdate = transitionise(tick).style('opacity', 1), - tickTransform, - tickX, - tickY; - - let range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()), - path = g.selectAll('.domain').data([0]), - pathUpdate = (path.enter().append('path').attr('class', 'domain'), transitionise(path)); - tickEnter.append('line'); - tickEnter.append('text'); - - let lineEnter = tickEnter.select('line'), - lineUpdate = tickUpdate.select('line'), - textEnter = tickEnter.select('text'), - textUpdate = tickUpdate.select('text'); - - if (params.isCategory) { - tickOffset = Math.ceil((scale1(1) - scale1(0)) / 2); - tickX = tickCentered ? 0 : tickOffset; - tickY = tickCentered ? tickOffset : 0; - } else { - tickOffset = tickX = 0; - } - - let text, - tspan, - sizeFor1Char = getSizeFor1Char(g.select('.tick')), - counts = []; - - let tickLength = Math.max(innerTickSize, 0) + tickPadding, - isVertical = orient === 'left' || orient === 'right'; - - // this should be called only when category axis - function splitTickText(d, maxWidth) { - let tickText = textFormatted(d), - subtext, - spaceIndex, - textWidth, - splitted = []; - - if (Object.prototype.toString.call(tickText) === '[object Array]') { - return tickText; - } - - if (!maxWidth || maxWidth <= 0) { - maxWidth = isVertical ? 95 : - params.isCategory ? - (Math.ceil(scale1(ticks[1]) - scale1(ticks[0])) - 12) : 110; - } - - function split(splitted, text) { - spaceIndex = undefined; - for (let i = 1; i < text.length; i++) { - if (text.charAt(i) === ' ') { - spaceIndex = i; - } - subtext = text.substr(0, i + 1); - textWidth = sizeFor1Char.w * subtext.length; - // if text width gets over tick width, split by space index or crrent index - if (maxWidth < textWidth) { - return split( - splitted.concat(text.substr(0, spaceIndex || i)), - text.slice(spaceIndex ? spaceIndex + 1 : i) - ); - } - } - return splitted.concat(text); - } - - return split(splitted, tickText + ''); - } - - function tspanDy(d, i) { - let dy = sizeFor1Char.h; - if (i === 0) { - if (orient === 'left' || orient === 'right') { - dy = -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3); - } else { - dy = '.71em'; - } - } - return dy; - } - - function tickSize(d) { - const tickPosition = scale(d) + (tickCentered ? 0 : tickOffset); - return range[0] < tickPosition && tickPosition < range[1] ? innerTickSize : 0; - } - - text = tick.select('text'); - tspan = text.selectAll('tspan') - .data((d, i) => { - const splitted = params.tickMultiline ? - splitTickText(d, params.tickWidth) : - [].concat(textFormatted(d)); - counts[i] = splitted.length; - return splitted.map(s => ({ index: i, splitted: s })); - }); - tspan.enter().append('tspan'); - tspan.exit().remove(); - tspan.text(d => d.splitted); - - const rotate = params.tickTextRotate; - - function textAnchorForText(rotate) { - if (!rotate) { - return 'middle'; - } - return rotate > 0 ? 'start' : 'end'; - } - function textTransform(rotate) { - if (!rotate) { - return ''; - } - return 'rotate(' + rotate + ')'; - } - function dxForText(rotate) { - if (!rotate) { - return 0; - } - return 8 * Math.sin(Math.PI * (rotate / 180)); - } - function yForText(rotate) { - if (!rotate) { - return tickLength; - } - return 11.5 - 2.5 * (rotate / 15) * (rotate > 0 ? 1 : -1); - } - - switch (orient) { - case 'bottom': - { - tickTransform = axisX; - lineEnter.attr('y2', innerTickSize); - textEnter.attr('y', tickLength); - lineUpdate.attr('x1', tickX).attr('x2', tickX).attr('y2', tickSize); - textUpdate.attr('x', 0).attr('y', yForText(rotate)) - .style('text-anchor', textAnchorForText(rotate)) - .attr('transform', textTransform(rotate)); - tspan.attr('x', 0).attr('dy', tspanDy).attr('dx', dxForText(rotate)); - pathUpdate.attr('d', 'M' + range[0] + ',' + outerTickSize + 'V0H' + range[1] + 'V' + outerTickSize); - break; - } - case 'top': - { - // TODO: rotated tick text - tickTransform = axisX; - lineEnter.attr('y2', -innerTickSize); - textEnter.attr('y', -tickLength); - lineUpdate.attr('x2', 0).attr('y2', -innerTickSize); - textUpdate.attr('x', 0).attr('y', -tickLength); - text.style('text-anchor', 'middle'); - tspan.attr('x', 0).attr('dy', '0em'); - pathUpdate.attr('d', 'M' + range[0] + ',' + -outerTickSize + 'V0H' + range[1] + 'V' + -outerTickSize); - break; - } - case 'left': - { - tickTransform = axisY; - lineEnter.attr('x2', -innerTickSize); - textEnter.attr('x', -tickLength); - lineUpdate.attr('x2', -innerTickSize).attr('y1', tickY).attr('y2', tickY); - textUpdate.attr('x', -tickLength).attr('y', tickOffset); - text.style('text-anchor', 'end'); - tspan.attr('x', -tickLength).attr('dy', tspanDy); - pathUpdate.attr('d', 'M' + -outerTickSize + ',' + range[0] + 'H0V' + range[1] + 'H' + -outerTickSize); - break; - } - case 'right': - { - tickTransform = axisY; - lineEnter.attr('x2', innerTickSize); - textEnter.attr('x', tickLength); - lineUpdate.attr('x2', innerTickSize).attr('y2', 0); - textUpdate.attr('x', tickLength).attr('y', 0); - text.style('text-anchor', 'start'); - tspan.attr('x', tickLength).attr('dy', tspanDy); - pathUpdate.attr('d', 'M' + outerTickSize + ',' + range[0] + 'H0V' + range[1] + 'H' + outerTickSize); - break; - } - default: - break; - } - if (scale1.rangeBand) { - let x = scale1, - dx = x.rangeBand() / 2; - scale0 = scale1 = function (d) { - return x(d) + dx; - }; - } else if (scale0.rangeBand) { - scale0 = scale1; - } else { - tickExit.call(tickTransform, scale1); - } - tickEnter.call(tickTransform, scale0); - tickUpdate.call(tickTransform, scale1); - }); - } - axis.scale = function (x) { - if (!arguments.length) { return scale; } - scale = x; - return axis; - }; - axis.orient = function (x) { - if (!arguments.length) { return orient; } - orient = x in { top: 1, right: 1, bottom: 1, left: 1 } ? x + '' : 'bottom'; - return axis; - }; - axis.tickFormat = function (format) { - if (!arguments.length) { return tickFormat; } - tickFormat = format; - return axis; - }; - axis.tickCentered = function (isCentered) { - if (!arguments.length) { return tickCentered; } - tickCentered = isCentered; - return axis; - }; - axis.tickOffset = function () { - return tickOffset; - }; - axis.tickInterval = function () { - let interval, - length; - if (params.isCategory) { - interval = tickOffset * 2; - } else { - length = axis.g.select('path.domain').node().getTotalLength() - outerTickSize * 2; - interval = length / axis.g.selectAll('line').size(); - } - return interval === Infinity ? 0 : interval; - }; - axis.ticks = function (...args) { - if (!arguments.length) { return tickArguments; } - tickArguments = args; - return axis; - }; - axis.tickCulling = function (culling) { - if (!arguments.length) { return tickCulling; } - tickCulling = culling; - return axis; - }; - axis.tickValues = function (x) { - if (typeof x === 'function') { - tickValues = function () { - return x(scale.domain()); - }; - } else { - if (!arguments.length) { return tickValues; } - tickValues = x; - } - return axis; - }; - return axis; -} - -export default c3_axis; diff --git a/es6_modules/axis/index.js b/es6_modules/axis/index.js deleted file mode 100644 index 5704553..0000000 --- a/es6_modules/axis/index.js +++ /dev/null @@ -1,41 +0,0 @@ -// import { -// CLASS, -// isValue, -// isFunction, -// isString, -// isUndefined, -// isDefined, -// ceil10, -// asHalfPixel, -// diffDomain, -// isEmpty, -// notEmpty, -// getOption, -// hasValue, -// sanitise, -// getPathBox, -// ChartInternal } from '../chartinternal'; - -import Axis from './axis'; - -function API(owner) { - this.owner = owner; -} - -/* eslint-disable */ -function inherit(base, derived) { - if (Object.create) { - derived.prototype = Object.create(base.prototype); - } else { - const f = function f() {}; - f.prototype = base.prototype; - derived.prototype = new f(); - } - - derived.prototype.constructor = derived; - - return derived; -} -/* eslint-enable */ - -export { API, inherit, Axis }; diff --git a/es6_modules/chart/api.axis.js b/es6_modules/chart/api.axis.js deleted file mode 100644 index 3b3b3d4..0000000 --- a/es6_modules/chart/api.axis.js +++ /dev/null @@ -1,81 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const axis = function () {}; -axis.labels = function (labels) { - const $$ = this.internal; - if (arguments.length) { - Object.keys(labels).forEach((axisId) => { - $$.axis.setLabelText(axisId, labels[axisId]); - }); - $$.axis.updateLabels(); - } - // TODO: return some values? -}; -axis.max = function (max) { - let $$ = this.internal, config = $$.config; - if (arguments.length) { - if (typeof max === 'object') { - if (isValue(max.x)) { config.axis_x_max = max.x; } - if (isValue(max.y)) { config.axis_y_max = max.y; } - if (isValue(max.y2)) { config.axis_y2_max = max.y2; } - } else { - config.axis_y_max = config.axis_y2_max = max; - } - $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true }); - } else { - return { - x: config.axis_x_max, - y: config.axis_y_max, - y2: config.axis_y2_max, - }; - } -}; -axis.min = function (min) { - let $$ = this.internal, config = $$.config; - if (arguments.length) { - if (typeof min === 'object') { - if (isValue(min.x)) { config.axis_x_min = min.x; } - if (isValue(min.y)) { config.axis_y_min = min.y; } - if (isValue(min.y2)) { config.axis_y2_min = min.y2; } - } else { - config.axis_y_min = config.axis_y2_min = min; - } - $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true }); - } else { - return { - x: config.axis_x_min, - y: config.axis_y_min, - y2: config.axis_y2_min, - }; - } -}; -axis.range = function (range) { - if (arguments.length) { - if (isDefined(range.max)) { this.axis.max(range.max); } - if (isDefined(range.min)) { this.axis.min(range.min); } - } else { - return { - max: this.axis.max(), - min: this.axis.min(), - }; - } -}; - -export { axis }; diff --git a/es6_modules/chart/api.category.js b/es6_modules/chart/api.category.js deleted file mode 100644 index 009874f..0000000 --- a/es6_modules/chart/api.category.js +++ /dev/null @@ -1,36 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal, -} from '../internals/index'; - -const category = function (i, category) { - let $$ = this.internal, config = $$.config; - if (arguments.length > 1) { - config.axis_x_categories[i] = category; - $$.redraw(); - } - return config.axis_x_categories[i]; -}; -const categories = function (categories) { - let $$ = this.internal, config = $$.config; - if (!arguments.length) { return config.axis_x_categories; } - config.axis_x_categories = categories; - $$.redraw(); - return config.axis_x_categories; -}; - -export { category, categories }; diff --git a/es6_modules/chart/api.chart.js b/es6_modules/chart/api.chart.js deleted file mode 100644 index 81bfb47..0000000 --- a/es6_modules/chart/api.chart.js +++ /dev/null @@ -1,64 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const resize = function (size) { - let $$ = this.internal, config = $$.config; - config.size_width = size ? size.width : null; - config.size_height = size ? size.height : null; - this.flush(); -}; - -const flush = function () { - const $$ = this.internal; - $$.updateAndRedraw({ withLegend: true, withTransition: false, withTransitionForTransform: false }); -}; - -const destroy = function () { - const $$ = this.internal; - - window.clearInterval($$.intervalForObserveInserted); - - if ($$.resizeTimeout !== undefined) { - window.clearTimeout($$.resizeTimeout); - } - - if (window.detachEvent) { - window.detachEvent('onresize', $$.resizeFunction); - } else if (window.removeEventListener) { - window.removeEventListener('resize', $$.resizeFunction); - } else { - const wrapper = window.onresize; - // check if no one else removed our wrapper and remove our resizeFunction from it - if (wrapper && wrapper.add && wrapper.remove) { - wrapper.remove($$.resizeFunction); - } - } - - $$.selectChart.classed('c3', false).html(''); - - // MEMO: this is needed because the reference of some elements will not be released, - // then memory leak will happen. - Object.keys($$).forEach((key) => { - $$[key] = null; - }); - - return null; -}; - -export { resize, flush, destroy }; diff --git a/es6_modules/chart/api.color.js b/es6_modules/chart/api.color.js deleted file mode 100644 index db5f5a8..0000000 --- a/es6_modules/chart/api.color.js +++ /dev/null @@ -1,26 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -// TODO: fix -const color = function (id) { - const $$ = this.internal; - return $$.color(id); // more patterns -}; - -export { color }; diff --git a/es6_modules/chart/api.data.js b/es6_modules/chart/api.data.js deleted file mode 100644 index e978583..0000000 --- a/es6_modules/chart/api.data.js +++ /dev/null @@ -1,53 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const data = function (targetIds) { - const targets = this.internal.data.targets; - return typeof targetIds === 'undefined' ? targets : targets.filter((t) => { - return [].concat(targetIds).indexOf(t.id) >= 0; - }); -}; - -data.shown = function (targetIds) { - return this.internal.filterTargetsToShow(this.data(targetIds)); -}; - -data.values = function (targetId) { - let targets, values = null; - if (targetId) { - targets = this.data(targetId); - values = targets[0] ? targets[0].values.map((d) => { return d.value; }) : null; - } - return values; -}; - -data.names = function (names) { - this.internal.clearLegendItemTextBoxCache(); - return this.internal.updateDataAttributes('names', names); -}; - -data.colors = function (colors) { - return this.internal.updateDataAttributes('colors', colors); -}; - -data.axes = function (axes) { - return this.internal.updateDataAttributes('axes', axes); -}; - -export { data }; diff --git a/es6_modules/chart/api.flow.js b/es6_modules/chart/api.flow.js deleted file mode 100644 index 6b68dc2..0000000 --- a/es6_modules/chart/api.flow.js +++ /dev/null @@ -1,164 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const flow = function (args) { - let $$ = this.internal, - targets, data, notfoundIds = [], - orgDataCount = $$.getMaxDataCount(), - dataCount, domain, baseTarget, baseValue, length = 0, - tail = 0, - diff, to; - - if (args.json) { - data = $$.convertJsonToData(args.json, args.keys); - } else if (args.rows) { - data = $$.convertRowsToData(args.rows); - } else if (args.columns) { - data = $$.convertColumnsToData(args.columns); - } else { - return; - } - targets = $$.convertDataToTargets(data, true); - - // Update/Add data - $$.data.targets.forEach((t) => { - let found = false, - i, j; - for (i = 0; i < targets.length; i++) { - if (t.id === targets[i].id) { - found = true; - - if (t.values[t.values.length - 1]) { - tail = t.values[t.values.length - 1].index + 1; - } - length = targets[i].values.length; - - for (j = 0; j < length; j++) { - targets[i].values[j].index = tail + j; - if (!$$.isTimeSeries()) { - targets[i].values[j].x = tail + j; - } - } - t.values = t.values.concat(targets[i].values); - - targets.splice(i, 1); - break; - } - } - if (!found) { notfoundIds.push(t.id); } - }); - - // Append null for not found targets - $$.data.targets.forEach((t) => { - let i, j; - for (i = 0; i < notfoundIds.length; i++) { - if (t.id === notfoundIds[i]) { - tail = t.values[t.values.length - 1].index + 1; - for (j = 0; j < length; j++) { - t.values.push({ - id: t.id, - index: tail + j, - x: $$.isTimeSeries() ? $$.getOtherTargetX(tail + j) : tail + j, - value: null, - }); - } - } - } - }); - - // Generate null values for new target - if ($$.data.targets.length) { - targets.forEach((t) => { - let i, missing = []; - for (i = $$.data.targets[0].values[0].index; i < tail; i++) { - missing.push({ - id: t.id, - index: i, - x: $$.isTimeSeries() ? $$.getOtherTargetX(i) : i, - value: null, - }); - } - t.values.forEach((v) => { - v.index += tail; - if (!$$.isTimeSeries()) { - v.x += tail; - } - }); - t.values = missing.concat(t.values); - }); - } - $$.data.targets = $$.data.targets.concat(targets); // add remained - - // check data count because behavior needs to change when it's only one - dataCount = $$.getMaxDataCount(); - baseTarget = $$.data.targets[0]; - baseValue = baseTarget.values[0]; - - // Update length to flow if needed - if (isDefined(args.to)) { - length = 0; - to = $$.isTimeSeries() ? $$.parseDate(args.to) : args.to; - baseTarget.values.forEach((v) => { - if (v.x < to) { length++; } - }); - } else if (isDefined(args.length)) { - length = args.length; - } - - // If only one data, update the domain to flow from left edge of the chart - if (!orgDataCount) { - if ($$.isTimeSeries()) { - if (baseTarget.values.length > 1) { - diff = baseTarget.values[baseTarget.values.length - 1].x - baseValue.x; - } else { - diff = baseValue.x - $$.getXDomain($$.data.targets)[0]; - } - } else { - diff = 1; - } - domain = [baseValue.x - diff, baseValue.x]; - $$.updateXDomain(null, true, true, false, domain); - } else if (orgDataCount === 1) { - if ($$.isTimeSeries()) { - diff = (baseTarget.values[baseTarget.values.length - 1].x - baseValue.x) / 2; - domain = [new Date(+baseValue.x - diff), new Date(+baseValue.x + diff)]; - $$.updateXDomain(null, true, true, false, domain); - } - } - - // Set targets - $$.updateTargets($$.data.targets); - - // Redraw with new targets - $$.redraw({ - flow: { - index: baseValue.index, - length, - duration: isValue(args.duration) ? args.duration : $$.config.transition_duration, - done: args.done, - orgDataCount, - }, - withLegend: true, - withTransition: orgDataCount > 1, - withTrimXDomain: false, - withUpdateXAxis: true, - }); -}; - -export { flow }; diff --git a/es6_modules/chart/api.focus.js b/es6_modules/chart/api.focus.js deleted file mode 100644 index f0febc6..0000000 --- a/es6_modules/chart/api.focus.js +++ /dev/null @@ -1,81 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const focus = function (targetIds) { - let $$ = this.internal, candidates; - - targetIds = $$.mapToTargetIds(targetIds); - candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))), - - this.revert(); - this.defocus(); - candidates.classed(CLASS.focused, true).classed(CLASS.defocused, false); - if ($$.hasArcType()) { - $$.expandArc(targetIds); - } - $$.toggleFocusLegend(targetIds, true); - - $$.focusedTargetIds = targetIds; - $$.defocusedTargetIds = $$.defocusedTargetIds.filter((id) => { - return targetIds.indexOf(id) < 0; - }); -}; - -const defocus = function (targetIds) { - let $$ = this.internal, candidates; - - targetIds = $$.mapToTargetIds(targetIds); - candidates = $$.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))), - - candidates.classed(CLASS.focused, false).classed(CLASS.defocused, true); - if ($$.hasArcType()) { - $$.unexpandArc(targetIds); - } - $$.toggleFocusLegend(targetIds, false); - - $$.focusedTargetIds = $$.focusedTargetIds.filter((id) => { - return targetIds.indexOf(id) < 0; - }); - $$.defocusedTargetIds = targetIds; -}; - -const revert = function (targetIds) { - let $$ = this.internal, candidates; - - targetIds = $$.mapToTargetIds(targetIds); - candidates = $$.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets - - candidates.classed(CLASS.focused, false).classed(CLASS.defocused, false); - if ($$.hasArcType()) { - $$.unexpandArc(targetIds); - } - if ($$.config.legend_show) { - $$.showLegend(targetIds.filter($$.isLegendToShow.bind($$))); - $$.legend.selectAll($$.selectorLegends(targetIds)) - .filter(function () { - return $$.d3.select(this).classed(CLASS.legendItemFocused); - }) - .classed(CLASS.legendItemFocused, false); - } - - $$.focusedTargetIds = []; - $$.defocusedTargetIds = []; -}; - -export { focus, defocus, revert }; diff --git a/es6_modules/chart/api.grid.js b/es6_modules/chart/api.grid.js deleted file mode 100644 index 710db15..0000000 --- a/es6_modules/chart/api.grid.js +++ /dev/null @@ -1,56 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const xgrids = function (grids) { - let $$ = this.internal, config = $$.config; - if (!grids) { return config.grid_x_lines; } - config.grid_x_lines = grids; - $$.redrawWithoutRescale(); - return config.grid_x_lines; -}; - -xgrids.add = function (grids) { - const $$ = this.internal; - return this.xgrids($$.config.grid_x_lines.concat(grids ? grids : [])); -}; - -xgrids.remove = function (params) { // TODO: multiple - const $$ = this.internal; - $$.removeGridLines(params, true); -}; - -const ygrids = function (grids) { - let $$ = this.internal, config = $$.config; - if (!grids) { return config.grid_y_lines; } - config.grid_y_lines = grids; - $$.redrawWithoutRescale(); - return config.grid_y_lines; -}; - -ygrids.add = function (grids) { - const $$ = this.internal; - return this.ygrids($$.config.grid_y_lines.concat(grids ? grids : [])); -}; - -ygrids.remove = function (params) { // TODO: multiple - const $$ = this.internal; - $$.removeGridLines(params, false); -}; - -export { xgrids, ygrids }; diff --git a/es6_modules/chart/api.group.js b/es6_modules/chart/api.group.js deleted file mode 100644 index 1a82491..0000000 --- a/es6_modules/chart/api.group.js +++ /dev/null @@ -1,28 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const groups = function (groups) { - let $$ = this.internal, config = $$.config; - if (isUndefined(groups)) { return config.data_groups; } - config.data_groups = groups; - $$.redraw(); - return config.data_groups; -}; - -export { groups }; diff --git a/es6_modules/chart/api.legend.js b/es6_modules/chart/api.legend.js deleted file mode 100644 index 7341270..0000000 --- a/es6_modules/chart/api.legend.js +++ /dev/null @@ -1,34 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const legend = function () {}; - -legend.show = function (targetIds) { - const $$ = this.internal; - $$.showLegend($$.mapToTargetIds(targetIds)); - $$.updateAndRedraw({ withLegend: true }); -}; - -legend.hide = function (targetIds) { - const $$ = this.internal; - $$.hideLegend($$.mapToTargetIds(targetIds)); - $$.updateAndRedraw({ withLegend: true }); -}; - -export { legend }; diff --git a/es6_modules/chart/api.load.js b/es6_modules/chart/api.load.js deleted file mode 100644 index 182e1dd..0000000 --- a/es6_modules/chart/api.load.js +++ /dev/null @@ -1,82 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const load = function (args) { - let $$ = this.internal, config = $$.config; - // update xs if specified - if (args.xs) { - $$.addXs(args.xs); - } - // update names if exists - if ('names' in args) { - c3_chart_fn.data.names.bind(this)(args.names); - } - // update classes if exists - if ('classes' in args) { - Object.keys(args.classes).forEach((id) => { - config.data_classes[id] = args.classes[id]; - }); - } - // update categories if exists - if ('categories' in args && $$.isCategorized()) { - config.axis_x_categories = args.categories; - } - // update axes if exists - if ('axes' in args) { - Object.keys(args.axes).forEach((id) => { - config.data_axes[id] = args.axes[id]; - }); - } - // update colors if exists - if ('colors' in args) { - Object.keys(args.colors).forEach((id) => { - config.data_colors[id] = args.colors[id]; - }); - } - // use cache if exists - if ('cacheIds' in args && $$.hasCaches(args.cacheIds)) { - $$.load($$.getCaches(args.cacheIds), args.done); - return; - } - // unload if needed - if ('unload' in args) { - // TODO: do not unload if target will load (included in url/rows/columns) - $$.unload($$.mapToTargetIds((typeof args.unload === 'boolean' && args.unload) ? null : args.unload), () => { - $$.loadFromArgs(args); - }); - } else { - $$.loadFromArgs(args); - } -}; - -const unload = function (args) { - const $$ = this.internal; - args = args || {}; - if (args instanceof Array) { - args = { ids: args }; - } else if (typeof args === 'string') { - args = { ids: [args] }; - } - $$.unload($$.mapToTargetIds(args.ids), () => { - $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true }); - if (args.done) { args.done(); } - }); -}; - -export { load, unload }; diff --git a/es6_modules/chart/api.region.js b/es6_modules/chart/api.region.js deleted file mode 100644 index 2213212..0000000 --- a/es6_modules/chart/api.region.js +++ /dev/null @@ -1,63 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const regions = function (regions) { - let $$ = this.internal, config = $$.config; - if (!regions) { return config.regions; } - config.regions = regions; - $$.redrawWithoutRescale(); - return config.regions; -}; - -regions.add = function (regions) { - let $$ = this.internal, config = $$.config; - if (!regions) { return config.regions; } - config.regions = config.regions.concat(regions); - $$.redrawWithoutRescale(); - return config.regions; -}; - -regions.remove = function (options) { - let $$ = this.internal, config = $$.config, - duration, classes, regions; - - options = options || {}; - duration = $$.getOption(options, 'duration', config.transition_duration); - classes = $$.getOption(options, 'classes', [CLASS.region]); - - regions = $$.main.select('.' + CLASS.regions).selectAll(classes.map((c) => { return '.' + c; })); - (duration ? regions.transition().duration(duration) : regions) - .style('opacity', 0) - .remove(); - - config.regions = config.regions.filter((region) => { - let found = false; - if (!region.class) { - return true; - } - region.class.split(' ').forEach((c) => { - if (classes.indexOf(c) >= 0) { found = true; } - }); - return !found; - }); - - return config.regions; -}; - -export { regions }; diff --git a/es6_modules/chart/api.selection.js b/es6_modules/chart/api.selection.js deleted file mode 100644 index 9b6fd5b..0000000 --- a/es6_modules/chart/api.selection.js +++ /dev/null @@ -1,77 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const selected = function (targetId) { - let $$ = this.internal, d3 = $$.d3; - return d3.merge( - $$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape) - .filter(function () { return d3.select(this).classed(CLASS.SELECTED); }) - .map((d) => { return d.map((d) => { const data = d.__data__; return data.data ? data.data : data; }); }) - ); -}; - -const select = function (ids, indices, resetOther) { - let $$ = this.internal, d3 = $$.d3, config = $$.config; - if (!config.data_selection_enabled) { return; } - $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { - let shape = d3.select(this), id = d.data ? d.data.id : d.id, - toggle = $$.getToggle(this, d).bind($$), - isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0, - isTargetIndex = !indices || indices.indexOf(i) >= 0, - isSelected = shape.classed(CLASS.SELECTED); - // line/area selection not supported yet - if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) { - return; - } - if (isTargetId && isTargetIndex) { - if (config.data_selection_isselectable(d) && !isSelected) { - toggle(true, shape.classed(CLASS.SELECTED, true), d, i); - } - } else if (isDefined(resetOther) && resetOther) { - if (isSelected) { - toggle(false, shape.classed(CLASS.SELECTED, false), d, i); - } - } - }); -}; - -const unselect = function (ids, indices) { - let $$ = this.internal, d3 = $$.d3, config = $$.config; - if (!config.data_selection_enabled) { return; } - $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { - let shape = d3.select(this), id = d.data ? d.data.id : d.id, - toggle = $$.getToggle(this, d).bind($$), - isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0, - isTargetIndex = !indices || indices.indexOf(i) >= 0, - isSelected = shape.classed(CLASS.SELECTED); - // line/area selection not supported yet - if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) { - return; - } - if (isTargetId && isTargetIndex) { - if (config.data_selection_isselectable(d)) { - if (isSelected) { - toggle(false, shape.classed(CLASS.SELECTED, false), d, i); - } - } - } - }); -}; - -export { selected, select, unselect }; diff --git a/es6_modules/chart/api.show.js b/es6_modules/chart/api.show.js deleted file mode 100644 index 6075092..0000000 --- a/es6_modules/chart/api.show.js +++ /dev/null @@ -1,71 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const show = function (targetIds, options) { - let $$ = this.internal, targets; - - targetIds = $$.mapToTargetIds(targetIds); - options = options || {}; - - $$.removeHiddenTargetIds(targetIds); - targets = $$.svg.selectAll($$.selectorTargets(targetIds)); - - targets.transition() - .style('opacity', 1, 'important') - .call($$.endall, () => { - targets.style('opacity', null).style('opacity', 1); - }); - - if (options.withLegend) { - $$.showLegend(targetIds); - } - - $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true }); -}; - -const hide = function (targetIds, options) { - let $$ = this.internal, targets; - - targetIds = $$.mapToTargetIds(targetIds); - options = options || {}; - - $$.addHiddenTargetIds(targetIds); - targets = $$.svg.selectAll($$.selectorTargets(targetIds)); - - targets.transition() - .style('opacity', 0, 'important') - .call($$.endall, () => { - targets.style('opacity', null).style('opacity', 0); - }); - - if (options.withLegend) { - $$.hideLegend(targetIds); - } - - $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true }); -}; - -const toggle = function (targetIds, options) { - let that = this, $$ = this.internal; - $$.mapToTargetIds(targetIds).forEach((targetId) => { - $$.isTargetToShow(targetId) ? that.hide(targetId, options) : that.show(targetId, options); - }); -}; - -export { show, hide, toggle }; diff --git a/es6_modules/chart/api.tooltip.js b/es6_modules/chart/api.tooltip.js deleted file mode 100644 index a8581e7..0000000 --- a/es6_modules/chart/api.tooltip.js +++ /dev/null @@ -1,60 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const tooltip = function () {}; - -tooltip.show = function (args) { - let $$ = this.internal, index, mouse; - - // determine mouse position on the chart - if (args.mouse) { - mouse = args.mouse; - } - - // determine focus data - if (args.data) { - if ($$.isMultipleX()) { - // if multiple xs, target point will be determined by mouse - mouse = [$$.x(args.data.x), $$.getYScale(args.data.id)(args.data.value)]; - index = null; - } else { - // TODO: when tooltip_grouped = false - index = isValue(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x); - } - } else if (typeof args.x !== 'undefined') { - index = $$.getIndexByX(args.x); - } else if (typeof args.index !== 'undefined') { - index = args.index; - } - - // emulate mouse events to show - $$.dispatchEvent('mouseover', index, mouse); - $$.dispatchEvent('mousemove', index, mouse); - - $$.config.tooltip_onshow.call($$, args.data); -}; - -tooltip.hide = function () { - // TODO: get target data by checking the state of focus - this.internal.dispatchEvent('mouseout', 0); - - this.internal.config.tooltip_onhide.call(this); -}; - -export { tooltip }; diff --git a/es6_modules/chart/api.transform.js b/es6_modules/chart/api.transform.js deleted file mode 100644 index cd9a309..0000000 --- a/es6_modules/chart/api.transform.js +++ /dev/null @@ -1,26 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const transform = function (type, targetIds) { - let $$ = this.internal, - options = ['pie', 'donut'].indexOf(type) >= 0 ? { withTransform: true } : null; - $$.transformTo(targetIds, type, options); -}; - -export { transform }; diff --git a/es6_modules/chart/api.x.js b/es6_modules/chart/api.x.js deleted file mode 100644 index 7fb2d76..0000000 --- a/es6_modules/chart/api.x.js +++ /dev/null @@ -1,38 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const x = function (x) { - const $$ = this.internal; - if (arguments.length) { - $$.updateTargetX($$.data.targets, x); - $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true }); - } - return $$.data.xs; -}; - -const xs = function (xs) { - const $$ = this.internal; - if (arguments.length) { - $$.updateTargetXs($$.data.targets, xs); - $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true }); - } - return $$.data.xs; -}; - -export { x, xs }; diff --git a/es6_modules/chart/api.zoom.js b/es6_modules/chart/api.zoom.js deleted file mode 100644 index 538f99a..0000000 --- a/es6_modules/chart/api.zoom.js +++ /dev/null @@ -1,77 +0,0 @@ -import { - CLASS, - isValue, - isFunction, - isString, - isUndefined, - isDefined, - ceil10, - asHalfPixel, - diffDomain, - isEmpty, - notEmpty, - getOption, - hasValue, - sanitise, - getPathBox, - ChartInternal -} from '../internals/index'; - -const zoom = function (domain) { - const $$ = this.internal; - if (domain) { - if ($$.isTimeSeries()) { - domain = domain.map((x) => { return $$.parseDate(x); }); - } - $$.brush.extent(domain); - $$.redraw({ withUpdateXDomain: true, withY: $$.config.zoom_rescale }); - $$.config.zoom_onzoom.call(this, $$.x.orgDomain()); - } - return $$.brush.extent(); -}; - -const unzoom = function () { - const $$ = this.internal; - $$.brush.clear().update(); - $$.redraw({ withUpdateXDomain: true }); -}; - -zoom.enable = function (enabled) { - const $$ = this.internal; - $$.config.zoom_enabled = enabled; - $$.updateAndRedraw(); -}; - -zoom.max = function (max) { - let $$ = this.internal, config = $$.config, d3 = $$.d3; - if (max === 0 || max) { - config.zoom_x_max = d3.max([$$.orgXDomain[1], max]); - } - else { - return config.zoom_x_max; - } -}; - -zoom.min = function (min) { - let $$ = this.internal, config = $$.config, d3 = $$.d3; - if (min === 0 || min) { - config.zoom_x_min = d3.min([$$.orgXDomain[0], min]); - } - else { - return config.zoom_x_min; - } -}; - -zoom.range = function (range) { - if (arguments.length) { - if (isDefined(range.max)) { this.domain.max(range.max); } - if (isDefined(range.min)) { this.domain.min(range.min); } - } else { - return { - max: this.domain.max(), - min: this.domain.min(), - }; - } -}; - -export { zoom, unzoom }; diff --git a/es6_modules/chart/index.js b/es6_modules/chart/index.js deleted file mode 100644 index 45649ac..0000000 --- a/es6_modules/chart/index.js +++ /dev/null @@ -1,78 +0,0 @@ -import { ChartInternal } from '../internals/index'; - -import { axis } from './api.axis'; -import { category, categories } from './api.category'; -import { resize, flush, destroy } from './api.chart'; -import { color } from './api.color'; -import { data } from './api.data'; -import { flow } from './api.flow'; -import { focus, defocus, revert } from './api.focus'; -import { xgrids, ygrids } from './api.grid'; -import { groups } from './api.group'; -import { legend } from './api.legend'; -import { load, unload } from './api.load'; -import { regions } from './api.region'; -import { selected, select, unselect } from './api.selection'; -import { show, hide, toggle } from './api.show'; -import { tooltip } from './api.tooltip'; -import { transform } from './api.transform'; -import { x, xs } from './api.x'; -import { zoom, unzoom } from './api.zoom'; - - -let c3_chart_fn; - -function Chart(config) { - const $$ = this.internal = new ChartInternal(this); - $$.loadConfig(config); - - $$.beforeInit(config); - $$.init(); - $$.afterInit(config); - - // bind "this" to nested API - (function bindThis(fn, target, argThis) { - Object.keys(fn).forEach((key) => { - target[key] = fn[key].bind(argThis); - if (Object.keys(fn[key]).length > 0) { - bindThis(fn[key], target[key], argThis); - } - }); - })(c3_chart_fn, this, this); -} - -c3_chart_fn = Chart.prototype; - -c3_chart_fn.axis = axis; -c3_chart_fn.category = category; -c3_chart_fn.categories = categories; -c3_chart_fn.resize = resize; -c3_chart_fn.flush = flush; -c3_chart_fn.destroy = destroy; -c3_chart_fn.color = color; -c3_chart_fn.data = data; -c3_chart_fn.flow = flow; -c3_chart_fn.focus = focus; -c3_chart_fn.defocus = defocus; -c3_chart_fn.revert = revert; -c3_chart_fn.xgrids = xgrids; -c3_chart_fn.ygrids = ygrids; -c3_chart_fn.groups = groups; -c3_chart_fn.legend = legend; -c3_chart_fn.load = load; -c3_chart_fn.unload = unload; -c3_chart_fn.regions = regions; -c3_chart_fn.selected = selected; -c3_chart_fn.select = select; -c3_chart_fn.unselect = unselect; -c3_chart_fn.show = show; -c3_chart_fn.hide = hide; -c3_chart_fn.toggle = toggle; -c3_chart_fn.tooltip = tooltip; -c3_chart_fn.transform = transform; -c3_chart_fn.x = x; -c3_chart_fn.xs = xs; -c3_chart_fn.zoom = zoom; -c3_chart_fn.unzoom = unzoom; - -export { Chart }; diff --git a/karma.conf.js b/karma.conf.js index 5b737b4..d39cfe7 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,6 +1,8 @@ // Karma configuration // Generated on Wed Sep 30 2015 22:01:48 GMT+0900 (KST) +const babel = require('rollup-plugin-babel'); + module.exports = function(config) { config.set({ @@ -15,9 +17,6 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ - 'node_modules/d3/d3.min.js', - 'c3.js', - 'c3.css', 'spec/*-helper.js', 'spec/*-spec.js' ], @@ -31,10 +30,22 @@ module.exports = function(config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { - 'c3.js': ['coverage'] + 'spec/*.js': ['rollup', 'coverage'] }, + rollupPreprocessor: { + // rollup settings. See Rollup documentation + plugins: [ + babel({ + exclude: 'node_modules/**' + }) + ], + // will help to prevent conflicts between different tests entries + format: 'iife', + sourceMap: 'inline' + }, + // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter @@ -56,7 +67,7 @@ module.exports = function(config) { // level of logging // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_INFO, + logLevel: config.LOG_ERROR, // enable / disable watching file and executing tests whenever any file changes diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000..309cfdc --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,45 @@ +0 info it worked if it ends with ok +1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'test' ] +2 info using npm@3.10.3 +3 info using node@v6.5.0 +4 verbose run-script [ 'pretest', 'test', 'posttest' ] +5 info lifecycle c3@0.4.11~pretest: c3@0.4.11 +6 silly lifecycle c3@0.4.11~pretest: no script for pretest, continuing +7 info lifecycle c3@0.4.11~test: c3@0.4.11 +8 verbose lifecycle c3@0.4.11~test: unsafe-perm in lifecycle true +9 verbose lifecycle c3@0.4.11~test: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/aendrew/Sites/c3/node_modules/.bin:/usr/local/bin:/Users/aendrew/.rvm/gems/ruby-2.0.0-p353/bin:/Users/aendrew/.rvm/gems/ruby-2.0.0-p353@global/bin:/Users/aendrew/.rvm/rubies/ruby-2.0.0-p353/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Users/aendrew/bin:/Users/aendrew/.rvm/gems/ruby-2.0.0-p353/bin:/Users/aendrew/.rvm/gems/ruby-2.0.0-p353@global/bin:/Users/aendrew/.rvm/rubies/ruby-2.0.0-p353/bin:/Users/aendrew/.composer/vendor/bin:/Users/aendrew/local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/aendrew/.rvm/bin:/Users/aendrew/.rvm/bin +10 verbose lifecycle c3@0.4.11~test: CWD: /Users/aendrew/Sites/c3 +11 silly lifecycle c3@0.4.11~test: Args: [ '-c', 'karma start karma.conf.js' ] +12 silly lifecycle c3@0.4.11~test: Returned: code: 1 signal: null +13 info lifecycle c3@0.4.11~test: Failed to exec test script +14 verbose stack Error: c3@0.4.11 test: `karma start karma.conf.js` +14 verbose stack Exit status 1 +14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:242:16) +14 verbose stack at emitTwo (events.js:106:13) +14 verbose stack at EventEmitter.emit (events.js:191:7) +14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14) +14 verbose stack at emitTwo (events.js:106:13) +14 verbose stack at ChildProcess.emit (events.js:191:7) +14 verbose stack at maybeClose (internal/child_process.js:877:16) +14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) +15 verbose pkgid c3@0.4.11 +16 verbose cwd /Users/aendrew/Sites/c3 +17 error Darwin 15.3.0 +18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test" +19 error node v6.5.0 +20 error npm v3.10.3 +21 error code ELIFECYCLE +22 error c3@0.4.11 test: `karma start karma.conf.js` +22 error Exit status 1 +23 error Failed at the c3@0.4.11 test script 'karma start karma.conf.js'. +23 error Make sure you have the latest version of node.js and npm installed. +23 error If you do, this is most likely a problem with the c3 package, +23 error not with npm itself. +23 error Tell the author that this fails on your system: +23 error karma start karma.conf.js +23 error You can get information on how to open an issue for this project with: +23 error npm bugs c3 +23 error Or if that isn't available, you can get their info via: +23 error npm owner ls c3 +23 error There is likely additional logging output above. +24 verbose exit [ 1, true ] diff --git a/package.json b/package.json index 6c46b4d..cc30ada 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,10 @@ "description": "D3-based reusable chart library", "main": "c3.js", "scripts": { - "lint": "grunt lint", + "lint": "eslint src/", "test": "karma start karma.conf.js", "codecov": "cat coverage/*/lcov.info | codecov", - "build": "rollup -c" + "build": "rollup -cm" }, "repository": { "type": "git", @@ -43,9 +43,11 @@ "jasmine-core": "^2.4.1", "jshint-stylish": "^2.2.0", "karma": "^1.1.1", + "karma-babel-preprocessor": "^6.0.1", "karma-coverage": "^1.1.0", "karma-jasmine": "^1.0.2", "karma-phantomjs-launcher": "^1.0.1", + "karma-rollup-plugin": "^0.2.3", "karma-spec-reporter": "0.0.26", "load-grunt-tasks": "^3.5.0", "phantomjs-prebuilt": "^2.1.7", diff --git a/rollup.config.js b/rollup.config.js index 767d149..805ed58 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -5,7 +5,7 @@ import babel from 'rollup-plugin-babel'; export default { - entry: 'es6_modules/rollup.entry.js', + entry: 'src/index.js', format: 'umd', moduleName: 'c3', external: ['d3'], diff --git a/spec/c3-helper.js b/spec/c3-helper.js index 970cd1b..cc19bdf 100644 --- a/spec/c3-helper.js +++ b/spec/c3-helper.js @@ -1,3 +1,5 @@ +import * as c3 from '../src/index'; + function initDom() { 'use strict'; @@ -30,9 +32,9 @@ function initChart(chart, args, done) { window.initDom(); } if (args) { - chart = window.c3.generate(args); - window.d3 = chart.internal.d3; - window.d3.select('.jasmine_html-reporter') + chart = c3.generate(args); + const d3 = chart.internal.d3; + d3.select('.jasmine_html-reporter') .style('position', 'absolute') .style('width', '640px') .style('right', 0); diff --git a/src/axis/axis.js b/src/axis/axis.js index 859e191..2fb72fa 100644 --- a/src/axis/axis.js +++ b/src/axis/axis.js @@ -1,3 +1,16 @@ +import * as d3 from 'd3'; + +import { + CLASS, + isValue, + isFunction, + isString, + isEmpty, +} from '../internals/index'; + +import { inherit, API } from './index'; +import c3_axis from './c3.axis'; + function Axis(owner) { API.call(this, owner); } @@ -5,7 +18,9 @@ function Axis(owner) { inherit(API, Axis); Axis.prototype.init = function init() { - let $$ = this.owner, config = $$.config, main = $$.main; + const $$ = this.owner; + const config = $$.config; + const main = $$.main; $$.axes.x = main.append('g') .attr('class', CLASS.axis + ' ' + CLASS.axisX) .attr('clip-path', $$.clipPathForXAxis) @@ -35,20 +50,28 @@ Axis.prototype.init = function init() { .attr('transform', config.axis_rotated ? '' : 'rotate(-90)') .style('text-anchor', this.textAnchorForY2AxisLabel.bind(this)); }; -Axis.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) { - let $$ = this.owner, config = $$.config, - axisParams = { - isCategory: $$.isCategorized(), - withOuterTick, - tickMultiline: config.axis_x_tick_multiline, - tickWidth: config.axis_x_tick_width, - tickTextRotate: withoutRotateTickText ? 0 : config.axis_x_tick_rotate, - withoutTransition, - }, - axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient); +Axis.prototype.getXAxis = function getXAxis( + scale, + orient, + tickFormat, + tickValues, + withOuterTick, + withoutTransition, + withoutRotateTickText) { + const $$ = this.owner; + const config = $$.config; + const axisParams = { + isCategory: $$.isCategorized(), + withOuterTick, + tickMultiline: config.axis_x_tick_multiline, + tickWidth: config.axis_x_tick_width, + tickTextRotate: withoutRotateTickText ? 0 : config.axis_x_tick_rotate, + withoutTransition, + }; + const axis = c3_axis(axisParams).scale(scale).orient(orient); if ($$.isTimeSeries() && tickValues && typeof tickValues !== 'function') { - tickValues = tickValues.map((v) => { return $$.parseDate(v); }); + tickValues = tickValues.map(v => $$.parseDate(v)); } // Set tick @@ -63,9 +86,15 @@ Axis.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickValue return axis; }; Axis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) { - let $$ = this.owner, config = $$.config, tickValues; + const $$ = this.owner; + const config = $$.config; + let tickValues; if (config.axis_x_tick_fit || config.axis_x_tick_count) { - tickValues = this.generateTickValues($$.mapTargetsToUniqueXs(targets), config.axis_x_tick_count, $$.isTimeSeries()); + tickValues = this.generateTickValues( + $$.mapTargetsToUniqueXs(targets), + config.axis_x_tick_count, + $$.isTimeSeries() + ); } if (axis) { axis.tickValues(tickValues); @@ -75,14 +104,21 @@ Axis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets, a } return tickValues; }; -Axis.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) { - let $$ = this.owner, config = $$.config, - axisParams = { - withOuterTick, - withoutTransition, - tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate, - }, - axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat); +Axis.prototype.getYAxis = function getYAxis(scale, + orient, + tickFormat, + tickValues, + withOuterTick, + withoutTransition, + withoutRotateTickText) { + const $$ = this.owner; + const config = $$.config; + const axisParams = { + withOuterTick, + withoutTransition, + tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate, + }; + const axis = c3_axis(axisParams).scale(scale).orient(orient).tickFormat(tickFormat); if ($$.isTimeSeriesY()) { axis.ticks($$.d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval); } else { @@ -95,8 +131,13 @@ Axis.prototype.getId = function getId(id) { return id in config.data_axes ? config.data_axes[id] : 'y'; }; Axis.prototype.getXAxisTickFormat = function getXAxisTickFormat() { - let $$ = this.owner, config = $$.config, - format = $$.isTimeSeries() ? $$.defaultAxisTimeFormat : $$.isCategorized() ? $$.categoryName : function (v) { return v < 0 ? v.toFixed(0) : v; }; + const $$ = this.owner; + const config = $$.config; + let format = $$.isTimeSeries() ? // eslint-disable-line no-nested-ternary + $$.defaultAxisTimeFormat : + $$.isCategorized() ? + $$.categoryName : + function (v) { return v < 0 ? v.toFixed(0) : v; }; if (config.axis_x_tick_format) { if (isFunction(config.axis_x_tick_format)) { format = config.axis_x_tick_format; @@ -109,7 +150,8 @@ Axis.prototype.getXAxisTickFormat = function getXAxisTickFormat() { return isFunction(format) ? function (v) { return format.call($$, v); } : format; }; Axis.prototype.getTickValues = function getTickValues(tickValues, axis) { - return tickValues ? tickValues : axis ? axis.tickValues() : undefined; + return tickValues ? tickValues : // eslint-disable-line no-nested-ternary,no-unneeded-ternary + axis ? axis.tickValues() : undefined; }; Axis.prototype.getXAxisTickValues = function getXAxisTickValues() { return this.getTickValues(this.owner.config.axis_x_tick_values, this.owner.xAxis); @@ -121,7 +163,9 @@ Axis.prototype.getY2AxisTickValues = function getY2AxisTickValues() { return this.getTickValues(this.owner.config.axis_y2_tick_values, this.owner.y2Axis); }; Axis.prototype.getLabelOptionByAxisId = function getLabelOptionByAxisId(axisId) { - let $$ = this.owner, config = $$.config, option; + const $$ = this.owner; + const config = $$.config; + let option; if (axisId === 'y') { option = config.axis_y_label; } else if (axisId === 'y2') { @@ -133,11 +177,12 @@ Axis.prototype.getLabelOptionByAxisId = function getLabelOptionByAxisId(axisId) }; Axis.prototype.getLabelText = function getLabelText(axisId) { const option = this.getLabelOptionByAxisId(axisId); - return isString(option) ? option : option ? option.text : null; + return isString(option) ? option : option ? option.text : null; // eslint-disable-line no-nested-ternary,max-len }; Axis.prototype.setLabelText = function setLabelText(axisId, text) { - let $$ = this.owner, config = $$.config, - option = this.getLabelOptionByAxisId(axisId); + const $$ = this.owner; + const config = $$.config; + const option = this.getLabelOptionByAxisId(axisId); if (isString(option)) { if (axisId === 'y') { config.axis_y_label = text; @@ -151,8 +196,8 @@ Axis.prototype.setLabelText = function setLabelText(axisId, text) { } }; Axis.prototype.getLabelPosition = function getLabelPosition(axisId, defaultPosition) { - let option = this.getLabelOptionByAxisId(axisId), - position = (option && typeof option === 'object' && option.position) ? option.position : defaultPosition; + const option = this.getLabelOptionByAxisId(axisId); + const position = (option && typeof option === 'object' && option.position) ? option.position : defaultPosition; return { isInner: position.indexOf('inner') >= 0, isOuter: position.indexOf('outer') >= 0, @@ -174,7 +219,8 @@ Axis.prototype.getY2AxisLabelPosition = function getY2AxisLabelPosition() { return this.getLabelPosition('y2', this.owner.config.axis_rotated ? 'inner-right' : 'inner-top'); }; Axis.prototype.getLabelPositionById = function getLabelPositionById(id) { - return id === 'y2' ? this.getY2AxisLabelPosition() : id === 'y' ? this.getYAxisLabelPosition() : this.getXAxisLabelPosition(); + return id === 'y2' ? this.getY2AxisLabelPosition() : + id === 'y' ? this.getYAxisLabelPosition() : this.getXAxisLabelPosition(); }; Axis.prototype.textForXAxisLabel = function textForXAxisLabel() { return this.getLabelText('x'); @@ -226,8 +272,9 @@ Axis.prototype.dxForY2AxisLabel = function dxForY2AxisLabel() { return this.dxForAxisLabel(this.owner.config.axis_rotated, this.getY2AxisLabelPosition()); }; Axis.prototype.dyForXAxisLabel = function dyForXAxisLabel() { - let $$ = this.owner, config = $$.config, - position = this.getXAxisLabelPosition(); + const $$ = this.owner; + const config = $$.config; + const position = this.getXAxisLabelPosition(); if (config.axis_rotated) { return position.isInner ? '1.2em' : -25 - this.getMaxTickWidth('x'); } else { @@ -235,8 +282,8 @@ Axis.prototype.dyForXAxisLabel = function dyForXAxisLabel() { } }; Axis.prototype.dyForYAxisLabel = function dyForYAxisLabel() { - let $$ = this.owner, - position = this.getYAxisLabelPosition(); + const $$ = this.owner; + const position = this.getYAxisLabelPosition(); if ($$.config.axis_rotated) { return position.isInner ? '-0.5em' : '3em'; } else { @@ -244,8 +291,8 @@ Axis.prototype.dyForYAxisLabel = function dyForYAxisLabel() { } }; Axis.prototype.dyForY2AxisLabel = function dyForY2AxisLabel() { - let $$ = this.owner, - position = this.getY2AxisLabelPosition(); + const $$ = this.owner; + const position = this.getY2AxisLabelPosition(); if ($$.config.axis_rotated) { return position.isInner ? '1.2em' : '-2.2em'; } else { @@ -265,8 +312,14 @@ Axis.prototype.textAnchorForY2AxisLabel = function textAnchorForY2AxisLabel() { return this.textAnchorForAxisLabel($$.config.axis_rotated, this.getY2AxisLabelPosition()); }; Axis.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) { - let $$ = this.owner, config = $$.config, - maxWidth = 0, targetsToShow, scale, axis, dummy, svg; + const $$ = this.owner; + const config = $$.config; + let maxWidth = 0; + let targetsToShow; + let scale; + let axis; + let dummy; + let svg; if (withoutRecompute && $$.currentMaxTickWidths[id]) { return $$.currentMaxTickWidths[id]; } @@ -274,17 +327,45 @@ Axis.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) targetsToShow = $$.filterTargetsToShow($$.data.targets); if (id === 'y') { scale = $$.y.copy().domain($$.getYDomain(targetsToShow, 'y')); - axis = this.getYAxis(scale, $$.yOrient, config.axis_y_tick_format, $$.yAxisTickValues, false, true, true); + axis = this.getYAxis( + scale, + $$.yOrient, + config.axis_y_tick_format, + $$.yAxisTickValues, + false, + true, + true + ); } else if (id === 'y2') { scale = $$.y2.copy().domain($$.getYDomain(targetsToShow, 'y2')); - axis = this.getYAxis(scale, $$.y2Orient, config.axis_y2_tick_format, $$.y2AxisTickValues, false, true, true); + axis = this.getYAxis( + scale, + $$.y2Orient, + config.axis_y2_tick_format, + $$.y2AxisTickValues, + false, + true, + true + ); } else { scale = $$.x.copy().domain($$.getXDomain(targetsToShow)); - axis = this.getXAxis(scale, $$.xOrient, $$.xAxisTickFormat, $$.xAxisTickValues, false, true, true); + axis = this.getXAxis( + scale, + $$.xOrient, + $$.xAxisTickFormat, + $$.xAxisTickValues, + false, + true, + true + ); this.updateXAxisTickValues(targetsToShow, axis); } dummy = $$.d3.select('body').append('div').classed('c3', true); - svg = dummy.append('svg').style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0), + svg = dummy.append('svg') + .style('visibility', 'hidden') + .style('position', 'fixed') + .style('top', 0) + .style('left', 0); svg.append('g').call(axis).each(function () { $$.d3.select(this).selectAll('text').each(function () { const box = this.getBoundingClientRect(); @@ -299,9 +380,9 @@ Axis.prototype.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) Axis.prototype.updateLabels = function updateLabels(withTransition) { const $$ = this.owner; - let axisXLabel = $$.main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel), - axisYLabel = $$.main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel), - axisY2Label = $$.main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label); + const axisXLabel = $$.main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel); + const axisYLabel = $$.main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel); + const axisY2Label = $$.main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label); (withTransition ? axisXLabel.transition() : axisXLabel) .attr('x', this.xForXAxisLabel.bind(this)) .attr('dx', this.dxForXAxisLabel.bind(this)) @@ -329,13 +410,20 @@ Axis.prototype.getPadding = function getPadding(padding, key, defaultValue, doma // assume padding is pixels if unit is not specified return this.convertPixelsToAxisPadding(p, domainLength); }; -Axis.prototype.convertPixelsToAxisPadding = function convertPixelsToAxisPadding(pixels, domainLength) { - let $$ = this.owner, - length = $$.config.axis_rotated ? $$.width : $$.height; +Axis.prototype.convertPixelsToAxisPadding = function convertPixelsToAxisPadding(pixels, domainLength) { // eslint-disable-line max-len + const $$ = this.owner; + const length = $$.config.axis_rotated ? $$.width : $$.height; return domainLength * (pixels / length); }; Axis.prototype.generateTickValues = function generateTickValues(values, tickCount, forTimeSeries) { - let tickValues = values, targetCount, start, end, count, interval, i, tickValue; + let tickValues = values; + let targetCount; + let start; + let end; + let count; + let interval; + let i; + let tickValue; if (tickCount) { targetCount = isFunction(tickCount) ? tickCount() : tickCount; // compute ticks according to tickCount @@ -357,11 +445,12 @@ Axis.prototype.generateTickValues = function generateTickValues(values, tickCoun tickValues.push(end); } } - if (!forTimeSeries) { tickValues = tickValues.sort((a, b) => { return a - b; }); } + if (!forTimeSeries) { tickValues = tickValues.sort((a, b) => a - b); } return tickValues; }; Axis.prototype.generateTransitions = function generateTransitions(duration) { - let $$ = this.owner, axes = $$.axes; + let $$ = this.owner; + let axes = $$.axes; return { axisX: duration ? axes.x.transition().duration(duration) : axes.x, axisY: duration ? axes.y.transition().duration(duration) : axes.y, @@ -380,3 +469,5 @@ Axis.prototype.redraw = function redraw(transitions, isHidden) { transitions.axisY2.call($$.y2Axis); transitions.axisSubX.call($$.subXAxis); }; + +export default Axis; diff --git a/src/axis/c3.axis.js b/src/axis/c3.axis.js index 9b13d49..21356af 100644 --- a/src/axis/c3.axis.js +++ b/src/axis/c3.axis.js @@ -1,36 +1,41 @@ -// Features: -// 1. category axis -// 2. ceil values of translate/x/y to int for half pixel antialiasing -// 3. multiline tick text +import d3 from 'd3'; + let tickTextCharSize; -function c3_axis(d3, params) { - let scale = d3.scale.linear(), orient = 'bottom', innerTickSize = 6, outerTickSize, tickPadding = 3, tickValues = null, tickFormat, tickArguments; +function c3_axis(params) { + let scale = d3.scale.linear(); + let orient = 'bottom'; + const innerTickSize = 6; + const tickPadding = 3; + let tickValues = null; + let tickFormat; + let tickArguments; - let tickOffset = 0, tickCulling = true, tickCentered; + let tickOffset = 0; + let tickCulling = true; + let tickCentered; params = params || {}; - outerTickSize = params.withOuterTick ? 6 : 0; + + const outerTickSize = params.withOuterTick ? 6 : 0; function axisX(selection, x) { - selection.attr('transform', (d) => { - return 'translate(' + Math.ceil(x(d) + tickOffset) + ', 0)'; - }); + selection.attr('transform', d => 'translate(' + Math.ceil(x(d) + tickOffset) + ', 0)'); } function axisY(selection, y) { - selection.attr('transform', (d) => { - return 'translate(0,' + Math.ceil(y(d)) + ')'; - }); + selection.attr('transform', d => 'translate(0,' + Math.ceil(y(d)) + ')'); } function scaleExtent(domain) { - let start = domain[0], stop = domain[domain.length - 1]; + const start = domain[0]; + const stop = domain[domain.length - 1]; return start < stop ? [start, stop] : [stop, start]; } - function generateTicks(scale) { - let i, domain, ticks = []; + function generateTicks(scale) { // eslint-disable-line no-shadow + let i; + const ticks = []; if (scale.ticks) { return scale.ticks.apply(scale, tickArguments); } - domain = scale.domain(); + const domain = scale.domain(); for (i = Math.ceil(domain[0]); i < domain[1]; i++) { ticks.push(i); } @@ -40,7 +45,8 @@ function c3_axis(d3, params) { return ticks; } function copyScale() { - let newScale = scale.copy(), domain; + const newScale = scale.copy(); + let domain; if (params.isCategory) { domain = scale.domain(); newScale.domain([domain[0], domain[1] - 1]); @@ -79,15 +85,19 @@ function c3_axis(d3, params) { g.each(function () { const g = axis.g = d3.select(this); - let scale0 = this.__chart__ || scale, scale1 = this.__chart__ = copyScale(); + let scale0 = this.__chart__ || scale, + scale1 = this.__chart__ = copyScale(); - let ticks = tickValues ? tickValues : generateTicks(scale1), + let ticks = tickValues || generateTicks(scale1), tick = g.selectAll('.tick').data(ticks, scale1), tickEnter = tick.enter().insert('g', '.domain').attr('class', 'tick').style('opacity', 1e-6), - // MEMO: No exit transition. The reason is this transition affects max tick width calculation because old tick will be included in the ticks. + // MEMO: No exit transition. The reason is this transition affects max tick width + // calculation because old tick will be included in the ticks. tickExit = tick.exit().remove(), tickUpdate = transitionise(tick).style('opacity', 1), - tickTransform, tickX, tickY; + tickTransform, + tickX, + tickY; let range = scale.rangeExtent ? scale.rangeExtent() : scaleExtent(scale.range()), path = g.selectAll('.domain').data([0]), @@ -108,21 +118,30 @@ function c3_axis(d3, params) { tickOffset = tickX = 0; } - let text, tspan, sizeFor1Char = getSizeFor1Char(g.select('.tick')), counts = []; + let text, + tspan, + sizeFor1Char = getSizeFor1Char(g.select('.tick')), + counts = []; + let tickLength = Math.max(innerTickSize, 0) + tickPadding, isVertical = orient === 'left' || orient === 'right'; // this should be called only when category axis function splitTickText(d, maxWidth) { let tickText = textFormatted(d), - subtext, spaceIndex, textWidth, splitted = []; + subtext, + spaceIndex, + textWidth, + splitted = []; if (Object.prototype.toString.call(tickText) === '[object Array]') { return tickText; } if (!maxWidth || maxWidth <= 0) { - maxWidth = isVertical ? 95 : params.isCategory ? (Math.ceil(scale1(ticks[1]) - scale1(ticks[0])) - 12) : 110; + maxWidth = isVertical ? 95 : + params.isCategory ? + (Math.ceil(scale1(ticks[1]) - scale1(ticks[0])) - 12) : 110; } function split(splitted, text) { @@ -136,7 +155,7 @@ function c3_axis(d3, params) { // if text width gets over tick width, split by space index or crrent index if (maxWidth < textWidth) { return split( - splitted.concat(text.substr(0, spaceIndex ? spaceIndex : i)), + splitted.concat(text.substr(0, spaceIndex || i)), text.slice(spaceIndex ? spaceIndex + 1 : i) ); } @@ -167,15 +186,15 @@ function c3_axis(d3, params) { text = tick.select('text'); tspan = text.selectAll('tspan') .data((d, i) => { - const splitted = params.tickMultiline ? splitTickText(d, params.tickWidth) : [].concat(textFormatted(d)); + const splitted = params.tickMultiline ? + splitTickText(d, params.tickWidth) : + [].concat(textFormatted(d)); counts[i] = splitted.length; - return splitted.map((s) => { - return { index: i, splitted: s }; - }); + return splitted.map(s => ({ index: i, splitted: s })); }); tspan.enter().append('tspan'); tspan.exit().remove(); - tspan.text((d) => { return d.splitted; }); + tspan.text(d => d.splitted); const rotate = params.tickTextRotate; @@ -255,9 +274,12 @@ function c3_axis(d3, params) { pathUpdate.attr('d', 'M' + outerTickSize + ',' + range[0] + 'H0V' + range[1] + 'H' + outerTickSize); break; } + default: + break; } if (scale1.rangeBand) { - let x = scale1, dx = x.rangeBand() / 2; + let x = scale1, + dx = x.rangeBand() / 2; scale0 = scale1 = function (d) { return x(d) + dx; }; @@ -294,19 +316,19 @@ function c3_axis(d3, params) { return tickOffset; }; axis.tickInterval = function () { - let interval, length; + let interval, + length; if (params.isCategory) { interval = tickOffset * 2; - } - else { + } else { length = axis.g.select('path.domain').node().getTotalLength() - outerTickSize * 2; interval = length / axis.g.selectAll('line').size(); } return interval === Infinity ? 0 : interval; }; - axis.ticks = function () { + axis.ticks = function (...args) { if (!arguments.length) { return tickArguments; } - tickArguments = arguments; + tickArguments = args; return axis; }; axis.tickCulling = function (culling) { @@ -319,8 +341,7 @@ function c3_axis(d3, params) { tickValues = function () { return x(scale.domain()); }; - } - else { + } else { if (!arguments.length) { return tickValues; } tickValues = x; } @@ -328,3 +349,5 @@ function c3_axis(d3, params) { }; return axis; } + +export default c3_axis; diff --git a/src/axis/index.js b/src/axis/index.js index 37b2bb1..5704553 100644 --- a/src/axis/index.js +++ b/src/axis/index.js @@ -1,7 +1,28 @@ +// import { +// CLASS, +// isValue, +// isFunction, +// isString, +// isUndefined, +// isDefined, +// ceil10, +// asHalfPixel, +// diffDomain, +// isEmpty, +// notEmpty, +// getOption, +// hasValue, +// sanitise, +// getPathBox, +// ChartInternal } from '../chartinternal'; + +import Axis from './axis'; + function API(owner) { this.owner = owner; } +/* eslint-disable */ function inherit(base, derived) { if (Object.create) { derived.prototype = Object.create(base.prototype); @@ -15,3 +36,6 @@ function inherit(base, derived) { return derived; } +/* eslint-enable */ + +export { API, inherit, Axis }; diff --git a/src/chart/api.axis.js b/src/chart/api.axis.js index e3c5e43..14b5106 100644 --- a/src/chart/api.axis.js +++ b/src/chart/api.axis.js @@ -1,5 +1,10 @@ -c3_chart_fn.axis = function () {}; -c3_chart_fn.axis.labels = function (labels) { +import { + isValue, + isDefined, +} from '../internals/index'; + +const axis = function () {}; +axis.labels = function (labels) { const $$ = this.internal; if (arguments.length) { Object.keys(labels).forEach((axisId) => { @@ -9,7 +14,7 @@ c3_chart_fn.axis.labels = function (labels) { } // TODO: return some values? }; -c3_chart_fn.axis.max = function (max) { +axis.max = function (max) { let $$ = this.internal, config = $$.config; if (arguments.length) { if (typeof max === 'object') { @@ -28,7 +33,7 @@ c3_chart_fn.axis.max = function (max) { }; } }; -c3_chart_fn.axis.min = function (min) { +axis.min = function (min) { let $$ = this.internal, config = $$.config; if (arguments.length) { if (typeof min === 'object') { @@ -47,7 +52,7 @@ c3_chart_fn.axis.min = function (min) { }; } }; -c3_chart_fn.axis.range = function (range) { +axis.range = function (range) { if (arguments.length) { if (isDefined(range.max)) { this.axis.max(range.max); } if (isDefined(range.min)) { this.axis.min(range.min); } @@ -58,3 +63,5 @@ c3_chart_fn.axis.range = function (range) { }; } }; + +export { axis }; diff --git a/src/chart/api.category.js b/src/chart/api.category.js index 64c74d9..c489420 100644 --- a/src/chart/api.category.js +++ b/src/chart/api.category.js @@ -1,4 +1,4 @@ -c3_chart_fn.category = function (i, category) { +const category = function (i, category) { let $$ = this.internal, config = $$.config; if (arguments.length > 1) { config.axis_x_categories[i] = category; @@ -6,10 +6,12 @@ c3_chart_fn.category = function (i, category) { } return config.axis_x_categories[i]; }; -c3_chart_fn.categories = function (categories) { +const categories = function (categories) { let $$ = this.internal, config = $$.config; if (!arguments.length) { return config.axis_x_categories; } config.axis_x_categories = categories; $$.redraw(); return config.axis_x_categories; }; + +export { category, categories }; diff --git a/src/chart/api.chart.js b/src/chart/api.chart.js index 7728948..d67f1f7 100644 --- a/src/chart/api.chart.js +++ b/src/chart/api.chart.js @@ -1,16 +1,16 @@ -c3_chart_fn.resize = function (size) { +const resize = function (size) { let $$ = this.internal, config = $$.config; config.size_width = size ? size.width : null; config.size_height = size ? size.height : null; this.flush(); }; -c3_chart_fn.flush = function () { +const flush = function () { const $$ = this.internal; $$.updateAndRedraw({ withLegend: true, withTransition: false, withTransitionForTransform: false }); }; -c3_chart_fn.destroy = function () { +const destroy = function () { const $$ = this.internal; window.clearInterval($$.intervalForObserveInserted); @@ -33,10 +33,13 @@ c3_chart_fn.destroy = function () { $$.selectChart.classed('c3', false).html(''); - // MEMO: this is needed because the reference of some elements will not be released, then memory leak will happen. + // MEMO: this is needed because the reference of some elements will not be released, + // then memory leak will happen. Object.keys($$).forEach((key) => { $$[key] = null; }); return null; }; + +export { resize, flush, destroy }; diff --git a/src/chart/api.color.js b/src/chart/api.color.js index ab906ad..8502f36 100644 --- a/src/chart/api.color.js +++ b/src/chart/api.color.js @@ -1,5 +1,7 @@ // TODO: fix -c3_chart_fn.color = function (id) { +const color = function (id) { const $$ = this.internal; return $$.color(id); // more patterns }; + +export { color }; diff --git a/src/chart/api.data.js b/src/chart/api.data.js index aa59505..1fbe5ff 100644 --- a/src/chart/api.data.js +++ b/src/chart/api.data.js @@ -1,13 +1,15 @@ -c3_chart_fn.data = function (targetIds) { +const data = function (targetIds) { const targets = this.internal.data.targets; return typeof targetIds === 'undefined' ? targets : targets.filter((t) => { return [].concat(targetIds).indexOf(t.id) >= 0; }); }; -c3_chart_fn.data.shown = function (targetIds) { + +data.shown = function (targetIds) { return this.internal.filterTargetsToShow(this.data(targetIds)); }; -c3_chart_fn.data.values = function (targetId) { + +data.values = function (targetId) { let targets, values = null; if (targetId) { targets = this.data(targetId); @@ -15,13 +17,18 @@ c3_chart_fn.data.values = function (targetId) { } return values; }; -c3_chart_fn.data.names = function (names) { + +data.names = function (names) { this.internal.clearLegendItemTextBoxCache(); return this.internal.updateDataAttributes('names', names); }; -c3_chart_fn.data.colors = function (colors) { + +data.colors = function (colors) { return this.internal.updateDataAttributes('colors', colors); }; -c3_chart_fn.data.axes = function (axes) { + +data.axes = function (axes) { return this.internal.updateDataAttributes('axes', axes); }; + +export { data }; diff --git a/src/chart/api.flow.js b/src/chart/api.flow.js index d0becd2..e29dea0 100644 --- a/src/chart/api.flow.js +++ b/src/chart/api.flow.js @@ -1,4 +1,9 @@ -c3_chart_fn.flow = function (args) { +import { + isValue, + isDefined, +} from '../internals/index'; + +const flow = function (args) { let $$ = this.internal, targets, data, notfoundIds = [], orgDataCount = $$.getMaxDataCount(), @@ -141,3 +146,5 @@ c3_chart_fn.flow = function (args) { withUpdateXAxis: true, }); }; + +export { flow }; diff --git a/src/chart/api.focus.js b/src/chart/api.focus.js index 3d3374e..87866c2 100644 --- a/src/chart/api.focus.js +++ b/src/chart/api.focus.js @@ -1,4 +1,8 @@ -c3_chart_fn.focus = function (targetIds) { +import { + CLASS, +} from '../internals/index'; + +const focus = function (targetIds) { let $$ = this.internal, candidates; targetIds = $$.mapToTargetIds(targetIds); @@ -18,7 +22,7 @@ c3_chart_fn.focus = function (targetIds) { }); }; -c3_chart_fn.defocus = function (targetIds) { +const defocus = function (targetIds) { let $$ = this.internal, candidates; targetIds = $$.mapToTargetIds(targetIds); @@ -36,7 +40,7 @@ c3_chart_fn.defocus = function (targetIds) { $$.defocusedTargetIds = targetIds; }; -c3_chart_fn.revert = function (targetIds) { +const revert = function (targetIds) { let $$ = this.internal, candidates; targetIds = $$.mapToTargetIds(targetIds); @@ -58,3 +62,5 @@ c3_chart_fn.revert = function (targetIds) { $$.focusedTargetIds = []; $$.defocusedTargetIds = []; }; + +export { focus, defocus, revert }; diff --git a/src/chart/api.grid.js b/src/chart/api.grid.js index 0dc4120..6d537d5 100644 --- a/src/chart/api.grid.js +++ b/src/chart/api.grid.js @@ -1,31 +1,37 @@ -c3_chart_fn.xgrids = function (grids) { +const xgrids = function (grids) { let $$ = this.internal, config = $$.config; if (!grids) { return config.grid_x_lines; } config.grid_x_lines = grids; $$.redrawWithoutRescale(); return config.grid_x_lines; }; -c3_chart_fn.xgrids.add = function (grids) { + +xgrids.add = function (grids) { const $$ = this.internal; return this.xgrids($$.config.grid_x_lines.concat(grids ? grids : [])); }; -c3_chart_fn.xgrids.remove = function (params) { // TODO: multiple + +xgrids.remove = function (params) { // TODO: multiple const $$ = this.internal; $$.removeGridLines(params, true); }; -c3_chart_fn.ygrids = function (grids) { +const ygrids = function (grids) { let $$ = this.internal, config = $$.config; if (!grids) { return config.grid_y_lines; } config.grid_y_lines = grids; $$.redrawWithoutRescale(); return config.grid_y_lines; }; -c3_chart_fn.ygrids.add = function (grids) { + +ygrids.add = function (grids) { const $$ = this.internal; return this.ygrids($$.config.grid_y_lines.concat(grids ? grids : [])); }; -c3_chart_fn.ygrids.remove = function (params) { // TODO: multiple + +ygrids.remove = function (params) { // TODO: multiple const $$ = this.internal; $$.removeGridLines(params, false); }; + +export { xgrids, ygrids }; diff --git a/src/chart/api.group.js b/src/chart/api.group.js index e17e5a1..7e65904 100644 --- a/src/chart/api.group.js +++ b/src/chart/api.group.js @@ -1,7 +1,13 @@ -c3_chart_fn.groups = function (groups) { +import { + isUndefined, +} from '../internals/index'; + +const groups = function (groups) { let $$ = this.internal, config = $$.config; if (isUndefined(groups)) { return config.data_groups; } config.data_groups = groups; $$.redraw(); return config.data_groups; }; + +export { groups }; diff --git a/src/chart/api.legend.js b/src/chart/api.legend.js index c4470f6..33cac65 100644 --- a/src/chart/api.legend.js +++ b/src/chart/api.legend.js @@ -1,11 +1,15 @@ -c3_chart_fn.legend = function () {}; -c3_chart_fn.legend.show = function (targetIds) { +const legend = function () {}; + +legend.show = function (targetIds) { const $$ = this.internal; $$.showLegend($$.mapToTargetIds(targetIds)); $$.updateAndRedraw({ withLegend: true }); }; -c3_chart_fn.legend.hide = function (targetIds) { + +legend.hide = function (targetIds) { const $$ = this.internal; $$.hideLegend($$.mapToTargetIds(targetIds)); $$.updateAndRedraw({ withLegend: true }); }; + +export { legend }; diff --git a/src/chart/api.load.js b/src/chart/api.load.js index 241ae72..42749cb 100644 --- a/src/chart/api.load.js +++ b/src/chart/api.load.js @@ -1,4 +1,6 @@ -c3_chart_fn.load = function (args) { +import { c3_chart_fn } from './index'; + +const load = function (args) { let $$ = this.internal, config = $$.config; // update xs if specified if (args.xs) { @@ -46,7 +48,7 @@ c3_chart_fn.load = function (args) { } }; -c3_chart_fn.unload = function (args) { +const unload = function (args) { const $$ = this.internal; args = args || {}; if (args instanceof Array) { @@ -59,3 +61,5 @@ c3_chart_fn.unload = function (args) { if (args.done) { args.done(); } }); }; + +export { load, unload }; diff --git a/src/chart/api.region.js b/src/chart/api.region.js index 8f3f772..2213212 100644 --- a/src/chart/api.region.js +++ b/src/chart/api.region.js @@ -1,18 +1,39 @@ -c3_chart_fn.regions = function (regions) { +import { + CLASS, + isValue, + isFunction, + isString, + isUndefined, + isDefined, + ceil10, + asHalfPixel, + diffDomain, + isEmpty, + notEmpty, + getOption, + hasValue, + sanitise, + getPathBox, + ChartInternal +} from '../internals/index'; + +const regions = function (regions) { let $$ = this.internal, config = $$.config; if (!regions) { return config.regions; } config.regions = regions; $$.redrawWithoutRescale(); return config.regions; }; -c3_chart_fn.regions.add = function (regions) { + +regions.add = function (regions) { let $$ = this.internal, config = $$.config; if (!regions) { return config.regions; } config.regions = config.regions.concat(regions); $$.redrawWithoutRescale(); return config.regions; }; -c3_chart_fn.regions.remove = function (options) { + +regions.remove = function (options) { let $$ = this.internal, config = $$.config, duration, classes, regions; @@ -38,3 +59,5 @@ c3_chart_fn.regions.remove = function (options) { return config.regions; }; + +export { regions }; diff --git a/src/chart/api.selection.js b/src/chart/api.selection.js index 6ba2e22..9b6fd5b 100644 --- a/src/chart/api.selection.js +++ b/src/chart/api.selection.js @@ -1,4 +1,23 @@ -c3_chart_fn.selected = function (targetId) { +import { + CLASS, + isValue, + isFunction, + isString, + isUndefined, + isDefined, + ceil10, + asHalfPixel, + diffDomain, + isEmpty, + notEmpty, + getOption, + hasValue, + sanitise, + getPathBox, + ChartInternal +} from '../internals/index'; + +const selected = function (targetId) { let $$ = this.internal, d3 = $$.d3; return d3.merge( $$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape) @@ -6,7 +25,8 @@ c3_chart_fn.selected = function (targetId) { .map((d) => { return d.map((d) => { const data = d.__data__; return data.data ? data.data : data; }); }) ); }; -c3_chart_fn.select = function (ids, indices, resetOther) { + +const select = function (ids, indices, resetOther) { let $$ = this.internal, d3 = $$.d3, config = $$.config; if (!config.data_selection_enabled) { return; } $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { @@ -30,7 +50,8 @@ c3_chart_fn.select = function (ids, indices, resetOther) { } }); }; -c3_chart_fn.unselect = function (ids, indices) { + +const unselect = function (ids, indices) { let $$ = this.internal, d3 = $$.d3, config = $$.config; if (!config.data_selection_enabled) { return; } $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) { @@ -52,3 +73,5 @@ c3_chart_fn.unselect = function (ids, indices) { } }); }; + +export { selected, select, unselect }; diff --git a/src/chart/api.show.js b/src/chart/api.show.js index 6f9aeab..6075092 100644 --- a/src/chart/api.show.js +++ b/src/chart/api.show.js @@ -1,4 +1,23 @@ -c3_chart_fn.show = function (targetIds, options) { +import { + CLASS, + isValue, + isFunction, + isString, + isUndefined, + isDefined, + ceil10, + asHalfPixel, + diffDomain, + isEmpty, + notEmpty, + getOption, + hasValue, + sanitise, + getPathBox, + ChartInternal +} from '../internals/index'; + +const show = function (targetIds, options) { let $$ = this.internal, targets; targetIds = $$.mapToTargetIds(targetIds); @@ -20,7 +39,7 @@ c3_chart_fn.show = function (targetIds, options) { $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true }); }; -c3_chart_fn.hide = function (targetIds, options) { +const hide = function (targetIds, options) { let $$ = this.internal, targets; targetIds = $$.mapToTargetIds(targetIds); @@ -42,9 +61,11 @@ c3_chart_fn.hide = function (targetIds, options) { $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true }); }; -c3_chart_fn.toggle = function (targetIds, options) { +const toggle = function (targetIds, options) { let that = this, $$ = this.internal; $$.mapToTargetIds(targetIds).forEach((targetId) => { $$.isTargetToShow(targetId) ? that.hide(targetId, options) : that.show(targetId, options); }); }; + +export { show, hide, toggle }; diff --git a/src/chart/api.tooltip.js b/src/chart/api.tooltip.js index 23c49f9..a8581e7 100644 --- a/src/chart/api.tooltip.js +++ b/src/chart/api.tooltip.js @@ -1,5 +1,25 @@ -c3_chart_fn.tooltip = function () {}; -c3_chart_fn.tooltip.show = function (args) { +import { + CLASS, + isValue, + isFunction, + isString, + isUndefined, + isDefined, + ceil10, + asHalfPixel, + diffDomain, + isEmpty, + notEmpty, + getOption, + hasValue, + sanitise, + getPathBox, + ChartInternal +} from '../internals/index'; + +const tooltip = function () {}; + +tooltip.show = function (args) { let $$ = this.internal, index, mouse; // determine mouse position on the chart @@ -17,11 +37,9 @@ c3_chart_fn.tooltip.show = function (args) { // TODO: when tooltip_grouped = false index = isValue(args.data.index) ? args.data.index : $$.getIndexByX(args.data.x); } - } - else if (typeof args.x !== 'undefined') { + } else if (typeof args.x !== 'undefined') { index = $$.getIndexByX(args.x); - } - else if (typeof args.index !== 'undefined') { + } else if (typeof args.index !== 'undefined') { index = args.index; } @@ -31,9 +49,12 @@ c3_chart_fn.tooltip.show = function (args) { $$.config.tooltip_onshow.call($$, args.data); }; -c3_chart_fn.tooltip.hide = function () { + +tooltip.hide = function () { // TODO: get target data by checking the state of focus this.internal.dispatchEvent('mouseout', 0); this.internal.config.tooltip_onhide.call(this); }; + +export { tooltip }; diff --git a/src/chart/api.transform.js b/src/chart/api.transform.js index e9bb128..cd9a309 100644 --- a/src/chart/api.transform.js +++ b/src/chart/api.transform.js @@ -1,5 +1,26 @@ -c3_chart_fn.transform = function (type, targetIds) { +import { + CLASS, + isValue, + isFunction, + isString, + isUndefined, + isDefined, + ceil10, + asHalfPixel, + diffDomain, + isEmpty, + notEmpty, + getOption, + hasValue, + sanitise, + getPathBox, + ChartInternal +} from '../internals/index'; + +const transform = function (type, targetIds) { let $$ = this.internal, options = ['pie', 'donut'].indexOf(type) >= 0 ? { withTransform: true } : null; $$.transformTo(targetIds, type, options); }; + +export { transform }; diff --git a/src/chart/api.x.js b/src/chart/api.x.js index 75b4412..7fb2d76 100644 --- a/src/chart/api.x.js +++ b/src/chart/api.x.js @@ -1,4 +1,23 @@ -c3_chart_fn.x = function (x) { +import { + CLASS, + isValue, + isFunction, + isString, + isUndefined, + isDefined, + ceil10, + asHalfPixel, + diffDomain, + isEmpty, + notEmpty, + getOption, + hasValue, + sanitise, + getPathBox, + ChartInternal +} from '../internals/index'; + +const x = function (x) { const $$ = this.internal; if (arguments.length) { $$.updateTargetX($$.data.targets, x); @@ -6,7 +25,8 @@ c3_chart_fn.x = function (x) { } return $$.data.xs; }; -c3_chart_fn.xs = function (xs) { + +const xs = function (xs) { const $$ = this.internal; if (arguments.length) { $$.updateTargetXs($$.data.targets, xs); @@ -14,3 +34,5 @@ c3_chart_fn.xs = function (xs) { } return $$.data.xs; }; + +export { x, xs }; diff --git a/src/chart/api.zoom.js b/src/chart/api.zoom.js index 38aec54..538f99a 100644 --- a/src/chart/api.zoom.js +++ b/src/chart/api.zoom.js @@ -1,4 +1,23 @@ -c3_chart_fn.zoom = function (domain) { +import { + CLASS, + isValue, + isFunction, + isString, + isUndefined, + isDefined, + ceil10, + asHalfPixel, + diffDomain, + isEmpty, + notEmpty, + getOption, + hasValue, + sanitise, + getPathBox, + ChartInternal +} from '../internals/index'; + +const zoom = function (domain) { const $$ = this.internal; if (domain) { if ($$.isTimeSeries()) { @@ -10,18 +29,20 @@ c3_chart_fn.zoom = function (domain) { } return $$.brush.extent(); }; -c3_chart_fn.zoom.enable = function (enabled) { - const $$ = this.internal; - $$.config.zoom_enabled = enabled; - $$.updateAndRedraw(); -}; -c3_chart_fn.unzoom = function () { + +const unzoom = function () { const $$ = this.internal; $$.brush.clear().update(); $$.redraw({ withUpdateXDomain: true }); }; -c3_chart_fn.zoom.max = function (max) { +zoom.enable = function (enabled) { + const $$ = this.internal; + $$.config.zoom_enabled = enabled; + $$.updateAndRedraw(); +}; + +zoom.max = function (max) { let $$ = this.internal, config = $$.config, d3 = $$.d3; if (max === 0 || max) { config.zoom_x_max = d3.max([$$.orgXDomain[1], max]); @@ -31,7 +52,7 @@ c3_chart_fn.zoom.max = function (max) { } }; -c3_chart_fn.zoom.min = function (min) { +zoom.min = function (min) { let $$ = this.internal, config = $$.config, d3 = $$.d3; if (min === 0 || min) { config.zoom_x_min = d3.min([$$.orgXDomain[0], min]); @@ -41,7 +62,7 @@ c3_chart_fn.zoom.min = function (min) { } }; -c3_chart_fn.zoom.range = function (range) { +zoom.range = function (range) { if (arguments.length) { if (isDefined(range.max)) { this.domain.max(range.max); } if (isDefined(range.min)) { this.domain.min(range.min); } @@ -52,3 +73,5 @@ c3_chart_fn.zoom.range = function (range) { }; } }; + +export { zoom, unzoom }; diff --git a/src/chart/index.js b/src/chart/index.js index 960c95f..12e93f3 100644 --- a/src/chart/index.js +++ b/src/chart/index.js @@ -1,5 +1,26 @@ -let c3_chart_fn; +import { ChartInternal } from '../internals/index'; + +import { axis } from './api.axis'; +import { category, categories } from './api.category'; +import { resize, flush, destroy } from './api.chart'; +import { color } from './api.color'; +import { data } from './api.data'; +import { flow } from './api.flow'; +import { focus, defocus, revert } from './api.focus'; +import { xgrids, ygrids } from './api.grid'; +import { groups } from './api.group'; +import { legend } from './api.legend'; +import { load, unload } from './api.load'; +import { regions } from './api.region'; +import { selected, select, unselect } from './api.selection'; +import { show, hide, toggle } from './api.show'; +import { tooltip } from './api.tooltip'; +import { transform } from './api.transform'; +import { x, xs } from './api.x'; +import { zoom, unzoom } from './api.zoom'; + +let c3_chart_fn; function Chart(config) { const $$ = this.internal = new ChartInternal(this); @@ -21,3 +42,37 @@ function Chart(config) { } c3_chart_fn = Chart.prototype; + +c3_chart_fn.axis = axis; +c3_chart_fn.category = category; +c3_chart_fn.categories = categories; +c3_chart_fn.resize = resize; +c3_chart_fn.flush = flush; +c3_chart_fn.destroy = destroy; +c3_chart_fn.color = color; +c3_chart_fn.data = data; +c3_chart_fn.flow = flow; +c3_chart_fn.focus = focus; +c3_chart_fn.defocus = defocus; +c3_chart_fn.revert = revert; +c3_chart_fn.xgrids = xgrids; +c3_chart_fn.ygrids = ygrids; +c3_chart_fn.groups = groups; +c3_chart_fn.legend = legend; +c3_chart_fn.load = load; +c3_chart_fn.unload = unload; +c3_chart_fn.regions = regions; +c3_chart_fn.selected = selected; +c3_chart_fn.select = select; +c3_chart_fn.unselect = unselect; +c3_chart_fn.show = show; +c3_chart_fn.hide = hide; +c3_chart_fn.toggle = toggle; +c3_chart_fn.tooltip = tooltip; +c3_chart_fn.transform = transform; +c3_chart_fn.x = x; +c3_chart_fn.xs = xs; +c3_chart_fn.zoom = zoom; +c3_chart_fn.unzoom = unzoom; + +export { Chart, c3_chart_fn }; diff --git a/src/chartinternal/arc.js b/src/chartinternal/arc.js deleted file mode 100644 index aa93d3e..0000000 --- a/src/chartinternal/arc.js +++ /dev/null @@ -1,435 +0,0 @@ -c3_chart_internal_fn.initPie = function () { - let $$ = this, d3 = $$.d3, config = $$.config; - $$.pie = d3.layout.pie().value((d) => { - return d.values.reduce((a, b) => { return a + b.value; }, 0); - }); - if (!config.data_order) { - $$.pie.sort(null); - } -}; - -c3_chart_internal_fn.updateRadius = function () { - let $$ = this, config = $$.config, - w = config.gauge_width || config.donut_width; - $$.radiusExpanded = Math.min($$.arcWidth, $$.arcHeight) / 2; - $$.radius = $$.radiusExpanded * 0.95; - $$.innerRadiusRatio = w ? ($$.radius - w) / $$.radius : 0.6; - $$.innerRadius = $$.hasType('donut') || $$.hasType('gauge') ? $$.radius * $$.innerRadiusRatio : 0; -}; - -c3_chart_internal_fn.updateArc = function () { - const $$ = this; - $$.svgArc = $$.getSvgArc(); - $$.svgArcExpanded = $$.getSvgArcExpanded(); - $$.svgArcExpandedSub = $$.getSvgArcExpanded(0.98); -}; - -c3_chart_internal_fn.updateAngle = function (d) { - let $$ = this, config = $$.config, - found = false, index = 0, - gMin, gMax, gTic, gValue; - - if (!config) { - return null; - } - - $$.pie($$.filterTargetsToShow($$.data.targets)).forEach((t) => { - if (!found && t.data.id === d.data.id) { - found = true; - d = t; - d.index = index; - } - index++; - }); - if (isNaN(d.startAngle)) { - d.startAngle = 0; - } - if (isNaN(d.endAngle)) { - d.endAngle = d.startAngle; - } - if ($$.isGaugeType(d.data)) { - gMin = config.gauge_min; - gMax = config.gauge_max; - gTic = (Math.PI * (config.gauge_fullCircle ? 2 : 1)) / (gMax - gMin); - gValue = d.value < gMin ? 0 : d.value < gMax ? d.value - gMin : (gMax - gMin); - d.startAngle = config.gauge_startingAngle; - d.endAngle = d.startAngle + gTic * gValue; - } - return found ? d : null; -}; - -c3_chart_internal_fn.getSvgArc = function () { - let $$ = this, - arc = $$.d3.svg.arc().outerRadius($$.radius).innerRadius($$.innerRadius), - newArc = function (d, withoutUpdate) { - let updated; - if (withoutUpdate) { return arc(d); } // for interpolate - updated = $$.updateAngle(d); - return updated ? arc(updated) : 'M 0 0'; - }; - // TODO: extends all function - newArc.centroid = arc.centroid; - return newArc; -}; - -c3_chart_internal_fn.getSvgArcExpanded = function (rate) { - let $$ = this, - arc = $$.d3.svg.arc().outerRadius($$.radiusExpanded * (rate ? rate : 1)).innerRadius($$.innerRadius); - return function (d) { - const updated = $$.updateAngle(d); - return updated ? arc(updated) : 'M 0 0'; - }; -}; - -c3_chart_internal_fn.getArc = function (d, withoutUpdate, force) { - return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : 'M 0 0'; -}; - - -c3_chart_internal_fn.transformForArcLabel = function (d) { - let $$ = this, config = $$.config, - updated = $$.updateAngle(d), c, x, y, h, ratio, translate = ''; - if (updated && !$$.hasType('gauge')) { - c = this.svgArc.centroid(updated); - x = isNaN(c[0]) ? 0 : c[0]; - y = isNaN(c[1]) ? 0 : c[1]; - h = Math.sqrt(x * x + y * y); - if ($$.hasType('donut') && config.donut_label_ratio) { - ratio = isFunction(config.donut_label_ratio) ? config.donut_label_ratio(d, $$.radius, h) : config.donut_label_ratio; - } else if ($$.hasType('pie') && config.pie_label_ratio) { - ratio = isFunction(config.pie_label_ratio) ? config.pie_label_ratio(d, $$.radius, h) : config.pie_label_ratio; - } else { - ratio = $$.radius && h ? (36 / $$.radius > 0.375 ? 1.175 - 36 / $$.radius : 0.8) * $$.radius / h : 0; - } - translate = 'translate(' + (x * ratio) + ',' + (y * ratio) + ')'; - } - return translate; -}; - -c3_chart_internal_fn.getArcRatio = function (d) { - let $$ = this, - config = $$.config, - whole = Math.PI * ($$.hasType('gauge') && !config.gauge_fullCircle ? 1 : 2); - return d ? (d.endAngle - d.startAngle) / whole : null; -}; - -c3_chart_internal_fn.convertToArcData = function (d) { - return this.addName({ - id: d.data.id, - value: d.value, - ratio: this.getArcRatio(d), - index: d.index, - }); -}; - -c3_chart_internal_fn.textForArcLabel = function (d) { - let $$ = this, - updated, value, ratio, id, format; - if (!$$.shouldShowArcLabel()) { return ''; } - updated = $$.updateAngle(d); - value = updated ? updated.value : null; - ratio = $$.getArcRatio(updated); - id = d.data.id; - if (!$$.hasType('gauge') && !$$.meetsArcLabelThreshold(ratio)) { return ''; } - format = $$.getArcLabelFormat(); - return format ? format(value, ratio, id) : $$.defaultArcValueFormat(value, ratio); -}; - -c3_chart_internal_fn.expandArc = function (targetIds) { - let $$ = this, interval; - - // MEMO: avoid to cancel transition - if ($$.transiting) { - interval = window.setInterval(() => { - if (!$$.transiting) { - window.clearInterval(interval); - if ($$.legend.selectAll('.c3-legend-item-focused').size() > 0) { - $$.expandArc(targetIds); - } - } - }, 10); - return; - } - - targetIds = $$.mapToTargetIds(targetIds); - - $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS.chartArc)).each(function (d) { - if (!$$.shouldExpand(d.data.id)) { return; } - $$.d3.select(this).selectAll('path') - .transition().duration($$.expandDuration(d.data.id)) - .attr('d', $$.svgArcExpanded) - .transition().duration($$.expandDuration(d.data.id) * 2) - .attr('d', $$.svgArcExpandedSub) - .each((d) => { - if ($$.isDonutType(d.data)) { - // callback here - } - }); - }); -}; - -c3_chart_internal_fn.unexpandArc = function (targetIds) { - const $$ = this; - - if ($$.transiting) { return; } - - targetIds = $$.mapToTargetIds(targetIds); - - $$.svg.selectAll($$.selectorTargets(targetIds, '.' + CLASS.chartArc)).selectAll('path') - .transition().duration((d) => { - return $$.expandDuration(d.data.id); - }) - .attr('d', $$.svgArc); - $$.svg.selectAll('.' + CLASS.arc) - .style('opacity', 1); -}; - -c3_chart_internal_fn.expandDuration = function (id) { - let $$ = this, config = $$.config; - - if ($$.isDonutType(id)) { - return config.donut_expand_duration; - } else if ($$.isGaugeType(id)) { - return config.gauge_expand_duration; - } else if ($$.isPieType(id)) { - return config.pie_expand_duration; - } else { - return 50; - } -}; - -c3_chart_internal_fn.shouldExpand = function (id) { - let $$ = this, config = $$.config; - return ($$.isDonutType(id) && config.donut_expand) || - ($$.isGaugeType(id) && config.gauge_expand) || - ($$.isPieType(id) && config.pie_expand); -}; - -c3_chart_internal_fn.shouldShowArcLabel = function () { - let $$ = this, config = $$.config, shouldShow = true; - if ($$.hasType('donut')) { - shouldShow = config.donut_label_show; - } else if ($$.hasType('pie')) { - shouldShow = config.pie_label_show; - } - // when gauge, always true - return shouldShow; -}; - -c3_chart_internal_fn.meetsArcLabelThreshold = function (ratio) { - let $$ = this, config = $$.config, - threshold = $$.hasType('donut') ? config.donut_label_threshold : config.pie_label_threshold; - return ratio >= threshold; -}; - -c3_chart_internal_fn.getArcLabelFormat = function () { - let $$ = this, config = $$.config, - format = config.pie_label_format; - if ($$.hasType('gauge')) { - format = config.gauge_label_format; - } else if ($$.hasType('donut')) { - format = config.donut_label_format; - } - return format; -}; - -c3_chart_internal_fn.getArcTitle = function () { - const $$ = this; - return $$.hasType('donut') ? $$.config.donut_title : ''; -}; - -c3_chart_internal_fn.updateTargetsForArc = function (targets) { - let $$ = this, main = $$.main, - mainPieUpdate, mainPieEnter, - classChartArc = $$.classChartArc.bind($$), - classArcs = $$.classArcs.bind($$), - classFocus = $$.classFocus.bind($$); - mainPieUpdate = main.select('.' + CLASS.chartArcs).selectAll('.' + CLASS.chartArc) - .data($$.pie(targets)) - .attr('class', (d) => { return classChartArc(d) + classFocus(d.data); }); - mainPieEnter = mainPieUpdate.enter().append('g') - .attr('class', classChartArc); - mainPieEnter.append('g') - .attr('class', classArcs); - mainPieEnter.append('text') - .attr('dy', $$.hasType('gauge') ? '-.1em' : '.35em') - .style('opacity', 0) - .style('text-anchor', 'middle') - .style('pointer-events', 'none'); - // MEMO: can not keep same color..., but not bad to update color in redraw - // mainPieUpdate.exit().remove(); -}; - -c3_chart_internal_fn.initArc = function () { - const $$ = this; - $$.arcs = $$.main.select('.' + CLASS.chart).append('g') - .attr('class', CLASS.chartArcs) - .attr('transform', $$.getTranslate('arc')); - $$.arcs.append('text') - .attr('class', CLASS.chartArcsTitle) - .style('text-anchor', 'middle') - .text($$.getArcTitle()); -}; - -c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransform) { - let $$ = this, d3 = $$.d3, config = $$.config, main = $$.main, - mainArc; - mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc) - .data($$.arcData.bind($$)); - mainArc.enter().append('path') - .attr('class', $$.classArc.bind($$)) - .style('fill', (d) => { return $$.color(d.data); }) - .style('cursor', (d) => { return config.interaction_enabled && config.data_selection_isselectable(d) ? 'pointer' : null; }) - .style('opacity', 0) - .each(function (d) { - if ($$.isGaugeType(d.data)) { - d.startAngle = d.endAngle = config.gauge_startingAngle; - } - this._current = d; - }); - mainArc - .attr('transform', (d) => { return !$$.isGaugeType(d.data) && withTransform ? 'scale(0)' : ''; }) - .style('opacity', function (d) { return d === this._current ? 0 : 1; }) - .on('mouseover', config.interaction_enabled ? function (d) { - let updated, arcData; - if ($$.transiting) { // skip while transiting - return; - } - updated = $$.updateAngle(d); - if (updated) { - arcData = $$.convertToArcData(updated); - // transitions - $$.expandArc(updated.data.id); - $$.api.focus(updated.data.id); - $$.toggleFocusLegend(updated.data.id, true); - $$.config.data_onmouseover(arcData, this); - } - } : null) - .on('mousemove', config.interaction_enabled ? function (d) { - let updated = $$.updateAngle(d), arcData, selectedData; - if (updated) { - arcData = $$.convertToArcData(updated), - selectedData = [arcData]; - $$.showTooltip(selectedData, this); - } - } : null) - .on('mouseout', config.interaction_enabled ? function (d) { - let updated, arcData; - if ($$.transiting) { // skip while transiting - return; - } - updated = $$.updateAngle(d); - if (updated) { - arcData = $$.convertToArcData(updated); - // transitions - $$.unexpandArc(updated.data.id); - $$.api.revert(); - $$.revertLegend(); - $$.hideTooltip(); - $$.config.data_onmouseout(arcData, this); - } - } : null) - .on('click', config.interaction_enabled ? function (d, i) { - let updated = $$.updateAngle(d), arcData; - if (updated) { - arcData = $$.convertToArcData(updated); - if ($$.toggleShape) { - $$.toggleShape(this, arcData, i); - } - $$.config.data_onclick.call($$.api, arcData, this); - } - } : null) - .each(() => { $$.transiting = true; }) - .transition().duration(duration) - .attrTween('d', function (d) { - let updated = $$.updateAngle(d), interpolate; - if (!updated) { - return function () { return 'M 0 0'; }; - } - // if (this._current === d) { - // this._current = { - // startAngle: Math.PI*2, - // endAngle: Math.PI*2, - // }; - // } - if (isNaN(this._current.startAngle)) { - this._current.startAngle = 0; - } - if (isNaN(this._current.endAngle)) { - this._current.endAngle = this._current.startAngle; - } - interpolate = d3.interpolate(this._current, updated); - this._current = interpolate(0); - return function (t) { - const interpolated = interpolate(t); - interpolated.data = d.data; // data.id will be updated by interporator - return $$.getArc(interpolated, true); - }; - }) - .attr('transform', withTransform ? 'scale(1)' : '') - .style('fill', (d) => { - return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data.id); - }) // Where gauge reading color would receive customization. - .style('opacity', 1) - .call($$.endall, () => { - $$.transiting = false; - }); - mainArc.exit().transition().duration(durationForExit) - .style('opacity', 0) - .remove(); - main.selectAll('.' + CLASS.chartArc).select('text') - .style('opacity', 0) - .attr('class', (d) => { return $$.isGaugeType(d.data) ? CLASS.gaugeValue : ''; }) - .text($$.textForArcLabel.bind($$)) - .attr('transform', $$.transformForArcLabel.bind($$)) - .style('font-size', (d) => { return $$.isGaugeType(d.data) ? Math.round($$.radius / 5) + 'px' : ''; }) - .transition().duration(duration) - .style('opacity', (d) => { return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? 1 : 0; }); - main.select('.' + CLASS.chartArcsTitle) - .style('opacity', $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0); - - if ($$.hasType('gauge')) { - $$.arcs.select('.' + CLASS.chartArcsBackground) - .attr('d', () => { - const d = { - data: [{ value: config.gauge_max }], - startAngle: config.gauge_startingAngle, - endAngle: -1 * config.gauge_startingAngle, - }; - return $$.getArc(d, true, true); - }); - $$.arcs.select('.' + CLASS.chartArcsGaugeUnit) - .attr('dy', '.75em') - .text(config.gauge_label_show ? config.gauge_units : ''); - $$.arcs.select('.' + CLASS.chartArcsGaugeMin) - .attr('dx', -1 * ($$.innerRadius + (($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2))) + 'px') - .attr('dy', '1.2em') - .text(config.gauge_label_show ? config.gauge_min : ''); - $$.arcs.select('.' + CLASS.chartArcsGaugeMax) - .attr('dx', $$.innerRadius + (($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2)) + 'px') - .attr('dy', '1.2em') - .text(config.gauge_label_show ? config.gauge_max : ''); - } -}; -c3_chart_internal_fn.initGauge = function () { - const arcs = this.arcs; - if (this.hasType('gauge')) { - arcs.append('path') - .attr('class', CLASS.chartArcsBackground); - arcs.append('text') - .attr('class', CLASS.chartArcsGaugeUnit) - .style('text-anchor', 'middle') - .style('pointer-events', 'none'); - arcs.append('text') - .attr('class', CLASS.chartArcsGaugeMin) - .style('text-anchor', 'middle') - .style('pointer-events', 'none'); - arcs.append('text') - .attr('class', CLASS.chartArcsGaugeMax) - .style('text-anchor', 'middle') - .style('pointer-events', 'none'); - } -}; -c3_chart_internal_fn.getGaugeLabelHeight = function () { - return this.config.gauge_label_show ? 20 : 0; -}; diff --git a/src/chartinternal/cache.js b/src/chartinternal/cache.js deleted file mode 100644 index 7b6f5ab..0000000 --- a/src/chartinternal/cache.js +++ /dev/null @@ -1,16 +0,0 @@ -c3_chart_internal_fn.hasCaches = function (ids) { - for (let i = 0; i < ids.length; i++) { - if (!(ids[i] in this.cache)) { return false; } - } - return true; -}; -c3_chart_internal_fn.addCache = function (id, target) { - this.cache[id] = this.cloneTarget(target); -}; -c3_chart_internal_fn.getCaches = function (ids) { - let targets = [], i; - for (i = 0; i < ids.length; i++) { - if (ids[i] in this.cache) { targets.push(this.cloneTarget(this.cache[ids[i]])); } - } - return targets; -}; diff --git a/src/chartinternal/category.js b/src/chartinternal/category.js deleted file mode 100644 index 0363c9a..0000000 --- a/src/chartinternal/category.js +++ /dev/null @@ -1,4 +0,0 @@ -c3_chart_internal_fn.categoryName = function (i) { - const config = this.config; - return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i; -}; diff --git a/src/chartinternal/class.js b/src/chartinternal/class.js deleted file mode 100644 index 1008923..0000000 --- a/src/chartinternal/class.js +++ /dev/null @@ -1,175 +0,0 @@ -const CLASS = c3_chart_internal_fn.CLASS = { - target: 'c3-target', - chart: 'c3-chart', - chartLine: 'c3-chart-line', - chartLines: 'c3-chart-lines', - chartBar: 'c3-chart-bar', - chartBars: 'c3-chart-bars', - chartText: 'c3-chart-text', - chartTexts: 'c3-chart-texts', - chartArc: 'c3-chart-arc', - chartArcs: 'c3-chart-arcs', - chartArcsTitle: 'c3-chart-arcs-title', - chartArcsBackground: 'c3-chart-arcs-background', - chartArcsGaugeUnit: 'c3-chart-arcs-gauge-unit', - chartArcsGaugeMax: 'c3-chart-arcs-gauge-max', - chartArcsGaugeMin: 'c3-chart-arcs-gauge-min', - selectedCircle: 'c3-selected-circle', - selectedCircles: 'c3-selected-circles', - eventRect: 'c3-event-rect', - eventRects: 'c3-event-rects', - eventRectsSingle: 'c3-event-rects-single', - eventRectsMultiple: 'c3-event-rects-multiple', - zoomRect: 'c3-zoom-rect', - brush: 'c3-brush', - focused: 'c3-focused', - defocused: 'c3-defocused', - region: 'c3-region', - regions: 'c3-regions', - title: 'c3-title', - tooltipContainer: 'c3-tooltip-container', - tooltip: 'c3-tooltip', - tooltipName: 'c3-tooltip-name', - shape: 'c3-shape', - shapes: 'c3-shapes', - line: 'c3-line', - lines: 'c3-lines', - bar: 'c3-bar', - bars: 'c3-bars', - circle: 'c3-circle', - circles: 'c3-circles', - arc: 'c3-arc', - arcs: 'c3-arcs', - area: 'c3-area', - areas: 'c3-areas', - empty: 'c3-empty', - text: 'c3-text', - texts: 'c3-texts', - gaugeValue: 'c3-gauge-value', - grid: 'c3-grid', - gridLines: 'c3-grid-lines', - xgrid: 'c3-xgrid', - xgrids: 'c3-xgrids', - xgridLine: 'c3-xgrid-line', - xgridLines: 'c3-xgrid-lines', - xgridFocus: 'c3-xgrid-focus', - ygrid: 'c3-ygrid', - ygrids: 'c3-ygrids', - ygridLine: 'c3-ygrid-line', - ygridLines: 'c3-ygrid-lines', - axis: 'c3-axis', - axisX: 'c3-axis-x', - axisXLabel: 'c3-axis-x-label', - axisY: 'c3-axis-y', - axisYLabel: 'c3-axis-y-label', - axisY2: 'c3-axis-y2', - axisY2Label: 'c3-axis-y2-label', - legendBackground: 'c3-legend-background', - legendItem: 'c3-legend-item', - legendItemEvent: 'c3-legend-item-event', - legendItemTile: 'c3-legend-item-tile', - legendItemHidden: 'c3-legend-item-hidden', - legendItemFocused: 'c3-legend-item-focused', - dragarea: 'c3-dragarea', - EXPANDED: '_expanded_', - SELECTED: '_selected_', - INCLUDED: '_included_', -}; -c3_chart_internal_fn.generateClass = function (prefix, targetId) { - return ' ' + prefix + ' ' + prefix + this.getTargetSelectorSuffix(targetId); -}; -c3_chart_internal_fn.classText = function (d) { - return this.generateClass(CLASS.text, d.index); -}; -c3_chart_internal_fn.classTexts = function (d) { - return this.generateClass(CLASS.texts, d.id); -}; -c3_chart_internal_fn.classShape = function (d) { - return this.generateClass(CLASS.shape, d.index); -}; -c3_chart_internal_fn.classShapes = function (d) { - return this.generateClass(CLASS.shapes, d.id); -}; -c3_chart_internal_fn.classLine = function (d) { - return this.classShape(d) + this.generateClass(CLASS.line, d.id); -}; -c3_chart_internal_fn.classLines = function (d) { - return this.classShapes(d) + this.generateClass(CLASS.lines, d.id); -}; -c3_chart_internal_fn.classCircle = function (d) { - return this.classShape(d) + this.generateClass(CLASS.circle, d.index); -}; -c3_chart_internal_fn.classCircles = function (d) { - return this.classShapes(d) + this.generateClass(CLASS.circles, d.id); -}; -c3_chart_internal_fn.classBar = function (d) { - return this.classShape(d) + this.generateClass(CLASS.bar, d.index); -}; -c3_chart_internal_fn.classBars = function (d) { - return this.classShapes(d) + this.generateClass(CLASS.bars, d.id); -}; -c3_chart_internal_fn.classArc = function (d) { - return this.classShape(d.data) + this.generateClass(CLASS.arc, d.data.id); -}; -c3_chart_internal_fn.classArcs = function (d) { - return this.classShapes(d.data) + this.generateClass(CLASS.arcs, d.data.id); -}; -c3_chart_internal_fn.classArea = function (d) { - return this.classShape(d) + this.generateClass(CLASS.area, d.id); -}; -c3_chart_internal_fn.classAreas = function (d) { - return this.classShapes(d) + this.generateClass(CLASS.areas, d.id); -}; -c3_chart_internal_fn.classRegion = function (d, i) { - return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : ''); -}; -c3_chart_internal_fn.classEvent = function (d) { - return this.generateClass(CLASS.eventRect, d.index); -}; -c3_chart_internal_fn.classTarget = function (id) { - const $$ = this; - let additionalClassSuffix = $$.config.data_classes[id], additionalClass = ''; - if (additionalClassSuffix) { - additionalClass = ' ' + CLASS.target + '-' + additionalClassSuffix; - } - return $$.generateClass(CLASS.target, id) + additionalClass; -}; -c3_chart_internal_fn.classFocus = function (d) { - return this.classFocused(d) + this.classDefocused(d); -}; -c3_chart_internal_fn.classFocused = function (d) { - return ' ' + (this.focusedTargetIds.indexOf(d.id) >= 0 ? CLASS.focused : ''); -}; -c3_chart_internal_fn.classDefocused = function (d) { - return ' ' + (this.defocusedTargetIds.indexOf(d.id) >= 0 ? CLASS.defocused : ''); -}; -c3_chart_internal_fn.classChartText = function (d) { - return CLASS.chartText + this.classTarget(d.id); -}; -c3_chart_internal_fn.classChartLine = function (d) { - return CLASS.chartLine + this.classTarget(d.id); -}; -c3_chart_internal_fn.classChartBar = function (d) { - return CLASS.chartBar + this.classTarget(d.id); -}; -c3_chart_internal_fn.classChartArc = function (d) { - return CLASS.chartArc + this.classTarget(d.data.id); -}; -c3_chart_internal_fn.getTargetSelectorSuffix = function (targetId) { - return targetId || targetId === 0 ? ('-' + targetId).replace(/[\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\]/g, '-') : ''; -}; -c3_chart_internal_fn.selectorTarget = function (id, prefix) { - return (prefix || '') + '.' + CLASS.target + this.getTargetSelectorSuffix(id); -}; -c3_chart_internal_fn.selectorTargets = function (ids, prefix) { - const $$ = this; - ids = ids || []; - return ids.length ? ids.map((id) => { return $$.selectorTarget(id, prefix); }) : null; -}; -c3_chart_internal_fn.selectorLegend = function (id) { - return '.' + CLASS.legendItem + this.getTargetSelectorSuffix(id); -}; -c3_chart_internal_fn.selectorLegends = function (ids) { - const $$ = this; - return ids && ids.length ? ids.map((id) => { return $$.selectorLegend(id); }) : null; -}; diff --git a/src/chartinternal/clip.js b/src/chartinternal/clip.js deleted file mode 100644 index 14d76c2..0000000 --- a/src/chartinternal/clip.js +++ /dev/null @@ -1,58 +0,0 @@ -c3_chart_internal_fn.getClipPath = function (id) { - const isIE9 = window.navigator.appVersion.toLowerCase().indexOf('msie 9.') >= 0; - return 'url(' + (isIE9 ? '' : document.URL.split('#')[0]) + '#' + id + ')'; -}; -c3_chart_internal_fn.appendClip = function (parent, id) { - return parent.append('clipPath').attr('id', id).append('rect'); -}; -c3_chart_internal_fn.getAxisClipX = function (forHorizontal) { - // axis line width + padding for left - const left = Math.max(30, this.margin.left); - return forHorizontal ? -(1 + left) : -(left - 1); -}; -c3_chart_internal_fn.getAxisClipY = function (forHorizontal) { - return forHorizontal ? -20 : -this.margin.top; -}; -c3_chart_internal_fn.getXAxisClipX = function () { - const $$ = this; - return $$.getAxisClipX(!$$.config.axis_rotated); -}; -c3_chart_internal_fn.getXAxisClipY = function () { - const $$ = this; - return $$.getAxisClipY(!$$.config.axis_rotated); -}; -c3_chart_internal_fn.getYAxisClipX = function () { - const $$ = this; - return $$.config.axis_y_inner ? -1 : $$.getAxisClipX($$.config.axis_rotated); -}; -c3_chart_internal_fn.getYAxisClipY = function () { - const $$ = this; - return $$.getAxisClipY($$.config.axis_rotated); -}; -c3_chart_internal_fn.getAxisClipWidth = function (forHorizontal) { - let $$ = this, - left = Math.max(30, $$.margin.left), - right = Math.max(30, $$.margin.right); - // width + axis line width + padding for left/right - return forHorizontal ? $$.width + 2 + left + right : $$.margin.left + 20; -}; -c3_chart_internal_fn.getAxisClipHeight = function (forHorizontal) { - // less than 20 is not enough to show the axis label 'outer' without legend - return (forHorizontal ? this.margin.bottom : (this.margin.top + this.height)) + 20; -}; -c3_chart_internal_fn.getXAxisClipWidth = function () { - const $$ = this; - return $$.getAxisClipWidth(!$$.config.axis_rotated); -}; -c3_chart_internal_fn.getXAxisClipHeight = function () { - const $$ = this; - return $$.getAxisClipHeight(!$$.config.axis_rotated); -}; -c3_chart_internal_fn.getYAxisClipWidth = function () { - const $$ = this; - return $$.getAxisClipWidth($$.config.axis_rotated) + ($$.config.axis_y_inner ? 20 : 0); -}; -c3_chart_internal_fn.getYAxisClipHeight = function () { - const $$ = this; - return $$.getAxisClipHeight($$.config.axis_rotated); -}; diff --git a/src/chartinternal/color.js b/src/chartinternal/color.js deleted file mode 100644 index acc6f05..0000000 --- a/src/chartinternal/color.js +++ /dev/null @@ -1,46 +0,0 @@ -c3_chart_internal_fn.generateColor = function () { - let $$ = this, config = $$.config, d3 = $$.d3, - colors = config.data_colors, - pattern = notEmpty(config.color_pattern) ? config.color_pattern : d3.scale.category10().range(), - callback = config.data_color, - ids = []; - - return function (d) { - let id = d.id || (d.data && d.data.id) || d, color; - - // if callback function is provided - if (colors[id] instanceof Function) { - color = colors[id](d); - } - // if specified, choose that color - else if (colors[id]) { - color = colors[id]; - } - // if not specified, choose from pattern - else { - if (ids.indexOf(id) < 0) { ids.push(id); } - color = pattern[ids.indexOf(id) % pattern.length]; - colors[id] = color; - } - return callback instanceof Function ? callback(color, d) : color; - }; -}; -c3_chart_internal_fn.generateLevelColor = function () { - let $$ = this, config = $$.config, - colors = config.color_pattern, - threshold = config.color_threshold, - asValue = threshold.unit === 'value', - values = threshold.values && threshold.values.length ? threshold.values : [], - max = threshold.max || 100; - return notEmpty(config.color_threshold) ? function (value) { - let i, v, color = colors[colors.length - 1]; - for (i = 0; i < values.length; i++) { - v = asValue ? value : (value * 100 / max); - if (v < values[i]) { - color = colors[i]; - break; - } - } - return color; - } : null; -}; diff --git a/src/chartinternal/config.js b/src/chartinternal/config.js deleted file mode 100644 index 7dbca2c..0000000 --- a/src/chartinternal/config.js +++ /dev/null @@ -1,266 +0,0 @@ -c3_chart_internal_fn.getDefaultConfig = function () { - const config = { - bindto: '#chart', - svg_classname: undefined, - size_width: undefined, - size_height: undefined, - padding_left: undefined, - padding_right: undefined, - padding_top: undefined, - padding_bottom: undefined, - resize_auto: true, - zoom_enabled: false, - zoom_extent: undefined, - zoom_privileged: false, - zoom_rescale: false, - zoom_onzoom() {}, - zoom_onzoomstart() {}, - zoom_onzoomend() {}, - zoom_x_min: undefined, - zoom_x_max: undefined, - interaction_brighten: true, - interaction_enabled: true, - onmouseover() {}, - onmouseout() {}, - onresize() {}, - onresized() {}, - oninit() {}, - onrendered() {}, - transition_duration: 350, - data_x: undefined, - data_xs: {}, - data_xFormat: '%Y-%m-%d', - data_xLocaltime: true, - data_xSort: true, - data_idConverter(id) { return id; }, - data_names: {}, - data_classes: {}, - data_groups: [], - data_axes: {}, - data_type: undefined, - data_types: {}, - data_labels: {}, - data_order: 'desc', - data_regions: {}, - data_color: undefined, - data_colors: {}, - data_hide: false, - data_filter: undefined, - data_selection_enabled: false, - data_selection_grouped: false, - data_selection_isselectable() { return true; }, - data_selection_multiple: true, - data_selection_draggable: false, - data_onclick() {}, - data_onmouseover() {}, - data_onmouseout() {}, - data_onselected() {}, - data_onunselected() {}, - data_url: undefined, - data_headers: undefined, - data_json: undefined, - data_rows: undefined, - data_columns: undefined, - data_mimeType: undefined, - data_keys: undefined, - // configuration for no plot-able data supplied. - data_empty_label_text: '', - // subchart - subchart_show: false, - subchart_size_height: 60, - subchart_axis_x_show: true, - subchart_onbrush() {}, - // color - color_pattern: [], - color_threshold: {}, - // legend - legend_show: true, - legend_hide: false, - legend_position: 'bottom', - legend_inset_anchor: 'top-left', - legend_inset_x: 10, - legend_inset_y: 0, - legend_inset_step: undefined, - legend_item_onclick: undefined, - legend_item_onmouseover: undefined, - legend_item_onmouseout: undefined, - legend_equally: false, - legend_padding: 0, - legend_item_tile_width: 10, - legend_item_tile_height: 10, - // axis - axis_rotated: false, - axis_x_show: true, - axis_x_type: 'indexed', - axis_x_localtime: true, - axis_x_categories: [], - axis_x_tick_centered: false, - axis_x_tick_format: undefined, - axis_x_tick_culling: {}, - axis_x_tick_culling_max: 10, - axis_x_tick_count: undefined, - axis_x_tick_fit: true, - axis_x_tick_values: null, - axis_x_tick_rotate: 0, - axis_x_tick_outer: true, - axis_x_tick_multiline: true, - axis_x_tick_width: null, - axis_x_max: undefined, - axis_x_min: undefined, - axis_x_padding: {}, - axis_x_height: undefined, - axis_x_extent: undefined, - axis_x_label: {}, - axis_y_show: true, - axis_y_type: undefined, - axis_y_max: undefined, - axis_y_min: undefined, - axis_y_inverted: false, - axis_y_center: undefined, - axis_y_inner: undefined, - axis_y_label: {}, - axis_y_tick_format: undefined, - axis_y_tick_outer: true, - axis_y_tick_values: null, - axis_y_tick_rotate: 0, - axis_y_tick_count: undefined, - axis_y_tick_time_value: undefined, - axis_y_tick_time_interval: undefined, - axis_y_padding: {}, - axis_y_default: undefined, - axis_y2_show: false, - axis_y2_max: undefined, - axis_y2_min: undefined, - axis_y2_inverted: false, - axis_y2_center: undefined, - axis_y2_inner: undefined, - axis_y2_label: {}, - axis_y2_tick_format: undefined, - axis_y2_tick_outer: true, - axis_y2_tick_values: null, - axis_y2_tick_count: undefined, - axis_y2_padding: {}, - axis_y2_default: undefined, - // grid - grid_x_show: false, - grid_x_type: 'tick', - grid_x_lines: [], - grid_y_show: false, - // not used - // grid_y_type: 'tick', - grid_y_lines: [], - grid_y_ticks: 10, - grid_focus_show: true, - grid_lines_front: true, - // point - point of each data - point_show: true, - point_r: 2.5, - point_sensitivity: 10, - point_focus_expand_enabled: true, - point_focus_expand_r: undefined, - point_select_r: undefined, - // line - line_connectNull: false, - line_step_type: 'step', - // bar - bar_width: undefined, - bar_width_ratio: 0.6, - bar_width_max: undefined, - bar_zerobased: true, - // area - area_zerobased: true, - area_above: false, - // pie - pie_label_show: true, - pie_label_format: undefined, - pie_label_threshold: 0.05, - pie_label_ratio: undefined, - pie_expand: {}, - pie_expand_duration: 50, - // gauge - gauge_fullCircle: false, - gauge_label_show: true, - gauge_label_format: undefined, - gauge_min: 0, - gauge_max: 100, - gauge_startingAngle: -1 * Math.PI / 2, - gauge_units: undefined, - gauge_width: undefined, - gauge_expand: {}, - gauge_expand_duration: 50, - // donut - donut_label_show: true, - donut_label_format: undefined, - donut_label_threshold: 0.05, - donut_label_ratio: undefined, - donut_width: undefined, - donut_title: '', - donut_expand: {}, - donut_expand_duration: 50, - // spline - spline_interpolation_type: 'cardinal', - // region - region to change style - regions: [], - // tooltip - show when mouseover on each data - tooltip_show: true, - tooltip_grouped: true, - tooltip_format_title: undefined, - tooltip_format_name: undefined, - tooltip_format_value: undefined, - tooltip_position: undefined, - tooltip_contents(d, defaultTitleFormat, defaultValueFormat, color) { - return this.getTooltipContent ? this.getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) : ''; - }, - tooltip_init_show: false, - tooltip_init_x: 0, - tooltip_init_position: { top: '0px', left: '50px' }, - tooltip_onshow() {}, - tooltip_onhide() {}, - // title - title_text: undefined, - title_padding: { - top: 0, - right: 0, - bottom: 0, - left: 0, - }, - title_position: 'top-center', - // TouchEvent configuration - touch_tap_radius: 20, // touch movement must be less than this to be a 'tap' - touch_tap_delay: 500, //clicks are suppressed for this many ms after a tap - }; - - Object.keys(this.additionalConfig).forEach(function (key) { - config[key] = this.additionalConfig[key]; - }, this); - - return config; -}; -c3_chart_internal_fn.additionalConfig = {}; - -c3_chart_internal_fn.loadConfig = function (config) { - let this_config = this.config, target, keys, read; - function find() { - const key = keys.shift(); -// console.log("key =>", key, ", target =>", target); - if (key && target && typeof target === 'object' && key in target) { - target = target[key]; - return find(); - } - else if (!key) { - return target; - } - else { - return undefined; - } - } - Object.keys(this_config).forEach((key) => { - target = config; - keys = key.split('_'); - read = find(); -// console.log("CONFIG : ", key, read); - if (isDefined(read)) { - this_config[key] = read; - } - }); -}; diff --git a/src/chartinternal/data.convert.js b/src/chartinternal/data.convert.js deleted file mode 100644 index e59d667..0000000 --- a/src/chartinternal/data.convert.js +++ /dev/null @@ -1,227 +0,0 @@ -c3_chart_internal_fn.convertUrlToData = function (url, mimeType, headers, keys, done) { - let $$ = this, type = mimeType ? mimeType : 'csv'; - const req = $$.d3.xhr(url); - if (headers) { - Object.keys(headers).forEach((header) => { - req.header(header, headers[header]); - }); - } - req.get((error, data) => { - let d; - if (!data) { - throw new Error(error.responseURL + ' ' + error.status + ' (' + error.statusText + ')'); - } - if (type === 'json') { - d = $$.convertJsonToData(JSON.parse(data.response), keys); - } else if (type === 'tsv') { - d = $$.convertTsvToData(data.response); - } else { - d = $$.convertCsvToData(data.response); - } - done.call($$, d); - }); -}; -c3_chart_internal_fn.convertXsvToData = function (xsv, parser) { - let rows = parser.parseRows(xsv), d; - if (rows.length === 1) { - d = [{}]; - rows[0].forEach((id) => { - d[0][id] = null; - }); - } else { - d = parser.parse(xsv); - } - return d; -}; -c3_chart_internal_fn.convertCsvToData = function (csv) { - return this.convertXsvToData(csv, this.d3.csv); -}; -c3_chart_internal_fn.convertTsvToData = function (tsv) { - return this.convertXsvToData(tsv, this.d3.tsv); -}; -c3_chart_internal_fn.convertJsonToData = function (json, keys) { - let $$ = this, - new_rows = [], targetKeys, data; - if (keys) { // when keys specified, json would be an array that includes objects - if (keys.x) { - targetKeys = keys.value.concat(keys.x); - $$.config.data_x = keys.x; - } else { - targetKeys = keys.value; - } - new_rows.push(targetKeys); - json.forEach((o) => { - const new_row = []; - targetKeys.forEach((key) => { - // convert undefined to null because undefined data will be removed in convertDataToTargets() - let v = $$.findValueInJson(o, key); - if (isUndefined(v)) { - v = null; - } - new_row.push(v); - }); - new_rows.push(new_row); - }); - data = $$.convertRowsToData(new_rows); - } else { - Object.keys(json).forEach((key) => { - new_rows.push([key].concat(json[key])); - }); - data = $$.convertColumnsToData(new_rows); - } - return data; -}; -c3_chart_internal_fn.findValueInJson = function (object, path) { - path = path.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties (replace [] with .) - path = path.replace(/^\./, ''); // strip a leading dot - const pathArray = path.split('.'); - for (let i = 0; i < pathArray.length; ++i) { - const k = pathArray[i]; - if (k in object) { - object = object[k]; - } else { - return; - } - } - return object; -}; -c3_chart_internal_fn.convertRowsToData = function (rows) { - let keys = rows[0], new_row = {}, new_rows = [], i, j; - for (i = 1; i < rows.length; i++) { - new_row = {}; - for (j = 0; j < rows[i].length; j++) { - if (isUndefined(rows[i][j])) { - throw new Error('Source data is missing a component at (' + i + ',' + j + ')!'); - } - new_row[keys[j]] = rows[i][j]; - } - new_rows.push(new_row); - } - return new_rows; -}; -c3_chart_internal_fn.convertColumnsToData = function (columns) { - let new_rows = [], i, j, key; - for (i = 0; i < columns.length; i++) { - key = columns[i][0]; - for (j = 1; j < columns[i].length; j++) { - if (isUndefined(new_rows[j - 1])) { - new_rows[j - 1] = {}; - } - if (isUndefined(columns[i][j])) { - throw new Error('Source data is missing a component at (' + i + ',' + j + ')!'); - } - new_rows[j - 1][key] = columns[i][j]; - } - } - return new_rows; -}; -c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) { - let $$ = this, config = $$.config, - ids = $$.d3.keys(data[0]).filter($$.isNotX, $$), - xs = $$.d3.keys(data[0]).filter($$.isX, $$), - targets; - - // save x for update data by load when custom x and c3.x API - ids.forEach((id) => { - const xKey = $$.getXKey(id); - - if ($$.isCustomX() || $$.isTimeSeries()) { - // if included in input data - if (xs.indexOf(xKey) >= 0) { - $$.data.xs[id] = (appendXs && $$.data.xs[id] ? $$.data.xs[id] : []).concat( - data.map((d) => { return d[xKey]; }) - .filter(isValue) - .map((rawX, i) => { return $$.generateTargetX(rawX, id, i); }) - ); - } - // if not included in input data, find from preloaded data of other id's x - else if (config.data_x) { - $$.data.xs[id] = $$.getOtherTargetXs(); - } - // if not included in input data, find from preloaded data - else if (notEmpty(config.data_xs)) { - $$.data.xs[id] = $$.getXValuesOfXKey(xKey, $$.data.targets); - } - // MEMO: if no x included, use same x of current will be used - } else { - $$.data.xs[id] = data.map((d, i) => { return i; }); - } - }); - - - // check x is defined - ids.forEach((id) => { - if (!$$.data.xs[id]) { - throw new Error('x is not defined for id = "' + id + '".'); - } - }); - - // convert to target - targets = ids.map((id, index) => { - const convertedId = config.data_idConverter(id); - return { - id: convertedId, - id_org: id, - values: data.map((d, i) => { - let xKey = $$.getXKey(id), rawX = d[xKey], - value = d[id] !== null && !isNaN(d[id]) ? +d[id] : null, x; - // use x as categories if custom x and categorized - if ($$.isCustomX() && $$.isCategorized() && index === 0 && !isUndefined(rawX)) { - if (index === 0 && i === 0) { - config.axis_x_categories = []; - } - x = config.axis_x_categories.indexOf(rawX); - if (x === -1) { - x = config.axis_x_categories.length; - config.axis_x_categories.push(rawX); - } - } else { - x = $$.generateTargetX(rawX, id, i); - } - // mark as x = undefined if value is undefined and filter to remove after mapped - if (isUndefined(d[id]) || $$.data.xs[id].length <= i) { - x = undefined; - } - return { x, value, id: convertedId }; - }).filter((v) => { return isDefined(v.x); }), - }; - }); - - // finish targets - targets.forEach((t) => { - let i; - // sort values by its x - if (config.data_xSort) { - t.values = t.values.sort((v1, v2) => { - let x1 = v1.x || v1.x === 0 ? v1.x : Infinity, - x2 = v2.x || v2.x === 0 ? v2.x : Infinity; - return x1 - x2; - }); - } - // indexing each value - i = 0; - t.values.forEach((v) => { - v.index = i++; - }); - // this needs to be sorted because its index and value.index is identical - $$.data.xs[t.id].sort((v1, v2) => { - return v1 - v2; - }); - }); - - // cache information about values - $$.hasNegativeValue = $$.hasNegativeValueInTargets(targets); - $$.hasPositiveValue = $$.hasPositiveValueInTargets(targets); - - // set target types - if (config.data_type) { - $$.setTargetType($$.mapToIds(targets).filter((id) => { return !(id in config.data_types); }), config.data_type); - } - - // cache as original id keyed - targets.forEach((d) => { - $$.addCache(d.id_org, d); - }); - - return targets; -}; diff --git a/src/chartinternal/data.js b/src/chartinternal/data.js deleted file mode 100644 index 680a71a..0000000 --- a/src/chartinternal/data.js +++ /dev/null @@ -1,370 +0,0 @@ -c3_chart_internal_fn.isX = function (key) { - let $$ = this, config = $$.config; - return (config.data_x && key === config.data_x) || (notEmpty(config.data_xs) && hasValue(config.data_xs, key)); -}; -c3_chart_internal_fn.isNotX = function (key) { - return !this.isX(key); -}; -c3_chart_internal_fn.getXKey = function (id) { - let $$ = this, config = $$.config; - return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null; -}; -c3_chart_internal_fn.getXValuesOfXKey = function (key, targets) { - let $$ = this, - xValues, ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : []; - ids.forEach((id) => { - if ($$.getXKey(id) === key) { - xValues = $$.data.xs[id]; - } - }); - return xValues; -}; -c3_chart_internal_fn.getIndexByX = function (x) { - let $$ = this, - data = $$.filterByX($$.data.targets, x); - return data.length ? data[0].index : null; -}; -c3_chart_internal_fn.getXValue = function (id, i) { - const $$ = this; - return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i; -}; -c3_chart_internal_fn.getOtherTargetXs = function () { - let $$ = this, - idsForX = Object.keys($$.data.xs); - return idsForX.length ? $$.data.xs[idsForX[0]] : null; -}; -c3_chart_internal_fn.getOtherTargetX = function (index) { - const xs = this.getOtherTargetXs(); - return xs && index < xs.length ? xs[index] : null; -}; -c3_chart_internal_fn.addXs = function (xs) { - const $$ = this; - Object.keys(xs).forEach((id) => { - $$.config.data_xs[id] = xs[id]; - }); -}; -c3_chart_internal_fn.hasMultipleX = function (xs) { - return this.d3.set(Object.keys(xs).map((id) => { return xs[id]; })).size() > 1; -}; -c3_chart_internal_fn.isMultipleX = function () { - return notEmpty(this.config.data_xs) || !this.config.data_xSort || this.hasType('scatter'); -}; -c3_chart_internal_fn.addName = function (data) { - let $$ = this, name; - if (data) { - name = $$.config.data_names[data.id]; - data.name = name !== undefined ? name : data.id; - } - return data; -}; -c3_chart_internal_fn.getValueOnIndex = function (values, index) { - const valueOnIndex = values.filter((v) => { return v.index === index; }); - return valueOnIndex.length ? valueOnIndex[0] : null; -}; -c3_chart_internal_fn.updateTargetX = function (targets, x) { - const $$ = this; - targets.forEach((t) => { - t.values.forEach((v, i) => { - v.x = $$.generateTargetX(x[i], t.id, i); - }); - $$.data.xs[t.id] = x; - }); -}; -c3_chart_internal_fn.updateTargetXs = function (targets, xs) { - const $$ = this; - targets.forEach((t) => { - if (xs[t.id]) { - $$.updateTargetX([t], xs[t.id]); - } - }); -}; -c3_chart_internal_fn.generateTargetX = function (rawX, id, index) { - let $$ = this, x; - if ($$.isTimeSeries()) { - x = rawX ? $$.parseDate(rawX) : $$.parseDate($$.getXValue(id, index)); - } - else if ($$.isCustomX() && !$$.isCategorized()) { - x = isValue(rawX) ? +rawX : $$.getXValue(id, index); - } - else { - x = index; - } - return x; -}; -c3_chart_internal_fn.cloneTarget = function (target) { - return { - id: target.id, - id_org: target.id_org, - values: target.values.map((d) => { - return { x: d.x, value: d.value, id: d.id }; - }), - }; -}; -c3_chart_internal_fn.updateXs = function () { - const $$ = this; - if ($$.data.targets.length) { - $$.xs = []; - $$.data.targets[0].values.forEach((v) => { - $$.xs[v.index] = v.x; - }); - } -}; -c3_chart_internal_fn.getPrevX = function (i) { - const x = this.xs[i - 1]; - return typeof x !== 'undefined' ? x : null; -}; -c3_chart_internal_fn.getNextX = function (i) { - const x = this.xs[i + 1]; - return typeof x !== 'undefined' ? x : null; -}; -c3_chart_internal_fn.getMaxDataCount = function () { - const $$ = this; - return $$.d3.max($$.data.targets, (t) => { return t.values.length; }); -}; -c3_chart_internal_fn.getMaxDataCountTarget = function (targets) { - let length = targets.length, max = 0, maxTarget; - if (length > 1) { - targets.forEach((t) => { - if (t.values.length > max) { - maxTarget = t; - max = t.values.length; - } - }); - } else { - maxTarget = length ? targets[0] : null; - } - return maxTarget; -}; -c3_chart_internal_fn.getEdgeX = function (targets) { - const $$ = this; - return !targets.length ? [0, 0] : [ - $$.d3.min(targets, (t) => { return t.values[0].x; }), - $$.d3.max(targets, (t) => { return t.values[t.values.length - 1].x; }), - ]; -}; -c3_chart_internal_fn.mapToIds = function (targets) { - return targets.map((d) => { return d.id; }); -}; -c3_chart_internal_fn.mapToTargetIds = function (ids) { - const $$ = this; - return ids ? [].concat(ids) : $$.mapToIds($$.data.targets); -}; -c3_chart_internal_fn.hasTarget = function (targets, id) { - let ids = this.mapToIds(targets), i; - for (i = 0; i < ids.length; i++) { - if (ids[i] === id) { - return true; - } - } - return false; -}; -c3_chart_internal_fn.isTargetToShow = function (targetId) { - return this.hiddenTargetIds.indexOf(targetId) < 0; -}; -c3_chart_internal_fn.isLegendToShow = function (targetId) { - return this.hiddenLegendIds.indexOf(targetId) < 0; -}; -c3_chart_internal_fn.filterTargetsToShow = function (targets) { - const $$ = this; - return targets.filter((t) => { return $$.isTargetToShow(t.id); }); -}; -c3_chart_internal_fn.mapTargetsToUniqueXs = function (targets) { - const $$ = this; - let xs = $$.d3.set($$.d3.merge(targets.map((t) => { return t.values.map((v) => { return +v.x; }); }))).values(); - xs = $$.isTimeSeries() ? xs.map((x) => { return new Date(+x); }) : xs.map((x) => { return +x; }); - return xs.sort((a, b) => { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; }); -}; -c3_chart_internal_fn.addHiddenTargetIds = function (targetIds) { - this.hiddenTargetIds = this.hiddenTargetIds.concat(targetIds); -}; -c3_chart_internal_fn.removeHiddenTargetIds = function (targetIds) { - this.hiddenTargetIds = this.hiddenTargetIds.filter((id) => { return targetIds.indexOf(id) < 0; }); -}; -c3_chart_internal_fn.addHiddenLegendIds = function (targetIds) { - this.hiddenLegendIds = this.hiddenLegendIds.concat(targetIds); -}; -c3_chart_internal_fn.removeHiddenLegendIds = function (targetIds) { - this.hiddenLegendIds = this.hiddenLegendIds.filter((id) => { return targetIds.indexOf(id) < 0; }); -}; -c3_chart_internal_fn.getValuesAsIdKeyed = function (targets) { - const ys = {}; - targets.forEach((t) => { - ys[t.id] = []; - t.values.forEach((v) => { - ys[t.id].push(v.value); - }); - }); - return ys; -}; -c3_chart_internal_fn.checkValueInTargets = function (targets, checker) { - let ids = Object.keys(targets), i, j, values; - for (i = 0; i < ids.length; i++) { - values = targets[ids[i]].values; - for (j = 0; j < values.length; j++) { - if (checker(values[j].value)) { - return true; - } - } - } - return false; -}; -c3_chart_internal_fn.hasNegativeValueInTargets = function (targets) { - return this.checkValueInTargets(targets, (v) => { return v < 0; }); -}; -c3_chart_internal_fn.hasPositiveValueInTargets = function (targets) { - return this.checkValueInTargets(targets, (v) => { return v > 0; }); -}; -c3_chart_internal_fn.isOrderDesc = function () { - const config = this.config; - return typeof (config.data_order) === 'string' && config.data_order.toLowerCase() === 'desc'; -}; -c3_chart_internal_fn.isOrderAsc = function () { - const config = this.config; - return typeof (config.data_order) === 'string' && config.data_order.toLowerCase() === 'asc'; -}; -c3_chart_internal_fn.orderTargets = function (targets) { - let $$ = this, config = $$.config, orderAsc = $$.isOrderAsc(), orderDesc = $$.isOrderDesc(); - if (orderAsc || orderDesc) { - targets.sort((t1, t2) => { - const reducer = function (p, c) { return p + Math.abs(c.value); }; - let t1Sum = t1.values.reduce(reducer, 0), - t2Sum = t2.values.reduce(reducer, 0); - return orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum; - }); - } else if (isFunction(config.data_order)) { - targets.sort(config.data_order); - } // TODO: accept name array for order - return targets; -}; -c3_chart_internal_fn.filterByX = function (targets, x) { - return this.d3.merge(targets.map((t) => { return t.values; })).filter((v) => { return v.x - x === 0; }); -}; -c3_chart_internal_fn.filterRemoveNull = function (data) { - return data.filter((d) => { return isValue(d.value); }); -}; -c3_chart_internal_fn.filterByXDomain = function (targets, xDomain) { - return targets.map((t) => { - return { - id: t.id, - id_org: t.id_org, - values: t.values.filter((v) => { - return xDomain[0] <= v.x && v.x <= xDomain[1]; - }), - }; - }); -}; -c3_chart_internal_fn.hasDataLabel = function () { - const config = this.config; - if (typeof config.data_labels === 'boolean' && config.data_labels) { - return true; - } else if (typeof config.data_labels === 'object' && notEmpty(config.data_labels)) { - return true; - } - return false; -}; -c3_chart_internal_fn.getDataLabelLength = function (min, max, key) { - let $$ = this, - lengths = [0, 0], paddingCoef = 1.3; - $$.selectChart.select('svg').selectAll('.dummy') - .data([min, max]) - .enter().append('text') - .text((d) => { return $$.dataLabelFormat(d.id)(d); }) - .each(function (d, i) { - lengths[i] = this.getBoundingClientRect()[key] * paddingCoef; - }) - .remove(); - return lengths; -}; -c3_chart_internal_fn.isNoneArc = function (d) { - return this.hasTarget(this.data.targets, d.id); -}, -c3_chart_internal_fn.isArc = function (d) { - return 'data' in d && this.hasTarget(this.data.targets, d.data.id); -}; -c3_chart_internal_fn.findSameXOfValues = function (values, index) { - let i, targetX = values[index].x, sames = []; - for (i = index - 1; i >= 0; i--) { - if (targetX !== values[i].x) { break; } - sames.push(values[i]); - } - for (i = index; i < values.length; i++) { - if (targetX !== values[i].x) { break; } - sames.push(values[i]); - } - return sames; -}; - -c3_chart_internal_fn.findClosestFromTargets = function (targets, pos) { - let $$ = this, candidates; - - // map to array of closest points of each target - candidates = targets.map((target) => { - return $$.findClosest(target.values, pos); - }); - - // decide closest point and return - return $$.findClosest(candidates, pos); -}; -c3_chart_internal_fn.findClosest = function (values, pos) { - let $$ = this, minDist = $$.config.point_sensitivity, closest; - - // find mouseovering bar - values.filter((v) => { return v && $$.isBarType(v.id); }).forEach((v) => { - const shape = $$.main.select('.' + CLASS.bars + $$.getTargetSelectorSuffix(v.id) + ' .' + CLASS.bar + '-' + v.index).node(); - if (!closest && $$.isWithinBar(shape)) { - closest = v; - } - }); - - // find closest point from non-bar - values.filter((v) => { return v && !$$.isBarType(v.id); }).forEach((v) => { - const d = $$.dist(v, pos); - if (d < minDist) { - minDist = d; - closest = v; - } - }); - - return closest; -}; -c3_chart_internal_fn.dist = function (data, pos) { - let $$ = this, config = $$.config, - xIndex = config.axis_rotated ? 1 : 0, - yIndex = config.axis_rotated ? 0 : 1, - y = $$.circleY(data, data.index), - x = $$.x(data.x); - return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2)); -}; -c3_chart_internal_fn.convertValuesToStep = function (values) { - let converted = [].concat(values), i; - - if (!this.isCategorized()) { - return values; - } - - for (i = values.length + 1; 0 < i; i--) { - converted[i] = converted[i - 1]; - } - - converted[0] = { - x: converted[0].x - 1, - value: converted[0].value, - id: converted[0].id, - }; - converted[values.length + 1] = { - x: converted[values.length].x + 1, - value: converted[values.length].value, - id: converted[values.length].id, - }; - - return converted; -}; -c3_chart_internal_fn.updateDataAttributes = function (name, attrs) { - let $$ = this, config = $$.config, current = config['data_' + name]; - if (typeof attrs === 'undefined') { return current; } - Object.keys(attrs).forEach((id) => { - current[id] = attrs[id]; - }); - $$.redraw({ withLegend: true }); - return current; -}; diff --git a/src/chartinternal/data.load.js b/src/chartinternal/data.load.js deleted file mode 100644 index bb1380e..0000000 --- a/src/chartinternal/data.load.js +++ /dev/null @@ -1,88 +0,0 @@ -c3_chart_internal_fn.load = function (targets, args) { - const $$ = this; - if (targets) { - // filter loading targets if needed - if (args.filter) { - targets = targets.filter(args.filter); - } - // set type if args.types || args.type specified - if (args.type || args.types) { - targets.forEach((t) => { - const type = args.types && args.types[t.id] ? args.types[t.id] : args.type; - $$.setTargetType(t.id, type); - }); - } - // Update/Add data - $$.data.targets.forEach((d) => { - for (let i = 0; i < targets.length; i++) { - if (d.id === targets[i].id) { - d.values = targets[i].values; - targets.splice(i, 1); - break; - } - } - }); - $$.data.targets = $$.data.targets.concat(targets); // add remained - } - - // Set targets - $$.updateTargets($$.data.targets); - - // Redraw with new targets - $$.redraw({ withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true }); - - if (args.done) { args.done(); } -}; -c3_chart_internal_fn.loadFromArgs = function (args) { - const $$ = this; - if (args.data) { - $$.load($$.convertDataToTargets(args.data), args); - } - else if (args.url) { - $$.convertUrlToData(args.url, args.mimeType, args.headers, args.keys, (data) => { - $$.load($$.convertDataToTargets(data), args); - }); - } - else if (args.json) { - $$.load($$.convertDataToTargets($$.convertJsonToData(args.json, args.keys)), args); - } - else if (args.rows) { - $$.load($$.convertDataToTargets($$.convertRowsToData(args.rows)), args); - } - else if (args.columns) { - $$.load($$.convertDataToTargets($$.convertColumnsToData(args.columns)), args); - } - else { - $$.load(null, args); - } -}; -c3_chart_internal_fn.unload = function (targetIds, done) { - const $$ = this; - if (!done) { - done = function () {}; - } - // filter existing target - targetIds = targetIds.filter((id) => { return $$.hasTarget($$.data.targets, id); }); - // If no target, call done and return - if (!targetIds || targetIds.length === 0) { - done(); - return; - } - $$.svg.selectAll(targetIds.map((id) => { return $$.selectorTarget(id); })) - .transition() - .style('opacity', 0) - .remove() - .call($$.endall, done); - targetIds.forEach((id) => { - // Reset fadein for future load - $$.withoutFadeIn[id] = false; - // Remove target's elements - if ($$.legend) { - $$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove(); - } - // Remove target - $$.data.targets = $$.data.targets.filter((t) => { - return t.id !== id; - }); - }); -}; diff --git a/src/chartinternal/domain.js b/src/chartinternal/domain.js deleted file mode 100644 index 61d8828..0000000 --- a/src/chartinternal/domain.js +++ /dev/null @@ -1,235 +0,0 @@ -c3_chart_internal_fn.getYDomainMin = function (targets) { - let $$ = this, config = $$.config, - ids = $$.mapToIds(targets), ys = $$.getValuesAsIdKeyed(targets), - j, k, baseId, idsInGroup, id, hasNegativeValue; - if (config.data_groups.length > 0) { - hasNegativeValue = $$.hasNegativeValueInTargets(targets); - for (j = 0; j < config.data_groups.length; j++) { - // Determine baseId - idsInGroup = config.data_groups[j].filter((id) => { return ids.indexOf(id) >= 0; }); - if (idsInGroup.length === 0) { continue; } - baseId = idsInGroup[0]; - // Consider negative values - if (hasNegativeValue && ys[baseId]) { - ys[baseId].forEach((v, i) => { - ys[baseId][i] = v < 0 ? v : 0; - }); - } - // Compute min - for (k = 1; k < idsInGroup.length; k++) { - id = idsInGroup[k]; - if (!ys[id]) { continue; } - ys[id].forEach((v, i) => { - if ($$.axis.getId(id) === $$.axis.getId(baseId) && ys[baseId] && !(hasNegativeValue && +v > 0)) { - ys[baseId][i] += +v; - } - }); - } - } - } - return $$.d3.min(Object.keys(ys).map((key) => { return $$.d3.min(ys[key]); })); -}; -c3_chart_internal_fn.getYDomainMax = function (targets) { - let $$ = this, config = $$.config, - ids = $$.mapToIds(targets), ys = $$.getValuesAsIdKeyed(targets), - j, k, baseId, idsInGroup, id, hasPositiveValue; - if (config.data_groups.length > 0) { - hasPositiveValue = $$.hasPositiveValueInTargets(targets); - for (j = 0; j < config.data_groups.length; j++) { - // Determine baseId - idsInGroup = config.data_groups[j].filter((id) => { return ids.indexOf(id) >= 0; }); - if (idsInGroup.length === 0) { continue; } - baseId = idsInGroup[0]; - // Consider positive values - if (hasPositiveValue && ys[baseId]) { - ys[baseId].forEach((v, i) => { - ys[baseId][i] = v > 0 ? v : 0; - }); - } - // Compute max - for (k = 1; k < idsInGroup.length; k++) { - id = idsInGroup[k]; - if (!ys[id]) { continue; } - ys[id].forEach((v, i) => { - if ($$.axis.getId(id) === $$.axis.getId(baseId) && ys[baseId] && !(hasPositiveValue && +v < 0)) { - ys[baseId][i] += +v; - } - }); - } - } - } - return $$.d3.max(Object.keys(ys).map((key) => { return $$.d3.max(ys[key]); })); -}; -c3_chart_internal_fn.getYDomain = function (targets, axisId, xDomain) { - let $$ = this, config = $$.config, - targetsByAxisId = targets.filter((t) => { return $$.axis.getId(t.id) === axisId; }), - yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId, - yMin = axisId === 'y2' ? config.axis_y2_min : config.axis_y_min, - yMax = axisId === 'y2' ? config.axis_y2_max : config.axis_y_max, - yDomainMin = $$.getYDomainMin(yTargets), - yDomainMax = $$.getYDomainMax(yTargets), - domain, domainLength, padding, padding_top, padding_bottom, - center = axisId === 'y2' ? config.axis_y2_center : config.axis_y_center, - yDomainAbs, lengths, diff, ratio, isAllPositive, isAllNegative, - isZeroBased = ($$.hasType('bar', yTargets) && config.bar_zerobased) || ($$.hasType('area', yTargets) && config.area_zerobased), - isInverted = axisId === 'y2' ? config.axis_y2_inverted : config.axis_y_inverted, - showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated, - showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated; - - // MEMO: avoid inverting domain unexpectedly - yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? (yDomainMin < yMax ? yDomainMin : yMax - 10) : yDomainMin; - yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? (yMin < yDomainMax ? yDomainMax : yMin + 10) : yDomainMax; - - if (yTargets.length === 0) { // use current domain if target of axisId is none - return axisId === 'y2' ? $$.y2.domain() : $$.y.domain(); - } - if (isNaN(yDomainMin)) { // set minimum to zero when not number - yDomainMin = 0; - } - if (isNaN(yDomainMax)) { // set maximum to have same value as yDomainMin - yDomainMax = yDomainMin; - } - if (yDomainMin === yDomainMax) { - yDomainMin < 0 ? yDomainMax = 0 : yDomainMin = 0; - } - isAllPositive = yDomainMin >= 0 && yDomainMax >= 0; - isAllNegative = yDomainMin <= 0 && yDomainMax <= 0; - - // Cancel zerobased if axis_*_min / axis_*_max specified - if ((isValue(yMin) && isAllPositive) || (isValue(yMax) && isAllNegative)) { - isZeroBased = false; - } - - // Bar/Area chart should be 0-based if all positive|negative - if (isZeroBased) { - if (isAllPositive) { yDomainMin = 0; } - if (isAllNegative) { yDomainMax = 0; } - } - - domainLength = Math.abs(yDomainMax - yDomainMin); - padding = padding_top = padding_bottom = domainLength * 0.1; - - if (typeof center !== 'undefined') { - yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax)); - yDomainMax = center + yDomainAbs; - yDomainMin = center - yDomainAbs; - } - // add padding for data label - if (showHorizontalDataLabel) { - lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, 'width'); - diff = diffDomain($$.y.range()); - ratio = [lengths[0] / diff, lengths[1] / diff]; - padding_top += domainLength * (ratio[1] / (1 - ratio[0] - ratio[1])); - padding_bottom += domainLength * (ratio[0] / (1 - ratio[0] - ratio[1])); - } else if (showVerticalDataLabel) { - lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, 'height'); - padding_top += $$.axis.convertPixelsToAxisPadding(lengths[1], domainLength); - padding_bottom += $$.axis.convertPixelsToAxisPadding(lengths[0], domainLength); - } - if (axisId === 'y' && notEmpty(config.axis_y_padding)) { - padding_top = $$.axis.getPadding(config.axis_y_padding, 'top', padding_top, domainLength); - padding_bottom = $$.axis.getPadding(config.axis_y_padding, 'bottom', padding_bottom, domainLength); - } - if (axisId === 'y2' && notEmpty(config.axis_y2_padding)) { - padding_top = $$.axis.getPadding(config.axis_y2_padding, 'top', padding_top, domainLength); - padding_bottom = $$.axis.getPadding(config.axis_y2_padding, 'bottom', padding_bottom, domainLength); - } - // Bar/Area chart should be 0-based if all positive|negative - if (isZeroBased) { - if (isAllPositive) { padding_bottom = yDomainMin; } - if (isAllNegative) { padding_top = -yDomainMax; } - } - domain = [yDomainMin - padding_bottom, yDomainMax + padding_top]; - return isInverted ? domain.reverse() : domain; -}; -c3_chart_internal_fn.getXDomainMin = function (targets) { - let $$ = this, config = $$.config; - return isDefined(config.axis_x_min) ? - ($$.isTimeSeries() ? this.parseDate(config.axis_x_min) : config.axis_x_min) : - $$.d3.min(targets, (t) => { return $$.d3.min(t.values, (v) => { return v.x; }); }); -}; -c3_chart_internal_fn.getXDomainMax = function (targets) { - let $$ = this, config = $$.config; - return isDefined(config.axis_x_max) ? - ($$.isTimeSeries() ? this.parseDate(config.axis_x_max) : config.axis_x_max) : - $$.d3.max(targets, (t) => { return $$.d3.max(t.values, (v) => { return v.x; }); }); -}; -c3_chart_internal_fn.getXDomainPadding = function (domain) { - let $$ = this, config = $$.config, - diff = domain[1] - domain[0], - maxDataCount, padding, paddingLeft, paddingRight; - if ($$.isCategorized()) { - padding = 0; - } else if ($$.hasType('bar')) { - maxDataCount = $$.getMaxDataCount(); - padding = maxDataCount > 1 ? (diff / (maxDataCount - 1)) / 2 : 0.5; - } else { - padding = diff * 0.01; - } - if (typeof config.axis_x_padding === 'object' && notEmpty(config.axis_x_padding)) { - paddingLeft = isValue(config.axis_x_padding.left) ? config.axis_x_padding.left : padding; - paddingRight = isValue(config.axis_x_padding.right) ? config.axis_x_padding.right : padding; - } else if (typeof config.axis_x_padding === 'number') { - paddingLeft = paddingRight = config.axis_x_padding; - } else { - paddingLeft = paddingRight = padding; - } - return { left: paddingLeft, right: paddingRight }; -}; -c3_chart_internal_fn.getXDomain = function (targets) { - let $$ = this, - xDomain = [$$.getXDomainMin(targets), $$.getXDomainMax(targets)], - firstX = xDomain[0], lastX = xDomain[1], - padding = $$.getXDomainPadding(xDomain), - min = 0, max = 0; - // show center of x domain if min and max are the same - if ((firstX - lastX) === 0 && !$$.isCategorized()) { - if ($$.isTimeSeries()) { - firstX = new Date(firstX.getTime() * 0.5); - lastX = new Date(lastX.getTime() * 1.5); - } else { - firstX = firstX === 0 ? 1 : (firstX * 0.5); - lastX = lastX === 0 ? -1 : (lastX * 1.5); - } - } - if (firstX || firstX === 0) { - min = $$.isTimeSeries() ? new Date(firstX.getTime() - padding.left) : firstX - padding.left; - } - if (lastX || lastX === 0) { - max = $$.isTimeSeries() ? new Date(lastX.getTime() + padding.right) : lastX + padding.right; - } - return [min, max]; -}; -c3_chart_internal_fn.updateXDomain = function (targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) { - let $$ = this, config = $$.config; - - if (withUpdateOrgXDomain) { - $$.x.domain(domain ? domain : $$.d3.extent($$.getXDomain(targets))); - $$.orgXDomain = $$.x.domain(); - if (config.zoom_enabled) { $$.zoom.scale($$.x).updateScaleExtent(); } - $$.subX.domain($$.x.domain()); - if ($$.brush) { $$.brush.scale($$.subX); } - } - if (withUpdateXDomain) { - $$.x.domain(domain ? domain : (!$$.brush || $$.brush.empty()) ? $$.orgXDomain : $$.brush.extent()); - if (config.zoom_enabled) { $$.zoom.scale($$.x).updateScaleExtent(); } - } - - // Trim domain when too big by zoom mousemove event - if (withTrim) { $$.x.domain($$.trimXDomain($$.x.orgDomain())); } - - return $$.x.domain(); -}; -c3_chart_internal_fn.trimXDomain = function (domain) { - let zoomDomain = this.getZoomDomain(), - min = zoomDomain[0], max = zoomDomain[1]; - if (domain[0] <= min) { - domain[1] = +domain[1] + (min - domain[0]); - domain[0] = min; - } - if (max <= domain[1]) { - domain[0] = +domain[0] - (domain[1] - max); - domain[1] = max; - } - return domain; -}; diff --git a/src/chartinternal/drag.js b/src/chartinternal/drag.js deleted file mode 100644 index 7a6ebe2..0000000 --- a/src/chartinternal/drag.js +++ /dev/null @@ -1,81 +0,0 @@ -c3_chart_internal_fn.drag = function (mouse) { - let $$ = this, config = $$.config, main = $$.main, d3 = $$.d3; - let sx, sy, mx, my, minX, maxX, minY, maxY; - - if ($$.hasArcType()) { return; } - if (!config.data_selection_enabled) { return; } // do nothing if not selectable - if (config.zoom_enabled && !$$.zoom.altDomain) { return; } // skip if zoomable because of conflict drag dehavior - if (!config.data_selection_multiple) { return; } // skip when single selection because drag is used for multiple selection - - sx = $$.dragStart[0]; - sy = $$.dragStart[1]; - mx = mouse[0]; - my = mouse[1]; - minX = Math.min(sx, mx); - maxX = Math.max(sx, mx); - minY = (config.data_selection_grouped) ? $$.margin.top : Math.min(sy, my); - maxY = (config.data_selection_grouped) ? $$.height : Math.max(sy, my); - - main.select('.' + CLASS.dragarea) - .attr('x', minX) - .attr('y', minY) - .attr('width', maxX - minX) - .attr('height', maxY - minY); - // TODO: binary search when multiple xs - main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape) - .filter((d) => { return config.data_selection_isselectable(d); }) - .each(function (d, i) { - let shape = d3.select(this), - isSelected = shape.classed(CLASS.SELECTED), - isIncluded = shape.classed(CLASS.INCLUDED), - _x, _y, _w, _h, toggle, isWithin = false, box; - if (shape.classed(CLASS.circle)) { - _x = shape.attr('cx') * 1; - _y = shape.attr('cy') * 1; - toggle = $$.togglePoint; - isWithin = minX < _x && _x < maxX && minY < _y && _y < maxY; - } - else if (shape.classed(CLASS.bar)) { - box = getPathBox(this); - _x = box.x; - _y = box.y; - _w = box.width; - _h = box.height; - toggle = $$.togglePath; - isWithin = !(maxX < _x || _x + _w < minX) && !(maxY < _y || _y + _h < minY); - } else { - // line/area selection not supported yet - return; - } - if (isWithin ^ isIncluded) { - shape.classed(CLASS.INCLUDED, !isIncluded); - // TODO: included/unincluded callback here - shape.classed(CLASS.SELECTED, !isSelected); - toggle.call($$, !isSelected, shape, d, i); - } - }); -}; - -c3_chart_internal_fn.dragstart = function (mouse) { - let $$ = this, config = $$.config; - if ($$.hasArcType()) { return; } - if (!config.data_selection_enabled) { return; } // do nothing if not selectable - $$.dragStart = mouse; - $$.main.select('.' + CLASS.chart).append('rect') - .attr('class', CLASS.dragarea) - .style('opacity', 0.1); - $$.dragging = true; -}; - -c3_chart_internal_fn.dragend = function () { - let $$ = this, config = $$.config; - if ($$.hasArcType()) { return; } - if (!config.data_selection_enabled) { return; } // do nothing if not selectable - $$.main.select('.' + CLASS.dragarea) - .transition().duration(100) - .style('opacity', 0) - .remove(); - $$.main.selectAll('.' + CLASS.shape) - .classed(CLASS.INCLUDED, false); - $$.dragging = false; -}; diff --git a/src/chartinternal/flow.js b/src/chartinternal/flow.js deleted file mode 100644 index f3775d4..0000000 --- a/src/chartinternal/flow.js +++ /dev/null @@ -1,155 +0,0 @@ -c3_chart_internal_fn.generateFlow = function (args) { - let $$ = this, - config = $$.config, - d3 = $$.d3; - - return function () { - let targets = args.targets, - flow = args.flow, - drawBar = args.drawBar, - drawLine = args.drawLine, - drawArea = args.drawArea, - cx = args.cx, - cy = args.cy, - xv = args.xv, - xForText = args.xForText, - yForText = args.yForText, - duration = args.duration; - - let translateX, scaleX = 1, - transform, - flowIndex = flow.index, - flowLength = flow.length, - flowStart = $$.getValueOnIndex($$.data.targets[0].values, flowIndex), - flowEnd = $$.getValueOnIndex($$.data.targets[0].values, flowIndex + flowLength), - orgDomain = $$.x.domain(), - domain, - durationForFlow = flow.duration || duration, - done = flow.done || function () {}, - wait = $$.generateWait(); - - let xgrid = $$.xgrid || d3.selectAll([]), - xgridLines = $$.xgridLines || d3.selectAll([]), - mainRegion = $$.mainRegion || d3.selectAll([]), - mainText = $$.mainText || d3.selectAll([]), - mainBar = $$.mainBar || d3.selectAll([]), - mainLine = $$.mainLine || d3.selectAll([]), - mainArea = $$.mainArea || d3.selectAll([]), - mainCircle = $$.mainCircle || d3.selectAll([]); - - // set flag - $$.flowing = true; - - // remove head data after rendered - $$.data.targets.forEach((d) => { - d.values.splice(0, flowLength); - }); - - // update x domain to generate axis elements for flow - domain = $$.updateXDomain(targets, true, true); - // update elements related to x scale - if ($$.updateXGrid) { $$.updateXGrid(true); } - - // generate transform to flow - if (!flow.orgDataCount) { // if empty - if ($$.data.targets[0].values.length !== 1) { - translateX = $$.x(orgDomain[0]) - $$.x(domain[0]); - } else { - if ($$.isTimeSeries()) { - flowStart = $$.getValueOnIndex($$.data.targets[0].values, 0); - flowEnd = $$.getValueOnIndex($$.data.targets[0].values, $$.data.targets[0].values.length - 1); - translateX = $$.x(flowStart.x) - $$.x(flowEnd.x); - } else { - translateX = diffDomain(domain) / 2; - } - } - } else if (flow.orgDataCount === 1 || (flowStart && flowStart.x) === (flowEnd && flowEnd.x)) { - translateX = $$.x(orgDomain[0]) - $$.x(domain[0]); - } else { - if ($$.isTimeSeries()) { - translateX = ($$.x(orgDomain[0]) - $$.x(domain[0])); - } else { - translateX = ($$.x(flowStart.x) - $$.x(flowEnd.x)); - } - } - scaleX = (diffDomain(orgDomain) / diffDomain(domain)); - transform = 'translate(' + translateX + ',0) scale(' + scaleX + ',1)'; - - $$.hideXGridFocus(); - - d3.transition().ease('linear').duration(durationForFlow).each(() => { - wait.add($$.axes.x.transition().call($$.xAxis)); - wait.add(mainBar.transition().attr('transform', transform)); - wait.add(mainLine.transition().attr('transform', transform)); - wait.add(mainArea.transition().attr('transform', transform)); - wait.add(mainCircle.transition().attr('transform', transform)); - wait.add(mainText.transition().attr('transform', transform)); - wait.add(mainRegion.filter($$.isRegionOnX).transition().attr('transform', transform)); - wait.add(xgrid.transition().attr('transform', transform)); - wait.add(xgridLines.transition().attr('transform', transform)); - }) - .call(wait, () => { - let i, shapes = [], - texts = [], - eventRects = []; - - // remove flowed elements - if (flowLength) { - for (i = 0; i < flowLength; i++) { - shapes.push('.' + CLASS.shape + '-' + (flowIndex + i)); - texts.push('.' + CLASS.text + '-' + (flowIndex + i)); - eventRects.push('.' + CLASS.eventRect + '-' + (flowIndex + i)); - } - $$.svg.selectAll('.' + CLASS.shapes).selectAll(shapes).remove(); - $$.svg.selectAll('.' + CLASS.texts).selectAll(texts).remove(); - $$.svg.selectAll('.' + CLASS.eventRects).selectAll(eventRects).remove(); - $$.svg.select('.' + CLASS.xgrid).remove(); - } - - // draw again for removing flowed elements and reverting attr - xgrid - .attr('transform', null) - .attr($$.xgridAttr); - xgridLines - .attr('transform', null); - xgridLines.select('line') - .attr('x1', config.axis_rotated ? 0 : xv) - .attr('x2', config.axis_rotated ? $$.width : xv); - xgridLines.select('text') - .attr('x', config.axis_rotated ? $$.width : 0) - .attr('y', xv); - mainBar - .attr('transform', null) - .attr('d', drawBar); - mainLine - .attr('transform', null) - .attr('d', drawLine); - mainArea - .attr('transform', null) - .attr('d', drawArea); - mainCircle - .attr('transform', null) - .attr('cx', cx) - .attr('cy', cy); - mainText - .attr('transform', null) - .attr('x', xForText) - .attr('y', yForText) - .style('fill-opacity', $$.opacityForText.bind($$)); - mainRegion - .attr('transform', null); - mainRegion.select('rect').filter($$.isRegionOnX) - .attr('x', $$.regionX.bind($$)) - .attr('width', $$.regionWidth.bind($$)); - - if (config.interaction_enabled) { - $$.redrawEventRect(); - } - - // callback for end of flow - done(); - - $$.flowing = false; - }); - }; -}; diff --git a/src/chartinternal/format.js b/src/chartinternal/format.js deleted file mode 100644 index dd0c666..0000000 --- a/src/chartinternal/format.js +++ /dev/null @@ -1,42 +0,0 @@ -c3_chart_internal_fn.getYFormat = function (forArc) { - let $$ = this, - formatForY = forArc && !$$.hasType('gauge') ? $$.defaultArcValueFormat : $$.yFormat, - formatForY2 = forArc && !$$.hasType('gauge') ? $$.defaultArcValueFormat : $$.y2Format; - return function (v, ratio, id) { - const format = $$.axis.getId(id) === 'y2' ? formatForY2 : formatForY; - return format.call($$, v, ratio); - }; -}; -c3_chart_internal_fn.yFormat = function (v) { - let $$ = this, config = $$.config, - format = config.axis_y_tick_format ? config.axis_y_tick_format : $$.defaultValueFormat; - return format(v); -}; -c3_chart_internal_fn.y2Format = function (v) { - let $$ = this, config = $$.config, - format = config.axis_y2_tick_format ? config.axis_y2_tick_format : $$.defaultValueFormat; - return format(v); -}; -c3_chart_internal_fn.defaultValueFormat = function (v) { - return isValue(v) ? +v : ''; -}; -c3_chart_internal_fn.defaultArcValueFormat = function (v, ratio) { - return (ratio * 100).toFixed(1) + '%'; -}; -c3_chart_internal_fn.dataLabelFormat = function (targetId) { - let $$ = this, data_labels = $$.config.data_labels, - format, defaultFormat = function (v) { return isValue(v) ? +v : ''; }; - // find format according to axis id - if (typeof data_labels.format === 'function') { - format = data_labels.format; - } else if (typeof data_labels.format === 'object') { - if (data_labels.format[targetId]) { - format = data_labels.format[targetId] === true ? defaultFormat : data_labels.format[targetId]; - } else { - format = function () { return ''; }; - } - } else { - format = defaultFormat; - } - return format; -}; diff --git a/src/chartinternal/grid.js b/src/chartinternal/grid.js deleted file mode 100644 index 97fa765..0000000 --- a/src/chartinternal/grid.js +++ /dev/null @@ -1,240 +0,0 @@ -c3_chart_internal_fn.initGrid = function () { - let $$ = this, config = $$.config, d3 = $$.d3; - $$.grid = $$.main.append('g') - .attr('clip-path', $$.clipPathForGrid) - .attr('class', CLASS.grid); - if (config.grid_x_show) { - $$.grid.append('g').attr('class', CLASS.xgrids); - } - if (config.grid_y_show) { - $$.grid.append('g').attr('class', CLASS.ygrids); - } - if (config.grid_focus_show) { - $$.grid.append('g') - .attr('class', CLASS.xgridFocus) - .append('line') - .attr('class', CLASS.xgridFocus); - } - $$.xgrid = d3.selectAll([]); - if (!config.grid_lines_front) { $$.initGridLines(); } -}; -c3_chart_internal_fn.initGridLines = function () { - let $$ = this, d3 = $$.d3; - $$.gridLines = $$.main.append('g') - .attr('clip-path', $$.clipPathForGrid) - .attr('class', CLASS.grid + ' ' + CLASS.gridLines); - $$.gridLines.append('g').attr('class', CLASS.xgridLines); - $$.gridLines.append('g').attr('class', CLASS.ygridLines); - $$.xgridLines = d3.selectAll([]); -}; -c3_chart_internal_fn.updateXGrid = function (withoutUpdate) { - let $$ = this, config = $$.config, d3 = $$.d3, - xgridData = $$.generateGridData(config.grid_x_type, $$.x), - tickOffset = $$.isCategorized() ? $$.xAxis.tickOffset() : 0; - - $$.xgridAttr = config.axis_rotated ? { - 'x1': 0, - 'x2': $$.width, - 'y1': function (d) { return $$.x(d) - tickOffset; }, - 'y2': function (d) { return $$.x(d) - tickOffset; }, - } : { - 'x1': function (d) { return $$.x(d) + tickOffset; }, - 'x2': function (d) { return $$.x(d) + tickOffset; }, - 'y1': 0, - 'y2': $$.height, - }; - - $$.xgrid = $$.main.select('.' + CLASS.xgrids).selectAll('.' + CLASS.xgrid) - .data(xgridData); - $$.xgrid.enter().append('line').attr('class', CLASS.xgrid); - if (!withoutUpdate) { - $$.xgrid.attr($$.xgridAttr) - .style('opacity', function () { return +d3.select(this).attr(config.axis_rotated ? 'y1' : 'x1') === (config.axis_rotated ? $$.height : 0) ? 0 : 1; }); - } - $$.xgrid.exit().remove(); -}; - -c3_chart_internal_fn.updateYGrid = function () { - let $$ = this, config = $$.config, - gridValues = $$.yAxis.tickValues() || $$.y.ticks(config.grid_y_ticks); - $$.ygrid = $$.main.select('.' + CLASS.ygrids).selectAll('.' + CLASS.ygrid) - .data(gridValues); - $$.ygrid.enter().append('line') - .attr('class', CLASS.ygrid); - $$.ygrid.attr('x1', config.axis_rotated ? $$.y : 0) - .attr('x2', config.axis_rotated ? $$.y : $$.width) - .attr('y1', config.axis_rotated ? 0 : $$.y) - .attr('y2', config.axis_rotated ? $$.height : $$.y); - $$.ygrid.exit().remove(); - $$.smoothLines($$.ygrid, 'grid'); -}; - -c3_chart_internal_fn.gridTextAnchor = function (d) { - return d.position ? d.position : 'end'; -}; -c3_chart_internal_fn.gridTextDx = function (d) { - return d.position === 'start' ? 4 : d.position === 'middle' ? 0 : -4; -}; -c3_chart_internal_fn.xGridTextX = function (d) { - return d.position === 'start' ? -this.height : d.position === 'middle' ? -this.height / 2 : 0; -}; -c3_chart_internal_fn.yGridTextX = function (d) { - return d.position === 'start' ? 0 : d.position === 'middle' ? this.width / 2 : this.width; -}; -c3_chart_internal_fn.updateGrid = function (duration) { - let $$ = this, main = $$.main, config = $$.config, - xgridLine, ygridLine, yv; - - // hide if arc type - $$.grid.style('visibility', $$.hasArcType() ? 'hidden' : 'visible'); - - main.select('line.' + CLASS.xgridFocus).style('visibility', 'hidden'); - if (config.grid_x_show) { - $$.updateXGrid(); - } - $$.xgridLines = main.select('.' + CLASS.xgridLines).selectAll('.' + CLASS.xgridLine) - .data(config.grid_x_lines); - // enter - xgridLine = $$.xgridLines.enter().append('g') - .attr('class', (d) => { return CLASS.xgridLine + (d.class ? ' ' + d.class : ''); }); - xgridLine.append('line') - .style('opacity', 0); - xgridLine.append('text') - .attr('text-anchor', $$.gridTextAnchor) - .attr('transform', config.axis_rotated ? '' : 'rotate(-90)') - .attr('dx', $$.gridTextDx) - .attr('dy', -5) - .style('opacity', 0); - // udpate - // done in d3.transition() of the end of this function - // exit - $$.xgridLines.exit().transition().duration(duration) - .style('opacity', 0) - .remove(); - - // Y-Grid - if (config.grid_y_show) { - $$.updateYGrid(); - } - $$.ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine) - .data(config.grid_y_lines); - // enter - ygridLine = $$.ygridLines.enter().append('g') - .attr('class', (d) => { return CLASS.ygridLine + (d.class ? ' ' + d.class : ''); }); - ygridLine.append('line') - .style('opacity', 0); - ygridLine.append('text') - .attr('text-anchor', $$.gridTextAnchor) - .attr('transform', config.axis_rotated ? 'rotate(-90)' : '') - .attr('dx', $$.gridTextDx) - .attr('dy', -5) - .style('opacity', 0); - // update - yv = $$.yv.bind($$); - $$.ygridLines.select('line') - .transition().duration(duration) - .attr('x1', config.axis_rotated ? yv : 0) - .attr('x2', config.axis_rotated ? yv : $$.width) - .attr('y1', config.axis_rotated ? 0 : yv) - .attr('y2', config.axis_rotated ? $$.height : yv) - .style('opacity', 1); - $$.ygridLines.select('text') - .transition().duration(duration) - .attr('x', config.axis_rotated ? $$.xGridTextX.bind($$) : $$.yGridTextX.bind($$)) - .attr('y', yv) - .text((d) => { return d.text; }) - .style('opacity', 1); - // exit - $$.ygridLines.exit().transition().duration(duration) - .style('opacity', 0) - .remove(); -}; -c3_chart_internal_fn.redrawGrid = function (withTransition) { - let $$ = this, config = $$.config, xv = $$.xv.bind($$), - lines = $$.xgridLines.select('line'), - texts = $$.xgridLines.select('text'); - return [ - (withTransition ? lines.transition() : lines) - .attr('x1', config.axis_rotated ? 0 : xv) - .attr('x2', config.axis_rotated ? $$.width : xv) - .attr('y1', config.axis_rotated ? xv : 0) - .attr('y2', config.axis_rotated ? xv : $$.height) - .style('opacity', 1), - (withTransition ? texts.transition() : texts) - .attr('x', config.axis_rotated ? $$.yGridTextX.bind($$) : $$.xGridTextX.bind($$)) - .attr('y', xv) - .text((d) => { return d.text; }) - .style('opacity', 1), - ]; -}; -c3_chart_internal_fn.showXGridFocus = function (selectedData) { - let $$ = this, config = $$.config, - dataToShow = selectedData.filter((d) => { return d && isValue(d.value); }), - focusEl = $$.main.selectAll('line.' + CLASS.xgridFocus), - xx = $$.xx.bind($$); - if (!config.tooltip_show) { return; } - // Hide when scatter plot exists - if ($$.hasType('scatter') || $$.hasArcType()) { return; } - focusEl - .style('visibility', 'visible') - .data([dataToShow[0]]) - .attr(config.axis_rotated ? 'y1' : 'x1', xx) - .attr(config.axis_rotated ? 'y2' : 'x2', xx); - $$.smoothLines(focusEl, 'grid'); -}; -c3_chart_internal_fn.hideXGridFocus = function () { - this.main.select('line.' + CLASS.xgridFocus).style('visibility', 'hidden'); -}; -c3_chart_internal_fn.updateXgridFocus = function () { - let $$ = this, config = $$.config; - $$.main.select('line.' + CLASS.xgridFocus) - .attr('x1', config.axis_rotated ? 0 : -10) - .attr('x2', config.axis_rotated ? $$.width : -10) - .attr('y1', config.axis_rotated ? -10 : 0) - .attr('y2', config.axis_rotated ? -10 : $$.height); -}; -c3_chart_internal_fn.generateGridData = function (type, scale) { - let $$ = this, - gridData = [], xDomain, firstYear, lastYear, i, - tickNum = $$.main.select('.' + CLASS.axisX).selectAll('.tick').size(); - if (type === 'year') { - xDomain = $$.getXDomain(); - firstYear = xDomain[0].getFullYear(); - lastYear = xDomain[1].getFullYear(); - for (i = firstYear; i <= lastYear; i++) { - gridData.push(new Date(i + '-01-01 00:00:00')); - } - } else { - gridData = scale.ticks(10); - if (gridData.length > tickNum) { // use only int - gridData = gridData.filter((d) => { return ('' + d).indexOf('.') < 0; }); - } - } - return gridData; -}; -c3_chart_internal_fn.getGridFilterToRemove = function (params) { - return params ? function (line) { - let found = false; - [].concat(params).forEach((param) => { - if ((('value' in param && line.value === param.value) || ('class' in param && line.class === param.class))) { - found = true; - } - }); - return found; - } : function () { return true; }; -}; -c3_chart_internal_fn.removeGridLines = function (params, forX) { - let $$ = this, config = $$.config, - toRemove = $$.getGridFilterToRemove(params), - toShow = function (line) { return !toRemove(line); }, - classLines = forX ? CLASS.xgridLines : CLASS.ygridLines, - classLine = forX ? CLASS.xgridLine : CLASS.ygridLine; - $$.main.select('.' + classLines).selectAll('.' + classLine).filter(toRemove) - .transition().duration(config.transition_duration) - .style('opacity', 0).remove(); - if (forX) { - config.grid_x_lines = config.grid_x_lines.filter(toShow); - } else { - config.grid_y_lines = config.grid_y_lines.filter(toShow); - } -}; diff --git a/src/chartinternal/index.js b/src/chartinternal/index.js deleted file mode 100644 index 991b9e9..0000000 --- a/src/chartinternal/index.js +++ /dev/null @@ -1,1039 +0,0 @@ -function ChartInternal(api) { - const $$ = this; - $$.d3 = window.d3 ? window.d3 : typeof require !== 'undefined' ? require('d3') : undefined; - $$.api = api; - $$.config = $$.getDefaultConfig(); - $$.data = {}; - $$.cache = {}; - $$.axes = {}; -} - -const c3_chart_internal_fn = ChartInternal.prototype; - -c3_chart_internal_fn.beforeInit = function () { - // can do something -}; -c3_chart_internal_fn.afterInit = function () { - // can do something -}; -c3_chart_internal_fn.init = function () { - let $$ = this, - config = $$.config; - - $$.initParams(); - - if (config.data_url) { - $$.convertUrlToData(config.data_url, config.data_mimeType, config.data_headers, config.data_keys, $$.initWithData); - } else if (config.data_json) { - $$.initWithData($$.convertJsonToData(config.data_json, config.data_keys)); - } else if (config.data_rows) { - $$.initWithData($$.convertRowsToData(config.data_rows)); - } else if (config.data_columns) { - $$.initWithData($$.convertColumnsToData(config.data_columns)); - } else { - throw Error('url or json or rows or columns is required.'); - } -}; - -c3_chart_internal_fn.initParams = function () { - let $$ = this, - d3 = $$.d3, - config = $$.config; - - // MEMO: clipId needs to be unique because it conflicts when multiple charts exist - $$.clipId = 'c3-' + (+new Date()) + '-clip', - $$.clipIdForXAxis = $$.clipId + '-xaxis', - $$.clipIdForYAxis = $$.clipId + '-yaxis', - $$.clipIdForGrid = $$.clipId + '-grid', - $$.clipIdForSubchart = $$.clipId + '-subchart', - $$.clipPath = $$.getClipPath($$.clipId), - $$.clipPathForXAxis = $$.getClipPath($$.clipIdForXAxis), - $$.clipPathForYAxis = $$.getClipPath($$.clipIdForYAxis); - $$.clipPathForGrid = $$.getClipPath($$.clipIdForGrid), - $$.clipPathForSubchart = $$.getClipPath($$.clipIdForSubchart), - - $$.dragStart = null; - $$.dragging = false; - $$.flowing = false; - $$.cancelClick = false; - $$.mouseover = false; - $$.transiting = false; - - $$.color = $$.generateColor(); - $$.levelColor = $$.generateLevelColor(); - - $$.dataTimeFormat = config.data_xLocaltime ? d3.time.format : d3.time.format.utc; - $$.axisTimeFormat = config.axis_x_localtime ? d3.time.format : d3.time.format.utc; - $$.defaultAxisTimeFormat = $$.axisTimeFormat.multi([ - ['.%L', function (d) { - return d.getMilliseconds(); - }], - [':%S', function (d) { - return d.getSeconds(); - }], - ['%I:%M', function (d) { - return d.getMinutes(); - }], - ['%I %p', function (d) { - return d.getHours(); - }], - ['%-m/%-d', function (d) { - return d.getDay() && d.getDate() !== 1; - }], - ['%-m/%-d', function (d) { - return d.getDate() !== 1; - }], - ['%-m/%-d', function (d) { - return d.getMonth(); - }], - ['%Y/%-m/%-d', function () { - return true; - }], - ]); - - $$.hiddenTargetIds = []; - $$.hiddenLegendIds = []; - $$.focusedTargetIds = []; - $$.defocusedTargetIds = []; - - $$.xOrient = config.axis_rotated ? 'left' : 'bottom'; - $$.yOrient = config.axis_rotated ? (config.axis_y_inner ? 'top' : 'bottom') : (config.axis_y_inner ? 'right' : 'left'); - $$.y2Orient = config.axis_rotated ? (config.axis_y2_inner ? 'bottom' : 'top') : (config.axis_y2_inner ? 'left' : 'right'); - $$.subXOrient = config.axis_rotated ? 'left' : 'bottom'; - - $$.isLegendRight = config.legend_position === 'right'; - $$.isLegendInset = config.legend_position === 'inset'; - $$.isLegendTop = config.legend_inset_anchor === 'top-left' || config.legend_inset_anchor === 'top-right'; - $$.isLegendLeft = config.legend_inset_anchor === 'top-left' || config.legend_inset_anchor === 'bottom-left'; - $$.legendStep = 0; - $$.legendItemWidth = 0; - $$.legendItemHeight = 0; - - $$.currentMaxTickWidths = { - x: 0, - y: 0, - y2: 0, - }; - - $$.rotated_padding_left = 30; - $$.rotated_padding_right = config.axis_rotated && !config.axis_x_show ? 0 : 30; - $$.rotated_padding_top = 5; - - $$.withoutFadeIn = {}; - - $$.intervalForObserveInserted = undefined; - - $$.axes.subx = d3.selectAll([]); // needs when excluding subchart.js -}; - -c3_chart_internal_fn.initChartElements = function () { - if (this.initBar) { this.initBar(); } - if (this.initLine) { this.initLine(); } - if (this.initArc) { this.initArc(); } - if (this.initGauge) { this.initGauge(); } - if (this.initText) { this.initText(); } -}; - -c3_chart_internal_fn.initWithData = function (data) { - let $$ = this, - d3 = $$.d3, - config = $$.config; - let defs, main, binding = true; - - $$.axis = new Axis($$); - - if ($$.initPie) { $$.initPie(); } - if ($$.initBrush) { $$.initBrush(); } - if ($$.initZoom) { $$.initZoom(); } - - if (!config.bindto) { - $$.selectChart = d3.selectAll([]); - } else if (typeof config.bindto.node === 'function') { - $$.selectChart = config.bindto; - } else { - $$.selectChart = d3.select(config.bindto); - } - if ($$.selectChart.empty()) { - $$.selectChart = d3.select(document.createElement('div')).style('opacity', 0); - $$.observeInserted($$.selectChart); - binding = false; - } - $$.selectChart.html('').classed('c3', true); - - // Init data as targets - $$.data.xs = {}; - $$.data.targets = $$.convertDataToTargets(data); - - if (config.data_filter) { - $$.data.targets = $$.data.targets.filter(config.data_filter); - } - - // Set targets to hide if needed - if (config.data_hide) { - $$.addHiddenTargetIds(config.data_hide === true ? $$.mapToIds($$.data.targets) : config.data_hide); - } - if (config.legend_hide) { - $$.addHiddenLegendIds(config.legend_hide === true ? $$.mapToIds($$.data.targets) : config.legend_hide); - } - - // when gauge, hide legend // TODO: fix - if ($$.hasType('gauge')) { - config.legend_show = false; - } - - // Init sizes and scales - $$.updateSizes(); - $$.updateScales(); - - // Set domains for each scale - $$.x.domain(d3.extent($$.getXDomain($$.data.targets))); - $$.y.domain($$.getYDomain($$.data.targets, 'y')); - $$.y2.domain($$.getYDomain($$.data.targets, 'y2')); - $$.subX.domain($$.x.domain()); - $$.subY.domain($$.y.domain()); - $$.subY2.domain($$.y2.domain()); - - // Save original x domain for zoom update - $$.orgXDomain = $$.x.domain(); - - // Set initialized scales to brush and zoom - if ($$.brush) { $$.brush.scale($$.subX); } - if (config.zoom_enabled) { $$.zoom.scale($$.x); } - - /* -- Basic Elements --*/ - - // Define svgs - $$.svg = $$.selectChart.append('svg') - .style('overflow', 'hidden') - .on('mouseenter', () => { - return config.onmouseover.call($$); - }) - .on('mouseleave', () => { - return config.onmouseout.call($$); - }); - - if ($$.config.svg_classname) { - $$.svg.attr('class', $$.config.svg_classname); - } - - // Define defs - defs = $$.svg.append('defs'); - $$.clipChart = $$.appendClip(defs, $$.clipId); - $$.clipXAxis = $$.appendClip(defs, $$.clipIdForXAxis); - $$.clipYAxis = $$.appendClip(defs, $$.clipIdForYAxis); - $$.clipGrid = $$.appendClip(defs, $$.clipIdForGrid); - $$.clipSubchart = $$.appendClip(defs, $$.clipIdForSubchart); - $$.updateSvgSize(); - - // Define regions - main = $$.main = $$.svg.append('g').attr('transform', $$.getTranslate('main')); - - if ($$.initSubchart) { $$.initSubchart(); } - if ($$.initTooltip) { $$.initTooltip(); } - if ($$.initLegend) { $$.initLegend(); } - if ($$.initTitle) { $$.initTitle(); } - - /* -- Main Region --*/ - - // text when empty - main.append('text') - .attr('class', CLASS.text + ' ' + CLASS.empty) - .attr('text-anchor', 'middle') // horizontal centering of text at x position in all browsers. - .attr('dominant-baseline', 'middle'); // vertical centering of text at y position in all browsers, except IE. - - // Regions - $$.initRegion(); - - // Grids - $$.initGrid(); - - // Define g for chart area - main.append('g') - .attr('clip-path', $$.clipPath) - .attr('class', CLASS.chart); - - // Grid lines - if (config.grid_lines_front) { $$.initGridLines(); } - - // Cover whole with rects for events - $$.initEventRect(); - - // Define g for chart - $$.initChartElements(); - - // if zoom privileged, insert rect to forefront - // TODO: is this needed? - main.insert('rect', config.zoom_privileged ? null : 'g.' + CLASS.regions) - .attr('class', CLASS.zoomRect) - .attr('width', $$.width) - .attr('height', $$.height) - .style('opacity', 0) - .on('dblclick.zoom', null); - - // Set default extent if defined - if (config.axis_x_extent) { $$.brush.extent($$.getDefaultExtent()); } - - // Add Axis - $$.axis.init(); - - // Set targets - $$.updateTargets($$.data.targets); - - // Draw with targets - if (binding) { - $$.updateDimension(); - $$.config.oninit.call($$); - $$.redraw({ - withTransition: false, - withTransform: true, - withUpdateXDomain: true, - withUpdateOrgXDomain: true, - withTransitionForAxis: false, - }); - } - - // Bind resize event - $$.bindResize(); - - // export element of the chart - $$.api.element = $$.selectChart.node(); -}; - -c3_chart_internal_fn.smoothLines = function (el, type) { - const $$ = this; - if (type === 'grid') { - el.each(function () { - let g = $$.d3.select(this), - x1 = g.attr('x1'), - x2 = g.attr('x2'), - y1 = g.attr('y1'), - y2 = g.attr('y2'); - g.attr({ - 'x1': Math.ceil(x1), - 'x2': Math.ceil(x2), - 'y1': Math.ceil(y1), - 'y2': Math.ceil(y2), - }); - }); - } -}; - - -c3_chart_internal_fn.updateSizes = function () { - let $$ = this, - config = $$.config; - let legendHeight = $$.legend ? $$.getLegendHeight() : 0, - legendWidth = $$.legend ? $$.getLegendWidth() : 0, - legendHeightForBottom = $$.isLegendRight || $$.isLegendInset ? 0 : legendHeight, - hasArc = $$.hasArcType(), - xAxisHeight = config.axis_rotated || hasArc ? 0 : $$.getHorizontalAxisHeight('x'), - subchartHeight = config.subchart_show && !hasArc ? (config.subchart_size_height + xAxisHeight) : 0; - - $$.currentWidth = $$.getCurrentWidth(); - $$.currentHeight = $$.getCurrentHeight(); - - // for main - $$.margin = config.axis_rotated ? { - top: $$.getHorizontalAxisHeight('y2') + $$.getCurrentPaddingTop(), - right: hasArc ? 0 : $$.getCurrentPaddingRight(), - bottom: $$.getHorizontalAxisHeight('y') + legendHeightForBottom + $$.getCurrentPaddingBottom(), - left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft()), - } : { - top: 4 + $$.getCurrentPaddingTop(), // for top tick text - right: hasArc ? 0 : $$.getCurrentPaddingRight(), - bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(), - left: hasArc ? 0 : $$.getCurrentPaddingLeft(), - }; - - // for subchart - $$.margin2 = config.axis_rotated ? { - top: $$.margin.top, - right: NaN, - bottom: 20 + legendHeightForBottom, - left: $$.rotated_padding_left, - } : { - top: $$.currentHeight - subchartHeight - legendHeightForBottom, - right: NaN, - bottom: xAxisHeight + legendHeightForBottom, - left: $$.margin.left, - }; - - // for legend - $$.margin3 = { - top: 0, - right: NaN, - bottom: 0, - left: 0, - }; - if ($$.updateSizeForLegend) { $$.updateSizeForLegend(legendHeight, legendWidth); } - - $$.width = $$.currentWidth - $$.margin.left - $$.margin.right; - $$.height = $$.currentHeight - $$.margin.top - $$.margin.bottom; - if ($$.width < 0) { $$.width = 0; } - if ($$.height < 0) { $$.height = 0; } - - $$.width2 = config.axis_rotated ? $$.margin.left - $$.rotated_padding_left - $$.rotated_padding_right : $$.width; - $$.height2 = config.axis_rotated ? $$.height : $$.currentHeight - $$.margin2.top - $$.margin2.bottom; - if ($$.width2 < 0) { $$.width2 = 0; } - if ($$.height2 < 0) { $$.height2 = 0; } - - // for arc - $$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0); - $$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10); - if ($$.hasType('gauge') && !config.gauge_fullCircle) { - $$.arcHeight += $$.height - $$.getGaugeLabelHeight(); - } - if ($$.updateRadius) { $$.updateRadius(); } - - if ($$.isLegendRight && hasArc) { - $$.margin3.left = $$.arcWidth / 2 + $$.radiusExpanded * 1.1; - } -}; - -c3_chart_internal_fn.updateTargets = function (targets) { - const $$ = this; - - /* -- Main --*/ - - // -- Text --// - $$.updateTargetsForText(targets); - - // -- Bar --// - $$.updateTargetsForBar(targets); - - // -- Line --// - $$.updateTargetsForLine(targets); - - // -- Arc --// - if ($$.hasArcType() && $$.updateTargetsForArc) { $$.updateTargetsForArc(targets); } - - /* -- Sub --*/ - - if ($$.updateTargetsForSubchart) { $$.updateTargetsForSubchart(targets); } - - // Fade-in each chart - $$.showTargets(); -}; -c3_chart_internal_fn.showTargets = function () { - const $$ = this; - $$.svg.selectAll('.' + CLASS.target).filter((d) => { - return $$.isTargetToShow(d.id); - }) - .transition().duration($$.config.transition_duration) - .style('opacity', 1); -}; - -c3_chart_internal_fn.redraw = function (options, transitions) { - let $$ = this, - main = $$.main, - d3 = $$.d3, - config = $$.config; - let areaIndices = $$.getShapeIndices($$.isAreaType), - barIndices = $$.getShapeIndices($$.isBarType), - lineIndices = $$.getShapeIndices($$.isLineType); - let withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, - withTransform, withUpdateXDomain, withUpdateOrgXDomain, withTrimXDomain, withLegend, - withEventRect, withDimension, withUpdateXAxis; - const hideAxis = $$.hasArcType(); - let drawArea, drawBar, drawLine, xForText, yForText; - let duration, durationForExit, durationForAxis; - let waitForDraw, flow; - let targetsToShow = $$.filterTargetsToShow($$.data.targets), - tickValues, i, intervalForCulling, xDomainForZoom; - let xv = $$.xv.bind($$), - cx, cy; - - options = options || {}; - withY = getOption(options, 'withY', true); - withSubchart = getOption(options, 'withSubchart', true); - withTransition = getOption(options, 'withTransition', true); - withTransform = getOption(options, 'withTransform', false); - withUpdateXDomain = getOption(options, 'withUpdateXDomain', false); - withUpdateOrgXDomain = getOption(options, 'withUpdateOrgXDomain', false); - withTrimXDomain = getOption(options, 'withTrimXDomain', true); - withUpdateXAxis = getOption(options, 'withUpdateXAxis', withUpdateXDomain); - withLegend = getOption(options, 'withLegend', false); - withEventRect = getOption(options, 'withEventRect', true); - withDimension = getOption(options, 'withDimension', true); - withTransitionForExit = getOption(options, 'withTransitionForExit', withTransition); - withTransitionForAxis = getOption(options, 'withTransitionForAxis', withTransition); - - duration = withTransition ? config.transition_duration : 0; - durationForExit = withTransitionForExit ? duration : 0; - durationForAxis = withTransitionForAxis ? duration : 0; - - transitions = transitions || $$.axis.generateTransitions(durationForAxis); - - // update legend and transform each g - if (withLegend && config.legend_show) { - $$.updateLegend($$.mapToIds($$.data.targets), options, transitions); - } else if (withDimension) { - // need to update dimension (e.g. axis.y.tick.values) because y tick values should change - // no need to update axis in it because they will be updated in redraw() - $$.updateDimension(true); - } - - // MEMO: needed for grids calculation - if ($$.isCategorized() && targetsToShow.length === 0) { - $$.x.domain([0, $$.axes.x.selectAll('.tick').size()]); - } - - if (targetsToShow.length) { - $$.updateXDomain(targetsToShow, withUpdateXDomain, withUpdateOrgXDomain, withTrimXDomain); - if (!config.axis_x_tick_values) { - tickValues = $$.axis.updateXAxisTickValues(targetsToShow); - } - } else { - $$.xAxis.tickValues([]); - $$.subXAxis.tickValues([]); - } - - if (config.zoom_rescale && !options.flow) { - xDomainForZoom = $$.x.orgDomain(); - } - - $$.y.domain($$.getYDomain(targetsToShow, 'y', xDomainForZoom)); - $$.y2.domain($$.getYDomain(targetsToShow, 'y2', xDomainForZoom)); - - if (!config.axis_y_tick_values && config.axis_y_tick_count) { - $$.yAxis.tickValues($$.axis.generateTickValues($$.y.domain(), config.axis_y_tick_count)); - } - if (!config.axis_y2_tick_values && config.axis_y2_tick_count) { - $$.y2Axis.tickValues($$.axis.generateTickValues($$.y2.domain(), config.axis_y2_tick_count)); - } - - // axes - $$.axis.redraw(transitions, hideAxis); - - // Update axis label - $$.axis.updateLabels(withTransition); - - // show/hide if manual culling needed - if ((withUpdateXDomain || withUpdateXAxis) && targetsToShow.length) { - if (config.axis_x_tick_culling && tickValues) { - for (i = 1; i < tickValues.length; i++) { - if (tickValues.length / i < config.axis_x_tick_culling_max) { - intervalForCulling = i; - break; - } - } - $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) { - const index = tickValues.indexOf(e); - if (index >= 0) { - d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); - } - }); - } else { - $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block'); - } - } - - // setup drawer - MEMO: these must be called after axis updated - drawArea = $$.generateDrawArea ? $$.generateDrawArea(areaIndices, false) : undefined; - drawBar = $$.generateDrawBar ? $$.generateDrawBar(barIndices) : undefined; - drawLine = $$.generateDrawLine ? $$.generateDrawLine(lineIndices, false) : undefined; - xForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, true); - yForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, false); - - // Update sub domain - if (withY) { - $$.subY.domain($$.getYDomain(targetsToShow, 'y')); - $$.subY2.domain($$.getYDomain(targetsToShow, 'y2')); - } - - // xgrid focus - $$.updateXgridFocus(); - - // Data empty label positioning and text. - main.select('text.' + CLASS.text + '.' + CLASS.empty) - .attr('x', $$.width / 2) - .attr('y', $$.height / 2) - .text(config.data_empty_label_text) - .transition() - .style('opacity', targetsToShow.length ? 0 : 1); - - // grid - $$.updateGrid(duration); - - // rect for regions - $$.updateRegion(duration); - - // bars - $$.updateBar(durationForExit); - - // lines, areas and cricles - $$.updateLine(durationForExit); - $$.updateArea(durationForExit); - $$.updateCircle(); - - // text - if ($$.hasDataLabel()) { - $$.updateText(durationForExit); - } - - // title - if ($$.redrawTitle) { $$.redrawTitle(); } - - // arc - if ($$.redrawArc) { $$.redrawArc(duration, durationForExit, withTransform); } - - // subchart - if ($$.redrawSubchart) { - $$.redrawSubchart(withSubchart, transitions, duration, durationForExit, areaIndices, barIndices, lineIndices); - } - - // circles for select - main.selectAll('.' + CLASS.selectedCircles) - .filter($$.isBarType.bind($$)) - .selectAll('circle') - .remove(); - - // event rects will redrawn when flow called - if (config.interaction_enabled && !options.flow && withEventRect) { - $$.redrawEventRect(); - if ($$.updateZoom) { $$.updateZoom(); } - } - - // update circleY based on updated parameters - $$.updateCircleY(); - - // generate circle x/y functions depending on updated params - cx = ($$.config.axis_rotated ? $$.circleY : $$.circleX).bind($$); - cy = ($$.config.axis_rotated ? $$.circleX : $$.circleY).bind($$); - - if (options.flow) { - flow = $$.generateFlow({ - targets: targetsToShow, - flow: options.flow, - duration: options.flow.duration, - drawBar, - drawLine, - drawArea, - cx, - cy, - xv, - xForText, - yForText, - }); - } - - if ((duration || flow) && $$.isTabVisible()) { // Only use transition if tab visible. See #938. - // transition should be derived from one transition - d3.transition().duration(duration).each(() => { - const transitionsToWait = []; - - // redraw and gather transitions - [ - $$.redrawBar(drawBar, true), - $$.redrawLine(drawLine, true), - $$.redrawArea(drawArea, true), - $$.redrawCircle(cx, cy, true), - $$.redrawText(xForText, yForText, options.flow, true), - $$.redrawRegion(true), - $$.redrawGrid(true), - ].forEach((transitions) => { - transitions.forEach((transition) => { - transitionsToWait.push(transition); - }); - }); - - // Wait for end of transitions to call flow and onrendered callback - waitForDraw = $$.generateWait(); - transitionsToWait.forEach((t) => { - waitForDraw.add(t); - }); - }) - .call(waitForDraw, () => { - if (flow) { - flow(); - } - if (config.onrendered) { - config.onrendered.call($$); - } - }); - } else { - $$.redrawBar(drawBar); - $$.redrawLine(drawLine); - $$.redrawArea(drawArea); - $$.redrawCircle(cx, cy); - $$.redrawText(xForText, yForText, options.flow); - $$.redrawRegion(); - $$.redrawGrid(); - if (config.onrendered) { - config.onrendered.call($$); - } - } - - // update fadein condition - $$.mapToIds($$.data.targets).forEach((id) => { - $$.withoutFadeIn[id] = true; - }); -}; - -c3_chart_internal_fn.updateAndRedraw = function (options) { - let $$ = this, - config = $$.config, - transitions; - options = options || {}; - // same with redraw - options.withTransition = getOption(options, 'withTransition', true); - options.withTransform = getOption(options, 'withTransform', false); - options.withLegend = getOption(options, 'withLegend', false); - // NOT same with redraw - options.withUpdateXDomain = true; - options.withUpdateOrgXDomain = true; - options.withTransitionForExit = false; - options.withTransitionForTransform = getOption(options, 'withTransitionForTransform', options.withTransition); - // MEMO: this needs to be called before updateLegend and it means this ALWAYS needs to be called) - $$.updateSizes(); - // MEMO: called in updateLegend in redraw if withLegend - if (!(options.withLegend && config.legend_show)) { - transitions = $$.axis.generateTransitions(options.withTransitionForAxis ? config.transition_duration : 0); - // Update scales - $$.updateScales(); - $$.updateSvgSize(); - // Update g positions - $$.transformAll(options.withTransitionForTransform, transitions); - } - // Draw with new sizes & scales - $$.redraw(options, transitions); -}; -c3_chart_internal_fn.redrawWithoutRescale = function () { - this.redraw({ - withY: false, - withSubchart: false, - withEventRect: false, - withTransitionForAxis: false, - }); -}; - -c3_chart_internal_fn.isTimeSeries = function () { - return this.config.axis_x_type === 'timeseries'; -}; -c3_chart_internal_fn.isCategorized = function () { - return this.config.axis_x_type.indexOf('categor') >= 0; -}; -c3_chart_internal_fn.isCustomX = function () { - let $$ = this, - config = $$.config; - return !$$.isTimeSeries() && (config.data_x || notEmpty(config.data_xs)); -}; - -c3_chart_internal_fn.isTimeSeriesY = function () { - return this.config.axis_y_type === 'timeseries'; -}; - -c3_chart_internal_fn.getTranslate = function (target) { - let $$ = this, - config = $$.config, - x, y; - if (target === 'main') { - x = asHalfPixel($$.margin.left); - y = asHalfPixel($$.margin.top); - } else if (target === 'context') { - x = asHalfPixel($$.margin2.left); - y = asHalfPixel($$.margin2.top); - } else if (target === 'legend') { - x = $$.margin3.left; - y = $$.margin3.top; - } else if (target === 'x') { - x = 0; - y = config.axis_rotated ? 0 : $$.height; - } else if (target === 'y') { - x = 0; - y = config.axis_rotated ? $$.height : 0; - } else if (target === 'y2') { - x = config.axis_rotated ? 0 : $$.width; - y = config.axis_rotated ? 1 : 0; - } else if (target === 'subx') { - x = 0; - y = config.axis_rotated ? 0 : $$.height2; - } else if (target === 'arc') { - x = $$.arcWidth / 2; - y = $$.arcHeight / 2; - } - return 'translate(' + x + ',' + y + ')'; -}; -c3_chart_internal_fn.initialOpacity = function (d) { - return d.value !== null && this.withoutFadeIn[d.id] ? 1 : 0; -}; -c3_chart_internal_fn.initialOpacityForCircle = function (d) { - return d.value !== null && this.withoutFadeIn[d.id] ? this.opacityForCircle(d) : 0; -}; -c3_chart_internal_fn.opacityForCircle = function (d) { - const opacity = this.config.point_show ? 1 : 0; - return isValue(d.value) ? (this.isScatterType(d) ? 0.5 : opacity) : 0; -}; -c3_chart_internal_fn.opacityForText = function () { - return this.hasDataLabel() ? 1 : 0; -}; -c3_chart_internal_fn.xx = function (d) { - return d ? this.x(d.x) : null; -}; -c3_chart_internal_fn.xv = function (d) { - let $$ = this, - value = d.value; - if ($$.isTimeSeries()) { - value = $$.parseDate(d.value); - } else if ($$.isCategorized() && typeof d.value === 'string') { - value = $$.config.axis_x_categories.indexOf(d.value); - } - return Math.ceil($$.x(value)); -}; -c3_chart_internal_fn.yv = function (d) { - let $$ = this, - yScale = d.axis && d.axis === 'y2' ? $$.y2 : $$.y; - return Math.ceil(yScale(d.value)); -}; -c3_chart_internal_fn.subxx = function (d) { - return d ? this.subX(d.x) : null; -}; - -c3_chart_internal_fn.transformMain = function (withTransition, transitions) { - let $$ = this, - xAxis, yAxis, y2Axis; - if (transitions && transitions.axisX) { - xAxis = transitions.axisX; - } else { - xAxis = $$.main.select('.' + CLASS.axisX); - if (withTransition) { xAxis = xAxis.transition(); } - } - if (transitions && transitions.axisY) { - yAxis = transitions.axisY; - } else { - yAxis = $$.main.select('.' + CLASS.axisY); - if (withTransition) { yAxis = yAxis.transition(); } - } - if (transitions && transitions.axisY2) { - y2Axis = transitions.axisY2; - } else { - y2Axis = $$.main.select('.' + CLASS.axisY2); - if (withTransition) { y2Axis = y2Axis.transition(); } - } - (withTransition ? $$.main.transition() : $$.main).attr('transform', $$.getTranslate('main')); - xAxis.attr('transform', $$.getTranslate('x')); - yAxis.attr('transform', $$.getTranslate('y')); - y2Axis.attr('transform', $$.getTranslate('y2')); - $$.main.select('.' + CLASS.chartArcs).attr('transform', $$.getTranslate('arc')); -}; -c3_chart_internal_fn.transformAll = function (withTransition, transitions) { - const $$ = this; - $$.transformMain(withTransition, transitions); - if ($$.config.subchart_show) { $$.transformContext(withTransition, transitions); } - if ($$.legend) { $$.transformLegend(withTransition); } -}; - -c3_chart_internal_fn.updateSvgSize = function () { - let $$ = this, - brush = $$.svg.select('.c3-brush .background'); - $$.svg.attr('width', $$.currentWidth).attr('height', $$.currentHeight); - $$.svg.selectAll(['#' + $$.clipId, '#' + $$.clipIdForGrid]).select('rect') - .attr('width', $$.width) - .attr('height', $$.height); - $$.svg.select('#' + $$.clipIdForXAxis).select('rect') - .attr('x', $$.getXAxisClipX.bind($$)) - .attr('y', $$.getXAxisClipY.bind($$)) - .attr('width', $$.getXAxisClipWidth.bind($$)) - .attr('height', $$.getXAxisClipHeight.bind($$)); - $$.svg.select('#' + $$.clipIdForYAxis).select('rect') - .attr('x', $$.getYAxisClipX.bind($$)) - .attr('y', $$.getYAxisClipY.bind($$)) - .attr('width', $$.getYAxisClipWidth.bind($$)) - .attr('height', $$.getYAxisClipHeight.bind($$)); - $$.svg.select('#' + $$.clipIdForSubchart).select('rect') - .attr('width', $$.width) - .attr('height', brush.size() ? brush.attr('height') : 0); - $$.svg.select('.' + CLASS.zoomRect) - .attr('width', $$.width) - .attr('height', $$.height); - // MEMO: parent div's height will be bigger than svg when - $$.selectChart.style('max-height', $$.currentHeight + 'px'); -}; - - -c3_chart_internal_fn.updateDimension = function (withoutAxis) { - const $$ = this; - if (!withoutAxis) { - if ($$.config.axis_rotated) { - $$.axes.x.call($$.xAxis); - $$.axes.subx.call($$.subXAxis); - } else { - $$.axes.y.call($$.yAxis); - $$.axes.y2.call($$.y2Axis); - } - } - $$.updateSizes(); - $$.updateScales(); - $$.updateSvgSize(); - $$.transformAll(false); -}; - -c3_chart_internal_fn.observeInserted = function (selection) { - let $$ = this, - observer; - if (typeof MutationObserver === 'undefined') { - window.console.error('MutationObserver not defined.'); - return; - } - observer = new MutationObserver((mutations) => { - mutations.forEach((mutation) => { - if (mutation.type === 'childList' && mutation.previousSibling) { - observer.disconnect(); - // need to wait for completion of load because size calculation requires the actual sizes determined after that completion - $$.intervalForObserveInserted = window.setInterval(() => { - // parentNode will NOT be null when completed - if (selection.node().parentNode) { - window.clearInterval($$.intervalForObserveInserted); - $$.updateDimension(); - if ($$.brush) { $$.brush.update(); } - $$.config.oninit.call($$); - $$.redraw({ - withTransform: true, - withUpdateXDomain: true, - withUpdateOrgXDomain: true, - withTransition: false, - withTransitionForTransform: false, - withLegend: true, - }); - selection.transition().style('opacity', 1); - } - }, 10); - } - }); - }); - observer.observe(selection.node(), { attributes: true, childList: true, characterData: true }); -}; - -c3_chart_internal_fn.bindResize = function () { - let $$ = this, - config = $$.config; - - $$.resizeFunction = $$.generateResize(); - - $$.resizeFunction.add(() => { - config.onresize.call($$); - }); - if (config.resize_auto) { - $$.resizeFunction.add(() => { - if ($$.resizeTimeout !== undefined) { - window.clearTimeout($$.resizeTimeout); - } - $$.resizeTimeout = window.setTimeout(() => { - delete $$.resizeTimeout; - $$.api.flush(); - }, 100); - }); - } - $$.resizeFunction.add(() => { - config.onresized.call($$); - }); - - if (window.attachEvent) { - window.attachEvent('onresize', $$.resizeFunction); - } else if (window.addEventListener) { - window.addEventListener('resize', $$.resizeFunction, false); - } else { - // fallback to this, if this is a very old browser - let wrapper = window.onresize; - if (!wrapper) { - // create a wrapper that will call all charts - wrapper = $$.generateResize(); - } else if (!wrapper.add || !wrapper.remove) { - // there is already a handler registered, make sure we call it too - wrapper = $$.generateResize(); - wrapper.add(window.onresize); - } - // add this graph to the wrapper, we will be removed if the user calls destroy - wrapper.add($$.resizeFunction); - window.onresize = wrapper; - } -}; - -c3_chart_internal_fn.generateResize = function () { - const resizeFunctions = []; - - function callResizeFunctions() { - resizeFunctions.forEach((f) => { - f(); - }); - } - callResizeFunctions.add = function (f) { - resizeFunctions.push(f); - }; - callResizeFunctions.remove = function (f) { - for (let i = 0; i < resizeFunctions.length; i++) { - if (resizeFunctions[i] === f) { - resizeFunctions.splice(i, 1); - break; - } - } - }; - return callResizeFunctions; -}; - -c3_chart_internal_fn.endall = function (transition, callback) { - let n = 0; - transition - .each(() => { ++n; }) - .each('end', function () { - if (!--n) { callback.apply(this, arguments); } - }); -}; -c3_chart_internal_fn.generateWait = function () { - let transitionsToWait = [], - f = function (transition, callback) { - const timer = setInterval(() => { - let done = 0; - transitionsToWait.forEach((t) => { - if (t.empty()) { - done += 1; - return; - } - try { - t.transition(); - } catch (e) { - done += 1; - } - }); - if (done === transitionsToWait.length) { - clearInterval(timer); - if (callback) { callback(); } - } - }, 10); - }; - f.add = function (transition) { - transitionsToWait.push(transition); - }; - return f; -}; - -c3_chart_internal_fn.parseDate = function (date) { - let $$ = this, - parsedDate; - if (date instanceof Date) { - parsedDate = date; - } else if (typeof date === 'string') { - parsedDate = $$.dataTimeFormat($$.config.data_xFormat).parse(date); - } else if (typeof date === 'number' && !isNaN(date)) { - parsedDate = new Date(+date); - } - if (!parsedDate || isNaN(+parsedDate)) { - window.console.error("Failed to parse x '" + date + "' to Date object"); - } - return parsedDate; -}; - -c3_chart_internal_fn.isTabVisible = function () { - let hidden; - if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support - hidden = 'hidden'; - } else if (typeof document.mozHidden !== 'undefined') { - hidden = 'mozHidden'; - } else if (typeof document.msHidden !== 'undefined') { - hidden = 'msHidden'; - } else if (typeof document.webkitHidden !== 'undefined') { - hidden = 'webkitHidden'; - } - - return document[hidden] ? false : true; -}; diff --git a/src/chartinternal/interaction.js b/src/chartinternal/interaction.js deleted file mode 100644 index 1792237..0000000 --- a/src/chartinternal/interaction.js +++ /dev/null @@ -1,400 +0,0 @@ -c3_chart_internal_fn.initEventRect = function () { - const $$ = this; - $$.main.select('.' + CLASS.chart).append('g') - .attr('class', CLASS.eventRects) - .style('fill-opacity', 0); -}; -c3_chart_internal_fn.redrawEventRect = function () { - let $$ = this, config = $$.config, - eventRectUpdate, maxDataCountTarget, - isMultipleX = $$.isMultipleX(); - - // rects for mouseover - const eventRects = $$.main.select('.' + CLASS.eventRects) - .style('cursor', config.zoom_enabled ? config.axis_rotated ? 'ns-resize' : 'ew-resize' : null) - .classed(CLASS.eventRectsMultiple, isMultipleX) - .classed(CLASS.eventRectsSingle, !isMultipleX); - - // clear old rects - eventRects.selectAll('.' + CLASS.eventRect).remove(); - - // open as public variable - $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect); - - if (isMultipleX) { - eventRectUpdate = $$.eventRect.data([0]); - // enter : only one rect will be added - $$.generateEventRectsForMultipleXs(eventRectUpdate.enter()); - // update - $$.updateEventRect(eventRectUpdate); - // exit : not needed because always only one rect exists - } - else { - // Set data and update $$.eventRect - maxDataCountTarget = $$.getMaxDataCountTarget($$.data.targets); - eventRects.datum(maxDataCountTarget ? maxDataCountTarget.values : []); - $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect); - eventRectUpdate = $$.eventRect.data((d) => { return d; }); - // enter - $$.generateEventRectsForSingleX(eventRectUpdate.enter()); - // update - $$.updateEventRect(eventRectUpdate); - // exit - eventRectUpdate.exit().remove(); - } -}; -c3_chart_internal_fn.updateEventRect = function (eventRectUpdate) { - let $$ = this, config = $$.config, - x, y, w, h, rectW, rectX; - - // set update selection if null - eventRectUpdate = eventRectUpdate || $$.eventRect.data((d) => { return d; }); - - if ($$.isMultipleX()) { - // TODO: rotated not supported yet - x = 0; - y = 0; - w = $$.width; - h = $$.height; - } - else { - if (($$.isCustomX() || $$.isTimeSeries()) && !$$.isCategorized()) { - // update index for x that is used by prevX and nextX - $$.updateXs(); - - rectW = function (d) { - let prevX = $$.getPrevX(d.index), nextX = $$.getNextX(d.index); - - // if there this is a single data point make the eventRect full width (or height) - if (prevX === null && nextX === null) { - return config.axis_rotated ? $$.height : $$.width; - } - - if (prevX === null) { prevX = $$.x.domain()[0]; } - if (nextX === null) { nextX = $$.x.domain()[1]; } - - return Math.max(0, ($$.x(nextX) - $$.x(prevX)) / 2); - }; - rectX = function (d) { - let prevX = $$.getPrevX(d.index), nextX = $$.getNextX(d.index), - thisX = $$.data.xs[d.id][d.index]; - - // if there this is a single data point position the eventRect at 0 - if (prevX === null && nextX === null) { - return 0; - } - - if (prevX === null) { prevX = $$.x.domain()[0]; } - - return ($$.x(thisX) + $$.x(prevX)) / 2; - }; - } else { - rectW = $$.getEventRectWidth(); - rectX = function (d) { - return $$.x(d.x) - (rectW / 2); - }; - } - x = config.axis_rotated ? 0 : rectX; - y = config.axis_rotated ? rectX : 0; - w = config.axis_rotated ? $$.width : rectW; - h = config.axis_rotated ? rectW : $$.height; - } - - eventRectUpdate - .attr('class', $$.classEvent.bind($$)) - .attr('x', x) - .attr('y', y) - .attr('width', w) - .attr('height', h); -}; -c3_chart_internal_fn.generateEventRectsForSingleX = function (eventRectEnter) { - let $$ = this, d3 = $$.d3, config = $$.config, - tap = false, tapX; - - function click(shape, d) { - let index = d.index; - if ($$.hasArcType() || !$$.toggleShape) { return; } - if ($$.cancelClick) { - $$.cancelClick = false; - return; - } - if ($$.isStepType(d) && config.line_step_type === 'step-after' && d3.mouse(shape)[0] < $$.x($$.getXValue(d.id, index))) { - index -= 1; - } - $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) { - if (config.data_selection_grouped || $$.isWithinShape(this, d)) { - $$.toggleShape(this, d, index); - $$.config.data_onclick.call($$.api, d, this); - } - }); - } - - eventRectEnter.append('rect') - .attr('class', $$.classEvent.bind($$)) - .style('cursor', config.data_selection_enabled && config.data_selection_grouped ? 'pointer' : null) - .on('mouseover', (d) => { - const index = d.index; - - if ($$.dragging || $$.flowing) { return; } // do nothing while dragging/flowing - if ($$.hasArcType()) { return; } - - // Expand shapes for selection - if (config.point_focus_expand_enabled) { $$.expandCircles(index, null, true); } - $$.expandBars(index, null, true); - - // Call event handler - $$.main.selectAll('.' + CLASS.shape + '-' + index).each((d) => { - config.data_onmouseover.call($$.api, d); - }); - }) - .on('mouseout', (d) => { - const index = d.index; - if (!$$.config) { return; } // chart is destroyed - if ($$.hasArcType()) { return; } - $$.hideXGridFocus(); - $$.hideTooltip(); - // Undo expanded shapes - $$.unexpandCircles(); - $$.unexpandBars(); - // Call event handler - $$.main.selectAll('.' + CLASS.shape + '-' + index).each((d) => { - config.data_onmouseout.call($$.api, d); - }); - }) - .on('mousemove', function (d) { - let selectedData, index = d.index, - eventRect = $$.svg.select('.' + CLASS.eventRect + '-' + index); - - if ($$.dragging || $$.flowing) { return; } // do nothing while dragging/flowing - if ($$.hasArcType()) { return; } - - if ($$.isStepType(d) && $$.config.line_step_type === 'step-after' && d3.mouse(this)[0] < $$.x($$.getXValue(d.id, index))) { - index -= 1; - } - - // Show tooltip - selectedData = $$.filterTargetsToShow($$.data.targets).map((t) => { - return $$.addName($$.getValueOnIndex(t.values, index)); - }); - - if (config.tooltip_grouped) { - $$.showTooltip(selectedData, this); - $$.showXGridFocus(selectedData); - } - - if (config.tooltip_grouped && (!config.data_selection_enabled || config.data_selection_grouped)) { - return; - } - - $$.main.selectAll('.' + CLASS.shape + '-' + index) - .each(function () { - d3.select(this).classed(CLASS.EXPANDED, true); - if (config.data_selection_enabled) { - eventRect.style('cursor', config.data_selection_grouped ? 'pointer' : null); - } - if (!config.tooltip_grouped) { - $$.hideXGridFocus(); - $$.hideTooltip(); - if (!config.data_selection_grouped) { - $$.unexpandCircles(index); - $$.unexpandBars(index); - } - } - }) - .filter(function (d) { - return $$.isWithinShape(this, d); - }) - .each(function (d) { - if (config.data_selection_enabled && (config.data_selection_grouped || config.data_selection_isselectable(d))) { - eventRect.style('cursor', 'pointer'); - } - if (!config.tooltip_grouped) { - $$.showTooltip([d], this); - $$.showXGridFocus([d]); - if (config.point_focus_expand_enabled) { $$.expandCircles(index, d.id, true); } - $$.expandBars(index, d.id, true); - } - }); - }) - .on('click', function (d) { - // click event was simulated via a 'tap' touch event, cancel regular click - if (tap) { - return; - } - - click(this, d); - }) - .on('touchstart', (d) => { - // store current X selection for comparison during touch end event - tapX = d.x; - }) - .on('touchend', function (d) { - const finalX = d.x; - - // If end is not the same as the start, event doesn't count as a tap - if (tapX !== finalX) { - return; - } - - - click(this, d); - - // indictate tap event fired to prevent click; - tap = true; - setTimeout(() => { tap = false; }, config.touch_tap_delay); - }) - - .call( - config.data_selection_draggable && $$.drag ? ( - d3.behavior.drag().origin(Object) - .on('drag', function () { $$.drag(d3.mouse(this)); }) - .on('dragstart', function () { $$.dragstart(d3.mouse(this)); }) - .on('dragend', () => { $$.dragend(); }) - ) : () => {} - ); -}; - -c3_chart_internal_fn.generateEventRectsForMultipleXs = function (eventRectEnter) { - let $$ = this, d3 = $$.d3, config = $$.config, - tap = false, tapX, tapY; - - function mouseout() { - $$.svg.select('.' + CLASS.eventRect).style('cursor', null); - $$.hideXGridFocus(); - $$.hideTooltip(); - $$.unexpandCircles(); - $$.unexpandBars(); - } - - function click(shape) { - const targetsToShow = $$.filterTargetsToShow($$.data.targets); - let mouse, closest; - if ($$.hasArcType(targetsToShow)) { return; } - - mouse = d3.mouse(shape); - closest = $$.findClosestFromTargets(targetsToShow, mouse); - if (!closest) { return; } - // select if selection enabled - if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) { - $$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(closest.id)).selectAll('.' + CLASS.shape + '-' + closest.index).each(function () { - if (config.data_selection_grouped || $$.isWithinShape(this, closest)) { - $$.toggleShape(this, closest, closest.index); - $$.config.data_onclick.call($$.api, closest, this); - } - }); - } - } - - eventRectEnter.append('rect') - .attr('x', 0) - .attr('y', 0) - .attr('width', $$.width) - .attr('height', $$.height) - .attr('class', CLASS.eventRect) - .on('mouseout', () => { - if (!$$.config) { return; } // chart is destroyed - if ($$.hasArcType()) { return; } - mouseout(); - }) - .on('mousemove', function () { - const targetsToShow = $$.filterTargetsToShow($$.data.targets); - let mouse, closest, sameXData, selectedData; - - if ($$.dragging) { return; } // do nothing when dragging - if ($$.hasArcType(targetsToShow)) { return; } - - mouse = d3.mouse(this); - closest = $$.findClosestFromTargets(targetsToShow, mouse); - - if ($$.mouseover && (!closest || closest.id !== $$.mouseover.id)) { - config.data_onmouseout.call($$.api, $$.mouseover); - $$.mouseover = undefined; - } - - if (!closest) { - mouseout(); - return; - } - - if ($$.isScatterType(closest) || !config.tooltip_grouped) { - sameXData = [closest]; - } else { - sameXData = $$.filterByX(targetsToShow, closest.x); - } - - // show tooltip when cursor is close to some point - selectedData = sameXData.map((d) => { - return $$.addName(d); - }); - $$.showTooltip(selectedData, this); - - // expand points - if (config.point_focus_expand_enabled) { - $$.expandCircles(closest.index, closest.id, true); - } - $$.expandBars(closest.index, closest.id, true); - - // Show xgrid focus line - $$.showXGridFocus(selectedData); - - // Show cursor as pointer if point is close to mouse position - if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) { - $$.svg.select('.' + CLASS.eventRect).style('cursor', 'pointer'); - if (!$$.mouseover) { - config.data_onmouseover.call($$.api, closest); - $$.mouseover = closest; - } - } - }) - .on('click', function () { - // click event was simulated via a 'tap' touch event, cancel regular click - if (tap) { - return; - } - - click(this); - }) - .on('touchstart', function () { - const mouse = d3.mouse(this); - // store starting coordinates for distance comparision during touch end event - tapX = mouse[0]; - tapY = mouse[1]; - }) - .on('touchend', function () { - let mouse = d3.mouse(this), - x = mouse[0], - y = mouse[1]; - - // If end is too far from start, event doesn't count as a tap - if (Math.abs(x - tapX) > config.touch_tap_radius || Math.abs(y - tapY) > config.touch_tap_radius) { - return; - } - - click(this); - - // indictate tap event fired to prevent click; - tap = true; - setTimeout(() => { tap = false; }, config.touch_tap_delay); - }) - .call( - config.data_selection_draggable && $$.drag ? ( - d3.behavior.drag().origin(Object) - .on('drag', function () { $$.drag(d3.mouse(this)); }) - .on('dragstart', function () { $$.dragstart(d3.mouse(this)); }) - .on('dragend', () => { $$.dragend(); }) - ) : () => {} - ); -}; -c3_chart_internal_fn.dispatchEvent = function (type, index, mouse) { - let $$ = this, - selector = '.' + CLASS.eventRect + (!$$.isMultipleX() ? '-' + index : ''), - eventRect = $$.main.select(selector).node(), - box = eventRect.getBoundingClientRect(), - x = box.left + (mouse ? mouse[0] : 0), - y = box.top + (mouse ? mouse[1] : 0), - event = document.createEvent('MouseEvents'); - - event.initMouseEvent(type, true, true, window, 0, x, y, x, y, - false, false, false, false, 0, null); - eventRect.dispatchEvent(event); -}; diff --git a/src/chartinternal/legend.js b/src/chartinternal/legend.js deleted file mode 100644 index 79c125d..0000000 --- a/src/chartinternal/legend.js +++ /dev/null @@ -1,337 +0,0 @@ -c3_chart_internal_fn.initLegend = function () { - const $$ = this; - $$.legendItemTextBox = {}; - $$.legendHasRendered = false; - $$.legend = $$.svg.append('g').attr('transform', $$.getTranslate('legend')); - if (!$$.config.legend_show) { - $$.legend.style('visibility', 'hidden'); - $$.hiddenLegendIds = $$.mapToIds($$.data.targets); - return; - } - // MEMO: call here to update legend box and tranlate for all - // MEMO: translate will be upated by this, so transform not needed in updateLegend() - $$.updateLegendWithDefaults(); -}; -c3_chart_internal_fn.updateLegendWithDefaults = function () { - const $$ = this; - $$.updateLegend($$.mapToIds($$.data.targets), { withTransform: false, withTransitionForTransform: false, withTransition: false }); -}; -c3_chart_internal_fn.updateSizeForLegend = function (legendHeight, legendWidth) { - let $$ = this, config = $$.config, insetLegendPosition = { - top: $$.isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : $$.currentHeight - legendHeight - $$.getCurrentPaddingBottom() - config.legend_inset_y, - left: $$.isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + 0.5 : $$.currentWidth - legendWidth - $$.getCurrentPaddingRight() - config.legend_inset_x + 0.5, - }; - - $$.margin3 = { - top: $$.isLegendRight ? 0 : $$.isLegendInset ? insetLegendPosition.top : $$.currentHeight - legendHeight, - right: NaN, - bottom: 0, - left: $$.isLegendRight ? $$.currentWidth - legendWidth : $$.isLegendInset ? insetLegendPosition.left : 0, - }; -}; -c3_chart_internal_fn.transformLegend = function (withTransition) { - const $$ = this; - (withTransition ? $$.legend.transition() : $$.legend).attr('transform', $$.getTranslate('legend')); -}; -c3_chart_internal_fn.updateLegendStep = function (step) { - this.legendStep = step; -}; -c3_chart_internal_fn.updateLegendItemWidth = function (w) { - this.legendItemWidth = w; -}; -c3_chart_internal_fn.updateLegendItemHeight = function (h) { - this.legendItemHeight = h; -}; -c3_chart_internal_fn.getLegendWidth = function () { - const $$ = this; - return $$.config.legend_show ? $$.isLegendRight || $$.isLegendInset ? $$.legendItemWidth * ($$.legendStep + 1) : $$.currentWidth : 0; -}; -c3_chart_internal_fn.getLegendHeight = function () { - let $$ = this, h = 0; - if ($$.config.legend_show) { - if ($$.isLegendRight) { - h = $$.currentHeight; - } else { - h = Math.max(20, $$.legendItemHeight) * ($$.legendStep + 1); - } - } - return h; -}; -c3_chart_internal_fn.opacityForLegend = function (legendItem) { - return legendItem.classed(CLASS.legendItemHidden) ? null : 1; -}; -c3_chart_internal_fn.opacityForUnfocusedLegend = function (legendItem) { - return legendItem.classed(CLASS.legendItemHidden) ? null : 0.3; -}; -c3_chart_internal_fn.toggleFocusLegend = function (targetIds, focus) { - const $$ = this; - targetIds = $$.mapToTargetIds(targetIds); - $$.legend.selectAll('.' + CLASS.legendItem) - .filter((id) => { return targetIds.indexOf(id) >= 0; }) - .classed(CLASS.legendItemFocused, focus) - .transition().duration(100) - .style('opacity', function () { - const opacity = focus ? $$.opacityForLegend : $$.opacityForUnfocusedLegend; - return opacity.call($$, $$.d3.select(this)); - }); -}; -c3_chart_internal_fn.revertLegend = function () { - let $$ = this, d3 = $$.d3; - $$.legend.selectAll('.' + CLASS.legendItem) - .classed(CLASS.legendItemFocused, false) - .transition().duration(100) - .style('opacity', function () { return $$.opacityForLegend(d3.select(this)); }); -}; -c3_chart_internal_fn.showLegend = function (targetIds) { - let $$ = this, config = $$.config; - if (!config.legend_show) { - config.legend_show = true; - $$.legend.style('visibility', 'visible'); - if (!$$.legendHasRendered) { - $$.updateLegendWithDefaults(); - } - } - $$.removeHiddenLegendIds(targetIds); - $$.legend.selectAll($$.selectorLegends(targetIds)) - .style('visibility', 'visible') - .transition() - .style('opacity', function () { return $$.opacityForLegend($$.d3.select(this)); }); -}; -c3_chart_internal_fn.hideLegend = function (targetIds) { - let $$ = this, config = $$.config; - if (config.legend_show && isEmpty(targetIds)) { - config.legend_show = false; - $$.legend.style('visibility', 'hidden'); - } - $$.addHiddenLegendIds(targetIds); - $$.legend.selectAll($$.selectorLegends(targetIds)) - .style('opacity', 0) - .style('visibility', 'hidden'); -}; -c3_chart_internal_fn.clearLegendItemTextBoxCache = function () { - this.legendItemTextBox = {}; -}; -c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) { - let $$ = this, config = $$.config; - let xForLegend, xForLegendText, xForLegendRect, yForLegend, yForLegendText, yForLegendRect, x1ForLegendTile, x2ForLegendTile, yForLegendTile; - let paddingTop = 4, paddingRight = 10, maxWidth = 0, maxHeight = 0, posMin = 10, tileWidth = config.legend_item_tile_width + 5; - let l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; - let withTransition, withTransitionForTransform; - let texts, rects, tiles, background; - - // Skip elements when their name is set to null - targetIds = targetIds.filter((id) => { - return !isDefined(config.data_names[id]) || config.data_names[id] !== null; - }); - - options = options || {}; - withTransition = getOption(options, 'withTransition', true); - withTransitionForTransform = getOption(options, 'withTransitionForTransform', true); - - function getTextBox(textElement, id) { - if (!$$.legendItemTextBox[id]) { - $$.legendItemTextBox[id] = $$.getTextRect(textElement.textContent, CLASS.legendItem, textElement); - } - return $$.legendItemTextBox[id]; - } - - function updatePositions(textElement, id, index) { - let reset = index === 0, isLast = index === targetIds.length - 1, - box = getTextBox(textElement, id), - itemWidth = box.width + tileWidth + (isLast && !($$.isLegendRight || $$.isLegendInset) ? 0 : paddingRight) + config.legend_padding, - itemHeight = box.height + paddingTop, - itemLength = $$.isLegendRight || $$.isLegendInset ? itemHeight : itemWidth, - areaLength = $$.isLegendRight || $$.isLegendInset ? $$.getLegendHeight() : $$.getLegendWidth(), - margin, maxLength; - - // MEMO: care about condifion of step, totalLength - function updateValues(id, withoutStep) { - if (!withoutStep) { - margin = (areaLength - totalLength - itemLength) / 2; - if (margin < posMin) { - margin = (areaLength - itemLength) / 2; - totalLength = 0; - step++; - } - } - steps[id] = step; - margins[step] = $$.isLegendInset ? 10 : margin; - offsets[id] = totalLength; - totalLength += itemLength; - } - - if (reset) { - totalLength = 0; - step = 0; - maxWidth = 0; - maxHeight = 0; - } - - if (config.legend_show && !$$.isLegendToShow(id)) { - widths[id] = heights[id] = steps[id] = offsets[id] = 0; - return; - } - - widths[id] = itemWidth; - heights[id] = itemHeight; - - if (!maxWidth || itemWidth >= maxWidth) { maxWidth = itemWidth; } - if (!maxHeight || itemHeight >= maxHeight) { maxHeight = itemHeight; } - maxLength = $$.isLegendRight || $$.isLegendInset ? maxHeight : maxWidth; - - if (config.legend_equally) { - Object.keys(widths).forEach((id) => { widths[id] = maxWidth; }); - Object.keys(heights).forEach((id) => { heights[id] = maxHeight; }); - margin = (areaLength - maxLength * targetIds.length) / 2; - if (margin < posMin) { - totalLength = 0; - step = 0; - targetIds.forEach((id) => { updateValues(id); }); - } - else { - updateValues(id, true); - } - } else { - updateValues(id); - } - } - - if ($$.isLegendInset) { - step = config.legend_inset_step ? config.legend_inset_step : targetIds.length; - $$.updateLegendStep(step); - } - - if ($$.isLegendRight) { - xForLegend = function (id) { return maxWidth * steps[id]; }; - yForLegend = function (id) { return margins[steps[id]] + offsets[id]; }; - } else if ($$.isLegendInset) { - xForLegend = function (id) { return maxWidth * steps[id] + 10; }; - yForLegend = function (id) { return margins[steps[id]] + offsets[id]; }; - } else { - xForLegend = function (id) { return margins[steps[id]] + offsets[id]; }; - yForLegend = function (id) { return maxHeight * steps[id]; }; - } - xForLegendText = function (id, i) { return xForLegend(id, i) + 4 + config.legend_item_tile_width; }; - yForLegendText = function (id, i) { return yForLegend(id, i) + 9; }; - xForLegendRect = function (id, i) { return xForLegend(id, i); }; - yForLegendRect = function (id, i) { return yForLegend(id, i) - 5; }; - x1ForLegendTile = function (id, i) { return xForLegend(id, i) - 2; }; - x2ForLegendTile = function (id, i) { return xForLegend(id, i) - 2 + config.legend_item_tile_width; }; - yForLegendTile = function (id, i) { return yForLegend(id, i) + 4; }; - - // Define g for legend area - l = $$.legend.selectAll('.' + CLASS.legendItem) - .data(targetIds) - .enter().append('g') - .attr('class', (id) => { return $$.generateClass(CLASS.legendItem, id); }) - .style('visibility', (id) => { return $$.isLegendToShow(id) ? 'visible' : 'hidden'; }) - .style('cursor', 'pointer') - .on('click', (id) => { - if (config.legend_item_onclick) { - config.legend_item_onclick.call($$, id); - } else { - if ($$.d3.event.altKey) { - $$.api.hide(); - $$.api.show(id); - } else { - $$.api.toggle(id); - $$.isTargetToShow(id) ? $$.api.focus(id) : $$.api.revert(); - } - } - }) - .on('mouseover', function (id) { - if (config.legend_item_onmouseover) { - config.legend_item_onmouseover.call($$, id); - } - else { - $$.d3.select(this).classed(CLASS.legendItemFocused, true); - if (!$$.transiting && $$.isTargetToShow(id)) { - $$.api.focus(id); - } - } - }) - .on('mouseout', function (id) { - if (config.legend_item_onmouseout) { - config.legend_item_onmouseout.call($$, id); - } - else { - $$.d3.select(this).classed(CLASS.legendItemFocused, false); - $$.api.revert(); - } - }); - l.append('text') - .text((id) => { return isDefined(config.data_names[id]) ? config.data_names[id] : id; }) - .each(function (id, i) { updatePositions(this, id, i); }) - .style('pointer-events', 'none') - .attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200) - .attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendText); - l.append('rect') - .attr('class', CLASS.legendItemEvent) - .style('fill-opacity', 0) - .attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendRect : -200) - .attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendRect); - l.append('line') - .attr('class', CLASS.legendItemTile) - .style('stroke', $$.color) - .style('pointer-events', 'none') - .attr('x1', $$.isLegendRight || $$.isLegendInset ? x1ForLegendTile : -200) - .attr('y1', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendTile) - .attr('x2', $$.isLegendRight || $$.isLegendInset ? x2ForLegendTile : -200) - .attr('y2', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendTile) - .attr('stroke-width', config.legend_item_tile_height); - - // Set background for inset legend - background = $$.legend.select('.' + CLASS.legendBackground + ' rect'); - if ($$.isLegendInset && maxWidth > 0 && background.size() === 0) { - background = $$.legend.insert('g', '.' + CLASS.legendItem) - .attr('class', CLASS.legendBackground) - .append('rect'); - } - - texts = $$.legend.selectAll('text') - .data(targetIds) - .text((id) => { return isDefined(config.data_names[id]) ? config.data_names[id] : id; }) // MEMO: needed for update - .each(function (id, i) { updatePositions(this, id, i); }); - (withTransition ? texts.transition() : texts) - .attr('x', xForLegendText) - .attr('y', yForLegendText); - - rects = $$.legend.selectAll('rect.' + CLASS.legendItemEvent) - .data(targetIds); - (withTransition ? rects.transition() : rects) - .attr('width', (id) => { return widths[id]; }) - .attr('height', (id) => { return heights[id]; }) - .attr('x', xForLegendRect) - .attr('y', yForLegendRect); - - tiles = $$.legend.selectAll('line.' + CLASS.legendItemTile) - .data(targetIds); - (withTransition ? tiles.transition() : tiles) - .style('stroke', $$.color) - .attr('x1', x1ForLegendTile) - .attr('y1', yForLegendTile) - .attr('x2', x2ForLegendTile) - .attr('y2', yForLegendTile); - - if (background) { - (withTransition ? background.transition() : background) - .attr('height', $$.getLegendHeight() - 12) - .attr('width', maxWidth * (step + 1) + 10); - } - - // toggle legend state - $$.legend.selectAll('.' + CLASS.legendItem) - .classed(CLASS.legendItemHidden, (id) => { return !$$.isTargetToShow(id); }); - - // Update all to reflect change of legend - $$.updateLegendItemWidth(maxWidth); - $$.updateLegendItemHeight(maxHeight); - $$.updateLegendStep(step); - // Update size and scale - $$.updateSizes(); - $$.updateScales(); - $$.updateSvgSize(); - // Update g positions - $$.transformAll(withTransitionForTransform, transitions); - $$.legendHasRendered = true; -}; diff --git a/src/chartinternal/region.js b/src/chartinternal/region.js deleted file mode 100644 index 5fa8b8a..0000000 --- a/src/chartinternal/region.js +++ /dev/null @@ -1,88 +0,0 @@ -c3_chart_internal_fn.initRegion = function () { - const $$ = this; - $$.region = $$.main.append('g') - .attr('clip-path', $$.clipPath) - .attr('class', CLASS.regions); -}; -c3_chart_internal_fn.updateRegion = function (duration) { - let $$ = this, config = $$.config; - - // hide if arc type - $$.region.style('visibility', $$.hasArcType() ? 'hidden' : 'visible'); - - $$.mainRegion = $$.main.select('.' + CLASS.regions).selectAll('.' + CLASS.region) - .data(config.regions); - $$.mainRegion.enter().append('g') - .append('rect') - .style('fill-opacity', 0); - $$.mainRegion - .attr('class', $$.classRegion.bind($$)); - $$.mainRegion.exit().transition().duration(duration) - .style('opacity', 0) - .remove(); -}; -c3_chart_internal_fn.redrawRegion = function (withTransition) { - let $$ = this, - regions = $$.mainRegion.selectAll('rect').each(function () { - // data is binded to g and it's not transferred to rect (child node) automatically, - // then data of each rect has to be updated manually. - // TODO: there should be more efficient way to solve this? - const parentData = $$.d3.select(this.parentNode).datum(); - $$.d3.select(this).datum(parentData); - }), - x = $$.regionX.bind($$), - y = $$.regionY.bind($$), - w = $$.regionWidth.bind($$), - h = $$.regionHeight.bind($$); - return [ - (withTransition ? regions.transition() : regions) - .attr('x', x) - .attr('y', y) - .attr('width', w) - .attr('height', h) - .style('fill-opacity', (d) => { return isValue(d.opacity) ? d.opacity : 0.1; }), - ]; -}; -c3_chart_internal_fn.regionX = function (d) { - let $$ = this, config = $$.config, - xPos, yScale = d.axis === 'y' ? $$.y : $$.y2; - if (d.axis === 'y' || d.axis === 'y2') { - xPos = config.axis_rotated ? ('start' in d ? yScale(d.start) : 0) : 0; - } else { - xPos = config.axis_rotated ? 0 : ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0); - } - return xPos; -}; -c3_chart_internal_fn.regionY = function (d) { - let $$ = this, config = $$.config, - yPos, yScale = d.axis === 'y' ? $$.y : $$.y2; - if (d.axis === 'y' || d.axis === 'y2') { - yPos = config.axis_rotated ? 0 : ('end' in d ? yScale(d.end) : 0); - } else { - yPos = config.axis_rotated ? ('start' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.start) : d.start) : 0) : 0; - } - return yPos; -}; -c3_chart_internal_fn.regionWidth = function (d) { - let $$ = this, config = $$.config, - start = $$.regionX(d), end, yScale = d.axis === 'y' ? $$.y : $$.y2; - if (d.axis === 'y' || d.axis === 'y2') { - end = config.axis_rotated ? ('end' in d ? yScale(d.end) : $$.width) : $$.width; - } else { - end = config.axis_rotated ? $$.width : ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.width); - } - return end < start ? 0 : end - start; -}; -c3_chart_internal_fn.regionHeight = function (d) { - let $$ = this, config = $$.config, - start = this.regionY(d), end, yScale = d.axis === 'y' ? $$.y : $$.y2; - if (d.axis === 'y' || d.axis === 'y2') { - end = config.axis_rotated ? $$.height : ('start' in d ? yScale(d.start) : $$.height); - } else { - end = config.axis_rotated ? ('end' in d ? $$.x($$.isTimeSeries() ? $$.parseDate(d.end) : d.end) : $$.height) : $$.height; - } - return end < start ? 0 : end - start; -}; -c3_chart_internal_fn.isRegionOnX = function (d) { - return !d.axis || d.axis === 'x'; -}; diff --git a/src/chartinternal/scale.js b/src/chartinternal/scale.js deleted file mode 100644 index 31ad426..0000000 --- a/src/chartinternal/scale.js +++ /dev/null @@ -1,89 +0,0 @@ -c3_chart_internal_fn.getScale = function (min, max, forTimeseries) { - return (forTimeseries ? this.d3.time.scale() : this.d3.scale.linear()).range([min, max]); -}; -c3_chart_internal_fn.getX = function (min, max, domain, offset) { - let $$ = this, - scale = $$.getScale(min, max, $$.isTimeSeries()), - _scale = domain ? scale.domain(domain) : scale, key; - // Define customized scale if categorized axis - if ($$.isCategorized()) { - offset = offset || function () { return 0; }; - scale = function (d, raw) { - const v = _scale(d) + offset(d); - return raw ? v : Math.ceil(v); - }; - } else { - scale = function (d, raw) { - const v = _scale(d); - return raw ? v : Math.ceil(v); - }; - } - // define functions - for (key in _scale) { - scale[key] = _scale[key]; - } - scale.orgDomain = function () { - return _scale.domain(); - }; - // define custom domain() for categorized axis - if ($$.isCategorized()) { - scale.domain = function (domain) { - if (!arguments.length) { - domain = this.orgDomain(); - return [domain[0], domain[1] + 1]; - } - _scale.domain(domain); - return scale; - }; - } - return scale; -}; -c3_chart_internal_fn.getY = function (min, max, domain) { - const scale = this.getScale(min, max, this.isTimeSeriesY()); - if (domain) { scale.domain(domain); } - return scale; -}; -c3_chart_internal_fn.getYScale = function (id) { - return this.axis.getId(id) === 'y2' ? this.y2 : this.y; -}; -c3_chart_internal_fn.getSubYScale = function (id) { - return this.axis.getId(id) === 'y2' ? this.subY2 : this.subY; -}; -c3_chart_internal_fn.updateScales = function () { - let $$ = this, config = $$.config, - forInit = !$$.x; - // update edges - $$.xMin = config.axis_rotated ? 1 : 0; - $$.xMax = config.axis_rotated ? $$.height : $$.width; - $$.yMin = config.axis_rotated ? 0 : $$.height; - $$.yMax = config.axis_rotated ? $$.width : 1; - $$.subXMin = $$.xMin; - $$.subXMax = $$.xMax; - $$.subYMin = config.axis_rotated ? 0 : $$.height2; - $$.subYMax = config.axis_rotated ? $$.width2 : 1; - // update scales - $$.x = $$.getX($$.xMin, $$.xMax, forInit ? undefined : $$.x.orgDomain(), () => { return $$.xAxis.tickOffset(); }); - $$.y = $$.getY($$.yMin, $$.yMax, forInit ? config.axis_y_default : $$.y.domain()); - $$.y2 = $$.getY($$.yMin, $$.yMax, forInit ? config.axis_y2_default : $$.y2.domain()); - $$.subX = $$.getX($$.xMin, $$.xMax, $$.orgXDomain, (d) => { return d % 1 ? 0 : $$.subXAxis.tickOffset(); }); - $$.subY = $$.getY($$.subYMin, $$.subYMax, forInit ? config.axis_y_default : $$.subY.domain()); - $$.subY2 = $$.getY($$.subYMin, $$.subYMax, forInit ? config.axis_y2_default : $$.subY2.domain()); - // update axes - $$.xAxisTickFormat = $$.axis.getXAxisTickFormat(); - $$.xAxisTickValues = $$.axis.getXAxisTickValues(); - $$.yAxisTickValues = $$.axis.getYAxisTickValues(); - $$.y2AxisTickValues = $$.axis.getY2AxisTickValues(); - - $$.xAxis = $$.axis.getXAxis($$.x, $$.xOrient, $$.xAxisTickFormat, $$.xAxisTickValues, config.axis_x_tick_outer); - $$.subXAxis = $$.axis.getXAxis($$.subX, $$.subXOrient, $$.xAxisTickFormat, $$.xAxisTickValues, config.axis_x_tick_outer); - $$.yAxis = $$.axis.getYAxis($$.y, $$.yOrient, config.axis_y_tick_format, $$.yAxisTickValues, config.axis_y_tick_outer); - $$.y2Axis = $$.axis.getYAxis($$.y2, $$.y2Orient, config.axis_y2_tick_format, $$.y2AxisTickValues, config.axis_y2_tick_outer); - - // Set initialized scales to brush and zoom - if (!forInit) { - if ($$.brush) { $$.brush.scale($$.subX); } - if (config.zoom_enabled) { $$.zoom.scale($$.x); } - } - // update for arc - if ($$.updateArc) { $$.updateArc(); } -}; diff --git a/src/chartinternal/selection.js b/src/chartinternal/selection.js deleted file mode 100644 index 84f9809..0000000 --- a/src/chartinternal/selection.js +++ /dev/null @@ -1,79 +0,0 @@ -c3_chart_internal_fn.selectPoint = function (target, d, i) { - let $$ = this, config = $$.config, - cx = (config.axis_rotated ? $$.circleY : $$.circleX).bind($$), - cy = (config.axis_rotated ? $$.circleX : $$.circleY).bind($$), - r = $$.pointSelectR.bind($$); - config.data_onselected.call($$.api, d, target.node()); - // add selected-circle on low layer g - $$.main.select('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS.selectedCircle + '-' + i) - .data([d]) - .enter().append('circle') - .attr('class', () => { return $$.generateClass(CLASS.selectedCircle, i); }) - .attr('cx', cx) - .attr('cy', cy) - .attr('stroke', () => { return $$.color(d); }) - .attr('r', (d) => { return $$.pointSelectR(d) * 1.4; }) - .transition().duration(100) - .attr('r', r); -}; -c3_chart_internal_fn.unselectPoint = function (target, d, i) { - const $$ = this; - $$.config.data_onunselected.call($$.api, d, target.node()); - // remove selected-circle from low layer g - $$.main.select('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS.selectedCircle + '-' + i) - .transition().duration(100).attr('r', 0) - .remove(); -}; -c3_chart_internal_fn.togglePoint = function (selected, target, d, i) { - selected ? this.selectPoint(target, d, i) : this.unselectPoint(target, d, i); -}; -c3_chart_internal_fn.selectPath = function (target, d) { - const $$ = this; - $$.config.data_onselected.call($$, d, target.node()); - if ($$.config.interaction_brighten) { - target.transition().duration(100) - .style('fill', () => { return $$.d3.rgb($$.color(d)).brighter(0.75); }); - } -}; -c3_chart_internal_fn.unselectPath = function (target, d) { - const $$ = this; - $$.config.data_onunselected.call($$, d, target.node()); - if ($$.config.interaction_brighten) { - target.transition().duration(100) - .style('fill', () => { return $$.color(d); }); - } -}; -c3_chart_internal_fn.togglePath = function (selected, target, d, i) { - selected ? this.selectPath(target, d, i) : this.unselectPath(target, d, i); -}; -c3_chart_internal_fn.getToggle = function (that, d) { - let $$ = this, toggle; - if (that.nodeName === 'circle') { - if ($$.isStepType(d)) { - // circle is hidden in step chart, so treat as within the click area - toggle = function () {}; // TODO: how to select step chart? - } else { - toggle = $$.togglePoint; - } - } - else if (that.nodeName === 'path') { - toggle = $$.togglePath; - } - return toggle; -}; -c3_chart_internal_fn.toggleShape = function (that, d, i) { - let $$ = this, d3 = $$.d3, config = $$.config, - shape = d3.select(that), isSelected = shape.classed(CLASS.SELECTED), - toggle = $$.getToggle(that, d).bind($$); - - if (config.data_selection_enabled && config.data_selection_isselectable(d)) { - if (!config.data_selection_multiple) { - $$.main.selectAll('.' + CLASS.shapes + (config.data_selection_grouped ? $$.getTargetSelectorSuffix(d.id) : '')).selectAll('.' + CLASS.shape).each(function (d, i) { - const shape = d3.select(this); - if (shape.classed(CLASS.SELECTED)) { toggle(false, shape.classed(CLASS.SELECTED, false), d, i); } - }); - } - shape.classed(CLASS.SELECTED, !isSelected); - toggle(!isSelected, shape, d, i); - } -}; diff --git a/src/chartinternal/shape.bar.js b/src/chartinternal/shape.bar.js deleted file mode 100644 index a36959c..0000000 --- a/src/chartinternal/shape.bar.js +++ /dev/null @@ -1,121 +0,0 @@ -c3_chart_internal_fn.initBar = function () { - const $$ = this; - $$.main.select('.' + CLASS.chart).append('g') - .attr('class', CLASS.chartBars); -}; -c3_chart_internal_fn.updateTargetsForBar = function (targets) { - let $$ = this, config = $$.config, - mainBarUpdate, mainBarEnter, - classChartBar = $$.classChartBar.bind($$), - classBars = $$.classBars.bind($$), - classFocus = $$.classFocus.bind($$); - mainBarUpdate = $$.main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar) - .data(targets) - .attr('class', (d) => { return classChartBar(d) + classFocus(d); }); - mainBarEnter = mainBarUpdate.enter().append('g') - .attr('class', classChartBar) - .style('opacity', 0) - .style('pointer-events', 'none'); - // Bars for each data - mainBarEnter.append('g') - .attr('class', classBars) - .style('cursor', (d) => { return config.data_selection_isselectable(d) ? 'pointer' : null; }); -}; -c3_chart_internal_fn.updateBar = function (durationForExit) { - let $$ = this, - barData = $$.barData.bind($$), - classBar = $$.classBar.bind($$), - initialOpacity = $$.initialOpacity.bind($$), - color = function (d) { return $$.color(d.id); }; - $$.mainBar = $$.main.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar) - .data(barData); - $$.mainBar.enter().append('path') - .attr('class', classBar) - .style('stroke', color) - .style('fill', color); - $$.mainBar - .style('opacity', initialOpacity); - $$.mainBar.exit().transition().duration(durationForExit) - .style('opacity', 0) - .remove(); -}; -c3_chart_internal_fn.redrawBar = function (drawBar, withTransition) { - return [ - (withTransition ? this.mainBar.transition(Math.random().toString()) : this.mainBar) - .attr('d', drawBar) - .style('fill', this.color) - .style('opacity', 1), - ]; -}; -c3_chart_internal_fn.getBarW = function (axis, barTargetsNum) { - let $$ = this, config = $$.config, - w = typeof config.bar_width === 'number' ? config.bar_width : barTargetsNum ? (axis.tickInterval() * config.bar_width_ratio) / barTargetsNum : 0; - return config.bar_width_max && w > config.bar_width_max ? config.bar_width_max : w; -}; -c3_chart_internal_fn.getBars = function (i, id) { - const $$ = this; - return (id ? $$.main.selectAll('.' + CLASS.bars + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : '')); -}; -c3_chart_internal_fn.expandBars = function (i, id, reset) { - const $$ = this; - if (reset) { $$.unexpandBars(); } - $$.getBars(i, id).classed(CLASS.EXPANDED, true); -}; -c3_chart_internal_fn.unexpandBars = function (i) { - const $$ = this; - $$.getBars(i).classed(CLASS.EXPANDED, false); -}; -c3_chart_internal_fn.generateDrawBar = function (barIndices, isSub) { - let $$ = this, config = $$.config, - getPoints = $$.generateGetBarPoints(barIndices, isSub); - return function (d, i) { - // 4 points that make a bar - const points = getPoints(d, i); - - // switch points if axis is rotated, not applicable for sub chart - const indexX = config.axis_rotated ? 1 : 0; - const indexY = config.axis_rotated ? 0 : 1; - - const path = 'M ' + points[0][indexX] + ',' + points[0][indexY] + ' ' + - 'L' + points[1][indexX] + ',' + points[1][indexY] + ' ' + - 'L' + points[2][indexX] + ',' + points[2][indexY] + ' ' + - 'L' + points[3][indexX] + ',' + points[3][indexY] + ' ' + - 'z'; - - return path; - }; -}; -c3_chart_internal_fn.generateGetBarPoints = function (barIndices, isSub) { - let $$ = this, - axis = isSub ? $$.subXAxis : $$.xAxis, - barTargetsNum = barIndices.__max__ + 1, - barW = $$.getBarW(axis, barTargetsNum), - barX = $$.getShapeX(barW, barTargetsNum, barIndices, !!isSub), - barY = $$.getShapeY(!!isSub), - barOffset = $$.getShapeOffset($$.isBarType, barIndices, !!isSub), - yScale = isSub ? $$.getSubYScale : $$.getYScale; - return function (d, i) { - let y0 = yScale.call($$, d.id)(0), - offset = barOffset(d, i) || y0, // offset is for stacked bar chart - posX = barX(d), posY = barY(d); - // fix posY not to overflow opposite quadrant - if ($$.config.axis_rotated) { - if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; } - } - // 4 points that make a bar - return [ - [posX, offset], - [posX, posY - (y0 - offset)], - [posX + barW, posY - (y0 - offset)], - [posX + barW, offset], - ]; - }; -}; -c3_chart_internal_fn.isWithinBar = function (that) { - let mouse = this.d3.mouse(that), box = that.getBoundingClientRect(), - seg0 = that.pathSegList.getItem(0), seg1 = that.pathSegList.getItem(1), - x = Math.min(seg0.x, seg1.x), y = Math.min(seg0.y, seg1.y), - w = box.width, h = box.height, offset = 2, - sx = x - offset, ex = x + w + offset, sy = y + h + offset, ey = y - offset; - return sx < mouse[0] && mouse[0] < ex && ey < mouse[1] && mouse[1] < sy; -}; diff --git a/src/chartinternal/shape.js b/src/chartinternal/shape.js deleted file mode 100644 index 61e7477..0000000 --- a/src/chartinternal/shape.js +++ /dev/null @@ -1,82 +0,0 @@ -c3_chart_internal_fn.getShapeIndices = function (typeFilter) { - let $$ = this, config = $$.config, - indices = {}, i = 0, j, k; - $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$)).forEach((d) => { - for (j = 0; j < config.data_groups.length; j++) { - if (config.data_groups[j].indexOf(d.id) < 0) { continue; } - for (k = 0; k < config.data_groups[j].length; k++) { - if (config.data_groups[j][k] in indices) { - indices[d.id] = indices[config.data_groups[j][k]]; - break; - } - } - } - if (isUndefined(indices[d.id])) { indices[d.id] = i++; } - }); - indices.__max__ = i - 1; - return indices; -}; -c3_chart_internal_fn.getShapeX = function (offset, targetsNum, indices, isSub) { - let $$ = this, scale = isSub ? $$.subX : $$.x; - return function (d) { - const index = d.id in indices ? indices[d.id] : 0; - return d.x || d.x === 0 ? scale(d.x) - offset * (targetsNum / 2 - index) : 0; - }; -}; -c3_chart_internal_fn.getShapeY = function (isSub) { - const $$ = this; - return function (d) { - const scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id); - return scale(d.value); - }; -}; -c3_chart_internal_fn.getShapeOffset = function (typeFilter, indices, isSub) { - let $$ = this, - targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))), - targetIds = targets.map((t) => { return t.id; }); - return function (d, i) { - let scale = isSub ? $$.getSubYScale(d.id) : $$.getYScale(d.id), - y0 = scale(0), offset = y0; - targets.forEach((t) => { - const values = $$.isStepType(d) ? $$.convertValuesToStep(t.values) : t.values; - if (t.id === d.id || indices[t.id] !== indices[d.id]) { return; } - if (targetIds.indexOf(t.id) < targetIds.indexOf(d.id)) { - // check if the x values line up - if (typeof values[i] === 'undefined' || +values[i].x !== +d.x) { // "+" for timeseries - // if not, try to find the value that does line up - i = -1; - values.forEach((v, j) => { - if (v.x === d.x) { - i = j; - } - }); - } - if (i in values && values[i].value * d.value >= 0) { - offset += scale(values[i].value) - y0; - } - } - }); - return offset; - }; -}; -c3_chart_internal_fn.isWithinShape = function (that, d) { - let $$ = this, - shape = $$.d3.select(that), isWithin; - if (!$$.isTargetToShow(d.id)) { - isWithin = false; - } - else if (that.nodeName === 'circle') { - isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScale(d.id)(d.value)) : $$.isWithinCircle(that, $$.pointSelectR(d) * 1.5); - } - else if (that.nodeName === 'path') { - isWithin = shape.classed(CLASS.bar) ? $$.isWithinBar(that) : true; - } - return isWithin; -}; - - -c3_chart_internal_fn.getInterpolate = function (d) { - let $$ = this, - interpolation = $$.isInterpolationType($$.config.spline_interpolation_type) ? $$.config.spline_interpolation_type : 'cardinal'; - return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? $$.config.line_step_type : 'linear'; -}; diff --git a/src/chartinternal/shape.line.js b/src/chartinternal/shape.line.js deleted file mode 100644 index 7459a75..0000000 --- a/src/chartinternal/shape.line.js +++ /dev/null @@ -1,384 +0,0 @@ -c3_chart_internal_fn.initLine = function () { - const $$ = this; - $$.main.select('.' + CLASS.chart).append('g') - .attr('class', CLASS.chartLines); -}; -c3_chart_internal_fn.updateTargetsForLine = function (targets) { - let $$ = this, config = $$.config, - mainLineUpdate, mainLineEnter, - classChartLine = $$.classChartLine.bind($$), - classLines = $$.classLines.bind($$), - classAreas = $$.classAreas.bind($$), - classCircles = $$.classCircles.bind($$), - classFocus = $$.classFocus.bind($$); - mainLineUpdate = $$.main.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine) - .data(targets) - .attr('class', (d) => { return classChartLine(d) + classFocus(d); }); - mainLineEnter = mainLineUpdate.enter().append('g') - .attr('class', classChartLine) - .style('opacity', 0) - .style('pointer-events', 'none'); - // Lines for each data - mainLineEnter.append('g') - .attr('class', classLines); - // Areas - mainLineEnter.append('g') - .attr('class', classAreas); - // Circles for each data point on lines - mainLineEnter.append('g') - .attr('class', (d) => { return $$.generateClass(CLASS.selectedCircles, d.id); }); - mainLineEnter.append('g') - .attr('class', classCircles) - .style('cursor', (d) => { return config.data_selection_isselectable(d) ? 'pointer' : null; }); - // Update date for selected circles - targets.forEach((t) => { - $$.main.selectAll('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS.selectedCircle).each((d) => { - d.value = t.values[d.index].value; - }); - }); - // MEMO: can not keep same color... - // mainLineUpdate.exit().remove(); -}; -c3_chart_internal_fn.updateLine = function (durationForExit) { - const $$ = this; - $$.mainLine = $$.main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line) - .data($$.lineData.bind($$)); - $$.mainLine.enter().append('path') - .attr('class', $$.classLine.bind($$)) - .style('stroke', $$.color); - $$.mainLine - .style('opacity', $$.initialOpacity.bind($$)) - .style('shape-rendering', (d) => { return $$.isStepType(d) ? 'crispEdges' : ''; }) - .attr('transform', null); - $$.mainLine.exit().transition().duration(durationForExit) - .style('opacity', 0) - .remove(); -}; -c3_chart_internal_fn.redrawLine = function (drawLine, withTransition) { - return [ - (withTransition ? this.mainLine.transition(Math.random().toString()) : this.mainLine) - .attr('d', drawLine) - .style('stroke', this.color) - .style('opacity', 1), - ]; -}; -c3_chart_internal_fn.generateDrawLine = function (lineIndices, isSub) { - let $$ = this, config = $$.config, - line = $$.d3.svg.line(), - getPoints = $$.generateGetLinePoints(lineIndices, isSub), - yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale, - xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); }, - yValue = function (d, i) { - return config.data_groups.length > 0 ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)(d.value); - }; - - line = config.axis_rotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue); - if (!config.line_connectNull) { line = line.defined((d) => { return d.value != null; }); } - return function (d) { - let values = config.line_connectNull ? $$.filterRemoveNull(d.values) : d.values, - x = isSub ? $$.x : $$.subX, y = yScaleGetter.call($$, d.id), x0 = 0, y0 = 0, path; - if ($$.isLineType(d)) { - if (config.data_regions[d.id]) { - path = $$.lineWithRegions(values, x, y, config.data_regions[d.id]); - } else { - if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); } - path = line.interpolate($$.getInterpolate(d))(values); - } - } else { - if (values[0]) { - x0 = x(values[0].x); - y0 = y(values[0].value); - } - path = config.axis_rotated ? 'M ' + y0 + ' ' + x0 : 'M ' + x0 + ' ' + y0; - } - return path ? path : 'M 0 0'; - }; -}; -c3_chart_internal_fn.generateGetLinePoints = function (lineIndices, isSub) { // partial duplication of generateGetBarPoints - let $$ = this, config = $$.config, - lineTargetsNum = lineIndices.__max__ + 1, - x = $$.getShapeX(0, lineTargetsNum, lineIndices, !!isSub), - y = $$.getShapeY(!!isSub), - lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, !!isSub), - yScale = isSub ? $$.getSubYScale : $$.getYScale; - return function (d, i) { - let y0 = yScale.call($$, d.id)(0), - offset = lineOffset(d, i) || y0, // offset is for stacked area chart - posX = x(d), posY = y(d); - // fix posY not to overflow opposite quadrant - if (config.axis_rotated) { - if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; } - } - // 1 point that marks the line position - return [ - [posX, posY - (y0 - offset)], - [posX, posY - (y0 - offset)], // needed for compatibility - [posX, posY - (y0 - offset)], // needed for compatibility - [posX, posY - (y0 - offset)], // needed for compatibility - ]; - }; -}; - - -c3_chart_internal_fn.lineWithRegions = function (d, x, y, _regions) { - let $$ = this, config = $$.config, - prev = -1, i, j, - s = 'M', sWithRegion, - xp, yp, dx, dy, dd, diff, diffx2, - xOffset = $$.isCategorized() ? 0.5 : 0, - xValue, yValue, - regions = []; - - function isWithinRegions(x, regions) { - let i; - for (i = 0; i < regions.length; i++) { - if (regions[i].start < x && x <= regions[i].end) { return true; } - } - return false; - } - - // Check start/end of regions - if (isDefined(_regions)) { - for (i = 0; i < _regions.length; i++) { - regions[i] = {}; - if (isUndefined(_regions[i].start)) { - regions[i].start = d[0].x; - } else { - regions[i].start = $$.isTimeSeries() ? $$.parseDate(_regions[i].start) : _regions[i].start; - } - if (isUndefined(_regions[i].end)) { - regions[i].end = d[d.length - 1].x; - } else { - regions[i].end = $$.isTimeSeries() ? $$.parseDate(_regions[i].end) : _regions[i].end; - } - } - } - - // Set scales - xValue = config.axis_rotated ? function (d) { return y(d.value); } : function (d) { return x(d.x); }; - yValue = config.axis_rotated ? function (d) { return x(d.x); } : function (d) { return y(d.value); }; - - // Define svg generator function for region - function generateM(points) { - return 'M' + points[0][0] + ' ' + points[0][1] + ' ' + points[1][0] + ' ' + points[1][1]; - } - if ($$.isTimeSeries()) { - sWithRegion = function (d0, d1, j, diff) { - let x0 = d0.x.getTime(), x_diff = d1.x - d0.x, - xv0 = new Date(x0 + x_diff * j), - xv1 = new Date(x0 + x_diff * (j + diff)), - points; - if (config.axis_rotated) { - points = [[y(yp(j)), x(xv0)], [y(yp(j + diff)), x(xv1)]]; - } else { - points = [[x(xv0), y(yp(j))], [x(xv1), y(yp(j + diff))]]; - } - return generateM(points); - }; - } else { - sWithRegion = function (d0, d1, j, diff) { - let points; - if (config.axis_rotated) { - points = [[y(yp(j), true), x(xp(j))], [y(yp(j + diff), true), x(xp(j + diff))]]; - } else { - points = [[x(xp(j), true), y(yp(j))], [x(xp(j + diff), true), y(yp(j + diff))]]; - } - return generateM(points); - }; - } - - // Generate - for (i = 0; i < d.length; i++) { - // Draw as normal - if (isUndefined(regions) || !isWithinRegions(d[i].x, regions)) { - s += ' ' + xValue(d[i]) + ' ' + yValue(d[i]); - } - // Draw with region // TODO: Fix for horizotal charts - else { - xp = $$.getScale(d[i - 1].x + xOffset, d[i].x + xOffset, $$.isTimeSeries()); - yp = $$.getScale(d[i - 1].value, d[i].value); - - dx = x(d[i].x) - x(d[i - 1].x); - dy = y(d[i].value) - y(d[i - 1].value); - dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); - diff = 2 / dd; - diffx2 = diff * 2; - - for (j = diff; j <= 1; j += diffx2) { - s += sWithRegion(d[i - 1], d[i], j, diff); - } - } - prev = d[i].x; - } - - return s; -}; - - -c3_chart_internal_fn.updateArea = function (durationForExit) { - let $$ = this, d3 = $$.d3; - $$.mainArea = $$.main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area) - .data($$.lineData.bind($$)); - $$.mainArea.enter().append('path') - .attr('class', $$.classArea.bind($$)) - .style('fill', $$.color) - .style('opacity', function () { $$.orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }); - $$.mainArea - .style('opacity', $$.orgAreaOpacity); - $$.mainArea.exit().transition().duration(durationForExit) - .style('opacity', 0) - .remove(); -}; -c3_chart_internal_fn.redrawArea = function (drawArea, withTransition) { - return [ - (withTransition ? this.mainArea.transition(Math.random().toString()) : this.mainArea) - .attr('d', drawArea) - .style('fill', this.color) - .style('opacity', this.orgAreaOpacity), - ]; -}; -c3_chart_internal_fn.generateDrawArea = function (areaIndices, isSub) { - let $$ = this, config = $$.config, area = $$.d3.svg.area(), - getPoints = $$.generateGetAreaPoints(areaIndices, isSub), - yScaleGetter = isSub ? $$.getSubYScale : $$.getYScale, - xValue = function (d) { return (isSub ? $$.subxx : $$.xx).call($$, d); }, - value0 = function (d, i) { - return config.data_groups.length > 0 ? getPoints(d, i)[0][1] : yScaleGetter.call($$, d.id)($$.getAreaBaseValue(d.id)); - }, - value1 = function (d, i) { - return config.data_groups.length > 0 ? getPoints(d, i)[1][1] : yScaleGetter.call($$, d.id)(d.value); - }; - - area = config.axis_rotated ? area.x0(value0).x1(value1).y(xValue) : area.x(xValue).y0(config.area_above ? 0 : value0).y1(value1); - if (!config.line_connectNull) { - area = area.defined((d) => { return d.value !== null; }); - } - - return function (d) { - let values = config.line_connectNull ? $$.filterRemoveNull(d.values) : d.values, - x0 = 0, y0 = 0, path; - if ($$.isAreaType(d)) { - if ($$.isStepType(d)) { values = $$.convertValuesToStep(values); } - path = area.interpolate($$.getInterpolate(d))(values); - } else { - if (values[0]) { - x0 = $$.x(values[0].x); - y0 = $$.getYScale(d.id)(values[0].value); - } - path = config.axis_rotated ? 'M ' + y0 + ' ' + x0 : 'M ' + x0 + ' ' + y0; - } - return path ? path : 'M 0 0'; - }; -}; -c3_chart_internal_fn.getAreaBaseValue = function () { - return 0; -}; -c3_chart_internal_fn.generateGetAreaPoints = function (areaIndices, isSub) { // partial duplication of generateGetBarPoints - let $$ = this, config = $$.config, - areaTargetsNum = areaIndices.__max__ + 1, - x = $$.getShapeX(0, areaTargetsNum, areaIndices, !!isSub), - y = $$.getShapeY(!!isSub), - areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, !!isSub), - yScale = isSub ? $$.getSubYScale : $$.getYScale; - return function (d, i) { - let y0 = yScale.call($$, d.id)(0), - offset = areaOffset(d, i) || y0, // offset is for stacked area chart - posX = x(d), posY = y(d); - // fix posY not to overflow opposite quadrant - if (config.axis_rotated) { - if ((0 < d.value && posY < y0) || (d.value < 0 && y0 < posY)) { posY = y0; } - } - // 1 point that marks the area position - return [ - [posX, offset], - [posX, posY - (y0 - offset)], - [posX, posY - (y0 - offset)], // needed for compatibility - [posX, offset], // needed for compatibility - ]; - }; -}; - - -c3_chart_internal_fn.updateCircle = function () { - const $$ = this; - $$.mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle) - .data($$.lineOrScatterData.bind($$)); - $$.mainCircle.enter().append('circle') - .attr('class', $$.classCircle.bind($$)) - .attr('r', $$.pointR.bind($$)) - .style('fill', $$.color); - $$.mainCircle - .style('opacity', $$.initialOpacityForCircle.bind($$)); - $$.mainCircle.exit().remove(); -}; -c3_chart_internal_fn.redrawCircle = function (cx, cy, withTransition) { - const selectedCircles = this.main.selectAll('.' + CLASS.selectedCircle); - return [ - (withTransition ? this.mainCircle.transition(Math.random().toString()) : this.mainCircle) - .style('opacity', this.opacityForCircle.bind(this)) - .style('fill', this.color) - .attr('cx', cx) - .attr('cy', cy), - (withTransition ? selectedCircles.transition(Math.random().toString()) : selectedCircles) - .attr('cx', cx) - .attr('cy', cy), - ]; -}; -c3_chart_internal_fn.circleX = function (d) { - return d.x || d.x === 0 ? this.x(d.x) : null; -}; -c3_chart_internal_fn.updateCircleY = function () { - let $$ = this, lineIndices, getPoints; - if ($$.config.data_groups.length > 0) { - lineIndices = $$.getShapeIndices($$.isLineType), - getPoints = $$.generateGetLinePoints(lineIndices); - $$.circleY = function (d, i) { - return getPoints(d, i)[0][1]; - }; - } else { - $$.circleY = function (d) { - return $$.getYScale(d.id)(d.value); - }; - } -}; -c3_chart_internal_fn.getCircles = function (i, id) { - const $$ = this; - return (id ? $$.main.selectAll('.' + CLASS.circles + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.circle + (isValue(i) ? '-' + i : '')); -}; -c3_chart_internal_fn.expandCircles = function (i, id, reset) { - let $$ = this, - r = $$.pointExpandedR.bind($$); - if (reset) { $$.unexpandCircles(); } - $$.getCircles(i, id) - .classed(CLASS.EXPANDED, true) - .attr('r', r); -}; -c3_chart_internal_fn.unexpandCircles = function (i) { - let $$ = this, - r = $$.pointR.bind($$); - $$.getCircles(i) - .filter(function () { return $$.d3.select(this).classed(CLASS.EXPANDED); }) - .classed(CLASS.EXPANDED, false) - .attr('r', r); -}; -c3_chart_internal_fn.pointR = function (d) { - let $$ = this, config = $$.config; - return $$.isStepType(d) ? 0 : (isFunction(config.point_r) ? config.point_r(d) : config.point_r); -}; -c3_chart_internal_fn.pointExpandedR = function (d) { - let $$ = this, config = $$.config; - return config.point_focus_expand_enabled ? (config.point_focus_expand_r ? config.point_focus_expand_r : $$.pointR(d) * 1.75) : $$.pointR(d); -}; -c3_chart_internal_fn.pointSelectR = function (d) { - let $$ = this, config = $$.config; - return isFunction(config.point_select_r) ? config.point_select_r(d) : ((config.point_select_r) ? config.point_select_r : $$.pointR(d) * 4); -}; -c3_chart_internal_fn.isWithinCircle = function (that, r) { - let d3 = this.d3, - mouse = d3.mouse(that), d3_this = d3.select(that), - cx = +d3_this.attr('cx'), cy = +d3_this.attr('cy'); - return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < r; -}; -c3_chart_internal_fn.isWithinStep = function (that, y) { - return Math.abs(y - this.d3.mouse(that)[1]) < 30; -}; diff --git a/src/chartinternal/size.js b/src/chartinternal/size.js deleted file mode 100644 index 3fc0fec..0000000 --- a/src/chartinternal/size.js +++ /dev/null @@ -1,115 +0,0 @@ -c3_chart_internal_fn.getCurrentWidth = function () { - let $$ = this, config = $$.config; - return config.size_width ? config.size_width : $$.getParentWidth(); -}; -c3_chart_internal_fn.getCurrentHeight = function () { - let $$ = this, config = $$.config, - h = config.size_height ? config.size_height : $$.getParentHeight(); - return h > 0 ? h : 320 / ($$.hasType('gauge') && !config.gauge_fullCircle ? 2 : 1); -}; -c3_chart_internal_fn.getCurrentPaddingTop = function () { - let $$ = this, - config = $$.config, - padding = isValue(config.padding_top) ? config.padding_top : 0; - if ($$.title && $$.title.node()) { - padding += $$.getTitlePadding(); - } - return padding; -}; -c3_chart_internal_fn.getCurrentPaddingBottom = function () { - const config = this.config; - return isValue(config.padding_bottom) ? config.padding_bottom : 0; -}; -c3_chart_internal_fn.getCurrentPaddingLeft = function (withoutRecompute) { - let $$ = this, config = $$.config; - if (isValue(config.padding_left)) { - return config.padding_left; - } else if (config.axis_rotated) { - return !config.axis_x_show ? 1 : Math.max(ceil10($$.getAxisWidthByAxisId('x', withoutRecompute)), 40); - } else if (!config.axis_y_show || config.axis_y_inner) { // && !config.axis_rotated - return $$.axis.getYAxisLabelPosition().isOuter ? 30 : 1; - } else { - return ceil10($$.getAxisWidthByAxisId('y', withoutRecompute)); - } -}; -c3_chart_internal_fn.getCurrentPaddingRight = function () { - let $$ = this, config = $$.config, - defaultPadding = 10, legendWidthOnRight = $$.isLegendRight ? $$.getLegendWidth() + 20 : 0; - if (isValue(config.padding_right)) { - return config.padding_right + 1; // 1 is needed not to hide tick line - } else if (config.axis_rotated) { - return defaultPadding + legendWidthOnRight; - } else if (!config.axis_y2_show || config.axis_y2_inner) { // && !config.axis_rotated - return 2 + legendWidthOnRight + ($$.axis.getY2AxisLabelPosition().isOuter ? 20 : 0); - } else { - return ceil10($$.getAxisWidthByAxisId('y2')) + legendWidthOnRight; - } -}; - -c3_chart_internal_fn.getParentRectValue = function (key) { - let parent = this.selectChart.node(), v; - while (parent && parent.tagName !== 'BODY') { - try { - v = parent.getBoundingClientRect()[key]; - } catch (e) { - if (key === 'width') { - // In IE in certain cases getBoundingClientRect - // will cause an "unspecified error" - v = parent.offsetWidth; - } - } - if (v) { - break; - } - parent = parent.parentNode; - } - return v; -}; -c3_chart_internal_fn.getParentWidth = function () { - return this.getParentRectValue('width'); -}; -c3_chart_internal_fn.getParentHeight = function () { - const h = this.selectChart.style('height'); - return h.indexOf('px') > 0 ? +h.replace('px', '') : 0; -}; - - -c3_chart_internal_fn.getSvgLeft = function (withoutRecompute) { - let $$ = this, config = $$.config, - hasLeftAxisRect = config.axis_rotated || (!config.axis_rotated && !config.axis_y_inner), - leftAxisClass = config.axis_rotated ? CLASS.axisX : CLASS.axisY, - leftAxis = $$.main.select('.' + leftAxisClass).node(), - svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : { right: 0 }, - chartRect = $$.selectChart.node().getBoundingClientRect(), - hasArc = $$.hasArcType(), - svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute)); - return svgLeft > 0 ? svgLeft : 0; -}; - - -c3_chart_internal_fn.getAxisWidthByAxisId = function (id, withoutRecompute) { - let $$ = this, position = $$.axis.getLabelPositionById(id); - return $$.axis.getMaxTickWidth(id, withoutRecompute) + (position.isInner ? 20 : 40); -}; -c3_chart_internal_fn.getHorizontalAxisHeight = function (axisId) { - let $$ = this, config = $$.config, h = 30; - if (axisId === 'x' && !config.axis_x_show) { return 8; } - if (axisId === 'x' && config.axis_x_height) { return config.axis_x_height; } - if (axisId === 'y' && !config.axis_y_show) { - return config.legend_show && !$$.isLegendRight && !$$.isLegendInset ? 10 : 1; - } - if (axisId === 'y2' && !config.axis_y2_show) { return $$.rotated_padding_top; } - // Calculate x axis height when tick rotated - if (axisId === 'x' && !config.axis_rotated && config.axis_x_tick_rotate) { - h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - config.axis_x_tick_rotate) / 180); - } - // Calculate y axis height when tick rotated - if (axisId === 'y' && config.axis_rotated && config.axis_y_tick_rotate) { - h = 30 + $$.axis.getMaxTickWidth(axisId) * Math.cos(Math.PI * (90 - config.axis_y_tick_rotate) / 180); - } - return h + ($$.axis.getLabelPositionById(axisId).isInner ? 0 : 10) + (axisId === 'y2' ? -10 : 0); -}; - -c3_chart_internal_fn.getEventRectWidth = function () { - return Math.max(0, this.xAxis.tickInterval()); -}; diff --git a/src/chartinternal/subchart.js b/src/chartinternal/subchart.js deleted file mode 100644 index f179f4c..0000000 --- a/src/chartinternal/subchart.js +++ /dev/null @@ -1,205 +0,0 @@ -c3_chart_internal_fn.initBrush = function () { - let $$ = this, d3 = $$.d3; - $$.brush = d3.svg.brush().on('brush', () => { $$.redrawForBrush(); }); - $$.brush.update = function () { - if ($$.context) { $$.context.select('.' + CLASS.brush).call(this); } - return this; - }; - $$.brush.scale = function (scale) { - return $$.config.axis_rotated ? this.y(scale) : this.x(scale); - }; -}; -c3_chart_internal_fn.initSubchart = function () { - let $$ = this, config = $$.config, - context = $$.context = $$.svg.append('g').attr('transform', $$.getTranslate('context')), - visibility = config.subchart_show ? 'visible' : 'hidden'; - - context.style('visibility', visibility); - - // Define g for chart area - context.append('g') - .attr('clip-path', $$.clipPathForSubchart) - .attr('class', CLASS.chart); - - // Define g for bar chart area - context.select('.' + CLASS.chart).append('g') - .attr('class', CLASS.chartBars); - - // Define g for line chart area - context.select('.' + CLASS.chart).append('g') - .attr('class', CLASS.chartLines); - - // Add extent rect for Brush - context.append('g') - .attr('clip-path', $$.clipPath) - .attr('class', CLASS.brush) - .call($$.brush); - - // ATTENTION: This must be called AFTER chart added - // Add Axis - $$.axes.subx = context.append('g') - .attr('class', CLASS.axisX) - .attr('transform', $$.getTranslate('subx')) - .attr('clip-path', config.axis_rotated ? '' : $$.clipPathForXAxis) - .style('visibility', config.subchart_axis_x_show ? visibility : 'hidden'); -}; -c3_chart_internal_fn.updateTargetsForSubchart = function (targets) { - let $$ = this, context = $$.context, config = $$.config, - contextLineEnter, contextLineUpdate, contextBarEnter, contextBarUpdate, - classChartBar = $$.classChartBar.bind($$), - classBars = $$.classBars.bind($$), - classChartLine = $$.classChartLine.bind($$), - classLines = $$.classLines.bind($$), - classAreas = $$.classAreas.bind($$); - - if (config.subchart_show) { - // -- Bar --// - contextBarUpdate = context.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar) - .data(targets) - .attr('class', classChartBar); - contextBarEnter = contextBarUpdate.enter().append('g') - .style('opacity', 0) - .attr('class', classChartBar); - // Bars for each data - contextBarEnter.append('g') - .attr('class', classBars); - - // -- Line --// - contextLineUpdate = context.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine) - .data(targets) - .attr('class', classChartLine); - contextLineEnter = contextLineUpdate.enter().append('g') - .style('opacity', 0) - .attr('class', classChartLine); - // Lines for each data - contextLineEnter.append('g') - .attr('class', classLines); - // Area - contextLineEnter.append('g') - .attr('class', classAreas); - - // -- Brush --// - context.selectAll('.' + CLASS.brush + ' rect') - .attr(config.axis_rotated ? 'width' : 'height', config.axis_rotated ? $$.width2 : $$.height2); - } -}; -c3_chart_internal_fn.updateBarForSubchart = function (durationForExit) { - const $$ = this; - $$.contextBar = $$.context.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar) - .data($$.barData.bind($$)); - $$.contextBar.enter().append('path') - .attr('class', $$.classBar.bind($$)) - .style('stroke', 'none') - .style('fill', $$.color); - $$.contextBar - .style('opacity', $$.initialOpacity.bind($$)); - $$.contextBar.exit().transition().duration(durationForExit) - .style('opacity', 0) - .remove(); -}; -c3_chart_internal_fn.redrawBarForSubchart = function (drawBarOnSub, withTransition, duration) { - (withTransition ? this.contextBar.transition(Math.random().toString()).duration(duration) : this.contextBar) - .attr('d', drawBarOnSub) - .style('opacity', 1); -}; -c3_chart_internal_fn.updateLineForSubchart = function (durationForExit) { - const $$ = this; - $$.contextLine = $$.context.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line) - .data($$.lineData.bind($$)); - $$.contextLine.enter().append('path') - .attr('class', $$.classLine.bind($$)) - .style('stroke', $$.color); - $$.contextLine - .style('opacity', $$.initialOpacity.bind($$)); - $$.contextLine.exit().transition().duration(durationForExit) - .style('opacity', 0) - .remove(); -}; -c3_chart_internal_fn.redrawLineForSubchart = function (drawLineOnSub, withTransition, duration) { - (withTransition ? this.contextLine.transition(Math.random().toString()).duration(duration) : this.contextLine) - .attr('d', drawLineOnSub) - .style('opacity', 1); -}; -c3_chart_internal_fn.updateAreaForSubchart = function (durationForExit) { - let $$ = this, d3 = $$.d3; - $$.contextArea = $$.context.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area) - .data($$.lineData.bind($$)); - $$.contextArea.enter().append('path') - .attr('class', $$.classArea.bind($$)) - .style('fill', $$.color) - .style('opacity', function () { $$.orgAreaOpacity = +d3.select(this).style('opacity'); return 0; }); - $$.contextArea - .style('opacity', 0); - $$.contextArea.exit().transition().duration(durationForExit) - .style('opacity', 0) - .remove(); -}; -c3_chart_internal_fn.redrawAreaForSubchart = function (drawAreaOnSub, withTransition, duration) { - (withTransition ? this.contextArea.transition(Math.random().toString()).duration(duration) : this.contextArea) - .attr('d', drawAreaOnSub) - .style('fill', this.color) - .style('opacity', this.orgAreaOpacity); -}; -c3_chart_internal_fn.redrawSubchart = function (withSubchart, transitions, duration, durationForExit, areaIndices, barIndices, lineIndices) { - let $$ = this, d3 = $$.d3, config = $$.config, - drawAreaOnSub, drawBarOnSub, drawLineOnSub; - - $$.context.style('visibility', config.subchart_show ? 'visible' : 'hidden'); - - // subchart - if (config.subchart_show) { - // reflect main chart to extent on subchart if zoomed - if (d3.event && d3.event.type === 'zoom') { - $$.brush.extent($$.x.orgDomain()).update(); - } - // update subchart elements if needed - if (withSubchart) { - // extent rect - if (!$$.brush.empty()) { - $$.brush.extent($$.x.orgDomain()).update(); - } - // setup drawer - MEMO: this must be called after axis updated - drawAreaOnSub = $$.generateDrawArea(areaIndices, true); - drawBarOnSub = $$.generateDrawBar(barIndices, true); - drawLineOnSub = $$.generateDrawLine(lineIndices, true); - - $$.updateBarForSubchart(duration); - $$.updateLineForSubchart(duration); - $$.updateAreaForSubchart(duration); - - $$.redrawBarForSubchart(drawBarOnSub, duration, duration); - $$.redrawLineForSubchart(drawLineOnSub, duration, duration); - $$.redrawAreaForSubchart(drawAreaOnSub, duration, duration); - } - } -}; -c3_chart_internal_fn.redrawForBrush = function () { - let $$ = this, x = $$.x; - $$.redraw({ - withTransition: false, - withY: $$.config.zoom_rescale, - withSubchart: false, - withUpdateXDomain: true, - withDimension: false, - }); - $$.config.subchart_onbrush.call($$.api, x.orgDomain()); -}; -c3_chart_internal_fn.transformContext = function (withTransition, transitions) { - let $$ = this, subXAxis; - if (transitions && transitions.axisSubX) { - subXAxis = transitions.axisSubX; - } else { - subXAxis = $$.context.select('.' + CLASS.axisX); - if (withTransition) { subXAxis = subXAxis.transition(); } - } - $$.context.attr('transform', $$.getTranslate('context')); - subXAxis.attr('transform', $$.getTranslate('subx')); -}; -c3_chart_internal_fn.getDefaultExtent = function () { - let $$ = this, config = $$.config, - extent = isFunction(config.axis_x_extent) ? config.axis_x_extent($$.getXDomain($$.data.targets)) : config.axis_x_extent; - if ($$.isTimeSeries()) { - extent = [$$.parseDate(extent[0]), $$.parseDate(extent[1])]; - } - return extent; -}; diff --git a/src/chartinternal/text.js b/src/chartinternal/text.js deleted file mode 100644 index d7997b3..0000000 --- a/src/chartinternal/text.js +++ /dev/null @@ -1,124 +0,0 @@ -c3_chart_internal_fn.initText = function () { - const $$ = this; - $$.main.select('.' + CLASS.chart).append('g') - .attr('class', CLASS.chartTexts); - $$.mainText = $$.d3.selectAll([]); -}; -c3_chart_internal_fn.updateTargetsForText = function (targets) { - let $$ = this, mainTextUpdate, mainTextEnter, - classChartText = $$.classChartText.bind($$), - classTexts = $$.classTexts.bind($$), - classFocus = $$.classFocus.bind($$); - mainTextUpdate = $$.main.select('.' + CLASS.chartTexts).selectAll('.' + CLASS.chartText) - .data(targets) - .attr('class', (d) => { return classChartText(d) + classFocus(d); }); - mainTextEnter = mainTextUpdate.enter().append('g') - .attr('class', classChartText) - .style('opacity', 0) - .style('pointer-events', 'none'); - mainTextEnter.append('g') - .attr('class', classTexts); -}; -c3_chart_internal_fn.updateText = function (durationForExit) { - let $$ = this, config = $$.config, - barOrLineData = $$.barOrLineData.bind($$), - classText = $$.classText.bind($$); - $$.mainText = $$.main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text) - .data(barOrLineData); - $$.mainText.enter().append('text') - .attr('class', classText) - .attr('text-anchor', (d) => { return config.axis_rotated ? (d.value < 0 ? 'end' : 'start') : 'middle'; }) - .style('stroke', 'none') - .style('fill', (d) => { return $$.color(d); }) - .style('fill-opacity', 0); - $$.mainText - .text((d, i, j) => { return $$.dataLabelFormat(d.id)(d.value, d.id, i, j); }); - $$.mainText.exit() - .transition().duration(durationForExit) - .style('fill-opacity', 0) - .remove(); -}; -c3_chart_internal_fn.redrawText = function (xForText, yForText, forFlow, withTransition) { - return [ - (withTransition ? this.mainText.transition() : this.mainText) - .attr('x', xForText) - .attr('y', yForText) - .style('fill', this.color) - .style('fill-opacity', forFlow ? 0 : this.opacityForText.bind(this)), - ]; -}; -c3_chart_internal_fn.getTextRect = function (text, cls, element) { - let dummy = this.d3.select('body').append('div').classed('c3', true), - svg = dummy.append('svg').style('visibility', 'hidden').style('position', 'fixed').style('top', 0).style('left', 0), - font = this.d3.select(element).style('font'), - rect; - svg.selectAll('.dummy') - .data([text]) - .enter().append('text') - .classed(cls ? cls : '', true) - .style('font', font) - .text(text) - .each(function () { rect = this.getBoundingClientRect(); }); - dummy.remove(); - return rect; -}; -c3_chart_internal_fn.generateXYForText = function (areaIndices, barIndices, lineIndices, forX) { - let $$ = this, - getAreaPoints = $$.generateGetAreaPoints(areaIndices, false), - getBarPoints = $$.generateGetBarPoints(barIndices, false), - getLinePoints = $$.generateGetLinePoints(lineIndices, false), - getter = forX ? $$.getXForText : $$.getYForText; - return function (d, i) { - const getPoints = $$.isAreaType(d) ? getAreaPoints : $$.isBarType(d) ? getBarPoints : getLinePoints; - return getter.call($$, getPoints(d, i), d, this); - }; -}; -c3_chart_internal_fn.getXForText = function (points, d, textElement) { - let $$ = this, - box = textElement.getBoundingClientRect(), xPos, padding; - if ($$.config.axis_rotated) { - padding = $$.isBarType(d) ? 4 : 6; - xPos = points[2][1] + padding * (d.value < 0 ? -1 : 1); - } else { - xPos = $$.hasType('bar') ? (points[2][0] + points[0][0]) / 2 : points[0][0]; - } - // show labels regardless of the domain if value is null - if (d.value === null) { - if (xPos > $$.width) { - xPos = $$.width - box.width; - } else if (xPos < 0) { - xPos = 4; - } - } - return xPos; -}; -c3_chart_internal_fn.getYForText = function (points, d, textElement) { - let $$ = this, - box = textElement.getBoundingClientRect(), - yPos; - if ($$.config.axis_rotated) { - yPos = (points[0][0] + points[2][0] + box.height * 0.6) / 2; - } else { - yPos = points[2][1]; - if (d.value < 0 || (d.value === 0 && !$$.hasPositiveValue)) { - yPos += box.height; - if ($$.isBarType(d) && $$.isSafari()) { - yPos -= 3; - } - else if (!$$.isBarType(d) && $$.isChrome()) { - yPos += 3; - } - } else { - yPos += $$.isBarType(d) ? -3 : -6; - } - } - // show labels regardless of the domain if value is null - if (d.value === null && !$$.config.axis_rotated) { - if (yPos < box.height) { - yPos = box.height; - } else if (yPos > this.height) { - yPos = this.height - 4; - } - } - return yPos; -}; diff --git a/src/chartinternal/title.js b/src/chartinternal/title.js deleted file mode 100644 index 0cf9ce6..0000000 --- a/src/chartinternal/title.js +++ /dev/null @@ -1,31 +0,0 @@ -c3_chart_internal_fn.initTitle = function () { - const $$ = this; - $$.title = $$.svg.append('text') - .text($$.config.title_text) - .attr('class', $$.CLASS.title); -}; -c3_chart_internal_fn.redrawTitle = function () { - const $$ = this; - $$.title - .attr('x', $$.xForTitle.bind($$)) - .attr('y', $$.yForTitle.bind($$)); -}; -c3_chart_internal_fn.xForTitle = function () { - let $$ = this, config = $$.config, position = config.title_position || 'left', x; - if (position.indexOf('right') >= 0) { - x = $$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width - config.title_padding.right; - } else if (position.indexOf('center') >= 0) { - x = ($$.currentWidth - $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).width) / 2; - } else { // left - x = config.title_padding.left; - } - return x; -}; -c3_chart_internal_fn.yForTitle = function () { - const $$ = this; - return $$.config.title_padding.top + $$.getTextRect($$.title.node().textContent, $$.CLASS.title, $$.title.node()).height; -}; -c3_chart_internal_fn.getTitlePadding = function () { - const $$ = this; - return $$.yForTitle() + $$.config.title_padding.bottom; -}; diff --git a/src/chartinternal/tooltip.js b/src/chartinternal/tooltip.js deleted file mode 100644 index 01d4340..0000000 --- a/src/chartinternal/tooltip.js +++ /dev/null @@ -1,136 +0,0 @@ -c3_chart_internal_fn.initTooltip = function () { - let $$ = this, config = $$.config, i; - $$.tooltip = $$.selectChart - .style('position', 'relative') - .append('div') - .attr('class', CLASS.tooltipContainer) - .style('position', 'absolute') - .style('pointer-events', 'none') - .style('display', 'none'); - // Show tooltip if needed - if (config.tooltip_init_show) { - if ($$.isTimeSeries() && isString(config.tooltip_init_x)) { - config.tooltip_init_x = $$.parseDate(config.tooltip_init_x); - for (i = 0; i < $$.data.targets[0].values.length; i++) { - if (($$.data.targets[0].values[i].x - config.tooltip_init_x) === 0) { break; } - } - config.tooltip_init_x = i; - } - $$.tooltip.html(config.tooltip_contents.call($$, $$.data.targets.map((d) => { - return $$.addName(d.values[config.tooltip_init_x]); - }), $$.axis.getXAxisTickFormat(), $$.getYFormat($$.hasArcType()), $$.color)); - $$.tooltip.style('top', config.tooltip_init_position.top) - .style('left', config.tooltip_init_position.left) - .style('display', 'block'); - } -}; -c3_chart_internal_fn.getTooltipContent = function (d, defaultTitleFormat, defaultValueFormat, color) { - let $$ = this, config = $$.config, - titleFormat = config.tooltip_format_title || defaultTitleFormat, - nameFormat = config.tooltip_format_name || function (name) { return name; }, - valueFormat = config.tooltip_format_value || defaultValueFormat, - text, i, title, value, name, bgcolor, - orderAsc = $$.isOrderAsc(); - - if (config.data_groups.length === 0) { - d.sort((a, b) => { - let v1 = a ? a.value : null, v2 = b ? b.value : null; - return orderAsc ? v1 - v2 : v2 - v1; - }); - } else { - const ids = $$.orderTargets($$.data.targets).map((i) => { - return i.id; - }); - d.sort((a, b) => { - let v1 = a ? a.value : null, v2 = b ? b.value : null; - if (v1 > 0 && v2 > 0) { - v1 = a ? ids.indexOf(a.id) : null; - v2 = b ? ids.indexOf(b.id) : null; - } - return orderAsc ? v1 - v2 : v2 - v1; - }); - } - - for (i = 0; i < d.length; i++) { - if (!(d[i] && (d[i].value || d[i].value === 0))) { continue; } - - if (!text) { - title = sanitise(titleFormat ? titleFormat(d[i].x) : d[i].x); - text = "" + (title || title === 0 ? "' : ''); - } - - value = sanitise(valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index, d)); - if (value !== undefined) { - // Skip elements when their name is set to null - if (d[i].name === null) { continue; } - name = sanitise(nameFormat(d[i].name, d[i].ratio, d[i].id, d[i].index)); - bgcolor = $$.levelColor ? $$.levelColor(d[i].value) : color(d[i].id); - - text += ""; - text += "'; - text += "'; - text += ''; - } - } - return text + '
" + title + '
" + name + '" + value + '
'; -}; -c3_chart_internal_fn.tooltipPosition = function (dataToShow, tWidth, tHeight, element) { - let $$ = this, config = $$.config, d3 = $$.d3; - let svgLeft, tooltipLeft, tooltipRight, tooltipTop, chartRight; - let forArc = $$.hasArcType(), - mouse = d3.mouse(element); - // Determin tooltip position - if (forArc) { - tooltipLeft = (($$.width - ($$.isLegendRight ? $$.getLegendWidth() : 0)) / 2) + mouse[0]; - tooltipTop = ($$.height / 2) + mouse[1] + 20; - } else { - svgLeft = $$.getSvgLeft(true); - if (config.axis_rotated) { - tooltipLeft = svgLeft + mouse[0] + 100; - tooltipRight = tooltipLeft + tWidth; - chartRight = $$.currentWidth - $$.getCurrentPaddingRight(); - tooltipTop = $$.x(dataToShow[0].x) + 20; - } else { - tooltipLeft = svgLeft + $$.getCurrentPaddingLeft(true) + $$.x(dataToShow[0].x) + 20; - tooltipRight = tooltipLeft + tWidth; - chartRight = svgLeft + $$.currentWidth - $$.getCurrentPaddingRight(); - tooltipTop = mouse[1] + 15; - } - - if (tooltipRight > chartRight) { - // 20 is needed for Firefox to keep tooltip width - tooltipLeft -= tooltipRight - chartRight + 20; - } - if (tooltipTop + tHeight > $$.currentHeight) { - tooltipTop -= tHeight + 30; - } - } - if (tooltipTop < 0) { - tooltipTop = 0; - } - return { top: tooltipTop, left: tooltipLeft }; -}; -c3_chart_internal_fn.showTooltip = function (selectedData, element) { - let $$ = this, config = $$.config; - let tWidth, tHeight, position; - let forArc = $$.hasArcType(), - dataToShow = selectedData.filter((d) => { return d && isValue(d.value); }), - positionFunction = config.tooltip_position || c3_chart_internal_fn.tooltipPosition; - if (dataToShow.length === 0 || !config.tooltip_show) { - return; - } - $$.tooltip.html(config.tooltip_contents.call($$, selectedData, $$.axis.getXAxisTickFormat(), $$.getYFormat(forArc), $$.color)).style('display', 'block'); - - // Get tooltip dimensions - tWidth = $$.tooltip.property('offsetWidth'); - tHeight = $$.tooltip.property('offsetHeight'); - - position = positionFunction.call(this, dataToShow, tWidth, tHeight, element); - // Set tooltip - $$.tooltip - .style('top', position.top + 'px') - .style('left', position.left + 'px'); -}; -c3_chart_internal_fn.hideTooltip = function () { - this.tooltip.style('display', 'none'); -}; diff --git a/src/chartinternal/transform.js b/src/chartinternal/transform.js deleted file mode 100644 index ad057e0..0000000 --- a/src/chartinternal/transform.js +++ /dev/null @@ -1,10 +0,0 @@ -c3_chart_internal_fn.transformTo = function (targetIds, type, optionsForRedraw) { - let $$ = this, - withTransitionForAxis = !$$.hasArcType(), - options = optionsForRedraw || { withTransitionForAxis }; - options.withTransitionForTransform = false; - $$.transiting = false; - $$.setTargetType(targetIds, type); - $$.updateTargets($$.data.targets); // this is needed when transforming to arc - $$.updateAndRedraw(options); -}; diff --git a/src/chartinternal/type.js b/src/chartinternal/type.js deleted file mode 100644 index 196b94a..0000000 --- a/src/chartinternal/type.js +++ /dev/null @@ -1,94 +0,0 @@ -c3_chart_internal_fn.setTargetType = function (targetIds, type) { - let $$ = this, config = $$.config; - $$.mapToTargetIds(targetIds).forEach((id) => { - $$.withoutFadeIn[id] = (type === config.data_types[id]); - config.data_types[id] = type; - }); - if (!targetIds) { - config.data_type = type; - } -}; -c3_chart_internal_fn.hasType = function (type, targets) { - let $$ = this, types = $$.config.data_types, has = false; - targets = targets || $$.data.targets; - if (targets && targets.length) { - targets.forEach((target) => { - const t = types[target.id]; - if ((t && t.indexOf(type) >= 0) || (!t && type === 'line')) { - has = true; - } - }); - } else if (Object.keys(types).length) { - Object.keys(types).forEach((id) => { - if (types[id] === type) { has = true; } - }); - } else { - has = $$.config.data_type === type; - } - return has; -}; -c3_chart_internal_fn.hasArcType = function (targets) { - return this.hasType('pie', targets) || this.hasType('donut', targets) || this.hasType('gauge', targets); -}; -c3_chart_internal_fn.isLineType = function (d) { - let config = this.config, id = isString(d) ? d : d.id; - return !config.data_types[id] || ['line', 'spline', 'area', 'area-spline', 'step', 'area-step'].indexOf(config.data_types[id]) >= 0; -}; -c3_chart_internal_fn.isStepType = function (d) { - const id = isString(d) ? d : d.id; - return ['step', 'area-step'].indexOf(this.config.data_types[id]) >= 0; -}; -c3_chart_internal_fn.isSplineType = function (d) { - const id = isString(d) ? d : d.id; - return ['spline', 'area-spline'].indexOf(this.config.data_types[id]) >= 0; -}; -c3_chart_internal_fn.isAreaType = function (d) { - const id = isString(d) ? d : d.id; - return ['area', 'area-spline', 'area-step'].indexOf(this.config.data_types[id]) >= 0; -}; -c3_chart_internal_fn.isBarType = function (d) { - const id = isString(d) ? d : d.id; - return this.config.data_types[id] === 'bar'; -}; -c3_chart_internal_fn.isScatterType = function (d) { - const id = isString(d) ? d : d.id; - return this.config.data_types[id] === 'scatter'; -}; -c3_chart_internal_fn.isPieType = function (d) { - const id = isString(d) ? d : d.id; - return this.config.data_types[id] === 'pie'; -}; -c3_chart_internal_fn.isGaugeType = function (d) { - const id = isString(d) ? d : d.id; - return this.config.data_types[id] === 'gauge'; -}; -c3_chart_internal_fn.isDonutType = function (d) { - const id = isString(d) ? d : d.id; - return this.config.data_types[id] === 'donut'; -}; -c3_chart_internal_fn.isArcType = function (d) { - return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d); -}; -c3_chart_internal_fn.lineData = function (d) { - return this.isLineType(d) ? [d] : []; -}; -c3_chart_internal_fn.arcData = function (d) { - return this.isArcType(d.data) ? [d] : []; -}; -/* not used - function scatterData(d) { - return isScatterType(d) ? d.values : []; - } - */ -c3_chart_internal_fn.barData = function (d) { - return this.isBarType(d) ? d.values : []; -}; -c3_chart_internal_fn.lineOrScatterData = function (d) { - return this.isLineType(d) || this.isScatterType(d) ? d.values : []; -}; -c3_chart_internal_fn.barOrLineData = function (d) { - return this.isBarType(d) || this.isLineType(d) ? d.values : []; -}; -c3_chart_internal_fn.isInterpolationType = function (type) { - return ['linear', 'linear-closed', 'basis', 'basis-open', 'basis-closed', 'bundle', 'cardinal', 'cardinal-open', 'cardinal-closed', 'monotone'].indexOf(type) >= 0; -}; diff --git a/src/chartinternal/ua.js b/src/chartinternal/ua.js deleted file mode 100644 index 0728fcd..0000000 --- a/src/chartinternal/ua.js +++ /dev/null @@ -1,8 +0,0 @@ -c3_chart_internal_fn.isSafari = function () { - const ua = window.navigator.userAgent; - return ua.indexOf('Safari') >= 0 && ua.indexOf('Chrome') < 0; -}; -c3_chart_internal_fn.isChrome = function () { - const ua = window.navigator.userAgent; - return ua.indexOf('Chrome') >= 0; -}; diff --git a/src/chartinternal/util.js b/src/chartinternal/util.js deleted file mode 100644 index 6ce9207..0000000 --- a/src/chartinternal/util.js +++ /dev/null @@ -1,49 +0,0 @@ -let isValue = c3_chart_internal_fn.isValue = function (v) { - return v || v === 0; - }, - isFunction = c3_chart_internal_fn.isFunction = function (o) { - return typeof o === 'function'; - }, - isString = c3_chart_internal_fn.isString = function (o) { - return typeof o === 'string'; - }, - isUndefined = c3_chart_internal_fn.isUndefined = function (v) { - return typeof v === 'undefined'; - }, - isDefined = c3_chart_internal_fn.isDefined = function (v) { - return typeof v !== 'undefined'; - }, - ceil10 = c3_chart_internal_fn.ceil10 = function (v) { - return Math.ceil(v / 10) * 10; - }, - asHalfPixel = c3_chart_internal_fn.asHalfPixel = function (n) { - return Math.ceil(n) + 0.5; - }, - diffDomain = c3_chart_internal_fn.diffDomain = function (d) { - return d[1] - d[0]; - }, - isEmpty = c3_chart_internal_fn.isEmpty = function (o) { - return typeof o === 'undefined' || o === null || (isString(o) && o.length === 0) || (typeof o === 'object' && Object.keys(o).length === 0); - }, - notEmpty = c3_chart_internal_fn.notEmpty = function (o) { - return !c3_chart_internal_fn.isEmpty(o); - }, - getOption = c3_chart_internal_fn.getOption = function (options, key, defaultValue) { - return isDefined(options[key]) ? options[key] : defaultValue; - }, - hasValue = c3_chart_internal_fn.hasValue = function (dict, value) { - let found = false; - Object.keys(dict).forEach((key) => { - if (dict[key] === value) { found = true; } - }); - return found; - }, - sanitise = c3_chart_internal_fn.sanitise = function (str) { - return typeof str === 'string' ? str.replace(//g, '>') : str; - }, - getPathBox = c3_chart_internal_fn.getPathBox = function (path) { - let box = path.getBoundingClientRect(), - items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)], - minX = items[0].x, minY = Math.min(items[0].y, items[1].y); - return { x: minX, y: minY, width: box.width, height: box.height }; - }; diff --git a/src/chartinternal/zoom.js b/src/chartinternal/zoom.js deleted file mode 100644 index a3e1e62..0000000 --- a/src/chartinternal/zoom.js +++ /dev/null @@ -1,75 +0,0 @@ -c3_chart_internal_fn.initZoom = function () { - let $$ = this, d3 = $$.d3, config = $$.config, startEvent; - - $$.zoom = d3.behavior.zoom() - .on('zoomstart', () => { - startEvent = d3.event.sourceEvent; - $$.zoom.altDomain = d3.event.sourceEvent.altKey ? $$.x.orgDomain() : null; - config.zoom_onzoomstart.call($$.api, d3.event.sourceEvent); - }) - .on('zoom', () => { - $$.redrawForZoom.call($$); - }) - .on('zoomend', () => { - const event = d3.event.sourceEvent; - // if click, do nothing. otherwise, click interaction will be canceled. - if (event && startEvent.clientX === event.clientX && startEvent.clientY === event.clientY) { - return; - } - $$.redrawEventRect(); - $$.updateZoom(); - config.zoom_onzoomend.call($$.api, $$.x.orgDomain()); - }); - $$.zoom.scale = function (scale) { - return config.axis_rotated ? this.y(scale) : this.x(scale); - }; - $$.zoom.orgScaleExtent = function () { - const extent = config.zoom_extent ? config.zoom_extent : [1, 10]; - return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])]; - }; - $$.zoom.updateScaleExtent = function () { - let ratio = diffDomain($$.x.orgDomain()) / diffDomain($$.getZoomDomain()), - extent = this.orgScaleExtent(); - this.scaleExtent([extent[0] * ratio, extent[1] * ratio]); - return this; - }; -}; -c3_chart_internal_fn.getZoomDomain = function () { - let $$ = this, config = $$.config, d3 = $$.d3, - min = d3.min([$$.orgXDomain[0], config.zoom_x_min]), - max = d3.max([$$.orgXDomain[1], config.zoom_x_max]); - return [min, max]; -}; -c3_chart_internal_fn.updateZoom = function () { - let $$ = this, z = $$.config.zoom_enabled ? $$.zoom : function () {}; - $$.main.select('.' + CLASS.zoomRect).call(z).on('dblclick.zoom', null); - $$.main.selectAll('.' + CLASS.eventRect).call(z).on('dblclick.zoom', null); -}; -c3_chart_internal_fn.redrawForZoom = function () { - let $$ = this, d3 = $$.d3, config = $$.config, zoom = $$.zoom, x = $$.x; - if (!config.zoom_enabled) { - return; - } - if ($$.filterTargetsToShow($$.data.targets).length === 0) { - return; - } - if (d3.event.sourceEvent.type === 'mousemove' && zoom.altDomain) { - x.domain(zoom.altDomain); - zoom.scale(x).updateScaleExtent(); - return; - } - if ($$.isCategorized() && x.orgDomain()[0] === $$.orgXDomain[0]) { - x.domain([$$.orgXDomain[0] - 1e-10, x.orgDomain()[1]]); - } - $$.redraw({ - withTransition: false, - withY: config.zoom_rescale, - withSubchart: false, - withEventRect: false, - withDimension: false, - }); - if (d3.event.sourceEvent.type === 'mousemove') { - $$.cancelClick = true; - } - config.zoom_onzoom.call($$.api, x.orgDomain()); -}; diff --git a/src/head.js b/src/head.js deleted file mode 100644 index f957401..0000000 --- a/src/head.js +++ /dev/null @@ -1,8 +0,0 @@ -/*global define, module, exports, require */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('d3')) : - typeof define === 'function' && define.amd ? define(['d3'],factory) : - (global.c3 = factory(global.d3)); -}(this, function (d3) { - 'use strict'; - var c3 = { version: "0.4.11-rc4" }; diff --git a/es6_modules/rollup.entry.js b/src/index.js similarity index 95% rename from es6_modules/rollup.entry.js rename to src/index.js index 1df2cdd..e3462eb 100644 --- a/es6_modules/rollup.entry.js +++ b/src/index.js @@ -9,7 +9,7 @@ import { Chart } from './chart/index'; import { Axis } from './axis/index'; -const version = '0.4.11'; +const version = '1.0.0'; const generate = function generate(config) { return new Chart(config); diff --git a/es6_modules/internals/arc.js b/src/internals/arc.js similarity index 100% rename from es6_modules/internals/arc.js rename to src/internals/arc.js diff --git a/es6_modules/internals/cache.js b/src/internals/cache.js similarity index 100% rename from es6_modules/internals/cache.js rename to src/internals/cache.js diff --git a/es6_modules/internals/category.js b/src/internals/category.js similarity index 100% rename from es6_modules/internals/category.js rename to src/internals/category.js diff --git a/es6_modules/internals/class.js b/src/internals/class.js similarity index 100% rename from es6_modules/internals/class.js rename to src/internals/class.js diff --git a/es6_modules/internals/clip.js b/src/internals/clip.js similarity index 100% rename from es6_modules/internals/clip.js rename to src/internals/clip.js diff --git a/es6_modules/internals/color.js b/src/internals/color.js similarity index 100% rename from es6_modules/internals/color.js rename to src/internals/color.js diff --git a/es6_modules/internals/config.js b/src/internals/config.js similarity index 100% rename from es6_modules/internals/config.js rename to src/internals/config.js diff --git a/es6_modules/internals/data.convert.js b/src/internals/data.convert.js similarity index 100% rename from es6_modules/internals/data.convert.js rename to src/internals/data.convert.js diff --git a/es6_modules/internals/data.js b/src/internals/data.js similarity index 100% rename from es6_modules/internals/data.js rename to src/internals/data.js diff --git a/es6_modules/internals/data.load.js b/src/internals/data.load.js similarity index 100% rename from es6_modules/internals/data.load.js rename to src/internals/data.load.js diff --git a/es6_modules/internals/domain.js b/src/internals/domain.js similarity index 99% rename from es6_modules/internals/domain.js rename to src/internals/domain.js index 0c75998..adf0381 100644 --- a/es6_modules/internals/domain.js +++ b/src/internals/domain.js @@ -1,3 +1,10 @@ +import { + isValue, + diffDomain, + notEmpty, + isDefined, +} from './util'; + const getYDomainMin = function (targets) { let $$ = this, config = $$.config, ids = $$.mapToIds(targets), ys = $$.getValuesAsIdKeyed(targets), diff --git a/es6_modules/internals/drag.js b/src/internals/drag.js similarity index 97% rename from es6_modules/internals/drag.js rename to src/internals/drag.js index 49d4f43..eebee33 100644 --- a/es6_modules/internals/drag.js +++ b/src/internals/drag.js @@ -1,3 +1,6 @@ +import { CLASS } from './class'; +import { getPathBox } from './util'; + const drag = function (mouse) { let $$ = this, config = $$.config, main = $$.main, d3 = $$.d3; let sx, sy, mx, my, minX, maxX, minY, maxY; diff --git a/es6_modules/internals/flow.js b/src/internals/flow.js similarity index 98% rename from es6_modules/internals/flow.js rename to src/internals/flow.js index 15dea51..f01f298 100644 --- a/es6_modules/internals/flow.js +++ b/src/internals/flow.js @@ -1,3 +1,9 @@ +import { + diffDomain, +} from './util'; + +import { CLASS } from './class'; + const generateFlow = function (args) { let $$ = this, config = $$.config, diff --git a/es6_modules/internals/format.js b/src/internals/format.js similarity index 98% rename from es6_modules/internals/format.js rename to src/internals/format.js index a42cba2..657e0d1 100644 --- a/es6_modules/internals/format.js +++ b/src/internals/format.js @@ -1,3 +1,5 @@ +import { isValue } from './util'; + const getYFormat = function (forArc) { let $$ = this, formatForY = forArc && !$$.hasType('gauge') ? $$.defaultArcValueFormat : $$.yFormat, diff --git a/es6_modules/internals/grid.js b/src/internals/grid.js similarity index 99% rename from es6_modules/internals/grid.js rename to src/internals/grid.js index 8a054bf..83e4a5a 100644 --- a/es6_modules/internals/grid.js +++ b/src/internals/grid.js @@ -1,3 +1,6 @@ +import { CLASS } from './class'; +import { isValue } from './util'; + const initGrid = function () { let $$ = this, config = $$.config, d3 = $$.d3; $$.grid = $$.main.append('g') diff --git a/es6_modules/internals/index.js b/src/internals/index.js similarity index 100% rename from es6_modules/internals/index.js rename to src/internals/index.js diff --git a/es6_modules/internals/interaction.js b/src/internals/interaction.js similarity index 99% rename from es6_modules/internals/interaction.js rename to src/internals/interaction.js index 99c6e65..1a7d29c 100644 --- a/es6_modules/internals/interaction.js +++ b/src/internals/interaction.js @@ -1,3 +1,5 @@ +import { CLASS } from './class'; + const initEventRect = function () { const $$ = this; $$.main.select('.' + CLASS.chart).append('g') diff --git a/es6_modules/internals/legend.js b/src/internals/legend.js similarity index 99% rename from es6_modules/internals/legend.js rename to src/internals/legend.js index aad5dd3..3c621b1 100644 --- a/es6_modules/internals/legend.js +++ b/src/internals/legend.js @@ -1,3 +1,10 @@ +import { CLASS } from './class'; +import { + isEmpty, + isDefined, + getOption, +} from './util'; + const initLegend = function () { const $$ = this; $$.legendItemTextBox = {}; diff --git a/es6_modules/internals/region.js b/src/internals/region.js similarity index 98% rename from es6_modules/internals/region.js rename to src/internals/region.js index eb203c3..02dcf0a 100644 --- a/es6_modules/internals/region.js +++ b/src/internals/region.js @@ -1,3 +1,6 @@ +import { CLASS } from './class'; +import { isValue } from './util'; + const initRegion = function () { const $$ = this; $$.region = $$.main.append('g') diff --git a/es6_modules/internals/scale.js b/src/internals/scale.js similarity index 100% rename from es6_modules/internals/scale.js rename to src/internals/scale.js diff --git a/es6_modules/internals/selection.js b/src/internals/selection.js similarity index 99% rename from es6_modules/internals/selection.js rename to src/internals/selection.js index 796662a..a6a803f 100644 --- a/es6_modules/internals/selection.js +++ b/src/internals/selection.js @@ -1,3 +1,5 @@ +import { CLASS } from './class'; + const selectPoint = function (target, d, i) { let $$ = this, config = $$.config, cx = (config.axis_rotated ? $$.circleY : $$.circleX).bind($$), diff --git a/es6_modules/internals/shape.bar.js b/src/internals/shape.bar.js similarity index 100% rename from es6_modules/internals/shape.bar.js rename to src/internals/shape.bar.js diff --git a/es6_modules/internals/shape.js b/src/internals/shape.js similarity index 100% rename from es6_modules/internals/shape.js rename to src/internals/shape.js diff --git a/es6_modules/internals/shape.line.js b/src/internals/shape.line.js similarity index 100% rename from es6_modules/internals/shape.line.js rename to src/internals/shape.line.js diff --git a/es6_modules/internals/size.js b/src/internals/size.js similarity index 100% rename from es6_modules/internals/size.js rename to src/internals/size.js diff --git a/es6_modules/internals/subchart.js b/src/internals/subchart.js similarity index 100% rename from es6_modules/internals/subchart.js rename to src/internals/subchart.js diff --git a/es6_modules/internals/text.js b/src/internals/text.js similarity index 100% rename from es6_modules/internals/text.js rename to src/internals/text.js diff --git a/es6_modules/internals/title.js b/src/internals/title.js similarity index 100% rename from es6_modules/internals/title.js rename to src/internals/title.js diff --git a/es6_modules/internals/tooltip.js b/src/internals/tooltip.js similarity index 100% rename from es6_modules/internals/tooltip.js rename to src/internals/tooltip.js diff --git a/es6_modules/internals/transform.js b/src/internals/transform.js similarity index 100% rename from es6_modules/internals/transform.js rename to src/internals/transform.js diff --git a/es6_modules/internals/type.js b/src/internals/type.js similarity index 100% rename from es6_modules/internals/type.js rename to src/internals/type.js diff --git a/es6_modules/internals/ua.js b/src/internals/ua.js similarity index 100% rename from es6_modules/internals/ua.js rename to src/internals/ua.js diff --git a/es6_modules/internals/util.js b/src/internals/util.js similarity index 100% rename from es6_modules/internals/util.js rename to src/internals/util.js diff --git a/es6_modules/internals/zoom.js b/src/internals/zoom.js similarity index 100% rename from es6_modules/internals/zoom.js rename to src/internals/zoom.js diff --git a/src/polyfill.js b/src/polyfill.js deleted file mode 100644 index 31343f6..0000000 --- a/src/polyfill.js +++ /dev/null @@ -1,842 +0,0 @@ -/* jshint ignore:start */ - -// PhantomJS doesn't have support for Function.prototype.bind, which has caused confusion. Use -// this polyfill to avoid the confusion. -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Polyfill - -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== 'function') { - // closest thing possible to the ECMAScript 5 - // internal IsCallable function - throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); - } - - let aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; -} - -// SVGPathSeg API polyfill -// https://github.com/progers/pathseg -// -// This is a drop-in replacement for the SVGPathSeg and SVGPathSegList APIs that were removed from -// SVG2 (https://lists.w3.org/Archives/Public/www-svg/2015Jun/0044.html), including the latest spec -// changes which were implemented in Firefox 43 and Chrome 46. -// Chrome 48 removes these APIs, so this polyfill is required. - -(function () { 'use strict'; - if (!('SVGPathSeg' in window)) { - // Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathSeg - window.SVGPathSeg = function (type, typeAsLetter, owningPathSegList) { - this.pathSegType = type; - this.pathSegTypeAsLetter = typeAsLetter; - this._owningPathSegList = owningPathSegList; - }; - - SVGPathSeg.PATHSEG_UNKNOWN = 0; - SVGPathSeg.PATHSEG_CLOSEPATH = 1; - SVGPathSeg.PATHSEG_MOVETO_ABS = 2; - SVGPathSeg.PATHSEG_MOVETO_REL = 3; - SVGPathSeg.PATHSEG_LINETO_ABS = 4; - SVGPathSeg.PATHSEG_LINETO_REL = 5; - SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS = 6; - SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL = 7; - SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS = 8; - SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL = 9; - SVGPathSeg.PATHSEG_ARC_ABS = 10; - SVGPathSeg.PATHSEG_ARC_REL = 11; - SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS = 12; - SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL = 13; - SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS = 14; - SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL = 15; - SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16; - SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17; - SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18; - SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19; - - // Notify owning PathSegList on any changes so they can be synchronized back to the path element. - SVGPathSeg.prototype._segmentChanged = function () { - if (this._owningPathSegList) - this._owningPathSegList.segmentChanged(this); - }; - - window.SVGPathSegClosePath = function (owningPathSegList) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CLOSEPATH, 'z', owningPathSegList); - }; - SVGPathSegClosePath.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegClosePath.prototype.toString = function () { return '[object SVGPathSegClosePath]'; }; - SVGPathSegClosePath.prototype._asPathString = function () { return this.pathSegTypeAsLetter; }; - SVGPathSegClosePath.prototype.clone = function () { return new SVGPathSegClosePath(undefined); }; - - window.SVGPathSegMovetoAbs = function (owningPathSegList, x, y) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_MOVETO_ABS, 'M', owningPathSegList); - this._x = x; - this._y = y; - }; - SVGPathSegMovetoAbs.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegMovetoAbs.prototype.toString = function () { return '[object SVGPathSegMovetoAbs]'; }; - SVGPathSegMovetoAbs.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }; - SVGPathSegMovetoAbs.prototype.clone = function () { return new SVGPathSegMovetoAbs(undefined, this._x, this._y); }; - Object.defineProperty(SVGPathSegMovetoAbs.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegMovetoAbs.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegMovetoRel = function (owningPathSegList, x, y) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_MOVETO_REL, 'm', owningPathSegList); - this._x = x; - this._y = y; - }; - SVGPathSegMovetoRel.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegMovetoRel.prototype.toString = function () { return '[object SVGPathSegMovetoRel]'; }; - SVGPathSegMovetoRel.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }; - SVGPathSegMovetoRel.prototype.clone = function () { return new SVGPathSegMovetoRel(undefined, this._x, this._y); }; - Object.defineProperty(SVGPathSegMovetoRel.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegMovetoRel.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegLinetoAbs = function (owningPathSegList, x, y) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_ABS, 'L', owningPathSegList); - this._x = x; - this._y = y; - }; - SVGPathSegLinetoAbs.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegLinetoAbs.prototype.toString = function () { return '[object SVGPathSegLinetoAbs]'; }; - SVGPathSegLinetoAbs.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }; - SVGPathSegLinetoAbs.prototype.clone = function () { return new SVGPathSegLinetoAbs(undefined, this._x, this._y); }; - Object.defineProperty(SVGPathSegLinetoAbs.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegLinetoAbs.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegLinetoRel = function (owningPathSegList, x, y) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_REL, 'l', owningPathSegList); - this._x = x; - this._y = y; - }; - SVGPathSegLinetoRel.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegLinetoRel.prototype.toString = function () { return '[object SVGPathSegLinetoRel]'; }; - SVGPathSegLinetoRel.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }; - SVGPathSegLinetoRel.prototype.clone = function () { return new SVGPathSegLinetoRel(undefined, this._x, this._y); }; - Object.defineProperty(SVGPathSegLinetoRel.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegLinetoRel.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegCurvetoCubicAbs = function (owningPathSegList, x, y, x1, y1, x2, y2) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS, 'C', owningPathSegList); - this._x = x; - this._y = y; - this._x1 = x1; - this._y1 = y1; - this._x2 = x2; - this._y2 = y2; - }; - SVGPathSegCurvetoCubicAbs.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegCurvetoCubicAbs.prototype.toString = function () { return '[object SVGPathSegCurvetoCubicAbs]'; }; - SVGPathSegCurvetoCubicAbs.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x1 + ' ' + this._y1 + ' ' + this._x2 + ' ' + this._y2 + ' ' + this._x + ' ' + this._y; }; - SVGPathSegCurvetoCubicAbs.prototype.clone = function () { return new SVGPathSegCurvetoCubicAbs(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2); }; - Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, 'x1', { get() { return this._x1; }, set(x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, 'y1', { get() { return this._y1; }, set(y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, 'x2', { get() { return this._x2; }, set(x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicAbs.prototype, 'y2', { get() { return this._y2; }, set(y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegCurvetoCubicRel = function (owningPathSegList, x, y, x1, y1, x2, y2) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL, 'c', owningPathSegList); - this._x = x; - this._y = y; - this._x1 = x1; - this._y1 = y1; - this._x2 = x2; - this._y2 = y2; - }; - SVGPathSegCurvetoCubicRel.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegCurvetoCubicRel.prototype.toString = function () { return '[object SVGPathSegCurvetoCubicRel]'; }; - SVGPathSegCurvetoCubicRel.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x1 + ' ' + this._y1 + ' ' + this._x2 + ' ' + this._y2 + ' ' + this._x + ' ' + this._y; }; - SVGPathSegCurvetoCubicRel.prototype.clone = function () { return new SVGPathSegCurvetoCubicRel(undefined, this._x, this._y, this._x1, this._y1, this._x2, this._y2); }; - Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, 'x1', { get() { return this._x1; }, set(x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, 'y1', { get() { return this._y1; }, set(y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, 'x2', { get() { return this._x2; }, set(x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicRel.prototype, 'y2', { get() { return this._y2; }, set(y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegCurvetoQuadraticAbs = function (owningPathSegList, x, y, x1, y1) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS, 'Q', owningPathSegList); - this._x = x; - this._y = y; - this._x1 = x1; - this._y1 = y1; - }; - SVGPathSegCurvetoQuadraticAbs.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegCurvetoQuadraticAbs.prototype.toString = function () { return '[object SVGPathSegCurvetoQuadraticAbs]'; }; - SVGPathSegCurvetoQuadraticAbs.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x1 + ' ' + this._y1 + ' ' + this._x + ' ' + this._y; }; - SVGPathSegCurvetoQuadraticAbs.prototype.clone = function () { return new SVGPathSegCurvetoQuadraticAbs(undefined, this._x, this._y, this._x1, this._y1); }; - Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype, 'x1', { get() { return this._x1; }, set(x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoQuadraticAbs.prototype, 'y1', { get() { return this._y1; }, set(y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegCurvetoQuadraticRel = function (owningPathSegList, x, y, x1, y1) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL, 'q', owningPathSegList); - this._x = x; - this._y = y; - this._x1 = x1; - this._y1 = y1; - }; - SVGPathSegCurvetoQuadraticRel.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegCurvetoQuadraticRel.prototype.toString = function () { return '[object SVGPathSegCurvetoQuadraticRel]'; }; - SVGPathSegCurvetoQuadraticRel.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x1 + ' ' + this._y1 + ' ' + this._x + ' ' + this._y; }; - SVGPathSegCurvetoQuadraticRel.prototype.clone = function () { return new SVGPathSegCurvetoQuadraticRel(undefined, this._x, this._y, this._x1, this._y1); }; - Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, 'x1', { get() { return this._x1; }, set(x1) { this._x1 = x1; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoQuadraticRel.prototype, 'y1', { get() { return this._y1; }, set(y1) { this._y1 = y1; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegArcAbs = function (owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_ARC_ABS, 'A', owningPathSegList); - this._x = x; - this._y = y; - this._r1 = r1; - this._r2 = r2; - this._angle = angle; - this._largeArcFlag = largeArcFlag; - this._sweepFlag = sweepFlag; - }; - SVGPathSegArcAbs.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegArcAbs.prototype.toString = function () { return '[object SVGPathSegArcAbs]'; }; - SVGPathSegArcAbs.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._r1 + ' ' + this._r2 + ' ' + this._angle + ' ' + (this._largeArcFlag ? '1' : '0') + ' ' + (this._sweepFlag ? '1' : '0') + ' ' + this._x + ' ' + this._y; }; - SVGPathSegArcAbs.prototype.clone = function () { return new SVGPathSegArcAbs(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag); }; - Object.defineProperty(SVGPathSegArcAbs.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcAbs.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcAbs.prototype, 'r1', { get() { return this._r1; }, set(r1) { this._r1 = r1; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcAbs.prototype, 'r2', { get() { return this._r2; }, set(r2) { this._r2 = r2; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcAbs.prototype, 'angle', { get() { return this._angle; }, set(angle) { this._angle = angle; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcAbs.prototype, 'largeArcFlag', { get() { return this._largeArcFlag; }, set(largeArcFlag) { this._largeArcFlag = largeArcFlag; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcAbs.prototype, 'sweepFlag', { get() { return this._sweepFlag; }, set(sweepFlag) { this._sweepFlag = sweepFlag; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegArcRel = function (owningPathSegList, x, y, r1, r2, angle, largeArcFlag, sweepFlag) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_ARC_REL, 'a', owningPathSegList); - this._x = x; - this._y = y; - this._r1 = r1; - this._r2 = r2; - this._angle = angle; - this._largeArcFlag = largeArcFlag; - this._sweepFlag = sweepFlag; - }; - SVGPathSegArcRel.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegArcRel.prototype.toString = function () { return '[object SVGPathSegArcRel]'; }; - SVGPathSegArcRel.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._r1 + ' ' + this._r2 + ' ' + this._angle + ' ' + (this._largeArcFlag ? '1' : '0') + ' ' + (this._sweepFlag ? '1' : '0') + ' ' + this._x + ' ' + this._y; }; - SVGPathSegArcRel.prototype.clone = function () { return new SVGPathSegArcRel(undefined, this._x, this._y, this._r1, this._r2, this._angle, this._largeArcFlag, this._sweepFlag); }; - Object.defineProperty(SVGPathSegArcRel.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcRel.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcRel.prototype, 'r1', { get() { return this._r1; }, set(r1) { this._r1 = r1; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcRel.prototype, 'r2', { get() { return this._r2; }, set(r2) { this._r2 = r2; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcRel.prototype, 'angle', { get() { return this._angle; }, set(angle) { this._angle = angle; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcRel.prototype, 'largeArcFlag', { get() { return this._largeArcFlag; }, set(largeArcFlag) { this._largeArcFlag = largeArcFlag; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegArcRel.prototype, 'sweepFlag', { get() { return this._sweepFlag; }, set(sweepFlag) { this._sweepFlag = sweepFlag; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegLinetoHorizontalAbs = function (owningPathSegList, x) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS, 'H', owningPathSegList); - this._x = x; - }; - SVGPathSegLinetoHorizontalAbs.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegLinetoHorizontalAbs.prototype.toString = function () { return '[object SVGPathSegLinetoHorizontalAbs]'; }; - SVGPathSegLinetoHorizontalAbs.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x; }; - SVGPathSegLinetoHorizontalAbs.prototype.clone = function () { return new SVGPathSegLinetoHorizontalAbs(undefined, this._x); }; - Object.defineProperty(SVGPathSegLinetoHorizontalAbs.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegLinetoHorizontalRel = function (owningPathSegList, x) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL, 'h', owningPathSegList); - this._x = x; - }; - SVGPathSegLinetoHorizontalRel.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegLinetoHorizontalRel.prototype.toString = function () { return '[object SVGPathSegLinetoHorizontalRel]'; }; - SVGPathSegLinetoHorizontalRel.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x; }; - SVGPathSegLinetoHorizontalRel.prototype.clone = function () { return new SVGPathSegLinetoHorizontalRel(undefined, this._x); }; - Object.defineProperty(SVGPathSegLinetoHorizontalRel.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegLinetoVerticalAbs = function (owningPathSegList, y) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS, 'V', owningPathSegList); - this._y = y; - }; - SVGPathSegLinetoVerticalAbs.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegLinetoVerticalAbs.prototype.toString = function () { return '[object SVGPathSegLinetoVerticalAbs]'; }; - SVGPathSegLinetoVerticalAbs.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._y; }; - SVGPathSegLinetoVerticalAbs.prototype.clone = function () { return new SVGPathSegLinetoVerticalAbs(undefined, this._y); }; - Object.defineProperty(SVGPathSegLinetoVerticalAbs.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegLinetoVerticalRel = function (owningPathSegList, y) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL, 'v', owningPathSegList); - this._y = y; - }; - SVGPathSegLinetoVerticalRel.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegLinetoVerticalRel.prototype.toString = function () { return '[object SVGPathSegLinetoVerticalRel]'; }; - SVGPathSegLinetoVerticalRel.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._y; }; - SVGPathSegLinetoVerticalRel.prototype.clone = function () { return new SVGPathSegLinetoVerticalRel(undefined, this._y); }; - Object.defineProperty(SVGPathSegLinetoVerticalRel.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegCurvetoCubicSmoothAbs = function (owningPathSegList, x, y, x2, y2) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, 'S', owningPathSegList); - this._x = x; - this._y = y; - this._x2 = x2; - this._y2 = y2; - }; - SVGPathSegCurvetoCubicSmoothAbs.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegCurvetoCubicSmoothAbs.prototype.toString = function () { return '[object SVGPathSegCurvetoCubicSmoothAbs]'; }; - SVGPathSegCurvetoCubicSmoothAbs.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x2 + ' ' + this._y2 + ' ' + this._x + ' ' + this._y; }; - SVGPathSegCurvetoCubicSmoothAbs.prototype.clone = function () { return new SVGPathSegCurvetoCubicSmoothAbs(undefined, this._x, this._y, this._x2, this._y2); }; - Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype, 'x2', { get() { return this._x2; }, set(x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicSmoothAbs.prototype, 'y2', { get() { return this._y2; }, set(y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegCurvetoCubicSmoothRel = function (owningPathSegList, x, y, x2, y2) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL, 's', owningPathSegList); - this._x = x; - this._y = y; - this._x2 = x2; - this._y2 = y2; - }; - SVGPathSegCurvetoCubicSmoothRel.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegCurvetoCubicSmoothRel.prototype.toString = function () { return '[object SVGPathSegCurvetoCubicSmoothRel]'; }; - SVGPathSegCurvetoCubicSmoothRel.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x2 + ' ' + this._y2 + ' ' + this._x + ' ' + this._y; }; - SVGPathSegCurvetoCubicSmoothRel.prototype.clone = function () { return new SVGPathSegCurvetoCubicSmoothRel(undefined, this._x, this._y, this._x2, this._y2); }; - Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype, 'x2', { get() { return this._x2; }, set(x2) { this._x2 = x2; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoCubicSmoothRel.prototype, 'y2', { get() { return this._y2; }, set(y2) { this._y2 = y2; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegCurvetoQuadraticSmoothAbs = function (owningPathSegList, x, y) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, 'T', owningPathSegList); - this._x = x; - this._y = y; - }; - SVGPathSegCurvetoQuadraticSmoothAbs.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegCurvetoQuadraticSmoothAbs.prototype.toString = function () { return '[object SVGPathSegCurvetoQuadraticSmoothAbs]'; }; - SVGPathSegCurvetoQuadraticSmoothAbs.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }; - SVGPathSegCurvetoQuadraticSmoothAbs.prototype.clone = function () { return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined, this._x, this._y); }; - Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothAbs.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - - window.SVGPathSegCurvetoQuadraticSmoothRel = function (owningPathSegList, x, y) { - SVGPathSeg.call(this, SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, 't', owningPathSegList); - this._x = x; - this._y = y; - }; - SVGPathSegCurvetoQuadraticSmoothRel.prototype = Object.create(SVGPathSeg.prototype); - SVGPathSegCurvetoQuadraticSmoothRel.prototype.toString = function () { return '[object SVGPathSegCurvetoQuadraticSmoothRel]'; }; - SVGPathSegCurvetoQuadraticSmoothRel.prototype._asPathString = function () { return this.pathSegTypeAsLetter + ' ' + this._x + ' ' + this._y; }; - SVGPathSegCurvetoQuadraticSmoothRel.prototype.clone = function () { return new SVGPathSegCurvetoQuadraticSmoothRel(undefined, this._x, this._y); }; - Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype, 'x', { get() { return this._x; }, set(x) { this._x = x; this._segmentChanged(); }, enumerable: true }); - Object.defineProperty(SVGPathSegCurvetoQuadraticSmoothRel.prototype, 'y', { get() { return this._y; }, set(y) { this._y = y; this._segmentChanged(); }, enumerable: true }); - - // Add createSVGPathSeg* functions to SVGPathElement. - // Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathElement. - SVGPathElement.prototype.createSVGPathSegClosePath = function () { return new SVGPathSegClosePath(undefined); }; - SVGPathElement.prototype.createSVGPathSegMovetoAbs = function (x, y) { return new SVGPathSegMovetoAbs(undefined, x, y); }; - SVGPathElement.prototype.createSVGPathSegMovetoRel = function (x, y) { return new SVGPathSegMovetoRel(undefined, x, y); }; - SVGPathElement.prototype.createSVGPathSegLinetoAbs = function (x, y) { return new SVGPathSegLinetoAbs(undefined, x, y); }; - SVGPathElement.prototype.createSVGPathSegLinetoRel = function (x, y) { return new SVGPathSegLinetoRel(undefined, x, y); }; - SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs = function (x, y, x1, y1, x2, y2) { return new SVGPathSegCurvetoCubicAbs(undefined, x, y, x1, y1, x2, y2); }; - SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel = function (x, y, x1, y1, x2, y2) { return new SVGPathSegCurvetoCubicRel(undefined, x, y, x1, y1, x2, y2); }; - SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs = function (x, y, x1, y1) { return new SVGPathSegCurvetoQuadraticAbs(undefined, x, y, x1, y1); }; - SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel = function (x, y, x1, y1) { return new SVGPathSegCurvetoQuadraticRel(undefined, x, y, x1, y1); }; - SVGPathElement.prototype.createSVGPathSegArcAbs = function (x, y, r1, r2, angle, largeArcFlag, sweepFlag) { return new SVGPathSegArcAbs(undefined, x, y, r1, r2, angle, largeArcFlag, sweepFlag); }; - SVGPathElement.prototype.createSVGPathSegArcRel = function (x, y, r1, r2, angle, largeArcFlag, sweepFlag) { return new SVGPathSegArcRel(undefined, x, y, r1, r2, angle, largeArcFlag, sweepFlag); }; - SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs = function (x) { return new SVGPathSegLinetoHorizontalAbs(undefined, x); }; - SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel = function (x) { return new SVGPathSegLinetoHorizontalRel(undefined, x); }; - SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs = function (y) { return new SVGPathSegLinetoVerticalAbs(undefined, y); }; - SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel = function (y) { return new SVGPathSegLinetoVerticalRel(undefined, y); }; - SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs = function (x, y, x2, y2) { return new SVGPathSegCurvetoCubicSmoothAbs(undefined, x, y, x2, y2); }; - SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel = function (x, y, x2, y2) { return new SVGPathSegCurvetoCubicSmoothRel(undefined, x, y, x2, y2); }; - SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs = function (x, y) { return new SVGPathSegCurvetoQuadraticSmoothAbs(undefined, x, y); }; - SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel = function (x, y) { return new SVGPathSegCurvetoQuadraticSmoothRel(undefined, x, y); }; - } - - if (!('SVGPathSegList' in window)) { - // Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGPathSegList - window.SVGPathSegList = function (pathElement) { - this._pathElement = pathElement; - this._list = this._parsePath(this._pathElement.getAttribute('d')); - - // Use a MutationObserver to catch changes to the path's "d" attribute. - this._mutationObserverConfig = { 'attributes': true, 'attributeFilter': ['d'] }; - this._pathElementMutationObserver = new MutationObserver(this._updateListFromPathMutations.bind(this)); - this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig); - }; - - Object.defineProperty(SVGPathSegList.prototype, 'numberOfItems', { - get() { - this._checkPathSynchronizedToList(); - return this._list.length; - }, - enumerable: true, - }); - - // Add the pathSegList accessors to SVGPathElement. - // Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-InterfaceSVGAnimatedPathData - Object.defineProperty(SVGPathElement.prototype, 'pathSegList', { - get() { - if (!this._pathSegList) - this._pathSegList = new SVGPathSegList(this); - return this._pathSegList; - }, - enumerable: true, - }); - // FIXME: The following are not implemented and simply return SVGPathElement.pathSegList. - Object.defineProperty(SVGPathElement.prototype, 'normalizedPathSegList', { get() { return this.pathSegList; }, enumerable: true }); - Object.defineProperty(SVGPathElement.prototype, 'animatedPathSegList', { get() { return this.pathSegList; }, enumerable: true }); - Object.defineProperty(SVGPathElement.prototype, 'animatedNormalizedPathSegList', { get() { return this.pathSegList; }, enumerable: true }); - - // Process any pending mutations to the path element and update the list as needed. - // This should be the first call of all public functions and is needed because - // MutationObservers are not synchronous so we can have pending asynchronous mutations. - SVGPathSegList.prototype._checkPathSynchronizedToList = function () { - this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords()); - }; - - SVGPathSegList.prototype._updateListFromPathMutations = function (mutationRecords) { - if (!this._pathElement) - return; - let hasPathMutations = false; - mutationRecords.forEach((record) => { - if (record.attributeName == 'd') - hasPathMutations = true; - }); - if (hasPathMutations) - this._list = this._parsePath(this._pathElement.getAttribute('d')); - }; - - // Serialize the list and update the path's 'd' attribute. - SVGPathSegList.prototype._writeListToPath = function () { - this._pathElementMutationObserver.disconnect(); - this._pathElement.setAttribute('d', SVGPathSegList._pathSegArrayAsString(this._list)); - this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig); - }; - - // When a path segment changes the list needs to be synchronized back to the path element. - SVGPathSegList.prototype.segmentChanged = function (pathSeg) { - this._writeListToPath(); - }; - - SVGPathSegList.prototype.clear = function () { - this._checkPathSynchronizedToList(); - - this._list.forEach((pathSeg) => { - pathSeg._owningPathSegList = null; - }); - this._list = []; - this._writeListToPath(); - }; - - SVGPathSegList.prototype.initialize = function (newItem) { - this._checkPathSynchronizedToList(); - - this._list = [newItem]; - newItem._owningPathSegList = this; - this._writeListToPath(); - return newItem; - }; - - SVGPathSegList.prototype._checkValidIndex = function (index) { - if (isNaN(index) || index < 0 || index >= this.numberOfItems) - throw 'INDEX_SIZE_ERR'; - }; - - SVGPathSegList.prototype.getItem = function (index) { - this._checkPathSynchronizedToList(); - - this._checkValidIndex(index); - return this._list[index]; - }; - - SVGPathSegList.prototype.insertItemBefore = function (newItem, index) { - this._checkPathSynchronizedToList(); - - // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list. - if (index > this.numberOfItems) - index = this.numberOfItems; - if (newItem._owningPathSegList) { - // SVG2 spec says to make a copy. - newItem = newItem.clone(); - } - this._list.splice(index, 0, newItem); - newItem._owningPathSegList = this; - this._writeListToPath(); - return newItem; - }; - - SVGPathSegList.prototype.replaceItem = function (newItem, index) { - this._checkPathSynchronizedToList(); - - if (newItem._owningPathSegList) { - // SVG2 spec says to make a copy. - newItem = newItem.clone(); - } - this._checkValidIndex(index); - this._list[index] = newItem; - newItem._owningPathSegList = this; - this._writeListToPath(); - return newItem; - }; - - SVGPathSegList.prototype.removeItem = function (index) { - this._checkPathSynchronizedToList(); - - this._checkValidIndex(index); - const item = this._list[index]; - this._list.splice(index, 1); - this._writeListToPath(); - return item; - }; - - SVGPathSegList.prototype.appendItem = function (newItem) { - this._checkPathSynchronizedToList(); - - if (newItem._owningPathSegList) { - // SVG2 spec says to make a copy. - newItem = newItem.clone(); - } - this._list.push(newItem); - newItem._owningPathSegList = this; - // TODO: Optimize this to just append to the existing attribute. - this._writeListToPath(); - return newItem; - }; - - SVGPathSegList._pathSegArrayAsString = function (pathSegArray) { - let string = ''; - let first = true; - pathSegArray.forEach((pathSeg) => { - if (first) { - first = false; - string += pathSeg._asPathString(); - } else { - string += ' ' + pathSeg._asPathString(); - } - }); - return string; - }; - - // This closely follows SVGPathParser::parsePath from Source/core/svg/SVGPathParser.cpp. - SVGPathSegList.prototype._parsePath = function (string) { - if (!string || string.length == 0) - return []; - - const owningPathSegList = this; - - const Builder = function () { - this.pathSegList = []; - }; - - Builder.prototype.appendSegment = function (pathSeg) { - this.pathSegList.push(pathSeg); - }; - - const Source = function (string) { - this._string = string; - this._currentIndex = 0; - this._endIndex = this._string.length; - this._previousCommand = SVGPathSeg.PATHSEG_UNKNOWN; - - this._skipOptionalSpaces(); - }; - - Source.prototype._isCurrentSpace = function () { - const character = this._string[this._currentIndex]; - return character <= ' ' && (character == ' ' || character == '\n' || character == '\t' || character == '\r' || character == '\f'); - }; - - Source.prototype._skipOptionalSpaces = function () { - while (this._currentIndex < this._endIndex && this._isCurrentSpace()) - this._currentIndex++; - return this._currentIndex < this._endIndex; - }; - - Source.prototype._skipOptionalSpacesOrDelimiter = function () { - if (this._currentIndex < this._endIndex && !this._isCurrentSpace() && this._string.charAt(this._currentIndex) != ',') - return false; - if (this._skipOptionalSpaces()) { - if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == ',') { - this._currentIndex++; - this._skipOptionalSpaces(); - } - } - return this._currentIndex < this._endIndex; - }; - - Source.prototype.hasMoreData = function () { - return this._currentIndex < this._endIndex; - }; - - Source.prototype.peekSegmentType = function () { - const lookahead = this._string[this._currentIndex]; - return this._pathSegTypeFromChar(lookahead); - }; - - Source.prototype._pathSegTypeFromChar = function (lookahead) { - switch (lookahead) { - case 'Z': - case 'z': - return SVGPathSeg.PATHSEG_CLOSEPATH; - case 'M': - return SVGPathSeg.PATHSEG_MOVETO_ABS; - case 'm': - return SVGPathSeg.PATHSEG_MOVETO_REL; - case 'L': - return SVGPathSeg.PATHSEG_LINETO_ABS; - case 'l': - return SVGPathSeg.PATHSEG_LINETO_REL; - case 'C': - return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS; - case 'c': - return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL; - case 'Q': - return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS; - case 'q': - return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL; - case 'A': - return SVGPathSeg.PATHSEG_ARC_ABS; - case 'a': - return SVGPathSeg.PATHSEG_ARC_REL; - case 'H': - return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS; - case 'h': - return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL; - case 'V': - return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS; - case 'v': - return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL; - case 'S': - return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS; - case 's': - return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL; - case 'T': - return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS; - case 't': - return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL; - default: - return SVGPathSeg.PATHSEG_UNKNOWN; - } - }; - - Source.prototype._nextCommandHelper = function (lookahead, previousCommand) { - // Check for remaining coordinates in the current command. - if ((lookahead == '+' || lookahead == '-' || lookahead == '.' || (lookahead >= '0' && lookahead <= '9')) && previousCommand != SVGPathSeg.PATHSEG_CLOSEPATH) { - if (previousCommand == SVGPathSeg.PATHSEG_MOVETO_ABS) - return SVGPathSeg.PATHSEG_LINETO_ABS; - if (previousCommand == SVGPathSeg.PATHSEG_MOVETO_REL) - return SVGPathSeg.PATHSEG_LINETO_REL; - return previousCommand; - } - return SVGPathSeg.PATHSEG_UNKNOWN; - }; - - Source.prototype.initialCommandIsMoveTo = function () { - // If the path is empty it is still valid, so return true. - if (!this.hasMoreData()) - return true; - const command = this.peekSegmentType(); - // Path must start with moveTo. - return command == SVGPathSeg.PATHSEG_MOVETO_ABS || command == SVGPathSeg.PATHSEG_MOVETO_REL; - }; - - // Parse a number from an SVG path. This very closely follows genericParseNumber(...) from Source/core/svg/SVGParserUtilities.cpp. - // Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-PathDataBNF - Source.prototype._parseNumber = function () { - let exponent = 0; - let integer = 0; - let frac = 1; - let decimal = 0; - let sign = 1; - let expsign = 1; - - const startIndex = this._currentIndex; - - this._skipOptionalSpaces(); - - // Read the sign. - if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == '+') - this._currentIndex++; - else if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == '-') { - this._currentIndex++; - sign = -1; - } - - if (this._currentIndex == this._endIndex || ((this._string.charAt(this._currentIndex) < '0' || this._string.charAt(this._currentIndex) > '9') && this._string.charAt(this._currentIndex) != '.')) - // The first character of a number must be one of [0-9+-.]. - return undefined; - - // Read the integer part, build right-to-left. - const startIntPartIndex = this._currentIndex; - while (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) >= '0' && this._string.charAt(this._currentIndex) <= '9') - this._currentIndex++; // Advance to first non-digit. - - if (this._currentIndex != startIntPartIndex) { - let scanIntPartIndex = this._currentIndex - 1; - let multiplier = 1; - while (scanIntPartIndex >= startIntPartIndex) { - integer += multiplier * (this._string.charAt(scanIntPartIndex--) - '0'); - multiplier *= 10; - } - } - - // Read the decimals. - if (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) == '.') { - this._currentIndex++; - - // There must be a least one digit following the . - if (this._currentIndex >= this._endIndex || this._string.charAt(this._currentIndex) < '0' || this._string.charAt(this._currentIndex) > '9') - return undefined; - while (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) >= '0' && this._string.charAt(this._currentIndex) <= '9') - decimal += (this._string.charAt(this._currentIndex++) - '0') * (frac *= 0.1); - } - - // Read the exponent part. - if (this._currentIndex != startIndex && this._currentIndex + 1 < this._endIndex && (this._string.charAt(this._currentIndex) == 'e' || this._string.charAt(this._currentIndex) == 'E') && (this._string.charAt(this._currentIndex + 1) != 'x' && this._string.charAt(this._currentIndex + 1) != 'm')) { - this._currentIndex++; - - // Read the sign of the exponent. - if (this._string.charAt(this._currentIndex) == '+') { - this._currentIndex++; - } else if (this._string.charAt(this._currentIndex) == '-') { - this._currentIndex++; - expsign = -1; - } - - // There must be an exponent. - if (this._currentIndex >= this._endIndex || this._string.charAt(this._currentIndex) < '0' || this._string.charAt(this._currentIndex) > '9') - return undefined; - - while (this._currentIndex < this._endIndex && this._string.charAt(this._currentIndex) >= '0' && this._string.charAt(this._currentIndex) <= '9') { - exponent *= 10; - exponent += (this._string.charAt(this._currentIndex) - '0'); - this._currentIndex++; - } - } - - let number = integer + decimal; - number *= sign; - - if (exponent) - number *= Math.pow(10, expsign * exponent); - - if (startIndex == this._currentIndex) - return undefined; - - this._skipOptionalSpacesOrDelimiter(); - - return number; - }; - - Source.prototype._parseArcFlag = function () { - if (this._currentIndex >= this._endIndex) - return undefined; - let flag = false; - const flagChar = this._string.charAt(this._currentIndex++); - if (flagChar == '0') - flag = false; - else if (flagChar == '1') - flag = true; - else - return undefined; - - this._skipOptionalSpacesOrDelimiter(); - return flag; - }; - - Source.prototype.parseSegment = function () { - const lookahead = this._string[this._currentIndex]; - let command = this._pathSegTypeFromChar(lookahead); - if (command == SVGPathSeg.PATHSEG_UNKNOWN) { - // Possibly an implicit command. Not allowed if this is the first command. - if (this._previousCommand == SVGPathSeg.PATHSEG_UNKNOWN) - return null; - command = this._nextCommandHelper(lookahead, this._previousCommand); - if (command == SVGPathSeg.PATHSEG_UNKNOWN) - return null; - } else { - this._currentIndex++; - } - - this._previousCommand = command; - - switch (command) { - case SVGPathSeg.PATHSEG_MOVETO_REL: - return new SVGPathSegMovetoRel(owningPathSegList, this._parseNumber(), this._parseNumber()); - case SVGPathSeg.PATHSEG_MOVETO_ABS: - return new SVGPathSegMovetoAbs(owningPathSegList, this._parseNumber(), this._parseNumber()); - case SVGPathSeg.PATHSEG_LINETO_REL: - return new SVGPathSegLinetoRel(owningPathSegList, this._parseNumber(), this._parseNumber()); - case SVGPathSeg.PATHSEG_LINETO_ABS: - return new SVGPathSegLinetoAbs(owningPathSegList, this._parseNumber(), this._parseNumber()); - case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL: - return new SVGPathSegLinetoHorizontalRel(owningPathSegList, this._parseNumber()); - case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS: - return new SVGPathSegLinetoHorizontalAbs(owningPathSegList, this._parseNumber()); - case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL: - return new SVGPathSegLinetoVerticalRel(owningPathSegList, this._parseNumber()); - case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS: - return new SVGPathSegLinetoVerticalAbs(owningPathSegList, this._parseNumber()); - case SVGPathSeg.PATHSEG_CLOSEPATH: - this._skipOptionalSpaces(); - return new SVGPathSegClosePath(owningPathSegList); - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL: - var points = { x1: this._parseNumber(), y1: this._parseNumber(), x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() }; - return new SVGPathSegCurvetoCubicRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2); - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS: - var points = { x1: this._parseNumber(), y1: this._parseNumber(), x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() }; - return new SVGPathSegCurvetoCubicAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.x2, points.y2); - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL: - var points = { x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() }; - return new SVGPathSegCurvetoCubicSmoothRel(owningPathSegList, points.x, points.y, points.x2, points.y2); - case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: - var points = { x2: this._parseNumber(), y2: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() }; - return new SVGPathSegCurvetoCubicSmoothAbs(owningPathSegList, points.x, points.y, points.x2, points.y2); - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL: - var points = { x1: this._parseNumber(), y1: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() }; - return new SVGPathSegCurvetoQuadraticRel(owningPathSegList, points.x, points.y, points.x1, points.y1); - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS: - var points = { x1: this._parseNumber(), y1: this._parseNumber(), x: this._parseNumber(), y: this._parseNumber() }; - return new SVGPathSegCurvetoQuadraticAbs(owningPathSegList, points.x, points.y, points.x1, points.y1); - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: - return new SVGPathSegCurvetoQuadraticSmoothRel(owningPathSegList, this._parseNumber(), this._parseNumber()); - case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: - return new SVGPathSegCurvetoQuadraticSmoothAbs(owningPathSegList, this._parseNumber(), this._parseNumber()); - case SVGPathSeg.PATHSEG_ARC_REL: - var points = { x1: this._parseNumber(), y1: this._parseNumber(), arcAngle: this._parseNumber(), arcLarge: this._parseArcFlag(), arcSweep: this._parseArcFlag(), x: this._parseNumber(), y: this._parseNumber() }; - return new SVGPathSegArcRel(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep); - case SVGPathSeg.PATHSEG_ARC_ABS: - var points = { x1: this._parseNumber(), y1: this._parseNumber(), arcAngle: this._parseNumber(), arcLarge: this._parseArcFlag(), arcSweep: this._parseArcFlag(), x: this._parseNumber(), y: this._parseNumber() }; - return new SVGPathSegArcAbs(owningPathSegList, points.x, points.y, points.x1, points.y1, points.arcAngle, points.arcLarge, points.arcSweep); - default: - throw 'Unknown path seg type.'; - } - }; - - const builder = new Builder(); - const source = new Source(string); - - if (!source.initialCommandIsMoveTo()) - return []; - while (source.hasMoreData()) { - const pathSeg = source.parseSegment(); - if (!pathSeg) - return []; - builder.appendSegment(pathSeg); - } - - return builder.pathSegList; - }; - } -}()); - -/* jshint ignore:end */ diff --git a/src/tail.js b/src/tail.js deleted file mode 100644 index 16278fa..0000000 --- a/src/tail.js +++ /dev/null @@ -1,17 +0,0 @@ - c3.generate = function(config) { - return new Chart(config); - }; - - c3.chart = { - fn: Chart.prototype, - internal: { - fn: ChartInternal.prototype, - axis: { - fn: Axis.prototype - } - } - }; - - return c3; - -})); \ No newline at end of file