chartjs-chart-error-bars
Advanced tools
Comparing version 3.0.0-alpha.1 to 3.0.0-alpha.2
@@ -1,3 +0,43 @@ | ||
import { elements, defaults, helpers, controllers } from 'chart.js'; | ||
import ChartNS from 'chart.js'; | ||
const Chart = ChartNS; | ||
const defaults = ChartNS.defaults; | ||
// export const DatasetController = ChartNS.DatasetController; | ||
const BarController = ChartNS.controllers.bar; | ||
const HorizontalBarController = ChartNS.controllers.horizontalBar; | ||
const LineController = ChartNS.controllers.line; | ||
const PolarAreaController = ChartNS.controllers.polarArea; | ||
const ScatterController = ChartNS.controllers.scatter; | ||
function registerController(controller) { | ||
ChartNS.controllers[controller.id] = controller; | ||
ChartNS.defaults.set(controller.id, controller.defaults); | ||
return controller; | ||
} | ||
// export const Element = ChartNS.Element; | ||
const Rectangle = ChartNS.elements.Rectangle; | ||
const Point = ChartNS.elements.Point; | ||
// export const Line = ChartNS.elements.Line; | ||
const Arc = ChartNS.elements.Arc; | ||
function registerElement(element) { | ||
ChartNS.defaults.set('elements', { | ||
[element.id]: element.defaults, | ||
}); | ||
return element; | ||
} | ||
const merge = ChartNS.helpers.merge; | ||
// export const drawPoint = ChartNS.helpers.canvas.drawPoint; | ||
const resolve = ChartNS.helpers.options.resolve; | ||
const color = ChartNS.helpers.color; | ||
function patchControllerConfig(config, controller) { | ||
controller.register(); | ||
config.type = controller.id; | ||
return config; | ||
} | ||
const allModelKeys = ['xMin', 'xMax', 'yMin', 'yMax']; | ||
@@ -30,3 +70,3 @@ | ||
const resetRadius = animationOpts.animateScale ? 0 : valueRadius; | ||
return reset ? resetRadius : arc.hidden ? 0 : valueRadius; | ||
return reset ? resetRadius : valueRadius; | ||
}; | ||
@@ -250,3 +290,3 @@ | ||
class RectangleWithErrorBar extends elements.Rectangle { | ||
class RectangleWithErrorBar extends Rectangle { | ||
draw(ctx) { | ||
@@ -258,11 +298,7 @@ super.draw(ctx); | ||
} | ||
RectangleWithErrorBar._type = 'rectangleWithErrorBar'; | ||
RectangleWithErrorBar.register = () => { | ||
defaults.set('elements', { | ||
[RectangleWithErrorBar._type]: Object.assign({}, defaults.elements.rectangle, errorBarDefaults), | ||
}); | ||
return RectangleWithErrorBar; | ||
}; | ||
RectangleWithErrorBar.id = RectangleWithErrorBar._type = 'rectangleWithErrorBar'; | ||
RectangleWithErrorBar.defaults = Object.assign({}, defaults.elements.rectangle, errorBarDefaults); | ||
RectangleWithErrorBar.register = () => registerElement(RectangleWithErrorBar); | ||
class PointWithErrorBar extends elements.Point { | ||
class PointWithErrorBar extends Point { | ||
draw(ctx) { | ||
@@ -274,11 +310,7 @@ super.draw(ctx); | ||
} | ||
PointWithErrorBar._type = 'pointWithErrorBar'; | ||
PointWithErrorBar.register = () => { | ||
defaults.set('elements', { | ||
[PointWithErrorBar._type]: Object.assign({}, defaults.elements.point, errorBarDefaults), | ||
}); | ||
return PointWithErrorBar; | ||
}; | ||
PointWithErrorBar.id = PointWithErrorBar._type = 'pointWithErrorBar'; | ||
PointWithErrorBar.defaults = Object.assign({}, defaults.elements.point, errorBarDefaults); | ||
PointWithErrorBar.register = () => registerElement(PointWithErrorBar); | ||
class ArcWithErrorBar extends elements.Arc { | ||
class ArcWithErrorBar extends Arc { | ||
draw(ctx) { | ||
@@ -290,9 +322,5 @@ super.draw(ctx); | ||
} | ||
ArcWithErrorBar._type = 'arcWithErrorBar'; | ||
ArcWithErrorBar.register = () => { | ||
defaults.set('elements', { | ||
[ArcWithErrorBar._type]: Object.assign({}, defaults.elements.arc, errorBarDefaults), | ||
}); | ||
return ArcWithErrorBar; | ||
}; | ||
ArcWithErrorBar.id = ArcWithErrorBar._type = 'arcWithErrorBar'; | ||
ArcWithErrorBar.defaults = Object.assign({}, defaults.elements.arc, errorBarDefaults); | ||
ArcWithErrorBar.register = () => registerElement(ArcWithErrorBar); | ||
@@ -363,4 +391,4 @@ function reverseOrder(v) { | ||
} | ||
var c0 = helpers.color(f); | ||
var c1 = c0.valid && helpers.color(t); | ||
var c0 = color(f); | ||
var c1 = c0.valid && color(t); | ||
return c1 && c1.valid ? c1.mix(c0, factor).hexString() : to; | ||
@@ -460,3 +488,3 @@ }, | ||
class BarWithErrorBars extends controllers.bar { | ||
class BarWithErrorBarsController extends BarController { | ||
getMinMax(scale, canStack) { | ||
@@ -479,13 +507,19 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
} | ||
BarWithErrorBars.prototype.dataElementOptions = controllers.bar.prototype.dataElementOptions.concat(styleKeys); | ||
BarWithErrorBarsController.prototype.dataElementOptions = BarController.prototype.dataElementOptions.concat(styleKeys); | ||
BarWithErrorBars.id = 'barWithErrorBars'; | ||
BarWithErrorBars.register = () => { | ||
BarWithErrorBars.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
controllers[BarWithErrorBars.id] = BarWithErrorBars; | ||
defaults.set(BarWithErrorBars.id, helpers.merge({}, [defaults.bar, verticalTooltipDefaults, animationHints])); | ||
return BarWithErrorBars; | ||
BarWithErrorBarsController.id = 'barWithErrorBars'; | ||
BarWithErrorBarsController.register = () => { | ||
BarWithErrorBarsController.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
BarWithErrorBarsController.defaults = merge({}, [defaults.bar, verticalTooltipDefaults, animationHints]); | ||
return registerController(BarWithErrorBarsController); | ||
}; | ||
class HorizontalBarWithErrorBars extends controllers.horizontalBar { | ||
class BarWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, BarWithErrorBarsController)); | ||
} | ||
} | ||
BarWithErrorBarsChart.id = BarWithErrorBarsController.id; | ||
class HorizontalBarWithErrorBarsController extends HorizontalBarController { | ||
getMinMax(scale, canStack) { | ||
@@ -509,18 +543,24 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
HorizontalBarWithErrorBars.prototype.dataElementOptions = controllers.horizontalBar.prototype.dataElementOptions.concat( | ||
HorizontalBarWithErrorBarsController.prototype.dataElementOptions = HorizontalBarController.prototype.dataElementOptions.concat( | ||
styleKeys | ||
); | ||
HorizontalBarWithErrorBars.id = 'horizontalBarWithErrorBars'; | ||
HorizontalBarWithErrorBars.register = () => { | ||
HorizontalBarWithErrorBars.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
controllers[HorizontalBarWithErrorBars.id] = HorizontalBarWithErrorBars; | ||
defaults.set( | ||
HorizontalBarWithErrorBars.id, | ||
helpers.merge({}, [defaults.horizontalBar, horizontalTooltipDefaults, animationHints]) | ||
); | ||
return HorizontalBarWithErrorBars; | ||
HorizontalBarWithErrorBarsController.id = 'horizontalBarWithErrorBars'; | ||
HorizontalBarWithErrorBarsController.register = () => { | ||
HorizontalBarWithErrorBarsController.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
HorizontalBarWithErrorBarsController.defaults = merge({}, [ | ||
defaults.horizontalBar, | ||
horizontalTooltipDefaults, | ||
animationHints, | ||
]); | ||
return registerController(HorizontalBarWithErrorBarsController); | ||
}; | ||
class LineWithErrorBars extends controllers.line { | ||
class HorizontalBarWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, HorizontalBarWithErrorBarsController)); | ||
} | ||
} | ||
HorizontalBarWithErrorBarsChart.id = HorizontalBarWithErrorBarsController.id; | ||
class LineWithErrorBarsController extends LineController { | ||
getMinMax(scale, canStack) { | ||
@@ -546,16 +586,22 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
LineWithErrorBars.prototype.dataElementOptions = Object.assign( | ||
LineWithErrorBarsController.prototype.dataElementOptions = Object.assign( | ||
{}, | ||
controllers.line.prototype.dataElementOptions, | ||
LineController.prototype.dataElementOptions, | ||
styleObjectKeys | ||
); | ||
LineWithErrorBars.id = 'lineWithErrorBars'; | ||
LineWithErrorBars.register = () => { | ||
LineWithErrorBars.prototype.dataElementType = PointWithErrorBar.register(); | ||
controllers[LineWithErrorBars.id] = LineWithErrorBars; | ||
defaults.set(LineWithErrorBars.id, helpers.merge({}, [defaults.line, verticalTooltipDefaults, animationHints])); | ||
return LineWithErrorBars; | ||
LineWithErrorBarsController.id = 'lineWithErrorBars'; | ||
LineWithErrorBarsController.register = () => { | ||
LineWithErrorBarsController.prototype.dataElementType = PointWithErrorBar.register(); | ||
LineWithErrorBarsController.defaults = merge({}, [defaults.line, verticalTooltipDefaults, animationHints]); | ||
return registerController(LineWithErrorBarsController); | ||
}; | ||
class LineWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, LineWithErrorBarsController)); | ||
} | ||
} | ||
LineWithErrorBarsChart.id = LineWithErrorBarsController.id; | ||
const tooltipDefaults = { | ||
@@ -569,3 +615,3 @@ tooltips: { | ||
class ScatterWithErrorBars extends controllers.scatter { | ||
class ScatterWithErrorBarsController extends ScatterController { | ||
getMinMax(scale, canStack) { | ||
@@ -591,16 +637,22 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
} | ||
ScatterWithErrorBars.prototype.dataElementOptions = Object.assign( | ||
ScatterWithErrorBarsController.prototype.dataElementOptions = Object.assign( | ||
{}, | ||
controllers.scatter.prototype.dataElementOptions, | ||
ScatterController.prototype.dataElementOptions, | ||
styleObjectKeys | ||
); | ||
ScatterWithErrorBars.id = 'scatterWithErrorBars'; | ||
ScatterWithErrorBars.register = () => { | ||
ScatterWithErrorBars.prototype.dataElementType = PointWithErrorBar.register(); | ||
controllers[ScatterWithErrorBars.id] = ScatterWithErrorBars; | ||
defaults.set(ScatterWithErrorBars.id, helpers.merge({}, [defaults.scatter, tooltipDefaults, animationHints])); | ||
return ScatterWithErrorBars; | ||
ScatterWithErrorBarsController.id = 'scatterWithErrorBars'; | ||
ScatterWithErrorBarsController.register = () => { | ||
ScatterWithErrorBarsController.prototype.dataElementType = PointWithErrorBar.register(); | ||
ScatterWithErrorBarsController.defaults = merge({}, [defaults.scatter, tooltipDefaults, animationHints]); | ||
return registerController(ScatterWithErrorBarsController); | ||
}; | ||
class ScatterWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, ScatterWithErrorBarsController)); | ||
} | ||
} | ||
ScatterWithErrorBarsChart.id = ScatterWithErrorBarsController.id; | ||
const tooltipDefaults$1 = { | ||
@@ -614,3 +666,3 @@ tooltips: { | ||
class PolarAreaWithErrorBars extends controllers.polarArea { | ||
class PolarAreaWithErrorBarsController extends PolarAreaController { | ||
getMinMax(scale, canStack) { | ||
@@ -639,3 +691,3 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
const context = this._getContext(index, true); | ||
return helpers.options.resolve([this.chart.options.elements.arc.angle, (2 * Math.PI) / count], context, index); | ||
return resolve([this.chart.options.elements.arc.angle, (2 * Math.PI) / count], context, index); | ||
} | ||
@@ -683,16 +735,22 @@ | ||
PolarAreaWithErrorBars.prototype.dataElementOptions = Object.assign( | ||
PolarAreaWithErrorBarsController.prototype.dataElementOptions = Object.assign( | ||
{}, | ||
controllers.polarArea.prototype.dataElementOptions, | ||
PolarAreaController.prototype.dataElementOptions, | ||
styleObjectKeys | ||
); | ||
PolarAreaWithErrorBars.id = 'polarAreaWithErrorBars'; | ||
PolarAreaWithErrorBars.register = () => { | ||
PolarAreaWithErrorBars.prototype.dataElementType = ArcWithErrorBar.register(); | ||
controllers[PolarAreaWithErrorBars.id] = PolarAreaWithErrorBars; | ||
defaults.set(PolarAreaWithErrorBars.id, helpers.merge({}, [defaults.polarArea, tooltipDefaults$1, animationHints])); | ||
return PolarAreaWithErrorBars; | ||
PolarAreaWithErrorBarsController.id = 'polarAreaWithErrorBars'; | ||
PolarAreaWithErrorBarsController.register = () => { | ||
PolarAreaWithErrorBarsController.prototype.dataElementType = ArcWithErrorBar.register(); | ||
PolarAreaWithErrorBarsController.defaults = merge({}, [defaults.polarArea, tooltipDefaults$1, animationHints]); | ||
return registerController(PolarAreaWithErrorBarsController); | ||
}; | ||
export { ArcWithErrorBar, BarWithErrorBars, HorizontalBarWithErrorBars, LineWithErrorBars, PointWithErrorBar, PolarAreaWithErrorBars, RectangleWithErrorBar, ScatterWithErrorBars }; | ||
class PolarAreaWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, PolarAreaWithErrorBarsController)); | ||
} | ||
} | ||
PolarAreaWithErrorBarsChart.id = PolarAreaWithErrorBarsController.id; | ||
export { ArcWithErrorBar, BarWithErrorBarsChart, BarWithErrorBarsController, HorizontalBarWithErrorBarsChart, HorizontalBarWithErrorBarsController, LineWithErrorBarsChart, LineWithErrorBarsController, PointWithErrorBar, PolarAreaWithErrorBarsChart, PolarAreaWithErrorBarsController, RectangleWithErrorBar, ScatterWithErrorBarsChart, ScatterWithErrorBarsController }; |
@@ -5,21 +5,6 @@ (function (global, factory) { | ||
(global = global || self, factory(global.ChartErrorBars = {}, global.Chart)); | ||
}(this, (function (exports, chart_js) { 'use strict'; | ||
}(this, (function (exports, ChartNS) { 'use strict'; | ||
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; | ||
} | ||
ChartNS = ChartNS && Object.prototype.hasOwnProperty.call(ChartNS, 'default') ? ChartNS['default'] : ChartNS; | ||
return obj; | ||
} | ||
var defineProperty = _defineProperty; | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -171,2 +156,51 @@ if (!(instance instanceof 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; | ||
} | ||
var defineProperty = _defineProperty; | ||
var Chart = ChartNS; | ||
var defaults = ChartNS.defaults; // export const DatasetController = ChartNS.DatasetController; | ||
var BarController = ChartNS.controllers.bar; | ||
var HorizontalBarController = ChartNS.controllers.horizontalBar; | ||
var LineController = ChartNS.controllers.line; | ||
var PolarAreaController = ChartNS.controllers.polarArea; | ||
var ScatterController = ChartNS.controllers.scatter; | ||
function registerController(controller) { | ||
ChartNS.controllers[controller.id] = controller; | ||
ChartNS.defaults.set(controller.id, controller.defaults); | ||
return controller; | ||
} // export const Element = ChartNS.Element; | ||
var Rectangle = ChartNS.elements.Rectangle; | ||
var Point = ChartNS.elements.Point; // export const Line = ChartNS.elements.Line; | ||
var Arc = ChartNS.elements.Arc; | ||
function registerElement(element) { | ||
ChartNS.defaults.set('elements', defineProperty({}, element.id, element.defaults)); | ||
return element; | ||
} | ||
var merge = ChartNS.helpers.merge; // export const drawPoint = ChartNS.helpers.canvas.drawPoint; | ||
var resolve = ChartNS.helpers.options.resolve; | ||
var color = ChartNS.helpers.color; | ||
function patchControllerConfig(config, controller) { | ||
controller.register(); | ||
config.type = controller.id; | ||
return config; | ||
} | ||
function _arrayWithHoles(arr) { | ||
@@ -270,3 +304,3 @@ if (Array.isArray(arr)) return arr; | ||
var resetRadius = animationOpts.animateScale ? 0 : valueRadius; | ||
return reset ? resetRadius : arc.hidden ? 0 : valueRadius; | ||
return reset ? resetRadius : valueRadius; | ||
}; | ||
@@ -521,4 +555,4 @@ | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
var RectangleWithErrorBar = /*#__PURE__*/function (_elements$Rectangle) { | ||
inherits(RectangleWithErrorBar, _elements$Rectangle); | ||
var RectangleWithErrorBar = /*#__PURE__*/function (_Rectangle) { | ||
inherits(RectangleWithErrorBar, _Rectangle); | ||
@@ -543,8 +577,8 @@ var _super = _createSuper(RectangleWithErrorBar); | ||
return RectangleWithErrorBar; | ||
}(chart_js.elements.Rectangle); | ||
RectangleWithErrorBar._type = 'rectangleWithErrorBar'; | ||
}(Rectangle); | ||
RectangleWithErrorBar.id = RectangleWithErrorBar._type = 'rectangleWithErrorBar'; | ||
RectangleWithErrorBar.defaults = Object.assign({}, defaults.elements.rectangle, errorBarDefaults); | ||
RectangleWithErrorBar.register = function () { | ||
chart_js.defaults.set('elements', defineProperty({}, RectangleWithErrorBar._type, Object.assign({}, chart_js.defaults.elements.rectangle, errorBarDefaults))); | ||
return RectangleWithErrorBar; | ||
return registerElement(RectangleWithErrorBar); | ||
}; | ||
@@ -555,4 +589,4 @@ | ||
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
var PointWithErrorBar = /*#__PURE__*/function (_elements$Point) { | ||
inherits(PointWithErrorBar, _elements$Point); | ||
var PointWithErrorBar = /*#__PURE__*/function (_Point) { | ||
inherits(PointWithErrorBar, _Point); | ||
@@ -577,8 +611,8 @@ var _super = _createSuper$1(PointWithErrorBar); | ||
return PointWithErrorBar; | ||
}(chart_js.elements.Point); | ||
PointWithErrorBar._type = 'pointWithErrorBar'; | ||
}(Point); | ||
PointWithErrorBar.id = PointWithErrorBar._type = 'pointWithErrorBar'; | ||
PointWithErrorBar.defaults = Object.assign({}, defaults.elements.point, errorBarDefaults); | ||
PointWithErrorBar.register = function () { | ||
chart_js.defaults.set('elements', defineProperty({}, PointWithErrorBar._type, Object.assign({}, chart_js.defaults.elements.point, errorBarDefaults))); | ||
return PointWithErrorBar; | ||
return registerElement(PointWithErrorBar); | ||
}; | ||
@@ -589,4 +623,4 @@ | ||
function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
var ArcWithErrorBar = /*#__PURE__*/function (_elements$Arc) { | ||
inherits(ArcWithErrorBar, _elements$Arc); | ||
var ArcWithErrorBar = /*#__PURE__*/function (_Arc) { | ||
inherits(ArcWithErrorBar, _Arc); | ||
@@ -611,8 +645,8 @@ var _super = _createSuper$2(ArcWithErrorBar); | ||
return ArcWithErrorBar; | ||
}(chart_js.elements.Arc); | ||
ArcWithErrorBar._type = 'arcWithErrorBar'; | ||
}(Arc); | ||
ArcWithErrorBar.id = ArcWithErrorBar._type = 'arcWithErrorBar'; | ||
ArcWithErrorBar.defaults = Object.assign({}, defaults.elements.arc, errorBarDefaults); | ||
ArcWithErrorBar.register = function () { | ||
chart_js.defaults.set('elements', defineProperty({}, ArcWithErrorBar._type, Object.assign({}, chart_js.defaults.elements.arc, errorBarDefaults))); | ||
return ArcWithErrorBar; | ||
return registerElement(ArcWithErrorBar); | ||
}; | ||
@@ -629,3 +663,3 @@ | ||
return function (item, data) { | ||
var base = chart_js.defaults.tooltips.callbacks.label.call(_this, item, data); | ||
var base = defaults.tooltips.callbacks.label.call(_this, item, data); | ||
var v = data.datasets[item.datasetIndex].data[item.index]; | ||
@@ -675,3 +709,3 @@ | ||
function generateTooltipPolar(item, data) { | ||
var base = chart_js.defaults.polarArea.tooltips.callbacks.label.call(this, item, data); | ||
var base = defaults.polarArea.tooltips.callbacks.label.call(this, item, data); | ||
var v = data.datasets[item.datasetIndex].data[item.index]; | ||
@@ -690,3 +724,3 @@ var keys = ['rMin', 'rMax']; | ||
var interpolators = { | ||
color: function color(from, to, factor) { | ||
color: function color$1(from, to, factor) { | ||
var f = from || transparent; | ||
@@ -699,4 +733,6 @@ var t = to || transparent; | ||
var c0 = chart_js.helpers.color(f); | ||
var c1 = c0.valid && chart_js.helpers.color(t); | ||
var c0 = color(f); | ||
var c1 = c0.valid && color(t); | ||
return c1 && c1.valid ? c1.mix(c0, factor).hexString() : to; | ||
@@ -839,9 +875,9 @@ }, | ||
function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
var BarWithErrorBars = /*#__PURE__*/function (_controllers$bar) { | ||
inherits(BarWithErrorBars, _controllers$bar); | ||
var BarWithErrorBarsController = /*#__PURE__*/function (_BarController) { | ||
inherits(BarWithErrorBarsController, _BarController); | ||
var _super = _createSuper$3(BarWithErrorBars); | ||
var _super = _createSuper$3(BarWithErrorBarsController); | ||
function BarWithErrorBars() { | ||
classCallCheck(this, BarWithErrorBars); | ||
function BarWithErrorBarsController() { | ||
classCallCheck(this, BarWithErrorBarsController); | ||
@@ -851,3 +887,3 @@ return _super.apply(this, arguments); | ||
createClass(BarWithErrorBars, [{ | ||
createClass(BarWithErrorBarsController, [{ | ||
key: "getMinMax", | ||
@@ -858,3 +894,3 @@ value: function getMinMax$1(scale, canStack) { | ||
return getMinMax(scale, canStack, function (scale, canStack) { | ||
return get(getPrototypeOf(BarWithErrorBars.prototype), "getMinMax", _this).call(_this, scale, canStack); | ||
return get(getPrototypeOf(BarWithErrorBarsController.prototype), "getMinMax", _this).call(_this, scale, canStack); | ||
}); | ||
@@ -865,3 +901,3 @@ } | ||
value: function parseObjectData(meta, data, start, count) { | ||
var parsed = get(getPrototypeOf(BarWithErrorBars.prototype), "parseObjectData", this).call(this, meta, data, start, count); | ||
var parsed = get(getPrototypeOf(BarWithErrorBarsController.prototype), "parseObjectData", this).call(this, meta, data, start, count); | ||
@@ -878,30 +914,43 @@ parseErrorNumberData(parsed, meta.vScale, data, start, count); | ||
get(getPrototypeOf(BarWithErrorBars.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
get(getPrototypeOf(BarWithErrorBarsController.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
} | ||
}]); | ||
return BarWithErrorBars; | ||
}(chart_js.controllers.bar); | ||
BarWithErrorBars.prototype.dataElementOptions = chart_js.controllers.bar.prototype.dataElementOptions.concat(styleKeys); | ||
BarWithErrorBars.id = 'barWithErrorBars'; | ||
return BarWithErrorBarsController; | ||
}(BarController); | ||
BarWithErrorBarsController.prototype.dataElementOptions = BarController.prototype.dataElementOptions.concat(styleKeys); | ||
BarWithErrorBarsController.id = 'barWithErrorBars'; | ||
BarWithErrorBars.register = function () { | ||
BarWithErrorBars.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
chart_js.controllers[BarWithErrorBars.id] = BarWithErrorBars; | ||
chart_js.defaults.set(BarWithErrorBars.id, chart_js.helpers.merge({}, [chart_js.defaults.bar, verticalTooltipDefaults, animationHints])); | ||
return BarWithErrorBars; | ||
BarWithErrorBarsController.register = function () { | ||
BarWithErrorBarsController.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
BarWithErrorBarsController.defaults = merge({}, [defaults.bar, verticalTooltipDefaults, animationHints]); | ||
return registerController(BarWithErrorBarsController); | ||
}; | ||
var HorizontalBarWithErrorBars = /*#__PURE__*/function (_controllers$horizont) { | ||
inherits(HorizontalBarWithErrorBars, _controllers$horizont); | ||
var BarWithErrorBarsChart = /*#__PURE__*/function (_Chart) { | ||
inherits(BarWithErrorBarsChart, _Chart); | ||
var _super2 = _createSuper$3(HorizontalBarWithErrorBars); | ||
var _super2 = _createSuper$3(BarWithErrorBarsChart); | ||
function HorizontalBarWithErrorBars() { | ||
classCallCheck(this, HorizontalBarWithErrorBars); | ||
function BarWithErrorBarsChart(item, config) { | ||
classCallCheck(this, BarWithErrorBarsChart); | ||
return _super2.apply(this, arguments); | ||
return _super2.call(this, item, patchControllerConfig(config, BarWithErrorBarsController)); | ||
} | ||
createClass(HorizontalBarWithErrorBars, [{ | ||
return BarWithErrorBarsChart; | ||
}(Chart); | ||
BarWithErrorBarsChart.id = BarWithErrorBarsController.id; | ||
var HorizontalBarWithErrorBarsController = /*#__PURE__*/function (_HorizontalBarControl) { | ||
inherits(HorizontalBarWithErrorBarsController, _HorizontalBarControl); | ||
var _super3 = _createSuper$3(HorizontalBarWithErrorBarsController); | ||
function HorizontalBarWithErrorBarsController() { | ||
classCallCheck(this, HorizontalBarWithErrorBarsController); | ||
return _super3.apply(this, arguments); | ||
} | ||
createClass(HorizontalBarWithErrorBarsController, [{ | ||
key: "getMinMax", | ||
@@ -912,3 +961,3 @@ value: function getMinMax$1(scale, canStack) { | ||
return getMinMax(scale, canStack, function (scale, canStack) { | ||
return get(getPrototypeOf(HorizontalBarWithErrorBars.prototype), "getMinMax", _this2).call(_this2, scale, canStack); | ||
return get(getPrototypeOf(HorizontalBarWithErrorBarsController.prototype), "getMinMax", _this2).call(_this2, scale, canStack); | ||
}); | ||
@@ -919,3 +968,3 @@ } | ||
value: function parseObjectData(meta, data, start, count) { | ||
var parsed = get(getPrototypeOf(HorizontalBarWithErrorBars.prototype), "parseObjectData", this).call(this, meta, data, start, count); | ||
var parsed = get(getPrototypeOf(HorizontalBarWithErrorBarsController.prototype), "parseObjectData", this).call(this, meta, data, start, count); | ||
@@ -932,28 +981,42 @@ parseErrorNumberData(parsed, meta.vScale, data, start, count); | ||
get(getPrototypeOf(HorizontalBarWithErrorBars.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
get(getPrototypeOf(HorizontalBarWithErrorBarsController.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
} | ||
}]); | ||
return HorizontalBarWithErrorBars; | ||
}(chart_js.controllers.horizontalBar); | ||
HorizontalBarWithErrorBars.prototype.dataElementOptions = chart_js.controllers.horizontalBar.prototype.dataElementOptions.concat(styleKeys); | ||
HorizontalBarWithErrorBars.id = 'horizontalBarWithErrorBars'; | ||
return HorizontalBarWithErrorBarsController; | ||
}(HorizontalBarController); | ||
HorizontalBarWithErrorBarsController.prototype.dataElementOptions = HorizontalBarController.prototype.dataElementOptions.concat(styleKeys); | ||
HorizontalBarWithErrorBarsController.id = 'horizontalBarWithErrorBars'; | ||
HorizontalBarWithErrorBars.register = function () { | ||
HorizontalBarWithErrorBars.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
chart_js.controllers[HorizontalBarWithErrorBars.id] = HorizontalBarWithErrorBars; | ||
chart_js.defaults.set(HorizontalBarWithErrorBars.id, chart_js.helpers.merge({}, [chart_js.defaults.horizontalBar, horizontalTooltipDefaults, animationHints])); | ||
return HorizontalBarWithErrorBars; | ||
HorizontalBarWithErrorBarsController.register = function () { | ||
HorizontalBarWithErrorBarsController.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
HorizontalBarWithErrorBarsController.defaults = merge({}, [defaults.horizontalBar, horizontalTooltipDefaults, animationHints]); | ||
return registerController(HorizontalBarWithErrorBarsController); | ||
}; | ||
var HorizontalBarWithErrorBarsChart = /*#__PURE__*/function (_Chart2) { | ||
inherits(HorizontalBarWithErrorBarsChart, _Chart2); | ||
var _super4 = _createSuper$3(HorizontalBarWithErrorBarsChart); | ||
function HorizontalBarWithErrorBarsChart(item, config) { | ||
classCallCheck(this, HorizontalBarWithErrorBarsChart); | ||
return _super4.call(this, item, patchControllerConfig(config, HorizontalBarWithErrorBarsController)); | ||
} | ||
return HorizontalBarWithErrorBarsChart; | ||
}(Chart); | ||
HorizontalBarWithErrorBarsChart.id = HorizontalBarWithErrorBarsController.id; | ||
function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } | ||
function _isNativeReflectConstruct$4() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
var LineWithErrorBars = /*#__PURE__*/function (_controllers$line) { | ||
inherits(LineWithErrorBars, _controllers$line); | ||
var LineWithErrorBarsController = /*#__PURE__*/function (_LineController) { | ||
inherits(LineWithErrorBarsController, _LineController); | ||
var _super = _createSuper$4(LineWithErrorBars); | ||
var _super = _createSuper$4(LineWithErrorBarsController); | ||
function LineWithErrorBars() { | ||
classCallCheck(this, LineWithErrorBars); | ||
function LineWithErrorBarsController() { | ||
classCallCheck(this, LineWithErrorBarsController); | ||
@@ -963,3 +1026,3 @@ return _super.apply(this, arguments); | ||
createClass(LineWithErrorBars, [{ | ||
createClass(LineWithErrorBarsController, [{ | ||
key: "getMinMax", | ||
@@ -970,3 +1033,3 @@ value: function getMinMax$1(scale, canStack) { | ||
return getMinMax(scale, canStack, function (scale, canStack) { | ||
return get(getPrototypeOf(LineWithErrorBars.prototype), "getMinMax", _this).call(_this, scale, canStack); | ||
return get(getPrototypeOf(LineWithErrorBarsController.prototype), "getMinMax", _this).call(_this, scale, canStack); | ||
}); | ||
@@ -977,3 +1040,3 @@ } | ||
value: function parseObjectData(meta, data, start, count) { | ||
var parsed = get(getPrototypeOf(LineWithErrorBars.prototype), "parseObjectData", this).call(this, meta, data, start, count); | ||
var parsed = get(getPrototypeOf(LineWithErrorBarsController.prototype), "parseObjectData", this).call(this, meta, data, start, count); | ||
@@ -992,18 +1055,32 @@ parseErrorNumberData(parsed, meta.vScale, data, start, count); | ||
get(getPrototypeOf(LineWithErrorBars.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
get(getPrototypeOf(LineWithErrorBarsController.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
} | ||
}]); | ||
return LineWithErrorBars; | ||
}(chart_js.controllers.line); | ||
LineWithErrorBars.prototype.dataElementOptions = Object.assign({}, chart_js.controllers.line.prototype.dataElementOptions, styleObjectKeys); | ||
LineWithErrorBars.id = 'lineWithErrorBars'; | ||
return LineWithErrorBarsController; | ||
}(LineController); | ||
LineWithErrorBarsController.prototype.dataElementOptions = Object.assign({}, LineController.prototype.dataElementOptions, styleObjectKeys); | ||
LineWithErrorBarsController.id = 'lineWithErrorBars'; | ||
LineWithErrorBars.register = function () { | ||
LineWithErrorBars.prototype.dataElementType = PointWithErrorBar.register(); | ||
chart_js.controllers[LineWithErrorBars.id] = LineWithErrorBars; | ||
chart_js.defaults.set(LineWithErrorBars.id, chart_js.helpers.merge({}, [chart_js.defaults.line, verticalTooltipDefaults, animationHints])); | ||
return LineWithErrorBars; | ||
LineWithErrorBarsController.register = function () { | ||
LineWithErrorBarsController.prototype.dataElementType = PointWithErrorBar.register(); | ||
LineWithErrorBarsController.defaults = merge({}, [defaults.line, verticalTooltipDefaults, animationHints]); | ||
return registerController(LineWithErrorBarsController); | ||
}; | ||
var LineWithErrorBarsChart = /*#__PURE__*/function (_Chart) { | ||
inherits(LineWithErrorBarsChart, _Chart); | ||
var _super2 = _createSuper$4(LineWithErrorBarsChart); | ||
function LineWithErrorBarsChart(item, config) { | ||
classCallCheck(this, LineWithErrorBarsChart); | ||
return _super2.call(this, item, patchControllerConfig(config, LineWithErrorBarsController)); | ||
} | ||
return LineWithErrorBarsChart; | ||
}(Chart); | ||
LineWithErrorBarsChart.id = LineWithErrorBarsController.id; | ||
function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } | ||
@@ -1019,9 +1096,9 @@ | ||
}; | ||
var ScatterWithErrorBars = /*#__PURE__*/function (_controllers$scatter) { | ||
inherits(ScatterWithErrorBars, _controllers$scatter); | ||
var ScatterWithErrorBarsController = /*#__PURE__*/function (_ScatterController) { | ||
inherits(ScatterWithErrorBarsController, _ScatterController); | ||
var _super = _createSuper$5(ScatterWithErrorBars); | ||
var _super = _createSuper$5(ScatterWithErrorBarsController); | ||
function ScatterWithErrorBars() { | ||
classCallCheck(this, ScatterWithErrorBars); | ||
function ScatterWithErrorBarsController() { | ||
classCallCheck(this, ScatterWithErrorBarsController); | ||
@@ -1031,3 +1108,3 @@ return _super.apply(this, arguments); | ||
createClass(ScatterWithErrorBars, [{ | ||
createClass(ScatterWithErrorBarsController, [{ | ||
key: "getMinMax", | ||
@@ -1038,3 +1115,3 @@ value: function getMinMax$1(scale, canStack) { | ||
return getMinMax(scale, canStack, function (scale, canStack) { | ||
return get(getPrototypeOf(ScatterWithErrorBars.prototype), "getMinMax", _this).call(_this, scale, canStack); | ||
return get(getPrototypeOf(ScatterWithErrorBarsController.prototype), "getMinMax", _this).call(_this, scale, canStack); | ||
}); | ||
@@ -1045,3 +1122,3 @@ } | ||
value: function parseObjectData(meta, data, start, count) { | ||
var parsed = get(getPrototypeOf(ScatterWithErrorBars.prototype), "parseObjectData", this).call(this, meta, data, start, count); | ||
var parsed = get(getPrototypeOf(ScatterWithErrorBarsController.prototype), "parseObjectData", this).call(this, meta, data, start, count); | ||
@@ -1061,18 +1138,32 @@ parseErrorNumberData(parsed, meta.xScale, data, start, count); | ||
get(getPrototypeOf(ScatterWithErrorBars.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
get(getPrototypeOf(ScatterWithErrorBarsController.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
} | ||
}]); | ||
return ScatterWithErrorBars; | ||
}(chart_js.controllers.scatter); | ||
ScatterWithErrorBars.prototype.dataElementOptions = Object.assign({}, chart_js.controllers.scatter.prototype.dataElementOptions, styleObjectKeys); | ||
ScatterWithErrorBars.id = 'scatterWithErrorBars'; | ||
return ScatterWithErrorBarsController; | ||
}(ScatterController); | ||
ScatterWithErrorBarsController.prototype.dataElementOptions = Object.assign({}, ScatterController.prototype.dataElementOptions, styleObjectKeys); | ||
ScatterWithErrorBarsController.id = 'scatterWithErrorBars'; | ||
ScatterWithErrorBars.register = function () { | ||
ScatterWithErrorBars.prototype.dataElementType = PointWithErrorBar.register(); | ||
chart_js.controllers[ScatterWithErrorBars.id] = ScatterWithErrorBars; | ||
chart_js.defaults.set(ScatterWithErrorBars.id, chart_js.helpers.merge({}, [chart_js.defaults.scatter, tooltipDefaults, animationHints])); | ||
return ScatterWithErrorBars; | ||
ScatterWithErrorBarsController.register = function () { | ||
ScatterWithErrorBarsController.prototype.dataElementType = PointWithErrorBar.register(); | ||
ScatterWithErrorBarsController.defaults = merge({}, [defaults.scatter, tooltipDefaults, animationHints]); | ||
return registerController(ScatterWithErrorBarsController); | ||
}; | ||
var ScatterWithErrorBarsChart = /*#__PURE__*/function (_Chart) { | ||
inherits(ScatterWithErrorBarsChart, _Chart); | ||
var _super2 = _createSuper$5(ScatterWithErrorBarsChart); | ||
function ScatterWithErrorBarsChart(item, config) { | ||
classCallCheck(this, ScatterWithErrorBarsChart); | ||
return _super2.call(this, item, patchControllerConfig(config, ScatterWithErrorBarsController)); | ||
} | ||
return ScatterWithErrorBarsChart; | ||
}(Chart); | ||
ScatterWithErrorBarsChart.id = ScatterWithErrorBarsController.id; | ||
function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function () { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } | ||
@@ -1088,9 +1179,9 @@ | ||
}; | ||
var PolarAreaWithErrorBars = /*#__PURE__*/function (_controllers$polarAre) { | ||
inherits(PolarAreaWithErrorBars, _controllers$polarAre); | ||
var PolarAreaWithErrorBarsController = /*#__PURE__*/function (_PolarAreaController) { | ||
inherits(PolarAreaWithErrorBarsController, _PolarAreaController); | ||
var _super = _createSuper$6(PolarAreaWithErrorBars); | ||
var _super = _createSuper$6(PolarAreaWithErrorBarsController); | ||
function PolarAreaWithErrorBars() { | ||
classCallCheck(this, PolarAreaWithErrorBars); | ||
function PolarAreaWithErrorBarsController() { | ||
classCallCheck(this, PolarAreaWithErrorBarsController); | ||
@@ -1100,3 +1191,3 @@ return _super.apply(this, arguments); | ||
createClass(PolarAreaWithErrorBars, [{ | ||
createClass(PolarAreaWithErrorBarsController, [{ | ||
key: "getMinMax", | ||
@@ -1107,3 +1198,3 @@ value: function getMinMax$1(scale, canStack) { | ||
return getMinMax(scale, canStack, function (scale, canStack) { | ||
return get(getPrototypeOf(PolarAreaWithErrorBars.prototype), "getMinMax", _this).call(_this, scale, canStack); | ||
return get(getPrototypeOf(PolarAreaWithErrorBarsController.prototype), "getMinMax", _this).call(_this, scale, canStack); | ||
}); | ||
@@ -1138,3 +1229,3 @@ } | ||
return chart_js.helpers.options.resolve([this.chart.options.elements.arc.angle, 2 * Math.PI / count], context, index); | ||
return resolve([this.chart.options.elements.arc.angle, 2 * Math.PI / count], context, index); | ||
} | ||
@@ -1161,3 +1252,3 @@ }, { | ||
get(getPrototypeOf(PolarAreaWithErrorBars.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
get(getPrototypeOf(PolarAreaWithErrorBarsController.prototype), "updateElement", this).call(this, element, index, properties, mode); | ||
} | ||
@@ -1178,3 +1269,3 @@ }, { | ||
get(getPrototypeOf(PolarAreaWithErrorBars.prototype), "updateElements", this).call(this, arcs, start, mode); | ||
get(getPrototypeOf(PolarAreaWithErrorBarsController.prototype), "updateElements", this).call(this, arcs, start, mode); | ||
@@ -1185,28 +1276,47 @@ scale.getDistanceFromCenterForValue = bak; | ||
return PolarAreaWithErrorBars; | ||
}(chart_js.controllers.polarArea); | ||
PolarAreaWithErrorBars.prototype.dataElementOptions = Object.assign({}, chart_js.controllers.polarArea.prototype.dataElementOptions, styleObjectKeys); | ||
PolarAreaWithErrorBars.id = 'polarAreaWithErrorBars'; | ||
return PolarAreaWithErrorBarsController; | ||
}(PolarAreaController); | ||
PolarAreaWithErrorBarsController.prototype.dataElementOptions = Object.assign({}, PolarAreaController.prototype.dataElementOptions, styleObjectKeys); | ||
PolarAreaWithErrorBarsController.id = 'polarAreaWithErrorBars'; | ||
PolarAreaWithErrorBars.register = function () { | ||
PolarAreaWithErrorBars.prototype.dataElementType = ArcWithErrorBar.register(); | ||
chart_js.controllers[PolarAreaWithErrorBars.id] = PolarAreaWithErrorBars; | ||
chart_js.defaults.set(PolarAreaWithErrorBars.id, chart_js.helpers.merge({}, [chart_js.defaults.polarArea, tooltipDefaults$1, animationHints])); | ||
return PolarAreaWithErrorBars; | ||
PolarAreaWithErrorBarsController.register = function () { | ||
PolarAreaWithErrorBarsController.prototype.dataElementType = ArcWithErrorBar.register(); | ||
PolarAreaWithErrorBarsController.defaults = merge({}, [defaults.polarArea, tooltipDefaults$1, animationHints]); | ||
return registerController(PolarAreaWithErrorBarsController); | ||
}; | ||
BarWithErrorBars.register(); | ||
HorizontalBarWithErrorBars.register(); | ||
LineWithErrorBars.register(); | ||
PolarAreaWithErrorBars.register(); | ||
ScatterWithErrorBars.register(); | ||
var PolarAreaWithErrorBarsChart = /*#__PURE__*/function (_Chart) { | ||
inherits(PolarAreaWithErrorBarsChart, _Chart); | ||
var _super2 = _createSuper$6(PolarAreaWithErrorBarsChart); | ||
function PolarAreaWithErrorBarsChart(item, config) { | ||
classCallCheck(this, PolarAreaWithErrorBarsChart); | ||
return _super2.call(this, item, patchControllerConfig(config, PolarAreaWithErrorBarsController)); | ||
} | ||
return PolarAreaWithErrorBarsChart; | ||
}(Chart); | ||
PolarAreaWithErrorBarsChart.id = PolarAreaWithErrorBarsController.id; | ||
BarWithErrorBarsController.register(); | ||
HorizontalBarWithErrorBarsController.register(); | ||
LineWithErrorBarsController.register(); | ||
PolarAreaWithErrorBarsController.register(); | ||
ScatterWithErrorBarsController.register(); | ||
exports.ArcWithErrorBar = ArcWithErrorBar; | ||
exports.BarWithErrorBars = BarWithErrorBars; | ||
exports.HorizontalBarWithErrorBars = HorizontalBarWithErrorBars; | ||
exports.LineWithErrorBars = LineWithErrorBars; | ||
exports.BarWithErrorBarsChart = BarWithErrorBarsChart; | ||
exports.BarWithErrorBarsController = BarWithErrorBarsController; | ||
exports.HorizontalBarWithErrorBarsChart = HorizontalBarWithErrorBarsChart; | ||
exports.HorizontalBarWithErrorBarsController = HorizontalBarWithErrorBarsController; | ||
exports.LineWithErrorBarsChart = LineWithErrorBarsChart; | ||
exports.LineWithErrorBarsController = LineWithErrorBarsController; | ||
exports.PointWithErrorBar = PointWithErrorBar; | ||
exports.PolarAreaWithErrorBars = PolarAreaWithErrorBars; | ||
exports.PolarAreaWithErrorBarsChart = PolarAreaWithErrorBarsChart; | ||
exports.PolarAreaWithErrorBarsController = PolarAreaWithErrorBarsController; | ||
exports.RectangleWithErrorBar = RectangleWithErrorBar; | ||
exports.ScatterWithErrorBars = ScatterWithErrorBars; | ||
exports.ScatterWithErrorBarsChart = ScatterWithErrorBarsChart; | ||
exports.ScatterWithErrorBarsController = ScatterWithErrorBarsController; | ||
@@ -1213,0 +1323,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,1 +0,1 @@ | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("chart.js")):"function"==typeof define&&define.amd?define(["exports","chart.js"],r):r((t=t||self).ChartErrorBars={},t.Chart)}(this,function(t,r){"use strict";var e=function(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t};var n=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")};function o(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=function(t,r,e){return r&&o(t.prototype,r),e&&o(t,e),t};function i(t,r){return t(r={exports:{}},r.exports),r.exports}var c=i(function(t){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r});var u=function(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=c(t)););return t},l=i(function(t){function r(e,n,o){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=r=Reflect.get:t.exports=r=function(t,r,e){var n=u(t,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(e):o.value}},r(e,n,o||e)}t.exports=r}),s=i(function(t){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},r(e,n)}t.exports=r});var f=function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),r&&s(t,r)},p=i(function(t){function r(e){"@babel/helpers - typeof";return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(t){return typeof t}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(e)}t.exports=r});var y=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var h=function(t,r){return!r||"object"!==p(r)&&"function"!=typeof r?y(t):r};var v=function(t){if(Array.isArray(t))return t};var d=function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(n=(i=c.next()).done)&&(e.push(i.value),!r||e.length!==r);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return e}};var m=function(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n};var g=function(t,r){if(t){if("string"==typeof t)return m(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?m(t,r):void 0}};var b=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var x=function(t,r){return v(t)||d(t,r)||g(t,r)||b()},M=["xMin","xMax","yMin","yMax"];function E(t){return t?M.slice(0,2):M.slice(2)}function k(t,r,e,n){for(var o=["".concat(e.axis,"Min"),"".concat(e.axis,"Max")],a=e.getBasePixel(),i=0,c=o;i<c.length;i++){var u=c[i],l=r[u];Array.isArray(l)?t[u]=l.map(function(t){return n?a:e.getPixelForValue(t)}):"number"==typeof l&&(t[u]=n?a:e.getPixelForValue(l))}}var S={errorBarLineWidth:{v:[1,3]},errorBarColor:{v:["#2c2c2c","#1f1f1f"]},errorBarWhiskerLineWidth:{v:[1,3]},errorBarWhiskerRatio:{v:[.2,.25]},errorBarWhiskerSize:{v:[20,24]},errorBarWhiskerColor:{v:["#2c2c2c","#1f1f1f"]}},A=Object.keys(S),O={};function R(t,r){var e=Array.isArray(t)?t:[t],n=Array.isArray(r)?r:[r];if(e.length===n.length)return e.map(function(t,r){return[t,n[r]]});var o=Math.max(e.length,n.length);return Array(o).map(function(t,r){return[e[r%e.length],n[r%n.length]]})}function B(t,r){if("string"==typeof t||"number"==typeof t)return t;var e=Array.isArray(t)?t:t.v;return e[r%e.length]}function W(t,r,e){var n=B(r.errorBarWhiskerRatio,e);return null!=t&&n>0?t*n*.5:.5*B(r.errorBarWhiskerSize,e)}function j(t,r){var e=t.getProps(["x","y","width","height"].concat(M));null==e.xMin&&null==e.xMax||function(t,r,e,n,o){o.save(),o.translate(0,t.y),null==r&&(r=t.x),null==e&&(e=t.x);var a=R(r,e);a.reverse().forEach(function(r,e){var i=x(r,2),c=i[0],u=i[1],l=a.length-e-1,s=W(t.height,n,l);o.lineWidth=B(n.errorBarLineWidth,l),o.strokeStyle=B(n.errorBarColor,l),o.beginPath(),o.moveTo(c,0),o.lineTo(u,0),o.stroke(),o.lineWidth=B(n.errorBarWhiskerLineWidth,l),o.strokeStyle=B(n.errorBarWhiskerColor,l),o.beginPath(),o.moveTo(c,-s),o.lineTo(c,s),o.moveTo(u,-s),o.lineTo(u,s),o.stroke()}),o.restore()}(e,e.xMin,e.xMax,t.options,r),null==e.yMin&&null==e.yMax||function(t,r,e,n,o){o.save(),o.translate(t.x,0),null==r&&(r=t.y),null==e&&(e=t.y);var a=R(r,e);a.reverse().forEach(function(r,e){var i=x(r,2),c=i[0],u=i[1],l=a.length-e-1,s=W(t.width,n,l);o.lineWidth=B(n.errorBarLineWidth,l),o.strokeStyle=B(n.errorBarColor,l),o.beginPath(),o.moveTo(0,c),o.lineTo(0,u),o.stroke(),o.lineWidth=B(n.errorBarWhiskerLineWidth,l),o.strokeStyle=B(n.errorBarWhiskerColor,l),o.beginPath(),o.moveTo(-s,c),o.lineTo(s,c),o.moveTo(-s,u),o.lineTo(s,u),o.stroke()}),o.restore()}(e,e.yMin,e.yMax,t.options,r)}function P(t,r){var e=t.getProps(["x","y","startAngle","endAngle","rMin","rMax","outerRadius"]);null==e.rMin&&null==e.rMax||function(t,r,e,n,o){o.save(),o.translate(t.x,t.y),null==r&&(r=t.outerRadius),null==e&&(e=t.outerRadius);var a=(t.startAngle+t.endAngle)/2,i=Math.cos(a),c=Math.sin(a),u={x:-c,y:i},l=Math.sqrt(u.x*u.x+u.y*u.y);u.x/=l,u.y/=l;var s=R(r,e);s.reverse().forEach(function(t,r){var e=x(t,2),a=e[0],l=e[1],f=s.length-r-1,p=a*i,y=a*c,h=l*i,v=l*c,d=W(null,n,f),m=u.x*d,g=u.y*d;o.lineWidth=B(n.errorBarLineWidth,f),o.strokeStyle=B(n.errorBarColor,f),o.beginPath(),o.moveTo(p,y),o.lineTo(h,v),o.stroke(),o.lineWidth=B(n.errorBarWhiskerLineWidth,f),o.strokeStyle=B(n.errorBarWhiskerColor,f),o.beginPath(),o.moveTo(p+m,y+g),o.lineTo(p-m,y-g),o.moveTo(h+m,v+g),o.lineTo(h-m,v-g),o.stroke()}),o.restore()}(e,e.rMin,e.rMax,t.options,r)}function D(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=c(t);if(r){var o=c(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return h(this,e)}}A.forEach(function(t){return O[t]=t});var _=function(t){f(e,t);var r=D(e);function e(){return n(this,e),r.apply(this,arguments)}return a(e,[{key:"draw",value:function(t){l(c(e.prototype),"draw",this).call(this,t),j(this,t)}}]),e}(r.elements.Rectangle);function T(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=c(t);if(r){var o=c(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return h(this,e)}}_._type="rectangleWithErrorBar",_.register=function(){return r.defaults.set("elements",e({},_._type,Object.assign({},r.defaults.elements.rectangle,S))),_};var w=function(t){f(e,t);var r=T(e);function e(){return n(this,e),r.apply(this,arguments)}return a(e,[{key:"draw",value:function(t){l(c(e.prototype),"draw",this).call(this,t),j(this,t)}}]),e}(r.elements.Point);function C(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=c(t);if(r){var o=c(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return h(this,e)}}w._type="pointWithErrorBar",w.register=function(){return r.defaults.set("elements",e({},w._type,Object.assign({},r.defaults.elements.point,S))),w};var F=function(t){f(e,t);var r=C(e);function e(){return n(this,e),r.apply(this,arguments)}return a(e,[{key:"draw",value:function(t){l(c(e.prototype),"draw",this).call(this,t),P(this,t)}}]),e}(r.elements.Arc);function L(t){return Array.isArray(t)?t.slice().reverse():t}function I(t){var e=this,n=E(t);return function(t,o){var a=r.defaults.tooltips.callbacks.label.call(e,t,o),i=o.datasets[t.datasetIndex].data[t.index];return null==i||n.every(function(t){return null==i[t]})?a:"".concat(a," (").concat(L(i[n[0]])," .. ").concat(i[n[1]],")")}}F._type="arcWithErrorBar",F.register=function(){return r.defaults.set("elements",e({},F._type,Object.assign({},r.defaults.elements.arc,S))),F};var V={tooltips:{callbacks:{label:I(!1)}}},z={tooltips:{callbacks:{label:I(!0)}}};var N={color:function(t,e,n){var o=t||transparent,a=e||transparent;if(o===a)return e;var i=r.helpers.color(o),c=i.valid&&r.helpers.color(a);return c&&c.valid?c.mix(i,n).hexString():e},number:function(t,r,e){return t===r?r:t+(r-t)*e}};function q(t,r,e,n,o){return p(t)===n&&p(r)===n?o(t,r,e):Array.isArray(t)&&Array.isArray(r)?t.map(function(t,n){return o(t,r[n],e)}):t&&Array.isArray(t.v)&&r&&Array.isArray(r.v)?t.v.map(function(t,n){return o(t,r.v[n],e)}):r}var H={datasets:{animation:{numberArray:{fn:function(t,r,e){return q(t,r,e,"number",N.number)},properties:M.concat(A.filter(function(t){return!t.endsWith("Color")}),["rMin","rMax"])},colorArray:{fn:function(t,r,e){return q(t,r,e,"string",N.color)},properties:M.concat(A.filter(function(t){return t.endsWith("Color")}))}}}};var U=function(t){if(Array.isArray(t))return m(t)};var $=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)};var G=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var J=function(t){return U(t)||$(t)||g(t)||G()};function K(t,r,e){var n=t.axis;t.axis="".concat(n,"MinMin");var o=e(t,r).min;t.axis="".concat(n,"MaxMax");var a=e(t,r).max;return t.axis=n,{min:o,max:a}}function Q(t,r,e){return Array.isArray(r)?e.apply(void 0,J(r)):"number"==typeof r?r:t}function X(t,r,e,n,o){for(var a="string"==typeof r?r:r.axis,i="".concat(a,"Min"),c="".concat(a,"Max"),u="".concat(a,"MinMin"),l="".concat(a,"MaxMax"),s=0;s<o;s++){var f=s+n,p=t[s];p[i]=e[f][i],p[c]=e[f][c],p[u]=Q(p[a],p[i],Math.min),p[l]=Q(p[a],p[c],Math.max)}}function Y(t,r,e,n){for(var o=r.axis,a=r.getLabels(),i=0;i<n;i++){var c=i+e;t[i][o]=r.parse(a[c],c)}}function Z(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=c(t);if(r){var o=c(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return h(this,e)}}var tt=function(t){f(e,t);var r=Z(e);function e(){return n(this,e),r.apply(this,arguments)}return a(e,[{key:"getMinMax",value:function(t,r){var n=this;return K(t,r,function(t,r){return l(c(e.prototype),"getMinMax",n).call(n,t,r)})}},{key:"parseObjectData",value:function(t,r,n,o){var a=l(c(e.prototype),"parseObjectData",this).call(this,t,r,n,o);return X(a,t.vScale,r,n,o),Y(a,t.iScale,n,o),a}},{key:"updateElement",value:function(t,r,n,o){k(n,this.getParsed(r),this._cachedMeta.vScale,"reset"===o),l(c(e.prototype),"updateElement",this).call(this,t,r,n,o)}}]),e}(r.controllers.bar);tt.prototype.dataElementOptions=r.controllers.bar.prototype.dataElementOptions.concat(A),tt.id="barWithErrorBars",tt.register=function(){return tt.prototype.dataElementType=_.register(),r.controllers[tt.id]=tt,r.defaults.set(tt.id,r.helpers.merge({},[r.defaults.bar,V,H])),tt};var rt=function(t){f(e,t);var r=Z(e);function e(){return n(this,e),r.apply(this,arguments)}return a(e,[{key:"getMinMax",value:function(t,r){var n=this;return K(t,r,function(t,r){return l(c(e.prototype),"getMinMax",n).call(n,t,r)})}},{key:"parseObjectData",value:function(t,r,n,o){var a=l(c(e.prototype),"parseObjectData",this).call(this,t,r,n,o);return X(a,t.vScale,r,n,o),Y(a,t.iScale,n,o),a}},{key:"updateElement",value:function(t,r,n,o){k(n,this.getParsed(r),this._cachedMeta.vScale,"reset"===o),l(c(e.prototype),"updateElement",this).call(this,t,r,n,o)}}]),e}(r.controllers.horizontalBar);function et(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=c(t);if(r){var o=c(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return h(this,e)}}rt.prototype.dataElementOptions=r.controllers.horizontalBar.prototype.dataElementOptions.concat(A),rt.id="horizontalBarWithErrorBars",rt.register=function(){return rt.prototype.dataElementType=_.register(),r.controllers[rt.id]=rt,r.defaults.set(rt.id,r.helpers.merge({},[r.defaults.horizontalBar,z,H])),rt};var nt=function(t){f(e,t);var r=et(e);function e(){return n(this,e),r.apply(this,arguments)}return a(e,[{key:"getMinMax",value:function(t,r){var n=this;return K(t,r,function(t,r){return l(c(e.prototype),"getMinMax",n).call(n,t,r)})}},{key:"parseObjectData",value:function(t,r,n,o){var a=l(c(e.prototype),"parseObjectData",this).call(this,t,r,n,o);return X(a,t.vScale,r,n,o),Y(a,t.iScale,n,o),a}},{key:"updateElement",value:function(t,r,n,o){t instanceof w&&k(n,this.getParsed(r),this._cachedMeta.vScale,"reset"===o),l(c(e.prototype),"updateElement",this).call(this,t,r,n,o)}}]),e}(r.controllers.line);function ot(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=c(t);if(r){var o=c(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return h(this,e)}}nt.prototype.dataElementOptions=Object.assign({},r.controllers.line.prototype.dataElementOptions,O),nt.id="lineWithErrorBars",nt.register=function(){return nt.prototype.dataElementType=w.register(),r.controllers[nt.id]=nt,r.defaults.set(nt.id,r.helpers.merge({},[r.defaults.line,V,H])),nt};var at={tooltips:{callbacks:{label:function(t,r){var e=r.datasets[t.datasetIndex].data[t.index],n=function(t,r){var n=E(r);return null==e||n.every(function(t){return null==e[t]})?t:"".concat(t," [").concat(L(e[n[0]])," .. ").concat(e[n[1]],"]")};return"(".concat(n(t.label,!0),", ").concat(n(t.value,!1),")")}}}},it=function(t){f(e,t);var r=ot(e);function e(){return n(this,e),r.apply(this,arguments)}return a(e,[{key:"getMinMax",value:function(t,r){var n=this;return K(t,r,function(t,r){return l(c(e.prototype),"getMinMax",n).call(n,t,r)})}},{key:"parseObjectData",value:function(t,r,n,o){var a=l(c(e.prototype),"parseObjectData",this).call(this,t,r,n,o);return X(a,t.xScale,r,n,o),X(a,t.yScale,r,n,o),a}},{key:"updateElement",value:function(t,r,n,o){t instanceof w&&(k(n,this.getParsed(r),this._cachedMeta.xScale,"reset"===o),k(n,this.getParsed(r),this._cachedMeta.yScale,"reset"===o)),l(c(e.prototype),"updateElement",this).call(this,t,r,n,o)}}]),e}(r.controllers.scatter);function ct(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=c(t);if(r){var o=c(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return h(this,e)}}it.prototype.dataElementOptions=Object.assign({},r.controllers.scatter.prototype.dataElementOptions,O),it.id="scatterWithErrorBars",it.register=function(){return it.prototype.dataElementType=w.register(),r.controllers[it.id]=it,r.defaults.set(it.id,r.helpers.merge({},[r.defaults.scatter,at,H])),it};var ut={tooltips:{callbacks:{label:function(t,e){var n=r.defaults.polarArea.tooltips.callbacks.label.call(this,t,e),o=e.datasets[t.datasetIndex].data[t.index],a=["rMin","rMax"];return null==o||a.every(function(t){return null==o[t]})?n:"".concat(n," [").concat(L(o[a[0]])," .. ").concat(o[a[1]],"]")}}}},lt=function(t){f(i,t);var o=ct(i);function i(){return n(this,i),o.apply(this,arguments)}return a(i,[{key:"getMinMax",value:function(t,r){var e=this;return K(t,r,function(t,r){return l(c(i.prototype),"getMinMax",e).call(e,t,r)})}},{key:"countVisibleElements",value:function(){var t=this,r=this._cachedMeta;return r.data.reduce(function(e,n,o){return!Number.isNaN(r._parsed[o].r)&&t.chart.getDataVisibility(o)?e+1:e},0)}},{key:"_computeAngle",value:function(t){var e=this._cachedMeta,n=e.count;if(Number.isNaN(e._parsed[t].r)||!this.chart.getDataVisibility(t))return 0;var o=this._getContext(t,!0);return r.helpers.options.resolve([this.chart.options.elements.arc.angle,2*Math.PI/n],o,t)}},{key:"parseObjectData",value:function(t,r,n,o){for(var a=new Array(o),i=0;i<o;++i){var c=i+n,u=r[c],l=t.rScale.parseObject(u,"r",c);a[i]=e({},t.rScale.axis,l)}return X(a,t.rScale,r,n,o),a}},{key:"updateElement",value:function(t,r,e,n){!function(t,r,e,n,o,a){for(var i=a.animation,c=function(r){var e=n.getDistanceFromCenterForValue(r),a=i.animateScale?0:e;return o?a:t.hidden?0:e},u=0,l=["".concat(n.axis,"Min"),"".concat(n.axis,"Max")];u<l.length;u++){var s=l[u],f=e[s];Array.isArray(f)?r[s]=f.map(c):"number"==typeof f&&(r[s]=c(f))}}(t,e,this.getParsed(r),this._cachedMeta.rScale,"reset"===n,this.chart.options),l(c(i.prototype),"updateElement",this).call(this,t,r,e,n)}},{key:"updateElements",value:function(t,r,e){var n=this.chart.scales.r,o=n.getDistanceFromCenterForValue;n.getDistanceFromCenterForValue=function(t){return"number"==typeof t?o.call(this,t):o.call(this,t.r)},l(c(i.prototype),"updateElements",this).call(this,t,r,e),n.getDistanceFromCenterForValue=o}}]),i}(r.controllers.polarArea);lt.prototype.dataElementOptions=Object.assign({},r.controllers.polarArea.prototype.dataElementOptions,O),lt.id="polarAreaWithErrorBars",lt.register=function(){return lt.prototype.dataElementType=F.register(),r.controllers[lt.id]=lt,r.defaults.set(lt.id,r.helpers.merge({},[r.defaults.polarArea,ut,H])),lt},tt.register(),rt.register(),nt.register(),lt.register(),it.register(),t.ArcWithErrorBar=F,t.BarWithErrorBars=tt,t.HorizontalBarWithErrorBars=rt,t.LineWithErrorBars=nt,t.PointWithErrorBar=w,t.PolarAreaWithErrorBars=lt,t.RectangleWithErrorBar=_,t.ScatterWithErrorBars=it,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("chart.js")):"function"==typeof define&&define.amd?define(["exports","chart.js"],r):r((t=t||self).ChartErrorBars={},t.Chart)}(this,function(t,r){"use strict";r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;var e=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")};function n(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=function(t,r,e){return r&&n(t.prototype,r),e&&n(t,e),t};function o(t,r){return t(r={exports:{}},r.exports),r.exports}var i=o(function(t){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r});var c=function(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=i(t)););return t},u=o(function(t){function r(e,n,a){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=r=Reflect.get:t.exports=r=function(t,r,e){var n=c(t,r);if(n){var a=Object.getOwnPropertyDescriptor(n,r);return a.get?a.get.call(e):a.value}},r(e,n,a||e)}t.exports=r}),l=o(function(t){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},r(e,n)}t.exports=r});var s=function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),r&&l(t,r)},f=o(function(t){function r(e){"@babel/helpers - typeof";return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(t){return typeof t}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(e)}t.exports=r});var p=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var h=function(t,r){return!r||"object"!==f(r)&&"function"!=typeof r?p(t):r};var y=function(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t},v=r,d=r.defaults,m=r.controllers.bar,g=r.controllers.horizontalBar,b=r.controllers.line,x=r.controllers.polarArea,M=r.controllers.scatter;function E(t){return r.controllers[t.id]=t,r.defaults.set(t.id,t.defaults),t}var k=r.elements.Rectangle,S=r.elements.Point,B=r.elements.Arc;function O(t){return r.defaults.set("elements",y({},t.id,t.defaults)),t}var W=r.helpers.merge,A=r.helpers.options.resolve,R=r.helpers.color;function P(t,r){return r.register(),t.type=r.id,t}var j=function(t){if(Array.isArray(t))return t};var D=function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,a=!1,o=void 0;try{for(var i,c=t[Symbol.iterator]();!(n=(i=c.next()).done)&&(e.push(i.value),!r||e.length!==r);n=!0);}catch(t){a=!0,o=t}finally{try{n||null==c.return||c.return()}finally{if(a)throw o}}return e}};var C=function(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n};var w=function(t,r){if(t){if("string"==typeof t)return C(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?C(t,r):void 0}};var T=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var _=function(t,r){return j(t)||D(t,r)||w(t,r)||T()},L=["xMin","xMax","yMin","yMax"];function F(t){return t?L.slice(0,2):L.slice(2)}function I(t,r,e,n){for(var a=["".concat(e.axis,"Min"),"".concat(e.axis,"Max")],o=e.getBasePixel(),i=0,c=a;i<c.length;i++){var u=c[i],l=r[u];Array.isArray(l)?t[u]=l.map(function(t){return n?o:e.getPixelForValue(t)}):"number"==typeof l&&(t[u]=n?o:e.getPixelForValue(l))}}var V={errorBarLineWidth:{v:[1,3]},errorBarColor:{v:["#2c2c2c","#1f1f1f"]},errorBarWhiskerLineWidth:{v:[1,3]},errorBarWhiskerRatio:{v:[.2,.25]},errorBarWhiskerSize:{v:[20,24]},errorBarWhiskerColor:{v:["#2c2c2c","#1f1f1f"]}},z=Object.keys(V),N={};function q(t,r){var e=Array.isArray(t)?t:[t],n=Array.isArray(r)?r:[r];if(e.length===n.length)return e.map(function(t,r){return[t,n[r]]});var a=Math.max(e.length,n.length);return Array(a).map(function(t,r){return[e[r%e.length],n[r%n.length]]})}function H(t,r){if("string"==typeof t||"number"==typeof t)return t;var e=Array.isArray(t)?t:t.v;return e[r%e.length]}function U(t,r,e){var n=H(r.errorBarWhiskerRatio,e);return null!=t&&n>0?t*n*.5:.5*H(r.errorBarWhiskerSize,e)}function $(t,r){var e=t.getProps(["x","y","width","height"].concat(L));null==e.xMin&&null==e.xMax||function(t,r,e,n,a){a.save(),a.translate(0,t.y),null==r&&(r=t.x),null==e&&(e=t.x);var o=q(r,e);o.reverse().forEach(function(r,e){var i=_(r,2),c=i[0],u=i[1],l=o.length-e-1,s=U(t.height,n,l);a.lineWidth=H(n.errorBarLineWidth,l),a.strokeStyle=H(n.errorBarColor,l),a.beginPath(),a.moveTo(c,0),a.lineTo(u,0),a.stroke(),a.lineWidth=H(n.errorBarWhiskerLineWidth,l),a.strokeStyle=H(n.errorBarWhiskerColor,l),a.beginPath(),a.moveTo(c,-s),a.lineTo(c,s),a.moveTo(u,-s),a.lineTo(u,s),a.stroke()}),a.restore()}(e,e.xMin,e.xMax,t.options,r),null==e.yMin&&null==e.yMax||function(t,r,e,n,a){a.save(),a.translate(t.x,0),null==r&&(r=t.y),null==e&&(e=t.y);var o=q(r,e);o.reverse().forEach(function(r,e){var i=_(r,2),c=i[0],u=i[1],l=o.length-e-1,s=U(t.width,n,l);a.lineWidth=H(n.errorBarLineWidth,l),a.strokeStyle=H(n.errorBarColor,l),a.beginPath(),a.moveTo(0,c),a.lineTo(0,u),a.stroke(),a.lineWidth=H(n.errorBarWhiskerLineWidth,l),a.strokeStyle=H(n.errorBarWhiskerColor,l),a.beginPath(),a.moveTo(-s,c),a.lineTo(s,c),a.moveTo(-s,u),a.lineTo(s,u),a.stroke()}),a.restore()}(e,e.yMin,e.yMax,t.options,r)}function G(t,r){var e=t.getProps(["x","y","startAngle","endAngle","rMin","rMax","outerRadius"]);null==e.rMin&&null==e.rMax||function(t,r,e,n,a){a.save(),a.translate(t.x,t.y),null==r&&(r=t.outerRadius),null==e&&(e=t.outerRadius);var o=(t.startAngle+t.endAngle)/2,i=Math.cos(o),c=Math.sin(o),u={x:-c,y:i},l=Math.sqrt(u.x*u.x+u.y*u.y);u.x/=l,u.y/=l;var s=q(r,e);s.reverse().forEach(function(t,r){var e=_(t,2),o=e[0],l=e[1],f=s.length-r-1,p=o*i,h=o*c,y=l*i,v=l*c,d=U(null,n,f),m=u.x*d,g=u.y*d;a.lineWidth=H(n.errorBarLineWidth,f),a.strokeStyle=H(n.errorBarColor,f),a.beginPath(),a.moveTo(p,h),a.lineTo(y,v),a.stroke(),a.lineWidth=H(n.errorBarWhiskerLineWidth,f),a.strokeStyle=H(n.errorBarWhiskerColor,f),a.beginPath(),a.moveTo(p+m,h+g),a.lineTo(p-m,h-g),a.moveTo(y+m,v+g),a.lineTo(y-m,v-g),a.stroke()}),a.restore()}(e,e.rMin,e.rMax,t.options,r)}function J(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=i(t);if(r){var a=i(this).constructor;e=Reflect.construct(n,arguments,a)}else e=n.apply(this,arguments);return h(this,e)}}z.forEach(function(t){return N[t]=t});var K=function(t){s(n,k);var r=J(n);function n(){return e(this,n),r.apply(this,arguments)}return a(n,[{key:"draw",value:function(t){u(i(n.prototype),"draw",this).call(this,t),$(this,t)}}]),n}();function Q(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=i(t);if(r){var a=i(this).constructor;e=Reflect.construct(n,arguments,a)}else e=n.apply(this,arguments);return h(this,e)}}K.id=K._type="rectangleWithErrorBar",K.defaults=Object.assign({},d.elements.rectangle,V),K.register=function(){return O(K)};var X=function(t){s(n,S);var r=Q(n);function n(){return e(this,n),r.apply(this,arguments)}return a(n,[{key:"draw",value:function(t){u(i(n.prototype),"draw",this).call(this,t),$(this,t)}}]),n}();function Y(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=i(t);if(r){var a=i(this).constructor;e=Reflect.construct(n,arguments,a)}else e=n.apply(this,arguments);return h(this,e)}}X.id=X._type="pointWithErrorBar",X.defaults=Object.assign({},d.elements.point,V),X.register=function(){return O(X)};var Z=function(t){s(n,B);var r=Y(n);function n(){return e(this,n),r.apply(this,arguments)}return a(n,[{key:"draw",value:function(t){u(i(n.prototype),"draw",this).call(this,t),G(this,t)}}]),n}();function tt(t){return Array.isArray(t)?t.slice().reverse():t}function rt(t){var r=this,e=F(t);return function(t,n){var a=d.tooltips.callbacks.label.call(r,t,n),o=n.datasets[t.datasetIndex].data[t.index];return null==o||e.every(function(t){return null==o[t]})?a:"".concat(a," (").concat(tt(o[e[0]])," .. ").concat(o[e[1]],")")}}Z.id=Z._type="arcWithErrorBar",Z.defaults=Object.assign({},d.elements.arc,V),Z.register=function(){return O(Z)};var et={tooltips:{callbacks:{label:rt(!1)}}},nt={tooltips:{callbacks:{label:rt(!0)}}};var at={color:function(t,r,e){var n=t||transparent,a=r||transparent;if(n===a)return r;var o=R(n),i=o.valid&&R(a);return i&&i.valid?i.mix(o,e).hexString():r},number:function(t,r,e){return t===r?r:t+(r-t)*e}};function ot(t,r,e,n,a){return f(t)===n&&f(r)===n?a(t,r,e):Array.isArray(t)&&Array.isArray(r)?t.map(function(t,n){return a(t,r[n],e)}):t&&Array.isArray(t.v)&&r&&Array.isArray(r.v)?t.v.map(function(t,n){return a(t,r.v[n],e)}):r}var it={datasets:{animation:{numberArray:{fn:function(t,r,e){return ot(t,r,e,"number",at.number)},properties:L.concat(z.filter(function(t){return!t.endsWith("Color")}),["rMin","rMax"])},colorArray:{fn:function(t,r,e){return ot(t,r,e,"string",at.color)},properties:L.concat(z.filter(function(t){return t.endsWith("Color")}))}}}};var ct=function(t){if(Array.isArray(t))return C(t)};var ut=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)};var lt=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var st=function(t){return ct(t)||ut(t)||w(t)||lt()};function ft(t,r,e){var n=t.axis;t.axis="".concat(n,"MinMin");var a=e(t,r).min;t.axis="".concat(n,"MaxMax");var o=e(t,r).max;return t.axis=n,{min:a,max:o}}function pt(t,r,e){return Array.isArray(r)?e.apply(void 0,st(r)):"number"==typeof r?r:t}function ht(t,r,e,n,a){for(var o="string"==typeof r?r:r.axis,i="".concat(o,"Min"),c="".concat(o,"Max"),u="".concat(o,"MinMin"),l="".concat(o,"MaxMax"),s=0;s<a;s++){var f=s+n,p=t[s];p[i]=e[f][i],p[c]=e[f][c],p[u]=pt(p[o],p[i],Math.min),p[l]=pt(p[o],p[c],Math.max)}}function yt(t,r,e,n){for(var a=r.axis,o=r.getLabels(),i=0;i<n;i++){var c=i+e;t[i][a]=r.parse(o[c],c)}}function vt(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=i(t);if(r){var a=i(this).constructor;e=Reflect.construct(n,arguments,a)}else e=n.apply(this,arguments);return h(this,e)}}var dt=function(t){s(n,m);var r=vt(n);function n(){return e(this,n),r.apply(this,arguments)}return a(n,[{key:"getMinMax",value:function(t,r){var e=this;return ft(t,r,function(t,r){return u(i(n.prototype),"getMinMax",e).call(e,t,r)})}},{key:"parseObjectData",value:function(t,r,e,a){var o=u(i(n.prototype),"parseObjectData",this).call(this,t,r,e,a);return ht(o,t.vScale,r,e,a),yt(o,t.iScale,e,a),o}},{key:"updateElement",value:function(t,r,e,a){I(e,this.getParsed(r),this._cachedMeta.vScale,"reset"===a),u(i(n.prototype),"updateElement",this).call(this,t,r,e,a)}}]),n}();dt.prototype.dataElementOptions=m.prototype.dataElementOptions.concat(z),dt.id="barWithErrorBars",dt.register=function(){return dt.prototype.dataElementType=K.register(),dt.defaults=W({},[d.bar,et,it]),E(dt)};var mt=function(t){s(n,v);var r=vt(n);function n(t,a){return e(this,n),r.call(this,t,P(a,dt))}return n}();mt.id=dt.id;var gt=function(t){s(n,g);var r=vt(n);function n(){return e(this,n),r.apply(this,arguments)}return a(n,[{key:"getMinMax",value:function(t,r){var e=this;return ft(t,r,function(t,r){return u(i(n.prototype),"getMinMax",e).call(e,t,r)})}},{key:"parseObjectData",value:function(t,r,e,a){var o=u(i(n.prototype),"parseObjectData",this).call(this,t,r,e,a);return ht(o,t.vScale,r,e,a),yt(o,t.iScale,e,a),o}},{key:"updateElement",value:function(t,r,e,a){I(e,this.getParsed(r),this._cachedMeta.vScale,"reset"===a),u(i(n.prototype),"updateElement",this).call(this,t,r,e,a)}}]),n}();gt.prototype.dataElementOptions=g.prototype.dataElementOptions.concat(z),gt.id="horizontalBarWithErrorBars",gt.register=function(){return gt.prototype.dataElementType=K.register(),gt.defaults=W({},[d.horizontalBar,nt,it]),E(gt)};var bt=function(t){s(n,v);var r=vt(n);function n(t,a){return e(this,n),r.call(this,t,P(a,gt))}return n}();function xt(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=i(t);if(r){var a=i(this).constructor;e=Reflect.construct(n,arguments,a)}else e=n.apply(this,arguments);return h(this,e)}}bt.id=gt.id;var Mt=function(t){s(n,b);var r=xt(n);function n(){return e(this,n),r.apply(this,arguments)}return a(n,[{key:"getMinMax",value:function(t,r){var e=this;return ft(t,r,function(t,r){return u(i(n.prototype),"getMinMax",e).call(e,t,r)})}},{key:"parseObjectData",value:function(t,r,e,a){var o=u(i(n.prototype),"parseObjectData",this).call(this,t,r,e,a);return ht(o,t.vScale,r,e,a),yt(o,t.iScale,e,a),o}},{key:"updateElement",value:function(t,r,e,a){t instanceof X&&I(e,this.getParsed(r),this._cachedMeta.vScale,"reset"===a),u(i(n.prototype),"updateElement",this).call(this,t,r,e,a)}}]),n}();Mt.prototype.dataElementOptions=Object.assign({},b.prototype.dataElementOptions,N),Mt.id="lineWithErrorBars",Mt.register=function(){return Mt.prototype.dataElementType=X.register(),Mt.defaults=W({},[d.line,et,it]),E(Mt)};var Et=function(t){s(n,v);var r=xt(n);function n(t,a){return e(this,n),r.call(this,t,P(a,Mt))}return n}();function kt(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=i(t);if(r){var a=i(this).constructor;e=Reflect.construct(n,arguments,a)}else e=n.apply(this,arguments);return h(this,e)}}Et.id=Mt.id;var St={tooltips:{callbacks:{label:function(t,r){var e=r.datasets[t.datasetIndex].data[t.index],n=function(t,r){var n=F(r);return null==e||n.every(function(t){return null==e[t]})?t:"".concat(t," [").concat(tt(e[n[0]])," .. ").concat(e[n[1]],"]")};return"(".concat(n(t.label,!0),", ").concat(n(t.value,!1),")")}}}},Bt=function(t){s(n,M);var r=kt(n);function n(){return e(this,n),r.apply(this,arguments)}return a(n,[{key:"getMinMax",value:function(t,r){var e=this;return ft(t,r,function(t,r){return u(i(n.prototype),"getMinMax",e).call(e,t,r)})}},{key:"parseObjectData",value:function(t,r,e,a){var o=u(i(n.prototype),"parseObjectData",this).call(this,t,r,e,a);return ht(o,t.xScale,r,e,a),ht(o,t.yScale,r,e,a),o}},{key:"updateElement",value:function(t,r,e,a){t instanceof X&&(I(e,this.getParsed(r),this._cachedMeta.xScale,"reset"===a),I(e,this.getParsed(r),this._cachedMeta.yScale,"reset"===a)),u(i(n.prototype),"updateElement",this).call(this,t,r,e,a)}}]),n}();Bt.prototype.dataElementOptions=Object.assign({},M.prototype.dataElementOptions,N),Bt.id="scatterWithErrorBars",Bt.register=function(){return Bt.prototype.dataElementType=X.register(),Bt.defaults=W({},[d.scatter,St,it]),E(Bt)};var Ot=function(t){s(n,v);var r=kt(n);function n(t,a){return e(this,n),r.call(this,t,P(a,Bt))}return n}();function Wt(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var e,n=i(t);if(r){var a=i(this).constructor;e=Reflect.construct(n,arguments,a)}else e=n.apply(this,arguments);return h(this,e)}}Ot.id=Bt.id;var At={tooltips:{callbacks:{label:function(t,r){var e=d.polarArea.tooltips.callbacks.label.call(this,t,r),n=r.datasets[t.datasetIndex].data[t.index],a=["rMin","rMax"];return null==n||a.every(function(t){return null==n[t]})?e:"".concat(e," [").concat(tt(n[a[0]])," .. ").concat(n[a[1]],"]")}}}},Rt=function(t){s(n,x);var r=Wt(n);function n(){return e(this,n),r.apply(this,arguments)}return a(n,[{key:"getMinMax",value:function(t,r){var e=this;return ft(t,r,function(t,r){return u(i(n.prototype),"getMinMax",e).call(e,t,r)})}},{key:"countVisibleElements",value:function(){var t=this,r=this._cachedMeta;return r.data.reduce(function(e,n,a){return!Number.isNaN(r._parsed[a].r)&&t.chart.getDataVisibility(a)?e+1:e},0)}},{key:"_computeAngle",value:function(t){var r=this._cachedMeta,e=r.count;if(Number.isNaN(r._parsed[t].r)||!this.chart.getDataVisibility(t))return 0;var n=this._getContext(t,!0);return A([this.chart.options.elements.arc.angle,2*Math.PI/e],n,t)}},{key:"parseObjectData",value:function(t,r,e,n){for(var a=new Array(n),o=0;o<n;++o){var i=o+e,c=r[i],u=t.rScale.parseObject(c,"r",i);a[o]=y({},t.rScale.axis,u)}return ht(a,t.rScale,r,e,n),a}},{key:"updateElement",value:function(t,r,e,a){!function(t,r,e,n,a,o){for(var i=o.animation,c=function(t){var r=n.getDistanceFromCenterForValue(t),e=i.animateScale?0:r;return a?e:r},u=0,l=["".concat(n.axis,"Min"),"".concat(n.axis,"Max")];u<l.length;u++){var s=l[u],f=e[s];Array.isArray(f)?r[s]=f.map(c):"number"==typeof f&&(r[s]=c(f))}}(0,e,this.getParsed(r),this._cachedMeta.rScale,"reset"===a,this.chart.options),u(i(n.prototype),"updateElement",this).call(this,t,r,e,a)}},{key:"updateElements",value:function(t,r,e){var a=this.chart.scales.r,o=a.getDistanceFromCenterForValue;a.getDistanceFromCenterForValue=function(t){return"number"==typeof t?o.call(this,t):o.call(this,t.r)},u(i(n.prototype),"updateElements",this).call(this,t,r,e),a.getDistanceFromCenterForValue=o}}]),n}();Rt.prototype.dataElementOptions=Object.assign({},x.prototype.dataElementOptions,N),Rt.id="polarAreaWithErrorBars",Rt.register=function(){return Rt.prototype.dataElementType=Z.register(),Rt.defaults=W({},[d.polarArea,At,it]),E(Rt)};var Pt=function(t){s(n,v);var r=Wt(n);function n(t,a){return e(this,n),r.call(this,t,P(a,Rt))}return n}();Pt.id=Rt.id,dt.register(),gt.register(),Mt.register(),Rt.register(),Bt.register(),t.ArcWithErrorBar=Z,t.BarWithErrorBarsChart=mt,t.BarWithErrorBarsController=dt,t.HorizontalBarWithErrorBarsChart=bt,t.HorizontalBarWithErrorBarsController=gt,t.LineWithErrorBarsChart=Et,t.LineWithErrorBarsController=Mt,t.PointWithErrorBar=X,t.PolarAreaWithErrorBarsChart=Pt,t.PolarAreaWithErrorBarsController=Rt,t.RectangleWithErrorBar=K,t.ScatterWithErrorBarsChart=Ot,t.ScatterWithErrorBarsController=Bt,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "chartjs-chart-error-bars", | ||
"description": "Chart.js module for charting error bars", | ||
"version": "3.0.0-alpha.1", | ||
"version": "3.0.0-alpha.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Samuel Gratzl", |
@@ -40,7 +40,7 @@ # Chart.js Error Bars | ||
and [![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/QWjjVgY) | ||
and [![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/ZEbqmqx) | ||
## Styling | ||
Several new styling keys are added to the indiviual chart types | ||
Several new styling keys are added to the individual chart types | ||
@@ -92,3 +92,3 @@ ```typescript | ||
### Chart types: `bar`, `line`, `scatter`` | ||
### Chart types: `bar` and `line` | ||
@@ -250,13 +250,15 @@ ```typescript | ||
The ESM build of the library supports three shaking but having no side effects. As a consequence the chart.js library won't be automatically manipulated nor new controllers automatically registered. One has to manually import and register them. | ||
The ESM build of the library supports tree shaking thus having no side effects. As a consequence the chart.js library won't be automatically manipulated nor new controllers automatically registered. One has to manually import and register them. | ||
Variant A: | ||
```js | ||
import Chart from 'chart.js'; | ||
import { BarWithErrorBars } from 'chartjs-chart-error-bars'; | ||
import { BarWithErrorBarsController } from 'chartjs-chart-error-bars'; | ||
// register controller in chart.js and ensure the defaults are set | ||
BarWithErrorBars.register(); | ||
BarWithErrorBarsController.register(); | ||
const chart = new Chart(document.getElementById('canvas').getContext('2d'), { | ||
type: BarWithErrorBars.id, | ||
type: BarWithErrorBarsController.id, | ||
data: { | ||
@@ -284,2 +286,14 @@ labels: ['A', 'B'], | ||
Variant B: | ||
```js | ||
import { BarWithErrorBarsChart } from 'chartjs-chart-error-bars'; | ||
const chart = new BarWithErrorBarsChart(document.getElementById('canvas').getContext('2d'), { | ||
data: { | ||
//... | ||
}, | ||
}); | ||
``` | ||
## Development Environment | ||
@@ -286,0 +300,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { helpers } from 'chart.js'; | ||
import { color } from './chart'; | ||
import { styleKeys } from './elements/render'; | ||
@@ -12,4 +12,4 @@ import { allModelKeys } from './controllers/utils'; | ||
} | ||
var c0 = helpers.color(f); | ||
var c1 = c0.valid && helpers.color(t); | ||
var c0 = color(f); | ||
var c1 = c0.valid && color(t); | ||
return c1 && c1.valid ? c1.mix(c0, factor).hexString() : to; | ||
@@ -16,0 +16,0 @@ }, |
export * from '.'; | ||
import { | ||
BarWithErrorBars, | ||
HorizontalBarWithErrorBars, | ||
LineWithErrorBars, | ||
PolarAreaWithErrorBars, | ||
ScatterWithErrorBars, | ||
BarWithErrorBarsController, | ||
HorizontalBarWithErrorBarsController, | ||
LineWithErrorBarsController, | ||
PolarAreaWithErrorBarsController, | ||
ScatterWithErrorBarsController, | ||
} from './controllers'; | ||
BarWithErrorBars.register(); | ||
HorizontalBarWithErrorBars.register(); | ||
LineWithErrorBars.register(); | ||
PolarAreaWithErrorBars.register(); | ||
ScatterWithErrorBars.register(); | ||
BarWithErrorBarsController.register(); | ||
HorizontalBarWithErrorBarsController.register(); | ||
LineWithErrorBarsController.register(); | ||
PolarAreaWithErrorBarsController.register(); | ||
ScatterWithErrorBarsController.register(); |
@@ -1,2 +0,10 @@ | ||
import { controllers, helpers, defaults } from 'chart.js'; | ||
import { | ||
Chart, | ||
registerController, | ||
BarController, | ||
HorizontalBarController, | ||
defaults, | ||
merge, | ||
patchControllerConfig, | ||
} from '../chart'; | ||
import { calculateScale } from './utils'; | ||
@@ -9,3 +17,3 @@ import { styleKeys } from '../elements/render'; | ||
export class BarWithErrorBars extends controllers.bar { | ||
export class BarWithErrorBarsController extends BarController { | ||
getMinMax(scale, canStack) { | ||
@@ -28,13 +36,19 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
} | ||
BarWithErrorBars.prototype.dataElementOptions = controllers.bar.prototype.dataElementOptions.concat(styleKeys); | ||
BarWithErrorBarsController.prototype.dataElementOptions = BarController.prototype.dataElementOptions.concat(styleKeys); | ||
BarWithErrorBars.id = 'barWithErrorBars'; | ||
BarWithErrorBars.register = () => { | ||
BarWithErrorBars.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
controllers[BarWithErrorBars.id] = BarWithErrorBars; | ||
defaults.set(BarWithErrorBars.id, helpers.merge({}, [defaults.bar, verticalTooltipDefaults, animationHints])); | ||
return BarWithErrorBars; | ||
BarWithErrorBarsController.id = 'barWithErrorBars'; | ||
BarWithErrorBarsController.register = () => { | ||
BarWithErrorBarsController.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
BarWithErrorBarsController.defaults = merge({}, [defaults.bar, verticalTooltipDefaults, animationHints]); | ||
return registerController(BarWithErrorBarsController); | ||
}; | ||
export class HorizontalBarWithErrorBars extends controllers.horizontalBar { | ||
export class BarWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, BarWithErrorBarsController)); | ||
} | ||
} | ||
BarWithErrorBarsChart.id = BarWithErrorBarsController.id; | ||
export class HorizontalBarWithErrorBarsController extends HorizontalBarController { | ||
getMinMax(scale, canStack) { | ||
@@ -58,15 +72,21 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
HorizontalBarWithErrorBars.prototype.dataElementOptions = controllers.horizontalBar.prototype.dataElementOptions.concat( | ||
HorizontalBarWithErrorBarsController.prototype.dataElementOptions = HorizontalBarController.prototype.dataElementOptions.concat( | ||
styleKeys | ||
); | ||
HorizontalBarWithErrorBars.id = 'horizontalBarWithErrorBars'; | ||
HorizontalBarWithErrorBars.register = () => { | ||
HorizontalBarWithErrorBars.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
HorizontalBarWithErrorBarsController.id = 'horizontalBarWithErrorBars'; | ||
HorizontalBarWithErrorBarsController.register = () => { | ||
HorizontalBarWithErrorBarsController.prototype.dataElementType = RectangleWithErrorBar.register(); | ||
HorizontalBarWithErrorBarsController.defaults = merge({}, [ | ||
defaults.horizontalBar, | ||
horizontalTooltipDefaults, | ||
animationHints, | ||
]); | ||
return registerController(HorizontalBarWithErrorBarsController); | ||
}; | ||
controllers[HorizontalBarWithErrorBars.id] = HorizontalBarWithErrorBars; | ||
defaults.set( | ||
HorizontalBarWithErrorBars.id, | ||
helpers.merge({}, [defaults.horizontalBar, horizontalTooltipDefaults, animationHints]) | ||
); | ||
return HorizontalBarWithErrorBars; | ||
}; | ||
export class HorizontalBarWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, HorizontalBarWithErrorBarsController)); | ||
} | ||
} | ||
HorizontalBarWithErrorBarsChart.id = HorizontalBarWithErrorBarsController.id; |
@@ -1,2 +0,2 @@ | ||
import { controllers, helpers, defaults } from 'chart.js'; | ||
import { Chart, registerController, LineController, defaults, merge, patchControllerConfig } from '../chart'; | ||
import { calculateScale } from './utils'; | ||
@@ -9,3 +9,3 @@ import { styleObjectKeys } from '../elements/render'; | ||
export class LineWithErrorBars extends controllers.line { | ||
export class LineWithErrorBarsController extends LineController { | ||
getMinMax(scale, canStack) { | ||
@@ -31,14 +31,20 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
LineWithErrorBars.prototype.dataElementOptions = Object.assign( | ||
LineWithErrorBarsController.prototype.dataElementOptions = Object.assign( | ||
{}, | ||
controllers.line.prototype.dataElementOptions, | ||
LineController.prototype.dataElementOptions, | ||
styleObjectKeys | ||
); | ||
LineWithErrorBars.id = 'lineWithErrorBars'; | ||
LineWithErrorBars.register = () => { | ||
LineWithErrorBars.prototype.dataElementType = PointWithErrorBar.register(); | ||
controllers[LineWithErrorBars.id] = LineWithErrorBars; | ||
defaults.set(LineWithErrorBars.id, helpers.merge({}, [defaults.line, verticalTooltipDefaults, animationHints])); | ||
return LineWithErrorBars; | ||
LineWithErrorBarsController.id = 'lineWithErrorBars'; | ||
LineWithErrorBarsController.register = () => { | ||
LineWithErrorBarsController.prototype.dataElementType = PointWithErrorBar.register(); | ||
LineWithErrorBarsController.defaults = merge({}, [defaults.line, verticalTooltipDefaults, animationHints]); | ||
return registerController(LineWithErrorBarsController); | ||
}; | ||
export class LineWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, LineWithErrorBarsController)); | ||
} | ||
} | ||
LineWithErrorBarsChart.id = LineWithErrorBarsController.id; |
@@ -1,2 +0,10 @@ | ||
import { controllers, helpers, defaults } from 'chart.js'; | ||
import { | ||
Chart, | ||
registerController, | ||
PolarAreaController, | ||
defaults, | ||
merge, | ||
resolve, | ||
patchControllerConfig, | ||
} from '../chart'; | ||
import { calculatePolarScale } from './utils'; | ||
@@ -17,3 +25,3 @@ import { getMinMax, parseErrorNumberData } from './base'; | ||
export class PolarAreaWithErrorBars extends controllers.polarArea { | ||
export class PolarAreaWithErrorBarsController extends PolarAreaController { | ||
getMinMax(scale, canStack) { | ||
@@ -42,3 +50,3 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
const context = this._getContext(index, true); | ||
return helpers.options.resolve([this.chart.options.elements.arc.angle, (2 * Math.PI) / count], context, index); | ||
return resolve([this.chart.options.elements.arc.angle, (2 * Math.PI) / count], context, index); | ||
} | ||
@@ -86,14 +94,20 @@ | ||
PolarAreaWithErrorBars.prototype.dataElementOptions = Object.assign( | ||
PolarAreaWithErrorBarsController.prototype.dataElementOptions = Object.assign( | ||
{}, | ||
controllers.polarArea.prototype.dataElementOptions, | ||
PolarAreaController.prototype.dataElementOptions, | ||
styleObjectKeys | ||
); | ||
PolarAreaWithErrorBars.id = 'polarAreaWithErrorBars'; | ||
PolarAreaWithErrorBars.register = () => { | ||
PolarAreaWithErrorBars.prototype.dataElementType = ArcWithErrorBar.register(); | ||
controllers[PolarAreaWithErrorBars.id] = PolarAreaWithErrorBars; | ||
defaults.set(PolarAreaWithErrorBars.id, helpers.merge({}, [defaults.polarArea, tooltipDefaults, animationHints])); | ||
return PolarAreaWithErrorBars; | ||
PolarAreaWithErrorBarsController.id = 'polarAreaWithErrorBars'; | ||
PolarAreaWithErrorBarsController.register = () => { | ||
PolarAreaWithErrorBarsController.prototype.dataElementType = ArcWithErrorBar.register(); | ||
PolarAreaWithErrorBarsController.defaults = merge({}, [defaults.polarArea, tooltipDefaults, animationHints]); | ||
return registerController(PolarAreaWithErrorBarsController); | ||
}; | ||
export class PolarAreaWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, PolarAreaWithErrorBarsController)); | ||
} | ||
} | ||
PolarAreaWithErrorBarsChart.id = PolarAreaWithErrorBarsController.id; |
@@ -1,2 +0,2 @@ | ||
import { controllers, helpers, defaults } from 'chart.js'; | ||
import { Chart, registerController, ScatterController, defaults, merge, patchControllerConfig } from '../chart'; | ||
import { calculateScale } from './utils'; | ||
@@ -17,3 +17,3 @@ import { getMinMax, parseErrorNumberData } from './base'; | ||
export class ScatterWithErrorBars extends controllers.scatter { | ||
export class ScatterWithErrorBarsController extends ScatterController { | ||
getMinMax(scale, canStack) { | ||
@@ -39,14 +39,20 @@ return getMinMax(scale, canStack, (scale, canStack) => super.getMinMax(scale, canStack)); | ||
} | ||
ScatterWithErrorBars.prototype.dataElementOptions = Object.assign( | ||
ScatterWithErrorBarsController.prototype.dataElementOptions = Object.assign( | ||
{}, | ||
controllers.scatter.prototype.dataElementOptions, | ||
ScatterController.prototype.dataElementOptions, | ||
styleObjectKeys | ||
); | ||
ScatterWithErrorBars.id = 'scatterWithErrorBars'; | ||
ScatterWithErrorBars.register = () => { | ||
ScatterWithErrorBars.prototype.dataElementType = PointWithErrorBar.register(); | ||
controllers[ScatterWithErrorBars.id] = ScatterWithErrorBars; | ||
defaults.set(ScatterWithErrorBars.id, helpers.merge({}, [defaults.scatter, tooltipDefaults, animationHints])); | ||
return ScatterWithErrorBars; | ||
ScatterWithErrorBarsController.id = 'scatterWithErrorBars'; | ||
ScatterWithErrorBarsController.register = () => { | ||
ScatterWithErrorBarsController.prototype.dataElementType = PointWithErrorBar.register(); | ||
ScatterWithErrorBarsController.defaults = merge({}, [defaults.scatter, tooltipDefaults, animationHints]); | ||
return registerController(ScatterWithErrorBarsController); | ||
}; | ||
export class ScatterWithErrorBarsChart extends Chart { | ||
constructor(item, config) { | ||
super(item, patchControllerConfig(config, ScatterWithErrorBarsController)); | ||
} | ||
} | ||
ScatterWithErrorBarsChart.id = ScatterWithErrorBarsController.id; |
import { modelKeys } from './utils'; | ||
import { defaults } from 'chart.js'; | ||
import { defaults } from '../chart'; | ||
@@ -4,0 +4,0 @@ function reverseOrder(v) { |
@@ -28,3 +28,3 @@ export const allModelKeys = ['xMin', 'xMax', 'yMin', 'yMax']; | ||
const resetRadius = animationOpts.animateScale ? 0 : valueRadius; | ||
return reset ? resetRadius : arc.hidden ? 0 : valueRadius; | ||
return reset ? resetRadius : valueRadius; | ||
}; | ||
@@ -31,0 +31,0 @@ |
@@ -1,5 +0,5 @@ | ||
import { defaults, elements } from 'chart.js'; | ||
import { defaults, Arc, registerElement } from '../chart'; | ||
import { renderErrorBarArc, errorBarDefaults } from './render'; | ||
export class ArcWithErrorBar extends elements.Arc { | ||
export class ArcWithErrorBar extends Arc { | ||
draw(ctx) { | ||
@@ -11,8 +11,4 @@ super.draw(ctx); | ||
} | ||
ArcWithErrorBar._type = 'arcWithErrorBar'; | ||
ArcWithErrorBar.register = () => { | ||
defaults.set('elements', { | ||
[ArcWithErrorBar._type]: Object.assign({}, defaults.elements.arc, errorBarDefaults), | ||
}); | ||
return ArcWithErrorBar; | ||
}; | ||
ArcWithErrorBar.id = ArcWithErrorBar._type = 'arcWithErrorBar'; | ||
ArcWithErrorBar.defaults = Object.assign({}, defaults.elements.arc, errorBarDefaults); | ||
ArcWithErrorBar.register = () => registerElement(ArcWithErrorBar); |
@@ -1,5 +0,5 @@ | ||
import { defaults, elements } from 'chart.js'; | ||
import { defaults, Point, registerElement } from '../chart'; | ||
import { renderErrorBar, errorBarDefaults } from './render'; | ||
export class PointWithErrorBar extends elements.Point { | ||
export class PointWithErrorBar extends Point { | ||
draw(ctx) { | ||
@@ -11,8 +11,4 @@ super.draw(ctx); | ||
} | ||
PointWithErrorBar._type = 'pointWithErrorBar'; | ||
PointWithErrorBar.register = () => { | ||
defaults.set('elements', { | ||
[PointWithErrorBar._type]: Object.assign({}, defaults.elements.point, errorBarDefaults), | ||
}); | ||
return PointWithErrorBar; | ||
}; | ||
PointWithErrorBar.id = PointWithErrorBar._type = 'pointWithErrorBar'; | ||
PointWithErrorBar.defaults = Object.assign({}, defaults.elements.point, errorBarDefaults); | ||
PointWithErrorBar.register = () => registerElement(PointWithErrorBar); |
@@ -1,5 +0,5 @@ | ||
import { defaults, elements } from 'chart.js'; | ||
import { defaults, Rectangle, registerElement } from '../chart'; | ||
import { renderErrorBar, errorBarDefaults } from './render'; | ||
export class RectangleWithErrorBar extends elements.Rectangle { | ||
export class RectangleWithErrorBar extends Rectangle { | ||
draw(ctx) { | ||
@@ -11,8 +11,4 @@ super.draw(ctx); | ||
} | ||
RectangleWithErrorBar._type = 'rectangleWithErrorBar'; | ||
RectangleWithErrorBar.register = () => { | ||
defaults.set('elements', { | ||
[RectangleWithErrorBar._type]: Object.assign({}, defaults.elements.rectangle, errorBarDefaults), | ||
}); | ||
return RectangleWithErrorBar; | ||
}; | ||
RectangleWithErrorBar.id = RectangleWithErrorBar._type = 'rectangleWithErrorBar'; | ||
RectangleWithErrorBar.defaults = Object.assign({}, defaults.elements.rectangle, errorBarDefaults); | ||
RectangleWithErrorBar.register = () => registerElement(RectangleWithErrorBar); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
126010
23
2397
318
0