vue-apexcharts
Advanced tools
Comparing version 1.2.9 to 1.3.0
@@ -9,2 +9,31 @@ (function (global, factory) { | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
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 ApexChartsComponent = { | ||
@@ -77,2 +106,4 @@ props: { | ||
init: function init() { | ||
var _this2 = this; | ||
var newOptions = { | ||
@@ -82,10 +113,65 @@ chart: { | ||
height: this.height, | ||
width: this.width | ||
width: this.width, | ||
events: {} | ||
}, | ||
series: this.series | ||
}; | ||
var config = ApexCharts.merge(this.options, newOptions); | ||
Object.keys(this.$listeners).forEach(function (evt) { | ||
newOptions.chart.events[evt] = _this2.$listeners[evt]; | ||
}); | ||
var config = this.extend(this.options, newOptions); | ||
this.chart = new ApexCharts(this.$el, config); | ||
this.chart.render(); | ||
}, | ||
isObject: function isObject(item) { | ||
return item && _typeof(item) === 'object' && !Array.isArray(item) && item != null; | ||
}, | ||
extend: function extend(target, source) { | ||
var _this3 = this; | ||
if (typeof Object.assign !== 'function') { | ||
(function () { | ||
Object.assign = function (target) { | ||
// We must check against these specific cases. | ||
if (target === undefined || target === null) { | ||
throw new TypeError('Cannot convert undefined or null to object'); | ||
} | ||
var output = Object(target); | ||
for (var index = 1; index < arguments.length; index++) { | ||
var _source = arguments[index]; | ||
if (_source !== undefined && _source !== null) { | ||
for (var nextKey in _source) { | ||
if (_source.hasOwnProperty(nextKey)) { | ||
output[nextKey] = _source[nextKey]; | ||
} | ||
} | ||
} | ||
} | ||
return output; | ||
}; | ||
})(); | ||
} | ||
var output = Object.assign({}, target); | ||
if (this.isObject(target) && this.isObject(source)) { | ||
Object.keys(source).forEach(function (key) { | ||
if (_this3.isObject(source[key])) { | ||
if (!(key in target)) { | ||
Object.assign(output, _defineProperty({}, key, source[key])); | ||
} else { | ||
output[key] = _this3.extend(target[key], source[key]); | ||
} | ||
} else { | ||
Object.assign(output, _defineProperty({}, key, source[key])); | ||
} | ||
}); | ||
} | ||
return output; | ||
}, | ||
refresh: function refresh() { | ||
@@ -92,0 +178,0 @@ this.destroy(); |
{ | ||
"name": "vue-apexcharts", | ||
"version": "1.2.9", | ||
"version": "1.3.0", | ||
"description": "Vue.js wrapper for ApexCharts", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-apexcharts.js", |
@@ -24,3 +24,3 @@ import ApexCharts from 'apexcharts' | ||
}, | ||
data() { | ||
data () { | ||
return { | ||
@@ -30,3 +30,3 @@ chart: null | ||
}, | ||
mounted() { | ||
mounted () { | ||
this.init() | ||
@@ -39,3 +39,3 @@ }, | ||
} else { | ||
this.chart.updateOptions(this.options); | ||
this.chart.updateOptions(this.options) | ||
} | ||
@@ -48,3 +48,3 @@ }) | ||
} else { | ||
this.chart.updateSeries(this.series); | ||
this.chart.updateSeries(this.series) | ||
} | ||
@@ -60,3 +60,3 @@ }, { deep: true }) | ||
}, | ||
beforeDestroy() { | ||
beforeDestroy () { | ||
if (!this.chart) { | ||
@@ -67,7 +67,7 @@ return | ||
}, | ||
render(createElement) { | ||
return createElement('div'); | ||
}, | ||
render (createElement) { | ||
return createElement('div') | ||
}, | ||
methods: { | ||
init() { | ||
init () { | ||
const newOptions = { | ||
@@ -77,3 +77,4 @@ chart: { | ||
height: this.height, | ||
width: this.width | ||
width: this.width, | ||
events: {} | ||
}, | ||
@@ -83,44 +84,98 @@ series: this.series | ||
const config = ApexCharts.merge(this.options, newOptions); | ||
Object.keys(this.$listeners).forEach((evt) => { | ||
newOptions.chart.events[evt] = this.$listeners[evt]; | ||
}); | ||
const config = this.extend(this.options, newOptions); | ||
this.chart = new ApexCharts(this.$el, config) | ||
this.chart.render() | ||
}, | ||
refresh() { | ||
isObject(item) { | ||
return ( | ||
item && typeof item === 'object' && !Array.isArray(item) && item != null | ||
) | ||
}, | ||
extend(target, source) { | ||
if (typeof Object.assign !== 'function') { | ||
(function() { | ||
Object.assign = function(target) { | ||
// We must check against these specific cases. | ||
if (target === undefined || target === null) { | ||
throw new TypeError('Cannot convert undefined or null to object') | ||
} | ||
let output = Object(target) | ||
for (let index = 1; index < arguments.length; index++) { | ||
let source = arguments[index] | ||
if (source !== undefined && source !== null) { | ||
for (let nextKey in source) { | ||
if (source.hasOwnProperty(nextKey)) { | ||
output[nextKey] = source[nextKey] | ||
} | ||
} | ||
} | ||
} | ||
return output | ||
} | ||
})() | ||
} | ||
let output = Object.assign({}, target) | ||
if (this.isObject(target) && this.isObject(source)) { | ||
Object.keys(source).forEach((key) => { | ||
if (this.isObject(source[key])) { | ||
if (!(key in target)) { | ||
Object.assign(output, { | ||
[key]: source[key] | ||
}) | ||
} else { | ||
output[key] = this.extend(target[key], source[key]) | ||
} | ||
} else { | ||
Object.assign(output, { | ||
[key]: source[key] | ||
}) | ||
} | ||
}) | ||
} | ||
return output | ||
}, | ||
refresh () { | ||
this.destroy() | ||
this.init() | ||
}, | ||
destroy() { | ||
destroy () { | ||
this.chart.destroy() | ||
}, | ||
updateSeries(newSeries, animate) { | ||
updateSeries (newSeries, animate) { | ||
this.chart.updateSeries(newSeries, animate) | ||
}, | ||
updateOptions(newOptions, redrawPaths, animate) { | ||
updateOptions (newOptions, redrawPaths, animate) { | ||
this.chart.updateOptions(newOptions, redrawPaths, animate) | ||
}, | ||
toggleSeries(seriesName) { | ||
toggleSeries (seriesName) { | ||
this.chart.toggleSeries(seriesName) | ||
}, | ||
appendData(newData) { | ||
appendData (newData) { | ||
this.chart.appendData(newData) | ||
}, | ||
addText(options) { | ||
addText (options) { | ||
this.chart.addText(options) | ||
}, | ||
dataURI() { | ||
return this.chart.dataURI(); | ||
dataURI () { | ||
return this.chart.dataURI() | ||
}, | ||
addXaxisAnnotation(options, pushToMemory) { | ||
addXaxisAnnotation (options, pushToMemory) { | ||
this.chart.addXaxisAnnotation(options, pushToMemory) | ||
}, | ||
addYaxisAnnotation(options, pushToMemory) { | ||
addYaxisAnnotation (options, pushToMemory) { | ||
this.chart.addYaxisAnnotation(options, pushToMemory) | ||
}, | ||
addPointAnnotation(options, pushToMemory) { | ||
addPointAnnotation (options, pushToMemory) { | ||
this.chart.addPointAnnotation(options, pushToMemory) | ||
}, | ||
clearAnnotations() { | ||
clearAnnotations () { | ||
this.chart.clearAnnotations() | ||
} | ||
}, | ||
} | ||
} |
51024
29
474