diff --git a/inst/htmlwidgets/apexcharter.yaml b/inst/htmlwidgets/apexcharter.yaml
index 5e312fa..447858f 100644
--- a/inst/htmlwidgets/apexcharter.yaml
+++ b/inst/htmlwidgets/apexcharter.yaml
@@ -1,5 +1,5 @@
dependencies:
- name: apexcharts
- version: 1.3.14
- src: htmlwidgets/lib/apexcharts-1.3
+ version: 1.4.2
+ src: htmlwidgets/lib/apexcharts-1.4
script: apexcharts.min.js
diff --git a/inst/htmlwidgets/lib/apexcharts-1.0.4/Options.js b/inst/htmlwidgets/lib/Options.js
similarity index 100%
rename from inst/htmlwidgets/lib/apexcharts-1.0.4/Options.js
rename to inst/htmlwidgets/lib/Options.js
diff --git a/inst/htmlwidgets/lib/apexcharts-1.0.4/apexcharts.min.js b/inst/htmlwidgets/lib/apexcharts-1.0.4/apexcharts.min.js
deleted file mode 100644
index d2e568b..0000000
--- a/inst/htmlwidgets/lib/apexcharts-1.0.4/apexcharts.min.js
+++ /dev/null
@@ -1,27849 +0,0 @@
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define("ApexCharts", [], factory);
- else if(typeof exports === 'object')
- exports["ApexCharts"] = factory();
- else
- root["ApexCharts"] = factory();
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId]) {
-/******/ return installedModules[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ i: moduleId,
-/******/ l: false,
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.l = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // identity function for calling harmony imports with the correct context
-/******/ __webpack_require__.i = function(value) { return value; };
-/******/
-/******/ // define getter function for harmony exports
-/******/ __webpack_require__.d = function(exports, name, getter) {
-/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, {
-/******/ configurable: false,
-/******/ enumerable: true,
-/******/ get: getter
-/******/ });
-/******/ }
-/******/ };
-/******/
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function getDefault() { return module['default']; } :
-/******/ function getModuleExports() { return module; };
-/******/ __webpack_require__.d(getter, 'a', getter);
-/******/ return getter;
-/******/ };
-/******/
-/******/ // Object.prototype.hasOwnProperty.call
-/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 138);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Utils = __webpack_require__(1);
-
-var _Utils2 = _interopRequireDefault(_Utils);
-
-var _Filters = __webpack_require__(4);
-
-var _Filters2 = _interopRequireDefault(_Filters);
-
-var _Animations = __webpack_require__(14);
-
-var _Animations2 = _interopRequireDefault(_Animations);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Graphics Class for all drawing operations.
- *
- * @module Graphics
- **/
-
-var Graphics = function () {
- function Graphics(ctx) {
- _classCallCheck(this, Graphics);
-
- this.ctx = ctx;
- this.w = ctx.w;
- }
-
- _createClass(Graphics, [{
- key: 'drawLine',
- value: function drawLine(x1, y1, x2, y2) {
- var lineColor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '#a8a8a8';
- var dashArray = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
- var strokeWidth = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
-
- var w = this.w;
- var line = w.globals.dom.Paper.line().attr({
- x1: x1,
- y1: y1,
- x2: x2,
- y2: y2,
- stroke: lineColor,
- 'stroke-dasharray': dashArray,
- 'stroke-width': strokeWidth
- });
-
- return line;
- }
- }, {
- key: 'drawRect',
- value: function drawRect() {
- var x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
- var y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
- var x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
- var y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
- var radius = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
- var color = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : '#fefefe';
- var opacity = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 1;
- var strokeWidth = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
- var strokeColor = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null;
- var strokeDashArray = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 0;
-
- var w = this.w;
- var rect = w.globals.dom.Paper.rect();
-
- rect.attr({
- x: x1,
- y: y1,
- width: x2 > 0 ? x2 : 0,
- height: y2 > 0 ? y2 : 0,
- rx: radius,
- ry: radius,
- fill: color,
- opacity: opacity,
- 'stroke-width': strokeWidth !== null ? strokeWidth : 0,
- stroke: strokeColor !== null ? strokeColor : 'none',
- 'stroke-dasharray': strokeDashArray
- });
-
- return rect;
- }
- }, {
- key: 'drawCircle',
- value: function drawCircle(radius) {
- var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
-
- var w = this.w;
-
- var c = w.globals.dom.Paper.circle(radius * 2);
- if (attrs !== null) {
- c.attr(attrs);
- }
- return c;
- }
- }, {
- key: 'drawPath',
- value: function drawPath(_ref) {
- var _ref$d = _ref.d,
- d = _ref$d === undefined ? '' : _ref$d,
- _ref$stroke = _ref.stroke,
- stroke = _ref$stroke === undefined ? '#a8a8a8' : _ref$stroke,
- strokeWidth = _ref.strokeWidth,
- fill = _ref.fill,
- _ref$fillOpacity = _ref.fillOpacity,
- fillOpacity = _ref$fillOpacity === undefined ? 1 : _ref$fillOpacity,
- _ref$strokeOpacity = _ref.strokeOpacity,
- strokeOpacity = _ref$strokeOpacity === undefined ? 1 : _ref$strokeOpacity,
- classes = _ref.classes,
- _ref$strokeLinecap = _ref.strokeLinecap,
- strokeLinecap = _ref$strokeLinecap === undefined ? null : _ref$strokeLinecap,
- _ref$strokeDashArray = _ref.strokeDashArray,
- strokeDashArray = _ref$strokeDashArray === undefined ? 0 : _ref$strokeDashArray;
-
- var w = this.w;
-
- if (strokeLinecap === null) {
- strokeLinecap = w.config.stroke.lineCap;
- }
-
- if (d.indexOf('undefined') > -1 || d.indexOf('NaN') > -1) {
- d = 'M 0 ' + w.globals.gridHeight;
- }
- var p = w.globals.dom.Paper.path(d).attr({
- fill: fill,
- 'fill-opacity': fillOpacity,
- stroke: stroke,
- 'stroke-opacity': strokeOpacity,
- 'stroke-linecap': strokeLinecap,
- 'stroke-width': strokeWidth,
- 'stroke-dasharray': strokeDashArray,
- class: classes
- });
-
- return p;
- }
- }, {
- key: 'group',
- value: function group() {
- var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
-
- var w = this.w;
- var g = w.globals.dom.Paper.group();
-
- if (attrs !== null) {
- g.attr(attrs);
- }
- return g;
- }
- }, {
- key: 'move',
- value: function move(x, y) {
- var move = ['M', x, y].join(' ');
- return move;
- }
- }, {
- key: 'line',
- value: function line(x, y) {
- var hORv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
-
- var line = null;
- if (hORv === null) {
- line = ['L', x, y].join(' ');
- } else {
- line = [hORv, x].join(' ');
- }
- return line;
- }
- }, {
- key: 'curve',
- value: function curve(x1, y1, x2, y2, x, y) {
- var curve = ['C', x1, y1, x2, y2, x, y].join(' ');
- return curve;
- }
- }, {
- key: 'quadraticCurve',
- value: function quadraticCurve(x1, y1, x, y) {
- var curve = ['Q', x1, y1, x, y].join(' ');
- return curve;
- }
- }, {
- key: 'arc',
- value: function arc(rx, ry, axisRotation, largeArcFlag, sweepFlag, x, y) {
- var relative = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
-
- var coord = 'A';
- if (relative) coord = 'a';
-
- var arc = [coord, rx, ry, axisRotation, largeArcFlag, sweepFlag, x, y].join(' ');
- return arc;
- }
-
- /**
- * @memberof Graphics
- * @param {object}
- * i = series's index
- * realIndex = realIndex is series's actual index when it was drawn time. After several redraws, the iterating "i" may change in loops, but realIndex doesn't
- * pathFrom = existing pathFrom to animateTo
- * pathTo = new Path to which d attr will be animated from pathFrom to pathTo
- * stroke = line Color
- * strokeWidth = width of path Line
- * fill = it can be gradient, single color, pattern or image
- * animationDelay = how much to delay when starting animation (in milliseconds)
- * dataChangeSpeed = for dynamic animations, when data changes
- * hideStrokesInChange = for certain charts, we hide strokes during anim
- * className = class attribute to add
- * @return {object} svg.js path object
- **/
-
- }, {
- key: 'renderPaths',
- value: function renderPaths(_ref2) {
- var i = _ref2.i,
- realIndex = _ref2.realIndex,
- pathFrom = _ref2.pathFrom,
- pathTo = _ref2.pathTo,
- stroke = _ref2.stroke,
- strokeWidth = _ref2.strokeWidth,
- fill = _ref2.fill,
- animationDelay = _ref2.animationDelay,
- initialSpeed = _ref2.initialSpeed,
- dataChangeSpeed = _ref2.dataChangeSpeed,
- _ref2$hideStrokesInCh = _ref2.hideStrokesInChange,
- hideStrokesInChange = _ref2$hideStrokesInCh === undefined ? false : _ref2$hideStrokesInCh,
- className = _ref2.className,
- id = _ref2.id;
-
- var w = this.w;
- var filters = new _Filters2.default(this.ctx);
- var anim = new _Animations2.default(this.ctx);
-
- var initialAnim = this.w.config.chart.animations.enabled;
- var dynamicAnim = initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled;
-
- var d = void 0;
- var shouldAnimate = !!(initialAnim && !w.globals.resized || dynamicAnim && w.globals.dataChanged);
-
- if (shouldAnimate) {
- d = pathFrom;
- } else {
- d = pathTo;
- }
-
- var strokeDashArrayOpt = w.config.stroke.dashArray;
- var strokeDashArray = 0;
- if (Array.isArray(strokeDashArrayOpt)) {
- strokeDashArray = strokeDashArrayOpt[realIndex];
- } else {
- strokeDashArray = w.config.stroke.dashArray;
- }
-
- var el = this.drawPath({
- d: d,
- stroke: stroke,
- strokeWidth: strokeWidth,
- fill: fill,
- fillOpacity: 1,
- classes: className,
- strokeLinecap: 'butt',
- strokeDashArray: strokeDashArray
- });
-
- el.attr('id', id + '-' + i);
- el.attr('index', realIndex);
-
- // const defaultFilter = el.filterer
-
- if (w.config.states.normal.filter.type !== 'none') {
- filters.getDefaultFilter(el, w.config.states.normal.filter.type, w.config.states.normal.filter.value);
- } else {
- if (w.config.chart.dropShadow.enabled) {
- if (!w.config.chart.dropShadow.enabledSeries || w.config.chart.dropShadow.enabledSeries && w.config.chart.dropShadow.enabledSeries.indexOf(realIndex) !== -1) {
- var shadow = w.config.chart.dropShadow;
- filters.dropShadow(el, shadow);
- }
- }
- }
-
- el.node.addEventListener('mouseenter', this.pathMouseEnter.bind(this, el));
- el.node.addEventListener('mouseleave', this.pathMouseLeave.bind(this, el));
-
- el.node.addEventListener('mousedown', this.pathMouseDown.bind(this, el));
- el.node.addEventListener('touchstart', this.pathMouseDown.bind(this, el));
-
- el.attr({
- pathTo: pathTo,
- pathFrom: pathFrom
- });
-
- if (initialAnim && !w.globals.resized && !w.globals.dataChanged) {
- anim.animatePathsGradually({
- el: el,
- pathFrom: pathFrom,
- pathTo: pathTo,
- speed: initialSpeed,
- delay: animationDelay,
- strokeWidth: strokeWidth
- });
- }
-
- if (dynamicAnim && w.globals.dataChanged) {
- anim.animatePathsGradually({
- el: el,
- pathFrom: pathFrom,
- pathTo: pathTo,
- speed: dataChangeSpeed,
- strokeWidth: strokeWidth
- });
- }
-
- return el;
- }
- }, {
- key: 'drawPattern',
- value: function drawPattern(style, width, height) {
- var stroke = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '#a8a8a8';
- var strokeWidth = arguments[4];
- var opacity = arguments[5];
-
- var w = this.w;
-
- var p = w.globals.dom.Paper.pattern(width, height, function (add) {
- if (style === 'horizontalLines') {
- add.line(0, 0, height, 0).stroke({ color: stroke, width: strokeWidth + 1 });
- } else if (style === 'verticalLines') {
- add.line(0, 0, 0, width).stroke({ color: stroke, width: strokeWidth + 1 });
- } else if (style === 'slantedLines') {
- add.line(0, 0, width, height).stroke({ color: stroke, width: strokeWidth });
- } else if (style === 'squares') {
- add.rect(width, height).fill('none').stroke({ color: stroke, width: strokeWidth });
- } else if (style === 'circles') {
- add.circle(width).fill('none').stroke({ color: stroke, width: strokeWidth });
- }
- });
-
- return p;
- }
- }, {
- key: 'drawGradient',
- value: function drawGradient(style, gfrom, gto, opacityFrom, opacityTo) {
- var size = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
- var stops = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
-
- var w = this.w;
-
- gfrom = _Utils2.default.hexToRgba(gfrom, opacityFrom);
- gto = _Utils2.default.hexToRgba(gto, opacityTo);
-
- var stop1 = 0;
- var stop2 = 1;
- var stop3 = 1;
- var stop4 = 1;
-
- if (stops !== null) {
- stop1 = typeof stops[0] !== 'undefined' ? stops[0] / 100 : 0;
- stop2 = typeof stops[1] !== 'undefined' ? stops[1] / 100 : 1;
- stop3 = typeof stops[2] !== 'undefined' ? stops[2] / 100 : 1;
- stop4 = typeof stops[3] !== 'undefined' ? stops[3] / 100 : 1;
- }
-
- var radial = !!(w.config.chart.type === 'donut' || w.config.chart.type === 'pie' || w.config.chart.type === 'bubble');
-
- var p = w.globals.dom.Paper.gradient(radial ? 'radial' : 'linear', function (stop) {
- stop.at(stop1, gfrom, opacityFrom);
- stop.at(stop2, gto, opacityTo);
- stop.at(stop3, gto, opacityTo);
- stop.at(stop4, gfrom, opacityTo);
- });
-
- if (!radial) {
- if (style === 'vertical') {
- p.from(0, 0).to(0, 1);
- } else if (style === 'diagonal') {
- p.from(0, 0).to(1, 1);
- } else if (style === 'horizontal') {
- p.from(0, 1).to(1, 1);
- } else if (style === 'diagonal2') {
- p.from(0, 1).to(2, 2);
- }
- } else {
- var offx = w.globals.gridWidth / 2;
- var offy = w.globals.gridHeight / 2;
-
- if (w.config.chart.type !== 'bubble') {
- p.attr({
- 'gradientUnits': 'userSpaceOnUse',
- cx: offx,
- cy: offy,
- r: size
- });
- } else {
- p.attr({
- cx: 0.5,
- cy: 0.5,
- r: 0.8,
- fx: 0.2,
- fy: 0.2
- });
- }
- }
-
- return p;
- }
- }, {
- key: 'drawText',
- value: function drawText(opts) {
- var w = this.w;
-
- var x = opts.x,
- y = opts.y,
- text = opts.text,
- textAnchor = opts.textAnchor,
- fontSize = opts.fontSize,
- foreColor = opts.foreColor,
- opacity = opts.opacity;
-
-
- if (!textAnchor) textAnchor = 'start';
-
- if (typeof foreColor === 'undefined' || foreColor === undefined) foreColor = w.config.chart.foreColor;
-
- var elText = w.globals.dom.Paper.plain(text).attr({
- x: x,
- y: y,
- 'text-anchor': textAnchor,
- 'dominate-baseline': 'central',
- class: true ? opts.cssClass : ''
- });
-
- elText.node.style.fontSize = fontSize;
- elText.node.style.fill = foreColor;
- elText.node.style.opacity = opacity;
-
- return elText;
- }
- }, {
- key: 'drawMarker',
- value: function drawMarker(x, y, opts) {
- x = x || 0;
- var size = opts.pSize || 0;
-
- var elPoint = null;
-
- if (opts.shape === 'square') {
- var radius = opts.pRadius === undefined ? size / 2 : opts.pRadius;
-
- if (y === null) {
- size = 0;
- radius = 0;
- }
-
- var nSize = size * 1.2 + radius;
-
- var p = this.drawRect(nSize, nSize, nSize, nSize, radius);
-
- p.attr({
- x: x - nSize / 2,
- y: y - nSize / 2,
- cx: x,
- cy: y,
- class: opts.class ? opts.class : '',
- fill: opts.pointFillColor,
- 'fill-opacity': opts.pointFillOpacity ? opts.pointFillOpacity : 1,
- stroke: opts.pointStrokeColor,
- 'stroke-width': opts.pWidth ? opts.pWidth : 1,
- 'stroke-opacity': opts.pointStrokeOpacity ? opts.pointStrokeOpacity : 1
- });
-
- elPoint = p;
- } else if (opts.shape === 'circle') {
- if (!y) {
- size = 0;
- y = 0;
- }
-
- // let nSize = size - opts.pRadius / 2 < 0 ? 0 : size - opts.pRadius / 2
-
- elPoint = this.drawCircle(size, {
- cx: x,
- cy: y,
- class: opts.class ? opts.class : '',
- stroke: opts.pointStrokeColor,
- fill: opts.pointFillColor,
- 'fill-opacity': opts.pointFillOpacity ? opts.pointFillOpacity : 1,
- 'stroke-width': opts.pWidth ? opts.pWidth : 0,
- 'stroke-opacity': opts.pointStrokeOpacity ? opts.pointStrokeOpacity : 1
- });
- }
-
- return elPoint;
- }
- }, {
- key: 'pathMouseEnter',
- value: function pathMouseEnter(path) {
- var w = this.w;
- var filters = new _Filters2.default(this.ctx);
-
- if (w.config.states.active.filter.type !== 'none') {
- if (path.node.getAttribute('selected') === 'true') {
- return;
- }
- }
-
- if (w.config.states.hover.filter.type !== 'none') {
- var hoverFilter = w.config.states.hover.filter;
- filters.applyFilter(path, hoverFilter.type, hoverFilter.value);
- }
- }
- }, {
- key: 'pathMouseLeave',
- value: function pathMouseLeave(path) {
- var w = this.w;
- var filters = new _Filters2.default(this.ctx);
-
- if (w.config.states.active.filter.type !== 'none') {
- if (path.node.getAttribute('selected') === 'true') {
- return;
- }
- }
-
- if (w.config.states.hover.filter.type !== 'none') {
- filters.getDefaultFilter(path);
- }
- }
- }, {
- key: 'pathMouseDown',
- value: function pathMouseDown(path, e) {
- var w = this.w;
- var filters = new _Filters2.default(this.ctx);
-
- var i = parseInt(path.node.getAttribute('index'));
- var j = parseInt(path.node.getAttribute('j'));
-
- // if (w.config.states.active.filter.type !== 'none') {
- // toggle selection
-
- var selected = 'false';
- if (path.node.getAttribute('selected') === 'true') {
- path.node.setAttribute('selected', 'false');
-
- if (w.globals.selectedDataPoints[i].includes(j)) {
- var index = w.globals.selectedDataPoints[i].indexOf(j);
- w.globals.selectedDataPoints[i].splice(index, 1);
- }
- } else {
- if (!w.config.states.active.allowMultipleDataPointsSelection && w.globals.selectedDataPoints.length > 0) {
- w.globals.selectedDataPoints = [];
- var elPaths = w.globals.dom.Paper.select('.apexcharts-series path').members;
- var elCircles = w.globals.dom.Paper.select('.apexcharts-series circle').members;
-
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
-
- try {
- for (var _iterator = elPaths[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var elPath = _step.value;
-
- elPath.node.setAttribute('selected', 'false');
- filters.getDefaultFilter(elPath);
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
-
- var _iteratorNormalCompletion2 = true;
- var _didIteratorError2 = false;
- var _iteratorError2 = undefined;
-
- try {
- for (var _iterator2 = elCircles[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
- var circle = _step2.value;
-
- circle.node.setAttribute('selected', 'false');
- filters.getDefaultFilter(circle);
- }
- } catch (err) {
- _didIteratorError2 = true;
- _iteratorError2 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
- _iterator2.return();
- }
- } finally {
- if (_didIteratorError2) {
- throw _iteratorError2;
- }
- }
- }
- }
-
- path.node.setAttribute('selected', 'true');
- selected = 'true';
-
- if (typeof w.globals.selectedDataPoints[i] === 'undefined') {
- w.globals.selectedDataPoints[i] = [];
- }
- w.globals.selectedDataPoints[i].push(j);
- }
-
- if (selected === 'true') {
- var activeFilter = w.config.states.active.filter;
- if (activeFilter !== 'none') {
- filters.applyFilter(path, activeFilter.type, activeFilter.value);
-
- if (typeof w.config.chart.events.dataPointSelection === 'function') {
- w.config.chart.events.dataPointSelection(e, this.ctx, { selectedDataPoints: w.globals.selectedDataPoints, seriesIndex: i, dataPointIndex: j, config: w.config, globals: w.globals });
- }
- this.ctx.fireEvent('dataPointSelection', [e, this.ctx, { selectedDataPoints: w.globals.selectedDataPoints, seriesIndex: i, dataPointIndex: j, config: w.config, globals: w.globals }]);
- }
- } else {
- if (w.config.states.active.filter.type !== 'none') {
- filters.getDefaultFilter(path);
- }
- if (typeof w.config.chart.events.dataPointSelection === 'function') {
- w.config.chart.events.dataPointSelection(e, this.ctx, { selectedDataPoints: w.globals.selectedDataPoints, seriesIndex: i, dataPointIndex: j, config: w.config, globals: w.globals });
- }
- this.ctx.fireEvent('dataPointSelection', [e, this.ctx, { selectedDataPoints: w.globals.selectedDataPoints, seriesIndex: i, dataPointIndex: j, config: w.config, globals: w.globals }]);
- }
-
- if (this.w.config.chart.selection.selectedPoints !== undefined) {
- this.w.config.chart.selection.selectedPoints(w.globals.selectedDataPoints);
- }
- }
- }, {
- key: 'rotateAroundCenter',
- value: function rotateAroundCenter(el) {
- var coord = el.getBBox();
- var x = coord.x + coord.width / 2;
- var y = coord.y + coord.height / 2;
-
- return {
- x: x,
- y: y
- };
- }
- }, {
- key: 'getTextRects',
- value: function getTextRects(text, fontSize) {
- var w = this.w;
- var virtualText = this.drawText({
- x: -200,
- y: -200,
- text: text,
- textAnchor: 'start',
- fontSize: fontSize,
- foreColor: '#fff',
- opacity: 0
- });
-
- w.globals.dom.Paper.add(virtualText);
-
- var rect = virtualText.bbox();
-
- virtualText.node.parentNode.removeChild(virtualText.node);
-
- return {
- width: rect.width,
- height: rect.height
- };
- }
-
- /**
- * append ... to long text
- * http://stackoverflow.com/questions/9241315/trimming-text-to-a-given-pixel-width-in-svg
- * @memberof Graphics
- **/
-
- }, {
- key: 'placeTextWithEllipsis',
- value: function placeTextWithEllipsis(textObj, textString, width) {
- console.log(textObj, 'text');
- textObj.textContent = textString;
- if (textString.length > 0) {
- // ellipsis is needed
- if (textObj.getSubStringLength(0, textString.length) >= width) {
- for (var x = textString.length - 3; x > 0; x -= 3) {
- if (textObj.getSubStringLength(0, x) <= width) {
- textObj.textContent = textString.substring(0, x) + '...';
- return;
- }
- }
- textObj.textContent = '...'; // can't place at all
- }
- }
- }
- }], [{
- key: 'setAttrs',
- value: function setAttrs(el, attrs) {
- for (var key in attrs) {
- if (attrs.hasOwnProperty(key)) {
- el.setAttribute(key, attrs[key]);
- }
- }
- }
- }]);
-
- return Graphics;
-}();
-
-exports.default = Graphics;
-
-/***/ }),
-/* 1 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/*
- ** Generic functions which are not dependent on ApexCharts.
- */
-
-var Utils = function () {
- function Utils() {
- _classCallCheck(this, Utils);
- }
-
- _createClass(Utils, [{
- key: 'shadeColor',
-
-
- // beautiful color shading blending code
- // http://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors
- value: function shadeColor(p, from) {
- var to = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
-
- if (from[0] !== '#' || from[0] !== 'r') {
- from = this.getHexColorFromName(from);
- }
- if (typeof p !== 'number' || p < -1 || p > 1 || typeof from !== 'string' || from[0] !== 'r' && from[0] !== '#' || typeof to !== 'string' && typeof to !== 'undefined') return null; // ErrorCheck
- var i = parseInt,
- r = Math.round,
- h = from.length > 9,
- h = typeof to === 'string' ? to.length > 9 ? true : to === 'c' ? !h : false : h,
- b = p < 0,
- p = b ? p * -1 : p,
- to = to && to !== 'c' ? to : b ? '#000000' : '#FFFFFF',
- f = this.sbcRip(from),
- t = this.sbcRip(to);
- if (!f || !t) return null; // ErrorCheck
- if (h) return 'rgb(' + r((t[0] - f[0]) * p + f[0]) + ',' + r((t[1] - f[1]) * p + f[1]) + ',' + r((t[2] - f[2]) * p + f[2]) + (f[3] < 0 && t[3] < 0 ? ')' : ',' + (f[3] > -1 && t[3] > -1 ? r(((t[3] - f[3]) * p + f[3]) * 10000) / 10000 : t[3] < 0 ? f[3] : t[3]) + ')');else return '#' + (0x100000000 + (f[3] > -1 && t[3] > -1 ? r(((t[3] - f[3]) * p + f[3]) * 255) : t[3] > -1 ? r(t[3] * 255) : f[3] > -1 ? r(f[3] * 255) : 255) * 0x1000000 + r((t[0] - f[0]) * p + f[0]) * 0x10000 + r((t[1] - f[1]) * p + f[1]) * 0x100 + r((t[2] - f[2]) * p + f[2])).toString(16).slice(f[3] > -1 || t[3] > -1 ? 1 : 3);
- }
-
- // helper function of shadeColor
-
- }, {
- key: 'sbcRip',
- value: function sbcRip(d) {
- var l = d.length,
- RGB = new Object();
- var i = parseInt,
- r = Math.round;
- if (l > 9) {
- d = d.split(',');
- if (d.length < 3 || d.length > 4) return null; // ErrorCheck
- RGB[0] = i(d[0].slice(4)), RGB[1] = i(d[1]), RGB[2] = i(d[2]), RGB[3] = d[3] ? parseFloat(d[3]) : -1;
- } else {
- if (l === 8 || l === 6 || l < 4) return null; // ErrorCheck
- if (l < 6) d = '#' + d[1] + d[1] + d[2] + d[2] + d[3] + d[3] + (l > 4 ? d[4] + '' + d[4] : ''); // 3 digit
- d = i(d.slice(1), 16), RGB[0] = d >> 16 & 255, RGB[1] = d >> 8 & 255, RGB[2] = d & 255, RGB[3] = l === 9 || l === 5 ? r((d >> 24 & 255) / 255 * 10000) / 10000 : -1;
- }
- return RGB;
- }
-
- // https://stackoverflow.com/questions/1573053/javascript-function-to-convert-color-names-to-hex-codes
-
- }, {
- key: 'getHexColorFromName',
- value: function getHexColorFromName(colorStr) {
- var a = document.createElement('div');
- a.style.color = colorStr;
- var colors = window.getComputedStyle(document.body.appendChild(a)).color.match(/\d+/g).map(function (a) {
- return parseInt(a, 10);
- });
- document.body.removeChild(a);
- return colors.length >= 3 ? '#' + ((1 << 24) + (colors[0] << 16) + (colors[1] << 8) + colors[2]).toString(16).substr(1) : false;
- }
- }], [{
- key: 'bind',
- value: function bind(fn, me) {
- return function () {
- return fn.apply(me, arguments);
- };
- }
- }, {
- key: 'isObject',
- value: function isObject(item) {
- return item && (typeof item === 'undefined' ? 'undefined' : _typeof(item)) === 'object' && !Array.isArray(item) && item !== null;
- }
-
- // to extend defaults with user options
- // credit: http://stackoverflow.com/questions/27936772/deep-object-merging-in-es6-es7#answer-34749873
-
- }, {
- key: 'extend',
- value: function extend(target, source) {
- var _this = this;
-
- if (typeof Object.assign !== 'function') {
- (function () {
- Object.assign = function (target) {
- 'use strict';
- // We must check against these specific cases.
-
- if (target === undefined || target === null) {
- throw new TypeError('Cannot convert undefined or null to object');
- }
-
- var output = Object(target);
- for (var index = 1; index < arguments.length; index++) {
- var _source = arguments[index];
- if (_source !== undefined && _source !== null) {
- for (var nextKey in _source) {
- if (_source.hasOwnProperty(nextKey)) {
- output[nextKey] = _source[nextKey];
- }
- }
- }
- }
- return output;
- };
- })();
- }
-
- var output = Object.assign({}, target);
- if (this.isObject(target) && this.isObject(source)) {
- Object.keys(source).forEach(function (key) {
- if (_this.isObject(source[key])) {
- if (!(key in target)) {
- Object.assign(output, _defineProperty({}, key, source[key]));
- } else {
- output[key] = _this.extend(target[key], source[key]);
- }
- } else {
- Object.assign(output, _defineProperty({}, key, source[key]));
- }
- });
- }
- return output;
- }
- }, {
- key: 'addProps',
- value: function addProps(obj, arr, val) {
-
- if (typeof arr == 'string') arr = arr.split(".");
-
- obj[arr[0]] = obj[arr[0]] || {};
-
- var tmpObj = obj[arr[0]];
-
- if (arr.length > 1) {
- arr.shift();
- this.addProps(tmpObj, arr, val);
- } else obj[arr[0]] = val;
-
- return obj;
- }
- }, {
- key: 'clone',
- value: function clone(source) {
- if (Object.prototype.toString.call(source) === '[object Array]') {
- var cloneResult = [];
- for (var i = 0; i < source.length; i++) {
- cloneResult[i] = this.clone(source[i]);
- }
- return cloneResult;
- } else if ((typeof source === 'undefined' ? 'undefined' : _typeof(source)) === "object") {
- var _cloneResult = {};
- for (var prop in source) {
- if (source.hasOwnProperty(prop)) {
- _cloneResult[prop] = this.clone(source[prop]);
- }
- }
- return _cloneResult;
- } else {
- return source;
- }
- }
- }, {
- key: 'getDimensions',
- value: function getDimensions(el) {
- var computedStyle = getComputedStyle(el);
- var ret = [];
-
- var elementHeight = el.clientHeight;
- var elementWidth = el.clientWidth;
-
- elementHeight -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
- elementWidth -= parseFloat(computedStyle.paddingLeft) + parseFloat(computedStyle.paddingRight);
- ret.push(elementWidth);
- ret.push(elementHeight);
-
- return ret;
- }
- }, {
- key: 'getBoundingClientRect',
- value: function getBoundingClientRect(element) {
- var rect = element.getBoundingClientRect();
- return {
- top: rect.top,
- right: rect.right,
- bottom: rect.bottom,
- left: rect.left,
- width: rect.width,
- height: rect.height,
- x: rect.x,
- y: rect.y
- };
- }
-
- // http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb#answer-12342275
-
- }, {
- key: 'hexToRgba',
- value: function hexToRgba() {
- var hex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '#999999';
- var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.6;
-
- if (hex.substring(0, 1) !== '#') {
- hex = '#999999';
- }
-
- var h = hex.replace('#', '');
- h = h.match(new RegExp('(.{' + h.length / 3 + '})', 'g'));
-
- for (var i = 0; i < h.length; i++) {
- h[i] = parseInt(h[i].length === 1 ? h[i] + h[i] : h[i], 16);
- }
-
- if (typeof opacity !== 'undefined') h.push(opacity);
-
- return 'rgba(' + h.join(',') + ')';
- }
- }, {
- key: 'rgb2hex',
- value: function rgb2hex(rgb) {
- rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
- return rgb && rgb.length === 4 ? "#" + ("0" + parseInt(rgb[1], 10).toString(16)).slice(-2) + ("0" + parseInt(rgb[2], 10).toString(16)).slice(-2) + ("0" + parseInt(rgb[3], 10).toString(16)).slice(-2) : '';
- }
- }, {
- key: 'polarToCartesian',
- value: function polarToCartesian(centerX, centerY, radius, angleInDegrees) {
- var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;
-
- return {
- x: centerX + radius * Math.cos(angleInRadians),
- y: centerY + radius * Math.sin(angleInRadians)
- };
- }
- }, {
- key: 'negToZero',
- value: function negToZero(val) {
- return val < 0 ? 0 : val;
- }
- }, {
- key: 'randomString',
- value: function randomString(len) {
- var text = '';
- var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
-
- for (var i = 0; i < len; i++) {
- text += possible.charAt(Math.floor(Math.random() * possible.length));
- }
-
- return text;
- }
- }, {
- key: 'findAncestor',
- value: function findAncestor(el, cls) {
- while ((el = el.parentElement) && !el.classList.contains(cls)) {}
- return el;
- }
- }, {
- key: 'setELstyles',
- value: function setELstyles(el, styles) {
- for (var key in styles) {
- if (styles.hasOwnProperty(key)) {
- el.style.key = styles[key];
- }
- }
- }
- }, {
- key: 'isInt',
- value: function isInt(value) {
- return !isNaN(value) && parseFloat(Number(value)) === value && !isNaN(parseInt(value, 10));
- }
- }, {
- key: 'isIE',
- value: function isIE() {
- var ua = window.navigator.userAgent;
-
- var msie = ua.indexOf('MSIE ');
- if (msie > 0) {
- // IE 10 or older => return version number
- return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
- }
-
- var trident = ua.indexOf('Trident/');
- if (trident > 0) {
- // IE 11 => return version number
- var rv = ua.indexOf('rv:');
- return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
- }
-
- var edge = ua.indexOf('Edge/');
- if (edge > 0) {
- // Edge (IE 12+) => return version number
- return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
- }
-
- // other browser
- return false;
- }
- }]);
-
- return Utils;
-}();
-
-Utils.isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
-exports.default = Utils;
-
-/***/ }),
-/* 2 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
-var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self
-// eslint-disable-next-line no-new-func
-: Function('return this')();
-if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
-
-/***/ }),
-/* 3 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var store = __webpack_require__(48)('wks');
-var uid = __webpack_require__(32);
-var _Symbol = __webpack_require__(2).Symbol;
-var USE_SYMBOL = typeof _Symbol == 'function';
-
-var $exports = module.exports = function (name) {
- return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name));
-};
-
-$exports.store = store;
-
-/***/ }),
-/* 4 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Utils = __webpack_require__(1);
-
-var _Utils2 = _interopRequireDefault(_Utils);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-__webpack_require__(62);
-__webpack_require__(61);
-
-/**
- * ApexCharts Filters Class for setting value formatters for axes as well as tooltips.
- *
- * @module Formatters
- **/
-
-var Filters = function () {
- function Filters(ctx) {
- _classCallCheck(this, Filters);
-
- this.ctx = ctx;
- this.w = ctx.w;
- }
-
- // create a re-usable filter which can be appended other filter effects and applied to multiple elements
-
-
- _createClass(Filters, [{
- key: 'getDefaultFilter',
- value: function getDefaultFilter(el) {
- var w = this.w;
- el.unfilter(true);
-
- var filter = new window.SVG.Filter();
- filter.size('120%', '180%', '-5%', '-40%');
-
- if (w.config.states.normal.filter !== 'none') {
- this.applyFilter(el, w.config.states.normal.filter.type, w.config.states.normal.filter.value);
- } else {
- if (w.config.chart.dropShadow.enabled) {
- this.dropShadow(el, w.config.chart.dropShadow);
- }
- }
- }
- }, {
- key: 'addNormalFilter',
- value: function addNormalFilter(el) {
- var w = this.w;
- if (w.config.chart.dropShadow.enabled) {
- this.dropShadow(el, w.config.chart.dropShadow);
- }
- }
- }, {
- key: 'addDesaturateFilter',
- value: function addDesaturateFilter(el) {
- var _this = this;
-
- var w = this.w;
-
- el.unfilter(true);
-
- var filter = new window.SVG.Filter();
- filter.size('120%', '180%', '-5%', '-40%');
-
- el.filter(function (add) {
- var shadowAttr = w.config.chart.dropShadow;
- if (shadowAttr.enabled) {
- filter = _this.addShadow(add, shadowAttr);
- } else {
- filter = add;
- }
- filter.colorMatrix('matrix', [0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 1.0, 0]).colorMatrix('saturate', 0);
- });
- el.filterer.node.setAttribute('filterUnits', 'userSpaceOnUse');
- }
-
- // appends dropShadow to the filter object which can be chained with other filter effects
-
- }, {
- key: 'addLightenFilter',
- value: function addLightenFilter(el, attrs) {
- var _this2 = this;
-
- var w = this.w;
- var intensity = attrs.intensity;
-
-
- el.unfilter(true);
-
- var filter = new window.SVG.Filter();
- filter.size('120%', '180%', '-5%', '-40%');
-
- el.filter(function (add) {
- var shadowAttr = w.config.chart.dropShadow;
- if (shadowAttr.enabled) {
- filter = _this2.addShadow(add, shadowAttr);
- } else {
- filter = add;
- }
- filter.componentTransfer({
- rgb: { type: 'linear', slope: 1.5, intercept: intensity }
- });
- });
- el.filterer.node.setAttribute('filterUnits', 'userSpaceOnUse');
- }
-
- // appends dropShadow to the filter object which can be chained with other filter effects
-
- }, {
- key: 'addDarkenFilter',
- value: function addDarkenFilter(el, attrs) {
- var _this3 = this;
-
- var w = this.w;
- var intensity = attrs.intensity;
-
-
- el.unfilter(true);
-
- var filter = new window.SVG.Filter();
- filter.size('120%', '180%', '-5%', '-40%');
-
- el.filter(function (add) {
- var shadowAttr = w.config.chart.dropShadow;
- if (shadowAttr.enabled) {
- filter = _this3.addShadow(add, shadowAttr);
- } else {
- filter = add;
- }
- filter.componentTransfer({
- rgb: { type: 'linear', slope: intensity }
- });
- });
- el.filterer.node.setAttribute('filterUnits', 'userSpaceOnUse');
- }
- }, {
- key: 'applyFilter',
- value: function applyFilter(el, filter) {
- var intensity = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.5;
-
- switch (filter) {
- case 'none':
- {
- this.addNormalFilter(el);
- break;
- }
- case 'lighten':
- {
- this.addLightenFilter(el, {
- intensity: intensity
- });
- break;
- }
- case 'darken':
- {
- this.addDarkenFilter(el, {
- intensity: intensity
- });
- break;
- }
- case 'desaturate':
- {
- this.addDesaturateFilter(el, {
- intensity: intensity
- });
- break;
- }
- default:
- // do nothing
- break;
- }
- }
-
- // appends dropShadow to the filter object which can be chained with other filter effects
-
- }, {
- key: 'addShadow',
- value: function addShadow(add, attrs) {
- var blur = attrs.blur,
- top = attrs.top,
- left = attrs.left,
- opacity = attrs.opacity;
-
-
- var shadowBlur = add.flood('black', opacity).composite(add.sourceAlpha, 'in').offset(left, top).gaussianBlur(blur).merge(add.source);
- return add.blend(add.source, shadowBlur);
- }
-
- // directly adds dropShadow to the element and returns the same element.
- // the only way it is different from the addShadow() function is that addShadow is chainable to other filters, while this function discards all filters and add dropShadow
-
- }, {
- key: 'dropShadow',
- value: function dropShadow(el, attrs) {
- var top = attrs.top,
- left = attrs.left,
- blur = attrs.blur,
- opacity = attrs.opacity;
-
-
- el.unfilter(true);
-
- var filter = new window.SVG.Filter();
- filter.size('120%', '180%', '-5%', '-40%');
-
- el.filter(function (add) {
- var shadowBlur = null;
- if (_Utils2.default.isSafari) {
- // safari has weird issues with this filter
- shadowBlur = add.flood('black', opacity).composite(add.sourceAlpha, 'in').offset(left, top).gaussianBlur(blur);
- } else {
- shadowBlur = add.flood('black', opacity).composite(add.sourceAlpha, 'in').offset(left, top).gaussianBlur(blur).merge(add.source);
- }
-
- add.blend(add.source, shadowBlur);
- });
-
- el.filterer.node.setAttribute('filterUnits', 'userSpaceOnUse');
-
- return el;
- }
-
- // directly adds darken filter to the element and returns the same element.
- // darken (el, intensity = 0.2) {
- // let darkenFilter = null
- // el.filter(function (add) {
- // darkenFilter = add.componentTransfer({
- // rgb: { type: 'linear', slope: intensity }
- // })
- // })
- // return darkenFilter
- // }
-
- // directly adds lighten to the element and returns the same element.
- // lighten (el, intensity = 0.2) {
- // el.filter(function (add) {
- // add.componentTransfer({
- // rgb: { type: 'linear', slope: 1.5, intercept: 0.2 }
- // })
- // })
- // return el
- // }
-
- }]);
-
- return Filters;
-}();
-
-exports.default = Filters;
-
-/***/ }),
-/* 5 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var core = module.exports = { version: '2.5.7' };
-if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
-
-/***/ }),
-/* 6 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var isObject = __webpack_require__(11);
-module.exports = function (it) {
- if (!isObject(it)) throw TypeError(it + ' is not an object!');
- return it;
-};
-
-/***/ }),
-/* 7 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var dP = __webpack_require__(20);
-var createDesc = __webpack_require__(47);
-module.exports = __webpack_require__(9) ? function (object, key, value) {
- return dP.f(object, key, createDesc(1, value));
-} : function (object, key, value) {
- object[key] = value;
- return object;
-};
-
-/***/ }),
-/* 8 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-var _Utils = __webpack_require__(1);
-
-var _Utils2 = _interopRequireDefault(_Utils);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Fill Class for setting fill options of the paths.
- *
- * @module Fill
- **/
-
-var Fill = function () {
- function Fill(ctx) {
- _classCallCheck(this, Fill);
-
- this.ctx = ctx;
- this.w = ctx.w;
- }
-
- _createClass(Fill, [{
- key: 'clippedImgArea',
- value: function clippedImgArea(opts) {
- var w = this.w;
- var cnf = w.config;
-
- var svgW = parseInt(w.globals.gridWidth);
- var svgH = parseInt(w.globals.gridHeight);
-
- var size = svgW > svgH ? svgW : svgH;
-
- var fillImg = opts.image;
-
- var imgWidth = 0;
- var imgHeight = 0;
- if (typeof opts.width === 'undefined' && typeof opts.height === 'undefined') {
- if (cnf.fill.image.width !== undefined && cnf.fill.image.height !== undefined) {
- imgWidth = cnf.fill.image.width + 1;
- imgHeight = cnf.fill.image.height;
- } else {
- imgWidth = size + 1;
- imgHeight = size;
- }
- } else {
- imgWidth = opts.width;
- imgHeight = opts.height;
- }
-
- var elPattern = document.createElementNS(w.globals.svgNS, 'pattern');
-
- _Graphics2.default.setAttrs(elPattern, {
- id: opts.patternID,
- patternUnits: 'userSpaceOnUse',
- width: imgWidth + 'px',
- height: imgHeight + 'px'
- });
-
- var elImage = document.createElementNS(w.globals.svgNS, 'image');
- elPattern.appendChild(elImage);
-
- elImage.setAttributeNS('http://www.w3.org/1999/xlink', 'href', fillImg);
-
- _Graphics2.default.setAttrs(elImage, {
- x: 0,
- y: 0,
- preserveAspectRatio: 'none',
- width: imgWidth + 'px',
- height: imgHeight + 'px'
- });
-
- elImage.style.opacity = opts.opacity;
-
- w.globals.dom.elDefs.node.appendChild(elPattern);
- }
- }, {
- key: 'fillPath',
- value: function fillPath(elSeries, opts) {
- var w = this.w;
-
- var cnf = this.w.config;
- var graphics = new _Graphics2.default(this.ctx);
- var utils = new _Utils2.default();
-
- var patternFill = void 0,
- gradientFill = void 0;
-
- var fillColors = [];
-
- var seriesIndex = function seriesIndex() {
- if (w.config.chart.type === 'bar' && w.config.plotOptions.bar.distributed || w.config.chart.type === 'heatmap') {
- return opts.seriesNumber;
- } else {
- return opts.seriesNumber % w.globals.series.length;
- }
- };
-
- var fillOpacity = Array.isArray(cnf.fill.opacity) ? cnf.fill.opacity[seriesIndex()] : cnf.fill.opacity;
-
- if (w.globals.comboCharts) {
- if (w.config.series[seriesIndex()].type === 'line') {
- if (cnf.stroke.colors instanceof Array) {
- fillColors = cnf.stroke.colors;
- } else {
- fillColors.push(cnf.stroke.colors);
- }
- } else {
- if (cnf.fill.colors instanceof Array) {
- fillColors = cnf.fill.colors;
- } else {
- fillColors.push(cnf.fill.colors);
- }
- }
- } else {
- if (cnf.chart.type === 'line') {
- if (cnf.stroke.colors instanceof Array) {
- fillColors = cnf.stroke.colors;
- } else {
- fillColors.push(cnf.stroke.colors);
- }
- } else {
- if (cnf.fill.colors instanceof Array) {
- fillColors = cnf.fill.colors;
- } else {
- fillColors.push(cnf.fill.colors);
- }
- }
- }
-
- // colors passed in arguments
- if (typeof opts.fillColors !== 'undefined') {
- fillColors = [];
- if (opts.fillColors instanceof Array) {
- fillColors = opts.fillColors.slice();
- } else {
- fillColors.push(opts.fillColors);
- }
- }
-
- var defaultColor = _Utils2.default.hexToRgba(fillColors[seriesIndex()], fillOpacity);
-
- var fillColor = fillColors[seriesIndex()];
-
- if (cnf.fill.type === 'pattern') {
- var patternStrokeWidth = cnf.fill.pattern.strokeWidth === undefined ? Array.isArray(cnf.stroke.width) ? cnf.stroke.width[seriesIndex] : cnf.stroke.width : Array.isArray(cnf.fill.pattern.strokeWidth) ? cnf.fill.pattern.strokeWidth[seriesIndex] : cnf.fill.pattern.strokeWidth;
- var patternLineColor = fillColor;
-
- if (cnf.fill.pattern.style instanceof Array) {
- if (typeof cnf.fill.pattern.style[opts.seriesNumber] !== 'undefined') {
- var pf = graphics.drawPattern(cnf.fill.pattern.style[opts.seriesNumber], cnf.fill.pattern.width, cnf.fill.pattern.height, patternLineColor, patternStrokeWidth, fillOpacity);
- patternFill = pf;
- } else {
- patternFill = defaultColor;
- }
- } else {
- patternFill = graphics.drawPattern(cnf.fill.pattern.style, cnf.fill.pattern.width, cnf.fill.pattern.height, patternLineColor, patternStrokeWidth, fillOpacity);
- }
- }
-
- if (cnf.fill.type === 'gradient') {
- var type = cnf.fill.gradient.type;
- var gradientFrom = void 0,
- gradientTo = void 0;
- var opacityFrom = cnf.fill.gradient.opacityFrom === undefined ? fillOpacity : cnf.fill.gradient.opacityFrom;
- var opacityTo = cnf.fill.gradient.opacityTo === undefined ? fillOpacity : cnf.fill.gradient.opacityTo;
-
- gradientFrom = fillColor;
- if (cnf.fill.gradient.gradientToColors === undefined || cnf.fill.gradient.gradientToColors.length === 0) {
- if (cnf.fill.gradient.shade === 'dark') {
- gradientTo = utils.shadeColor(parseFloat(cnf.fill.gradient.shadeIntensity) * -1, fillColor);
- } else {
- gradientTo = utils.shadeColor(parseFloat(cnf.fill.gradient.shadeIntensity), fillColor);
- }
- } else {
- gradientTo = cnf.fill.gradient.gradientToColors[opts.seriesNumber];
- }
-
- if (cnf.fill.gradient.inverseColors) {
- var t = gradientFrom;
- gradientFrom = gradientTo;
- gradientTo = t;
- }
-
- gradientFill = graphics.drawGradient(type, gradientFrom, gradientTo, opacityFrom, opacityTo, opts.size, cnf.fill.gradient.stops);
- }
-
- var pathFill = 'none';
-
- if (cnf.fill.image.src.length > 0 && cnf.fill.type === 'image') {
- if (opts.seriesNumber < cnf.fill.image.src.length) {
- this.clippedImgArea({
- opacity: fillOpacity,
- image: cnf.fill.image.src[opts.seriesNumber],
- patternID: 'pattern' + w.globals.cuid + (opts.seriesNumber + 1)
- });
- pathFill = 'url(#pattern' + w.globals.cuid + (opts.seriesNumber + 1) + ')';
- } else {
- pathFill = defaultColor;
- }
- } else if (cnf.fill.type === 'gradient') {
- pathFill = gradientFill;
- } else if (cnf.fill.type === 'pattern') {
- pathFill = patternFill;
- } else {
- pathFill = defaultColor;
- }
-
- if (opts.solid) {
- pathFill = defaultColor;
- }
-
- if (opts.color) {
- pathFill = opts.color;
- }
-
- return pathFill;
- }
- }]);
-
- return Fill;
-}();
-
-exports.default = Fill;
-
-/***/ }),
-/* 9 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// Thank's IE8 for his funny defineProperty
-module.exports = !__webpack_require__(41)(function () {
- return Object.defineProperty({}, 'a', { get: function get() {
- return 7;
- } }).a != 7;
-});
-
-/***/ }),
-/* 10 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var global = __webpack_require__(2);
-var core = __webpack_require__(5);
-var hide = __webpack_require__(7);
-var redefine = __webpack_require__(13);
-var ctx = __webpack_require__(18);
-var PROTOTYPE = 'prototype';
-
-var $export = function $export(type, name, source) {
- var IS_FORCED = type & $export.F;
- var IS_GLOBAL = type & $export.G;
- var IS_STATIC = type & $export.S;
- var IS_PROTO = type & $export.P;
- var IS_BIND = type & $export.B;
- var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
- var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
- var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
- var key, own, out, exp;
- if (IS_GLOBAL) source = name;
- for (key in source) {
- // contains in native
- own = !IS_FORCED && target && target[key] !== undefined;
- // export native or passed
- out = (own ? target : source)[key];
- // bind timers to global for call from export context
- exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
- // extend global
- if (target) redefine(target, key, out, type & $export.U);
- // export
- if (exports[key] != out) hide(exports, key, exp);
- if (IS_PROTO && expProto[key] != out) expProto[key] = out;
- }
-};
-global.core = core;
-// type bitmap
-$export.F = 1; // forced
-$export.G = 2; // global
-$export.S = 4; // static
-$export.P = 8; // proto
-$export.B = 16; // bind
-$export.W = 32; // wrap
-$export.U = 64; // safe
-$export.R = 128; // real proto method for `library`
-module.exports = $export;
-
-/***/ }),
-/* 11 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-module.exports = function (it) {
- return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) === 'object' ? it !== null : typeof it === 'function';
-};
-
-/***/ }),
-/* 12 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-module.exports = {};
-
-/***/ }),
-/* 13 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var global = __webpack_require__(2);
-var hide = __webpack_require__(7);
-var has = __webpack_require__(19);
-var SRC = __webpack_require__(32)('src');
-var TO_STRING = 'toString';
-var $toString = Function[TO_STRING];
-var TPL = ('' + $toString).split(TO_STRING);
-
-__webpack_require__(5).inspectSource = function (it) {
- return $toString.call(it);
-};
-
-(module.exports = function (O, key, val, safe) {
- var isFunction = typeof val == 'function';
- if (isFunction) has(val, 'name') || hide(val, 'name', key);
- if (O[key] === val) return;
- if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
- if (O === global) {
- O[key] = val;
- } else if (!safe) {
- delete O[key];
- hide(O, key, val);
- } else if (O[key]) {
- O[key] = val;
- } else {
- hide(O, key, val);
- }
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
-})(Function.prototype, TO_STRING, function toString() {
- return typeof this == 'function' && this[SRC] || $toString.call(this);
-});
-
-/***/ }),
-/* 14 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Animation Class.
- *
- * @module Animations
- **/
-
-var Animations = function () {
- function Animations(ctx) {
- _classCallCheck(this, Animations);
-
- this.ctx = ctx;
- this.w = ctx.w;
-
- this.setEasingFunctions();
- }
-
- _createClass(Animations, [{
- key: 'setEasingFunctions',
- value: function setEasingFunctions() {
- var easing = '<>';
-
- var userDefinedEasing = this.w.config.chart.animations.easing;
-
- switch (userDefinedEasing) {
- case 'linear':
- {
- easing = '-';
- break;
- }
- case 'easein':
- {
- easing = '<';
- break;
- }
- case 'easeout':
- {
- easing = '>';
- break;
- }
- case 'easeinout':
- {
- easing = '<>';
- break;
- }
- default:
- {
- easing = '<>';
- }
- }
-
- this.w.globals.easing = easing;
- }
- }, {
- key: 'animateLine',
- value: function animateLine(el, from, to, speed) {
- el.attr(from).animate(speed).attr(to);
- }
-
- /*
- ** Animate radius of a circle element
- */
-
- }, {
- key: 'animateCircleRadius',
- value: function animateCircleRadius(el, from, to, speed) {
- if (!from) from = 0;
-
- el.attr({
- r: from
- }).animate(speed).attr({
- r: to
- });
- }
-
- /*
- ** Animate radius and position of a circle element
- */
-
- }, {
- key: 'animateCircle',
- value: function animateCircle(el, from, to, speed) {
- el.attr({
- r: from.r,
- cx: from.cx,
- cy: from.cy
- }).animate(speed).attr({
- r: to.r,
- cx: to.cx,
- cy: to.cy
- });
- }
-
- /*
- ** Animate rect properties
- */
-
- }, {
- key: 'animateRect',
- value: function animateRect(el, from, to, speed) {
- el.attr(from).animate(speed).attr(to);
- }
- }, {
- key: 'animatePathsGradually',
- value: function animatePathsGradually(params) {
- var el = params.el,
- pathFrom = params.pathFrom,
- pathTo = params.pathTo,
- speed = params.speed,
- delay = params.delay,
- strokeWidth = params.strokeWidth;
-
-
- var me = this;
- var w = this.w;
-
- var delayFactor = 0;
-
- if (w.config.chart.animations.animateGradually.enabled) {
- delayFactor = w.config.chart.animations.animateGradually.delay;
- }
-
- if (w.config.chart.animations.dynamicAnimation.enabled && w.globals.dataChanged) {
- delayFactor = 0;
- }
-
- me.morphSVG(el, pathFrom, pathTo, speed, strokeWidth, delay * delayFactor);
- }
-
- // SVG.js animation for morphing one path to another
-
- }, {
- key: 'morphSVG',
- value: function morphSVG(el, pathFrom, pathTo, speed, strokeWidth, delay) {
- var w = this.w;
-
- if (!pathFrom) {
- pathFrom = el.attr('pathFrom');
- }
-
- if (!pathTo) {
- pathTo = el.attr('pathTo');
- }
-
- if (pathFrom.indexOf('undefined') > -1 || pathFrom.indexOf('NaN') > -1) {
- pathFrom = 'M 0 ' + w.globals.gridHeight;
- speed = 1;
- }
- if (pathTo.indexOf('undefined') > -1 || pathTo.indexOf('NaN') > -1) {
- pathTo = 'M 0 ' + w.globals.gridHeight;
- speed = 1;
- }
-
- el.plot(pathFrom).animate(1, w.globals.easing, delay).plot(pathFrom).animate(speed, w.globals.easing, delay).plot(pathTo);
- }
-
- /* This function is called when initial animation ends.
- ** as we are delaying some elements on axis chart types and showing after initialAnim
- */
-
- }, {
- key: 'showDelayedElements',
- value: function showDelayedElements() {
- var w = this.w;
-
- var anim = w.config.chart.animations;
- var speed = anim.speed;
- var gradualAnimate = anim.animateGradually.enabled;
- var gradualDelay = anim.animateGradually.delay;
-
- if (anim.enabled && !w.globals.resized) {
- for (var i = 0; i < w.globals.series.length; i++) {
- var delay = 0;
- if (gradualAnimate) {
- delay = (i + 1) * (gradualDelay / 1000);
- }
-
- for (var z = 0; z < w.globals.delayedElements.length; z++) {
- if (w.globals.delayedElements[z].index === i) {
- var ele = w.globals.delayedElements[z].el;
- ele.classList.add('apexcharts-showAfterDelay');
- ele.style.animationDelay = speed / 950 + delay + 's';
- }
- }
- }
- }
-
- if (w.config.chart.animations.dynamicAnimation.enabled && w.globals.dataChanged) {
- for (var _z = 0; _z < w.globals.delayedElements.length; _z++) {
- var _ele = w.globals.delayedElements[_z].el;
- _ele.classList.add('apexcharts-showAfterDelay');
- _ele.style.animationDelay = w.config.chart.animations.dynamicAnimation.speed / 950 + 's';
- }
- }
- }
- }]);
-
- return Animations;
-}();
-
-module.exports = Animations;
-
-/***/ }),
-/* 15 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = undefined;
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Series Class for interation with the Series of the chart.
- *
- * @module Series
- **/
-
-var Series = function () {
- function Series(ctx) {
- _classCallCheck(this, Series);
-
- this.ctx = ctx;
- this.w = ctx.w;
- }
-
- _createClass(Series, [{
- key: 'toggleSeriesOnHover',
- value: function toggleSeriesOnHover(e, targetElement) {
- var w = this.w;
-
- var allSeriesEls = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series');
-
- if (e.type === 'mousemove') {
- var seriesCnt = parseInt(targetElement.getAttribute('rel')) - 1;
-
- var seriesEl = null;
- if (w.globals.axisCharts || w.config.chart.type === 'radialBar') {
- if (w.globals.axisCharts) {
- seriesEl = w.globals.dom.baseEl.querySelector('.apexcharts-series[data\\:realIndex=\'' + seriesCnt + '\']');
- } else {
- seriesEl = w.globals.dom.baseEl.querySelector('.apexcharts-series[rel=\'' + (seriesCnt + 1) + '\']');
- }
- } else {
- seriesEl = w.globals.dom.baseEl.querySelector('.apexcharts-series[rel=\'' + (seriesCnt + 1) + '\'] path');
- }
-
- for (var se = 0; se < allSeriesEls.length; se++) {
- allSeriesEls[se].classList.add('legend-mouseover-inactive');
- }
-
- if (seriesEl !== null) {
- if (!w.globals.axisCharts) {
- seriesEl.parentNode.classList.remove('legend-mouseover-inactive');
- }
-
- seriesEl.classList.remove('legend-mouseover-inactive');
- }
- } else if (e.type === 'mouseout') {
- for (var _se = 0; _se < allSeriesEls.length; _se++) {
- allSeriesEls[_se].classList.remove('legend-mouseover-inactive');
- }
- }
- }
- }, {
- key: 'highlightRangeInSeries',
- value: function highlightRangeInSeries(e, targetElement) {
- var w = this.w;
- var allHeatMapElements = w.globals.dom.baseEl.querySelectorAll('.apexcharts-heatmap-rect');
-
- var allActive = function allActive() {
- for (var i = 0; i < allHeatMapElements.length; i++) {
- allHeatMapElements[i].classList.remove('legend-mouseover-inactive');
- }
- };
- var allInactive = function allInactive() {
- for (var i = 0; i < allHeatMapElements.length; i++) {
- allHeatMapElements[i].classList.add('legend-mouseover-inactive');
- }
- };
-
- var selectedActive = function selectedActive(range) {
- for (var i = 0; i < allHeatMapElements.length; i++) {
- var val = parseInt(allHeatMapElements[i].getAttribute('val'));
- if (val > range.from && val < range.to) {
- allHeatMapElements[i].classList.remove('legend-mouseover-inactive');
- }
- }
- };
-
- if (e.type === 'mousemove') {
- var seriesCnt = parseInt(targetElement.getAttribute('rel')) - 1;
- allActive();
- allInactive();
-
- var range = w.config.plotOptions.heatmap.colorScale.ranges[seriesCnt];
-
- selectedActive(range);
- } else if (e.type === 'mouseout') {
- allActive();
- }
- }
- }, {
- key: 'getActiveSeriesIndex',
- value: function getActiveSeriesIndex() {
- var w = this.w;
- var activeIndex = 0;
-
- if (w.globals.series.length > 1) {
- // active series flag is required to know if user has not deactivated via legend click
- var firstActiveSeriesIndex = w.globals.series.map(function (series, index) {
- if (series.length > 0 && w.config.series[index].type !== 'bar' && w.config.series[index].type !== 'column') {
- return index;
- } else {
- return -1;
- }
- });
-
- for (var a = 0; a < firstActiveSeriesIndex.length; a++) {
- if (firstActiveSeriesIndex[a] !== -1) {
- activeIndex = firstActiveSeriesIndex[a];
- break;
- }
- }
- }
-
- return activeIndex;
- }
- }, {
- key: 'getActiveConfigSeriesIndex',
- value: function getActiveConfigSeriesIndex() {
- var w = this.w;
- var activeIndex = 0;
-
- if (w.config.series.length > 1) {
- // active series flag is required to know if user has not deactivated via legend click
- var firstActiveSeriesIndex = w.config.series.map(function (series, index) {
- if (series.data && series.data.length > 0) {
- return index;
- } else {
- return -1;
- }
- });
-
- for (var a = 0; a < firstActiveSeriesIndex.length; a++) {
- if (firstActiveSeriesIndex[a] !== -1) {
- activeIndex = firstActiveSeriesIndex[a];
- break;
- }
- }
- }
-
- return activeIndex;
- }
- }, {
- key: 'getPreviousPaths',
- value: function getPreviousPaths() {
- var w = this.w;
-
- w.globals.previousPaths = [];
-
- function pushPaths(seriesEls, i, type) {
- var paths = seriesEls[i].childNodes;
- var dArr = {
- type: type,
- paths: [],
- realIndex: seriesEls[i].getAttribute('data:realIndex')
- };
-
- for (var j = 0; j < paths.length; j++) {
- if (paths[j].hasAttribute('pathTo')) {
- var d = paths[j].getAttribute('pathTo');
- if (type === 'area') {
- if (paths[j].classList.contains('apexcharts-line')) {
- dArr.paths.push({
- d: d
- });
- } else if (paths[j].classList.contains('apexcharts-area')) {
- dArr.paths.push({
- d: d
- });
- }
- } else {
- dArr.paths.push({
- d: d
- });
- }
- }
- }
-
- w.globals.previousPaths.push(dArr);
- }
-
- var linePaths = w.globals.dom.baseEl.querySelectorAll('.apexcharts-line-series .apexcharts-series');
- if (linePaths.length > 0) {
- for (var p = linePaths.length - 1; p >= 0; p--) {
- pushPaths(linePaths, p, 'line');
- }
- }
-
- var areapaths = w.globals.dom.baseEl.querySelectorAll('.apexcharts-area-series .apexcharts-series');
-
- if (areapaths.length > 0) {
- for (var i = areapaths.length - 1; i >= 0; i--) {
- pushPaths(areapaths, i, 'area');
- }
- }
-
- var barPaths = w.globals.dom.baseEl.querySelectorAll('.apexcharts-bar-series .apexcharts-series');
- if (barPaths.length > 0) {
- for (var _p = 0; _p < barPaths.length; _p++) {
- pushPaths(barPaths, _p, 'bar');
- }
- }
-
- var bubblepaths = w.globals.dom.baseEl.querySelectorAll('.apexcharts-bubble-series .apexcharts-series');
- if (bubblepaths.length > 0) {
- for (var s = 0; s < bubblepaths.length; s++) {
- var seriesEls = w.globals.dom.baseEl.querySelectorAll('.apexcharts-bubble-series .apexcharts-series[data\\:realIndex=\'' + s + '\'] circle');
- var dArr = [];
-
- for (var _i = 0; _i < seriesEls.length; _i++) {
- dArr.push({
- x: seriesEls[_i].getAttribute('cx'),
- y: seriesEls[_i].getAttribute('cy'),
- r: seriesEls[_i].getAttribute('r')
- });
- }
- w.globals.previousPaths.push(dArr);
- }
- }
-
- var scatterpaths = w.globals.dom.baseEl.querySelectorAll('.apexcharts-scatter-series .apexcharts-series');
- if (scatterpaths.length > 0) {
- for (var _s = 0; _s < scatterpaths.length; _s++) {
- var _seriesEls = w.globals.dom.baseEl.querySelectorAll('.apexcharts-scatter-series .apexcharts-series[data\\:realIndex=\'' + _s + '\'] circle');
- var _dArr = [];
-
- for (var _i2 = 0; _i2 < _seriesEls.length; _i2++) {
- _dArr.push({
- x: _seriesEls[_i2].getAttribute('cx'),
- y: _seriesEls[_i2].getAttribute('cy'),
- r: _seriesEls[_i2].getAttribute('r')
- });
- }
- w.globals.previousPaths.push(_dArr);
- }
- }
-
- var heatmapColors = w.globals.dom.baseEl.querySelectorAll('.apexcharts-heatmap .apexcharts-series');
-
- if (heatmapColors.length > 0) {
- for (var h = 0; h < heatmapColors.length; h++) {
- var _seriesEls2 = w.globals.dom.baseEl.querySelectorAll('.apexcharts-heatmap .apexcharts-series[data\\:realIndex=\'' + h + '\'] rect');
-
- var _dArr2 = [];
-
- for (var _i3 = 0; _i3 < _seriesEls2.length; _i3++) {
- _dArr2.push({
- color: _seriesEls2[_i3].getAttribute('color')
- });
- }
- w.globals.previousPaths.push(_dArr2);
- }
- }
-
- if (!w.globals.axisCharts) {
- // for non-axis charts (i.e., circular charts, pathFrom is not usable. We need whole series)
- w.globals.previousPaths = w.globals.series;
- }
- }
- }, {
- key: 'handleNoData',
- value: function handleNoData(_ref) {
- var _ref$appendToRoot = _ref.appendToRoot,
- appendToRoot = _ref$appendToRoot === undefined ? false : _ref$appendToRoot,
- rootEl = _ref.rootEl;
-
- var w = this.w;
- var me = this;
-
- var noDataOpts = w.config.noData;
- var graphics = new _Graphics2.default(me.ctx);
-
- var x = w.globals.svgWidth / 2;
- var y = w.globals.svgHeight / 2;
- var textAnchor = 'middle';
-
- if (noDataOpts.align === 'left') {
- x = 10;
- textAnchor = 'start';
- } else if (noDataOpts.align === 'right') {
- x = w.globals.svgWidth - 10;
- textAnchor = 'end';
- }
-
- if (noDataOpts.verticalAlign === 'top') {
- y = 50;
- } else if (noDataOpts.verticalAlign === 'bottom') {
- y = w.globals.svgHeight - 50;
- }
-
- x = x + noDataOpts.offsetX;
- y = y + parseInt(noDataOpts.style.fontSize) + 2;
-
- if (noDataOpts.text !== undefined && noDataOpts.text !== '') {
- var titleText = graphics.drawText({
- x: x,
- y: y,
- text: noDataOpts.text,
- textAnchor: textAnchor,
- fontSize: noDataOpts.style.fontSize,
- foreColor: noDataOpts.style.color,
- opacity: 1,
- class: 'apexcharts-text-nodata'
- });
-
- titleText.node.setAttribute('class', 'apexcharts-title-text');
-
- w.globals.dom.Paper.add(titleText);
- }
- }
-
- // When user clicks on legends, the collapsed series is filled with [0,0,0,...,0]
- // This is because we don't want to alter the series' length as it is used at many places
-
- }, {
- key: 'setNullSeriesToZeroValues',
- value: function setNullSeriesToZeroValues(series) {
- var w = this.w;
- for (var sl = 0; sl < series.length; sl++) {
- if (series[sl].length === 0) {
- for (var j = 0; j < series[w.globals.maxValsInArrayIndex].length; j++) {
- series[sl].push(0);
- }
- }
- }
- return series;
- }
- }]);
-
- return Series;
-}();
-
-exports.default = Series;
-
-/***/ }),
-/* 16 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-module.exports = function (it) {
- if (typeof it != 'function') throw TypeError(it + ' is not a function!');
- return it;
-};
-
-/***/ }),
-/* 17 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var toString = {}.toString;
-
-module.exports = function (it) {
- return toString.call(it).slice(8, -1);
-};
-
-/***/ }),
-/* 18 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// optional / simple context binding
-var aFunction = __webpack_require__(16);
-module.exports = function (fn, that, length) {
- aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 1:
- return function (a) {
- return fn.call(that, a);
- };
- case 2:
- return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3:
- return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function () /* ...args */{
- return fn.apply(that, arguments);
- };
-};
-
-/***/ }),
-/* 19 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var hasOwnProperty = {}.hasOwnProperty;
-module.exports = function (it, key) {
- return hasOwnProperty.call(it, key);
-};
-
-/***/ }),
-/* 20 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var anObject = __webpack_require__(6);
-var IE8_DOM_DEFINE = __webpack_require__(68);
-var toPrimitive = __webpack_require__(86);
-var dP = Object.defineProperty;
-
-exports.f = __webpack_require__(9) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPrimitive(P, true);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return dP(O, P, Attributes);
- } catch (e) {/* empty */}
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
-};
-
-/***/ }),
-/* 21 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-var _Formatters = __webpack_require__(22);
-
-var _Formatters2 = _interopRequireDefault(_Formatters);
-
-var _Utils = __webpack_require__(1);
-
-var _Utils2 = _interopRequireDefault(_Utils);
-
-var _YAxis = __webpack_require__(36);
-
-var _YAxis2 = _interopRequireDefault(_YAxis);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Dimensions Class for calculating rects of all elements that are drawn and will be drawn.
- *
- * @module Dimensions
- **/
-
-var Dimensions = function () {
- function Dimensions(ctx) {
- _classCallCheck(this, Dimensions);
-
- this.ctx = ctx;
- this.w = ctx.w;
- this.lgRect = {};
- this.yAxisWidth = 0;
- this.xAxisHeight = 0;
-
- this.isBarHorizontal = !!(this.w.config.chart.type === 'bar' && this.w.config.plotOptions.bar.horizontal);
- }
-
- /**
- * @memberof Dimensions
- * @param {object} w - chart context
- **/
-
-
- _createClass(Dimensions, [{
- key: 'plotCoords',
- value: function plotCoords() {
- var w = this.w;
- var gl = w.globals;
-
- // if user specified a type in series too, turn on comboCharts flag
- if (w.config.series.length && typeof w.config.series[0].type !== 'undefined') {
- w.globals.comboCharts = true;
- }
-
- var lgRect = this.getLegendsRect();
-
- if (gl.axisCharts) {
- // for line / area / scatter / column
- this.setGridCoordsForAxisCharts(lgRect);
- } else {
- // for pie / donuts / circle
- this.setGridCoordsForNonAxisCharts(lgRect);
- }
-
- this.titleSubtitleOffset();
- }
- }, {
- key: 'setGridCoordsForAxisCharts',
- value: function setGridCoordsForAxisCharts(lgRect) {
- var w = this.w;
- var gl = w.globals;
-
- var xPad = 0;
-
- var xtitleCoords = {
- width: 0,
- height: 0
- };
- var ytitleCoords = [];
- var yaxisLabelCoords = {
- width: 0,
- height: 0
- };
- var xaxisLabelCoords = {
- width: 0,
- height: 0
- };
-
- yaxisLabelCoords = this.getyAxisLabelsCoords();
- xaxisLabelCoords = this.getxAxisLabelsCoords();
-
- if (w.globals.timelineLabels.length > 0) {
- xaxisLabelCoords = this.getxAxisTimeScaleLabelsCoords();
- }
-
- xtitleCoords = this.getxAxisTitleCoords();
- ytitleCoords = this.getyAxisTitleCoords();
-
- if (this.isBarHorizontal) {}
- // move x with y for horizontal bars
- // let tempObj = Object.assign({}, yaxisLabelCoords)
- // yaxisLabelCoords = Object.assign({}, xaxisLabelCoords)
- // xaxisLabelCoords = Object.assign({}, tempObj)
-
-
- // no x labels, make w=0,h=0
- if (!w.config.xaxis.labels.show) {
- xaxisLabelCoords = {
- height: 0,
- width: 0
- };
- }
-
- w.globals.yLabelsCoords = [];
- w.globals.yTitleCoords = [];
- w.config.yaxis.map(function (yaxe, index) {
- // store the labels and titles coords in global vars
- w.globals.yLabelsCoords.push({
- width: yaxisLabelCoords[index].width,
- index: index
- });
- w.globals.yTitleCoords.push({
- width: ytitleCoords[index].width,
- index: index
- });
- });
-
- this.xAxisHeight = (xaxisLabelCoords.height + xtitleCoords.height) * w.globals.lineHeightRatio + 15;
-
- this.xAxisWidth = xaxisLabelCoords.width;
-
- if (this.xAxisHeight - xtitleCoords.height > w.config.xaxis.labels.maxHeight) {
- this.xAxisHeight = w.config.xaxis.labels.maxHeight;
- }
-
- if (w.config.xaxis.floating) {
- this.xAxisHeight = 0;
- }
-
- gl.xAxisLabelsHeight = this.xAxisHeight;
-
- gl.translateXAxisY = w.globals.rotateXLabels ? this.xAxisHeight / 8 : -4;
- gl.translateXAxisX = w.globals.rotateXLabels && w.globals.dataXY && w.config.xaxis.labels.rotate <= -45 ? -this.xAxisWidth / 4 : 0;
-
- if (this.isBarHorizontal) {
- gl.rotateXLabels = false;
- gl.translateXAxisY = -1 * (parseInt(w.config.xaxis.labels.style.fontSize) / 1.5);
- }
-
- gl.translateXAxisY = gl.translateXAxisY + w.config.xaxis.labels.offsetY;
- gl.translateXAxisX = gl.translateXAxisX + w.config.xaxis.labels.offsetX;
-
- if (!this.isBarHorizontal) {
- this.yAxisWidth = this.getTotalYAxisWidth();
- } else {
- this.yAxisWidth = w.globals.yLabelsCoords[0].width + w.globals.yTitleCoords[0].width + 15;
- if (this.yAxisWidth > w.config.yaxis[0].labels.maxWidth) {
- this.yAxisWidth = w.config.yaxis[0].labels.maxWidth;
- }
- }
-
- var yAxisWidth = this.yAxisWidth;
- var xAxisHeight = this.xAxisHeight;
- var translateY = 10;
-
- if (!w.config.grid.show) {
- yAxisWidth = 0;
- xAxisHeight = 35;
- }
-
- if (w.config.chart.sparkline.enabled) {
- lgRect = {
- height: 0,
- width: 0
- };
- xPad = 0;
- xAxisHeight = 0;
- yAxisWidth = 0;
- translateY = 0;
- }
-
- switch (w.config.legend.position) {
- case 'bottom':
- gl.translateY = translateY;
- gl.translateX = yAxisWidth;
- gl.gridHeight = gl.svgHeight - lgRect.height - xAxisHeight - (w.globals.rotateXLabels ? 10 : 15);
- gl.gridWidth = gl.svgWidth - xPad - yAxisWidth;
- break;
- case 'top':
- gl.translateY = lgRect.height + translateY;
- gl.translateX = yAxisWidth;
- gl.gridHeight = gl.svgHeight - lgRect.height - xAxisHeight - (w.globals.rotateXLabels ? 10 : 15);
- gl.gridWidth = gl.svgWidth - xPad - yAxisWidth;
- break;
- case 'left':
- gl.translateY = translateY;
- gl.translateX = lgRect.width + yAxisWidth;
- gl.gridHeight = gl.svgHeight - xAxisHeight;
- gl.gridWidth = gl.svgWidth - lgRect.width - xPad - yAxisWidth;
- break;
- case 'right':
- gl.translateY = translateY;
- gl.translateX = yAxisWidth;
- gl.gridHeight = gl.svgHeight - xAxisHeight;
- gl.gridWidth = gl.svgWidth - lgRect.width - xPad - yAxisWidth;
- break;
- default:
- gl.translateY = translateY;
- gl.translateX = yAxisWidth;
- gl.gridHeight = gl.svgHeight - lgRect.height - xAxisHeight;
- gl.gridWidth = gl.svgWidth - xPad;
- break;
- }
-
- var scrollerHeight = 0;
- if (w.config.chart.scroller.enabled && w.globals.dataXY) {
- scrollerHeight = w.config.chart.scroller.height;
- }
-
- gl.gridHeight = gl.gridHeight - w.config.grid.padding.top - w.config.grid.padding.bottom - scrollerHeight;
-
- gl.gridWidth = gl.gridWidth - w.config.grid.padding.left - w.config.grid.padding.right;
-
- gl.translateX = gl.translateX + w.config.grid.padding.left;
- gl.translateY = gl.translateY + w.config.grid.padding.top;
-
- if (!this.isBarHorizontal) {
- this.setGridXPosForDualYAxis(ytitleCoords, yaxisLabelCoords);
- }
-
- // after drawing everything, set the Y axis positions
- this.setYAxisXPosition(yaxisLabelCoords, ytitleCoords);
- }
- }, {
- key: 'setGridCoordsForNonAxisCharts',
- value: function setGridCoordsForNonAxisCharts(lgRect) {
- var w = this.w;
- var gl = w.globals;
- var xPad = w.config.legend.markers.size * 4 + w.config.legend.itemMargin.horizontal;
-
- var offY = 15;
-
- if (w.config.chart.type === 'pie' || w.config.chart.type === 'donut') {
- offY = offY + w.config.plotOptions.pie.offsetY;
- } else if (w.config.chart.type === 'radialBar') {
- offY = offY + w.config.plotOptions.radialBar.offsetY;
- }
-
- switch (w.config.legend.position) {
- case 'bottom':
- gl.gridHeight = gl.svgHeight - lgRect.height - 35;
- gl.gridWidth = gl.gridHeight;
-
- gl.translateY = offY;
- gl.translateX = (gl.svgWidth - gl.gridWidth) / 2;
- break;
- case 'top':
- gl.gridHeight = gl.svgHeight - lgRect.height - 35;
- gl.gridWidth = gl.gridHeight;
-
- gl.translateY = lgRect.height + offY;
- gl.translateX = (gl.svgWidth - gl.gridWidth) / 2;
- break;
- case 'left':
- gl.gridWidth = gl.svgWidth - lgRect.width - xPad;
- gl.gridHeight = gl.gridWidth;
- gl.translateY = offY;
- gl.translateX = lgRect.width + xPad;
-
- break;
- case 'right':
- gl.gridWidth = gl.svgWidth - lgRect.width - xPad;
- gl.gridHeight = gl.gridWidth;
- gl.translateY = offY;
- gl.translateX = 5;
-
- break;
- default:
- gl.gridHeight = gl.svgHeight - lgRect.height - 30;
- gl.gridWidth = gl.gridHeight;
-
- gl.translateY = offY;
- gl.translateX = (gl.svgWidth - gl.gridWidth) / 2;
- break;
- }
- }
- }, {
- key: 'setGridXPosForDualYAxis',
- value: function setGridXPosForDualYAxis(ytitleCoords, yaxisLabelCoords) {
- var w = this.w;
- // if(w.config.yaxis.length > 1) {
- w.config.yaxis.map(function (yaxe, index) {
- if (!w.globals.ignoreYAxisIndexes.includes(index) && !w.config.yaxis[index].floating) {
- if (yaxe.opposite) {
- w.globals.translateX = w.globals.translateX - (yaxisLabelCoords[index].width + ytitleCoords[index].width) - parseInt(w.config.yaxis[index].labels.style.fontSize) / 1.2;
- }
- }
- });
- // }
- }
- }, {
- key: 'titleSubtitleOffset',
- value: function titleSubtitleOffset() {
- var w = this.w;
- var gl = w.globals;
- var gridShrinkOffset = 10;
-
- if (w.config.title.text !== undefined) {
- gridShrinkOffset += w.config.title.margin;
- } else {
- gridShrinkOffset += 5;
- }
-
- if (w.config.subtitle.text !== undefined) {
- gridShrinkOffset += w.config.subtitle.margin;
- } else {
- gridShrinkOffset += 5;
- }
-
- if (w.config.legend.show && w.config.legend.position === 'bottom' && !w.config.legend.floating && w.config.series.length > 1) {
- gridShrinkOffset += 10;
- }
-
- var titleCoords = this.getMainTitleCoords();
- var subtitleCoords = this.getSubTitleCoords();
-
- gl.gridHeight = gl.gridHeight - titleCoords.height - subtitleCoords.height - gridShrinkOffset;
-
- gl.translateY = gl.translateY + titleCoords.height + subtitleCoords.height + gridShrinkOffset;
- }
- }, {
- key: 'getTotalYAxisWidth',
- value: function getTotalYAxisWidth() {
- var w = this.w;
- var yAxisWidth = 0;
-
- w.globals.yLabelsCoords.map(function (yLabelCoord, index) {
- var floating = w.config.yaxis[index].floating;
- if (yLabelCoord.width > 0 && !floating) {
- yAxisWidth = yAxisWidth + yLabelCoord.width;
- if (w.globals.ignoreYAxisIndexes.includes(index)) {
- yAxisWidth = yAxisWidth - yLabelCoord.width;
- }
- } else {
- yAxisWidth = yAxisWidth + (floating ? 0 : 5);
- }
- });
-
- w.globals.yTitleCoords.map(function (yTitleCoord, index) {
- var floating = w.config.yaxis[index].floating;
- if (yTitleCoord.width > 0 && !floating) {
- yAxisWidth = yAxisWidth + yTitleCoord.width + parseInt(w.config.yaxis[index].title.style.fontSize);
- if (w.globals.ignoreYAxisIndexes.includes(index)) {
- yAxisWidth = yAxisWidth - yTitleCoord.width;
- }
- } else {
- yAxisWidth = yAxisWidth + (floating ? 0 : 5);
- }
- });
-
- return yAxisWidth;
- }
- }, {
- key: 'getxAxisTimeScaleLabelsCoords',
- value: function getxAxisTimeScaleLabelsCoords() {
- var w = this.w;
-
- var timescaleLabels = w.globals.timelineLabels.slice();
-
- var labels = timescaleLabels.map(function (label) {
- return label.value;
- });
-
- // get the longest string from the labels array and also apply label formatter to it
- var val = labels.reduce(function (a, b) {
- // if undefined, maybe user didn't pass the datetime(x) values
- if (typeof a === 'undefined') {
- throw new Error('You have possibly supplied invalid Date format. Please supply a valid JavaScript Date');
- }
- return a.length > b.length ? a : b;
- });
-
- var graphics = new _Graphics2.default(this.ctx);
- var virtualText = graphics.drawText({
- x: -200,
- y: -200,
- text: val,
- textAnchor: 'start',
- fontSize: w.config.xaxis.labels.style.fontSize,
- foreColor: '#fff',
- opacity: 0
- });
-
- w.globals.dom.Paper.add(virtualText);
-
- var rect = virtualText.node.getBoundingClientRect();
-
- var totalWidthRotated = rect.width * 1.05 * labels.length;
-
- if (totalWidthRotated > w.globals.gridWidth && w.config.xaxis.labels.rotate !== 0) {
- w.globals.overlappingXLabels = true;
- } else {
- w.globals.overlappingXLabels = true;
- }
-
- virtualText.node.parentNode.removeChild(virtualText.node);
-
- return {
- width: rect.width,
- height: rect.height
- };
- }
-
- /**
- * Get X Axis Dimensions
- * @memberof Dimensions
- * @return {{width, height}}
- **/
-
- }, {
- key: 'getxAxisLabelsCoords',
- value: function getxAxisLabelsCoords() {
- var w = this.w;
-
- var xaxisLabels = w.globals.labels.slice();
-
- var lgWidthForSideLegends = w.config.legend.position === 'left' && w.config.legend.position === 'right' && !w.config.legend.floating ? this.lgRect.width : 0;
-
- // get the longest string from the labels array and also apply label formatter to it
- var val = xaxisLabels.reduce(function (a, b) {
- return a.length > b.length ? a : b;
- });
-
- var xlbFormatter = w.globals.xLabelFormatter;
-
- var xFormat = new _Formatters2.default(this.ctx);
- val = xFormat.xLabelFormat(xlbFormatter, val);
-
- var graphics = new _Graphics2.default(this.ctx);
- var virtualText = graphics.drawText({
- x: -200,
- y: -200,
- text: val,
- textAnchor: 'start',
- fontSize: w.config.xaxis.labels.style.fontSize,
- foreColor: '#fff',
- opacity: 0
- });
-
- w.globals.dom.Paper.add(virtualText);
-
- var xLabelrect = virtualText.node.getBoundingClientRect();
-
- var rect = {
- width: xLabelrect.width,
- height: xLabelrect.height
- };
-
- if (rect.width * xaxisLabels.length > w.globals.svgWidth - lgWidthForSideLegends - this.yAxisWidth && w.config.xaxis.labels.rotate !== 0) {
- if (!this.isBarHorizontal) {
- w.globals.rotateXLabels = true;
- virtualText.attr('transform', 'rotate(' + w.config.xaxis.labels.rotate + ' 0 0)');
-
- xLabelrect = virtualText.node.getBoundingClientRect();
- rect.height = xLabelrect.height / 1.65;
- }
- } else {
- w.globals.rotateXLabels = false;
- }
-
- virtualText.node.parentNode.removeChild(virtualText.node);
-
- return {
- width: rect.width,
- height: rect.height
- };
- }
- }, {
- key: 'setYAxisXPosition',
- value: function setYAxisXPosition(yaxisLabelCoords, ytitleCoords) {
- var _this = this;
-
- var w = this.w;
-
- var xLeft = 0;
- var xRight = 0;
- var leftDrawnYs = 0; // already drawn y axis on left side
- var rightDrawnYs = 4; // already drawn y axis on right side
- var multipleYPadd = 5;
- this.multipleYs = false;
-
- if (w.config.yaxis.length > 1) {
- this.multipleYs = true;
- }
-
- w.config.yaxis.map(function (yaxe, index) {
- var yAxisWidth = yaxisLabelCoords[index].width + ytitleCoords[index].width;
-
- var objyAxis = new _YAxis2.default(_this.ctx);
-
- var paddingForYAxisTitle = objyAxis.xPaddingForYAxisTitle(index, {
- width: yaxisLabelCoords[index].width
- }, {
- width: ytitleCoords[index].width
- }, yaxe.opposite);
-
- if (w.config.yaxis.length > 1) {
- // multiple yaxis
- yAxisWidth = yAxisWidth + Math.abs(paddingForYAxisTitle.padd);
- } else {
- // just a single y axis in axis chart
- if (yaxe.title.text === undefined) {
- yAxisWidth = yAxisWidth + Math.abs(paddingForYAxisTitle.padd) + 15;
- } else {
- yAxisWidth = yAxisWidth + Math.abs(paddingForYAxisTitle.padd);
- }
- }
-
- if (!yaxe.opposite) {
- // left side y axis
- var offset = yAxisWidth;
- if (w.globals.ignoreYAxisIndexes.includes(index)) {
- offset = 0;
- }
-
- if (_this.multipleYs) {
- xLeft = w.globals.translateX - yAxisWidth - leftDrawnYs + multipleYPadd + parseInt(w.config.yaxis[index].labels.style.fontSize) / 1.2 + yaxe.labels.offsetX + 5;
- } else {
- xLeft = w.globals.translateX - yAxisWidth + yaxisLabelCoords[index].width + yaxe.labels.offsetX + 2;
- }
-
- leftDrawnYs = leftDrawnYs + offset;
- w.globals.translateYAxisX[index] = xLeft;
- } else {
- // right side y axis
- xRight = w.globals.gridWidth + w.globals.translateX + rightDrawnYs + 26 + (w.globals.series.length - w.globals.collapsedSeries.length);
-
- rightDrawnYs = rightDrawnYs + yAxisWidth;
- w.globals.translateYAxisX[index] = xRight - yaxe.labels.offsetX;
- }
-
- // w.globals.yAxisWidths.push(yAxisWidth)
- });
- }
-
- /**
- * Get Y Axis Dimensions
- * @memberof Dimensions
- * @return {{width, height}}
- **/
-
- }, {
- key: 'getyAxisLabelsCoords',
- value: function getyAxisLabelsCoords() {
- var _this2 = this;
-
- var w = this.w;
-
- var width = 0;
- var height = 0;
- var ret = [];
- var labelPad = 10;
-
- w.config.yaxis.map(function (yaxe, index) {
- if (yaxe.labels.show && w.globals.yAxisScale[index].result.length) {
- var lbFormatter = yaxe.labels.formatter;
- var val = lbFormatter(w.globals.yAxisScale[index].niceMax);
-
- if (_this2.isBarHorizontal) {
- labelPad = 0;
-
- var barYaxisLabels = w.globals.labels.slice();
-
- // get the longest string from the labels array and also apply label formatter to it
- val = barYaxisLabels.reduce(function (a, b) {
- return a.length > b.length ? a : b;
- });
-
- val = lbFormatter(val);
- }
-
- var graphics = new _Graphics2.default(_this2.ctx);
- var virtualText = graphics.drawText({
- x: 0,
- y: 0,
- text: val,
- textAnchor: 'start',
- fontSize: yaxe.labels.style.fontSize,
- foreColor: '#fff',
- opacity: 0
- });
-
- w.globals.dom.Paper.add(virtualText);
-
- var rect = virtualText.node.getBoundingClientRect();
-
- virtualText.node.parentNode.removeChild(virtualText.node);
-
- ret.push({
- width: rect.width + labelPad,
- height: rect.height
- });
- } else {
- ret.push({
- width: width,
- height: height
- });
- }
- });
-
- return ret;
- }
-
- /**
- * Get X Axis Title Dimensions
- * @memberof Dimensions
- * @return {{width, height}}
- **/
-
- }, {
- key: 'getxAxisTitleCoords',
- value: function getxAxisTitleCoords() {
- var w = this.w;
- var width = 0;
- var height = 0;
-
- if (w.config.xaxis.title.text !== undefined) {
- var graphics = new _Graphics2.default(this.ctx);
- var virtualText = graphics.drawText({
- x: 0,
- y: 0,
- text: w.config.xaxis.title.text,
- textAnchor: 'start',
- fontSize: w.config.xaxis.title.style.fontSize,
- foreColor: '#fff',
- opacity: 0
- });
-
- w.globals.dom.Paper.add(virtualText);
-
- var rect = virtualText.node.getBoundingClientRect();
-
- width = rect.width;
- height = rect.height;
-
- virtualText.node.parentNode.removeChild(virtualText.node);
- }
-
- return {
- width: width,
- height: height
- };
- }
-
- /**
- * Get Y Axis Dimensions
- * @memberof Dimensions
- * @return {{width, height}}
- **/
-
- }, {
- key: 'getyAxisTitleCoords',
- value: function getyAxisTitleCoords() {
- var _this3 = this;
-
- var w = this.w;
- var ret = [];
-
- w.config.yaxis.map(function (yaxe, index) {
- if (yaxe.title.text !== undefined) {
- var graphics = new _Graphics2.default(_this3.ctx);
- var virtualText = graphics.drawText({
- x: 0,
- y: 0,
- text: yaxe.title.text,
- textAnchor: 'middle',
- fontSize: yaxe.title.style.fontSize,
- foreColor: '#fff',
- opacity: 0
- });
-
- virtualText.attr('transform', 'rotate(-90 0 0)');
-
- w.globals.dom.Paper.add(virtualText);
-
- var rect = virtualText.node.getBoundingClientRect();
-
- ret.push({
- width: rect.width,
- height: rect.height
- });
-
- virtualText.node.parentNode.removeChild(virtualText.node);
- } else {
- ret.push({
- width: 0,
- height: 0
- });
- }
- });
-
- return ret;
- }
-
- /**
- * Get Chart Title Dimensions
- * @memberof Dimensions
- * @return {{width, height}}
- **/
-
- }, {
- key: 'getMainTitleCoords',
- value: function getMainTitleCoords() {
- var w = this.w;
- var width = 0;
- var height = 0;
-
- var elTitle = w.globals.dom.baseEl.querySelector('.apexcharts-title-text');
-
- if (elTitle !== null && !w.config.title.floating) {
- var titleCoords = elTitle.getBoundingClientRect();
- width = titleCoords.width;
- height = titleCoords.height + 5;
- }
-
- return {
- width: width,
- height: height
- };
- }
-
- /**
- * Get Chart Title Dimensions
- * @memberof Dimensions
- * @return {{width, height}}
- **/
-
- }, {
- key: 'getSubTitleCoords',
- value: function getSubTitleCoords() {
- var w = this.w;
- var width = 0;
- var height = 0;
-
- var elSubTitle = w.globals.dom.baseEl.querySelector('.apexcharts-subtitle-text');
-
- if (elSubTitle !== null && !w.config.subtitle.floating) {
- var subtitleCoords = elSubTitle.getBoundingClientRect();
- width = subtitleCoords.width;
- height = subtitleCoords.height + 5;
- }
-
- return {
- width: width,
- height: height
- };
- }
- }, {
- key: 'getLegendsRect',
- value: function getLegendsRect() {
- var w = this.w;
-
- var elLegendWrap = w.globals.dom.baseEl.querySelector('.apexcharts-legend');
- var lgRect = Object.assign({}, _Utils2.default.getBoundingClientRect(elLegendWrap));
-
- lgRect.height = lgRect.height + w.config.legend.containerMargin.top + w.config.legend.containerMargin.bottom;
- lgRect.width = lgRect.width + w.config.legend.containerMargin.left + w.config.legend.containerMargin.right;
-
- if (elLegendWrap !== null && !w.config.legend.floating) {
- this.lgRect = lgRect;
- } else {
- this.lgRect = {
- x: 0,
- y: 0,
- height: 0,
- width: 0
- };
- }
-
- return this.lgRect;
- }
- }]);
-
- return Dimensions;
-}();
-
-module.exports = Dimensions;
-
-/***/ }),
-/* 22 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _DateTime = __webpack_require__(37);
-
-var _DateTime2 = _interopRequireDefault(_DateTime);
-
-var _Utils = __webpack_require__(1);
-
-var _Utils2 = _interopRequireDefault(_Utils);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Formatter Class for setting value formatters for axes as well as tooltips.
- *
- * @module Formatters
- **/
-
-var Formatters = function () {
- function Formatters(ctx) {
- _classCallCheck(this, Formatters);
-
- this.ctx = ctx;
- this.w = ctx.w;
- this.tooltipKeyFormat = 'dd MMM';
- }
-
- // xLabelFormat is the formatter function which is used
-
-
- _createClass(Formatters, [{
- key: 'xLabelFormat',
- value: function xLabelFormat(fn, val) {
- var w = this.w;
-
- // if datetime series
- if (w.config.xaxis.type === 'datetime') {
- // if user has not specified a custom formatter, use the
- if (w.config.tooltip.x.formatter === undefined) {
- var datetimeObj = new _DateTime2.default(this.ctx);
- return datetimeObj.formatDate(new Date(val), w.config.tooltip.x.format);
- }
- }
-
- return fn(val);
- }
- }, {
- key: 'setLabelFormatters',
- value: function setLabelFormatters() {
- var w = this.w;
-
- w.globals.xLabelFormatter = function (val, opts) {
- return val;
- };
-
- // this is commented for now, can be give as a customization to user later
- // w.globals.xaxisTooltipLabelFormatter = function (val) {
- // return val
- // }
-
- w.globals.ttKeyFormatter = function (val, opts) {
- return val;
- };
-
- w.globals.ttZFormatter = function (val, opts) {
- return val;
- };
-
- w.globals.legendFormatter = function (val, opts) {
- return val;
- };
-
- if (w.config.tooltip.x.formatter !== undefined) {
- w.globals.ttKeyFormatter = w.config.tooltip.x.formatter;
- }
-
- if (w.config.tooltip.y.formatter !== undefined) {
- w.globals.ttValFormatter = w.config.tooltip.y.formatter;
- }
-
- if (w.config.tooltip.z.formatter !== undefined) {
- w.globals.ttZFormatter = w.config.tooltip.z.formatter;
- }
-
- // legend formatter - if user wants to append any global values of series to legend text
- if (w.config.legend.formatter !== undefined) {
- w.globals.legendFormatter = w.config.legend.formatter;
- }
-
- // formatter function will always overwrite format property
- if (w.config.xaxis.labels.formatter !== undefined) {
- w.globals.xLabelFormatter = w.config.xaxis.labels.formatter;
- } else {
- w.globals.xLabelFormatter = function (val, opts) {
- if (_Utils2.default.isInt(val)) {
- return val.toFixed(0);
- }
- return val;
- };
- }
- }
- }]);
-
- return Formatters;
-}();
-
-exports.default = Formatters;
-
-/***/ }),
-/* 23 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// getting tag from 19.1.3.6 Object.prototype.toString()
-var cof = __webpack_require__(17);
-var TAG = __webpack_require__(3)('toStringTag');
-// ES3 wrong here
-var ARG = cof(function () {
- return arguments;
-}()) == 'Arguments';
-
-// fallback for IE11 Script Access Denied error
-var tryGet = function tryGet(it, key) {
- try {
- return it[key];
- } catch (e) {/* empty */}
-};
-
-module.exports = function (it) {
- var O, T, B;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
- // builtinTag case
- : ARG ? cof(O)
- // ES3 arguments fallback
- : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
-};
-
-/***/ }),
-/* 24 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// 7.2.1 RequireObjectCoercible(argument)
-module.exports = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
-};
-
-/***/ }),
-/* 25 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var isObject = __webpack_require__(11);
-var document = __webpack_require__(2).document;
-// typeof document.createElement is 'object' in old IE
-var is = isObject(document) && isObject(document.createElement);
-module.exports = function (it) {
- return is ? document.createElement(it) : {};
-};
-
-/***/ }),
-/* 26 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-module.exports = false;
-
-/***/ }),
-/* 27 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-// 25.4.1.5 NewPromiseCapability(C)
-
-var aFunction = __webpack_require__(16);
-
-function PromiseCapability(C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aFunction(resolve);
- this.reject = aFunction(reject);
-}
-
-module.exports.f = function (C) {
- return new PromiseCapability(C);
-};
-
-/***/ }),
-/* 28 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var def = __webpack_require__(20).f;
-var has = __webpack_require__(19);
-var TAG = __webpack_require__(3)('toStringTag');
-
-module.exports = function (it, tag, stat) {
- if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
-};
-
-/***/ }),
-/* 29 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var shared = __webpack_require__(48)('keys');
-var uid = __webpack_require__(32);
-module.exports = function (key) {
- return shared[key] || (shared[key] = uid(key));
-};
-
-/***/ }),
-/* 30 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// 7.1.4 ToInteger
-var ceil = Math.ceil;
-var floor = Math.floor;
-module.exports = function (it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
-};
-
-/***/ }),
-/* 31 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// to indexed object, toObject with fallback for non-array-like ES3 strings
-var IObject = __webpack_require__(70);
-var defined = __webpack_require__(24);
-module.exports = function (it) {
- return IObject(defined(it));
-};
-
-/***/ }),
-/* 32 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var id = 0;
-var px = Math.random();
-module.exports = function (key) {
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
-};
-
-/***/ }),
-/* 33 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Scatter = __webpack_require__(54);
-
-var _Scatter2 = _interopRequireDefault(_Scatter);
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-var _Filters = __webpack_require__(4);
-
-var _Filters2 = _interopRequireDefault(_Filters);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts DataLabels Class for drawing dataLabels on Axes based Charts.
- *
- * @module DataLabels
- **/
-
-var DataLabels = function () {
- function DataLabels(ctx) {
- var _this = this;
-
- _classCallCheck(this, DataLabels);
-
- this.plotDataLabelsText = function (x, y, text, i, j, elToAppendTo, dataLabelsConfig) {
- var w = _this.w;
- var graphics = new _Graphics2.default(_this.ctx);
-
- var correctedLabels = _this.dataLabelsCorrection(x, y, text, i, j, parseInt(dataLabelsConfig.style.fontSize), w.config.markers.size <= w.config.markers.hover.size ? w.config.markers.hover.size : w.config.markers.size);
-
- // when zoomed, we don't need to correct labels offsets,
- // but if normally, labels get cropped, correct them
- if (!w.globals.zoomed) {
- x = correctedLabels.x;
- y = correctedLabels.y;
- }
-
- if (correctedLabels.drawnextLabel) {
- var dataLabelText = graphics.drawText({
- width: 100,
- height: parseInt(dataLabelsConfig.style.fontSize),
- x: x,
- y: y,
- foreColor: dataLabelsConfig.style.colors[i],
- textAnchor: dataLabelsConfig.textAnchor,
- text: text,
- fontSize: dataLabelsConfig.style.fontSize
- });
-
- dataLabelText.attr({
- class: 'apexcharts-datalabel',
- cx: x,
- cy: y
- });
-
- if (dataLabelsConfig.dropShadow.enabled) {
- var textShadow = dataLabelsConfig.dropShadow;
- var filters = new _Filters2.default(_this.ctx);
- filters.dropShadow(dataLabelText, textShadow);
- }
-
- elToAppendTo.add(dataLabelText);
-
- if (typeof w.globals.lastDrawnDataLabelsIndexes[i] === 'undefined') {
- w.globals.lastDrawnDataLabelsIndexes[i] = [];
- }
-
- w.globals.lastDrawnDataLabelsIndexes[i].push(j);
- }
- };
-
- this.ctx = ctx;
- this.w = ctx.w;
- }
-
- // When there are many datalabels to be printed, and some of them overlaps each other in the same series, this method will take care of that
- // Also, when datalabels exceeds the drawable area and get clipped off, we need to adjust and move some pixels to make them visible again
-
-
- _createClass(DataLabels, [{
- key: 'dataLabelsCorrection',
- value: function dataLabelsCorrection(x, y, val, i, realIndexP, fontSize, pointSize) {
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
- var drawnextLabel = false; //
-
- var textRects = graphics.getTextRects(val, fontSize);
- var width = textRects.width;
- var height = textRects.height;
-
- // first value in series, so push an empty array
- if (typeof w.globals.dataLabelsRects[i] === 'undefined') w.globals.dataLabelsRects[i] = [];
-
- // then start pushing actual rects in that sub-array
- w.globals.dataLabelsRects[i].push({ x: x, y: y, width: width, height: height });
-
- var len = w.globals.dataLabelsRects[i].length - 2;
- var lastDrawnIndex = typeof w.globals.lastDrawnDataLabelsIndexes[i] !== 'undefined' ? w.globals.lastDrawnDataLabelsIndexes[i][w.globals.lastDrawnDataLabelsIndexes[i].length - 1] : 0;
-
- if (typeof w.globals.dataLabelsRects[i][len] !== 'undefined') {
- var lastDataLabelRect = w.globals.dataLabelsRects[i][lastDrawnIndex];
- if (
- // next label forward and x not intersecting
- x > lastDataLabelRect.x + lastDataLabelRect.width + 2 || y > lastDataLabelRect.y + lastDataLabelRect.height + 2 || x + width < lastDataLabelRect.x // next label is going to be drawn backwards
- ) {
- // the 2 indexes don't override, so OK to draw next label
- drawnextLabel = true;
- }
- }
- if (realIndexP === 0) {
- drawnextLabel = true;
- }
-
- return {
- x: x,
- y: y,
- drawnextLabel: drawnextLabel
- };
- }
- }, {
- key: 'drawDataLabel',
- value: function drawDataLabel(pos, i, j) {
- var z = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
-
- // this method handles line, area, bubble, scatter charts as those charts contains markers/points which have pre-defined x/y positions
- // all other charts like bars / heatmaps will define their own drawDataLabel routine
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
-
- var dataLabelsConfig = w.config.dataLabels;
-
- var x = 0;
- var y = 0;
-
- var realIndexP = j;
-
- var elDataLabelsWrap = null;
-
- if (dataLabelsConfig.enabled) {
- elDataLabelsWrap = graphics.group({
- class: 'apexcharts-data-labels'
- });
-
- if (pos.x instanceof Array) {
- for (var q = 0; q < pos.x.length; q++) {
- x = pos.x[q] + dataLabelsConfig.offsetX;
- y = pos.y[q] + dataLabelsConfig.offsetY - w.config.markers.size - 5;
-
- if (!isNaN(x)) {
- // a small hack as we have 2 points for the first val to connect it
- if (j === 1 && q === 0) realIndexP = 0;
- if (j === 1 && q === 1) realIndexP = 1;
-
- var val = w.globals.series[i][realIndexP];
-
- var text = '';
-
- if (w.config.chart.type === 'bubble') {
- text = w.globals.seriesZ[i][realIndexP];
- y = pos.y[q] + w.config.dataLabels.offsetY;
- var scatter = new _Scatter2.default(this.ctx);
- var centerTextInBubbleCoords = scatter.centerTextInBubble(y, i, realIndexP);
- y = centerTextInBubbleCoords.y;
- } else {
- if (val) {
- text = w.config.dataLabels.formatter(val, { seriesIndex: i, dataPointIndex: realIndexP, globals: w.globals });
- }
- }
- this.plotDataLabelsText(x, y, text, i, realIndexP, elDataLabelsWrap, w.config.dataLabels);
- }
- }
- }
- }
-
- return elDataLabelsWrap;
- }
- }]);
-
- return DataLabels;
-}();
-
-exports.default = DataLabels;
-
-/***/ }),
-/* 34 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Filters = __webpack_require__(4);
-
-var _Filters2 = _interopRequireDefault(_Filters);
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Markers Class for drawing points on y values in axes charts.
- *
- * @module Markers
- **/
-
-var Markers = function () {
- function Markers(ctx, opts) {
- _classCallCheck(this, Markers);
-
- this.ctx = ctx;
- this.w = ctx.w;
- }
-
- _createClass(Markers, [{
- key: 'plotChartMarkers',
- value: function plotChartMarkers(pointsPos, seriesIndex, j) {
- var _this = this;
-
- var w = this.w;
-
- var p = pointsPos;
- var elPointsWrap = null;
-
- var graphics = new _Graphics2.default(this.ctx);
-
- var point = void 0;
-
- if (w.config.markers.size > 0) {
- elPointsWrap = graphics.group({
- class: 'apexcharts-series-markers'
- });
- }
-
- if (p.x instanceof Array) {
- var _loop = function _loop(q) {
- var realIndexP = j;
-
- var PointClasses = 'apexcharts-marker';
- if ((w.config.chart.type === 'line' || w.config.chart.type === 'area') && !w.globals.comboCharts && !w.config.tooltip.intersect) {
- PointClasses += ' no-pointer-events';
- }
-
- if (w.config.markers.size > 0) {
- if (p.y[q] !== null) {
- PointClasses += ' w' + (Math.random() + 1).toString(36).substring(4);
- } else {
- PointClasses = 'apexcharts-nullpoint';
- }
-
- var opts = _this.getMarkerConfig(PointClasses, seriesIndex);
- w.config.markers.discrete.map(function (marker, mIndex) {
- if (marker.i === seriesIndex && marker.j === realIndexP) {
- opts.pointStrokeColor = marker.strokeColor;
- opts.pointFillColor = marker.fillColor;
- opts.size = marker.size;
- }
- });
-
- point = graphics.drawMarker(p.x[q], p.y[q], opts);
-
- // a small hack as we have 2 points for the first val to connect it
- if (j === 1 && q === 0) realIndexP = 0;
- if (j === 1 && q === 1) realIndexP = 1;
-
- point.attr('rel', realIndexP);
- point.attr('j', realIndexP);
- point.attr('index', seriesIndex);
-
- _this.setSelectedPointFilter(point, seriesIndex, realIndexP);
- _this.addEvents(point);
-
- elPointsWrap.add(point);
- } else {
- // dynamic array creation - multidimensional
- if (typeof w.globals.pointsArray[seriesIndex] === 'undefined') w.globals.pointsArray[seriesIndex] = [];
-
- w.globals.pointsArray[seriesIndex].push([p.x[q], p.y[q]]);
- }
- };
-
- for (var q = 0; q < p.x.length; q++) {
- _loop(q);
- }
- }
-
- return elPointsWrap;
- }
- }, {
- key: 'getMarkerConfig',
- value: function getMarkerConfig(cssClass, seriesIndex) {
- var w = this.w;
- var pStyle = this.getMarkerStyle(seriesIndex);
-
- var pSize = w.config.markers.size;
-
- return {
- pSize: pSize instanceof Array ? pSize[seriesIndex] : pSize,
- pRadius: w.config.markers.radius,
- pWidth: w.config.markers.strokeWidth,
- pointStrokeColor: pStyle.pointStrokeColor,
- pointFillColor: pStyle.pointFillColor,
- shape: w.config.markers.shape instanceof Array ? w.config.markers.shape[seriesIndex] : w.config.markers.shape,
- class: cssClass,
- pointStrokeOpacity: w.config.markers.strokeOpacity,
- pointFillOpacity: w.config.markers.fillOpacity,
- seriesIndex: seriesIndex
- };
- }
- }, {
- key: 'addEvents',
- value: function addEvents(circle) {
- var graphics = new _Graphics2.default(this.ctx);
- circle.node.addEventListener('mouseenter', graphics.pathMouseEnter.bind(this.ctx, circle));
- circle.node.addEventListener('mouseleave', graphics.pathMouseLeave.bind(this.ctx, circle));
-
- circle.node.addEventListener('mousedown', graphics.pathMouseDown.bind(this.ctx, circle));
-
- circle.node.addEventListener('touchstart', graphics.pathMouseDown.bind(this.ctx, circle));
- }
- }, {
- key: 'setSelectedPointFilter',
- value: function setSelectedPointFilter(circle, realIndex, realIndexP) {
- var w = this.w;
- if (typeof w.globals.selectedDataPoints[realIndex] !== 'undefined') {
- if (w.globals.selectedDataPoints[realIndex].includes(realIndexP)) {
- circle.node.setAttribute('selected', true);
- var activeFilter = w.config.states.active.filter;
- if (activeFilter !== 'none') {
- var filters = new _Filters2.default(this.ctx);
- filters.applyFilter(circle, activeFilter.type, activeFilter.value);
- }
- }
- }
- }
- }, {
- key: 'getMarkerStyle',
- value: function getMarkerStyle(seriesIndex) {
- var w = this.w;
-
- var colors = w.config.markers.colors;
-
- var pointStrokeColor = w.config.markers.strokeColor;
- var pointFillColor = colors instanceof Array ? colors[seriesIndex] : colors;
-
- return {
- pointStrokeColor: pointStrokeColor, pointFillColor: pointFillColor
- };
- }
- }]);
-
- return Markers;
-}();
-
-module.exports = Markers;
-
-/***/ }),
-/* 35 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-var _YAxis = __webpack_require__(36);
-
-var _YAxis2 = _interopRequireDefault(_YAxis);
-
-var _Formatters = __webpack_require__(22);
-
-var _Formatters2 = _interopRequireDefault(_Formatters);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts XAxis Class for drawing X-Axis.
- *
- * @module XAxis
- **/
-
-var XAxis = function () {
- function XAxis(ctx) {
- _classCallCheck(this, XAxis);
-
- this.ctx = ctx;
- this.w = ctx.w;
-
- var w = this.w;
- this.xaxisLabels = w.globals.labels.slice();
- if (w.globals.timelineLabels.length > 0) {
- // timeline labels are there
- this.xaxisLabels = w.globals.timelineLabels.slice();
- }
- if (w.config.xaxis.position === 'top') {
- this.offY = 0;
- } else {
- this.offY = w.globals.gridHeight + 1;
- }
-
- this.xaxisFontSize = w.config.xaxis.labels.style.fontSize;
- this.xaxisForeColors = w.config.xaxis.labels.style.colors;
-
- // For bars, we will only consider single y xais,
- // as we are not providing multiple yaxis for bar charts
- this.yaxis = w.config.yaxis[0];
- }
-
- _createClass(XAxis, [{
- key: 'drawXaxis',
- value: function drawXaxis() {
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
-
- var elXaxis = graphics.group({
- 'class': 'apexcharts-xaxis'
- });
-
- var elXaxisTexts = graphics.group({
- 'class': 'apexcharts-xaxis-texts-g',
- 'transform': 'translate(' + w.globals.translateXAxisX + ', ' + w.globals.translateXAxisY + ')'
- });
-
- elXaxis.add(elXaxisTexts);
-
- var colWidth = void 0;
-
- // initial x Position (keep adding column width in the loop)
- var xPos = w.globals.padHorizontal;
- var labels = [];
-
- for (var i = 0; i < this.xaxisLabels.length; i++) {
- labels.push(this.xaxisLabels[i]);
- }
-
- if (w.config.chart.type === 'line' || w.config.chart.type === 'area') {
- if (w.globals.dataXY) {
- colWidth = w.globals.gridWidth / (labels.length - 1);
- xPos = xPos + colWidth / 2 + w.config.xaxis.labels.offsetX;
- } else {
- // no dataXY, only y values values and labels not provided
- if (w.globals.noLabelsProvided) {
- colWidth = w.globals.gridWidth / this.xaxisLabels.length;
- } else {
- // labels provided
- colWidth = w.globals.gridWidth / labels.length;
- }
- xPos = xPos + colWidth + w.config.xaxis.labels.offsetX;
- }
- } else {
- if (w.globals.dataXY) {
- if (w.config.chart.type !== 'bar') {
- colWidth = w.globals.gridWidth / (this.xaxisLabels.length - 1);
- xPos = xPos + colWidth / 2 + w.config.xaxis.labels.offsetX;
- } else {
- colWidth = w.globals.gridWidth / w.globals.labels.length;
- xPos = xPos + colWidth / 2 + w.config.xaxis.labels.offsetX;
- }
- } else {
- if (w.globals.noLabelsProvided && w.config.chart.type !== 'bar') {
- colWidth = w.globals.gridWidth / this.xaxisLabels.length;
- xPos = xPos + colWidth / 2 + w.config.xaxis.labels.offsetX;
- } else {
- colWidth = w.globals.gridWidth / labels.length;
- xPos = xPos + colWidth + w.config.xaxis.labels.offsetX;
- }
- }
- }
-
- var xlbFormatter = w.globals.xLabelFormatter;
-
- var labelsLen = labels.length;
-
- if (w.config.xaxis.labels.show) {
- for (var _i = 0; _i <= labelsLen - 1; _i++) {
- var label = typeof labels[_i] === 'undefined' ? '' : labels[_i];
-
- var xFormat = new _Formatters2.default(this.ctx);
- label = xFormat.xLabelFormat(xlbFormatter, label);
-
- var x = xPos - colWidth / 2 + w.config.xaxis.labels.offsetX;
- if (w.globals.timelineLabels.length > 0) {
- x = w.globals.timelineLabels[_i].position;
- label = w.globals.timelineLabels[_i].value;
- }
-
- var offsetYCorrection = 28;
- if (w.globals.rotateXLabels) {
- offsetYCorrection = 22;
- }
- var elTick = graphics.drawText({
- x: x,
- y: this.offY + w.config.xaxis.labels.offsetY + offsetYCorrection,
- text: '',
- textAnchor: 'middle',
- fontSize: this.xaxisFontSize,
- foreColor: this.xaxisForeColors[_i],
- cssClass: 'apexcharts-xaxis-label ' + w.config.xaxis.labels.style.cssClass
- });
-
- elXaxisTexts.add(elTick);
-
- elTick.tspan(label);
-
- var elTooltipTitle = document.createElementNS(w.globals.svgNS, 'title');
- elTooltipTitle.textContent = label;
- elTick.node.appendChild(elTooltipTitle);
-
- // console.log(elText, elTooltipTitle, elTick.node, label, 'xaxis-text')
-
- xPos = xPos + colWidth;
- }
- }
-
- if (w.config.xaxis.title.text !== undefined) {
- var elXaxisTitle = graphics.group({
- class: 'apexcharts-xaxis-title'
- });
-
- var elXAxisTitleText = graphics.drawText({
- x: w.globals.gridWidth / 2 + w.config.xaxis.title.offsetX,
- y: this.offY - parseInt(this.xaxisFontSize) + w.globals.xAxisLabelsHeight + w.config.xaxis.title.offsetY,
- text: w.config.xaxis.title.text,
- textAnchor: 'middle',
- fontSize: w.config.xaxis.title.style.fontSize,
- foreColor: w.config.xaxis.title.style.color,
- cssClass: 'apexcharts-xaxis-title-text ' + w.config.xaxis.title.style.cssClass
- });
-
- elXaxisTitle.add(elXAxisTitleText);
-
- elXaxis.add(elXaxisTitle);
- }
-
- if (w.config.xaxis.axisBorder.show) {
- var lineCorrection = 0;
- if (w.config.chart.type === 'bar' && w.globals.dataXY) {
- lineCorrection = lineCorrection - 15;
- }
- var elHorzLine = graphics.drawLine(w.globals.padHorizontal + lineCorrection + w.config.xaxis.axisBorder.offsetX, this.offY, w.globals.gridWidth, this.offY, w.config.xaxis.axisBorder.color);
-
- elXaxis.add(elHorzLine);
- }
-
- return elXaxis;
- }
-
- // this actually becomes the vertical axis (for bar charts)
-
- }, {
- key: 'drawXaxisInversed',
- value: function drawXaxisInversed(realIndex) {
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
-
- var elYaxis = graphics.group({
- class: 'apexcharts-yaxis apexcharts-xaxis-inversed',
- 'rel': realIndex
- });
-
- var elYaxisTexts = graphics.group({
- class: 'apexcharts-yaxis-texts-g apexcharts-xaxis-inversed-texts-g'
- });
-
- elYaxis.add(elYaxisTexts);
-
- var colHeight = void 0;
-
- // initial x Position (keep adding column width in the loop)
- var yPos = void 0;
- var labels = [];
-
- for (var i = 0; i < this.xaxisLabels.length; i++) {
- labels.push(this.xaxisLabels[i]);
- }
-
- colHeight = w.globals.gridHeight / labels.length;
- yPos = -(colHeight / 2.2);
-
- var lbFormatter = w.config.yaxis[0].labels.formatter;
-
- if (w.config.yaxis[0].labels.show) {
- for (var _i2 = 0; _i2 <= labels.length - 1; _i2++) {
- var label = typeof labels[_i2] === 'undefined' ? '' : labels[_i2];
-
- label = lbFormatter(label);
-
- var elTick = graphics.drawText({
- x: w.config.yaxis[0].labels.offsetX - 15,
- y: yPos + colHeight + w.config.yaxis[0].labels.offsetY,
- text: label,
- textAnchor: 'end',
- foreColor: w.config.yaxis[0].labels.style.colors[_i2],
- fontSize: w.config.yaxis[0].labels.style.fontSize,
- cssClass: 'apexcharts-yaxis-label ' + w.config.yaxis[0].labels.style.cssClass
- });
-
- elYaxisTexts.add(elTick);
- yPos = yPos + colHeight;
- }
- }
-
- if (w.config.yaxis[0].title.text !== undefined) {
- var elXaxisTitle = graphics.group({
- class: 'apexcharts-yaxis-title apexcharts-xaxis-title-inversed'
- });
-
- var elXAxisTitleText = graphics.drawText({
- x: 0,
- y: w.globals.gridHeight / 2,
- text: w.config.yaxis[0].title.text,
- textAnchor: 'middle',
- foreColor: w.config.yaxis[0].title.style.color,
- fontSize: w.config.yaxis[0].title.style.fontSize,
- cssClass: 'apexcharts-yaxis-title-text ' + w.config.yaxis[0].title.style.cssClass
- });
-
- elXaxisTitle.add(elXAxisTitleText);
-
- elYaxis.add(elXaxisTitle);
- }
-
- if (w.config.xaxis.axisBorder.show) {
- var elHorzLine = graphics.drawLine(w.globals.padHorizontal + w.config.xaxis.axisBorder.offsetX, this.offY, w.globals.gridWidth, this.offY, this.yaxis.axisBorder.color);
-
- elYaxis.add(elHorzLine);
-
- // let x = w.globals.yAxisWidths[0] / 2
- // if (w.config.yaxis[0].opposite) {
- // x = -w.globals.yAxisWidths[0] / 2
- // }
-
- var yaxis = new _YAxis2.default(this.ctx);
-
- yaxis.drawAxisTicks(0, labels.length, w.config.yaxis[0].axisBorder, w.config.yaxis[0].axisTicks, 0, colHeight, elYaxis);
- }
-
- return elYaxis;
- }
- }, {
- key: 'drawXaxisTicks',
- value: function drawXaxisTicks(x1, appendToElement) {
- var w = this.w;
- var x2 = x1;
-
- if (x1 < 0 || x1 > w.globals.gridWidth) return;
-
- var y1 = this.offY + w.config.xaxis.axisTicks.offsetY;
- var y2 = y1 + w.config.xaxis.axisTicks.height;
-
- if (w.config.xaxis.axisTicks.show) {
- var graphics = new _Graphics2.default(this.ctx);
-
- var line = graphics.drawLine(x1 + w.config.xaxis.axisTicks.offsetX, y1, x2 + w.config.xaxis.axisTicks.offsetX, y2, w.config.xaxis.axisTicks.color);
-
- // we are not returning anything, but appending directly to the element pased in param
- appendToElement.add(line);
- line.node.classList.add('apexcharts-xaxis-tick');
- }
- }
- }, {
- key: 'getXAxisTicksPositions',
- value: function getXAxisTicksPositions() {
- var w = this.w;
- var xAxisTicksPositions = [];
-
- var xCount = this.xaxisLabels.length;
- var x1 = w.globals.padHorizontal;
-
- if (w.globals.timelineLabels.length > 0) {
- for (var i = 0; i < xCount; i++) {
- x1 = this.xaxisLabels[i].position;
- xAxisTicksPositions.push(x1);
- }
- } else {
- var xCountForCategoryCharts = xCount;
- for (var _i3 = 0; _i3 < xCountForCategoryCharts; _i3++) {
- var x1Count = xCountForCategoryCharts;
- if (w.globals.dataXY && w.config.chart.type !== 'bar') {
- x1Count -= 1;
- }
- x1 = x1 + w.globals.gridWidth / x1Count;
- xAxisTicksPositions.push(x1);
- }
- }
-
- return xAxisTicksPositions;
- }
-
- // to rotate x-axis labels or to put ... for longer text in xaxis
-
- }, {
- key: 'xAxisLabelCorrections',
- value: function xAxisLabelCorrections() {
- var w = this.w;
-
- var graphics = new _Graphics2.default(this.ctx);
-
- var xAxis = w.globals.dom.baseEl.querySelector('.apexcharts-xaxis-texts-g');
-
- var xAxisTexts = w.globals.dom.baseEl.querySelectorAll('.apexcharts-xaxis-texts-g text');
- var yAxisTextsInversed = w.globals.dom.baseEl.querySelectorAll('.apexcharts-yaxis-inversed text');
- var xAxisTextsInversed = w.globals.dom.baseEl.querySelectorAll('.apexcharts-xaxis-inversed-texts-g text');
-
- if (w.globals.rotateXLabels || w.config.xaxis.labels.rotateAlways) {
- for (var xat = 0; xat < xAxisTexts.length; xat++) {
- var textRotatingCenter = graphics.rotateAroundCenter(xAxisTexts[xat]);
- textRotatingCenter.y = textRotatingCenter.y - 1; // + tickWidth/4;
- textRotatingCenter.x = textRotatingCenter.x + 1;
-
- xAxisTexts[xat].setAttribute('transform', 'rotate(' + w.config.xaxis.labels.rotate + ' ' + textRotatingCenter.x + ' ' + textRotatingCenter.y + ')');
-
- xAxisTexts[xat].setAttribute('text-anchor', 'end');
-
- var offsetHeight = 10;
-
- xAxis.setAttribute('transform', 'translate(0, ' + -offsetHeight + ')');
-
- var tSpan = xAxisTexts[xat].childNodes;
-
- if (w.config.xaxis.labels.trim) {
- graphics.placeTextWithEllipsis(tSpan[0], tSpan[0].textContent, w.config.xaxis.labels.maxHeight - 40);
- }
- }
- } else {
- var width = w.globals.gridWidth / w.globals.labels.length;
-
- for (var _xat = 0; _xat < xAxisTexts.length; _xat++) {
- var _tSpan = xAxisTexts[_xat].childNodes;
-
- if (w.config.xaxis.labels.trim && w.config.chart.type !== 'bar' && w.config.plotOptions.bar.horizontal) {
- graphics.placeTextWithEllipsis(_tSpan[0], _tSpan[0].textContent, width);
- }
- }
- }
-
- if (xAxisTexts.length > 0) {
- var firstLabelPos = xAxisTexts[0].getBBox();
- var lastLabelPos = xAxisTexts[xAxisTexts.length - 1].getBBox();
-
- if (firstLabelPos.x < -25) {
- xAxisTexts[0].parentNode.removeChild(xAxisTexts[0]);
- }
-
- if (lastLabelPos.x + lastLabelPos.width > w.globals.gridWidth) {
- xAxisTexts[xAxisTexts.length - 1].parentNode.removeChild(xAxisTexts[xAxisTexts.length - 1]);
- }
- }
-
- if (yAxisTextsInversed.length > 0) {
- // truncate y axis in bar chart
- var firstLabelPosX = yAxisTextsInversed[yAxisTextsInversed.length - 1].getBBox();
- var lastLabelPosX = yAxisTextsInversed[0].getBBox();
-
- if (firstLabelPosX.x < -20) {
- yAxisTextsInversed[yAxisTextsInversed.length - 1].parentNode.removeChild(yAxisTextsInversed[yAxisTextsInversed.length - 1]);
- }
-
- if (lastLabelPosX.x + lastLabelPosX.width > w.globals.gridWidth) {
- yAxisTextsInversed[0].parentNode.removeChild(yAxisTextsInversed[0]);
- }
-
- // truncate y axis in bar chart
- for (var _xat2 = 0; _xat2 < xAxisTextsInversed.length; _xat2++) {
- graphics.placeTextWithEllipsis(xAxisTextsInversed[_xat2], xAxisTextsInversed[_xat2].textContent, w.config.yaxis[0].labels.maxWidth - parseInt(w.config.yaxis[0].title.style.fontSize) * 2 - 20);
- }
- }
- }
-
- // renderXAxisBands() {
- // let w = this.w;
-
- // let plotBand = document.createElementNS(w.globals.svgNS, 'rect')
- // w.globals.dom.elGraphical.add(plotBand)
- // }
-
- }]);
-
- return XAxis;
-}();
-
-module.exports = XAxis;
-
-/***/ }),
-/* 36 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts YAxis Class for drawing Y-Axis.
- *
- * @module YAxis
- **/
-
-var YAxis = function () {
- function YAxis(ctx) {
- _classCallCheck(this, YAxis);
-
- this.ctx = ctx;
- this.w = ctx.w;
-
- this.xaxisFontSize = this.w.config.xaxis.labels.style.fontSize;
- this.isBarHorizontal = !!(this.w.config.chart.type === 'bar' && this.w.config.plotOptions.bar.horizontal);
-
- this.xAxisoffX = 0;
- if (this.w.config.xaxis.position === 'bottom') {
- this.xAxisoffX = this.w.globals.gridHeight;
- }
- }
-
- _createClass(YAxis, [{
- key: 'drawYaxis',
- value: function drawYaxis(xyRatios, realIndex) {
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
-
- var yaxisFontSize = w.config.yaxis[realIndex].labels.style.fontSize;
-
- var elYaxis = graphics.group({
- class: 'apexcharts-yaxis',
- 'rel': realIndex,
- 'transform': 'translate(' + w.globals.translateYAxisX[realIndex] + ', 0)'
- });
-
- var elYaxisTexts = graphics.group({
- 'class': 'apexcharts-yaxis-texts-g'
- });
-
- elYaxis.add(elYaxisTexts);
-
- var tickAmount = w.globals.yAxisScale[realIndex].result.length - 1;
-
- // labelsDivider is simply svg height/number of ticks
- var labelsDivider = w.globals.gridHeight / tickAmount + 0.1;
-
- // initial label position = 0;
- var l = w.globals.translateY;
- var lbFormatter = w.config.yaxis[realIndex].labels.formatter;
-
- if (w.config.yaxis[realIndex].labels.show) {
- for (var i = tickAmount; i >= 0; i--) {
- var val = w.globals.yAxisScale[realIndex].result[i];
-
- val = lbFormatter(val);
- var xPad = 20;
- if (w.config.yaxis[realIndex].opposite) {
- xPad = xPad * -1;
- }
-
- if (w.config.yaxis.length === 0) {
- xPad = 20;
- }
-
- var label = graphics.drawText({
- x: xPad,
- y: l + tickAmount / 10 + w.config.yaxis[realIndex].labels.offsetY + 1,
- text: val,
- textAnchor: w.config.yaxis[realIndex].opposite ? 'start' : 'end',
- fontSize: yaxisFontSize,
- foreColor: w.config.yaxis[realIndex].labels.style.color,
- cssClass: 'apexcharts-yaxis-label ' + w.config.yaxis[realIndex].labels.style.cssClass
- });
- elYaxisTexts.add(label);
- l = l + labelsDivider;
- }
- }
-
- if (w.config.yaxis[realIndex].title.text !== undefined) {
- var elYaxisTitle = graphics.group({
- 'class': 'apexcharts-yaxis-title'
- });
-
- var x = 0;
- if (w.config.yaxis[realIndex].opposite) {
- x = w.globals.translateYAxisX[realIndex];
- }
- var elYAxisTitleText = graphics.drawText({
- x: x,
- y: w.globals.gridHeight / 2 + w.globals.translateY,
- text: w.config.yaxis[realIndex].title.text,
- textAnchor: 'end',
- foreColor: w.config.yaxis[realIndex].labels.style.color,
- fontSize: w.config.yaxis[realIndex].title.style.fontSize,
- cssClass: 'apexcharts-yaxis-title-text ' + w.config.yaxis[realIndex].title.style.cssClass
- });
-
- elYaxisTitle.add(elYAxisTitleText);
-
- elYaxis.add(elYaxisTitle);
- }
-
- var axisBorder = w.config.yaxis[realIndex].axisBorder;
- if (axisBorder.show) {
- var _x = 31 + axisBorder.offsetX;
- if (w.config.yaxis[realIndex].opposite) {
- _x = -31 - axisBorder.offsetX;
- }
-
- var elVerticalLine = graphics.drawLine(_x, w.globals.translateY + axisBorder.offsetY - 2, _x, w.globals.gridHeight + w.globals.translateY + axisBorder.offsetY + 2, axisBorder.color);
-
- elYaxis.add(elVerticalLine);
-
- this.drawAxisTicks(_x, tickAmount, axisBorder, w.config.yaxis[realIndex].axisTicks, realIndex, labelsDivider, elYaxis);
- }
-
- return elYaxis;
- }
-
- // This actually becomes horizonal axis (for bar charts)
-
- }, {
- key: 'drawYaxisInversed',
- value: function drawYaxisInversed(realIndex) {
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
-
- var elXaxis = graphics.group({
- 'class': 'apexcharts-xaxis apexcharts-yaxis-inversed'
- });
-
- var elXaxisTexts = graphics.group({
- 'class': 'apexcharts-xaxis-texts-g',
- 'transform': 'translate(' + w.globals.translateXAxisX + ', ' + w.globals.translateXAxisY + ')'
- });
-
- elXaxis.add(elXaxisTexts);
-
- var tickAmount = w.globals.yAxisScale[realIndex].result.length - 1;
-
- // labelsDivider is simply svg width/number of ticks
- var labelsDivider = w.globals.gridWidth / tickAmount + 0.1;
-
- // initial label position;
- var l = labelsDivider + w.config.xaxis.labels.offsetX;
- var lbFormatter = w.globals.xLabelFormatter;
-
- if (w.config.xaxis.labels.show) {
- for (var i = tickAmount; i >= 0; i--) {
- var val = w.globals.yAxisScale[realIndex].result[i];
- val = lbFormatter(val);
-
- var elTick = graphics.drawText({
- x: w.globals.gridWidth + w.globals.padHorizontal - (l - labelsDivider + w.config.xaxis.labels.offsetX),
- y: this.xAxisoffX + w.config.xaxis.labels.offsetY + 30,
- text: '',
- textAnchor: 'middle',
- fontSize: this.xaxisFontSize,
- cssClass: 'apexcharts-xaxis-label ' + w.config.xaxis.labels.style.cssClass
- });
-
- elXaxisTexts.add(elTick);
-
- elTick.tspan(val);
-
- var elTooltipTitle = document.createElementNS(w.globals.svgNS, 'title');
- elTooltipTitle.textContent = val;
- elTick.node.appendChild(elTooltipTitle);
-
- l = l + labelsDivider;
- }
- }
-
- if (w.config.xaxis.title.text !== undefined) {
- var elYaxisTitle = graphics.group({
- 'class': 'apexcharts-xaxis-title apexcharts-yaxis-title-inversed'
- });
-
- var elYAxisTitleText = graphics.drawText({
- x: w.globals.gridWidth / 2,
- y: this.xAxisoffX + parseInt(this.xaxisFontSize) + parseInt(w.config.xaxis.title.style.fontSize) + 20,
- text: w.config.xaxis.title.text,
- textAnchor: 'middle',
- fontSize: w.config.xaxis.title.style.fontSize,
- cssClass: 'apexcharts-xaxis-title-text ' + w.config.xaxis.title.style.cssClass
- });
-
- elYaxisTitle.add(elYAxisTitleText);
-
- elXaxis.add(elYaxisTitle);
- }
-
- var axisBorder = w.config.yaxis[realIndex].axisBorder;
- if (axisBorder.show) {
- var elVerticalLine = graphics.drawLine(w.globals.padHorizontal + axisBorder.offsetX, 1 + axisBorder.offsetY, w.globals.padHorizontal + axisBorder.offsetX, w.globals.gridHeight + axisBorder.offsetY, axisBorder.color);
-
- elXaxis.add(elVerticalLine);
- }
-
- return elXaxis;
- }
- }, {
- key: 'drawAxisTicks',
- value: function drawAxisTicks(x, tickAmount, axisBorder, axisTicks, realIndex, labelsDivider, elYaxis) {
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
-
- // initial label position = 0;
- var t = w.globals.translateY;
-
- if (axisTicks.show) {
- if (w.config.yaxis[realIndex].opposite === true) x = x + axisTicks.width;
-
- for (var i = tickAmount; i >= 0; i--) {
- var tY = t + tickAmount / 10 + w.config.yaxis[realIndex].labels.offsetY - 1;
- if (this.isBarHorizontal) {
- tY = labelsDivider * i;
- }
- var elTick = graphics.drawLine(x + axisBorder.offsetX - axisTicks.width + axisTicks.offsetX, tY + axisTicks.offsetY, x + axisBorder.offsetX + axisTicks.offsetX, tY + axisTicks.offsetY, axisBorder.color);
- elYaxis.add(elTick);
- t = t + labelsDivider;
- }
- }
- }
- }, {
- key: 'yAxisTitleRotate',
- value: function yAxisTitleRotate(realIndex, yAxisOpposite) {
- var w = this.w;
-
- var graphics = new _Graphics2.default(this.ctx);
-
- var yAxisLabelsCoord = {
- width: 0,
- height: 0
- };
- var yAxisTitleCoord = {
- width: 0,
- height: 0
- };
-
- var elYAxisLabelsWrap = w.globals.dom.baseEl.querySelector(' .apexcharts-yaxis[rel=\'' + realIndex + '\'] .apexcharts-yaxis-texts-g');
-
- if (elYAxisLabelsWrap !== null) {
- yAxisLabelsCoord = elYAxisLabelsWrap.getBoundingClientRect();
- }
-
- var yAxisTitle = w.globals.dom.baseEl.querySelector('.apexcharts-yaxis[rel=\'' + realIndex + '\'] .apexcharts-yaxis-title text');
-
- if (yAxisTitle !== null) {
- yAxisTitleCoord = yAxisTitle.getBoundingClientRect();
- }
-
- if (yAxisTitle !== null) {
- var x = this.xPaddingForYAxisTitle(realIndex, yAxisLabelsCoord, yAxisTitleCoord, yAxisOpposite);
-
- yAxisTitle.setAttribute('x', x.xPos);
- }
-
- if (yAxisTitle !== null) {
- var titleRotatingCenter = graphics.rotateAroundCenter(yAxisTitle);
- if (!yAxisOpposite) {
- yAxisTitle.setAttribute('transform', 'rotate(-90 ' + titleRotatingCenter.x + ' ' + titleRotatingCenter.y + ')');
- } else {
- yAxisTitle.setAttribute('transform', 'rotate(90 ' + titleRotatingCenter.x + ' ' + titleRotatingCenter.y + ')');
- }
- }
- }
- }, {
- key: 'xPaddingForYAxisTitle',
- value: function xPaddingForYAxisTitle(realIndex, yAxisLabelsCoord, yAxisTitleCoord, yAxisOpposite) {
- var w = this.w;
- var oppositeAxisCount = 0;
-
- var x = 0;
- var padd = 20;
- if (yAxisOpposite) {
- x = yAxisLabelsCoord.width + w.config.yaxis[realIndex].title.offsetX + padd + yAxisTitleCoord.width / 2 - 15;
-
- if (oppositeAxisCount === 0) {
- x = x - 15;
- }
- oppositeAxisCount += 1;
- } else {
- x = yAxisLabelsCoord.width * -1 + w.config.yaxis[realIndex].title.offsetX + padd + yAxisTitleCoord.width / 2 - 15;
-
- if (this.isBarHorizontal) {
- padd = 25;
- x = yAxisLabelsCoord.width * -1 - w.config.yaxis[realIndex].title.offsetX - padd;
- }
- }
-
- return { xPos: x, padd: padd };
- }
- }]);
-
- return YAxis;
-}();
-
-module.exports = YAxis;
-
-/***/ }),
-/* 37 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _TimeScale = __webpack_require__(55);
-
-var _TimeScale2 = _interopRequireDefault(_TimeScale);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * DateTime Class to manipulate datetime values.
- *
- * @module DateTime
- **/
-
-var DateTime = function () {
- function DateTime(ctx) {
- _classCallCheck(this, DateTime);
-
- this.ctx = ctx;
- this.w = ctx.w;
-
- this.months31 = [1, 3, 5, 7, 8, 10, 12];
- this.months30 = [2, 4, 6, 9, 11];
-
- this.daysCntOfYear = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
-
- this.MMMM = ['\x00', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
- }
-
- _createClass(DateTime, [{
- key: 'isValidDate',
- value: function isValidDate(date) {
- return !isNaN(Date.parse(date));
- }
-
- // https://stackoverflow.com/a/11252167/6495043
-
- }, {
- key: 'treatAsUtc',
- value: function treatAsUtc(dateStr) {
- var result = new Date(dateStr);
- result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
- return result;
- }
-
- // http://stackoverflow.com/questions/14638018/current-time-formatting-with-javascript#answer-14638191
-
- }, {
- key: 'formatDate',
- value: function formatDate(date, format) {
- var utc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
-
- var MMMM = ['\x00', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
- var MMM = ['\x01', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
- var dddd = ['\x02', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
- var ddd = ['\x03', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
-
- function ii(i, len) {
- var s = i + '';
- len = len || 2;
- while (s.length < len) {
- s = '0' + s;
- }return s;
- }
-
- date = this.treatAsUtc(date);
-
- var y = utc ? date.getUTCFullYear() : date.getFullYear();
- format = format.replace(/(^|[^\\])yyyy+/g, '$1' + y);
- format = format.replace(/(^|[^\\])yy/g, '$1' + y.toString().substr(2, 2));
- format = format.replace(/(^|[^\\])y/g, '$1' + y);
-
- var M = (utc ? date.getUTCMonth() : date.getMonth()) + 1;
- format = format.replace(/(^|[^\\])MMMM+/g, '$1' + MMMM[0]);
- format = format.replace(/(^|[^\\])MMM/g, '$1' + MMM[0]);
- format = format.replace(/(^|[^\\])MM/g, '$1' + ii(M));
- format = format.replace(/(^|[^\\])M/g, '$1' + M);
-
- var d = utc ? date.getUTCDate() : date.getDate();
- format = format.replace(/(^|[^\\])dddd+/g, '$1' + dddd[0]);
- format = format.replace(/(^|[^\\])ddd/g, '$1' + ddd[0]);
- format = format.replace(/(^|[^\\])dd/g, '$1' + ii(d));
- format = format.replace(/(^|[^\\])d/g, '$1' + d);
-
- var H = utc ? date.getUTCHours() : date.getHours();
- format = format.replace(/(^|[^\\])HH+/g, '$1' + ii(H));
- format = format.replace(/(^|[^\\])H/g, '$1' + H);
-
- var h = H > 12 ? H - 12 : H === 0 ? 12 : H;
- format = format.replace(/(^|[^\\])hh+/g, '$1' + ii(h));
- format = format.replace(/(^|[^\\])h/g, '$1' + h);
-
- var m = utc ? date.getUTCMinutes() : date.getMinutes();
- format = format.replace(/(^|[^\\])mm+/g, '$1' + ii(m));
- format = format.replace(/(^|[^\\])m/g, '$1' + m);
-
- var s = utc ? date.getUTCSeconds() : date.getSeconds();
- format = format.replace(/(^|[^\\])ss+/g, '$1' + ii(s));
- format = format.replace(/(^|[^\\])s/g, '$1' + s);
-
- var f = utc ? date.getUTCMilliseconds() : date.getMilliseconds();
- format = format.replace(/(^|[^\\])fff+/g, '$1' + ii(f, 3));
- f = Math.round(f / 10);
- format = format.replace(/(^|[^\\])ff/g, '$1' + ii(f));
- f = Math.round(f / 10);
- format = format.replace(/(^|[^\\])f/g, '$1' + f);
-
- var T = H < 12 ? 'AM' : 'PM';
- format = format.replace(/(^|[^\\])TT+/g, '$1' + T);
- format = format.replace(/(^|[^\\])T/g, '$1' + T.charAt(0));
-
- var t = T.toLowerCase();
- format = format.replace(/(^|[^\\])tt+/g, '$1' + t);
- format = format.replace(/(^|[^\\])t/g, '$1' + t.charAt(0));
-
- var tz = -date.getTimezoneOffset();
- var K = utc || !tz ? 'Z' : tz > 0 ? '+' : '-';
- if (!utc) {
- tz = Math.abs(tz);
- var tzHrs = Math.floor(tz / 60);
- var tzMin = tz % 60;
- K += ii(tzHrs) + ':' + ii(tzMin);
- }
- format = format.replace(/(^|[^\\])K/g, '$1' + K);
-
- var day = (utc ? date.getUTCDay() : date.getDay()) + 1;
- format = format.replace(new RegExp(dddd[0], 'g'), dddd[day]);
- format = format.replace(new RegExp(ddd[0], 'g'), ddd[day]);
-
- format = format.replace(new RegExp(MMMM[0], 'g'), MMMM[M]);
- format = format.replace(new RegExp(MMM[0], 'g'), MMM[M]);
-
- format = format.replace(/\\(.)/g, '$1');
-
- return format;
- }
- }, {
- key: 'getTimeUnitsfromTimestamp',
- value: function getTimeUnitsfromTimestamp(minX, maxX) {
- var w = this.w;
-
- if (w.config.xaxis.min !== undefined) {
- minX = w.config.xaxis.min;
- }
- if (w.config.xaxis.max !== undefined) {
- maxX = w.config.xaxis.max;
- }
-
- var minYear = new Date(minX).getFullYear();
- var maxYear = new Date(maxX).getFullYear();
-
- var minMonth = new Date(minX).getMonth();
- var maxMonth = new Date(maxX).getMonth();
-
- var minDate = new Date(minX).getDate();
- var maxDate = new Date(maxX).getDate();
-
- var minHour = new Date(minX).getHours();
- var maxHour = new Date(maxX).getHours();
-
- var minMinute = new Date(minX).getMinutes();
- var maxMinute = new Date(maxX).getMinutes();
-
- return {
- minMinute: minMinute, maxMinute: maxMinute, minHour: minHour, maxHour: maxHour, minDate: minDate, maxDate: maxDate, minMonth: minMonth, maxMonth: maxMonth, minYear: minYear, maxYear: maxYear
- };
- }
- }, {
- key: 'isLeapYear',
- value: function isLeapYear(year) {
- return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
- }
- }, {
- key: 'calculcateLastDaysOfMonth',
- value: function calculcateLastDaysOfMonth(month, year, subtract) {
- var days = this.determineDaysOfMonths(month, year);
-
- // whatever days we get, subtract the number of days asked
- return days - subtract;
- }
- }, {
- key: 'determineDaysOfYear',
- value: function determineDaysOfYear(year) {
- var days = 365;
-
- if (this.isLeapYear(year)) {
- days = 366;
- }
-
- return days;
- }
- }, {
- key: 'determineRemainingDaysOfYear',
- value: function determineRemainingDaysOfYear(year, month, date) {
- var dayOfYear = this.daysCntOfYear[month] + date;
- if (month > 1 && this.isLeapYear()) dayOfYear++;
- return dayOfYear;
- }
- }, {
- key: 'determineDaysOfMonths',
- value: function determineDaysOfMonths(month, year) {
- var days = 30;
-
- var ts = new _TimeScale2.default(this.ctx);
- month = ts.monthMod(month);
-
- switch (true) {
- case this.months30.includes(month):
- if (month === 2) {
- if (this.isLeapYear(year)) {
- days = 29;
- } else {
- days = 28;
- }
- }
-
- break;
-
- case this.months31.includes(month):
- days = 31;
- break;
-
- default:
- days = 31;
- break;
- }
-
- return days;
- }
- }]);
-
- return DateTime;
-}();
-
-exports.default = DateTime;
-
-/***/ }),
-/* 38 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// 22.1.3.31 Array.prototype[@@unscopables]
-var UNSCOPABLES = __webpack_require__(3)('unscopables');
-var ArrayProto = Array.prototype;
-if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(7)(ArrayProto, UNSCOPABLES, {});
-module.exports = function (key) {
- ArrayProto[UNSCOPABLES][key] = true;
-};
-
-/***/ }),
-/* 39 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// false -> Array#indexOf
-// true -> Array#includes
-var toIObject = __webpack_require__(31);
-var toLength = __webpack_require__(51);
-var toAbsoluteIndex = __webpack_require__(84);
-module.exports = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIObject($this);
- var length = toLength(O.length);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (; length > index; index++) {
- if (IS_INCLUDES || index in O) {
- if (O[index] === el) return IS_INCLUDES || index || 0;
- }
- }return !IS_INCLUDES && -1;
- };
-};
-
-/***/ }),
-/* 40 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// IE 8- don't enum bug keys
-module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');
-
-/***/ }),
-/* 41 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-module.exports = function (exec) {
- try {
- return !!exec();
- } catch (e) {
- return true;
- }
-};
-
-/***/ }),
-/* 42 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var document = __webpack_require__(2).document;
-module.exports = document && document.documentElement;
-
-/***/ }),
-/* 43 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var LIBRARY = __webpack_require__(26);
-var $export = __webpack_require__(10);
-var redefine = __webpack_require__(13);
-var hide = __webpack_require__(7);
-var Iterators = __webpack_require__(12);
-var $iterCreate = __webpack_require__(73);
-var setToStringTag = __webpack_require__(28);
-var getPrototypeOf = __webpack_require__(79);
-var ITERATOR = __webpack_require__(3)('iterator');
-var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
-var FF_ITERATOR = '@@iterator';
-var KEYS = 'keys';
-var VALUES = 'values';
-
-var returnThis = function returnThis() {
- return this;
-};
-
-module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
- $iterCreate(Constructor, NAME, next);
- var getMethod = function getMethod(kind) {
- if (!BUGGY && kind in proto) return proto[kind];
- switch (kind) {
- case KEYS:
- return function keys() {
- return new Constructor(this, kind);
- };
- case VALUES:
- return function values() {
- return new Constructor(this, kind);
- };
- }return function entries() {
- return new Constructor(this, kind);
- };
- };
- var TAG = NAME + ' Iterator';
- var DEF_VALUES = DEFAULT == VALUES;
- var VALUES_BUG = false;
- var proto = Base.prototype;
- var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
- var $default = $native || getMethod(DEFAULT);
- var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
- var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
- var methods, key, IteratorPrototype;
- // Fix native
- if ($anyNative) {
- IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
- if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
- // Set @@toStringTag to native iterators
- setToStringTag(IteratorPrototype, TAG, true);
- // fix for some old engines
- if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
- }
- }
- // fix Array#{values, @@iterator}.name in V8 / FF
- if (DEF_VALUES && $native && $native.name !== VALUES) {
- VALUES_BUG = true;
- $default = function values() {
- return $native.call(this);
- };
- }
- // Define iterator
- if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
- hide(proto, ITERATOR, $default);
- }
- // Plug for library
- Iterators[NAME] = $default;
- Iterators[TAG] = returnThis;
- if (DEFAULT) {
- methods = {
- values: DEF_VALUES ? $default : getMethod(VALUES),
- keys: IS_SET ? $default : getMethod(KEYS),
- entries: $entries
- };
- if (FORCED) for (key in methods) {
- if (!(key in proto)) redefine(proto, key, methods[key]);
- } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
- }
- return methods;
-};
-
-/***/ }),
-/* 44 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// 19.1.2.14 / 15.2.3.14 Object.keys(O)
-var $keys = __webpack_require__(80);
-var enumBugKeys = __webpack_require__(40);
-
-module.exports = Object.keys || function keys(O) {
- return $keys(O, enumBugKeys);
-};
-
-/***/ }),
-/* 45 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-module.exports = function (exec) {
- try {
- return { e: false, v: exec() };
- } catch (e) {
- return { e: true, v: e };
- }
-};
-
-/***/ }),
-/* 46 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var anObject = __webpack_require__(6);
-var isObject = __webpack_require__(11);
-var newPromiseCapability = __webpack_require__(27);
-
-module.exports = function (C, x) {
- anObject(C);
- if (isObject(x) && x.constructor === C) return x;
- var promiseCapability = newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
-};
-
-/***/ }),
-/* 47 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
-};
-
-/***/ }),
-/* 48 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var core = __webpack_require__(5);
-var global = __webpack_require__(2);
-var SHARED = '__core-js_shared__';
-var store = global[SHARED] || (global[SHARED] = {});
-
-(module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
-})('versions', []).push({
- version: core.version,
- mode: __webpack_require__(26) ? 'pure' : 'global',
- copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
-});
-
-/***/ }),
-/* 49 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// 7.3.20 SpeciesConstructor(O, defaultConstructor)
-var anObject = __webpack_require__(6);
-var aFunction = __webpack_require__(16);
-var SPECIES = __webpack_require__(3)('species');
-module.exports = function (O, D) {
- var C = anObject(O).constructor;
- var S;
- return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
-};
-
-/***/ }),
-/* 50 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var ctx = __webpack_require__(18);
-var invoke = __webpack_require__(69);
-var html = __webpack_require__(42);
-var cel = __webpack_require__(25);
-var global = __webpack_require__(2);
-var process = global.process;
-var setTask = global.setImmediate;
-var clearTask = global.clearImmediate;
-var MessageChannel = global.MessageChannel;
-var Dispatch = global.Dispatch;
-var counter = 0;
-var queue = {};
-var ONREADYSTATECHANGE = 'onreadystatechange';
-var defer, channel, port;
-var run = function run() {
- var id = +this;
- // eslint-disable-next-line no-prototype-builtins
- if (queue.hasOwnProperty(id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
-};
-var listener = function listener(event) {
- run.call(event.data);
-};
-// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
-if (!setTask || !clearTask) {
- setTask = function setImmediate(fn) {
- var args = [];
- var i = 1;
- while (arguments.length > i) {
- args.push(arguments[i++]);
- }queue[++counter] = function () {
- // eslint-disable-next-line no-new-func
- invoke(typeof fn == 'function' ? fn : Function(fn), args);
- };
- defer(counter);
- return counter;
- };
- clearTask = function clearImmediate(id) {
- delete queue[id];
- };
- // Node.js 0.8-
- if (__webpack_require__(17)(process) == 'process') {
- defer = function defer(id) {
- process.nextTick(ctx(run, id, 1));
- };
- // Sphere (JS game engine) Dispatch API
- } else if (Dispatch && Dispatch.now) {
- defer = function defer(id) {
- Dispatch.now(ctx(run, id, 1));
- };
- // Browsers with MessageChannel, includes WebWorkers
- } else if (MessageChannel) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = ctx(port.postMessage, port, 1);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
- defer = function defer(id) {
- global.postMessage(id + '', '*');
- };
- global.addEventListener('message', listener, false);
- // IE8-
- } else if (ONREADYSTATECHANGE in cel('script')) {
- defer = function defer(id) {
- html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
- html.removeChild(this);
- run.call(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function defer(id) {
- setTimeout(ctx(run, id, 1), 0);
- };
- }
-}
-module.exports = {
- set: setTask,
- clear: clearTask
-};
-
-/***/ }),
-/* 51 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-// 7.1.15 ToLength
-var toInteger = __webpack_require__(30);
-var min = Math.min;
-module.exports = function (it) {
- return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
-};
-
-/***/ }),
-/* 52 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Fill = __webpack_require__(8);
-
-var _Fill2 = _interopRequireDefault(_Fill);
-
-var _Filters = __webpack_require__(4);
-
-var _Filters2 = _interopRequireDefault(_Filters);
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-var _DataLabels = __webpack_require__(33);
-
-var _DataLabels2 = _interopRequireDefault(_DataLabels);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Bar Class responsible for drawing both Columns and Bars.
- *
- * @module Bar
- **/
-
-var Bar = function () {
- function Bar(ctx, xyRatios) {
- _classCallCheck(this, Bar);
-
- this.ctx = ctx;
- this.w = ctx.w;
- var w = this.w;
- this.barOptions = w.config.plotOptions.bar;
-
- this.xRatio = xyRatios.xRatio;
- this.yRatio = xyRatios.yRatio;
- this.invertedXRatio = xyRatios.invertedXRatio;
- this.invertedYRatio = xyRatios.invertedYRatio;
- this.baseLineY = xyRatios.baseLineY;
- this.baseLineInvertedY = xyRatios.baseLineInvertedY;
- this.isHorizontal = this.barOptions.horizontal;
- this.strokeWidth = w.config.stroke.width;
- this.isNullValue = false;
-
- this.xyRatios = xyRatios;
- this.yaxisIndex = 0;
-
- this.seriesLen = 0;
- }
-
- /** primary draw method which is called on bar object
- * @memberof Bar
- * @param {array} series - user supplied series values
- * @param {int} seriesIndex - the index by which series will be drawn on the svg
- * @return {node} element which is supplied to parent chart draw method for appending
- **/
-
-
- _createClass(Bar, [{
- key: 'draw',
- value: function draw(series, seriesIndex) {
- var _this = this;
-
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
- var fill = new _Fill2.default(this.ctx);
-
- this.series = series;
- this.totalItems = 0;
- this.seriesLen = 0;
- this.visibleI = -1;
-
- for (var sl = 0; sl < series.length; sl++) {
- if (series[sl].length > 0) {
- this.seriesLen = this.seriesLen + 1;
- this.totalItems += series[sl].length;
- }
- }
-
- if (this.seriesLen === 0) {
- // A small adjustment when combo charts are used
- this.seriesLen = 1;
- }
-
- var ret = graphics.group({
- class: 'apexcharts-bar-series apexcharts-plot-series'
- });
-
- ret.attr('clip-path', 'url(#gridRectMask' + w.globals.cuid + ')');
-
- var _loop = function _loop(i, bc) {
- var pathTo = void 0,
- pathFrom = void 0;
- var x = void 0,
- y = void 0,
- xDivision = void 0,
- // xDivision is the GRIDWIDTH divided by number of datapoints (columns)
- yDivision = void 0,
- // yDivision is the GRIDHEIGHT divided by number of datapoints (bars)
- zeroH = void 0,
- // zeroH is the baseline where 0 meets y axis
- zeroW = void 0; // zeroW is the baseline where 0 meets x axis
-
- var yArrj = []; // hold y values of current iterating series
- var xArrj = []; // hold x values of current iterating series
-
- var realIndex = w.globals.comboCharts ? seriesIndex[i] : i;
-
- // el to which series will be drawn
- var elSeries = graphics.group({
- class: 'apexcharts-series',
- 'rel': i + 1,
- 'data:realIndex': realIndex
- });
-
- if (series[i].length > 0) {
- _this.visibleI = _this.visibleI + 1;
- }
-
- var strokeWidth = 0;
- var barHeight = 0;
- var barWidth = 0;
-
- if (_this.yRatio.length > 1) {
- _this.yaxisIndex = realIndex;
- }
-
- var initPositions = _this.initialPositions();
-
- y = initPositions.y;
- barHeight = initPositions.barHeight;
- yDivision = initPositions.yDivision;
- zeroW = initPositions.zeroW;
-
- x = initPositions.x;
- barWidth = initPositions.barWidth;
- xDivision = initPositions.xDivision;
- zeroH = initPositions.zeroH;
-
- if (!_this.horizontal) {
- xArrj.push(x + barWidth / 2);
- }
-
- // eldatalabels
- var elDataLabelsWrap = graphics.group({
- class: 'apexcharts-datalabels'
- });
-
- var _loop2 = function _loop2(j, tj) {
- if (typeof _this.series[i][j] === 'undefined' || series[i][j] === null) {
- _this.isNullValue = true;
- } else {
- _this.isNullValue = false;
- }
- if (w.config.stroke.show) {
- if (_this.isNullValue) {
- strokeWidth = 0;
- } else {
- strokeWidth = Array.isArray(_this.strokeWidth) ? _this.strokeWidth[realIndex] : _this.strokeWidth;
- }
- }
-
- var paths = null;
- if (_this.isHorizontal) {
- paths = _this.drawBarPaths({
- indexes: { i: i, j: j, realIndex: realIndex, bc: bc },
- barHeight: barHeight,
- strokeWidth: strokeWidth,
- pathTo: pathTo,
- pathFrom: pathFrom,
- zeroW: zeroW,
- x: x,
- y: y,
- yDivision: yDivision,
- elSeries: elSeries
- });
- } else {
- paths = _this.drawColumnPaths({
- indexes: { i: i, j: j, realIndex: realIndex, bc: bc },
- x: x,
- y: y,
- xDivision: xDivision,
- pathTo: pathTo,
- pathFrom: pathFrom,
- barWidth: barWidth,
- zeroH: zeroH,
- strokeWidth: strokeWidth,
- elSeries: elSeries
- });
- }
-
- pathTo = paths.pathTo;
- pathFrom = paths.pathFrom;
- y = paths.y;
- x = paths.x;
-
- // push current X
- if (j > 0) {
- xArrj.push(x + barWidth / 2);
- }
-
- yArrj.push(y);
-
- var seriesNumber = _this.barOptions.distributed ? j : i;
-
- var fillColor = null;
-
- if (_this.barOptions.colors.ranges.length > 0) {
- var colorRange = _this.barOptions.colors.ranges;
- colorRange.map(function (range, index) {
- if (series[i][j] >= range.from && series[i][j] <= range.to) {
- fillColor = range.color;
- }
- });
- }
-
- var pathFill = fill.fillPath(elSeries, {
- seriesNumber: _this.barOptions.distributed ? seriesNumber : realIndex,
- color: fillColor
- });
-
- var lineFill = w.config.stroke.colors[realIndex];
-
- if (_this.isNullValue) {
- pathFill = 'none';
- }
-
- var delay = j / w.config.chart.animations.animateGradually.delay * (w.config.chart.animations.speed / w.globals.dataPoints) / 2.4;
-
- var renderedPath = graphics.renderPaths({
- i: i,
- realIndex: realIndex,
- pathFrom: pathFrom,
- pathTo: pathTo,
- stroke: lineFill,
- strokeWidth: strokeWidth,
- fill: pathFill,
- animationDelay: delay,
- initialSpeed: w.config.chart.animations.speed,
- dataChangeSpeed: w.config.chart.animations.dynamicAnimation.speed,
- className: 'apexcharts-bar-area',
- id: 'apexcharts-bar-area'
- });
-
- _this.setSelectedBarFilter(renderedPath, realIndex, j);
-
- elSeries.add(renderedPath);
-
- var dataLabels = _this.calculateBarDataLabels({ x: x, y: y, i: i, j: j, series: series, realIndex: realIndex, barHeight: barHeight, barWidth: barWidth, renderedPath: renderedPath, visibleSeries: _this.visibleI });
-
- if (dataLabels !== null) {
- elDataLabelsWrap.add(dataLabels);
- }
-
- elSeries.add(elDataLabelsWrap);
- };
-
- for (var j = 0, tj = w.globals.dataPoints; j < w.globals.dataPoints; j++, tj--) {
- _loop2(j, tj);
- }
-
- // push all x val arrays into main xArr
- w.globals.seriesXvalues[realIndex] = xArrj;
- w.globals.seriesYvalues[realIndex] = yArrj;
-
- ret.add(elSeries);
- };
-
- for (var i = 0, bc = 0; i < series.length; i++, bc++) {
- _loop(i, bc);
- }
-
- return ret;
- }
- }, {
- key: 'initialPositions',
- value: function initialPositions() {
- var w = this.w;
- var x = void 0,
- y = void 0,
- yDivision = void 0,
- xDivision = void 0,
- barHeight = void 0,
- barWidth = void 0,
- zeroH = void 0,
- zeroW = void 0;
- if (this.isHorizontal) {
- // height divided into equal parts
- yDivision = w.globals.gridHeight / w.globals.dataPoints;
- barHeight = yDivision / this.seriesLen;
-
- if (w.globals.dataXY) {
- yDivision = w.globals.gridHeight / this.totalItems;
- barHeight = yDivision / this.seriesLen;
- }
-
- barHeight = barHeight * parseInt(this.barOptions.barHeight) / 100;
-
- zeroW = this.baseLineInvertedY + w.globals.padHorizontal;
-
- y = (yDivision - barHeight * this.seriesLen) / 2;
- } else {
- // width divided into equal parts
- xDivision = w.globals.gridWidth / w.globals.dataPoints;
- barWidth = xDivision / this.seriesLen;
-
- if (w.globals.dataXY) {
- xDivision = w.globals.gridWidth / (this.totalItems / 2);
- barWidth = xDivision / (this.seriesLen + 1) * (parseInt(this.barOptions.columnWidth) / 100);
- } else {
- barWidth = barWidth * parseInt(this.barOptions.columnWidth) / 100;
- }
-
- zeroH = w.globals.gridHeight - this.baseLineY[this.yaxisIndex];
-
- x = w.globals.padHorizontal + (xDivision - barWidth * this.seriesLen) / 2;
- }
-
- return {
- x: x, y: y, yDivision: yDivision, xDivision: xDivision, barHeight: barHeight, barWidth: barWidth, zeroH: zeroH, zeroW: zeroW
- };
- }
- }, {
- key: 'drawBarPaths',
- value: function drawBarPaths(_ref) {
- var indexes = _ref.indexes,
- barHeight = _ref.barHeight,
- strokeWidth = _ref.strokeWidth,
- pathTo = _ref.pathTo,
- pathFrom = _ref.pathFrom,
- zeroW = _ref.zeroW,
- x = _ref.x,
- y = _ref.y,
- yDivision = _ref.yDivision,
- elSeries = _ref.elSeries;
-
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
-
- var i = indexes.i;
- var j = indexes.j;
- var realIndex = indexes.realIndex;
- var bc = indexes.bc;
-
- if (w.globals.dataXY) {
- y = (w.globals.seriesX[i][j] - w.globals.minX) / this.invertedXRatio - barHeight;
- }
-
- var barYPosition = y + barHeight * this.visibleI;
-
- pathTo = graphics.move(zeroW, barYPosition);
-
- pathFrom = graphics.move(zeroW, barYPosition);
- if (w.globals.previousPaths.length > 0) {
- pathFrom = this.getPathFrom(realIndex, j, true);
- }
-
- if (typeof this.series[i][j] === 'undefined' || this.series[i][j] === null) {
- x = zeroW;
- } else {
- x = zeroW + this.series[i][j] / this.invertedYRatio;
- }
-
- var endingShapeOpts = {
- barHeight: barHeight,
- strokeWidth: strokeWidth,
- barYPosition: barYPosition,
- x: x,
- zeroW: zeroW
- };
- var endingShape = this.barEndingShape(w, endingShapeOpts, this.series, i, j);
-
- pathTo = pathTo + graphics.line(endingShape.newX, barYPosition) + endingShape.path + graphics.line(zeroW, barYPosition + barHeight - strokeWidth) + graphics.line(zeroW, barYPosition);
-
- pathFrom = pathFrom + graphics.line(zeroW, barYPosition) + endingShape.ending_p_from + graphics.line(zeroW, barYPosition + barHeight - strokeWidth) + graphics.line(zeroW, barYPosition + barHeight - strokeWidth) + graphics.line(zeroW, barYPosition);
-
- if (!w.globals.dataXY) {
- y = y + yDivision;
- }
-
- if (this.barOptions.colors.backgroundBarColors.length > 0 && i === 0) {
- if (bc >= this.barOptions.colors.backgroundBarColors.length) {
- bc = 0;
- }
-
- var bcolor = this.barOptions.colors.backgroundBarColors[bc];
- var rect = graphics.drawRect(0, barYPosition - barHeight * this.visibleI, w.globals.gridWidth, barHeight * this.seriesLen, 0, bcolor, this.barOptions.colors.backgroundBarOpacity);
- elSeries.add(rect);
- rect.node.classList.add('apexcharts-backgroundBar');
- }
- return {
- pathTo: pathTo,
- pathFrom: pathFrom,
- x: x,
- y: y,
- barYPosition: barYPosition
- };
- }
- }, {
- key: 'drawColumnPaths',
- value: function drawColumnPaths(_ref2) {
- var indexes = _ref2.indexes,
- x = _ref2.x,
- y = _ref2.y,
- xDivision = _ref2.xDivision,
- pathTo = _ref2.pathTo,
- pathFrom = _ref2.pathFrom,
- barWidth = _ref2.barWidth,
- zeroH = _ref2.zeroH,
- strokeWidth = _ref2.strokeWidth,
- elSeries = _ref2.elSeries;
-
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
-
- var i = indexes.i;
- var j = indexes.j;
-
- var realIndex = indexes.realIndex;
- var bc = indexes.bc;
-
- if (w.globals.dataXY) {
- x = (w.globals.seriesX[i][j] - w.globals.minX) / this.xRatio - barWidth / 2;
- }
-
- var barXPosition = x + barWidth * this.visibleI;
-
- pathTo = graphics.move(barXPosition, zeroH);
-
- pathFrom = graphics.move(barXPosition, zeroH);
- if (w.globals.previousPaths.length > 0) {
- pathFrom = this.getPathFrom(realIndex, j, true);
- }
-
- if (typeof this.series[i][j] === 'undefined' || this.series[i][j] === null) {
- y = zeroH;
- } else {
- y = zeroH - this.series[i][j] / this.yRatio[this.yaxisIndex];
- }
-
- var endingShapeOpts = {
- barWidth: barWidth,
- strokeWidth: strokeWidth,
- barXPosition: barXPosition,
- y: y,
- zeroH: zeroH
- };
- var endingShape = this.barEndingShape(w, endingShapeOpts, this.series, i, j);
-
- pathTo = pathTo + graphics.line(barXPosition, endingShape.newY) + endingShape.path + graphics.line(barXPosition + barWidth - strokeWidth, zeroH) + graphics.line(barXPosition, zeroH);
- pathFrom = pathFrom + graphics.line(barXPosition, zeroH) + endingShape.ending_p_from + graphics.line(barXPosition + barWidth - strokeWidth, zeroH) + graphics.line(barXPosition + barWidth - strokeWidth, zeroH) + graphics.line(barXPosition, zeroH);
-
- if (!w.globals.dataXY) {
- x = x + xDivision;
- }
-
- if (this.barOptions.colors.backgroundBarColors.length > 0 && i === 0) {
- if (bc >= this.barOptions.colors.backgroundBarColors.length) {
- bc = 0;
- }
- var bcolor = this.barOptions.colors.backgroundBarColors[bc];
- var rect = graphics.drawRect(barXPosition - barWidth * this.visibleI, 0, barWidth * this.seriesLen, w.globals.gridHeight, 0, bcolor, this.barOptions.colors.backgroundBarOpacity);
- elSeries.add(rect);
- rect.node.classList.add('apexcharts-backgroundBar');
- }
-
- return {
- pathTo: pathTo,
- pathFrom: pathFrom,
- x: x,
- y: y,
- barXPosition: barXPosition
- };
- }
-
- /** getPathFrom is a common function for bars/columns which is used to get previous paths when data changes.
- * @memberof Bar
- * @param {int} realIndex - current iterating i
- * @param {int} j - current iterating series's j index
- * @param {bool} typeGroup - Bars/columns are not stacked, but grouped
- * @return {string} pathFrom is the string which will be appended in animations
- **/
-
- }, {
- key: 'getPathFrom',
- value: function getPathFrom(realIndex, j) {
- var typeGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
- var w = this.w;
- var pathFrom = void 0;
- for (var pp = 0; pp < w.globals.previousPaths.length; pp++) {
- var gpp = w.globals.previousPaths[pp];
-
- if (gpp.paths.length > 0 && parseInt(gpp.realIndex) === parseInt(realIndex)) {
- if (typeof w.globals.previousPaths[pp].paths[j] !== 'undefined') {
- pathFrom = w.globals.previousPaths[pp].paths[j].d;
- }
- }
- }
- return pathFrom;
- }
-
- /** calculateBarDataLabels is used to calculate the positions for the data-labels
- * It also sets the element's data attr for bars and calls drawCalculatedBarDataLabels()
- * @memberof Bar
- * @param {object} {barProps} most of the bar properties used throughout the bar
- * drawing function
- * @return {object} dataLabels node-element which you can append later
- **/
-
- }, {
- key: 'calculateBarDataLabels',
- value: function calculateBarDataLabels(_ref3) {
- var x = _ref3.x,
- y = _ref3.y,
- i = _ref3.i,
- j = _ref3.j,
- realIndex = _ref3.realIndex,
- series = _ref3.series,
- barHeight = _ref3.barHeight,
- barWidth = _ref3.barWidth,
- visibleSeries = _ref3.visibleSeries,
- renderedPath = _ref3.renderedPath;
-
- var w = this.w;
- var graphics = new _Graphics2.default(this.ctx);
-
- var strokeWidth = Array.isArray(this.strokeWidth) ? this.strokeWidth[realIndex] : this.strokeWidth;
-
- var bcx = x + parseFloat(barWidth * visibleSeries);
- var bcy = y + parseFloat(barHeight * visibleSeries);
-
- var offX = w.config.dataLabels.offsetX;
- var offY = w.config.dataLabels.offsetY;
-
- if (w.globals.dataXY) {
- bcx = x + parseFloat(barWidth * (visibleSeries + 1)) - strokeWidth;
-
- bcy = y + parseFloat(barHeight * (visibleSeries + 1)) - strokeWidth;
- }
-
- var dataLabels = null;
- var dataLabelsX = x;
- var dataLabelsY = y;
- var dataLabelsConfig = w.config.dataLabels;
- var barDataLabelsConfig = this.barOptions.dataLabels;
-
- var dataPointsDividedHeight = w.globals.gridHeight / w.globals.dataPoints;
- var dataPointsDividedWidth = w.globals.gridWidth / w.globals.dataPoints;
-
- var negValuesPresent = Math.abs(w.globals.minY) !== 0;
-
- var textRects = graphics.getTextRects(w.globals.series[i][j], parseInt(dataLabelsConfig.style.fontSize));
-
- if (this.isHorizontal) {
- dataLabelsY = bcy - dataPointsDividedHeight + barHeight / 2 + textRects.height / 2 + offY - 3;
-
- var baseline = w.globals.gridWidth - this.baseLineInvertedY;
- var _barWidth = series[i][j] / this.invertedYRatio;
-
- var emptySpaceBackwards = w.globals.gridWidth - baseline;
-
- var valIsNegative = !!(x < emptySpaceBackwards && Math.abs(this.baseLineInvertedY) !== 0);
-
- switch (barDataLabelsConfig.position) {
- case 'center':
- dataLabelsX = x - _barWidth / 2 + offX;
- if (negValuesPresent) {
- if (valIsNegative) {
- dataLabelsX = x - _barWidth / 2 - offX;
- } else {
- dataLabelsX = x - _barWidth / 2 + offX;
- }
- }
- break;
- case 'bottom':
- if (negValuesPresent) {
- if (valIsNegative) {
- dataLabelsX = x - _barWidth - strokeWidth - Math.round(textRects.width / 2) - offX;
- } else {
- dataLabelsX = x - _barWidth + strokeWidth + Math.round(textRects.width / 2) + offX;
- }
- } else {
- dataLabelsX = x - _barWidth + strokeWidth + Math.round(textRects.width / 2) + offX;
- }
- break;
- case 'top':
- if (negValuesPresent) {
- if (valIsNegative) {
- dataLabelsX = x - strokeWidth + Math.round(textRects.width / 2) - offX;
- } else {
- dataLabelsX = x - strokeWidth - Math.round(textRects.width / 2) + offX;
- }
- } else {
- dataLabelsX = x + strokeWidth - Math.round(textRects.width / 2) + offX;
- }
- break;
- }
-
- renderedPath.attr({
- cy: bcy,
- cx: x,
- j: j,
- val: series[i][j],
- barHeight: barHeight
- });
-
- dataLabels = this.drawCalculatedBarDataLabels({ x: dataLabelsX, y: dataLabelsY, val: series[i][j], i: realIndex, j: j, dataLabelsConfig: dataLabelsConfig });
- } else {
- // columns
- var _barHeight = series[i][j] / this.yRatio[this.yaxisIndex];
- bcx = bcx - strokeWidth / 2;
-
- if (w.globals.dataXY) {
- dataLabelsX = bcx - barWidth / 2 + offX;
- } else {
- dataLabelsX = bcx - dataPointsDividedWidth + barWidth / 2 + offX;
- }
-
- var _baseline = w.globals.gridHeight - this.baseLineY[this.yaxisIndex];
- var _valIsNegative = !!(y > _baseline && Math.abs(this.baseLineY[this.yaxisIndex]) !== 0);
-
- switch (barDataLabelsConfig.position) {
- case 'center':
- dataLabelsY = y + _barHeight / 2 + textRects.height / 2 - offY;
- if (negValuesPresent) {
- if (_valIsNegative) {
- dataLabelsY = y + _barHeight / 2 + textRects.height / 2 + offY;
- } else {
- dataLabelsY = y + _barHeight / 2 + textRects.height / 2 - offY;
- }
- }
- break;
- case 'bottom':
- if (negValuesPresent) {
- if (_valIsNegative) {
- dataLabelsY = y + _barHeight + textRects.height + strokeWidth + offY;
- } else {
- dataLabelsY = y + _barHeight - textRects.height / 2 + strokeWidth - offY;
- }
- } else {
- dataLabelsY = w.globals.gridHeight - textRects.height / 2 - offY;
- }
- break;
- case 'top':
- if (negValuesPresent) {
- if (_valIsNegative) {
- dataLabelsY = y - textRects.height / 2 - offY;
- } else {
- dataLabelsY = y + textRects.height + offY;
- }
- } else {
- dataLabelsY = y + textRects.height + offY;
- }
- break;
- }
-
- renderedPath.attr({
- cy: y,
- cx: bcx,
- j: j,
- val: series[i][j],
- barWidth: barWidth
- });
-
- dataLabels = this.drawCalculatedBarDataLabels({ x: dataLabelsX, y: dataLabelsY, val: series[i][j], i: realIndex, j: j, dataLabelsConfig: dataLabelsConfig });
- }
-
- return dataLabels;
- }
- }, {
- key: 'drawCalculatedBarDataLabels',
- value: function drawCalculatedBarDataLabels(_ref4) {
- var x = _ref4.x,
- y = _ref4.y,
- val = _ref4.val,
- i = _ref4.i,
- j = _ref4.j,
- dataLabelsConfig = _ref4.dataLabelsConfig;
-
- var w = this.w;
-
- var dataLabels = new _DataLabels2.default(this.ctx);
- var graphics = new _Graphics2.default(this.ctx);
- var formatter = dataLabelsConfig.formatter;
-
- var elDataLabelsWrap = null;
-
- if (dataLabelsConfig.enabled) {
- elDataLabelsWrap = graphics.group({
- class: 'apexcharts-data-labels'
- });
-
- var text = '';
- if (val) {
- text = formatter(val, { seriesIndex: i, dataPointIndex: j, globals: w.globals });
- }
- dataLabels.plotDataLabelsText(x, y, text, i, j, elDataLabelsWrap, dataLabelsConfig);
- }
-
- return elDataLabelsWrap;
- }
-
- /** barEndingShape draws the various shapes on top of bars/columns
- * @memberof Bar
- * @param {object} w - chart context
- * @param {object} opts - consists several properties like barHeight/barWidth
- * @param {array} series - global primary series
- * @param {int} i - current iterating series's index
- * @param {int} j - series's j of i
- * @return {object} path - ending shape whether round/arrow
- * ending_p_from - similar to pathFrom
- * newY - which is calculated from existing y and new shape's top
- **/
-
- }, {
- key: 'barEndingShape',
- value: function barEndingShape(w, opts, series, i, j) {
- var graphics = new _Graphics2.default(this.ctx);
-
- if (this.isHorizontal) {
- var endingShape = null;
- var endingShapeFrom = '';
- var _x2 = opts.x;
-
- if (typeof series[i][j] !== 'undefined' || series[i][j] !== null) {
- var inverse = series[i][j] < 0;
- var eX = opts.barHeight / 2 - opts.strokeWidth;
- if (inverse) eX = -opts.barHeight / 2 - opts.strokeWidth;
-
- if (!w.config.chart.stacked) {
- // if (Math.abs(series[i][j] / this.invertedYRatio) > eX) {
- if (this.barOptions.endingShape === 'arrow') {
- _x2 = opts.x - eX;
- } else if (this.barOptions.endingShape === 'rounded') {
- _x2 = opts.x - eX / 2;
- }
- // }
- }
-
- switch (this.barOptions.endingShape) {
- case 'flat':
- endingShape = graphics.line(_x2, opts.barYPosition + opts.barHeight - opts.strokeWidth);
- break;
- case 'arrow':
- endingShape = graphics.line(_x2 + eX, opts.barYPosition + (opts.barHeight - opts.strokeWidth) / 2) + graphics.line(_x2, opts.barYPosition + opts.barHeight - opts.strokeWidth);
-
- endingShapeFrom = graphics.line(opts.zeroW, opts.barYPosition + opts.barHeight - opts.strokeWidth);
- break;
- case 'rounded':
- endingShape = graphics.quadraticCurve(_x2 + eX, opts.barYPosition + (opts.barHeight - opts.strokeWidth) / 2, _x2, opts.barYPosition + opts.barHeight - opts.strokeWidth);
- break;
- default:
- endingShape = graphics.line(_x2, opts.barYPosition + opts.barHeight - opts.strokeWidth);
- break;
- }
- }
- return {
- path: endingShape,
- ending_p_from: endingShapeFrom,
- newX: _x2
- };
- } else {
- var _endingShape = null;
- var _endingShapeFrom = '';
- var _y = opts.y;
-
- if (typeof series[i][j] !== 'undefined' || series[i][j] !== null) {
- var _inverse = series[i][j] < 0;
-
- var eY = opts.barWidth / 2 - opts.strokeWidth;
-
- if (_inverse) eY = -opts.barWidth / 2 - opts.strokeWidth;
-
- if (!w.config.chart.stacked) {
- // if (Math.abs(series[i][j] / this.yRatio[this.yaxisIndex]) > eY) {
- // the arrow exceeds the chart height, hence reduce y
- if (this.barOptions.endingShape === 'arrow') {
- _y = _y + eY;
- } else if (this.barOptions.endingShape === 'rounded') {
- _y = _y + eY / 2;
- }
- // }
- }
-
- switch (this.barOptions.endingShape) {
- case 'flat':
- _endingShape = graphics.line(opts.barXPosition + opts.barWidth - opts.strokeWidth, _y);
- break;
- case 'arrow':
- _endingShape = graphics.line(opts.barXPosition + (opts.barWidth - opts.strokeWidth) / 2, _y - eY) + graphics.line(opts.barXPosition + opts.barWidth - opts.strokeWidth, _y);
- _endingShapeFrom = graphics.line(opts.barXPosition + opts.barWidth - opts.strokeWidth, opts.zeroH);
- break;
- case 'rounded':
- _endingShape = graphics.quadraticCurve(opts.barXPosition + (opts.barWidth - opts.strokeWidth) / 2, _y - eY, opts.barXPosition + opts.barWidth - opts.strokeWidth, _y);
- break;
- default:
- _endingShape = graphics.line(opts.barXPosition + opts.barWidth - opts.strokeWidth, _y);
- break;
- }
- }
- return {
- path: _endingShape,
- ending_p_from: _endingShapeFrom,
- newY: _y
- };
- }
- }
- }, {
- key: 'setSelectedBarFilter',
- value: function setSelectedBarFilter(el, realIndex, j) {
- var w = this.w;
- if (typeof w.globals.selectedDataPoints[realIndex] !== 'undefined') {
- if (w.globals.selectedDataPoints[realIndex].includes(j)) {
- el.node.setAttribute('selected', true);
- var activeFilter = w.config.states.active.filter;
- if (activeFilter !== 'none') {
- var filters = new _Filters2.default(this.ctx);
- filters.applyFilter(el, activeFilter.type, activeFilter.value);
- }
- }
- }
- }
- }]);
-
- return Bar;
-}();
-
-exports.default = Bar;
-
-/***/ }),
-/* 53 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Fill = __webpack_require__(8);
-
-var _Fill2 = _interopRequireDefault(_Fill);
-
-var _Utils = __webpack_require__(1);
-
-var _Utils2 = _interopRequireDefault(_Utils);
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-var _Filters = __webpack_require__(4);
-
-var _Filters2 = _interopRequireDefault(_Filters);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Pie Class for drawing Pie / Donut Charts.
- * @module Pie
- **/
-
-var Pie = function () {
- function Pie(ctx) {
- _classCallCheck(this, Pie);
-
- this.ctx = ctx;
- this.w = ctx.w;
-
- this.chartType = this.w.config.chart.type;
-
- this.initialAnim = this.w.config.chart.animations.enabled;
- this.dynamicAnim = this.initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled;
-
- this.animBeginArr = [0];
- this.animDur = 0;
-
- var w = this.w;
-
- this.centerY = w.globals.gridHeight / 2;
- this.centerX = w.globals.gridWidth / 2;
-
- if (w.config.chart.type === 'radialBar') {
- this.fullAngle = 360 - w.config.plotOptions.radialBar.endAngle - w.config.plotOptions.radialBar.startAngle;
- } else {
- this.fullAngle = 360;
- }
-
- this.size = 0;
- this.donutSize = 0;
-
- this.prevSectorAngleArr = []; // for dynamic animations
- }
-
- _createClass(Pie, [{
- key: 'draw',
- value: function draw(series) {
- var self = this;
- var w = this.w;
-
- var graphics = new _Graphics2.default(this.ctx);
-
- var ret = graphics.group({
- class: 'apexcharts-pie'
- });
-
- var colorArr = w.config.fill.colors;
-
- var lineColorArr = w.config.stroke.colors !== undefined ? w.config.stroke.colors : w.config.colors;
-
- var total = 0;
- for (var k = 0; k < series.length; k++) {
- // CALCULATE THE TOTAL
- total += _Utils2.default.negToZero(series[k]);
- }
-
- var sectorAngleArr = [];
-
- // el to which series will be drawn
- var elSeries = graphics.group();
-
- for (var i = 0; i < series.length; i++) {
- // CALCULATE THE ANGLES
- var angle = Math.round(this.fullAngle * _Utils2.default.negToZero(series[i]) / total);
- sectorAngleArr.push(angle);
- }
-
- if (w.globals.dataChanged) {
- var prevTotal = 0;
- for (var _k = 0; _k < w.globals.previousPaths.length; _k++) {
- // CALCULATE THE PREV TOTAL
- prevTotal += _Utils2.default.negToZero(w.globals.previousPaths[_k]);
- }
-
- var previousAngle = void 0;
-
- for (var _i = 0; _i < w.globals.previousPaths.length; _i++) {
- // CALCULATE THE PREVIOUS ANGLES
- previousAngle = Math.round(this.fullAngle * _Utils2.default.negToZero(w.globals.previousPaths[_i]) / prevTotal);
- this.prevSectorAngleArr.push(previousAngle);
- }
- }
-
- this.size = w.globals.gridWidth / 2.05 - w.config.stroke.width - w.config.chart.dropShadow.blur;
-
- if (w.config.plotOptions.pie.size !== undefined) {
- this.size = w.config.plotOptions.pie.size;
- }
-
- this.donutSize = this.size * parseInt(w.config.plotOptions.pie.donut.size) / 100;
-
- var scaleSize = 1 + w.config.plotOptions.pie.customScale;
- var halfW = w.globals.gridWidth / 2;
- var halfH = w.globals.gridHeight / 2;
- var translateX = halfW - w.globals.gridWidth / 2 * scaleSize;
- var translateY = halfH - w.globals.gridHeight / 2 * scaleSize;
-
- if (w.config.chart.type === 'donut') {
- // draw the inner circle and add some text to it
- var circle = graphics.drawCircle(this.donutSize);
-
- circle.attr({
- cx: this.centerX,
- cy: this.centerY,
- fill: w.config.plotOptions.pie.donut.background
- });
-
- elSeries.add(circle);
- }
-
- var elG = self.drawArcs(colorArr, lineColorArr, sectorAngleArr, series);
-
- elSeries.attr({
- 'transform': 'translate(' + translateX + ', ' + translateY + ') scale(' + scaleSize + ')'
- });
-
- ret.attr({
- 'data:innerTranslateX': translateX,
- 'data:innerTranslateY': translateY
- });
-
- elSeries.add(elG);
-
- ret.add(elSeries);
-
- return ret;
- }
-
- // core function for drawing pie arcs
-
- }, {
- key: 'drawArcs',
- value: function drawArcs(colorArr, lineColorArr, sectorAngleArr, series) {
- var w = this.w;
- var filters = new _Filters2.default(this.ctx);
-
- var graphics = new _Graphics2.default(this.ctx);
- var fill = new _Fill2.default(this.ctx);
- var g = graphics.group();
-
- var startAngle = 0;
- var prevStartAngle = 0;
- var endAngle = 0;
- var prevEndAngle = 0;
-
- this.strokeWidth = w.config.stroke.show ? w.config.stroke.width : 0;
-
- for (var i = 0; i < sectorAngleArr.length; i++) {
- // if(sectorAngleArr[i]>0) {
-
- var elPieArc = graphics.group({
- class: 'apexcharts-series apexcharts-pie-series',
- id: 'apexcharts-series-' + i,
- rel: i + 1
- });
-
- g.add(elPieArc);
-
- startAngle = endAngle;
- prevStartAngle = prevEndAngle;
-
- endAngle = startAngle + sectorAngleArr[i];
- prevEndAngle = prevStartAngle + this.prevSectorAngleArr[i];
-
- var angle = endAngle - startAngle;
-
- var pathFill = fill.fillPath(elPieArc, {
- seriesNumber: i,
- size: this.size
- }); // additionaly, pass size for gradient drawing in the fillPath function
-
- var elPath = graphics.drawPath({
- d: '',
- stroke: lineColorArr instanceof Array ? lineColorArr[i] : lineColorArr,
- strokeWidth: this.strokeWidth,
- fill: pathFill,
- fillOpacity: w.config.fill.opacity,
- classes: 'apexcharts-pie-area'
- });
-
- elPath.attr({
- id: 'apexcharts-pieSlice-' + i
- });
-
- if (w.config.chart.dropShadow.enabled) {
- var shadow = w.config.chart.dropShadow;
- filters.dropShadow(elPath, shadow);
- }
-
- // append filters on mouseenter and mouseleave
- elPath.node.addEventListener('mouseenter', graphics.pathMouseEnter.bind(this, elPath));
- elPath.node.addEventListener('mouseleave', graphics.pathMouseLeave.bind(this, elPath));
-
- _Graphics2.default.setAttrs(elPath.node, {
- 'data:angle': angle,
- 'data:startAngle': startAngle,
- 'data:strokeWidth': this.strokeWidth,
- 'data:value': series[i]
- });
-
- var labelPosition = void 0;
-
- if (w.config.chart.type === 'pie') {
- labelPosition = _Utils2.default.polarToCartesian(this.centerX, this.centerY, this.size / 1.25 + w.config.plotOptions.pie.dataLabels.offset, startAngle + (endAngle - startAngle) / 2);
- } else if (w.config.chart.type === 'donut') {
- labelPosition = _Utils2.default.polarToCartesian(this.centerX, this.centerY, (this.size + this.donutSize) / 2 + w.config.plotOptions.pie.dataLabels.offset, startAngle + (endAngle - startAngle) / 2);
- }
-
- elPieArc.add(elPath);
-
- // Animation code starts
- var dur = 0;
- if (this.initialAnim && !w.globals.resized && !w.globals.dataChanged) {
- dur = (endAngle - startAngle) / this.fullAngle * w.config.chart.animations.speed;
-
- this.animDur = dur + this.animDur;
- this.animBeginArr.push(this.animDur);
- } else {
- this.animBeginArr.push(0);
- }
-
- this.animatePaths(elPath, {
- endAngle: endAngle,
- startAngle: startAngle,
- i: i,
- totalItems: sectorAngleArr.length - 1,
- animBeginArr: this.animBeginArr,
- dur: dur
- });
-
- if (this.dynamicAnim && w.globals.dataChanged) {
- this.animatePaths(elPath, {
- endAngle: endAngle,
- startAngle: startAngle,
- prevStartAngle: prevStartAngle,
- prevEndAngle: prevEndAngle,
- i: i,
- animateStartingPos: true,
- animBeginArr: this.animBeginArr,
- dur: w.config.chart.animations.dynamicAnimation.speed
- });
- }
-
- // animation code ends
-
- elPath.click(this.pieClicked.bind(this, i));
-
- if (w.config.dataLabels.enabled) {
- var xPos = labelPosition.x;
- var yPos = labelPosition.y;
- var text = Math.round(100 * (endAngle - startAngle) / 360) + '%';
-
- if (angle !== 0) {
- var formatter = w.config.dataLabels.formatter;
-
- if (formatter !== undefined) {
- text = formatter(w.globals.seriesPercent[i][0], { seriesIndex: i, globals: w.globals });
- }
- var foreColor = w.config.dataLabels.style.colors[i];
-
- var elPieLabel = graphics.drawText({
- x: xPos,
- y: yPos,
- text: text,
- textAnchor: 'middle',
- fontSize: w.config.dataLabels.style.fontSize,
- foreColor: foreColor
- });
-
- if (w.config.dataLabels.dropShadow.enabled) {
- var textShadow = w.config.dataLabels.dropShadow;
- var _filters = new _Filters2.default(this.ctx);
- _filters.dropShadow(elPieLabel, textShadow);
- }
-
- elPieLabel.node.classList.add('apexcharts-pie-label');
- if (w.config.chart.animations.animate && w.globals.resized === false) {
- elPieLabel.node.classList.add('apexcharts-pie-label-delay');
- elPieLabel.node.style.animationDelay = w.config.chart.animations.speed / 940 + 's';
- }
-
- elPieArc.add(elPieLabel);
- }
- }
- // }
- }
-
- return g;
- }
-
- // This function can be used for other circle charts too
-
- }, {
- key: 'animatePaths',
- value: function animatePaths(el, opts) {
- var w = this.w;
- var me = this;
-
- var angle = opts.endAngle - opts.startAngle;
- var prevAngle = angle;
-
- var fromStartAngle = opts.startAngle;
- var toStartAngle = opts.startAngle;
-
- if (opts.prevStartAngle !== undefined && opts.prevEndAngle !== undefined) {
- fromStartAngle = opts.prevEndAngle;
- prevAngle = opts.prevEndAngle - opts.prevStartAngle;
- }
-
- if (opts.i === w.config.series.length - 1) {
- // some adjustments for the last overlapping paths
- if (angle + toStartAngle > this.fullAngle) {
- opts.endAngle = opts.endAngle - (angle + toStartAngle);
- } else if (angle + toStartAngle < this.fullAngle) {
- opts.endAngle = opts.endAngle + (this.fullAngle - (angle + toStartAngle));
- }
- }
-
- if (angle === this.fullAngle) angle = this.fullAngle - 0.01;
-
- me.animateArc(el, fromStartAngle, toStartAngle, angle, prevAngle, opts);
- }
- }, {
- key: 'animateArc',
- value: function animateArc(el, fromStartAngle, toStartAngle, angle, prevAngle, params) {
- var me = this;
- var w = this.w;
-
- var size = me.size;
-
- if (!size) {
- size = params.size;
- }
-
- var path = void 0;
- var opts = params;
-
- var currAngle = angle;
- var startAngle = toStartAngle;
- var fromAngle = fromStartAngle - toStartAngle;
-
- if (w.globals.dataChanged) {
- // to avoid flickering, set prev path first and then we will animate from there
- path = me.getPiePath({
- me: me,
- startAngle: startAngle,
- angle: prevAngle,
- size: size
- });
- el.attr({ d: path });
- }
-
- if (opts.dur !== 0) {
- el.animate(opts.dur, w.globals.easing, opts.animBeginArr[opts.i]).afterAll(function () {
- if (w.config.chart.type === 'pie' || w.config.chart.type === 'donut') {
- this.animate(300).attr({
- 'stroke-width': w.config.stroke.width
- });
- }
- }).during(function (pos) {
- currAngle = fromAngle + (angle - fromAngle) * pos;
- if (params.animateStartingPos) {
- startAngle = fromAngle + (toStartAngle - fromAngle) * pos;
- currAngle = fromStartAngle + (angle - fromStartAngle) * pos;
- }
- path = me.getPiePath({
- me: me,
- startAngle: startAngle,
- angle: currAngle,
- size: size
- });
-
- el.node.setAttribute('data:pathOrig', path);
-
- if (w.config.chart.type === 'pie' || w.config.chart.type === 'donut') {
- el.attr({
- 'stroke-width': 0
- });
- }
-
- el.attr({
- d: path
- });
- });
- } else {
- path = me.getPiePath({
- me: me,
- startAngle: startAngle,
- angle: angle,
- size: size
- });
-
- el.node.setAttribute('data:pathOrig', path);
-
- el.attr({
- d: path
- });
- }
- }
- }, {
- key: 'pieClicked',
- value: function pieClicked(i) {
- var w = this.w;
- var me = this;
- var path = void 0;
-
- var size = me.size + 10;
- var elPath = w.globals.dom.Paper.select('#apexcharts-pieSlice-' + i).members[0];
-
- var pathFrom = elPath.attr('d');
-
- if (elPath.attr('data:pieClicked') === 'true') {
- size = me.size;
- elPath.attr({
- 'data:pieClicked': 'false'
- });
-
- var origPath = elPath.attr('data:pathOrig');
- elPath.attr({
- 'd': origPath
- });
- return;
- } else {
- // reset all elems
- var allEls = w.globals.dom.baseEl.querySelectorAll('.apexcharts-pie-area');
- Array.prototype.forEach.call(allEls, function (pieSlice) {
- pieSlice.setAttribute('data:pieClicked', 'false');
- var origPath = pieSlice.getAttribute('data:pathOrig');
- pieSlice.setAttribute('d', origPath);
- });
- elPath.attr('data:pieClicked', 'true');
- }
-
- var startAngle = parseInt(elPath.attr('data:startAngle'));
- var angle = parseInt(elPath.attr('data:angle'));
-
- path = me.getPiePath({
- me: me,
- startAngle: startAngle,
- angle: angle,
- size: size
- });
-
- elPath.plot(path).animate(1).plot(pathFrom).animate(100).plot(path);
- }
- }, {
- key: 'getPiePath',
- value: function getPiePath(_ref) {
- var me = _ref.me,
- startAngle = _ref.startAngle,
- angle = _ref.angle,
- size = _ref.size;
-
- var w = this.w;
- var path = void 0;
-
- var startDeg = startAngle;
- var startRadians = Math.PI * (startDeg - 90) / 180;
-
- var endDeg = angle + startAngle;
- if (endDeg > 360) endDeg = 360;
-
- var endRadians = Math.PI * (endDeg - 90) / 180;
-
- var x1 = me.centerX + size * Math.cos(startRadians);
- var y1 = me.centerY + size * Math.sin(startRadians);
- var x2 = me.centerX + size * Math.cos(endRadians);
- var y2 = me.centerY + size * Math.sin(endRadians);
-
- var startInner = _Utils2.default.polarToCartesian(me.centerX, me.centerY, me.donutSize, endDeg);
- var endInner = _Utils2.default.polarToCartesian(me.centerX, me.centerY, me.donutSize, startDeg);
-
- var largeArc = angle > 180 ? 1 : 0;
-
- if (w.config.chart.type === 'donut') {
- path = ['M', x1, y1, 'A', size, size, 0, largeArc, 1, x2, y2, 'L', startInner.x, startInner.y, 'A', me.donutSize, me.donutSize, 0, largeArc, 0, endInner.x, endInner.y, 'L', x1, y1, 'z'].join(' ');
- } else if (w.config.chart.type === 'pie') {
- path = ['M', x1, y1, 'A', size, size, 0, largeArc, 1, x2, y2, 'L', me.centerX, me.centerY, 'L', x1, y1].join(' ');
- } else {
- path = ['M', x1, y1, 'A', size, size, 0, largeArc, 1, x2, y2].join(' ');
- }
-
- return path;
- }
- }]);
-
- return Pie;
-}();
-
-exports.default = Pie;
-
-/***/ }),
-/* 54 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Animations = __webpack_require__(14);
-
-var _Animations2 = _interopRequireDefault(_Animations);
-
-var _Fill = __webpack_require__(8);
-
-var _Fill2 = _interopRequireDefault(_Fill);
-
-var _Filters = __webpack_require__(4);
-
-var _Filters2 = _interopRequireDefault(_Filters);
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-var _Markers = __webpack_require__(34);
-
-var _Markers2 = _interopRequireDefault(_Markers);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Scatter Class.
- * This Class also handles bubbles chart as currently there is no major difference in drawing them,
- * @module Scatter
- **/
-var Scatter = function () {
- function Scatter(ctx) {
- _classCallCheck(this, Scatter);
-
- this.ctx = ctx;
- this.w = ctx.w;
-
- this.initialAnim = this.w.config.chart.animations.enabled;
- this.dynamicAnim = this.initialAnim && this.w.config.chart.animations.dynamicAnimation.enabled;
-
- // this array will help in centering the label in bubbles
- this.radiusSizes = [];
- }
-
- _createClass(Scatter, [{
- key: 'draw',
- value: function draw(elSeries, j, opts) {
- var w = this.w;
-
- var anim = new _Animations2.default(this.ctx);
- var graphics = new _Graphics2.default(this.ctx);
- var filters = new _Filters2.default(this.ctx);
- var fill = new _Fill2.default(this.ctx);
-
- var realIndex = opts.realIndex;
- var pointsPos = opts.pointsPos;
- var zRatio = opts.zRatio;
- var elPointsMain = opts.elParent;
-
- var pathFillCircle = fill.fillPath(elSeries, {
- seriesNumber: realIndex
- });
-
- var elPointsWrap = graphics.group({
- class: 'apexcharts-series-markers apexcharts-series-' + w.config.chart.type
- });
-
- if (pointsPos.x instanceof Array) {
- for (var q = 0; q < pointsPos.x.length; q++) {
- var realIndexP = j + 1;
-
- // a small hack as we have 2 points for the first val to connect it
- if (j === 0 && q === 0) realIndexP = 0;
- if (j === 0 && q === 1) realIndexP = 1;
-
- var radius = 0;
- var finishRadius = w.config.markers.size;
-
- if (zRatio !== Infinity) {
- // means we have a bubble
- finishRadius = w.globals.seriesZ[realIndex][realIndexP] / zRatio;
- if (typeof this.radiusSizes[realIndex] === 'undefined') {
- this.radiusSizes.push([]);
- }
- this.radiusSizes[realIndex].push(finishRadius);
- }
-
- if (!w.config.chart.animations.enabled) {
- radius = finishRadius;
- }
-
- var x = pointsPos.x[q];
- var y = pointsPos.y[q];
-
- x = x || 0;
- y = y || 0;
- radius = radius || 0;
-
- if (x === 0 && y === 0 || typeof w.globals.series[realIndex][realIndexP] === 'undefined') return;
-
- var circle = graphics.drawCircle(radius);
-
- circle.attr({
- cx: x,
- cy: y,
- fill: pathFillCircle
- });
-
- if (w.config.chart.dropShadow.enabled) {
- filters.dropShadow(circle, {
- top: w.config.chart.dropShadow.top,
- left: w.config.chart.dropShadow.left,
- blur: w.config.chart.dropShadow.blur
- });
- }
-
- if (this.initialAnim && !w.globals.dataChanged) {
- var speed = 1;
- if (!w.globals.resized) {
- speed = w.config.chart.animations.speed;
- }
- anim.animateCircleRadius(circle, 0, finishRadius, speed);
- }
-
- if (w.globals.dataChanged) {
- if (this.dynamicAnim) {
- var _speed = w.config.chart.animations.dynamicAnimation.speed;
- var prevX = void 0,
- prevY = void 0,
- prevR = void 0;
-
- var prevPathJ = w.globals.previousPaths[realIndex][j];
-
- if (typeof prevPathJ !== 'undefined') {
- // series containing less elements will ignore these values and revert to 0
- prevX = prevPathJ.x;
- prevY = prevPathJ.y;
- prevR = typeof prevPathJ.r !== 'undefined' ? prevPathJ.r : finishRadius;
- }
-
- for (var cs = 0; cs < w.globals.collapsedSeries.length; cs++) {
- if (w.globals.collapsedSeries[cs].index === realIndex) {
- _speed = 1;
- finishRadius = 0;
- }
- }
-
- if (x === 0 && y === 0) finishRadius = 0;
-
- if (!w.globals.risingSeries.includes(realIndex)) {
- anim.animateCircle(circle, {
- cx: prevX, cy: prevY, r: prevR
- }, {
- cx: x, cy: y, r: finishRadius
- }, _speed);
- } else {
- anim.animateCircle(circle, {
- cx: prevX, cy: prevY, r: prevR
- }, {
- cx: x, cy: y, r: finishRadius
- }, _speed);
- }
- } else {
- circle.attr({
- r: finishRadius
- });
- }
- }
-
- circle.attr({
- 'rel': realIndexP,
- 'j': realIndexP,
- 'index': realIndex
- });
-
- var markers = new _Markers2.default(this.ctx);
- markers.setSelectedPointFilter(circle, realIndex, realIndexP);
- markers.addEvents(circle);
-
- circle.node.classList.add('apexcharts-marker');
-
- elPointsWrap.add(circle);
-
- elPointsMain.add(elPointsWrap);
- }
- }
- }
- }, {
- key: 'centerTextInBubble',
- value: function centerTextInBubble(y, i, realIndexP) {
- var w = this.w;
- y = y + parseInt(w.config.dataLabels.style.fontSize) / 4;
-
- return {
- y: y
- };
- }
- }]);
-
- return Scatter;
-}();
-
-module.exports = Scatter;
-
-/***/ }),
-/* 55 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _DateTime = __webpack_require__(37);
-
-var _DateTime2 = _interopRequireDefault(_DateTime);
-
-var _Dimensions = __webpack_require__(21);
-
-var _Dimensions2 = _interopRequireDefault(_Dimensions);
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts TimeScale Class for generating time ticks for x-axis.
- *
- * @module TimeScale
- **/
-
-var TimeScale = function () {
- function TimeScale(ctx) {
- _classCallCheck(this, TimeScale);
-
- this.ctx = ctx;
- this.w = ctx.w;
- this.timeScaleArray = [];
- }
-
- _createClass(TimeScale, [{
- key: 'calculateTimeScaleTicks',
- value: function calculateTimeScaleTicks() {
- var _this = this;
-
- var w = this.w;
-
- // null check when no series to show
- if (w.globals.allSeriesCollapsed) {
- w.globals.labels = [];
- w.globals.timelineLabels = [];
- return [];
- }
-
- var dt = new _DateTime2.default(this.ctx);
-
- var daysDiff = (w.globals.maxX - w.globals.minX) / (1000 * 60 * 60 * 24);
- this.determineInterval(daysDiff);
-
- var timeIntervals = dt.getTimeUnitsfromTimestamp(w.globals.minX, w.globals.maxX);
-
- var daysWidthOnXAxis = w.globals.gridWidth / daysDiff;
- var hoursWidthOnXAxis = daysWidthOnXAxis / 24;
- var minutesWidthOnXAxis = hoursWidthOnXAxis / 60;
-
- var numberOfHours = Math.floor(daysDiff * 24);
- // let numberOfMinutes = Math.floor(daysDiff * 24 * 60)
- var numberOfDays = Math.floor(daysDiff);
- var numberOfMonths = Math.floor(daysDiff / 30);
- var numberOfYears = Math.floor(daysDiff / 365);
-
- var firstVal = {
- minMinute: timeIntervals.minMinute,
- minHour: timeIntervals.minHour,
- minDate: timeIntervals.minDate,
- minMonth: timeIntervals.minMonth,
- minYear: timeIntervals.minYear
-
- // let currentHour = firstVal.minHour
- };var currentMonthDate = firstVal.minDate;
- var currentDate = firstVal.minDate;
- var currentMonth = firstVal.minMonth;
- var currentYear = firstVal.minYear;
-
- var params = {
- firstVal: firstVal,
- currentMonthDate: currentMonthDate,
- currentDate: currentDate,
- currentMonth: currentMonth,
- currentYear: currentYear,
- daysWidthOnXAxis: daysWidthOnXAxis,
- hoursWidthOnXAxis: hoursWidthOnXAxis,
- minutesWidthOnXAxis: minutesWidthOnXAxis,
- numberOfHours: numberOfHours,
- numberOfDays: numberOfDays,
- numberOfMonths: numberOfMonths,
- numberOfYears: numberOfYears
- };
-
- switch (this.tickInterval) {
- case 'years':
- {
- this.generateYearScale(params);
- break;
- }
- case 'months':case 'half_year':
- {
- this.generateMonthScale(params);
- break;
- }
- case 'months_days':case 'months_fortnight':case 'days':case 'week_days':
- {
- this.generateDayScale(params);
- break;
- }
- case 'hours':
- {
- this.generateHourScale(params);
- break;
- }
- case 'minutes':
- // TODO
- break;
- }
-
- // first, we will adjust the month values index
- // as in the upper function, it is starting from 0
- // we will start them from 1
- var adjustedMonthInTimeScaleArray = this.timeScaleArray.map(function (ts) {
- if (ts.unit === 'month') {
- return {
- position: ts.position,
- value: ts.value + 1,
- unit: ts.unit,
- year: ts.year,
- month: ts.month + 1
- };
- } else if (ts.unit === 'day' || ts.unit === 'hour') {
- return {
- position: ts.position,
- value: ts.value,
- unit: ts.unit,
- year: ts.year,
- month: ts.month + 1
- };
- }
-
- return ts;
- });
-
- var filteredTimeScale = adjustedMonthInTimeScaleArray.filter(function (ts, index) {
- var modulo = 1;
- var ticks = Math.ceil(w.globals.gridWidth / 120);
- var value = ts.value;
- if (w.config.xaxis.tickAmount !== undefined) {
- ticks = w.config.xaxis.tickAmount;
- }
- if (adjustedMonthInTimeScaleArray.length > ticks) {
- modulo = Math.floor(adjustedMonthInTimeScaleArray.length / ticks);
- }
-
- var shouldNotSkipUnit = false; // there is a big change in unit i.e days to months
- var shouldNotPrint = false; // should skip these values
-
- switch (_this.tickInterval) {
- case 'half_year':
- modulo = 7;
- if (ts.unit === 'year') {
- shouldNotSkipUnit = true;
- }
- break;
- case 'months':
- modulo = 1;
- if (ts.unit === 'year') {
- shouldNotSkipUnit = true;
- }
- break;
- case 'months_fortnight':
- modulo = 15;
- if (ts.unit === 'year' || ts.unit === 'month') {
- shouldNotSkipUnit = true;
- }
- if (value === 30) {
- shouldNotPrint = true;
- }
- break;
- case 'months_days':
- modulo = 10;
- if (ts.unit === 'month') {
- shouldNotSkipUnit = true;
- }
- if (value === 30) {
- shouldNotPrint = true;
- }
- break;
- case 'week_days':
- modulo = 8;
- if (ts.unit === 'month') {
- shouldNotSkipUnit = true;
- }
- break;
- case 'days':
- modulo = 1;
- if (ts.unit === 'month') {
- shouldNotSkipUnit = true;
- }
- break;
- case 'hours':
- if (ts.unit === 'day') {
- shouldNotSkipUnit = true;
- }
- break;
- default:
- shouldNotSkipUnit = false;
- break;
- }
-
- if ((value % modulo === 0 || shouldNotSkipUnit) && !shouldNotPrint) {
- return true;
- }
- });
-
- var reformattedTimescaleArray = this.formatDates(filteredTimeScale);
-
- var removedOverlappingTS = this.removeOverlappingTS(reformattedTimescaleArray);
- w.globals.timelineLabels = removedOverlappingTS.slice();
-
- // at this stage, we need to re-calculate coords of the grid as timeline labels may have altered the xaxis labels coords
- // The reason we can't do this prior to this stage is because timeline labels depends on gridWidth, and as the ticks are calculated based on available gridWidth, there can be unknown number of ticks generated for different minX and maxX
- // Dependency on Dimensions(), need to refactor correctly
- // TODO - find an alternate way to avoid calling this Heavy method twice
- var dimensions = new _Dimensions2.default(this.ctx);
- dimensions.plotCoords();
-
- return filteredTimeScale;
- }
- }, {
- key: 'determineInterval',
- value: function determineInterval(daysDiff) {
- switch (true) {
- case daysDiff > 1825:
- // difference is more than 5 years
- this.tickInterval = 'years';
- break;
- case daysDiff > 800 && daysDiff <= 1825:
- this.tickInterval = 'half_year';
- break;
- case daysDiff > 180 && daysDiff <= 800:
- this.tickInterval = 'months';
- break;
- case daysDiff > 90 && daysDiff <= 180:
- this.tickInterval = 'months_fortnight';
- break;
- case daysDiff > 60 && daysDiff <= 90:
- this.tickInterval = 'months_days';
- break;
- case daysDiff > 30 && daysDiff <= 60:
- this.tickInterval = 'week_days';
- break;
- case daysDiff > 2 && daysDiff <= 30:
- this.tickInterval = 'days';
- break;
- case daysDiff <= 2:
- // less than 2 days
- this.tickInterval = 'hours';
- break;
- default:
- this.tickInterval = 'days';
- break;
- }
- }
- }, {
- key: 'generateYearScale',
- value: function generateYearScale(params) {
- var firstVal = params.firstVal,
- currentMonth = params.currentMonth,
- currentYear = params.currentYear,
- daysWidthOnXAxis = params.daysWidthOnXAxis,
- numberOfYears = params.numberOfYears;
-
-
- var firstTickValue = firstVal.minYear;
- var firstTickPosition = 0;
- var dt = new _DateTime2.default(this.ctx);
-
- var unit = 'year';
-
- if (firstVal.minDate > 1 && firstVal.minMonth > 0) {
- var remainingDays = dt.determineRemainingDaysOfYear(firstVal.minYear, firstVal.minMonth, firstVal.minDate);
-
- // remainingDaysofFirstMonth is used to reacht the 2nd tick position
- var remainingDaysOfFirstYear = dt.determineDaysOfYear(firstVal.minYear) - remainingDays + 1;
-
- // calculate the first tick position
- firstTickPosition = remainingDaysOfFirstYear * daysWidthOnXAxis;
- firstTickValue = firstVal.minYear + 1;
- // push the first tick in the array
- this.timeScaleArray.push({ position: firstTickPosition, value: firstTickValue, unit: unit, year: firstTickValue, month: this.monthMod(currentMonth + 1) });
- } else if (firstVal.minDate === 1 && firstVal.minMonth === 0) {
- // push the first tick in the array
- this.timeScaleArray.push({ position: firstTickPosition, value: firstTickValue, unit: unit, year: currentYear, month: this.monthMod(currentMonth + 1) });
- }
-
- var year = firstTickValue;
- var pos = firstTickPosition;
-
- // keep drawing rest of the ticks
- for (var i = 0; i < numberOfYears; i++) {
- year++;
- pos = dt.determineDaysOfYear(year - 1) * daysWidthOnXAxis + pos;
- this.timeScaleArray.push({ position: pos, value: year, unit: unit, year: year, month: 1 });
- }
- }
- }, {
- key: 'generateMonthScale',
- value: function generateMonthScale(params) {
- var firstVal = params.firstVal,
- currentMonthDate = params.currentMonthDate,
- currentMonth = params.currentMonth,
- currentYear = params.currentYear,
- daysWidthOnXAxis = params.daysWidthOnXAxis,
- numberOfMonths = params.numberOfMonths;
-
-
- var firstTickValue = currentMonth;
- var firstTickPosition = 0;
- var dt = new _DateTime2.default(this.ctx);
- var unit = 'month';
- var yrCounter = 0;
-
- if (firstVal.minDate > 1) {
- // remainingDaysofFirstMonth is used to reacht the 2nd tick position
- var remainingDaysOfFirstMonth = dt.determineDaysOfMonths(currentMonth + 1, firstVal.minYear) - currentMonthDate + 1;
-
- // calculate the first tick position
- firstTickPosition = remainingDaysOfFirstMonth * daysWidthOnXAxis;
- firstTickValue = this.monthMod(currentMonth + 1);
-
- var year = currentYear + yrCounter;
- var _month = this.monthMod(firstTickValue);
- var value = firstTickValue;
- // it's Jan, so update the year
- if (firstTickValue === 0) {
- unit = 'year';
- value = year;
- _month = 1;
- yrCounter += 1;
- year = year + yrCounter;
- }
-
- // push the first tick in the array
- this.timeScaleArray.push({ position: firstTickPosition, value: value, unit: unit, year: year, month: _month });
- } else {
- // push the first tick in the array
- this.timeScaleArray.push({ position: firstTickPosition, value: firstTickValue, unit: unit, year: currentYear, month: this.monthMod(currentMonth) });
- }
-
- var month = firstTickValue + 1;
- var pos = firstTickPosition;
-
- // keep drawing rest of the ticks
- for (var i = 0, j = 1; i < numberOfMonths; i++, j++) {
- month = this.monthMod(month);
-
- if (month === 0) {
- unit = 'year';
- yrCounter += 1;
- } else {
- unit = 'month';
- }
- var _year = currentYear + Math.floor(month / 12) + yrCounter;
-
- pos = dt.determineDaysOfMonths(month, _year) * daysWidthOnXAxis + pos;
- var monthVal = month === 0 ? _year : month;
- this.timeScaleArray.push({ position: pos, value: monthVal, unit: unit, year: _year, month: month === 0 ? 1 : month });
- month++;
- }
- }
- }, {
- key: 'generateDayScale',
- value: function generateDayScale(params) {
- var firstVal = params.firstVal,
- currentMonth = params.currentMonth,
- currentYear = params.currentYear,
- hoursWidthOnXAxis = params.hoursWidthOnXAxis,
- numberOfDays = params.numberOfDays;
-
-
- var dt = new _DateTime2.default(this.ctx);
-
- var unit = 'day';
- var yrCounter = 0;
-
- var changeMonth = function changeMonth(dateVal, month, year) {
- var monthdays = dt.determineDaysOfMonths(month + 1, year);
-
- if (dateVal > monthdays) {
- month = month + 1;
- date = 1;
- unit = 'month';
- return month;
- }
-
- return month;
- };
-
- var remainingHours = 24 - firstVal.minHour;
-
- // calculate the first tick position
- var firstTickPosition = remainingHours * hoursWidthOnXAxis;
- var firstTickValue = firstVal.minDate + 1;
-
- var date = firstTickValue;
- var month = changeMonth(date, currentMonth, currentYear);
-
- // push the first tick in the array
- this.timeScaleArray.push({ position: firstTickPosition, value: firstTickValue, unit: unit, year: currentYear, month: this.monthMod(month) });
-
- var pos = firstTickPosition;
- // keep drawing rest of the ticks
- for (var i = 0; i < numberOfDays; i++) {
- date += 1;
- unit = 'day';
- month = changeMonth(date, month, currentYear + Math.floor(month / 12) + yrCounter);
-
- var year = currentYear + Math.floor(month / 12) + yrCounter;
-
- pos = 24 * hoursWidthOnXAxis + pos;
- var val = date === 1 ? this.monthMod(month) : date;
- this.timeScaleArray.push({ position: pos, value: val, unit: unit, year: year, month: this.monthMod(month) });
- }
- }
- }, {
- key: 'generateHourScale',
- value: function generateHourScale(params) {
- var firstVal = params.firstVal,
- currentDate = params.currentDate,
- currentMonth = params.currentMonth,
- currentYear = params.currentYear,
- minutesWidthOnXAxis = params.minutesWidthOnXAxis,
- numberOfHours = params.numberOfHours;
-
-
- var dt = new _DateTime2.default(this.ctx);
-
- var yrCounter = 0;
- var unit = 'hour';
-
- var changeDate = function changeDate(dateVal, month) {
- var monthdays = dt.determineDaysOfMonths(month + 1, currentYear);
- if (dateVal > monthdays) {
- date = 1;
- month = month + 1;
- }
- return {
- month: month,
- date: date
- };
- };
-
- var changeMonth = function changeMonth(dateVal, month) {
- var monthdays = dt.determineDaysOfMonths(month + 1, currentYear);
- if (dateVal > monthdays) {
- month = month + 1;
- return month;
- }
-
- return month;
- };
-
- var remainingMins = 60 - firstVal.minMinute;
-
- var firstTickPosition = remainingMins * minutesWidthOnXAxis;
- var firstTickValue = firstVal.minHour + 1;
- var hour = firstTickValue + 1;
-
- var date = currentDate;
-
- var month = changeMonth(date, currentMonth);
-
- // push the first tick in the array
- this.timeScaleArray.push({ position: firstTickPosition, value: firstTickValue, unit: unit, day: date, year: currentYear, month: this.monthMod(month) });
-
- var pos = firstTickPosition;
- // keep drawing rest of the ticks
- for (var i = 0; i < numberOfHours; i++) {
- unit = 'hour';
-
- if (hour >= 24) {
- hour = 0;
- date += 1;
- unit = 'day';
-
- var checkNextMonth = changeDate(date, month);
-
- month = checkNextMonth.month;
- month = changeMonth(date, month);
- }
-
- var year = currentYear + Math.floor(month / 12) + yrCounter;
- pos = 60 * minutesWidthOnXAxis + pos;
- var val = hour === 0 ? date : hour;
- this.timeScaleArray.push({ position: pos, value: val, unit: unit, day: date, year: year, month: this.monthMod(month) });
-
- hour++;
- }
- }
- }, {
- key: 'formatDates',
- value: function formatDates(filteredTimeScale) {
- var _this2 = this;
-
- var w = this.w;
-
- var reformattedTimescaleArray = filteredTimeScale.map(function (ts) {
- var value = ts.value.toString();
-
- var dt = new _DateTime2.default(_this2.ctx);
-
- var dateString = ts.year;
- dateString += '-' + ('0' + ts.month.toString()).slice(-2);
- dateString += ts.unit === 'day' ? '-' + ('0' + value).slice(-2) : '-01';
- dateString += ts.unit === 'hour' ? 'T' + ('0' + value).slice(-2) + ':00:00' : 'T00:00:00';
- dateString = new Date(Date.parse(dateString));
-
- if (w.config.xaxis.labels.format === undefined) {
- var customFormat = 'dd MMM';
- var dtFormatter = w.config.xaxis.labels.datetimeFormatter;
- if (ts.unit === 'year') customFormat = dtFormatter.year;
- if (ts.unit === 'month') customFormat = dtFormatter.month;
- if (ts.unit === 'day') customFormat = dtFormatter.day;
- if (ts.unit === 'hour') customFormat = dtFormatter.hour;
-
- value = dt.formatDate(dateString, customFormat);
- } else {
- value = dt.formatDate(dateString, w.config.xaxis.labels.format);
- }
-
- return {
- position: ts.position,
- value: value,
- unit: ts.unit,
- year: ts.year,
- month: ts.month
- };
- });
-
- return reformattedTimescaleArray;
- }
- }, {
- key: 'removeOverlappingTS',
- value: function removeOverlappingTS(arr) {
- var graphics = new _Graphics2.default(this.ctx);
- var lastDrawnIndex = 0;
-
- var filteredArray = arr.map(function (item, index) {
- if (index > 0) {
- var prevLabelWidth = graphics.getTextRects(arr[lastDrawnIndex].value).width;
- var prevPos = arr[lastDrawnIndex].position;
- var pos = item.position;
-
- if (pos > prevPos + prevLabelWidth + 10) {
- lastDrawnIndex = index;
- return item;
- } else {
- return null;
- }
- } else {
- return item;
- }
- });
-
- filteredArray = filteredArray.filter(function (f) {
- return f !== null;
- });
-
- return filteredArray;
- }
-
- // If month counter exceeds 12, it starts again from 1
-
- }, {
- key: 'monthMod',
- value: function monthMod(month) {
- return month % 12;
- }
- }]);
-
- return TimeScale;
-}();
-
-exports.default = TimeScale;
-
-/***/ }),
-/* 56 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-var _Exports = __webpack_require__(106);
-
-var _Exports2 = _interopRequireDefault(_Exports);
-
-var _icoPanHand = __webpack_require__(134);
-
-var _icoPanHand2 = _interopRequireDefault(_icoPanHand);
-
-var _icoZoomIn = __webpack_require__(137);
-
-var _icoZoomIn2 = _interopRequireDefault(_icoZoomIn);
-
-var _icoHome = __webpack_require__(132);
-
-var _icoHome2 = _interopRequireDefault(_icoHome);
-
-var _icoPlus = __webpack_require__(135);
-
-var _icoPlus2 = _interopRequireDefault(_icoPlus);
-
-var _icoMinus = __webpack_require__(133);
-
-var _icoMinus2 = _interopRequireDefault(_icoMinus);
-
-var _icoSelect = __webpack_require__(136);
-
-var _icoSelect2 = _interopRequireDefault(_icoSelect);
-
-var _icoCamera = __webpack_require__(131);
-
-var _icoCamera2 = _interopRequireDefault(_icoCamera);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Toolbar Class for creating toolbar in axis based charts.
- *
- * @module Toolbar
- **/
-
-var Toolbar = function () {
- function Toolbar(ctx) {
- _classCallCheck(this, Toolbar);
-
- this.ctx = ctx;
- this.w = ctx.w;
- }
-
- _createClass(Toolbar, [{
- key: 'createToolbar',
- value: function createToolbar() {
- var w = this.w;
-
- this.elToolbarWrap = document.createElement('div');
- this.elToolbarWrap.setAttribute('class', 'apexcharts-toolbar');
- w.globals.dom.elWrap.appendChild(this.elToolbarWrap);
-
- this.elZoom = document.createElement('div');
- this.elZoomIn = document.createElement('div');
- this.elZoomOut = document.createElement('div');
- this.elPan = document.createElement('div');
- this.elSelection = document.createElement('div');
- this.elZoomReset = document.createElement('div');
- this.elCamera = document.createElement('div');
-
- var toolbarControls = [];
- if (w.config.chart.toolbar.tools.download) {
- toolbarControls.push({
- el: this.elCamera,
- icon: _icoCamera2.default,
- title: 'Download SVG',
- class: 'apexcharts-download-icon'
- });
- }
-
- if (w.config.chart.toolbar.tools.selection) {
- toolbarControls.push({
- el: this.elSelection,
- icon: _icoSelect2.default,
- title: 'Select',
- class: 'apexcharts-selection-icon'
- });
- }
-
- if (w.config.chart.toolbar.tools.zoomin && w.config.chart.zoom.enabled) {
- toolbarControls.push({
- el: this.elZoomIn,
- icon: _icoPlus2.default,
- title: 'Zoom In',
- class: 'apexcharts-zoom-in-icon'
- });
- }
-
- if (w.config.chart.toolbar.tools.zoomout && w.config.chart.zoom.enabled) {
- toolbarControls.push({
- el: this.elZoomOut,
- icon: _icoMinus2.default,
- title: 'Zoom Out',
- class: 'apexcharts-zoom-out-icon'
- });
- }
-
- if (w.config.chart.toolbar.tools.zoom && w.config.chart.zoom.enabled) {
- toolbarControls.push({
- el: this.elZoom,
- icon: _icoZoomIn2.default,
- title: 'Zoom',
- class: 'apexcharts-zoom-icon'
- });
- }
-
- if (w.config.chart.toolbar.tools.pan && (w.config.chart.zoom.enabled || w.config.chart.scroller.enabled)) {
- toolbarControls.push({
- el: this.elPan,
- icon: _icoPanHand2.default,
- title: 'Panning',
- class: 'apexcharts-pan-icon'
- });
- }
-
- if (w.config.chart.toolbar.tools.reset) {
- toolbarControls.push({
- el: this.elZoomReset,
- icon: _icoHome2.default,
- title: 'Reset Zoom',
- class: 'apexcharts-reset-zoom-icon'
- });
- }
-
- for (var i = 0; i < toolbarControls.length; i++) {
- _Graphics2.default.setAttrs(toolbarControls[i].el, {
- class: toolbarControls[i].class,
- title: toolbarControls[i].title
- });
- toolbarControls[i].el.innerHTML = toolbarControls[i].icon;
- this.elToolbarWrap.appendChild(toolbarControls[i].el);
- }
-
- if (w.globals.zoomEnabled) {
- this.elZoom.classList.add('selected');
- } else if (w.globals.panEnabled) {
- this.elPan.classList.add('selected');
- } else if (w.globals.selectionEnabled) {
- this.elSelection.classList.add('selected');
- }
-
- this.addToolbarEventListeners();
- }
- }, {
- key: 'addToolbarEventListeners',
- value: function addToolbarEventListeners() {
- this.elZoomReset.addEventListener('click', this.handleZoomReset.bind(this));
- this.elSelection.addEventListener('click', this.toggleSelection.bind(this));
- this.elZoom.addEventListener('click', this.toggleZooming.bind(this));
- this.elZoomIn.addEventListener('click', this.handleZoomIn.bind(this));
- this.elZoomOut.addEventListener('click', this.handleZoomOut.bind(this));
- this.elPan.addEventListener('click', this.togglePanning.bind(this));
- this.elCamera.addEventListener('click', this.downloadSVG.bind(this));
- }
- }, {
- key: 'toggleSelection',
- value: function toggleSelection() {
- this.toggleOtherControls();
- this.w.globals.selectionEnabled = !this.w.globals.selectionEnabled;
-
- if (!this.elSelection.classList.contains('selected')) {
- this.elSelection.classList.add('selected');
- } else {
- this.elSelection.classList.remove('selected');
- }
- }
- }, {
- key: 'toggleZooming',
- value: function toggleZooming() {
- this.toggleOtherControls();
- this.w.globals.zoomEnabled = !this.w.globals.zoomEnabled;
-
- if (!this.elZoom.classList.contains('selected')) {
- this.elZoom.classList.add('selected');
- } else {
- this.elZoom.classList.remove('selected');
- }
- }
- }, {
- key: 'togglePanning',
- value: function togglePanning() {
- this.toggleOtherControls();
- this.w.globals.panEnabled = !this.w.globals.panEnabled;
-
- if (!this.elPan.classList.contains('selected')) {
- this.elPan.classList.add('selected');
- } else {
- this.elPan.classList.remove('selected');
- }
- }
- }, {
- key: 'toggleOtherControls',
- value: function toggleOtherControls() {
- var w = this.w;
- w.globals.panEnabled = false;
- w.globals.zoomEnabled = false;
- w.globals.selectionEnabled = false;
-
- this.elPan.classList.remove('selected');
- this.elSelection.classList.remove('selected');
- this.elZoom.classList.remove('selected');
- }
- }, {
- key: 'handleZoomIn',
- value: function handleZoomIn() {
- var w = this.w;
-
- var centerX = (w.globals.minX + w.globals.maxX) / 2;
- var newMinX = (w.globals.minX + centerX) / 2;
- var newMaxX = (w.globals.maxX + centerX) / 2;
-
- this.ctx.updateOptions({
- xaxis: {
- min: newMinX,
- max: newMaxX
- }
- }, false, w.globals.initialConfig.chart.animations.dynamicAnimation.enabled);
- }
- }, {
- key: 'handleZoomOut',
- value: function handleZoomOut() {
- var w = this.w;
-
- var centerX = (w.globals.minX + w.globals.maxX) / 2;
- var newMinX = w.globals.minX - (centerX - w.globals.minX);
- var newMaxX = w.globals.maxX - (centerX - w.globals.maxX);
-
- if (newMinX < w.globals.initialminX / 1.00001) {
- return;
- }
-
- this.ctx.updateOptions({
- xaxis: {
- min: newMinX,
- max: newMaxX
- }
- }, false, w.globals.initialConfig.chart.animations.dynamicAnimation.enabled);
- }
- }, {
- key: 'downloadSVG',
- value: function downloadSVG() {
- // const w = this.w
- var downloadSVG = new _Exports2.default(this.ctx);
-
- downloadSVG.exportToSVG();
- }
- }, {
- key: 'handleZoomReset',
- value: function handleZoomReset(e) {
- var w = this.w;
-
- var me = this;
- var yaxis = w.config.yaxis;
- var xaxis = w.config.xaxis;
- w.globals.zoomed = false;
-
- if (w.globals.minX === w.globals.initialminX && w.globals.maxX === w.globals.initialmaxX) return;
-
- w.config.yaxis.map(function (yaxe, index) {
- yaxis[index].min = undefined;
- yaxis[index].max = undefined;
- });
- xaxis.min = undefined;
- xaxis.max = undefined;
-
- me.ctx.updateOptions(w.globals.initialConfig, false, w.globals.initialConfig.chart.animations.dynamicAnimation.enabled);
- }
- }]);
-
- return Toolbar;
-}();
-
-module.exports = Toolbar;
-
-/***/ }),
-/* 57 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Graphics = __webpack_require__(0);
-
-var _Graphics2 = _interopRequireDefault(_Graphics);
-
-var _Series = __webpack_require__(15);
-
-var _Series2 = _interopRequireDefault(_Series);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Tooltip.Position Class to move the tooltip based on x and y position.
- *
- * @module Tooltip.Position
- **/
-
-var Position = function () {
- function Position(tooltipContext) {
- _classCallCheck(this, Position);
-
- this.ttCtx = tooltipContext;
- this.ctx = tooltipContext.ctx;
- this.w = tooltipContext.w;
- }
-
- /**
- * This will move the crosshair (the vertical/horz line that moves along with mouse)
- * Along with this, this function also calls the xaxisMove function
- * @memberof Position
- * @param {int} - cx = point's x position, wherever point's x is, you need to move crosshair
- */
-
-
- _createClass(Position, [{
- key: 'moveXCrosshairs',
- value: function moveXCrosshairs(cx) {
- var j = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
-
- var ttCtx = this.ttCtx;
- var w = this.w;
-
- var x = cx - ttCtx.xcrosshairsWidth / 2;
-
- var tickAmount = w.globals.labels.slice().length;
- if (j !== null) {
- x = w.globals.gridWidth / tickAmount * j;
- }
-
- if (w.config.xaxis.crosshairs.width === 'tickWidth' || w.config.xaxis.crosshairs.width === 'barWidth') {
- if (ttCtx.isBarShared) {
- if (x + ttCtx.xcrosshairsWidth > w.globals.gridWidth) {
- x = w.globals.gridWidth - ttCtx.xcrosshairsWidth;
- }
- } else {
- if (x + ttCtx.xcrosshairsWidth > w.globals.gridWidth) {
- x = w.globals.gridWidth - ttCtx.xcrosshairsWidth;
- }
- }
-
- if (x < 0) {
- x = 0;
- }
- } else {
- if (j !== null) {
- x = x + w.globals.gridWidth / tickAmount / 2;
- }
- }
-
- if (ttCtx.xcrosshairs !== null) {
- ttCtx.xcrosshairs.setAttribute('x', x);
- ttCtx.xcrosshairs.classList.add('active');
- }
-
- if (ttCtx.blxaxisTooltip) {
- var tx = x;
- if (w.config.xaxis.crosshairs.width === 'tickWidth' || w.config.xaxis.crosshairs.width === 'barWidth') {
- tx = x + ttCtx.xcrosshairsWidth / 2;
- }
- this.moveXAxisTooltip(tx);
- }
- }
-
- /**
- * This will move the crosshair (the vertical/horz line that moves along with mouse)
- * Along with this, this function also calls the xaxisMove function
- * @memberof Position
- * @param {int} - cx = point's x position, wherever point's x is, you need to move crosshair
- */
-
- }, {
- key: 'moveYCrosshairs',
- value: function moveYCrosshairs(cy) {
- var ttCtx = this.ttCtx;
-
- if (ttCtx.ycrosshairs !== null) {
- _Graphics2.default.setAttrs(ttCtx.ycrosshairs, {
- y1: cy,
- y2: cy
- });
-
- _Graphics2.default.setAttrs(ttCtx.ycrosshairsHidden, {
- y1: cy,
- y2: cy
- });
- }
- }
-
- /**
- ** AxisTooltip is the small rectangle which appears on x axis with x value, when user moves
- * @memberof Position
- * @param {int} - cx = point's x position, wherever point's x is, you need to move
- */
-
- }, {
- key: 'moveXAxisTooltip',
- value: function moveXAxisTooltip(cx) {
- var w = this.w;
- var ttCtx = this.ttCtx;
-
- if (ttCtx.xaxisTooltip !== null) {
- ttCtx.xaxisTooltip.classList.add('active');
-
- var cy = ttCtx.xaxisOffY + w.config.xaxis.tooltip.offsetY + w.globals.translateY + 1;
-
- var xaxisTTText = ttCtx.xaxisTooltip.getBoundingClientRect();
- var xaxisTTTextWidth = xaxisTTText.width;
-
- cx = cx - xaxisTTTextWidth / 2;
-
- if (!isNaN(cx)) {
- cx = cx + w.globals.translateX;
-
- var textRect = 0;
- var graphics = new _Graphics2.default(this.ctx);
- textRect = graphics.getTextRects(ttCtx.xaxisTooltipText.innerHTML);
-
- ttCtx.xaxisTooltipText.style.minWidth = textRect.width + 'px';
- ttCtx.xaxisTooltip.style.left = cx + 'px';
- ttCtx.xaxisTooltip.style.top = cy + 'px';
- }
- }
- }
- }, {
- key: 'moveYAxisTooltip',
- value: function moveYAxisTooltip(index) {
- var w = this.w;
- var ttCtx = this.ttCtx;
-
- if (ttCtx.yaxisTTEls === null) {
- ttCtx.yaxisTTEls = w.globals.dom.baseEl.querySelectorAll('.apexcharts-yaxistooltip');
- }
-
- var ycrosshairsHiddenRect = parseInt(ttCtx.ycrosshairsHidden.getAttribute('y1'));
- var cy = w.globals.translateY + ycrosshairsHiddenRect;
-
- var yAxisTTRect = ttCtx.yaxisTTEls[index].getBoundingClientRect();
- var yAxisTTHeight = yAxisTTRect.height;
- var cx = w.globals.translateYAxisX[index] - 2;
-
- if (w.config.yaxis[index].opposite) {
- cx = cx - 26;
- }
-
- cy = cy - yAxisTTHeight / 2;
-
- if (!w.globals.ignoreYAxisIndexes.includes(index)) {
- ttCtx.yaxisTTEls[index].classList.add('active');
- ttCtx.yaxisTTEls[index].style.top = cy + 'px';
- ttCtx.yaxisTTEls[index].style.left = cx + w.config.yaxis[index].tooltip.offsetX + 'px';
- } else {
- ttCtx.yaxisTTEls[index].classList.remove('active');
- }
- }
-
- /**
- ** moves the whole tooltip by changing x, y attrs
- * @memberof Position
- * @param {int} - cx = point's x position, wherever point's x is, you need to move tooltip
- * @param {int} - cy = point's y position, wherever point's y is, you need to move tooltip
- * @param {int} - r = point's radius
- */
-
- }, {
- key: 'moveTooltip',
- value: function moveTooltip(cx, cy) {
- var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
-
- var w = this.w;
-
- var ttCtx = this.ttCtx;
- var tooltipRect = ttCtx.tooltipRect;
-
- var pointR = r !== null ? parseInt(r) : 1;
-
- var x = parseInt(cx) + pointR + 5;
- var y = parseInt(cy) + pointR / 2; // - tooltipRect.ttHeight / 2
-
- if (x > w.globals.gridWidth / 2) {
- x = x - tooltipRect.ttWidth - pointR - 15;
- }
-
- if (x > w.globals.gridWidth - tooltipRect.ttWidth - 10) {
- x = w.globals.gridWidth - tooltipRect.ttWidth;
- }
-
- if (x < -20) {
- x = -20;
- }
-
- if (w.config.tooltip.followCursor) {
- y = ttCtx.e.clientY - ttCtx.seriesBound.top - tooltipRect.ttHeight / 2;
- }
-
- if (tooltipRect.ttHeight + y > w.globals.gridHeight) {
- y = w.globals.gridHeight - tooltipRect.ttHeight / 2 - pointR;
- }
-
- if (!isNaN(x)) {
- x = x + w.globals.translateX;
-
- ttCtx.tooltip.style.left = x + 'px';
- ttCtx.tooltip.style.top = y + 'px';
- }
- }
- }, {
- key: 'moveMarkers',
- value: function moveMarkers(i, j) {
- var w = this.w;
- var ttCtx = this.ttCtx;
-
- if (w.config.markers.size > 0) {
- var allPoints = w.globals.dom.baseEl.querySelectorAll(' .apexcharts-series[data\\:realIndex=\'' + i + '\'] .apexcharts-marker');
- for (var p = 0; p < allPoints.length; p++) {
- if (parseInt(allPoints[p].getAttribute('rel')) === j) {
- ttCtx.marker.resetPointsSize();
- ttCtx.marker.enlargeCurrentPoint(j, allPoints[p]);
- }
- }
- } else {
- ttCtx.marker.resetPointsSize();
- this.moveDynamicPointOnHover(j, i);
- }
- }
-
- // This function is used when you need to show points only on hover -
- // DIFFERENT X VALUES in multiple series
-
- }, {
- key: 'moveDynamicPointOnHover',
- value: function moveDynamicPointOnHover(j, capturedSeries) {
- var w = this.w;
- var ttCtx = this.ttCtx;
- var cx = 0;
- var cy = 0;
-
- var pointsArr = w.globals.pointsArray;
-
- var hoverSize = w.config.markers.hover.size;
- cx = pointsArr[capturedSeries][j][0];
- cy = pointsArr[capturedSeries][j][1] ? pointsArr[capturedSeries][j][1] : 0;
-
- var point = w.globals.dom.baseEl.querySelector('.apexcharts-series[data\\:realIndex=\'' + capturedSeries + '\'] .apexcharts-series-markers circle');
-
- point.setAttribute('r', hoverSize);
-
- point.setAttribute('cx', cx);
- point.setAttribute('cy', cy);
- // point.style.opacity = w.config.markers.hover.opacity
-
- this.moveXCrosshairs(cx);
-
- if (!ttCtx.fixedTooltip) {
- this.moveTooltip(cx, cy, hoverSize);
- }
- }
-
- // This function is used when you need to show markers/points only on hover -
- // SAME X VALUES in multiple series
-
- }, {
- key: 'moveDynamicPointsOnHover',
- value: function moveDynamicPointsOnHover(j) {
- var ttCtx = this.ttCtx;
- var w = ttCtx.w;
- var cx = 0;
- var cy = 0;
- var activeSeries = 0;
-
- var pointsArr = w.globals.pointsArray;
-
- var series = new _Series2.default(this.ctx);
- activeSeries = series.getActiveSeriesIndex();
-
- var hoverSize = w.config.markers.hover.size;
- if (pointsArr[activeSeries]) {
- cx = pointsArr[activeSeries][j][0];
- cy = pointsArr[activeSeries][j][1];
- }
-
- var points = null;
- if (ttCtx.allPoints !== null) {
- points = ttCtx.allPoints;
- } else {
- points = w.globals.dom.baseEl.querySelectorAll('.apexcharts-series-markers circle');
- }
-
- if (points !== null) {
- for (var p = 0; p < points.length; p++) {
- var pointArr = pointsArr[p];
-
- if (pointArr && pointArr.length && typeof pointArr !== 'undefined') {
- var pcy = pointsArr[p][j][1];
- points[p].setAttribute('cx', cx);
- var realIndex = parseInt(points[p].parentNode.parentNode.parentNode.getAttribute('data:realIndex'));
-
- if (pcy !== null) {
- points[realIndex] && points[realIndex].setAttribute('r', hoverSize);
- points[realIndex] && points[realIndex].setAttribute('cy', pcy);
- } else {
- points[realIndex] && points[realIndex].setAttribute('r', 0);
- }
- }
- }
- }
-
- this.moveXCrosshairs(cx);
-
- if (!ttCtx.fixedTooltip) {
- var tcy = cy || w.globals.gridHeight;
- this.moveTooltip(cx, tcy, hoverSize);
- }
- }
- }, {
- key: 'moveStickyTooltipOverBars',
- value: function moveStickyTooltipOverBars(j) {
- var w = this.w;
- var ttCtx = this.ttCtx;
-
- var jBar = w.globals.dom.baseEl.querySelector('.apexcharts-bar-series .apexcharts-series[rel=\'1\'] path[j=\'' + j + '\']');
-
- var bcx = jBar ? parseFloat(jBar.getAttribute('cx')) : 0;
- var bcy = 0;
- var bw = jBar ? parseFloat(jBar.getAttribute('barWidth')) : 0;
-
- if (w.globals.dataXY) {
- bcx = bcx - bw / 2;
- } else {
- bcx = ttCtx.xAxisTicksPositions[j - 1] + ttCtx.dataPointsDividedWidth / 2;
- if (Number.isNaN(bcx)) {
- bcx = ttCtx.xAxisTicksPositions[j] - ttCtx.dataPointsDividedWidth / 2;
- }
- }
-
- // tooltip will move vertically along with mouse as it is a shared tooltip
- var elGrid = w.globals.dom.baseEl.querySelector('.apexcharts-grid');
- var seriesBound = elGrid.getBoundingClientRect();
-
- bcy = ttCtx.e.clientY - seriesBound.top - ttCtx.tooltipRect.ttHeight / 2;
-
- this.moveXCrosshairs(bcx);
-
- if (!ttCtx.fixedTooltip) {
- var tcy = bcy || w.globals.gridHeight;
- this.moveTooltip(bcx, tcy);
- }
- }
- }]);
-
- return Position;
-}();
-
-module.exports = Position;
-
-/***/ }),
-/* 58 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Tooltip.Utils Class to support Tooltip functionality.
- *
- * @module Tooltip.Utils
- **/
-
-var Utils = function () {
- function Utils(tooltipContext) {
- _classCallCheck(this, Utils);
-
- this.w = tooltipContext.w;
- this.ttCtx = tooltipContext;
- this.ctx = tooltipContext.ctx;
- }
-
- /**
- ** When hovering over series, you need to capture which series is being hovered on.
- ** This function will return both capturedseries index as well as inner index of that series
- * @memberof Utils
- * @param {object}
- * - context = chart's context
- * - hoverArea = the rect on which user hovers
- * - elGrid = dimensions of the hover rect (it can be different than hoverarea)
- * - lineSeriesWidth = Whatever series the user hovered on, get the width of it
- * @return {object}
- * - capturedSeries = i
- * - j is the inner index of the capturedSeries
- */
-
-
- _createClass(Utils, [{
- key: 'getNearestValues',
- value: function getNearestValues(_ref) {
- var context = _ref.context,
- hoverArea = _ref.hoverArea,
- elGrid = _ref.elGrid,
- clientX = _ref.clientX,
- clientY = _ref.clientY,
- plotSeriesWidth = _ref.plotSeriesWidth,
- hasBars = _ref.hasBars;
-
- var w = this.w;
-
- var hoverWidth = w.globals.gridWidth; // - (w.globals.gridWidth - plotSeriesWidth)
-
- var xDivisor = hoverWidth / (w.globals.dataPoints - 1);
-
- var seriesBound = elGrid.getBoundingClientRect();
-
- if (hasBars && w.globals.comboCharts || hasBars) {
- xDivisor = hoverWidth / w.globals.dataPoints;
- }
-
- var hoverX = clientX - seriesBound.left;
- var hoverY = clientY - seriesBound.top;
-
- var inRect = hoverX < 0 || hoverY < 0 || hoverX > w.globals.gridWidth || hoverY > w.globals.gridHeight;
-
- if (inRect) {
- hoverArea.classList.remove('hovering-zoom');
- hoverArea.classList.remove('hovering-pan');
- } else {
- if (w.globals.zoomEnabled) {
- hoverArea.classList.remove('hovering-pan');
- hoverArea.classList.add('hovering-zoom');
- } else if (w.globals.panEnabled) {
- hoverArea.classList.remove('hovering-zoom');
- hoverArea.classList.add('hovering-pan');
- }
- }
-
- var j = Math.round(hoverX / xDivisor);
-
- if (hasBars) {
- j = Math.ceil(hoverX / xDivisor);
- j = j - 1;
- }
-
- var capturedSeries = null;
- var closest = null;
- var seriesXValArr = [];
- var seriesYValArr = [];
-
- for (var s = 0; s < w.globals.seriesXvalues.length; s++) {
- seriesXValArr.push([w.globals.seriesXvalues[s][0] - 0.000001].concat(w.globals.seriesXvalues[s]));
- }
-
- seriesXValArr = seriesXValArr.map(function (seriesXVal) {
- return seriesXVal.filter(function (s) {
- return s;
- });
- });
-
- seriesYValArr = w.globals.seriesYvalues.map(function (seriesYVal) {
- return seriesYVal.filter(function (s) {
- return s;
- });
- });
-
- // if X axis type is not category and tooltip is not shared, then we need to find the cursor position and get the nearest value
- if (w.globals.dataXY) {
- closest = this.closestInMultiArray(hoverX, hoverY, seriesXValArr, seriesYValArr);
- capturedSeries = closest.index;
- j = closest.j;
-
- if (capturedSeries !== null) {
- // initial push, it should be a little smaller than the 1st val
- seriesXValArr = w.globals.seriesXvalues[capturedSeries];
-
- closest = this.closestInArray(hoverX, seriesXValArr);
-
- j = closest.index;
- }
- }
-
- if (!j || j < 1) j = 0;
-
- return {
- capturedSeries: capturedSeries,
- j: j,
- hoverX: hoverX,
- hoverY: hoverY
- };
- }
- }, {
- key: 'closestInMultiArray',
- value: function closestInMultiArray(hoverX, hoverY, Xarrays, Yarrays) {
- var w = this.w;
- var activeIndex = 0;
- var currIndex = null;
- var j = -1;
-
- if (w.globals.series.length > 1) {
- activeIndex = this.getFirstActiveXArray(Xarrays);
- } else {
- currIndex = 0;
- }
-
- var currY = Yarrays[activeIndex][0];
- var currX = Xarrays[activeIndex][0];
-
- var diffX = Math.abs(hoverX - currX);
- var diffY = Math.abs(hoverY - currY);
- var diff = diffY + diffX;
-
- Yarrays.map(function (arrY, arrIndex) {
- arrY.map(function (y, innerKey) {
- var newdiffY = Math.abs(hoverY - Yarrays[arrIndex][innerKey]);
- var newdiffX = Math.abs(hoverX - Xarrays[arrIndex][innerKey]);
- var newdiff = newdiffX + newdiffY;
-
- if (newdiff < diff) {
- diff = newdiff;
- diffX = newdiffX;
- diffY = newdiffY;
- currIndex = arrIndex;
- j = innerKey;
- }
- });
- });
-
- return {
- index: currIndex,
- j: j
- };
- }
- }, {
- key: 'getFirstActiveXArray',
- value: function getFirstActiveXArray(Xarrays) {
- var activeIndex = 0;
-
- var firstActiveSeriesIndex = Xarrays.map(function (xarr, index) {
- if (xarr.length > 0) {
- return index;
- } else {
- return -1;
- }
- });
-
- for (var a = 0; a < firstActiveSeriesIndex.length; a++) {
- if (firstActiveSeriesIndex[a] !== -1) {
- activeIndex = firstActiveSeriesIndex[a];
- break;
- }
- }
-
- return activeIndex;
- }
- }, {
- key: 'closestInArray',
- value: function closestInArray(val, arr) {
- var curr = arr[0];
- var currIndex = null;
- var diff = Math.abs(val - curr);
-
- for (var i = 0; i < arr.length; i++) {
- var newdiff = Math.abs(val - arr[i]);
- if (newdiff < diff) {
- diff = newdiff;
- curr = arr[i];
- currIndex = i;
- }
- }
-
- return {
- index: currIndex
- };
- }
-
- /**
- * When there are multiple series, it is possible to have different x values for each series.
- * But it may be possible in those multiple series, that there is same x value for 2 or more
- * series.
- * @memberof Utils
- * @param {int}
- * - j = is the inner index of series -> (series[i][j])
- * @return {bool}
- */
-
- }, {
- key: 'isXoverlap',
- value: function isXoverlap(j) {
- var w = this.w;
- var xSameForAllSeriesJArr = [];
-
- var seriesX = w.globals.seriesX.filter(function (s) {
- return typeof s[0] !== 'undefined';
- });
-
- if (seriesX.length > 0) {
- for (var i = 0; i < seriesX.length - 1; i++) {
- if (typeof seriesX[i][j] !== 'undefined' && typeof seriesX[i + 1][j] !== 'undefined') {
- if (seriesX[i][j] !== seriesX[i + 1][j]) {
- xSameForAllSeriesJArr.push('unEqual');
- }
- }
- }
- }
-
- if (xSameForAllSeriesJArr.length === 0) {
- return true;
- }
-
- return false;
- }
- }, {
- key: 'isinitialSeriesSameLen',
- value: function isinitialSeriesSameLen() {
- var sameLen = true;
-
- var initialSeries = this.w.globals.initialSeries;
-
- for (var i = 0; i < initialSeries.length - 1; i++) {
- if (initialSeries[i].data.length !== initialSeries[i + 1].data.length) {
- sameLen = false;
- break;
- }
- }
-
- return sameLen;
- }
- }, {
- key: 'isSeriesSameLen',
- value: function isSeriesSameLen() {
- var sameLen = true;
-
- var filteredSerX = this.filteredSeriesX();
-
- for (var i = 0; i < filteredSerX.length - 1; i++) {
- if (filteredSerX[i][0] !== filteredSerX[i + 1][0]) {
- sameLen = false;
- break;
- }
- }
-
- return sameLen;
- }
- }, {
- key: 'filteredSeriesX',
- value: function filteredSeriesX() {
- var w = this.w;
-
- var filteredSeriesX = w.globals.seriesX.map(function (ser, index) {
- if (ser.length > 0) {
- return ser;
- } else {
- return [];
- }
- });
-
- return filteredSeriesX;
- }
- }, {
- key: 'getBarsHeight',
- value: function getBarsHeight(allbars) {
- var bars = [].concat(_toConsumableArray(allbars));
- var totalHeight = bars.reduce(function (acc, bar) {
- return acc + bar.getBBox().height;
- }, 0);
-
- return totalHeight;
- }
- }, {
- key: 'toggleAllTooltipSeriesGroups',
- value: function toggleAllTooltipSeriesGroups(state) {
- var w = this.w;
- var ttCtx = this.ttCtx;
-
- if (ttCtx.allTooltipSeriesGroups.length === 0) {
- ttCtx.allTooltipSeriesGroups = w.globals.dom.baseEl.querySelectorAll('.apexcharts-tooltip-series-group');
- }
-
- var allTooltipSeriesGroups = ttCtx.allTooltipSeriesGroups;
- for (var i = 0; i < allTooltipSeriesGroups.length; i++) {
- if (state === 'enable') {
- allTooltipSeriesGroups[i].classList.add('active');
- allTooltipSeriesGroups[i].style.display = w.config.tooltip.items.display;
- } else {
- allTooltipSeriesGroups[i].classList.remove('active');
- allTooltipSeriesGroups[i].style.display = 'none';
- }
- }
- }
- }]);
-
- return Utils;
-}();
-
-module.exports = Utils;
-
-/***/ }),
-/* 59 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _Defaults = __webpack_require__(120);
-
-var _Defaults2 = _interopRequireDefault(_Defaults);
-
-var _Utils = __webpack_require__(1);
-
-var _Utils2 = _interopRequireDefault(_Utils);
-
-var _Options = __webpack_require__(60);
-
-var _Options2 = _interopRequireDefault(_Options);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Config Class for extending user options with pre-defined ApexCharts config.
- *
- * @module Config
- **/
-var Config = function () {
- function Config(opts) {
- _classCallCheck(this, Config);
-
- this.opts = opts;
- }
-
- _createClass(Config, [{
- key: 'init',
- value: function init() {
- var opts = this.opts;
- var options = new _Options2.default();
- var defaults = new _Defaults2.default(opts);
-
- if (typeof opts.yaxis === 'undefined') {
- opts.yaxis = {};
- }
-
- this.chartType = opts.chart.type;
-
- if (this.chartType === 'histogram') {
- opts.chart.type = 'bar';
- opts = _Utils2.default.extend({
- plotOptions: {
- bar: {
- columnWidth: '99.99%'
- }
- }
- }, opts);
- }
-
- if (typeof opts.annotations === 'undefined') {
- opts.annotations = {};
- opts.annotations.yaxis = [];
- opts.annotations.xaxis = [];
- }
-
- var extendArray = function extendArray(arrToExtend, resultArr) {
- var extendedArr = [];
- arrToExtend.map(function (item) {
- extendedArr.push(_Utils2.default.extend(resultArr, item));
- });
- arrToExtend = extendedArr;
- return arrToExtend;
- };
-
- // as we can't extend nested object's array with extend, we need to do it first
- // user can provide either an array or object in yaxis config
- if (opts.yaxis.constructor !== Array) {
- // convert the yaxis to array if user supplied object
- opts.yaxis = [_Utils2.default.extend(_Options.yAxis, opts.yaxis)];
- } else {
- opts.yaxis = extendArray(opts.yaxis, _Options.yAxis);
- }
-
- // annotations also accepts array, so we need to extend them manually
- opts.annotations.xaxis = extendArray(typeof opts.annotations.xaxis !== 'undefined' ? opts.annotations.xaxis : [], _Options.xAxisAnnotation);
- opts.annotations.yaxis = extendArray(typeof opts.annotations.yaxis !== 'undefined' ? opts.annotations.yaxis : [], _Options.yAxisAnnotation);
- opts.annotations.points = extendArray(typeof opts.annotations.points !== 'undefined' ? opts.annotations.points : [], _Options.pointAnnotation);
-
- var config = options.init();
- var newDefaults = {};
- if (opts && (typeof opts === 'undefined' ? 'undefined' : _typeof(opts)) === 'object') {
- var chartDefaults = {};
- switch (this.chartType) {
- case 'line':
- chartDefaults = defaults.line();
- break;
- case 'area':
- chartDefaults = defaults.area();
- break;
- case 'bar':
- chartDefaults = defaults.bar();
- break;
- case 'histogram':
- chartDefaults = defaults.bar();
- break;
- case 'bubble':
- chartDefaults = defaults.bubble();
- break;
- case 'scatter':
- chartDefaults = defaults.scatter();
- break;
- case 'heatmap':
- chartDefaults = defaults.heatmap();
- break;
- case 'pie':
- chartDefaults = defaults.pie();
- break;
- case 'donut':
- chartDefaults = defaults.donut();
- break;
- case 'radialBar':
- chartDefaults = defaults.radialBar();
- break;
- default:
- chartDefaults = defaults.line();
- }
-
- if (opts.chart.stacked && opts.chart.stackType === '100%') {
- defaults.stacked100();
- }
- newDefaults = _Utils2.default.extend(config, chartDefaults);
- }
-
- // config should override in this fashion
- // default config < global apex variable config < user defined config
-
- // get GLOBALLY defined options and merge with the default config
- var mergedWithDefaultConfig = _Utils2.default.extend(newDefaults, window.Apex);
-
- // get the merged config and extend with user defined config
- config = _Utils2.default.extend(mergedWithDefaultConfig, opts);
-
- // some features are not supported. those mismatches should be handled
- config = this.handleUserInputErrors(config);
-
- return config;
- }
- }, {
- key: 'handleUserInputErrors',
- value: function handleUserInputErrors(opts) {
- var config = opts;
- // conflicting tooltip option. intersect makes sure to focus on 1 point at a time. Shared cannot be used along with it
- if (config.tooltip.shared && config.tooltip.intersect) {
- throw new Error('tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false');
- }
-
- if (config.chart.type === 'bar' && config.plotOptions.bar.horizontal) {
- // No time series for horizontal bars
- if (config.xaxis.type === 'datetime') {
- throw new Error('Timelines on bars are not supported yet. Switch to column chart by setting plotOptions.bar.horizontal=false');
- }
-
- // No multiple yaxis for bars
- if (config.yaxis.length > 1) {
- throw new Error('Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false');
- }
-
- config.xaxis.tooltip.enabled = false; // no xaxis tooltip for horizontal bar
- config.yaxis[0].tooltip.enabled = false; // no xaxis tooltip for horizontal bar
- config.chart.zoom.enabled = false; // no zooming for bars
- }
-
- if (config.chart.type === 'bar') {
- if (config.tooltip.shared) {
- if (config.xaxis.crosshairs.width === 'barWidth' && config.series.length > 1) {
- console.warn('barWidth is only supported in single series, not multi-series barchart');
- config.xaxis.crosshairs.width = 'tickWidth';
- }
- if (config.plotOptions.bar.horizontal) {
- config.states.hover.type = 'none';
- }
- if (!config.tooltip.followCursor) {
- console.warn('followCursor option in shared columns cannot be turned off');
- config.tooltip.followCursor = true;
- }
- }
- }
-
- // if user supplied array for stroke width, it will only be applicable to line/area charts, for any other charts, revert back to Number
- if (Array.isArray(config.stroke.width)) {
- if (config.chart.type !== 'line' && config.chart.type !== 'area') {
- console.warn('stroke.width option accepts array only for line and area charts. Reverted back to Number');
- config.stroke.width = config.stroke.width[0];
- }
- }
-
- return config;
- }
- }]);
-
- return Config;
-}();
-
-module.exports = Config;
-
-/***/ }),
-/* 60 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/**
- * ApexCharts Options for setting the initial configuration of ApexCharts.
- **/
-
-var xAxisAnnotation = exports.xAxisAnnotation = {
- x: 0,
- strokeDashArray: 4,
- borderColor: '#c2c2c2',
- offsetX: 0,
- offsetY: 0,
- label: {
- borderColor: '#c2c2c2',
- borderWidth: 1,
- text: undefined,
- textAnchor: 'middle',
- orientation: 'vertical',
- position: 'top',
- offsetX: 0,
- offsetY: 0,
- style: {
- background: '#fff',
- color: '#777',
- fontSize: '12px',
- cssClass: 'apexcharts-xaxis-annotation-label',
- padding: {
- left: 5,
- right: 5,
- top: 2,
- bottom: 2
- }
- }
- }
-};
-
-var pointAnnotation = exports.pointAnnotation = {
- x: 0,
- y: null,
- yAxisIndex: 0,
- seriesIndex: 0,
- marker: {
- size: 0,
- fillColor: '#fff',
- strokeWidth: 2,
- strokeColor: '#333',
- shape: 'circle',
- radius: 2
- },
- label: {
- borderColor: '#c2c2c2',
- borderWidth: 1,
- text: undefined,
- textAnchor: 'middle',
- offsetX: 0,
- offsetY: -15,
- style: {
- background: '#fff',
- color: '#777',
- fontSize: '12px',
- cssClass: 'apexcharts-point-annotation-label',
- padding: {
- left: 5,
- right: 5,
- top: 0,
- bottom: 2
- }
- }
- }
-};
-
-var yAxisAnnotation = exports.yAxisAnnotation = {
- y: 0,
- strokeDashArray: 4,
- borderColor: '#c2c2c2',
- offsetX: 0,
- offsetY: 0,
- yAxisIndex: 0,
- label: {
- borderColor: '#c2c2c2',
- borderWidth: 1,
- text: undefined,
- textAnchor: 'end',
- position: 'right',
- offsetX: 0,
- offsetY: -3,
- style: {
- background: '#fff',
- color: '#777',
- fontSize: '12px',
- cssClass: 'apexcharts-yaxis-annotation-label',
- padding: {
- left: 5,
- right: 5,
- top: 0,
- bottom: 2
- }
- }
- }
-};
-
-var yAxis = exports.yAxis = {
- opposite: false,
- tickAmount: 6,
- max: undefined,
- min: undefined,
- floating: false,
- labels: {
- show: true,
- maxWidth: 160,
- offsetX: 0,
- offsetY: 0,
- style: {
- colors: [],
- fontSize: '12px',
- cssClass: 'apexcharts-yaxis-label'
- },
- formatter: function formatter(val) {
- if (typeof val === 'number') {
- return val ? val.toFixed(0) : val;
- }
- return val;
- }
- },
- axisBorder: {
- show: false,
- color: '#78909C',
- offsetX: 0,
- offsetY: 0
- },
- axisTicks: {
- show: false,
- color: '#78909C',
- width: 6,
- offsetX: 0,
- offsetY: 0
- },
- title: {
- text: undefined,
- rotate: -90,
- offsetY: 0,
- offsetX: 0,
- style: {
- color: undefined,
- fontSize: '12px',
- cssClass: 'apexcharts-yaxis-title'
- }
- },
- tooltip: {
- enabled: false,
- offsetX: 0
- },
- crosshairs: {
- show: true,
- position: 'front',
- stroke: {
- color: '#b6b6b6',
- width: 1,
- dashArray: 0
- }
- }
-};
-
-var Options = function () {
- function Options() {
- _classCallCheck(this, Options);
- }
-
- _createClass(Options, [{
- key: 'init',
- value: function init() {
- return {
- annotations: {
- position: 'front',
- yaxis: [yAxisAnnotation],
- xaxis: [xAxisAnnotation],
- points: [pointAnnotation]
- },
- chart: {
- animations: {
- enabled: true,
- easing: 'easeinout', // linear, easeout, easein, easeinout
- speed: 800,
- animateGradually: {
- delay: 150,
- enabled: true
- },
- dynamicAnimation: {
- enabled: true,
- speed: 350
- }
- },
- background: 'transparent',
- foreColor: '#373d3f',
- dropShadow: {
- enabled: false,
- enabledSeries: undefined,
- top: 2,
- left: 2,
- blur: 4,
- opacity: 0.35
- },
- events: {
- beforeMount: undefined,
- mounted: undefined,
- updated: undefined,
- clicked: undefined,
- selection: undefined,
- dataPointSelection: undefined,
- zoomed: undefined,
- scrolled: undefined
- },
- height: 'auto',
- offsetX: 0,
- offsetY: 0,
- scroller: {
- enabled: false,
- height: 30,
- track: {
- height: 2,
- background: '#e0e0e0'
- },
- thumb: {
- height: 2,
- background: '#008FFB'
- },
- scrollButtons: {
- enabled: true,
- size: 6,
- borderWidth: 2,
- borderColor: '#c3c3c3',
- fillColor: '#fff'
- },
- padding: {
- left: 10,
- right: 10
- },
- offsetX: 0,
- offsetY: 0
- },
- selection: {
- enabled: true,
- type: 'x',
- selectedPoints: undefined,
- fill: {
- color: '#24292e',
- opacity: 0.1
- },
- stroke: {
- width: 1,
- color: '#24292e',
- opacity: 0.4,
- dashArray: 3
- },
- xaxis: {
- min: undefined,
- max: undefined
- },
- yaxis: {
- min: undefined,
- max: undefined
- }
- },
- sparkline: {
- enabled: false
- },
- stacked: false,
- stackType: 'normal',
- toolbar: {
- show: true,
- tools: {
- download: true,
- selection: true,
- zoom: true,
- zoomin: true,
- zoomout: true,
- pan: true,
- reset: true
- }
- },
- type: 'line',
- width: '100%',
- zoom: {
- enabled: true,
- type: 'x',
- zoomedArea: {
- fill: {
- color: '#90CAF9',
- opacity: 0.4
- },
- stroke: {
- color: '#0D47A1',
- opacity: 0.4,
- width: 1
- }
- }
- }
- },
- plotOptions: {
- bar: {
- horizontal: false,
- endingShape: 'flat',
- columnWidth: '70%', // should be in percent 0 - 100
- barHeight: '70%', // should be in percent 0 - 100
- distributed: false,
- colors: {
- ranges: [],
- backgroundBarColors: [],
- backgroundBarOpacity: 1
- },
- dataLabels: {
- position: 'top' // top, center, bottom
-
- // stackedLabels: true
- } },
- heatmap: {
- radius: 2,
- enableShades: true,
- shadeIntensity: 0.5,
- colorScale: {
- ranges: []
- }
- },
- radialBar: {
- size: undefined,
- inverseOrder: false,
- startAngle: 0,
- endAngle: 360,
- offsetX: 0,
- offsetY: 0,
- hollow: {
- margin: 5,
- size: '50%',
- background: 'transparent',
- image: undefined,
- imageWidth: 150,
- imageHeight: 150,
- imageOffsetX: 0,
- imageOffsetY: 0,
- imageClipped: true,
- position: 'front',
- dropShadow: {
- enabled: false,
- top: 0,
- left: 0,
- blur: 3,
- opacity: 0.5
- }
- },
- track: {
- show: true,
- startAngle: undefined,
- endAngle: undefined,
- background: '#f2f2f2',
- strokeWidth: '97%',
- opacity: 1,
- margin: 5, // margin is in pixels
- dropShadow: {
- enabled: false,
- top: 0,
- left: 0,
- blur: 3,
- opacity: 0.5
- }
- },
- dataLabels: {
- showOn: 'always', // hover/always
- name: {
- show: true,
- fontSize: '22px',
- color: undefined,
- offsetY: -10
- },
- value: {
- show: true,
- fontSize: '16px',
- color: undefined,
- offsetY: 16,
- formatter: function formatter(val) {
- return val + '%';
- }
- }
- }
- },
- pie: {
- size: undefined,
- donut: {
- size: '65%',
- background: 'transparent'
- // TODO: draw labels in donut area
- // labels: {
- // showOn: 'hover',
- // name: {
- // show: false,
- // fontSize: '22px',
- // color: undefined,
- // offsetY: -10
- // },
- // value: {
- // show: true,
- // offsetY: 16,
- // fontSize: '16px',
- // color: undefined,
- // formatter: function (val) {
- // return val + '%'
- // }
- // }
- // }
- },
- customScale: 0,
- offsetX: 0,
- offsetY: 0,
- dataLabels: {
- offset: 0 // offset by which labels will move outside
- }
- }
- },
- colors: undefined,
- dataLabels: {
- enabled: true,
- formatter: function formatter(val) {
- return val;
- },
- textAnchor: 'middle',
- offsetX: 0,
- offsetY: 0,
- style: {
- fontSize: '14px',
- colors: undefined
- },
- dropShadow: {
- enabled: false,
- top: 1,
- left: 1,
- blur: 1,
- opacity: 0.45
- }
- },
- fill: {
- type: 'solid',
- colors: undefined, // array of colors,
- opacity: 0.9,
- gradient: {
- shade: 'dark',
- type: 'horizontal',
- shadeIntensity: 0.5,
- gradientToColors: undefined,
- inverseColors: true,
- opacityFrom: 1,
- opacityTo: 1,
- stops: [0, 50, 100]
- },
- image: {
- src: [],
- width: undefined, // optional
- height: undefined // optional
- },
- pattern: {
- style: 'sqaures', // string or array of strings
- width: 6,
- height: 6,
- strokeWidth: 2
- }
- },
- grid: {
- show: true,
- borderColor: '#e0e0e0',
- strokeDashArray: 0,
- position: 'back',
- xaxis: {
- lines: {
- show: false,
- animate: false
- }
- },
- yaxis: {
- lines: {
- show: true,
- animate: true
- }
- },
- row: {
- colors: undefined, // takes as array which will be repeated on rows
- opacity: 0.5
- },
- column: {
- colors: undefined, // takes an array which will be repeated on columns
- opacity: 0.5
- },
- padding: {
- top: 0,
- right: 10,
- bottom: 0,
- left: 10
- }
- },
- labels: [],
- legend: {
- show: true,
- floating: false,
- position: 'bottom', // whether to position legends in 1 of 4
- // direction - top, bottom, left, right
- horizontalAlign: 'center', // when position top/bottom, you can
- // specify whether to align legends
- // left, right or center
- verticalAlign: 'middle',
- fontSize: '14px',
- textAnchor: 'start',
- offsetY: 0,
- offsetX: 0,
- formatter: undefined,
- labels: {
- color: undefined,
- useSeriesColors: false
- },
- markers: {
- size: 6,
- strokeWidth: 0,
- strokeColor: '#fff',
- offsetX: 0,
- offsetY: 0,
- shape: 'circle',
- radius: 2
- },
- itemMargin: {
- horizontal: 20,
- vertical: 5
- },
- containerMargin: {
- left: 5,
- top: 4,
- right: 0,
- bottom: 0
- },
- onItemClick: {
- toggleDataSeries: true
- },
- onItemHover: {
- highlightDataSeries: true
- }
- },
- markers: {
- discrete: [],
- size: 0,
- colors: undefined,
- strokeColor: '#fff',
- strokeWidth: 2,
- strokeOpacity: 0.9,
- fillOpacity: 1,
- shape: 'circle',
- radius: 2,
- offsetX: 0,
- offsetY: 0,
- hover: {
- size: 6
- }
- },
- noData: {
- text: undefined,
- align: 'center',
- verticalAlign: 'middle',
- offsetX: 0,
- offsetY: 0,
- style: {
- color: '#888',
- fontSize: '16px'
- }
- },
- responsive: [], // breakpoints should follow ascending order 400, then 700, then 1000
- series: undefined,
- states: {
- normal: {
- filter: {
- type: 'none',
- value: 0
- }
- },
- hover: {
- filter: {
- type: 'lighten',
- value: 0.15
- }
- },
- active: {
- allowMultipleDataPointsSelection: false,
- filter: {
- type: 'darken',
- value: 0.35
- }
- }
- },
- title: {
- text: undefined,
- align: 'left',
- margin: 10,
- offsetX: 0,
- offsetY: 0,
- floating: false,
- style: {
- fontSize: '16px',
- color: '#263238'
- }
- },
- subtitle: {
- text: undefined,
- align: 'left',
- margin: 10,
- offsetX: 0,
- offsetY: 0,
- floating: false,
- style: {
- fontSize: '14px',
- color: '#9699a2'
- }
- },
- stroke: {
- show: true,
- curve: 'smooth', // "smooth" or "straight"
- lineCap: 'butt', // round, butt , square
- width: 2,
- colors: undefined, // array of colors
- dashArray: 0 // single value or array of values
- },
- tooltip: {
- enabled: true,
- shared: true,
- followCursor: false, // when disabled, the tooltip will show on top of the series instead of mouse position
- intersect: false, // when enabled, tooltip will only show when user directly hovers over point
- inverseOrder: false,
- custom: undefined,
- fillSeriesColor: false,
- onDatasetHover: {
- highlightDataSeries: false
- },
- theme: 'light',
- x: { // x value
- show: true,
- format: 'dd MMM', // dd/MM, dd MMM yy, dd MMM yyyy
- formatter: undefined // a custom user supplied formatter function
- },
- y: {
- formatter: undefined,
- title: {
- formatter: function formatter(seriesName) {
- return seriesName;
- }
- }
- },
- z: {
- formatter: undefined,
- title: 'Size: '
- },
- marker: {
- show: true
- },
- items: {
- display: 'flex'
- },
- fixed: {
- enabled: false,
- position: 'topRight', // topRight, topLeft, bottomRight, bottomLeft
- offsetX: -100,
- offsetY: 0
- }
- },
- xaxis: {
- type: 'category',
- categories: [],
- labels: {
- show: true,
- rotate: -45,
- rotateAlways: false,
- trim: true,
- maxHeight: 120,
- style: {
- colors: [],
- fontSize: '12px',
- cssClass: 'apexcharts-xaxis-label'
- },
- offsetX: 0,
- offsetY: 0,
- format: undefined,
- formatter: undefined, // custom formatter function which will override format
- datetimeFormatter: {
- year: 'yyyy',
- month: 'MMM \'yy',
- day: 'dd MMM',
- hour: 'HH:mm'
- }
- },
- axisBorder: {
- show: true,
- color: '#78909C',
- offsetX: 0,
- offsetY: 0
- },
- axisTicks: {
- show: true,
- color: '#78909C',
- height: 6,
- offsetX: 0,
- offsetY: 0
- },
- tickAmount: undefined,
- min: undefined,
- max: undefined,
- range: undefined,
- floating: false,
- position: 'bottom',
- title: {
- text: undefined,
- offsetX: 0,
- offsetY: 0,
- style: {
- color: undefined,
- fontSize: '12px',
- cssClass: 'apexcharts-xaxis-title'
- }
- },
- crosshairs: {
- show: true,
- width: 1, // tickWidth/barWidth or an integer
- position: 'back',
- opacity: 0.9,
- stroke: {
- color: '#b6b6b6',
- width: 0,
- dashArray: 0
- },
- fill: {
- type: 'solid', // solid, gradient
- color: '#B1B9C4',
- gradient: {
- colorFrom: '#D8E3F0',
- colorTo: '#BED1E6',
- stops: [0, 100],
- opacityFrom: 0.4,
- opacityTo: 0.5
- }
- },
- dropShadow: {
- enabled: false,
- left: 0,
- top: 0,
- blur: 1,
- opacity: 0.4
- }
- },
- tooltip: {
- enabled: true,
- offsetY: 0
- }
- },
- yaxis: yAxis,
- theme: {
- palette: 'palette1', // If defined, it will overwrite config.colors variable
- monochrome: { // monochrome allows you to select just 1 color and fill out the rest with light/dark shade (intensity can be selected)
- enabled: false,
- color: '#008FFB',
- shadeTo: 'light',
- shadeIntensity: 0.65
- }
- }
- };
- }
- }]);
-
- return Options;
-}();
-
-exports.default = Options;
-
-/***/ }),
-/* 61 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-/*! svg.filter.js - v2.0.2 - 2016-02-24
-* https://github.com/wout/svg.filter.js
-* Copyright (c) 2016 Wout Fierens; Licensed MIT */
-;(function () {
-
- // Main filter class
- SVG.Filter = SVG.invent({
- create: 'filter',
- inherit: SVG.Parent,
- extend: {
- // Static strings
- source: 'SourceGraphic',
- sourceAlpha: 'SourceAlpha',
- background: 'BackgroundImage',
- backgroundAlpha: 'BackgroundAlpha',
- fill: 'FillPaint',
- stroke: 'StrokePaint',
-
- autoSetIn: true,
- // Custom put method for leaner code
- put: function put(element, i) {
- this.add(element, i);
-
- if (!element.attr('in') && this.autoSetIn) {
- element.attr('in', this.source);
- }
- if (!element.attr('result')) {
- element.attr('result', element);
- }
-
- return element;
- },
- // Blend effect
- blend: function blend(in1, in2, mode) {
- return this.put(new SVG.BlendEffect(in1, in2, mode));
- },
- // ColorMatrix effect
- colorMatrix: function colorMatrix(type, values) {
- return this.put(new SVG.ColorMatrixEffect(type, values));
- },
- // ConvolveMatrix effect
- convolveMatrix: function convolveMatrix(matrix) {
- return this.put(new SVG.ConvolveMatrixEffect(matrix));
- },
- // ComponentTransfer effect
- componentTransfer: function componentTransfer(components) {
- return this.put(new SVG.ComponentTransferEffect(components));
- },
- // Composite effect
- composite: function composite(in1, in2, operator) {
- return this.put(new SVG.CompositeEffect(in1, in2, operator));
- },
- // Flood effect
- flood: function flood(color, opacity) {
- return this.put(new SVG.FloodEffect(color, opacity));
- },
- // Offset effect
- offset: function offset(x, y) {
- return this.put(new SVG.OffsetEffect(x, y));
- },
- // Image effect
- image: function image(src) {
- return this.put(new SVG.ImageEffect(src));
- },
- // Merge effect
- merge: function merge() {
- //pass the array of arguments to the constructor because we dont know if the user gave us an array as the first arguemnt or wether they listed the effects in the arguments
- var args = [undefined];
- for (var i in arguments) {
- args.push(arguments[i]);
- }return this.put(new (SVG.MergeEffect.bind.apply(SVG.MergeEffect, args))());
- },
- // Gaussian Blur effect
- gaussianBlur: function gaussianBlur(x, y) {
- return this.put(new SVG.GaussianBlurEffect(x, y));
- },
- // Morphology effect
- morphology: function morphology(operator, radius) {
- return this.put(new SVG.MorphologyEffect(operator, radius));
- },
- // DiffuseLighting effect
- diffuseLighting: function diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength) {
- return this.put(new SVG.DiffuseLightingEffect(surfaceScale, diffuseConstant, kernelUnitLength));
- },
- // DisplacementMap effect
- displacementMap: function displacementMap(in1, in2, scale, xChannelSelector, yChannelSelector) {
- return this.put(new SVG.DisplacementMapEffect(in1, in2, scale, xChannelSelector, yChannelSelector));
- },
- // SpecularLighting effect
- specularLighting: function specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength) {
- return this.put(new SVG.SpecularLightingEffect(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength));
- },
- // Tile effect
- tile: function tile() {
- return this.put(new SVG.TileEffect());
- },
- // Turbulence effect
- turbulence: function turbulence(baseFrequency, numOctaves, seed, stitchTiles, type) {
- return this.put(new SVG.TurbulenceEffect(baseFrequency, numOctaves, seed, stitchTiles, type));
- },
- // Default string value
- toString: function toString() {
- return 'url(#' + this.attr('id') + ')';
- }
- }
- });
-
- //add .filter function
- SVG.extend(SVG.Defs, {
- // Define filter
- filter: function filter(block) {
- var filter = this.put(new SVG.Filter());
-
- /* invoke passed block */
- if (typeof block === 'function') block.call(filter, filter);
-
- return filter;
- }
- });
- SVG.extend(SVG.Container, {
- // Define filter on defs
- filter: function filter(block) {
- return this.defs().filter(block);
- }
- });
- SVG.extend(SVG.Element, SVG.G, SVG.Nested, {
- // Create filter element in defs and store reference
- filter: function filter(block) {
- this.filterer = block instanceof SVG.Element ? block : this.doc().filter(block);
-
- if (this.doc() && this.filterer.doc() !== this.doc()) {
- this.doc().defs().add(this.filterer);
- }
-
- this.attr('filter', this.filterer);
-
- return this.filterer;
- },
- // Remove filter
- unfilter: function unfilter(remove) {
- /* also remove the filter node */
- if (this.filterer && remove === true) this.filterer.remove();
-
- /* delete reference to filterer */
- delete this.filterer;
-
- /* remove filter attribute */
- return this.attr('filter', null);
- }
- });
-
- // Create SVG.Effect class
- SVG.Effect = SVG.invent({
- create: function create() {
- this.constructor.call(this);
- },
- inherit: SVG.Element,
- extend: {
- // Set in attribute
- in: function _in(effect) {
- return effect == null ? this.parent() && this.parent().select('[result="' + this.attr('in') + '"]').get(0) || this.attr('in') : this.attr('in', effect);
- },
- // Named result
- result: function result(_result) {
- return _result == null ? this.attr('result') : this.attr('result', _result);
- },
- // Stringification
- toString: function toString() {
- return this.result();
- }
- }
- });
-
- // create class for parent effects like merge
- // Inherit from SVG.Parent
- SVG.ParentEffect = SVG.invent({
- create: function create() {
- this.constructor.call(this);
- },
- inherit: SVG.Parent,
- extend: {
- // Set in attribute
- in: function _in(effect) {
- return effect == null ? this.parent() && this.parent().select('[result="' + this.attr('in') + '"]').get(0) || this.attr('in') : this.attr('in', effect);
- },
- // Named result
- result: function result(_result2) {
- return _result2 == null ? this.attr('result') : this.attr('result', _result2);
- },
- // Stringification
- toString: function toString() {
- return this.result();
- }
- }
- });
-
- //chaining
- var chainingEffects = {
- // Blend effect
- blend: function blend(in2, mode) {
- return this.parent() && this.parent().blend(this, in2, mode); //pass this as the first input
- },
- // ColorMatrix effect
- colorMatrix: function colorMatrix(type, values) {
- return this.parent() && this.parent().colorMatrix(type, values).in(this);
- },
- // ConvolveMatrix effect
- convolveMatrix: function convolveMatrix(matrix) {
- return this.parent() && this.parent().convolveMatrix(matrix).in(this);
- },
- // ComponentTransfer effect
- componentTransfer: function componentTransfer(components) {
- return this.parent() && this.parent().componentTransfer(components).in(this);
- },
- // Composite effect
- composite: function composite(in2, operator) {
- return this.parent() && this.parent().composite(this, in2, operator); //pass this as the first input
- },
- // Flood effect
- flood: function flood(color, opacity) {
- return this.parent() && this.parent().flood(color, opacity); //this effect dont have inputs
- },
- // Offset effect
- offset: function offset(x, y) {
- return this.parent() && this.parent().offset(x, y).in(this);
- },
- // Image effect
- image: function image(src) {
- return this.parent() && this.parent().image(src); //this effect dont have inputs
- },
- // Merge effect
- merge: function merge() {
- return this.parent() && this.parent().merge.apply(this.parent(), [this].concat(arguments)); //pass this as the first argument
- },
- // Gaussian Blur effect
- gaussianBlur: function gaussianBlur(x, y) {
- return this.parent() && this.parent().gaussianBlur(x, y).in(this);
- },
- // Morphology effect
- morphology: function morphology(operator, radius) {
- return this.parent() && this.parent().morphology(operator, radius).in(this);
- },
- // DiffuseLighting effect
- diffuseLighting: function diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength) {
- return this.parent() && this.parent().diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength).in(this);
- },
- // DisplacementMap effect
- displacementMap: function displacementMap(in2, scale, xChannelSelector, yChannelSelector) {
- return this.parent() && this.parent().displacementMap(this, in2, scale, xChannelSelector, yChannelSelector); //pass this as the first input
- },
- // SpecularLighting effect
- specularLighting: function specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength) {
- return this.parent() && this.parent().specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength).in(this);
- },
- // Tile effect
- tile: function tile() {
- return this.parent() && this.parent().tile().in(this);
- },
- // Turbulence effect
- turbulence: function turbulence(baseFrequency, numOctaves, seed, stitchTiles, type) {
- return this.parent() && this.parent().turbulence(baseFrequency, numOctaves, seed, stitchTiles, type).in(this);
- }
- };
- SVG.extend(SVG.Effect, chainingEffects);
- SVG.extend(SVG.ParentEffect, chainingEffects);
-
- //crea class for child effects, like MergeNode, FuncR and lights
- SVG.ChildEffect = SVG.invent({
- create: function create() {
- this.constructor.call(this);
- },
- inherit: SVG.Element,
- extend: {
- in: function _in(effect) {
- this.attr('in', effect);
- }
- //dont include any "result" functions because these types of nodes dont have them
- }
- });
-
- // Create all different effects
- var effects = {
- blend: function blend(in1, in2, mode) {
- this.attr({
- in: in1,
- in2: in2,
- mode: mode || 'normal'
- });
- },
- colorMatrix: function colorMatrix(type, values) {
- if (type == 'matrix') values = normaliseMatrix(values);
-
- this.attr({
- type: type,
- values: typeof values == 'undefined' ? null : values
- });
- },
- convolveMatrix: function convolveMatrix(matrix) {
- matrix = normaliseMatrix(matrix);
-
- this.attr({
- order: Math.sqrt(matrix.split(' ').length),
- kernelMatrix: matrix
- });
- },
- composite: function composite(in1, in2, operator) {
- this.attr({
- in: in1,
- in2: in2,
- operator: operator
- });
- },
- flood: function flood(color, opacity) {
- this.attr('flood-color', color);
- if (opacity != null) this.attr('flood-opacity', opacity);
- },
- offset: function offset(x, y) {
- this.attr({
- dx: x,
- dy: y
- });
- },
- image: function image(src) {
- this.attr('href', src, SVG.xlink);
- },
- displacementMap: function displacementMap(in1, in2, scale, xChannelSelector, yChannelSelector) {
- this.attr({
- in: in1,
- in2: in2,
- scale: scale,
- xChannelSelector: xChannelSelector,
- yChannelSelector: yChannelSelector
- });
- },
- gaussianBlur: function gaussianBlur(x, y) {
- if (x != null || y != null) this.attr('stdDeviation', listString(Array.prototype.slice.call(arguments)));else this.attr('stdDeviation', '0 0');
- },
- morphology: function morphology(operator, radius) {
- this.attr({
- operator: operator,
- radius: radius
- });
- },
- tile: function tile() {},
- turbulence: function turbulence(baseFrequency, numOctaves, seed, stitchTiles, type) {
- this.attr({
- numOctaves: numOctaves,
- seed: seed,
- stitchTiles: stitchTiles,
- baseFrequency: baseFrequency,
- type: type
- });
- }
-
- // Create all parent effects
- };var parentEffects = {
- merge: function merge() {
- var children;
-
- //test to see if we have a set
- if (arguments[0] instanceof SVG.Set) {
- var that = this;
- arguments[0].each(function (i) {
- if (this instanceof SVG.MergeNode) that.put(this);else if (this instanceof SVG.Effect || this instanceof SVG.ParentEffect) that.put(new SVG.MergeNode(this));
- });
- } else {
- //if the first argument is an array use it
- if (Array.isArray(arguments[0])) children = arguments[0];else children = arguments;
-
- for (var i = 0; i < children.length; i++) {
- if (children[i] instanceof SVG.MergeNode) {
- this.put(children[i]);
- } else this.put(new SVG.MergeNode(children[i]));
- }
- }
- },
- componentTransfer: function componentTransfer(compontents) {
- /* create rgb set */
- this.rgb = new SVG.Set()
-
- /* create components */
- ;['r', 'g', 'b', 'a'].forEach(function (c) {
- /* create component */
- this[c] = new SVG['Func' + c.toUpperCase()]('identity');
-
- /* store component in set */
- this.rgb.add(this[c]);
-
- /* add component node */
- this.node.appendChild(this[c].node);
- }.bind(this)); //lost context in foreach
-
- /* set components */
- if (compontents) {
- if (compontents.rgb) {
- /* set bundled components */
- ;['r', 'g', 'b'].forEach(function (c) {
- this[c].attr(compontents.rgb);
- }.bind(this));
-
- delete compontents.rgb;
- }
-
- /* set individual components */
- for (var c in compontents) {
- this[c].attr(compontents[c]);
- }
- }
- },
- diffuseLighting: function diffuseLighting(surfaceScale, diffuseConstant, kernelUnitLength) {
- this.attr({
- surfaceScale: surfaceScale,
- diffuseConstant: diffuseConstant,
- kernelUnitLength: kernelUnitLength
- });
- },
- specularLighting: function specularLighting(surfaceScale, diffuseConstant, specularExponent, kernelUnitLength) {
- this.attr({
- surfaceScale: surfaceScale,
- diffuseConstant: diffuseConstant,
- specularExponent: specularExponent,
- kernelUnitLength: kernelUnitLength
- });
- }
-
- // Create child effects like PointLight and MergeNode
- };var childEffects = {
- distantLight: function distantLight(azimuth, elevation) {
- this.attr({
- azimuth: azimuth,
- elevation: elevation
- });
- },
- pointLight: function pointLight(x, y, z) {
- this.attr({
- x: x,
- y: y,
- z: z
- });
- },
- spotLight: function spotLight(x, y, z, pointsAtX, pointsAtY, pointsAtZ) {
- this.attr({
- x: x,
- y: y,
- z: z,
- pointsAtX: pointsAtX,
- pointsAtY: pointsAtY,
- pointsAtZ: pointsAtZ
- });
- },
- mergeNode: function mergeNode(in1) {
- this.attr('in', in1);
- }
-
- // Create compontent functions
- };['r', 'g', 'b', 'a'].forEach(function (c) {
- /* create class */
- childEffects['Func' + c.toUpperCase()] = function (type) {
- this.attr('type', type);
-
- // take diffent arguments based on the type
- switch (type) {
- case 'table':
- this.attr('tableValues', arguments[1]);
- break;
- case 'linear':
- this.attr('slope', arguments[1]);
- this.attr('intercept', arguments[2]);
- break;
- case 'gamma':
- this.attr('amplitude', arguments[1]);
- this.attr('exponent', arguments[2]);
- this.attr('offset', arguments[2]);
- break;
- }
- };
- });
-
- //create effects
- foreach(effects, function (effect, i) {
-
- /* capitalize name */
- var name = i.charAt(0).toUpperCase() + i.slice(1);
- var proto = {};
-
- /* create class */
- SVG[name + 'Effect'] = SVG.invent({
- create: function create() {
- //call super
- this.constructor.call(this, SVG.create('fe' + name));
-
- //call constructor for this effect
- effect.apply(this, arguments);
-
- //set the result
- this.result(this.attr('id') + 'Out');
- },
- inherit: SVG.Effect,
- extend: proto
- });
- });
-
- //create parent effects
- foreach(parentEffects, function (effect, i) {
-
- /* capitalize name */
- var name = i.charAt(0).toUpperCase() + i.slice(1);
- var proto = {};
-
- /* create class */
- SVG[name + 'Effect'] = SVG.invent({
- create: function create() {
- //call super
- this.constructor.call(this, SVG.create('fe' + name));
-
- //call constructor for this effect
- effect.apply(this, arguments);
-
- //set the result
- this.result(this.attr('id') + 'Out');
- },
- inherit: SVG.ParentEffect,
- extend: proto
- });
- });
-
- //create child effects
- foreach(childEffects, function (effect, i) {
-
- /* capitalize name */
- var name = i.charAt(0).toUpperCase() + i.slice(1);
- var proto = {};
-
- /* create class */
- SVG[name] = SVG.invent({
- create: function create() {
- //call super
- this.constructor.call(this, SVG.create('fe' + name));
-
- //call constructor for this effect
- effect.apply(this, arguments);
- },
- inherit: SVG.ChildEffect,
- extend: proto
- });
- });
-
- // Effect-specific extensions
- SVG.extend(SVG.MergeEffect, {
- in: function _in(effect) {
- if (effect instanceof SVG.MergeNode) this.add(effect, 0);else this.add(new SVG.MergeNode(effect), 0);
-
- return this;
- }
- });
- SVG.extend(SVG.CompositeEffect, SVG.BlendEffect, SVG.DisplacementMapEffect, {
- in2: function in2(effect) {
- return effect == null ? this.parent() && this.parent().select('[result="' + this.attr('in2') + '"]').get(0) || this.attr('in2') : this.attr('in2', effect);
- }
- });
-
- // Presets
- SVG.filter = {
- sepiatone: [.343, .669, .119, 0, 0, .249, .626, .130, 0, 0, .172, .334, .111, 0, 0, .000, .000, .000, 1, 0]
-
- // Helpers
- };function normaliseMatrix(matrix) {
- /* convert possible array value to string */
- if (Array.isArray(matrix)) matrix = new SVG.Array(matrix);
-
- /* ensure there are no leading, tailing or double spaces */
- return matrix.toString().replace(/^\s+/, '').replace(/\s+$/, '').replace(/\s+/g, ' ');
- }
-
- function listString(list) {
- if (!Array.isArray(list)) return list;
-
- for (var i = 0, l = list.length, s = []; i < l; i++) {
- s.push(list[i]);
- }return s.join(' ');
- }
-
- function foreach() {
- //loops through mutiple objects
- var fn = function fn() {};
- if (typeof arguments[arguments.length - 1] == 'function') {
- fn = arguments[arguments.length - 1];
- Array.prototype.splice.call(arguments, arguments.length - 1, 1);
- }
- for (var k in arguments) {
- for (var i in arguments[k]) {
- fn(arguments[k][i], i, arguments[k]);
- }
- }
- }
-}).call(undefined);
-
-/***/ }),
-/* 62 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-var __WEBPACK_AMD_DEFINE_RESULT__;
-
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-/*!
-* svg.js - A lightweight library for manipulating and animating SVG.
-* @version 2.6.5
-* https://svgdotjs.github.io/
-*
-* @copyright Wout Fierens
-* @license MIT
-*
-* BUILT: Sat May 26 2018 22:47:07 GMT+0200 (Mitteleuropäische Sommerzeit)
-*/;
-(function (root, factory) {
- /* istanbul ignore next */
- if (true) {
- !(__WEBPACK_AMD_DEFINE_RESULT__ = function () {
- return factory(root, root.document);
- }.call(exports, __webpack_require__, exports, module),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') {
- module.exports = root.document ? factory(root, root.document) : function (w) {
- return factory(w, w.document);
- };
- } else {
- root.SVG = factory(root, root.document);
- }
-})(typeof window !== "undefined" ? window : undefined, function (window, document) {
-
- // The main wrapping element
- var SVG = (this || window).SVG = function (element) {
- if (SVG.supported) {
- element = new SVG.Doc(element);
-
- if (!SVG.parser.draw) SVG.prepare();
-
- return element;
- }
- };
-
- // Default namespaces
- SVG.ns = 'http://www.w3.org/2000/svg';
- SVG.xmlns = 'http://www.w3.org/2000/xmlns/';
- SVG.xlink = 'http://www.w3.org/1999/xlink';
- SVG.svgjs = 'http://svgjs.com/svgjs';
-
- // Svg support test
- SVG.supported = function () {
- return !!document.createElementNS && !!document.createElementNS(SVG.ns, 'svg').createSVGRect;
- }();
-
- // Don't bother to continue if SVG is not supported
- if (!SVG.supported) return false;
-
- // Element id sequence
- SVG.did = 1000;
-
- // Get next named element id
- SVG.eid = function (name) {
- return 'Svgjs' + capitalize(name) + SVG.did++;
- };
-
- // Method for element creation
- SVG.create = function (name) {
- // create element
- var element = document.createElementNS(this.ns, name);
-
- // apply unique id
- element.setAttribute('id', this.eid(name));
-
- return element;
- };
-
- // Method for extending objects
- SVG.extend = function () {
- var modules, methods, key, i;
-
- // Get list of modules
- modules = [].slice.call(arguments);
-
- // Get object with extensions
- methods = modules.pop();
-
- for (i = modules.length - 1; i >= 0; i--) {
- if (modules[i]) for (key in methods) {
- modules[i].prototype[key] = methods[key];
- }
- } // Make sure SVG.Set inherits any newly added methods
- if (SVG.Set && SVG.Set.inherit) SVG.Set.inherit();
- };
-
- // Invent new element
- SVG.invent = function (config) {
- // Create element initializer
- var initializer = typeof config.create == 'function' ? config.create : function () {
- this.constructor.call(this, SVG.create(config.create));
- };
-
- // Inherit prototype
- if (config.inherit) initializer.prototype = new config.inherit();
-
- // Extend with methods
- if (config.extend) SVG.extend(initializer, config.extend);
-
- // Attach construct method to parent
- if (config.construct) SVG.extend(config.parent || SVG.Container, config.construct);
-
- return initializer;
- };
-
- // Adopt existing svg elements
- SVG.adopt = function (node) {
- // check for presence of node
- if (!node) return null;
-
- // make sure a node isn't already adopted
- if (node.instance) return node.instance;
-
- // initialize variables
- var element;
-
- // adopt with element-specific settings
- if (node.nodeName == 'svg') element = node.parentNode instanceof window.SVGElement ? new SVG.Nested() : new SVG.Doc();else if (node.nodeName == 'linearGradient') element = new SVG.Gradient('linear');else if (node.nodeName == 'radialGradient') element = new SVG.Gradient('radial');else if (SVG[capitalize(node.nodeName)]) element = new SVG[capitalize(node.nodeName)]();else element = new SVG.Element(node);
-
- // ensure references
- element.type = node.nodeName;
- element.node = node;
- node.instance = element;
-
- // SVG.Class specific preparations
- if (element instanceof SVG.Doc) element.namespace().defs();
-
- // pull svgjs data from the dom (getAttributeNS doesn't work in html5)
- element.setData(JSON.parse(node.getAttribute('svgjs:data')) || {});
-
- return element;
- };
-
- // Initialize parsing element
- SVG.prepare = function () {
- // Select document body and create invisible svg element
- var body = document.getElementsByTagName('body')[0],
- draw = (body ? new SVG.Doc(body) : SVG.adopt(document.documentElement).nested()).size(2, 0);
-
- // Create parser object
- SVG.parser = {
- body: body || document.documentElement,
- draw: draw.style('opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden').node,
- poly: draw.polyline().node,
- path: draw.path().node,
- native: SVG.create('svg')
- };
- };
-
- SVG.parser = {
- native: SVG.create('svg')
- };
-
- document.addEventListener('DOMContentLoaded', function () {
- if (!SVG.parser.draw) SVG.prepare();
- }, false);
-
- // Storage for regular expressions
- SVG.regex = {
- // Parse unit value
- numberAndUnit: /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i
-
- // Parse hex value
- , hex: /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i
-
- // Parse rgb value
- , rgb: /rgb\((\d+),(\d+),(\d+)\)/
-
- // Parse reference id
- , reference: /#([a-z0-9\-_]+)/i
-
- // splits a transformation chain
- , transforms: /\)\s*,?\s*/
-
- // Whitespace
- , whitespace: /\s/g
-
- // Test hex value
- , isHex: /^#[a-f0-9]{3,6}$/i
-
- // Test rgb value
- , isRgb: /^rgb\(/
-
- // Test css declaration
- , isCss: /[^:]+:[^;]+;?/
-
- // Test for blank string
- , isBlank: /^(\s+)?$/
-
- // Test for numeric string
- , isNumber: /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i
-
- // Test for percent value
- , isPercent: /^-?[\d\.]+%$/
-
- // Test for image url
- , isImage: /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i
-
- // split at whitespace and comma
- , delimiter: /[\s,]+/
-
- // The following regex are used to parse the d attribute of a path
-
- // Matches all hyphens which are not after an exponent
- , hyphen: /([^e])\-/gi
-
- // Replaces and tests for all path letters
- , pathLetters: /[MLHVCSQTAZ]/gi
-
- // yes we need this one, too
- , isPathLetter: /[MLHVCSQTAZ]/i
-
- // matches 0.154.23.45
- , numbersWithDots: /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi
-
- // matches .
- , dots: /\./g
- };
-
- SVG.utils = {
- // Map function
- map: function map(array, block) {
- var i,
- il = array.length,
- result = [];
-
- for (i = 0; i < il; i++) {
- result.push(block(array[i]));
- }return result;
- }
-
- // Filter function
- , filter: function filter(array, block) {
- var i,
- il = array.length,
- result = [];
-
- for (i = 0; i < il; i++) {
- if (block(array[i])) result.push(array[i]);
- }return result;
- }
-
- // Degrees to radians
- , radians: function radians(d) {
- return d % 360 * Math.PI / 180;
- }
-
- // Radians to degrees
- , degrees: function degrees(r) {
- return r * 180 / Math.PI % 360;
- },
-
- filterSVGElements: function filterSVGElements(nodes) {
- return this.filter(nodes, function (el) {
- return el instanceof window.SVGElement;
- });
- }
-
- };
-
- SVG.defaults = {
- // Default attribute values
- attrs: {
- // fill and stroke
- 'fill-opacity': 1,
- 'stroke-opacity': 1,
- 'stroke-width': 0,
- 'stroke-linejoin': 'miter',
- 'stroke-linecap': 'butt',
- fill: '#000000',
- stroke: '#000000',
- opacity: 1
- // position
- , x: 0,
- y: 0,
- cx: 0,
- cy: 0
- // size
- , width: 0,
- height: 0
- // radius
- , r: 0,
- rx: 0,
- ry: 0
- // gradient
- , offset: 0,
- 'stop-opacity': 1,
- 'stop-color': '#000000'
- // text
- , 'font-size': 16,
- 'font-family': 'Helvetica, Arial, sans-serif',
- 'text-anchor': 'start'
- }
- // Module for color convertions
- };SVG.Color = function (color) {
- var match;
-
- // initialize defaults
- this.r = 0;
- this.g = 0;
- this.b = 0;
-
- if (!color) return;
-
- // parse color
- if (typeof color === 'string') {
- if (SVG.regex.isRgb.test(color)) {
- // get rgb values
- match = SVG.regex.rgb.exec(color.replace(SVG.regex.whitespace, ''));
-
- // parse numeric values
- this.r = parseInt(match[1]);
- this.g = parseInt(match[2]);
- this.b = parseInt(match[3]);
- } else if (SVG.regex.isHex.test(color)) {
- // get hex values
- match = SVG.regex.hex.exec(fullHex(color));
-
- // parse numeric values
- this.r = parseInt(match[1], 16);
- this.g = parseInt(match[2], 16);
- this.b = parseInt(match[3], 16);
- }
- } else if ((typeof color === 'undefined' ? 'undefined' : _typeof(color)) === 'object') {
- this.r = color.r;
- this.g = color.g;
- this.b = color.b;
- }
- };
-
- SVG.extend(SVG.Color, {
- // Default to hex conversion
- toString: function toString() {
- return this.toHex();
- }
- // Build hex value
- , toHex: function toHex() {
- return '#' + compToHex(this.r) + compToHex(this.g) + compToHex(this.b);
- }
- // Build rgb value
- , toRgb: function toRgb() {
- return 'rgb(' + [this.r, this.g, this.b].join() + ')';
- }
- // Calculate true brightness
- , brightness: function brightness() {
- return this.r / 255 * 0.30 + this.g / 255 * 0.59 + this.b / 255 * 0.11;
- }
- // Make color morphable
- , morph: function morph(color) {
- this.destination = new SVG.Color(color);
-
- return this;
- }
- // Get morphed color at given position
- , at: function at(pos) {
- // make sure a destination is defined
- if (!this.destination) return this;
-
- // normalise pos
- pos = pos < 0 ? 0 : pos > 1 ? 1 : pos;
-
- // generate morphed color
- return new SVG.Color({
- r: ~~(this.r + (this.destination.r - this.r) * pos),
- g: ~~(this.g + (this.destination.g - this.g) * pos),
- b: ~~(this.b + (this.destination.b - this.b) * pos)
- });
- }
-
- });
-
- // Testers
-
- // Test if given value is a color string
- SVG.Color.test = function (color) {
- color += '';
- return SVG.regex.isHex.test(color) || SVG.regex.isRgb.test(color);
- };
-
- // Test if given value is a rgb object
- SVG.Color.isRgb = function (color) {
- return color && typeof color.r == 'number' && typeof color.g == 'number' && typeof color.b == 'number';
- };
-
- // Test if given value is a color
- SVG.Color.isColor = function (color) {
- return SVG.Color.isRgb(color) || SVG.Color.test(color);
- };
- // Module for array conversion
- SVG.Array = function (array, fallback) {
- array = (array || []).valueOf();
-
- // if array is empty and fallback is provided, use fallback
- if (array.length == 0 && fallback) array = fallback.valueOf();
-
- // parse array
- this.value = this.parse(array);
- };
-
- SVG.extend(SVG.Array, {
- // Make array morphable
- morph: function morph(array) {
- this.destination = this.parse(array);
-
- // normalize length of arrays
- if (this.value.length != this.destination.length) {
- var lastValue = this.value[this.value.length - 1],
- lastDestination = this.destination[this.destination.length - 1];
-
- while (this.value.length > this.destination.length) {
- this.destination.push(lastDestination);
- }while (this.value.length < this.destination.length) {
- this.value.push(lastValue);
- }
- }
-
- return this;
- }
- // Clean up any duplicate points
- , settle: function settle() {
- // find all unique values
- for (var i = 0, il = this.value.length, seen = []; i < il; i++) {
- if (seen.indexOf(this.value[i]) == -1) seen.push(this.value[i]);
- } // set new value
- return this.value = seen;
- }
- // Get morphed array at given position
- , at: function at(pos) {
- // make sure a destination is defined
- if (!this.destination) return this;
-
- // generate morphed array
- for (var i = 0, il = this.value.length, array = []; i < il; i++) {
- array.push(this.value[i] + (this.destination[i] - this.value[i]) * pos);
- }return new SVG.Array(array);
- }
- // Convert array to string
- , toString: function toString() {
- return this.value.join(' ');
- }
- // Real value
- , valueOf: function valueOf() {
- return this.value;
- }
- // Parse whitespace separated string
- , parse: function parse(array) {
- array = array.valueOf();
-
- // if already is an array, no need to parse it
- if (Array.isArray(array)) return array;
-
- return this.split(array);
- }
- // Strip unnecessary whitespace
- , split: function split(string) {
- return string.trim().split(SVG.regex.delimiter).map(parseFloat);
- }
- // Reverse array
- , reverse: function reverse() {
- this.value.reverse();
-
- return this;
- },
- clone: function clone() {
- var clone = new this.constructor();
- clone.value = array_clone(this.value);
- return clone;
- }
- });
- // Poly points array
- SVG.PointArray = function (array, fallback) {
- SVG.Array.call(this, array, fallback || [[0, 0]]);
- };
-
- // Inherit from SVG.Array
- SVG.PointArray.prototype = new SVG.Array();
- SVG.PointArray.prototype.constructor = SVG.PointArray;
-
- SVG.extend(SVG.PointArray, {
- // Convert array to string
- toString: function toString() {
- // convert to a poly point string
- for (var i = 0, il = this.value.length, array = []; i < il; i++) {
- array.push(this.value[i].join(','));
- }return array.join(' ');
- }
- // Convert array to line object
- , toLine: function toLine() {
- return {
- x1: this.value[0][0],
- y1: this.value[0][1],
- x2: this.value[1][0],
- y2: this.value[1][1]
- };
- }
- // Get morphed array at given position
- , at: function at(pos) {
- // make sure a destination is defined
- if (!this.destination) return this;
-
- // generate morphed point string
- for (var i = 0, il = this.value.length, array = []; i < il; i++) {
- array.push([this.value[i][0] + (this.destination[i][0] - this.value[i][0]) * pos, this.value[i][1] + (this.destination[i][1] - this.value[i][1]) * pos]);
- }return new SVG.PointArray(array);
- }
- // Parse point string and flat array
- , parse: function parse(array) {
- var points = [];
-
- array = array.valueOf();
-
- // if it is an array
- if (Array.isArray(array)) {
- // and it is not flat, there is no need to parse it
- if (Array.isArray(array[0])) {
- // make sure to use a clone
- return array.map(function (el) {
- return el.slice();
- });
- } else if (array[0].x != null) {
- // allow point objects to be passed
- return array.map(function (el) {
- return [el.x, el.y];
- });
- }
- } else {
- // Else, it is considered as a string
- // parse points
- array = array.trim().split(SVG.regex.delimiter).map(parseFloat);
- }
-
- // validate points - https://svgwg.org/svg2-draft/shapes.html#DataTypePoints
- // Odd number of coordinates is an error. In such cases, drop the last odd coordinate.
- if (array.length % 2 !== 0) array.pop();
-
- // wrap points in two-tuples and parse points as floats
- for (var i = 0, len = array.length; i < len; i = i + 2) {
- points.push([array[i], array[i + 1]]);
- }return points;
- }
- // Move point string
- , move: function move(x, y) {
- var box = this.bbox();
-
- // get relative offset
- x -= box.x;
- y -= box.y;
-
- // move every point
- if (!isNaN(x) && !isNaN(y)) for (var i = this.value.length - 1; i >= 0; i--) {
- this.value[i] = [this.value[i][0] + x, this.value[i][1] + y];
- }return this;
- }
- // Resize poly string
- , size: function size(width, height) {
- var i,
- box = this.bbox();
-
- // recalculate position of all points according to new size
- for (i = this.value.length - 1; i >= 0; i--) {
- if (box.width) this.value[i][0] = (this.value[i][0] - box.x) * width / box.width + box.x;
- if (box.height) this.value[i][1] = (this.value[i][1] - box.y) * height / box.height + box.y;
- }
-
- return this;
- }
- // Get bounding box of points
- , bbox: function bbox() {
- SVG.parser.poly.setAttribute('points', this.toString());
-
- return SVG.parser.poly.getBBox();
- }
- });
-
- var pathHandlers = {
- M: function M(c, p, p0) {
- p.x = p0.x = c[0];
- p.y = p0.y = c[1];
-
- return ['M', p.x, p.y];
- },
- L: function L(c, p) {
- p.x = c[0];
- p.y = c[1];
- return ['L', c[0], c[1]];
- },
- H: function H(c, p) {
- p.x = c[0];
- return ['H', c[0]];
- },
- V: function V(c, p) {
- p.y = c[0];
- return ['V', c[0]];
- },
- C: function C(c, p) {
- p.x = c[4];
- p.y = c[5];
- return ['C', c[0], c[1], c[2], c[3], c[4], c[5]];
- },
- S: function S(c, p) {
- p.x = c[2];
- p.y = c[3];
- return ['S', c[0], c[1], c[2], c[3]];
- },
- Q: function Q(c, p) {
- p.x = c[2];
- p.y = c[3];
- return ['Q', c[0], c[1], c[2], c[3]];
- },
- T: function T(c, p) {
- p.x = c[0];
- p.y = c[1];
- return ['T', c[0], c[1]];
- },
- Z: function Z(c, p, p0) {
- p.x = p0.x;
- p.y = p0.y;
- return ['Z'];
- },
- A: function A(c, p) {
- p.x = c[5];
- p.y = c[6];
- return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]];
- }
- };
-
- var mlhvqtcsa = 'mlhvqtcsaz'.split('');
-
- for (var i = 0, il = mlhvqtcsa.length; i < il; ++i) {
- pathHandlers[mlhvqtcsa[i]] = function (i) {
- return function (c, p, p0) {
- if (i == 'H') c[0] = c[0] + p.x;else if (i == 'V') c[0] = c[0] + p.y;else if (i == 'A') {
- c[5] = c[5] + p.x, c[6] = c[6] + p.y;
- } else for (var j = 0, jl = c.length; j < jl; ++j) {
- c[j] = c[j] + (j % 2 ? p.y : p.x);
- }
-
- return pathHandlers[i](c, p, p0);
- };
- }(mlhvqtcsa[i].toUpperCase());
- }
-
- // Path points array
- SVG.PathArray = function (array, fallback) {
- SVG.Array.call(this, array, fallback || [['M', 0, 0]]);
- };
-
- // Inherit from SVG.Array
- SVG.PathArray.prototype = new SVG.Array();
- SVG.PathArray.prototype.constructor = SVG.PathArray;
-
- SVG.extend(SVG.PathArray, {
- // Convert array to string
- toString: function toString() {
- return arrayToString(this.value);
- }
- // Move path string
- , move: function move(x, y) {
- // get bounding box of current situation
- var box = this.bbox();
-
- // get relative offset
- x -= box.x;
- y -= box.y;
-
- if (!isNaN(x) && !isNaN(y)) {
- // move every point
- for (var l, i = this.value.length - 1; i >= 0; i--) {
- l = this.value[i][0];
-
- if (l == 'M' || l == 'L' || l == 'T') {
- this.value[i][1] += x;
- this.value[i][2] += y;
- } else if (l == 'H') {
- this.value[i][1] += x;
- } else if (l == 'V') {
- this.value[i][1] += y;
- } else if (l == 'C' || l == 'S' || l == 'Q') {
- this.value[i][1] += x;
- this.value[i][2] += y;
- this.value[i][3] += x;
- this.value[i][4] += y;
-
- if (l == 'C') {
- this.value[i][5] += x;
- this.value[i][6] += y;
- }
- } else if (l == 'A') {
- this.value[i][6] += x;
- this.value[i][7] += y;
- }
- }
- }
-
- return this;
- }
- // Resize path string
- , size: function size(width, height) {
- // get bounding box of current situation
- var i,
- l,
- box = this.bbox();
-
- // recalculate position of all points according to new size
- for (i = this.value.length - 1; i >= 0; i--) {
- l = this.value[i][0];
-
- if (l == 'M' || l == 'L' || l == 'T') {
- this.value[i][1] = (this.value[i][1] - box.x) * width / box.width + box.x;
- this.value[i][2] = (this.value[i][2] - box.y) * height / box.height + box.y;
- } else if (l == 'H') {
- this.value[i][1] = (this.value[i][1] - box.x) * width / box.width + box.x;
- } else if (l == 'V') {
- this.value[i][1] = (this.value[i][1] - box.y) * height / box.height + box.y;
- } else if (l == 'C' || l == 'S' || l == 'Q') {
- this.value[i][1] = (this.value[i][1] - box.x) * width / box.width + box.x;
- this.value[i][2] = (this.value[i][2] - box.y) * height / box.height + box.y;
- this.value[i][3] = (this.value[i][3] - box.x) * width / box.width + box.x;
- this.value[i][4] = (this.value[i][4] - box.y) * height / box.height + box.y;
-
- if (l == 'C') {
- this.value[i][5] = (this.value[i][5] - box.x) * width / box.width + box.x;
- this.value[i][6] = (this.value[i][6] - box.y) * height / box.height + box.y;
- }
- } else if (l == 'A') {
- // resize radii
- this.value[i][1] = this.value[i][1] * width / box.width;
- this.value[i][2] = this.value[i][2] * height / box.height;
-
- // move position values
- this.value[i][6] = (this.value[i][6] - box.x) * width / box.width + box.x;
- this.value[i][7] = (this.value[i][7] - box.y) * height / box.height + box.y;
- }
- }
-
- return this;
- }
- // Test if the passed path array use the same path data commands as this path array
- , equalCommands: function equalCommands(pathArray) {
- var i, il, equalCommands;
-
- pathArray = new SVG.PathArray(pathArray);
-
- equalCommands = this.value.length === pathArray.value.length;
- for (i = 0, il = this.value.length; equalCommands && i < il; i++) {
- equalCommands = this.value[i][0] === pathArray.value[i][0];
- }
-
- return equalCommands;
- }
- // Make path array morphable
- , morph: function morph(pathArray) {
- pathArray = new SVG.PathArray(pathArray);
-
- if (this.equalCommands(pathArray)) {
- this.destination = pathArray;
- } else {
- this.destination = null;
- }
-
- return this;
- }
- // Get morphed path array at given position
- , at: function at(pos) {
- // make sure a destination is defined
- if (!this.destination) return this;
-
- var sourceArray = this.value,
- destinationArray = this.destination.value,
- array = [],
- pathArray = new SVG.PathArray(),
- i,
- il,
- j,
- jl;
-
- // Animate has specified in the SVG spec
- // See: https://www.w3.org/TR/SVG11/paths.html#PathElement
- for (i = 0, il = sourceArray.length; i < il; i++) {
- array[i] = [sourceArray[i][0]];
- for (j = 1, jl = sourceArray[i].length; j < jl; j++) {
- array[i][j] = sourceArray[i][j] + (destinationArray[i][j] - sourceArray[i][j]) * pos;
- }
- // For the two flags of the elliptical arc command, the SVG spec say:
- // Flags and booleans are interpolated as fractions between zero and one, with any non-zero value considered to be a value of one/true
- // Elliptical arc command as an array followed by corresponding indexes:
- // ['A', rx, ry, x-axis-rotation, large-arc-flag, sweep-flag, x, y]
- // 0 1 2 3 4 5 6 7
- if (array[i][0] === 'A') {
- array[i][4] = +(array[i][4] != 0);
- array[i][5] = +(array[i][5] != 0);
- }
- }
-
- // Directly modify the value of a path array, this is done this way for performance
- pathArray.value = array;
- return pathArray;
- }
- // Absolutize and parse path to array
- , parse: function parse(array) {
- // if it's already a patharray, no need to parse it
- if (array instanceof SVG.PathArray) return array.valueOf();
-
- // prepare for parsing
- var i,
- x0,
- y0,
- s,
- seg,
- arr,
- x = 0,
- y = 0,
- paramCnt = { 'M': 2, 'L': 2, 'H': 1, 'V': 1, 'C': 6, 'S': 4, 'Q': 4, 'T': 2, 'A': 7, 'Z': 0 };
-
- if (typeof array == 'string') {
-
- array = array.replace(SVG.regex.numbersWithDots, pathRegReplace) // convert 45.123.123 to 45.123 .123
- .replace(SVG.regex.pathLetters, ' $& ') // put some room between letters and numbers
- .replace(SVG.regex.hyphen, '$1 -') // add space before hyphen
- .trim() // trim
- .split(SVG.regex.delimiter); // split into array
- } else {
- array = array.reduce(function (prev, curr) {
- return [].concat.call(prev, curr);
- }, []);
- }
-
- // array now is an array containing all parts of a path e.g. ['M', '0', '0', 'L', '30', '30' ...]
- var arr = [],
- p = new SVG.Point(),
- p0 = new SVG.Point(),
- index = 0,
- len = array.length;
-
- do {
- // Test if we have a path letter
- if (SVG.regex.isPathLetter.test(array[index])) {
- s = array[index];
- ++index;
- // If last letter was a move command and we got no new, it defaults to [L]ine
- } else if (s == 'M') {
- s = 'L';
- } else if (s == 'm') {
- s = 'l';
- }
-
- arr.push(pathHandlers[s].call(null, array.slice(index, index = index + paramCnt[s.toUpperCase()]).map(parseFloat), p, p0));
- } while (len > index);
-
- return arr;
- }
- // Get bounding box of path
- , bbox: function bbox() {
- SVG.parser.path.setAttribute('d', this.toString());
-
- return SVG.parser.path.getBBox();
- }
-
- });
-
- // Module for unit convertions
- SVG.Number = SVG.invent({
- // Initialize
- create: function create(value, unit) {
- // initialize defaults
- this.value = 0;
- this.unit = unit || '';
-
- // parse value
- if (typeof value === 'number') {
- // ensure a valid numeric value
- this.value = isNaN(value) ? 0 : !isFinite(value) ? value < 0 ? -3.4e+38 : +3.4e+38 : value;
- } else if (typeof value === 'string') {
- unit = value.match(SVG.regex.numberAndUnit);
-
- if (unit) {
- // make value numeric
- this.value = parseFloat(unit[1]);
-
- // normalize
- if (unit[5] == '%') this.value /= 100;else if (unit[5] == 's') this.value *= 1000;
-
- // store unit
- this.unit = unit[5];
- }
- } else {
- if (value instanceof SVG.Number) {
- this.value = value.valueOf();
- this.unit = value.unit;
- }
- }
- }
- // Add methods
- , extend: {
- // Stringalize
- toString: function toString() {
- return (this.unit == '%' ? ~~(this.value * 1e8) / 1e6 : this.unit == 's' ? this.value / 1e3 : this.value) + this.unit;
- },
- toJSON: function toJSON() {
- return this.toString();
- },
- // Convert to primitive
- valueOf: function valueOf() {
- return this.value;
- }
- // Add number
- , plus: function plus(number) {
- number = new SVG.Number(number);
- return new SVG.Number(this + number, this.unit || number.unit);
- }
- // Subtract number
- , minus: function minus(number) {
- number = new SVG.Number(number);
- return new SVG.Number(this - number, this.unit || number.unit);
- }
- // Multiply number
- , times: function times(number) {
- number = new SVG.Number(number);
- return new SVG.Number(this * number, this.unit || number.unit);
- }
- // Divide number
- , divide: function divide(number) {
- number = new SVG.Number(number);
- return new SVG.Number(this / number, this.unit || number.unit);
- }
- // Convert to different unit
- , to: function to(unit) {
- var number = new SVG.Number(this);
-
- if (typeof unit === 'string') number.unit = unit;
-
- return number;
- }
- // Make number morphable
- , morph: function morph(number) {
- this.destination = new SVG.Number(number);
-
- if (number.relative) {
- this.destination.value += this.value;
- }
-
- return this;
- }
- // Get morphed number at given position
- , at: function at(pos) {
- // Make sure a destination is defined
- if (!this.destination) return this;
-
- // Generate new morphed number
- return new SVG.Number(this.destination).minus(this).times(pos).plus(this);
- }
-
- }
- });
-
- SVG.Element = SVG.invent({
- // Initialize node
- create: function create(node) {
- // make stroke value accessible dynamically
- this._stroke = SVG.defaults.attrs.stroke;
- this._event = null;
-
- // initialize data object
- this.dom = {};
-
- // create circular reference
- if (this.node = node) {
- this.type = node.nodeName;
- this.node.instance = this;
-
- // store current attribute value
- this._stroke = node.getAttribute('stroke') || this._stroke;
- }
- }
-
- // Add class methods
- , extend: {
- // Move over x-axis
- x: function x(_x) {
- return this.attr('x', _x);
- }
- // Move over y-axis
- , y: function y(_y) {
- return this.attr('y', _y);
- }
- // Move by center over x-axis
- , cx: function cx(x) {
- return x == null ? this.x() + this.width() / 2 : this.x(x - this.width() / 2);
- }
- // Move by center over y-axis
- , cy: function cy(y) {
- return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2);
- }
- // Move element to given x and y values
- , move: function move(x, y) {
- return this.x(x).y(y);
- }
- // Move element by its center
- , center: function center(x, y) {
- return this.cx(x).cy(y);
- }
- // Set width of element
- , width: function width(_width) {
- return this.attr('width', _width);
- }
- // Set height of element
- , height: function height(_height) {
- return this.attr('height', _height);
- }
- // Set element size to given width and height
- , size: function size(width, height) {
- var p = proportionalSize(this, width, height);
-
- return this.width(new SVG.Number(p.width)).height(new SVG.Number(p.height));
- }
- // Clone element
- , clone: function clone(parent) {
- // write dom data to the dom so the clone can pickup the data
- this.writeDataToDom();
-
- // clone element and assign new id
- var clone = assignNewId(this.node.cloneNode(true));
-
- // insert the clone in the given parent or after myself
- if (parent) parent.add(clone);else this.after(clone);
-
- return clone;
- }
- // Remove element
- , remove: function remove() {
- if (this.parent()) this.parent().removeElement(this);
-
- return this;
- }
- // Replace element
- , replace: function replace(element) {
- this.after(element).remove();
-
- return element;
- }
- // Add element to given container and return self
- , addTo: function addTo(parent) {
- return parent.put(this);
- }
- // Add element to given container and return container
- , putIn: function putIn(parent) {
- return parent.add(this);
- }
- // Get / set id
- , id: function id(_id) {
- return this.attr('id', _id);
- }
- // Checks whether the given point inside the bounding box of the element
- , inside: function inside(x, y) {
- var box = this.bbox();
-
- return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height;
- }
- // Show element
- , show: function show() {
- return this.style('display', '');
- }
- // Hide element
- , hide: function hide() {
- return this.style('display', 'none');
- }
- // Is element visible?
- , visible: function visible() {
- return this.style('display') != 'none';
- }
- // Return id on string conversion
- , toString: function toString() {
- return this.attr('id');
- }
- // Return array of classes on the node
- , classes: function classes() {
- var attr = this.attr('class');
-
- return attr == null ? [] : attr.trim().split(SVG.regex.delimiter);
- }
- // Return true if class exists on the node, false otherwise
- , hasClass: function hasClass(name) {
- return this.classes().indexOf(name) != -1;
- }
- // Add class to the node
- , addClass: function addClass(name) {
- if (!this.hasClass(name)) {
- var array = this.classes();
- array.push(name);
- this.attr('class', array.join(' '));
- }
-
- return this;
- }
- // Remove class from the node
- , removeClass: function removeClass(name) {
- if (this.hasClass(name)) {
- this.attr('class', this.classes().filter(function (c) {
- return c != name;
- }).join(' '));
- }
-
- return this;
- }
- // Toggle the presence of a class on the node
- , toggleClass: function toggleClass(name) {
- return this.hasClass(name) ? this.removeClass(name) : this.addClass(name);
- }
- // Get referenced element form attribute value
- , reference: function reference(attr) {
- return SVG.get(this.attr(attr));
- }
- // Returns the parent element instance
- , parent: function parent(type) {
- var parent = this;
-
- // check for parent
- if (!parent.node.parentNode) return null;
-
- // get parent element
- parent = SVG.adopt(parent.node.parentNode);
-
- if (!type) return parent;
-
- // loop trough ancestors if type is given
- while (parent && parent.node instanceof window.SVGElement) {
- if (typeof type === 'string' ? parent.matches(type) : parent instanceof type) return parent;
- if (!parent.node.parentNode || parent.node.parentNode.nodeName == '#document') return null; // #759, #720
- parent = SVG.adopt(parent.node.parentNode);
- }
- }
- // Get parent document
- , doc: function doc() {
- return this instanceof SVG.Doc ? this : this.parent(SVG.Doc);
- }
- // return array of all ancestors of given type up to the root svg
- , parents: function parents(type) {
- var parents = [],
- parent = this;
-
- do {
- parent = parent.parent(type);
- if (!parent || !parent.node) break;
-
- parents.push(parent);
- } while (parent.parent);
-
- return parents;
- }
- // matches the element vs a css selector
- , matches: function matches(selector) {
- return _matches(this.node, selector);
- }
- // Returns the svg node to call native svg methods on it
- , native: function native() {
- return this.node;
- }
- // Import raw svg
- , svg: function svg(_svg) {
- // create temporary holder
- var well = document.createElement('svg');
-
- // act as a setter if svg is given
- if (_svg && this instanceof SVG.Parent) {
- // dump raw svg
- well.innerHTML = '';
-
- // transplant nodes
- for (var i = 0, il = well.firstChild.childNodes.length; i < il; i++) {
- this.node.appendChild(well.firstChild.firstChild);
- } // otherwise act as a getter
- } else {
- // create a wrapping svg element in case of partial content
- well.appendChild(_svg = document.createElement('svg'));
-
- // write svgjs data to the dom
- this.writeDataToDom();
-
- // insert a copy of this node
- _svg.appendChild(this.node.cloneNode(true));
-
- // return target element
- return well.innerHTML.replace(/^