1661 lines
62 KiB
JavaScript
1661 lines
62 KiB
JavaScript
|
/* Chartist.js 0.9.7
|
||
|
* Copyright © 2016 Gion Kunz
|
||
|
* Free to use under either the WTFPL license or the MIT license.
|
||
|
* https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-WTFPL
|
||
|
* https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-MIT
|
||
|
*/
|
||
|
|
||
|
!(function (a, b) {
|
||
|
'function' == typeof define && define.amd
|
||
|
? define([], function () {
|
||
|
return (a.Chartist = b());
|
||
|
})
|
||
|
: 'object' == typeof exports
|
||
|
? (module.exports = b())
|
||
|
: (a.Chartist = b());
|
||
|
})(this, function () {
|
||
|
var a = { version: '0.9.7' };
|
||
|
return (
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
(c.namespaces = {
|
||
|
svg: 'http://www.w3.org/2000/svg',
|
||
|
xmlns: 'http://www.w3.org/2000/xmlns/',
|
||
|
xhtml: 'http://www.w3.org/1999/xhtml',
|
||
|
xlink: 'http://www.w3.org/1999/xlink',
|
||
|
ct: 'http://gionkunz.github.com/chartist-js/ct',
|
||
|
}),
|
||
|
(c.noop = function (a) {
|
||
|
return a;
|
||
|
}),
|
||
|
(c.alphaNumerate = function (a) {
|
||
|
return String.fromCharCode(97 + (a % 26));
|
||
|
}),
|
||
|
(c.extend = function (a) {
|
||
|
a = a || {};
|
||
|
var b = Array.prototype.slice.call(arguments, 1);
|
||
|
return (
|
||
|
b.forEach(function (b) {
|
||
|
for (var d in b)
|
||
|
'object' != typeof b[d] || null === b[d] || b[d] instanceof Array ? (a[d] = b[d]) : (a[d] = c.extend({}, a[d], b[d]));
|
||
|
}),
|
||
|
a
|
||
|
);
|
||
|
}),
|
||
|
(c.replaceAll = function (a, b, c) {
|
||
|
return a.replace(new RegExp(b, 'g'), c);
|
||
|
}),
|
||
|
(c.ensureUnit = function (a, b) {
|
||
|
return 'number' == typeof a && (a += b), a;
|
||
|
}),
|
||
|
(c.quantity = function (a) {
|
||
|
if ('string' == typeof a) {
|
||
|
var b = /^(\d+)\s*(.*)$/g.exec(a);
|
||
|
return { value: +b[1], unit: b[2] || void 0 };
|
||
|
}
|
||
|
return { value: a };
|
||
|
}),
|
||
|
(c.querySelector = function (a) {
|
||
|
return a instanceof Node ? a : b.querySelector(a);
|
||
|
}),
|
||
|
(c.times = function (a) {
|
||
|
return Array.apply(null, new Array(a));
|
||
|
}),
|
||
|
(c.sum = function (a, b) {
|
||
|
return a + (b ? b : 0);
|
||
|
}),
|
||
|
(c.mapMultiply = function (a) {
|
||
|
return function (b) {
|
||
|
return b * a;
|
||
|
};
|
||
|
}),
|
||
|
(c.mapAdd = function (a) {
|
||
|
return function (b) {
|
||
|
return b + a;
|
||
|
};
|
||
|
}),
|
||
|
(c.serialMap = function (a, b) {
|
||
|
var d = [],
|
||
|
e = Math.max.apply(
|
||
|
null,
|
||
|
a.map(function (a) {
|
||
|
return a.length;
|
||
|
})
|
||
|
);
|
||
|
return (
|
||
|
c.times(e).forEach(function (c, e) {
|
||
|
var f = a.map(function (a) {
|
||
|
return a[e];
|
||
|
});
|
||
|
d[e] = b.apply(null, f);
|
||
|
}),
|
||
|
d
|
||
|
);
|
||
|
}),
|
||
|
(c.roundWithPrecision = function (a, b) {
|
||
|
var d = Math.pow(10, b || c.precision);
|
||
|
return Math.round(a * d) / d;
|
||
|
}),
|
||
|
(c.precision = 8),
|
||
|
(c.escapingMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }),
|
||
|
(c.serialize = function (a) {
|
||
|
return null === a || void 0 === a
|
||
|
? a
|
||
|
: ('number' == typeof a ? (a = '' + a) : 'object' == typeof a && (a = JSON.stringify({ data: a })),
|
||
|
Object.keys(c.escapingMap).reduce(function (a, b) {
|
||
|
return c.replaceAll(a, b, c.escapingMap[b]);
|
||
|
}, a));
|
||
|
}),
|
||
|
(c.deserialize = function (a) {
|
||
|
if ('string' != typeof a) return a;
|
||
|
a = Object.keys(c.escapingMap).reduce(function (a, b) {
|
||
|
return c.replaceAll(a, c.escapingMap[b], b);
|
||
|
}, a);
|
||
|
try {
|
||
|
(a = JSON.parse(a)), (a = void 0 !== a.data ? a.data : a);
|
||
|
} catch (b) {}
|
||
|
return a;
|
||
|
}),
|
||
|
(c.createSvg = function (a, b, d, e) {
|
||
|
var f;
|
||
|
return (
|
||
|
(b = b || '100%'),
|
||
|
(d = d || '100%'),
|
||
|
Array.prototype.slice
|
||
|
.call(a.querySelectorAll('svg'))
|
||
|
.filter(function (a) {
|
||
|
return a.getAttributeNS(c.namespaces.xmlns, 'ct');
|
||
|
})
|
||
|
.forEach(function (b) {
|
||
|
a.removeChild(b);
|
||
|
}),
|
||
|
(f = new c.Svg('svg')
|
||
|
.attr({ width: b, height: d })
|
||
|
.addClass(e)
|
||
|
.attr({ style: 'width: ' + b + '; height: ' + d + ';' })),
|
||
|
a.appendChild(f._node),
|
||
|
f
|
||
|
);
|
||
|
}),
|
||
|
(c.normalizeData = function (a) {
|
||
|
if (
|
||
|
((a = a || { series: [], labels: [] }),
|
||
|
(a.series = a.series || []),
|
||
|
(a.labels = a.labels || []),
|
||
|
a.series.length > 0 && 0 === a.labels.length)
|
||
|
) {
|
||
|
var b,
|
||
|
d = c.getDataArray(a);
|
||
|
(b = d.every(function (a) {
|
||
|
return a instanceof Array;
|
||
|
})
|
||
|
? Math.max.apply(
|
||
|
null,
|
||
|
d.map(function (a) {
|
||
|
return a.length;
|
||
|
})
|
||
|
)
|
||
|
: d.length),
|
||
|
(a.labels = c.times(b).map(function () {
|
||
|
return '';
|
||
|
}));
|
||
|
}
|
||
|
return a;
|
||
|
}),
|
||
|
(c.reverseData = function (a) {
|
||
|
a.labels.reverse(), a.series.reverse();
|
||
|
for (var b = 0; b < a.series.length; b++)
|
||
|
'object' == typeof a.series[b] && void 0 !== a.series[b].data
|
||
|
? a.series[b].data.reverse()
|
||
|
: a.series[b] instanceof Array && a.series[b].reverse();
|
||
|
}),
|
||
|
(c.getDataArray = function (a, b, d) {
|
||
|
function e(a) {
|
||
|
if (!c.isFalseyButZero(a)) {
|
||
|
if ((a.data || a) instanceof Array) return (a.data || a).map(e);
|
||
|
if (a.hasOwnProperty('value')) return e(a.value);
|
||
|
if (d) {
|
||
|
var b = {};
|
||
|
return (
|
||
|
'string' == typeof d ? (b[d] = c.getNumberOrUndefined(a)) : (b.y = c.getNumberOrUndefined(a)),
|
||
|
(b.x = a.hasOwnProperty('x') ? c.getNumberOrUndefined(a.x) : b.x),
|
||
|
(b.y = a.hasOwnProperty('y') ? c.getNumberOrUndefined(a.y) : b.y),
|
||
|
b
|
||
|
);
|
||
|
}
|
||
|
return c.getNumberOrUndefined(a);
|
||
|
}
|
||
|
}
|
||
|
return ((b && !a.reversed) || (!b && a.reversed)) && (c.reverseData(a), (a.reversed = !a.reversed)), a.series.map(e);
|
||
|
}),
|
||
|
(c.normalizePadding = function (a, b) {
|
||
|
return (
|
||
|
(b = b || 0),
|
||
|
'number' == typeof a
|
||
|
? { top: a, right: a, bottom: a, left: a }
|
||
|
: {
|
||
|
top: 'number' == typeof a.top ? a.top : b,
|
||
|
right: 'number' == typeof a.right ? a.right : b,
|
||
|
bottom: 'number' == typeof a.bottom ? a.bottom : b,
|
||
|
left: 'number' == typeof a.left ? a.left : b,
|
||
|
}
|
||
|
);
|
||
|
}),
|
||
|
(c.getMetaData = function (a, b) {
|
||
|
var d = a.data ? a.data[b] : a[b];
|
||
|
return d ? c.serialize(d.meta) : void 0;
|
||
|
}),
|
||
|
(c.orderOfMagnitude = function (a) {
|
||
|
return Math.floor(Math.log(Math.abs(a)) / Math.LN10);
|
||
|
}),
|
||
|
(c.projectLength = function (a, b, c) {
|
||
|
return (b / c.range) * a;
|
||
|
}),
|
||
|
(c.getAvailableHeight = function (a, b) {
|
||
|
return Math.max((c.quantity(b.height).value || a.height()) - (b.chartPadding.top + b.chartPadding.bottom) - b.axisX.offset, 0);
|
||
|
}),
|
||
|
(c.getHighLow = function (a, b, d) {
|
||
|
function e(a) {
|
||
|
if (void 0 !== a)
|
||
|
if (a instanceof Array) for (var b = 0; b < a.length; b++) e(a[b]);
|
||
|
else {
|
||
|
var c = d ? +a[d] : +a;
|
||
|
g && c > f.high && (f.high = c), h && c < f.low && (f.low = c);
|
||
|
}
|
||
|
}
|
||
|
b = c.extend({}, b, d ? b['axis' + d.toUpperCase()] : {});
|
||
|
var f = { high: void 0 === b.high ? -Number.MAX_VALUE : +b.high, low: void 0 === b.low ? Number.MAX_VALUE : +b.low },
|
||
|
g = void 0 === b.high,
|
||
|
h = void 0 === b.low;
|
||
|
return (
|
||
|
(g || h) && e(a),
|
||
|
(b.referenceValue || 0 === b.referenceValue) &&
|
||
|
((f.high = Math.max(b.referenceValue, f.high)), (f.low = Math.min(b.referenceValue, f.low))),
|
||
|
f.high <= f.low &&
|
||
|
(0 === f.low ? (f.high = 1) : f.low < 0 ? (f.high = 0) : f.high > 0 ? (f.low = 0) : ((f.high = 1), (f.low = 0))),
|
||
|
f
|
||
|
);
|
||
|
}),
|
||
|
(c.isNum = function (a) {
|
||
|
return !isNaN(a) && isFinite(a);
|
||
|
}),
|
||
|
(c.isFalseyButZero = function (a) {
|
||
|
return !a && 0 !== a;
|
||
|
}),
|
||
|
(c.getNumberOrUndefined = function (a) {
|
||
|
return isNaN(+a) ? void 0 : +a;
|
||
|
}),
|
||
|
(c.getMultiValue = function (a, b) {
|
||
|
return c.isNum(a) ? +a : a ? a[b || 'y'] || 0 : 0;
|
||
|
}),
|
||
|
(c.rho = function (a) {
|
||
|
function b(a, c) {
|
||
|
return a % c === 0 ? c : b(c, a % c);
|
||
|
}
|
||
|
function c(a) {
|
||
|
return a * a + 1;
|
||
|
}
|
||
|
if (1 === a) return a;
|
||
|
var d,
|
||
|
e = 2,
|
||
|
f = 2;
|
||
|
if (a % 2 === 0) return 2;
|
||
|
do (e = c(e) % a), (f = c(c(f)) % a), (d = b(Math.abs(e - f), a));
|
||
|
while (1 === d);
|
||
|
return d;
|
||
|
}),
|
||
|
(c.getBounds = function (a, b, d, e) {
|
||
|
var f,
|
||
|
g,
|
||
|
h,
|
||
|
i = 0,
|
||
|
j = { high: b.high, low: b.low };
|
||
|
(j.valueRange = j.high - j.low),
|
||
|
(j.oom = c.orderOfMagnitude(j.valueRange)),
|
||
|
(j.step = Math.pow(10, j.oom)),
|
||
|
(j.min = Math.floor(j.low / j.step) * j.step),
|
||
|
(j.max = Math.ceil(j.high / j.step) * j.step),
|
||
|
(j.range = j.max - j.min),
|
||
|
(j.numberOfSteps = Math.round(j.range / j.step));
|
||
|
var k = c.projectLength(a, j.step, j),
|
||
|
l = d > k,
|
||
|
m = e ? c.rho(j.range) : 0;
|
||
|
if (e && c.projectLength(a, 1, j) >= d) j.step = 1;
|
||
|
else if (e && m < j.step && c.projectLength(a, m, j) >= d) j.step = m;
|
||
|
else
|
||
|
for (;;) {
|
||
|
if (l && c.projectLength(a, j.step, j) <= d) j.step *= 2;
|
||
|
else {
|
||
|
if (l || !(c.projectLength(a, j.step / 2, j) >= d)) break;
|
||
|
if (((j.step /= 2), e && j.step % 1 !== 0)) {
|
||
|
j.step *= 2;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
if (i++ > 1e3) throw new Error('Exceeded maximum number of iterations while optimizing scale step!');
|
||
|
}
|
||
|
for (g = j.min, h = j.max; g + j.step <= j.low; ) g += j.step;
|
||
|
for (; h - j.step >= j.high; ) h -= j.step;
|
||
|
for (j.min = g, j.max = h, j.range = j.max - j.min, j.values = [], f = j.min; f <= j.max; f += j.step)
|
||
|
j.values.push(c.roundWithPrecision(f));
|
||
|
return j;
|
||
|
}),
|
||
|
(c.polarToCartesian = function (a, b, c, d) {
|
||
|
var e = ((d - 90) * Math.PI) / 180;
|
||
|
return { x: a + c * Math.cos(e), y: b + c * Math.sin(e) };
|
||
|
}),
|
||
|
(c.createChartRect = function (a, b, d) {
|
||
|
var e = !(!b.axisX && !b.axisY),
|
||
|
f = e ? b.axisY.offset : 0,
|
||
|
g = e ? b.axisX.offset : 0,
|
||
|
h = a.width() || c.quantity(b.width).value || 0,
|
||
|
i = a.height() || c.quantity(b.height).value || 0,
|
||
|
j = c.normalizePadding(b.chartPadding, d);
|
||
|
(h = Math.max(h, f + j.left + j.right)), (i = Math.max(i, g + j.top + j.bottom));
|
||
|
var k = {
|
||
|
padding: j,
|
||
|
width: function () {
|
||
|
return this.x2 - this.x1;
|
||
|
},
|
||
|
height: function () {
|
||
|
return this.y1 - this.y2;
|
||
|
},
|
||
|
};
|
||
|
return (
|
||
|
e
|
||
|
? ('start' === b.axisX.position
|
||
|
? ((k.y2 = j.top + g), (k.y1 = Math.max(i - j.bottom, k.y2 + 1)))
|
||
|
: ((k.y2 = j.top), (k.y1 = Math.max(i - j.bottom - g, k.y2 + 1))),
|
||
|
'start' === b.axisY.position
|
||
|
? ((k.x1 = j.left + f), (k.x2 = Math.max(h - j.right, k.x1 + 1)))
|
||
|
: ((k.x1 = j.left), (k.x2 = Math.max(h - j.right - f, k.x1 + 1))))
|
||
|
: ((k.x1 = j.left), (k.x2 = Math.max(h - j.right, k.x1 + 1)), (k.y2 = j.top), (k.y1 = Math.max(i - j.bottom, k.y2 + 1))),
|
||
|
k
|
||
|
);
|
||
|
}),
|
||
|
(c.createGrid = function (a, b, d, e, f, g, h, i) {
|
||
|
var j = {};
|
||
|
(j[d.units.pos + '1'] = a), (j[d.units.pos + '2'] = a), (j[d.counterUnits.pos + '1'] = e), (j[d.counterUnits.pos + '2'] = e + f);
|
||
|
var k = g.elem('line', j, h.join(' '));
|
||
|
i.emit('draw', c.extend({ type: 'grid', axis: d, index: b, group: g, element: k }, j));
|
||
|
}),
|
||
|
(c.createLabel = function (a, b, d, e, f, g, h, i, j, k, l) {
|
||
|
var m,
|
||
|
n = {};
|
||
|
if (
|
||
|
((n[f.units.pos] = a + h[f.units.pos]),
|
||
|
(n[f.counterUnits.pos] = h[f.counterUnits.pos]),
|
||
|
(n[f.units.len] = b),
|
||
|
(n[f.counterUnits.len] = g - 10),
|
||
|
k)
|
||
|
) {
|
||
|
var o =
|
||
|
'<span class="' +
|
||
|
j.join(' ') +
|
||
|
'" style="' +
|
||
|
f.units.len +
|
||
|
': ' +
|
||
|
Math.round(n[f.units.len]) +
|
||
|
'px; ' +
|
||
|
f.counterUnits.len +
|
||
|
': ' +
|
||
|
Math.round(n[f.counterUnits.len]) +
|
||
|
'px">' +
|
||
|
e[d] +
|
||
|
'</span>';
|
||
|
m = i.foreignObject(o, c.extend({ style: 'overflow: visible;' }, n));
|
||
|
} else m = i.elem('text', n, j.join(' ')).text(e[d]);
|
||
|
l.emit('draw', c.extend({ type: 'label', axis: f, index: d, group: i, element: m, text: e[d] }, n));
|
||
|
}),
|
||
|
(c.getSeriesOption = function (a, b, c) {
|
||
|
if (a.name && b.series && b.series[a.name]) {
|
||
|
var d = b.series[a.name];
|
||
|
return d.hasOwnProperty(c) ? d[c] : b[c];
|
||
|
}
|
||
|
return b[c];
|
||
|
}),
|
||
|
(c.optionsProvider = function (b, d, e) {
|
||
|
function f(b) {
|
||
|
var f = h;
|
||
|
if (((h = c.extend({}, j)), d))
|
||
|
for (i = 0; i < d.length; i++) {
|
||
|
var g = a.matchMedia(d[i][0]);
|
||
|
g.matches && (h = c.extend(h, d[i][1]));
|
||
|
}
|
||
|
e && !b && e.emit('optionsChanged', { previousOptions: f, currentOptions: h });
|
||
|
}
|
||
|
function g() {
|
||
|
k.forEach(function (a) {
|
||
|
a.removeListener(f);
|
||
|
});
|
||
|
}
|
||
|
var h,
|
||
|
i,
|
||
|
j = c.extend({}, b),
|
||
|
k = [];
|
||
|
if (!a.matchMedia) throw "window.matchMedia not found! Make sure you're using a polyfill.";
|
||
|
if (d)
|
||
|
for (i = 0; i < d.length; i++) {
|
||
|
var l = a.matchMedia(d[i][0]);
|
||
|
l.addListener(f), k.push(l);
|
||
|
}
|
||
|
return (
|
||
|
f(!0),
|
||
|
{
|
||
|
removeMediaQueryListeners: g,
|
||
|
getCurrentOptions: function () {
|
||
|
return c.extend({}, h);
|
||
|
},
|
||
|
}
|
||
|
);
|
||
|
});
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
(c.Interpolation = {}),
|
||
|
(c.Interpolation.none = function (a) {
|
||
|
var b = { fillHoles: !1 };
|
||
|
return (
|
||
|
(a = c.extend({}, b, a)),
|
||
|
function (b, d) {
|
||
|
for (var e = new c.Svg.Path(), f = !0, g = 0; g < b.length; g += 2) {
|
||
|
var h = b[g],
|
||
|
i = b[g + 1],
|
||
|
j = d[g / 2];
|
||
|
void 0 !== j.value ? (f ? e.move(h, i, !1, j) : e.line(h, i, !1, j), (f = !1)) : a.fillHoles || (f = !0);
|
||
|
}
|
||
|
return e;
|
||
|
}
|
||
|
);
|
||
|
}),
|
||
|
(c.Interpolation.simple = function (a) {
|
||
|
var b = { divisor: 2, fillHoles: !1 };
|
||
|
a = c.extend({}, b, a);
|
||
|
var d = 1 / Math.max(1, a.divisor);
|
||
|
return function (b, e) {
|
||
|
for (var f, g, h, i = new c.Svg.Path(), j = 0; j < b.length; j += 2) {
|
||
|
var k = b[j],
|
||
|
l = b[j + 1],
|
||
|
m = (k - f) * d,
|
||
|
n = e[j / 2];
|
||
|
void 0 !== n.value
|
||
|
? (void 0 === h ? i.move(k, l, !1, n) : i.curve(f + m, g, k - m, l, k, l, !1, n), (f = k), (g = l), (h = n))
|
||
|
: a.fillHoles || (f = k = h = void 0);
|
||
|
}
|
||
|
return i;
|
||
|
};
|
||
|
}),
|
||
|
(c.Interpolation.cardinal = function (a) {
|
||
|
function b(b, c) {
|
||
|
for (var d = [], e = !0, f = 0; f < b.length; f += 2)
|
||
|
void 0 === c[f / 2].value
|
||
|
? a.fillHoles || (e = !0)
|
||
|
: (e && (d.push({ pathCoordinates: [], valueData: [] }), (e = !1)),
|
||
|
d[d.length - 1].pathCoordinates.push(b[f], b[f + 1]),
|
||
|
d[d.length - 1].valueData.push(c[f / 2]));
|
||
|
return d;
|
||
|
}
|
||
|
var d = { tension: 1, fillHoles: !1 };
|
||
|
a = c.extend({}, d, a);
|
||
|
var e = Math.min(1, Math.max(0, a.tension)),
|
||
|
f = 1 - e;
|
||
|
return function g(a, d) {
|
||
|
var h = b(a, d);
|
||
|
if (h.length) {
|
||
|
if (h.length > 1) {
|
||
|
var i = [];
|
||
|
return (
|
||
|
h.forEach(function (a) {
|
||
|
i.push(g(a.pathCoordinates, a.valueData));
|
||
|
}),
|
||
|
c.Svg.Path.join(i)
|
||
|
);
|
||
|
}
|
||
|
if (((a = h[0].pathCoordinates), (d = h[0].valueData), a.length <= 4)) return c.Interpolation.none()(a, d);
|
||
|
for (var j, k = new c.Svg.Path().move(a[0], a[1], !1, d[0]), l = 0, m = a.length; m - 2 * !j > l; l += 2) {
|
||
|
var n = [
|
||
|
{ x: +a[l - 2], y: +a[l - 1] },
|
||
|
{ x: +a[l], y: +a[l + 1] },
|
||
|
{ x: +a[l + 2], y: +a[l + 3] },
|
||
|
{ x: +a[l + 4], y: +a[l + 5] },
|
||
|
];
|
||
|
j
|
||
|
? l
|
||
|
? m - 4 === l
|
||
|
? (n[3] = { x: +a[0], y: +a[1] })
|
||
|
: m - 2 === l && ((n[2] = { x: +a[0], y: +a[1] }), (n[3] = { x: +a[2], y: +a[3] }))
|
||
|
: (n[0] = { x: +a[m - 2], y: +a[m - 1] })
|
||
|
: m - 4 === l
|
||
|
? (n[3] = n[2])
|
||
|
: l || (n[0] = { x: +a[l], y: +a[l + 1] }),
|
||
|
k.curve(
|
||
|
(e * (-n[0].x + 6 * n[1].x + n[2].x)) / 6 + f * n[2].x,
|
||
|
(e * (-n[0].y + 6 * n[1].y + n[2].y)) / 6 + f * n[2].y,
|
||
|
(e * (n[1].x + 6 * n[2].x - n[3].x)) / 6 + f * n[2].x,
|
||
|
(e * (n[1].y + 6 * n[2].y - n[3].y)) / 6 + f * n[2].y,
|
||
|
n[2].x,
|
||
|
n[2].y,
|
||
|
!1,
|
||
|
d[(l + 2) / 2]
|
||
|
);
|
||
|
}
|
||
|
return k;
|
||
|
}
|
||
|
return c.Interpolation.none()([]);
|
||
|
};
|
||
|
}),
|
||
|
(c.Interpolation.step = function (a) {
|
||
|
var b = { postpone: !0, fillHoles: !1 };
|
||
|
return (
|
||
|
(a = c.extend({}, b, a)),
|
||
|
function (b, d) {
|
||
|
for (var e, f, g, h = new c.Svg.Path(), i = 0; i < b.length; i += 2) {
|
||
|
var j = b[i],
|
||
|
k = b[i + 1],
|
||
|
l = d[i / 2];
|
||
|
void 0 !== l.value
|
||
|
? (void 0 === g ? h.move(j, k, !1, l) : (a.postpone ? h.line(j, f, !1, g) : h.line(e, k, !1, l), h.line(j, k, !1, l)),
|
||
|
(e = j),
|
||
|
(f = k),
|
||
|
(g = l))
|
||
|
: a.fillHoles || (e = f = g = void 0);
|
||
|
}
|
||
|
return h;
|
||
|
}
|
||
|
);
|
||
|
});
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
c.EventEmitter = function () {
|
||
|
function a(a, b) {
|
||
|
(d[a] = d[a] || []), d[a].push(b);
|
||
|
}
|
||
|
function b(a, b) {
|
||
|
d[a] && (b ? (d[a].splice(d[a].indexOf(b), 1), 0 === d[a].length && delete d[a]) : delete d[a]);
|
||
|
}
|
||
|
function c(a, b) {
|
||
|
d[a] &&
|
||
|
d[a].forEach(function (a) {
|
||
|
a(b);
|
||
|
}),
|
||
|
d['*'] &&
|
||
|
d['*'].forEach(function (c) {
|
||
|
c(a, b);
|
||
|
});
|
||
|
}
|
||
|
var d = [];
|
||
|
return { addEventHandler: a, removeEventHandler: b, emit: c };
|
||
|
};
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a) {
|
||
|
var b = [];
|
||
|
if (a.length) for (var c = 0; c < a.length; c++) b.push(a[c]);
|
||
|
return b;
|
||
|
}
|
||
|
function e(a, b) {
|
||
|
var d = b || this.prototype || c.Class,
|
||
|
e = Object.create(d);
|
||
|
c.Class.cloneDefinitions(e, a);
|
||
|
var f = function () {
|
||
|
var a,
|
||
|
b = e.constructor || function () {};
|
||
|
return (a = this === c ? Object.create(e) : this), b.apply(a, Array.prototype.slice.call(arguments, 0)), a;
|
||
|
};
|
||
|
return (f.prototype = e), (f['super'] = d), (f.extend = this.extend), f;
|
||
|
}
|
||
|
function f() {
|
||
|
var a = d(arguments),
|
||
|
b = a[0];
|
||
|
return (
|
||
|
a.splice(1, a.length - 1).forEach(function (a) {
|
||
|
Object.getOwnPropertyNames(a).forEach(function (c) {
|
||
|
delete b[c], Object.defineProperty(b, c, Object.getOwnPropertyDescriptor(a, c));
|
||
|
});
|
||
|
}),
|
||
|
b
|
||
|
);
|
||
|
}
|
||
|
c.Class = { extend: e, cloneDefinitions: f };
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a, b, d) {
|
||
|
return (
|
||
|
a && ((this.data = a), this.eventEmitter.emit('data', { type: 'update', data: this.data })),
|
||
|
b &&
|
||
|
((this.options = c.extend({}, d ? this.options : this.defaultOptions, b)),
|
||
|
this.initializeTimeoutId ||
|
||
|
(this.optionsProvider.removeMediaQueryListeners(),
|
||
|
(this.optionsProvider = c.optionsProvider(this.options, this.responsiveOptions, this.eventEmitter)))),
|
||
|
this.initializeTimeoutId || this.createChart(this.optionsProvider.getCurrentOptions()),
|
||
|
this
|
||
|
);
|
||
|
}
|
||
|
function e() {
|
||
|
return (
|
||
|
this.initializeTimeoutId
|
||
|
? a.clearTimeout(this.initializeTimeoutId)
|
||
|
: (a.removeEventListener('resize', this.resizeListener), this.optionsProvider.removeMediaQueryListeners()),
|
||
|
this
|
||
|
);
|
||
|
}
|
||
|
function f(a, b) {
|
||
|
return this.eventEmitter.addEventHandler(a, b), this;
|
||
|
}
|
||
|
function g(a, b) {
|
||
|
return this.eventEmitter.removeEventHandler(a, b), this;
|
||
|
}
|
||
|
function h() {
|
||
|
a.addEventListener('resize', this.resizeListener),
|
||
|
(this.optionsProvider = c.optionsProvider(this.options, this.responsiveOptions, this.eventEmitter)),
|
||
|
this.eventEmitter.addEventHandler(
|
||
|
'optionsChanged',
|
||
|
function () {
|
||
|
this.update();
|
||
|
}.bind(this)
|
||
|
),
|
||
|
this.options.plugins &&
|
||
|
this.options.plugins.forEach(
|
||
|
function (a) {
|
||
|
a instanceof Array ? a[0](this, a[1]) : a(this);
|
||
|
}.bind(this)
|
||
|
),
|
||
|
this.eventEmitter.emit('data', { type: 'initial', data: this.data }),
|
||
|
this.createChart(this.optionsProvider.getCurrentOptions()),
|
||
|
(this.initializeTimeoutId = void 0);
|
||
|
}
|
||
|
function i(a, b, d, e, f) {
|
||
|
(this.container = c.querySelector(a)),
|
||
|
(this.data = b),
|
||
|
(this.defaultOptions = d),
|
||
|
(this.options = e),
|
||
|
(this.responsiveOptions = f),
|
||
|
(this.eventEmitter = c.EventEmitter()),
|
||
|
(this.supportsForeignObject = c.Svg.isSupported('Extensibility')),
|
||
|
(this.supportsAnimations = c.Svg.isSupported('AnimationEventsAttribute')),
|
||
|
(this.resizeListener = function () {
|
||
|
this.update();
|
||
|
}.bind(this)),
|
||
|
this.container && (this.container.__chartist__ && this.container.__chartist__.detach(), (this.container.__chartist__ = this)),
|
||
|
(this.initializeTimeoutId = setTimeout(h.bind(this), 0));
|
||
|
}
|
||
|
c.Base = c.Class.extend({
|
||
|
constructor: i,
|
||
|
optionsProvider: void 0,
|
||
|
container: void 0,
|
||
|
svg: void 0,
|
||
|
eventEmitter: void 0,
|
||
|
createChart: function () {
|
||
|
throw new Error("Base chart type can't be instantiated!");
|
||
|
},
|
||
|
update: d,
|
||
|
detach: e,
|
||
|
on: f,
|
||
|
off: g,
|
||
|
version: c.version,
|
||
|
supportsForeignObject: !1,
|
||
|
});
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a, d, e, f, g) {
|
||
|
a instanceof Element
|
||
|
? (this._node = a)
|
||
|
: ((this._node = b.createElementNS(c.namespaces.svg, a)), 'svg' === a && this.attr({ 'xmlns:ct': c.namespaces.ct })),
|
||
|
d && this.attr(d),
|
||
|
e && this.addClass(e),
|
||
|
f && (g && f._node.firstChild ? f._node.insertBefore(this._node, f._node.firstChild) : f._node.appendChild(this._node));
|
||
|
}
|
||
|
function e(a, b) {
|
||
|
return 'string' == typeof a
|
||
|
? b
|
||
|
? this._node.getAttributeNS(b, a)
|
||
|
: this._node.getAttribute(a)
|
||
|
: (Object.keys(a).forEach(
|
||
|
function (b) {
|
||
|
if (void 0 !== a[b])
|
||
|
if (-1 !== b.indexOf(':')) {
|
||
|
var d = b.split(':');
|
||
|
this._node.setAttributeNS(c.namespaces[d[0]], b, a[b]);
|
||
|
} else this._node.setAttribute(b, a[b]);
|
||
|
}.bind(this)
|
||
|
),
|
||
|
this);
|
||
|
}
|
||
|
function f(a, b, d, e) {
|
||
|
return new c.Svg(a, b, d, this, e);
|
||
|
}
|
||
|
function g() {
|
||
|
return this._node.parentNode instanceof SVGElement ? new c.Svg(this._node.parentNode) : null;
|
||
|
}
|
||
|
function h() {
|
||
|
for (var a = this._node; 'svg' !== a.nodeName; ) a = a.parentNode;
|
||
|
return new c.Svg(a);
|
||
|
}
|
||
|
function i(a) {
|
||
|
var b = this._node.querySelector(a);
|
||
|
return b ? new c.Svg(b) : null;
|
||
|
}
|
||
|
function j(a) {
|
||
|
var b = this._node.querySelectorAll(a);
|
||
|
return b.length ? new c.Svg.List(b) : null;
|
||
|
}
|
||
|
function k(a, d, e, f) {
|
||
|
if ('string' == typeof a) {
|
||
|
var g = b.createElement('div');
|
||
|
(g.innerHTML = a), (a = g.firstChild);
|
||
|
}
|
||
|
a.setAttribute('xmlns', c.namespaces.xmlns);
|
||
|
var h = this.elem('foreignObject', d, e, f);
|
||
|
return h._node.appendChild(a), h;
|
||
|
}
|
||
|
function l(a) {
|
||
|
return this._node.appendChild(b.createTextNode(a)), this;
|
||
|
}
|
||
|
function m() {
|
||
|
for (; this._node.firstChild; ) this._node.removeChild(this._node.firstChild);
|
||
|
return this;
|
||
|
}
|
||
|
function n() {
|
||
|
return this._node.parentNode.removeChild(this._node), this.parent();
|
||
|
}
|
||
|
function o(a) {
|
||
|
return this._node.parentNode.replaceChild(a._node, this._node), a;
|
||
|
}
|
||
|
function p(a, b) {
|
||
|
return b && this._node.firstChild ? this._node.insertBefore(a._node, this._node.firstChild) : this._node.appendChild(a._node), this;
|
||
|
}
|
||
|
function q() {
|
||
|
return this._node.getAttribute('class') ? this._node.getAttribute('class').trim().split(/\s+/) : [];
|
||
|
}
|
||
|
function r(a) {
|
||
|
return (
|
||
|
this._node.setAttribute(
|
||
|
'class',
|
||
|
this.classes(this._node)
|
||
|
.concat(a.trim().split(/\s+/))
|
||
|
.filter(function (a, b, c) {
|
||
|
return c.indexOf(a) === b;
|
||
|
})
|
||
|
.join(' ')
|
||
|
),
|
||
|
this
|
||
|
);
|
||
|
}
|
||
|
function s(a) {
|
||
|
var b = a.trim().split(/\s+/);
|
||
|
return (
|
||
|
this._node.setAttribute(
|
||
|
'class',
|
||
|
this.classes(this._node)
|
||
|
.filter(function (a) {
|
||
|
return -1 === b.indexOf(a);
|
||
|
})
|
||
|
.join(' ')
|
||
|
),
|
||
|
this
|
||
|
);
|
||
|
}
|
||
|
function t() {
|
||
|
return this._node.setAttribute('class', ''), this;
|
||
|
}
|
||
|
function u() {
|
||
|
return this._node.getBoundingClientRect().height;
|
||
|
}
|
||
|
function v() {
|
||
|
return this._node.getBoundingClientRect().width;
|
||
|
}
|
||
|
function w(a, b, d) {
|
||
|
return (
|
||
|
void 0 === b && (b = !0),
|
||
|
Object.keys(a).forEach(
|
||
|
function (e) {
|
||
|
function f(a, b) {
|
||
|
var f,
|
||
|
g,
|
||
|
h,
|
||
|
i = {};
|
||
|
a.easing && ((h = a.easing instanceof Array ? a.easing : c.Svg.Easing[a.easing]), delete a.easing),
|
||
|
(a.begin = c.ensureUnit(a.begin, 'ms')),
|
||
|
(a.dur = c.ensureUnit(a.dur, 'ms')),
|
||
|
h && ((a.calcMode = 'spline'), (a.keySplines = h.join(' ')), (a.keyTimes = '0;1')),
|
||
|
b && ((a.fill = 'freeze'), (i[e] = a.from), this.attr(i), (g = c.quantity(a.begin || 0).value), (a.begin = 'indefinite')),
|
||
|
(f = this.elem('animate', c.extend({ attributeName: e }, a))),
|
||
|
b &&
|
||
|
setTimeout(
|
||
|
function () {
|
||
|
try {
|
||
|
f._node.beginElement();
|
||
|
} catch (b) {
|
||
|
(i[e] = a.to), this.attr(i), f.remove();
|
||
|
}
|
||
|
}.bind(this),
|
||
|
g
|
||
|
),
|
||
|
d &&
|
||
|
f._node.addEventListener(
|
||
|
'beginEvent',
|
||
|
function () {
|
||
|
d.emit('animationBegin', { element: this, animate: f._node, params: a });
|
||
|
}.bind(this)
|
||
|
),
|
||
|
f._node.addEventListener(
|
||
|
'endEvent',
|
||
|
function () {
|
||
|
d && d.emit('animationEnd', { element: this, animate: f._node, params: a }),
|
||
|
b && ((i[e] = a.to), this.attr(i), f.remove());
|
||
|
}.bind(this)
|
||
|
);
|
||
|
}
|
||
|
a[e] instanceof Array
|
||
|
? a[e].forEach(
|
||
|
function (a) {
|
||
|
f.bind(this)(a, !1);
|
||
|
}.bind(this)
|
||
|
)
|
||
|
: f.bind(this)(a[e], b);
|
||
|
}.bind(this)
|
||
|
),
|
||
|
this
|
||
|
);
|
||
|
}
|
||
|
function x(a) {
|
||
|
var b = this;
|
||
|
this.svgElements = [];
|
||
|
for (var d = 0; d < a.length; d++) this.svgElements.push(new c.Svg(a[d]));
|
||
|
Object.keys(c.Svg.prototype)
|
||
|
.filter(function (a) {
|
||
|
return (
|
||
|
-1 ===
|
||
|
['constructor', 'parent', 'querySelector', 'querySelectorAll', 'replace', 'append', 'classes', 'height', 'width'].indexOf(a)
|
||
|
);
|
||
|
})
|
||
|
.forEach(function (a) {
|
||
|
b[a] = function () {
|
||
|
var d = Array.prototype.slice.call(arguments, 0);
|
||
|
return (
|
||
|
b.svgElements.forEach(function (b) {
|
||
|
c.Svg.prototype[a].apply(b, d);
|
||
|
}),
|
||
|
b
|
||
|
);
|
||
|
};
|
||
|
});
|
||
|
}
|
||
|
(c.Svg = c.Class.extend({
|
||
|
constructor: d,
|
||
|
attr: e,
|
||
|
elem: f,
|
||
|
parent: g,
|
||
|
root: h,
|
||
|
querySelector: i,
|
||
|
querySelectorAll: j,
|
||
|
foreignObject: k,
|
||
|
text: l,
|
||
|
empty: m,
|
||
|
remove: n,
|
||
|
replace: o,
|
||
|
append: p,
|
||
|
classes: q,
|
||
|
addClass: r,
|
||
|
removeClass: s,
|
||
|
removeAllClasses: t,
|
||
|
height: u,
|
||
|
width: v,
|
||
|
animate: w,
|
||
|
})),
|
||
|
(c.Svg.isSupported = function (a) {
|
||
|
return b.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#' + a, '1.1');
|
||
|
});
|
||
|
var y = {
|
||
|
easeInSine: [0.47, 0, 0.745, 0.715],
|
||
|
easeOutSine: [0.39, 0.575, 0.565, 1],
|
||
|
easeInOutSine: [0.445, 0.05, 0.55, 0.95],
|
||
|
easeInQuad: [0.55, 0.085, 0.68, 0.53],
|
||
|
easeOutQuad: [0.25, 0.46, 0.45, 0.94],
|
||
|
easeInOutQuad: [0.455, 0.03, 0.515, 0.955],
|
||
|
easeInCubic: [0.55, 0.055, 0.675, 0.19],
|
||
|
easeOutCubic: [0.215, 0.61, 0.355, 1],
|
||
|
easeInOutCubic: [0.645, 0.045, 0.355, 1],
|
||
|
easeInQuart: [0.895, 0.03, 0.685, 0.22],
|
||
|
easeOutQuart: [0.165, 0.84, 0.44, 1],
|
||
|
easeInOutQuart: [0.77, 0, 0.175, 1],
|
||
|
easeInQuint: [0.755, 0.05, 0.855, 0.06],
|
||
|
easeOutQuint: [0.23, 1, 0.32, 1],
|
||
|
easeInOutQuint: [0.86, 0, 0.07, 1],
|
||
|
easeInExpo: [0.95, 0.05, 0.795, 0.035],
|
||
|
easeOutExpo: [0.19, 1, 0.22, 1],
|
||
|
easeInOutExpo: [1, 0, 0, 1],
|
||
|
easeInCirc: [0.6, 0.04, 0.98, 0.335],
|
||
|
easeOutCirc: [0.075, 0.82, 0.165, 1],
|
||
|
easeInOutCirc: [0.785, 0.135, 0.15, 0.86],
|
||
|
easeInBack: [0.6, -0.28, 0.735, 0.045],
|
||
|
easeOutBack: [0.175, 0.885, 0.32, 1.275],
|
||
|
easeInOutBack: [0.68, -0.55, 0.265, 1.55],
|
||
|
};
|
||
|
(c.Svg.Easing = y), (c.Svg.List = c.Class.extend({ constructor: x }));
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a, b, d, e, f, g) {
|
||
|
var h = c.extend({ command: f ? a.toLowerCase() : a.toUpperCase() }, b, g ? { data: g } : {});
|
||
|
d.splice(e, 0, h);
|
||
|
}
|
||
|
function e(a, b) {
|
||
|
a.forEach(function (c, d) {
|
||
|
u[c.command.toLowerCase()].forEach(function (e, f) {
|
||
|
b(c, e, d, f, a);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
function f(a, b) {
|
||
|
(this.pathElements = []), (this.pos = 0), (this.close = a), (this.options = c.extend({}, v, b));
|
||
|
}
|
||
|
function g(a) {
|
||
|
return void 0 !== a ? ((this.pos = Math.max(0, Math.min(this.pathElements.length, a))), this) : this.pos;
|
||
|
}
|
||
|
function h(a) {
|
||
|
return this.pathElements.splice(this.pos, a), this;
|
||
|
}
|
||
|
function i(a, b, c, e) {
|
||
|
return d('M', { x: +a, y: +b }, this.pathElements, this.pos++, c, e), this;
|
||
|
}
|
||
|
function j(a, b, c, e) {
|
||
|
return d('L', { x: +a, y: +b }, this.pathElements, this.pos++, c, e), this;
|
||
|
}
|
||
|
function k(a, b, c, e, f, g, h, i) {
|
||
|
return d('C', { x1: +a, y1: +b, x2: +c, y2: +e, x: +f, y: +g }, this.pathElements, this.pos++, h, i), this;
|
||
|
}
|
||
|
function l(a, b, c, e, f, g, h, i, j) {
|
||
|
return d('A', { rx: +a, ry: +b, xAr: +c, lAf: +e, sf: +f, x: +g, y: +h }, this.pathElements, this.pos++, i, j), this;
|
||
|
}
|
||
|
function m(a) {
|
||
|
var b = a
|
||
|
.replace(/([A-Za-z])([0-9])/g, '$1 $2')
|
||
|
.replace(/([0-9])([A-Za-z])/g, '$1 $2')
|
||
|
.split(/[\s,]+/)
|
||
|
.reduce(function (a, b) {
|
||
|
return b.match(/[A-Za-z]/) && a.push([]), a[a.length - 1].push(b), a;
|
||
|
}, []);
|
||
|
'Z' === b[b.length - 1][0].toUpperCase() && b.pop();
|
||
|
var d = b.map(function (a) {
|
||
|
var b = a.shift(),
|
||
|
d = u[b.toLowerCase()];
|
||
|
return c.extend(
|
||
|
{ command: b },
|
||
|
d.reduce(function (b, c, d) {
|
||
|
return (b[c] = +a[d]), b;
|
||
|
}, {})
|
||
|
);
|
||
|
}),
|
||
|
e = [this.pos, 0];
|
||
|
return Array.prototype.push.apply(e, d), Array.prototype.splice.apply(this.pathElements, e), (this.pos += d.length), this;
|
||
|
}
|
||
|
function n() {
|
||
|
var a = Math.pow(10, this.options.accuracy);
|
||
|
return (
|
||
|
this.pathElements.reduce(
|
||
|
function (b, c) {
|
||
|
var d = u[c.command.toLowerCase()].map(
|
||
|
function (b) {
|
||
|
return this.options.accuracy ? Math.round(c[b] * a) / a : c[b];
|
||
|
}.bind(this)
|
||
|
);
|
||
|
return b + c.command + d.join(',');
|
||
|
}.bind(this),
|
||
|
''
|
||
|
) + (this.close ? 'Z' : '')
|
||
|
);
|
||
|
}
|
||
|
function o(a, b) {
|
||
|
return (
|
||
|
e(this.pathElements, function (c, d) {
|
||
|
c[d] *= 'x' === d[0] ? a : b;
|
||
|
}),
|
||
|
this
|
||
|
);
|
||
|
}
|
||
|
function p(a, b) {
|
||
|
return (
|
||
|
e(this.pathElements, function (c, d) {
|
||
|
c[d] += 'x' === d[0] ? a : b;
|
||
|
}),
|
||
|
this
|
||
|
);
|
||
|
}
|
||
|
function q(a) {
|
||
|
return (
|
||
|
e(this.pathElements, function (b, c, d, e, f) {
|
||
|
var g = a(b, c, d, e, f);
|
||
|
(g || 0 === g) && (b[c] = g);
|
||
|
}),
|
||
|
this
|
||
|
);
|
||
|
}
|
||
|
function r(a) {
|
||
|
var b = new c.Svg.Path(a || this.close);
|
||
|
return (
|
||
|
(b.pos = this.pos),
|
||
|
(b.pathElements = this.pathElements.slice().map(function (a) {
|
||
|
return c.extend({}, a);
|
||
|
})),
|
||
|
(b.options = c.extend({}, this.options)),
|
||
|
b
|
||
|
);
|
||
|
}
|
||
|
function s(a) {
|
||
|
var b = [new c.Svg.Path()];
|
||
|
return (
|
||
|
this.pathElements.forEach(function (d) {
|
||
|
d.command === a.toUpperCase() && 0 !== b[b.length - 1].pathElements.length && b.push(new c.Svg.Path()),
|
||
|
b[b.length - 1].pathElements.push(d);
|
||
|
}),
|
||
|
b
|
||
|
);
|
||
|
}
|
||
|
function t(a, b, d) {
|
||
|
for (var e = new c.Svg.Path(b, d), f = 0; f < a.length; f++)
|
||
|
for (var g = a[f], h = 0; h < g.pathElements.length; h++) e.pathElements.push(g.pathElements[h]);
|
||
|
return e;
|
||
|
}
|
||
|
var u = { m: ['x', 'y'], l: ['x', 'y'], c: ['x1', 'y1', 'x2', 'y2', 'x', 'y'], a: ['rx', 'ry', 'xAr', 'lAf', 'sf', 'x', 'y'] },
|
||
|
v = { accuracy: 3 };
|
||
|
(c.Svg.Path = c.Class.extend({
|
||
|
constructor: f,
|
||
|
position: g,
|
||
|
remove: h,
|
||
|
move: i,
|
||
|
line: j,
|
||
|
curve: k,
|
||
|
arc: l,
|
||
|
scale: o,
|
||
|
translate: p,
|
||
|
transform: q,
|
||
|
parse: m,
|
||
|
stringify: n,
|
||
|
clone: r,
|
||
|
splitByCommand: s,
|
||
|
})),
|
||
|
(c.Svg.Path.elementDescriptions = u),
|
||
|
(c.Svg.Path.join = t);
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a, b, c, d) {
|
||
|
(this.units = a),
|
||
|
(this.counterUnits = a === f.x ? f.y : f.x),
|
||
|
(this.chartRect = b),
|
||
|
(this.axisLength = b[a.rectEnd] - b[a.rectStart]),
|
||
|
(this.gridOffset = b[a.rectOffset]),
|
||
|
(this.ticks = c),
|
||
|
(this.options = d);
|
||
|
}
|
||
|
function e(a, b, d, e, f) {
|
||
|
var g = e['axis' + this.units.pos.toUpperCase()],
|
||
|
h = this.ticks.map(this.projectValue.bind(this)),
|
||
|
i = this.ticks.map(g.labelInterpolationFnc);
|
||
|
h.forEach(
|
||
|
function (j, k) {
|
||
|
var l,
|
||
|
m = { x: 0, y: 0 };
|
||
|
(l = h[k + 1] ? h[k + 1] - j : Math.max(this.axisLength - j, 30)),
|
||
|
(c.isFalseyButZero(i[k]) && '' !== i[k]) ||
|
||
|
('x' === this.units.pos
|
||
|
? ((j = this.chartRect.x1 + j),
|
||
|
(m.x = e.axisX.labelOffset.x),
|
||
|
'start' === e.axisX.position
|
||
|
? (m.y = this.chartRect.padding.top + e.axisX.labelOffset.y + (d ? 5 : 20))
|
||
|
: (m.y = this.chartRect.y1 + e.axisX.labelOffset.y + (d ? 5 : 20)))
|
||
|
: ((j = this.chartRect.y1 - j),
|
||
|
(m.y = e.axisY.labelOffset.y - (d ? l : 0)),
|
||
|
'start' === e.axisY.position
|
||
|
? (m.x = d ? this.chartRect.padding.left + e.axisY.labelOffset.x : this.chartRect.x1 - 10)
|
||
|
: (m.x = this.chartRect.x2 + e.axisY.labelOffset.x + 10)),
|
||
|
g.showGrid &&
|
||
|
c.createGrid(
|
||
|
j,
|
||
|
k,
|
||
|
this,
|
||
|
this.gridOffset,
|
||
|
this.chartRect[this.counterUnits.len](),
|
||
|
a,
|
||
|
[e.classNames.grid, e.classNames[this.units.dir]],
|
||
|
f
|
||
|
),
|
||
|
g.showLabel &&
|
||
|
c.createLabel(
|
||
|
j,
|
||
|
l,
|
||
|
k,
|
||
|
i,
|
||
|
this,
|
||
|
g.offset,
|
||
|
m,
|
||
|
b,
|
||
|
[e.classNames.label, e.classNames[this.units.dir], e.classNames[g.position]],
|
||
|
d,
|
||
|
f
|
||
|
));
|
||
|
}.bind(this)
|
||
|
);
|
||
|
}
|
||
|
var f = {
|
||
|
x: { pos: 'x', len: 'width', dir: 'horizontal', rectStart: 'x1', rectEnd: 'x2', rectOffset: 'y2' },
|
||
|
y: { pos: 'y', len: 'height', dir: 'vertical', rectStart: 'y2', rectEnd: 'y1', rectOffset: 'x1' },
|
||
|
};
|
||
|
(c.Axis = c.Class.extend({
|
||
|
constructor: d,
|
||
|
createGridAndLabels: e,
|
||
|
projectValue: function (a, b, c) {
|
||
|
throw new Error("Base axis can't be instantiated!");
|
||
|
},
|
||
|
})),
|
||
|
(c.Axis.units = f);
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a, b, d, e) {
|
||
|
var f = e.highLow || c.getHighLow(b.normalized, e, a.pos);
|
||
|
(this.bounds = c.getBounds(d[a.rectEnd] - d[a.rectStart], f, e.scaleMinSpace || 20, e.onlyInteger)),
|
||
|
(this.range = { min: this.bounds.min, max: this.bounds.max }),
|
||
|
c.AutoScaleAxis['super'].constructor.call(this, a, d, this.bounds.values, e);
|
||
|
}
|
||
|
function e(a) {
|
||
|
return (this.axisLength * (+c.getMultiValue(a, this.units.pos) - this.bounds.min)) / this.bounds.range;
|
||
|
}
|
||
|
c.AutoScaleAxis = c.Axis.extend({ constructor: d, projectValue: e });
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a, b, d, e) {
|
||
|
var f = e.highLow || c.getHighLow(b.normalized, e, a.pos);
|
||
|
(this.divisor = e.divisor || 1),
|
||
|
(this.ticks =
|
||
|
e.ticks ||
|
||
|
c.times(this.divisor).map(
|
||
|
function (a, b) {
|
||
|
return f.low + ((f.high - f.low) / this.divisor) * b;
|
||
|
}.bind(this)
|
||
|
)),
|
||
|
this.ticks.sort(function (a, b) {
|
||
|
return a - b;
|
||
|
}),
|
||
|
(this.range = { min: f.low, max: f.high }),
|
||
|
c.FixedScaleAxis['super'].constructor.call(this, a, d, this.ticks, e),
|
||
|
(this.stepLength = this.axisLength / this.divisor);
|
||
|
}
|
||
|
function e(a) {
|
||
|
return (this.axisLength * (+c.getMultiValue(a, this.units.pos) - this.range.min)) / (this.range.max - this.range.min);
|
||
|
}
|
||
|
c.FixedScaleAxis = c.Axis.extend({ constructor: d, projectValue: e });
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a, b, d, e) {
|
||
|
c.StepAxis['super'].constructor.call(this, a, d, e.ticks, e),
|
||
|
(this.stepLength = this.axisLength / (e.ticks.length - (e.stretch ? 1 : 0)));
|
||
|
}
|
||
|
function e(a, b) {
|
||
|
return this.stepLength * b;
|
||
|
}
|
||
|
c.StepAxis = c.Axis.extend({ constructor: d, projectValue: e });
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a) {
|
||
|
this.data = c.normalizeData(this.data);
|
||
|
var b = { raw: this.data, normalized: c.getDataArray(this.data, a.reverseData, !0) };
|
||
|
this.svg = c.createSvg(this.container, a.width, a.height, a.classNames.chart);
|
||
|
var d,
|
||
|
e,
|
||
|
g = this.svg.elem('g').addClass(a.classNames.gridGroup),
|
||
|
h = this.svg.elem('g'),
|
||
|
i = this.svg.elem('g').addClass(a.classNames.labelGroup),
|
||
|
j = c.createChartRect(this.svg, a, f.padding);
|
||
|
(d =
|
||
|
void 0 === a.axisX.type
|
||
|
? new c.StepAxis(c.Axis.units.x, b, j, c.extend({}, a.axisX, { ticks: b.raw.labels, stretch: a.fullWidth }))
|
||
|
: a.axisX.type.call(c, c.Axis.units.x, b, j, a.axisX)),
|
||
|
(e =
|
||
|
void 0 === a.axisY.type
|
||
|
? new c.AutoScaleAxis(
|
||
|
c.Axis.units.y,
|
||
|
b,
|
||
|
j,
|
||
|
c.extend({}, a.axisY, { high: c.isNum(a.high) ? a.high : a.axisY.high, low: c.isNum(a.low) ? a.low : a.axisY.low })
|
||
|
)
|
||
|
: a.axisY.type.call(c, c.Axis.units.y, b, j, a.axisY)),
|
||
|
d.createGridAndLabels(g, i, this.supportsForeignObject, a, this.eventEmitter),
|
||
|
e.createGridAndLabels(g, i, this.supportsForeignObject, a, this.eventEmitter),
|
||
|
b.raw.series.forEach(
|
||
|
function (f, g) {
|
||
|
var i = h.elem('g');
|
||
|
i.attr({ 'ct:series-name': f.name, 'ct:meta': c.serialize(f.meta) }),
|
||
|
i.addClass([a.classNames.series, f.className || a.classNames.series + '-' + c.alphaNumerate(g)].join(' '));
|
||
|
var k = [],
|
||
|
l = [];
|
||
|
b.normalized[g].forEach(
|
||
|
function (a, h) {
|
||
|
var i = { x: j.x1 + d.projectValue(a, h, b.normalized[g]), y: j.y1 - e.projectValue(a, h, b.normalized[g]) };
|
||
|
k.push(i.x, i.y), l.push({ value: a, valueIndex: h, meta: c.getMetaData(f, h) });
|
||
|
}.bind(this)
|
||
|
);
|
||
|
var m = {
|
||
|
lineSmooth: c.getSeriesOption(f, a, 'lineSmooth'),
|
||
|
showPoint: c.getSeriesOption(f, a, 'showPoint'),
|
||
|
showLine: c.getSeriesOption(f, a, 'showLine'),
|
||
|
showArea: c.getSeriesOption(f, a, 'showArea'),
|
||
|
areaBase: c.getSeriesOption(f, a, 'areaBase'),
|
||
|
},
|
||
|
n = 'function' == typeof m.lineSmooth ? m.lineSmooth : m.lineSmooth ? c.Interpolation.cardinal() : c.Interpolation.none(),
|
||
|
o = n(k, l);
|
||
|
if (
|
||
|
(m.showPoint &&
|
||
|
o.pathElements.forEach(
|
||
|
function (b) {
|
||
|
var h = i
|
||
|
.elem('line', { x1: b.x, y1: b.y, x2: b.x + 0.01, y2: b.y }, a.classNames.point)
|
||
|
.attr({ 'ct:value': [b.data.value.x, b.data.value.y].filter(c.isNum).join(','), 'ct:meta': b.data.meta });
|
||
|
this.eventEmitter.emit('draw', {
|
||
|
type: 'point',
|
||
|
value: b.data.value,
|
||
|
index: b.data.valueIndex,
|
||
|
meta: b.data.meta,
|
||
|
series: f,
|
||
|
seriesIndex: g,
|
||
|
axisX: d,
|
||
|
axisY: e,
|
||
|
group: i,
|
||
|
element: h,
|
||
|
x: b.x,
|
||
|
y: b.y,
|
||
|
});
|
||
|
}.bind(this)
|
||
|
),
|
||
|
m.showLine)
|
||
|
) {
|
||
|
var p = i.elem('path', { d: o.stringify() }, a.classNames.line, !0);
|
||
|
this.eventEmitter.emit('draw', {
|
||
|
type: 'line',
|
||
|
values: b.normalized[g],
|
||
|
path: o.clone(),
|
||
|
chartRect: j,
|
||
|
index: g,
|
||
|
series: f,
|
||
|
seriesIndex: g,
|
||
|
axisX: d,
|
||
|
axisY: e,
|
||
|
group: i,
|
||
|
element: p,
|
||
|
});
|
||
|
}
|
||
|
if (m.showArea && e.range) {
|
||
|
var q = Math.max(Math.min(m.areaBase, e.range.max), e.range.min),
|
||
|
r = j.y1 - e.projectValue(q);
|
||
|
o.splitByCommand('M')
|
||
|
.filter(function (a) {
|
||
|
return a.pathElements.length > 1;
|
||
|
})
|
||
|
.map(function (a) {
|
||
|
var b = a.pathElements[0],
|
||
|
c = a.pathElements[a.pathElements.length - 1];
|
||
|
return a
|
||
|
.clone(!0)
|
||
|
.position(0)
|
||
|
.remove(1)
|
||
|
.move(b.x, r)
|
||
|
.line(b.x, b.y)
|
||
|
.position(a.pathElements.length + 1)
|
||
|
.line(c.x, r);
|
||
|
})
|
||
|
.forEach(
|
||
|
function (c) {
|
||
|
var h = i.elem('path', { d: c.stringify() }, a.classNames.area, !0);
|
||
|
this.eventEmitter.emit('draw', {
|
||
|
type: 'area',
|
||
|
values: b.normalized[g],
|
||
|
path: c.clone(),
|
||
|
series: f,
|
||
|
seriesIndex: g,
|
||
|
axisX: d,
|
||
|
axisY: e,
|
||
|
chartRect: j,
|
||
|
index: g,
|
||
|
group: i,
|
||
|
element: h,
|
||
|
});
|
||
|
}.bind(this)
|
||
|
);
|
||
|
}
|
||
|
}.bind(this)
|
||
|
),
|
||
|
this.eventEmitter.emit('created', { bounds: e.bounds, chartRect: j, axisX: d, axisY: e, svg: this.svg, options: a });
|
||
|
}
|
||
|
function e(a, b, d, e) {
|
||
|
c.Line['super'].constructor.call(this, a, b, f, c.extend({}, f, d), e);
|
||
|
}
|
||
|
var f = {
|
||
|
axisX: {
|
||
|
offset: 30,
|
||
|
position: 'end',
|
||
|
labelOffset: { x: 0, y: 0 },
|
||
|
showLabel: !0,
|
||
|
showGrid: !0,
|
||
|
labelInterpolationFnc: c.noop,
|
||
|
type: void 0,
|
||
|
},
|
||
|
axisY: {
|
||
|
offset: 40,
|
||
|
position: 'start',
|
||
|
labelOffset: { x: 0, y: 0 },
|
||
|
showLabel: !0,
|
||
|
showGrid: !0,
|
||
|
labelInterpolationFnc: c.noop,
|
||
|
type: void 0,
|
||
|
scaleMinSpace: 20,
|
||
|
onlyInteger: !1,
|
||
|
},
|
||
|
width: void 0,
|
||
|
height: void 0,
|
||
|
showLine: !0,
|
||
|
showPoint: !0,
|
||
|
showArea: !1,
|
||
|
areaBase: 0,
|
||
|
lineSmooth: !0,
|
||
|
low: void 0,
|
||
|
high: void 0,
|
||
|
chartPadding: { top: 15, right: 15, bottom: 5, left: 10 },
|
||
|
fullWidth: !1,
|
||
|
reverseData: !1,
|
||
|
classNames: {
|
||
|
chart: 'ct-chart-line',
|
||
|
label: 'ct-label',
|
||
|
labelGroup: 'ct-labels',
|
||
|
series: 'ct-series',
|
||
|
line: 'ct-line',
|
||
|
point: 'ct-point',
|
||
|
area: 'ct-area',
|
||
|
grid: 'ct-grid',
|
||
|
gridGroup: 'ct-grids',
|
||
|
vertical: 'ct-vertical',
|
||
|
horizontal: 'ct-horizontal',
|
||
|
start: 'ct-start',
|
||
|
end: 'ct-end',
|
||
|
},
|
||
|
};
|
||
|
c.Line = c.Base.extend({ constructor: e, createChart: d });
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a) {
|
||
|
this.data = c.normalizeData(this.data);
|
||
|
var b,
|
||
|
d = {
|
||
|
raw: this.data,
|
||
|
normalized: a.distributeSeries
|
||
|
? c.getDataArray(this.data, a.reverseData, a.horizontalBars ? 'x' : 'y').map(function (a) {
|
||
|
return [a];
|
||
|
})
|
||
|
: c.getDataArray(this.data, a.reverseData, a.horizontalBars ? 'x' : 'y'),
|
||
|
};
|
||
|
this.svg = c.createSvg(
|
||
|
this.container,
|
||
|
a.width,
|
||
|
a.height,
|
||
|
a.classNames.chart + (a.horizontalBars ? ' ' + a.classNames.horizontalBars : '')
|
||
|
);
|
||
|
var e = this.svg.elem('g').addClass(a.classNames.gridGroup),
|
||
|
g = this.svg.elem('g'),
|
||
|
h = this.svg.elem('g').addClass(a.classNames.labelGroup);
|
||
|
if (a.stackBars && 0 !== d.normalized.length) {
|
||
|
var i = c.serialMap(d.normalized, function () {
|
||
|
return Array.prototype.slice
|
||
|
.call(arguments)
|
||
|
.map(function (a) {
|
||
|
return a;
|
||
|
})
|
||
|
.reduce(
|
||
|
function (a, b) {
|
||
|
return { x: a.x + (b && b.x) || 0, y: a.y + (b && b.y) || 0 };
|
||
|
},
|
||
|
{ x: 0, y: 0 }
|
||
|
);
|
||
|
});
|
||
|
b = c.getHighLow([i], c.extend({}, a, { referenceValue: 0 }), a.horizontalBars ? 'x' : 'y');
|
||
|
} else b = c.getHighLow(d.normalized, c.extend({}, a, { referenceValue: 0 }), a.horizontalBars ? 'x' : 'y');
|
||
|
(b.high = +a.high || (0 === a.high ? 0 : b.high)), (b.low = +a.low || (0 === a.low ? 0 : b.low));
|
||
|
var j,
|
||
|
k,
|
||
|
l,
|
||
|
m,
|
||
|
n,
|
||
|
o = c.createChartRect(this.svg, a, f.padding);
|
||
|
(k = a.distributeSeries && a.stackBars ? d.raw.labels.slice(0, 1) : d.raw.labels),
|
||
|
a.horizontalBars
|
||
|
? ((j = m =
|
||
|
void 0 === a.axisX.type
|
||
|
? new c.AutoScaleAxis(c.Axis.units.x, d, o, c.extend({}, a.axisX, { highLow: b, referenceValue: 0 }))
|
||
|
: a.axisX.type.call(c, c.Axis.units.x, d, o, c.extend({}, a.axisX, { highLow: b, referenceValue: 0 }))),
|
||
|
(l = n =
|
||
|
void 0 === a.axisY.type
|
||
|
? new c.StepAxis(c.Axis.units.y, d, o, { ticks: k })
|
||
|
: a.axisY.type.call(c, c.Axis.units.y, d, o, a.axisY)))
|
||
|
: ((l = m =
|
||
|
void 0 === a.axisX.type
|
||
|
? new c.StepAxis(c.Axis.units.x, d, o, { ticks: k })
|
||
|
: a.axisX.type.call(c, c.Axis.units.x, d, o, a.axisX)),
|
||
|
(j = n =
|
||
|
void 0 === a.axisY.type
|
||
|
? new c.AutoScaleAxis(c.Axis.units.y, d, o, c.extend({}, a.axisY, { highLow: b, referenceValue: 0 }))
|
||
|
: a.axisY.type.call(c, c.Axis.units.y, d, o, c.extend({}, a.axisY, { highLow: b, referenceValue: 0 }))));
|
||
|
var p = a.horizontalBars ? o.x1 + j.projectValue(0) : o.y1 - j.projectValue(0),
|
||
|
q = [];
|
||
|
l.createGridAndLabels(e, h, this.supportsForeignObject, a, this.eventEmitter),
|
||
|
j.createGridAndLabels(e, h, this.supportsForeignObject, a, this.eventEmitter),
|
||
|
d.raw.series.forEach(
|
||
|
function (b, e) {
|
||
|
var f,
|
||
|
h,
|
||
|
i = e - (d.raw.series.length - 1) / 2;
|
||
|
(f =
|
||
|
a.distributeSeries && !a.stackBars
|
||
|
? l.axisLength / d.normalized.length / 2
|
||
|
: a.distributeSeries && a.stackBars
|
||
|
? l.axisLength / 2
|
||
|
: l.axisLength / d.normalized[e].length / 2),
|
||
|
(h = g.elem('g')),
|
||
|
h.attr({ 'ct:series-name': b.name, 'ct:meta': c.serialize(b.meta) }),
|
||
|
h.addClass([a.classNames.series, b.className || a.classNames.series + '-' + c.alphaNumerate(e)].join(' ')),
|
||
|
d.normalized[e].forEach(
|
||
|
function (g, k) {
|
||
|
var r, s, t, u;
|
||
|
if (
|
||
|
((u = a.distributeSeries && !a.stackBars ? e : a.distributeSeries && a.stackBars ? 0 : k),
|
||
|
(r = a.horizontalBars
|
||
|
? {
|
||
|
x: o.x1 + j.projectValue(g && g.x ? g.x : 0, k, d.normalized[e]),
|
||
|
y: o.y1 - l.projectValue(g && g.y ? g.y : 0, u, d.normalized[e]),
|
||
|
}
|
||
|
: {
|
||
|
x: o.x1 + l.projectValue(g && g.x ? g.x : 0, u, d.normalized[e]),
|
||
|
y: o.y1 - j.projectValue(g && g.y ? g.y : 0, k, d.normalized[e]),
|
||
|
}),
|
||
|
l instanceof c.StepAxis &&
|
||
|
(l.options.stretch || (r[l.units.pos] += f * (a.horizontalBars ? -1 : 1)),
|
||
|
(r[l.units.pos] += a.stackBars || a.distributeSeries ? 0 : i * a.seriesBarDistance * (a.horizontalBars ? -1 : 1))),
|
||
|
(t = q[k] || p),
|
||
|
(q[k] = t - (p - r[l.counterUnits.pos])),
|
||
|
void 0 !== g)
|
||
|
) {
|
||
|
var v = {};
|
||
|
(v[l.units.pos + '1'] = r[l.units.pos]),
|
||
|
(v[l.units.pos + '2'] = r[l.units.pos]),
|
||
|
!a.stackBars || ('accumulate' !== a.stackMode && a.stackMode)
|
||
|
? ((v[l.counterUnits.pos + '1'] = p), (v[l.counterUnits.pos + '2'] = r[l.counterUnits.pos]))
|
||
|
: ((v[l.counterUnits.pos + '1'] = t), (v[l.counterUnits.pos + '2'] = q[k])),
|
||
|
(v.x1 = Math.min(Math.max(v.x1, o.x1), o.x2)),
|
||
|
(v.x2 = Math.min(Math.max(v.x2, o.x1), o.x2)),
|
||
|
(v.y1 = Math.min(Math.max(v.y1, o.y2), o.y1)),
|
||
|
(v.y2 = Math.min(Math.max(v.y2, o.y2), o.y1)),
|
||
|
(s = h
|
||
|
.elem('line', v, a.classNames.bar)
|
||
|
.attr({ 'ct:value': [g.x, g.y].filter(c.isNum).join(','), 'ct:meta': c.getMetaData(b, k) })),
|
||
|
this.eventEmitter.emit(
|
||
|
'draw',
|
||
|
c.extend(
|
||
|
{
|
||
|
type: 'bar',
|
||
|
value: g,
|
||
|
index: k,
|
||
|
meta: c.getMetaData(b, k),
|
||
|
series: b,
|
||
|
seriesIndex: e,
|
||
|
axisX: m,
|
||
|
axisY: n,
|
||
|
chartRect: o,
|
||
|
group: h,
|
||
|
element: s,
|
||
|
},
|
||
|
v
|
||
|
)
|
||
|
);
|
||
|
}
|
||
|
}.bind(this)
|
||
|
);
|
||
|
}.bind(this)
|
||
|
),
|
||
|
this.eventEmitter.emit('created', { bounds: j.bounds, chartRect: o, axisX: m, axisY: n, svg: this.svg, options: a });
|
||
|
}
|
||
|
function e(a, b, d, e) {
|
||
|
c.Bar['super'].constructor.call(this, a, b, f, c.extend({}, f, d), e);
|
||
|
}
|
||
|
var f = {
|
||
|
axisX: {
|
||
|
offset: 30,
|
||
|
position: 'end',
|
||
|
labelOffset: { x: 0, y: 0 },
|
||
|
showLabel: !0,
|
||
|
showGrid: !0,
|
||
|
labelInterpolationFnc: c.noop,
|
||
|
scaleMinSpace: 30,
|
||
|
onlyInteger: !1,
|
||
|
},
|
||
|
axisY: {
|
||
|
offset: 40,
|
||
|
position: 'start',
|
||
|
labelOffset: { x: 0, y: 0 },
|
||
|
showLabel: !0,
|
||
|
showGrid: !0,
|
||
|
labelInterpolationFnc: c.noop,
|
||
|
scaleMinSpace: 20,
|
||
|
onlyInteger: !1,
|
||
|
},
|
||
|
width: void 0,
|
||
|
height: void 0,
|
||
|
high: void 0,
|
||
|
low: void 0,
|
||
|
chartPadding: { top: 15, right: 15, bottom: 5, left: 10 },
|
||
|
seriesBarDistance: 15,
|
||
|
stackBars: !1,
|
||
|
stackMode: 'accumulate',
|
||
|
horizontalBars: !1,
|
||
|
distributeSeries: !1,
|
||
|
reverseData: !1,
|
||
|
classNames: {
|
||
|
chart: 'ct-chart-bar',
|
||
|
horizontalBars: 'ct-horizontal-bars',
|
||
|
label: 'ct-label',
|
||
|
labelGroup: 'ct-labels',
|
||
|
series: 'ct-series',
|
||
|
bar: 'ct-bar',
|
||
|
grid: 'ct-grid',
|
||
|
gridGroup: 'ct-grids',
|
||
|
vertical: 'ct-vertical',
|
||
|
horizontal: 'ct-horizontal',
|
||
|
start: 'ct-start',
|
||
|
end: 'ct-end',
|
||
|
},
|
||
|
};
|
||
|
c.Bar = c.Base.extend({ constructor: e, createChart: d });
|
||
|
})(window, document, a),
|
||
|
(function (a, b, c) {
|
||
|
'use strict';
|
||
|
function d(a, b, c) {
|
||
|
var d = b.x > a.x;
|
||
|
return (d && 'explode' === c) || (!d && 'implode' === c)
|
||
|
? 'start'
|
||
|
: (d && 'implode' === c) || (!d && 'explode' === c)
|
||
|
? 'end'
|
||
|
: 'middle';
|
||
|
}
|
||
|
function e(a) {
|
||
|
this.data = c.normalizeData(this.data);
|
||
|
var b,
|
||
|
e,
|
||
|
f,
|
||
|
h,
|
||
|
i,
|
||
|
j = [],
|
||
|
k = a.startAngle,
|
||
|
l = c.getDataArray(this.data, a.reverseData);
|
||
|
(this.svg = c.createSvg(this.container, a.width, a.height, a.donut ? a.classNames.chartDonut : a.classNames.chartPie)),
|
||
|
(e = c.createChartRect(this.svg, a, g.padding)),
|
||
|
(f = Math.min(e.width() / 2, e.height() / 2)),
|
||
|
(i =
|
||
|
a.total ||
|
||
|
l.reduce(function (a, b) {
|
||
|
return a + b;
|
||
|
}, 0));
|
||
|
var m = c.quantity(a.donutWidth);
|
||
|
'%' === m.unit && (m.value *= f / 100),
|
||
|
(f -= a.donut ? m.value / 2 : 0),
|
||
|
(h = 'outside' === a.labelPosition || a.donut ? f : 'center' === a.labelPosition ? 0 : f / 2),
|
||
|
(h += a.labelOffset);
|
||
|
var n = { x: e.x1 + e.width() / 2, y: e.y2 + e.height() / 2 },
|
||
|
o =
|
||
|
1 ===
|
||
|
this.data.series.filter(function (a) {
|
||
|
return a.hasOwnProperty('value') ? 0 !== a.value : 0 !== a;
|
||
|
}).length;
|
||
|
a.showLabel && (b = this.svg.elem('g', null, null, !0));
|
||
|
for (var p = 0; p < this.data.series.length; p++)
|
||
|
if (0 !== l[p] || !a.ignoreEmptyValues) {
|
||
|
var q = this.data.series[p];
|
||
|
(j[p] = this.svg.elem('g', null, null, !0)),
|
||
|
j[p].attr({ 'ct:series-name': q.name }),
|
||
|
j[p].addClass([a.classNames.series, q.className || a.classNames.series + '-' + c.alphaNumerate(p)].join(' '));
|
||
|
var r = k + (l[p] / i) * 360,
|
||
|
s = Math.max(0, k - (0 === p || o ? 0 : 0.2));
|
||
|
r - s >= 359.99 && (r = s + 359.99);
|
||
|
var t = c.polarToCartesian(n.x, n.y, f, s),
|
||
|
u = c.polarToCartesian(n.x, n.y, f, r),
|
||
|
v = new c.Svg.Path(!a.donut).move(u.x, u.y).arc(f, f, 0, r - k > 180, 0, t.x, t.y);
|
||
|
a.donut || v.line(n.x, n.y);
|
||
|
var w = j[p].elem('path', { d: v.stringify() }, a.donut ? a.classNames.sliceDonut : a.classNames.slicePie);
|
||
|
if (
|
||
|
(w.attr({ 'ct:value': l[p], 'ct:meta': c.serialize(q.meta) }),
|
||
|
a.donut && w.attr({ style: 'stroke-width: ' + m.value + 'px' }),
|
||
|
this.eventEmitter.emit('draw', {
|
||
|
type: 'slice',
|
||
|
value: l[p],
|
||
|
totalDataSum: i,
|
||
|
index: p,
|
||
|
meta: q.meta,
|
||
|
series: q,
|
||
|
group: j[p],
|
||
|
element: w,
|
||
|
path: v.clone(),
|
||
|
center: n,
|
||
|
radius: f,
|
||
|
startAngle: k,
|
||
|
endAngle: r,
|
||
|
}),
|
||
|
a.showLabel)
|
||
|
) {
|
||
|
var x = c.polarToCartesian(n.x, n.y, h, k + (r - k) / 2),
|
||
|
y = a.labelInterpolationFnc(this.data.labels && !c.isFalseyButZero(this.data.labels[p]) ? this.data.labels[p] : l[p], p);
|
||
|
if (y || 0 === y) {
|
||
|
var z = b.elem('text', { dx: x.x, dy: x.y, 'text-anchor': d(n, x, a.labelDirection) }, a.classNames.label).text('' + y);
|
||
|
this.eventEmitter.emit('draw', { type: 'label', index: p, group: b, element: z, text: '' + y, x: x.x, y: x.y });
|
||
|
}
|
||
|
}
|
||
|
k = r;
|
||
|
}
|
||
|
this.eventEmitter.emit('created', { chartRect: e, svg: this.svg, options: a });
|
||
|
}
|
||
|
function f(a, b, d, e) {
|
||
|
c.Pie['super'].constructor.call(this, a, b, g, c.extend({}, g, d), e);
|
||
|
}
|
||
|
var g = {
|
||
|
width: void 0,
|
||
|
height: void 0,
|
||
|
chartPadding: 5,
|
||
|
classNames: {
|
||
|
chartPie: 'ct-chart-pie',
|
||
|
chartDonut: 'ct-chart-donut',
|
||
|
series: 'ct-series',
|
||
|
slicePie: 'ct-slice-pie',
|
||
|
sliceDonut: 'ct-slice-donut',
|
||
|
label: 'ct-label',
|
||
|
},
|
||
|
startAngle: 0,
|
||
|
total: void 0,
|
||
|
donut: !1,
|
||
|
donutWidth: 60,
|
||
|
showLabel: !0,
|
||
|
labelOffset: 0,
|
||
|
labelPosition: 'inside',
|
||
|
labelInterpolationFnc: c.noop,
|
||
|
labelDirection: 'neutral',
|
||
|
reverseData: !1,
|
||
|
ignoreEmptyValues: !1,
|
||
|
};
|
||
|
c.Pie = c.Base.extend({ constructor: f, createChart: e, determineAnchorPosition: d });
|
||
|
})(window, document, a),
|
||
|
a
|
||
|
);
|
||
|
});
|