diff --git a/dist/vue-chartjs.js b/dist/vue-chartjs.js index a521d5bc..566fb395 100644 --- a/dist/vue-chartjs.js +++ b/dist/vue-chartjs.js @@ -202,7 +202,9 @@ var reactiveData = { var reactiveProp = { props: { chartData: { - required: true + type: Object, + required: true, + default: function _default() {} } }, watch: { diff --git a/dist/vue-chartjs.js.map b/dist/vue-chartjs.js.map index e16fa13b..1b83b763 100644 --- a/dist/vue-chartjs.js.map +++ b/dist/vue-chartjs.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 30e5fe6ae965a48c1009","webpack:///./src/index.js","webpack:///./src/mixins/index.js","webpack:///./src/BaseCharts.js","webpack:///external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}"],"names":["VueCharts","Bar","HorizontalBar","Doughnut","Line","Pie","PolarArea","Radar","Bubble","Scatter","mixins","generateChart","render","console","error","dataHandler","newData","oldData","chart","$data","_chart","newDatasetLabels","datasets","map","dataset","label","oldDatasetLabels","oldLabels","JSON","stringify","newLabels","length","forEach","i","oldDatasetKeys","Object","keys","newDatasetKeys","deletionKeys","filter","key","indexOf","deletionKey","data","attribute","hasOwnProperty","labels","$emit","xLabels","yLabels","update","destroy","renderChart","chartData","options","reactiveData","watch","reactiveProp","props","required","chartId","chartType","createElement","style","styles","class","cssClasses","attrs","id","width","height","ref","default","type","String","Number","plugins","Array","_plugins","methods","addPlugin","plugin","push","generateLegend","$refs","canvas","getContext","beforeDestroy"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAE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2B,KAA3B,CAAZ;AACA,IAAMT,gBAAgBS,cAAc,qBAAd,EAAqC,eAArC,CAAtB;AACA,IAAMR,WAAWQ,cAAc,gBAAd,EAAgC,UAAhC,CAAjB;AACA,IAAMP,OAAOO,cAAc,YAAd,EAA4B,MAA5B,CAAb;AACA,IAAMN,MAAMM,cAAc,WAAd,EAA2B,KAA3B,CAAZ;AACA,IAAML,YAAYK,cAAc,aAAd,EAA6B,WAA7B,CAAlB;AACA,IAAMJ,QAAQI,cAAc,aAAd,EAA6B,OAA7B,CAAd;AACA,IAAMH,SAASG,cAAc,cAAd,EAA8B,QAA9B,CAAf;AACA,IAAMF,UAAUE,cAAc,eAAd,EAA+B,SAA/B,CAAhB;AAEP,0EAAe;AACbV,UADa;AAEbC,8BAFa;AAGbC,oBAHa;AAIbC,YAJa;AAKbC,UALa;AAMbC,sBANa;AAObC,cAPa;AAQbC,gBARa;AASbC;AATa,CAAf,E;;;;;;ACnGA,+C","file":"./dist/vue-chartjs.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"chart.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"VueChartJs\", [\"chart.js\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VueChartJs\"] = factory(require(\"chart.js\"));\n\telse\n\t\troot[\"VueChartJs\"] = factory(root[\"Chart\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 30e5fe6ae965a48c1009","import mixins from './mixins/index.js'\n\nimport {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n generateChart\n} from './BaseCharts'\n\nconst VueCharts = {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n mixins,\n generateChart,\n render: () => console.error('[vue-chartjs]: This is not a vue component. It is the whole object containing all vue components. Please import the named export or access the components over the dot notation. For more info visit https://vue-chartjs.org/#/home?id=quick-start')\n}\n\nexport default VueCharts\n\nexport {\n VueCharts,\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n mixins,\n generateChart\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","function dataHandler (newData, oldData) {\n if (oldData) {\n let chart = this.$data._chart\n\n // Get new and old DataSet Labels\n let newDatasetLabels = newData.datasets.map((dataset) => {\n return dataset.label\n })\n\n let oldDatasetLabels = oldData.datasets.map((dataset) => {\n return dataset.label\n })\n\n // Stringify 'em for easier compare\n const oldLabels = JSON.stringify(oldDatasetLabels)\n const newLabels = JSON.stringify(newDatasetLabels)\n\n // Check if Labels are equal and if dataset length is equal\n if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) {\n newData.datasets.forEach((dataset, i) => {\n // Get new and old dataset keys\n const oldDatasetKeys = Object.keys(oldData.datasets[i])\n const newDatasetKeys = Object.keys(dataset)\n\n // Get keys that aren't present in the new data\n const deletionKeys = oldDatasetKeys.filter((key) => {\n return key !== '_meta' && newDatasetKeys.indexOf(key) === -1\n })\n\n // Remove outdated key-value pairs\n deletionKeys.forEach((deletionKey) => {\n delete chart.data.datasets[i][deletionKey]\n })\n\n // Update attributes individually to avoid re-rendering the entire chart\n for (const attribute in dataset) {\n if (dataset.hasOwnProperty(attribute)) {\n chart.data.datasets[i][attribute] = dataset[attribute]\n }\n }\n })\n\n if (newData.hasOwnProperty('labels')) {\n chart.data.labels = newData.labels\n this.$emit('labels:update')\n }\n if (newData.hasOwnProperty('xLabels')) {\n chart.data.xLabels = newData.xLabels\n this.$emit('xlabels:update')\n }\n if (newData.hasOwnProperty('yLabels')) {\n chart.data.yLabels = newData.yLabels\n this.$emit('ylabels:update')\n }\n chart.update()\n this.$emit('chart:update')\n } else {\n if (chart) {\n chart.destroy()\n this.$emit('chart:destroy')\n }\n this.renderChart(this.chartData, this.options)\n this.$emit('chart:render')\n }\n } else {\n if (this.$data._chart) {\n this.$data._chart.destroy()\n this.$emit('chart:destroy')\n }\n this.renderChart(this.chartData, this.options)\n this.$emit('chart:render')\n }\n}\n\nexport const reactiveData = {\n data () {\n return {\n chartData: null\n }\n },\n\n watch: {\n 'chartData': dataHandler\n }\n}\n\nexport const reactiveProp = {\n props: {\n chartData: {\n required: true\n }\n },\n watch: {\n 'chartData': dataHandler\n }\n}\n\nexport default {\n reactiveData,\n reactiveProp\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/mixins/index.js","import Chart from 'chart.js'\n\nexport function generateChart (chartId, chartType) {\n return {\n render: function (createElement) {\n return createElement(\n 'div', {\n style: this.styles,\n class: this.cssClasses\n },\n [\n createElement(\n 'canvas', {\n attrs: {\n id: this.chartId,\n width: this.width,\n height: this.height\n },\n ref: 'canvas'\n }\n )\n ]\n )\n },\n\n props: {\n chartId: {\n default: chartId,\n type: String\n },\n width: {\n default: 400,\n type: Number\n },\n height: {\n default: 400,\n type: Number\n },\n cssClasses: {\n type: String,\n default: ''\n },\n styles: {\n type: Object\n },\n plugins: {\n type: Array,\n default () {\n return []\n }\n }\n },\n\n data () {\n return {\n _chart: null,\n _plugins: this.plugins\n }\n },\n\n methods: {\n addPlugin (plugin) {\n this.$data._plugins.push(plugin)\n },\n generateLegend () {\n if (this.$data._chart) {\n return this.$data._chart.generateLegend()\n }\n },\n renderChart (data, options) {\n if (this.$data._chart) this.$data._chart.destroy()\n this.$data._chart = new Chart(\n this.$refs.canvas.getContext('2d'), {\n type: chartType,\n data: data,\n options: options,\n plugins: this.$data._plugins\n }\n )\n }\n },\n beforeDestroy () {\n if (this.$data._chart) {\n this.$data._chart.destroy()\n }\n }\n }\n}\n\nexport const Bar = generateChart('bar-chart', 'bar')\nexport const HorizontalBar = generateChart('horizontalbar-chart', 'horizontalBar')\nexport const Doughnut = generateChart('doughnut-chart', 'doughnut')\nexport const Line = generateChart('line-chart', 'line')\nexport const Pie = generateChart('pie-chart', 'pie')\nexport const PolarArea = generateChart('polar-chart', 'polarArea')\nexport const Radar = generateChart('radar-chart', 'radar')\nexport const Bubble = generateChart('bubble-chart', 'bubble')\nexport const Scatter = generateChart('scatter-chart', 'scatter')\n\nexport default {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/BaseCharts.js","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap f655aa7a8ed46dd84ec1","webpack:///./src/index.js","webpack:///./src/mixins/index.js","webpack:///./src/BaseCharts.js","webpack:///external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}"],"names":["VueCharts","Bar","HorizontalBar","Doughnut","Line","Pie","PolarArea","Radar","Bubble","Scatter","mixins","generateChart","render","console","error","dataHandler","newData","oldData","chart","$data","_chart","newDatasetLabels","datasets","map","dataset","label","oldDatasetLabels","oldLabels","JSON","stringify","newLabels","length","forEach","i","oldDatasetKeys","Object","keys","newDatasetKeys","deletionKeys","filter","key","indexOf","deletionKey","data","attribute","hasOwnProperty","labels","$emit","xLabels","yLabels","update","destroy","renderChart","chartData","options","reactiveData","watch","reactiveProp","props","type","required","default","chartId","chartType","createElement","style","styles","class","cssClasses","attrs","id","width","height","ref","String","Number","plugins","Array","_plugins","methods","addPlugin","plugin","push","generateLegend","$refs","canvas","getContext","beforeDestroy"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA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,CAAWC,MAAf,EAAuB;AACrB,aAAKD,KAAL,CAAWC,MAAX,CAAkB+B,OAAlB;AACD;AACF;AAlFI,GAAP;AAoFD;AAEM,IAAMlD,MAAMU,cAAc,WAAd,EAA2B,KAA3B,CAAZ;AACA,IAAMT,gBAAgBS,cAAc,qBAAd,EAAqC,eAArC,CAAtB;AACA,IAAMR,WAAWQ,cAAc,gBAAd,EAAgC,UAAhC,CAAjB;AACA,IAAMP,OAAOO,cAAc,YAAd,EAA4B,MAA5B,CAAb;AACA,IAAMN,MAAMM,cAAc,WAAd,EAA2B,KAA3B,CAAZ;AACA,IAAML,YAAYK,cAAc,aAAd,EAA6B,WAA7B,CAAlB;AACA,IAAMJ,QAAQI,cAAc,aAAd,EAA6B,OAA7B,CAAd;AACA,IAAMH,SAASG,cAAc,cAAd,EAA8B,QAA9B,CAAf;AACA,IAAMF,UAAUE,cAAc,eAAd,EAA+B,SAA/B,CAAhB;AAEP,0EAAe;AACbV,UADa;AAEbC,8BAFa;AAGbC,oBAHa;AAIbC,YAJa;AAKbC,UALa;AAMbC,sBANa;AAObC,cAPa;AAQbC,gBARa;AASbC;AATa,CAAf,E;;;;;;ACnGA,+C","file":"./dist/vue-chartjs.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"chart.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"VueChartJs\", [\"chart.js\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VueChartJs\"] = factory(require(\"chart.js\"));\n\telse\n\t\troot[\"VueChartJs\"] = factory(root[\"Chart\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f655aa7a8ed46dd84ec1","import mixins from './mixins/index.js'\n\nimport {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n generateChart\n} from './BaseCharts'\n\nconst VueCharts = {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n mixins,\n generateChart,\n render: () => console.error('[vue-chartjs]: This is not a vue component. It is the whole object containing all vue components. Please import the named export or access the components over the dot notation. For more info visit https://vue-chartjs.org/#/home?id=quick-start')\n}\n\nexport default VueCharts\n\nexport {\n VueCharts,\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n mixins,\n generateChart\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","function dataHandler (newData, oldData) {\n if (oldData) {\n let chart = this.$data._chart\n\n // Get new and old DataSet Labels\n let newDatasetLabels = newData.datasets.map((dataset) => {\n return dataset.label\n })\n\n let oldDatasetLabels = oldData.datasets.map((dataset) => {\n return dataset.label\n })\n\n // Stringify 'em for easier compare\n const oldLabels = JSON.stringify(oldDatasetLabels)\n const newLabels = JSON.stringify(newDatasetLabels)\n\n // Check if Labels are equal and if dataset length is equal\n if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) {\n newData.datasets.forEach((dataset, i) => {\n // Get new and old dataset keys\n const oldDatasetKeys = Object.keys(oldData.datasets[i])\n const newDatasetKeys = Object.keys(dataset)\n\n // Get keys that aren't present in the new data\n const deletionKeys = oldDatasetKeys.filter((key) => {\n return key !== '_meta' && newDatasetKeys.indexOf(key) === -1\n })\n\n // Remove outdated key-value pairs\n deletionKeys.forEach((deletionKey) => {\n delete chart.data.datasets[i][deletionKey]\n })\n\n // Update attributes individually to avoid re-rendering the entire chart\n for (const attribute in dataset) {\n if (dataset.hasOwnProperty(attribute)) {\n chart.data.datasets[i][attribute] = dataset[attribute]\n }\n }\n })\n\n if (newData.hasOwnProperty('labels')) {\n chart.data.labels = newData.labels\n this.$emit('labels:update')\n }\n if (newData.hasOwnProperty('xLabels')) {\n chart.data.xLabels = newData.xLabels\n this.$emit('xlabels:update')\n }\n if (newData.hasOwnProperty('yLabels')) {\n chart.data.yLabels = newData.yLabels\n this.$emit('ylabels:update')\n }\n chart.update()\n this.$emit('chart:update')\n } else {\n if (chart) {\n chart.destroy()\n this.$emit('chart:destroy')\n }\n this.renderChart(this.chartData, this.options)\n this.$emit('chart:render')\n }\n } else {\n if (this.$data._chart) {\n this.$data._chart.destroy()\n this.$emit('chart:destroy')\n }\n this.renderChart(this.chartData, this.options)\n this.$emit('chart:render')\n }\n}\n\nexport const reactiveData = {\n data () {\n return {\n chartData: null\n }\n },\n\n watch: {\n 'chartData': dataHandler\n }\n}\n\nexport const reactiveProp = {\n props: {\n chartData: {\n type: Object,\n required: true,\n default: () => {}\n }\n },\n watch: {\n 'chartData': dataHandler\n }\n}\n\nexport default {\n reactiveData,\n reactiveProp\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/mixins/index.js","import Chart from 'chart.js'\n\nexport function generateChart (chartId, chartType) {\n return {\n render: function (createElement) {\n return createElement(\n 'div', {\n style: this.styles,\n class: this.cssClasses\n },\n [\n createElement(\n 'canvas', {\n attrs: {\n id: this.chartId,\n width: this.width,\n height: this.height\n },\n ref: 'canvas'\n }\n )\n ]\n )\n },\n\n props: {\n chartId: {\n default: chartId,\n type: String\n },\n width: {\n default: 400,\n type: Number\n },\n height: {\n default: 400,\n type: Number\n },\n cssClasses: {\n type: String,\n default: ''\n },\n styles: {\n type: Object\n },\n plugins: {\n type: Array,\n default () {\n return []\n }\n }\n },\n\n data () {\n return {\n _chart: null,\n _plugins: this.plugins\n }\n },\n\n methods: {\n addPlugin (plugin) {\n this.$data._plugins.push(plugin)\n },\n generateLegend () {\n if (this.$data._chart) {\n return this.$data._chart.generateLegend()\n }\n },\n renderChart (data, options) {\n if (this.$data._chart) this.$data._chart.destroy()\n this.$data._chart = new Chart(\n this.$refs.canvas.getContext('2d'), {\n type: chartType,\n data: data,\n options: options,\n plugins: this.$data._plugins\n }\n )\n }\n },\n beforeDestroy () {\n if (this.$data._chart) {\n this.$data._chart.destroy()\n }\n }\n }\n}\n\nexport const Bar = generateChart('bar-chart', 'bar')\nexport const HorizontalBar = generateChart('horizontalbar-chart', 'horizontalBar')\nexport const Doughnut = generateChart('doughnut-chart', 'doughnut')\nexport const Line = generateChart('line-chart', 'line')\nexport const Pie = generateChart('pie-chart', 'pie')\nexport const PolarArea = generateChart('polar-chart', 'polarArea')\nexport const Radar = generateChart('radar-chart', 'radar')\nexport const Bubble = generateChart('bubble-chart', 'bubble')\nexport const Scatter = generateChart('scatter-chart', 'scatter')\n\nexport default {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/BaseCharts.js","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/vue-chartjs.min.js b/dist/vue-chartjs.min.js index 78d58c97..9ae69e15 100644 --- a/dist/vue-chartjs.min.js +++ b/dist/vue-chartjs.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("chart.js")):"function"==typeof define&&define.amd?define("VueChartJs",["chart.js"],e):"object"==typeof exports?exports.VueChartJs=e(require("chart.js")):t.VueChartJs=e(t.Chart)}("undefined"!=typeof self?self:this,function(t){return function(t){function e(a){if(r[a])return r[a].exports;var n=r[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:a})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){"use strict";function a(t,e){if(e){var r=this.$data._chart,a=t.datasets.map(function(t){return t.label}),n=e.datasets.map(function(t){return t.label}),s=JSON.stringify(n);JSON.stringify(a)===s&&e.datasets.length===t.datasets.length?(t.datasets.forEach(function(t,a){var n=Object.keys(e.datasets[a]),s=Object.keys(t);n.filter(function(t){return"_meta"!==t&&-1===s.indexOf(t)}).forEach(function(t){delete r.data.datasets[a][t]});for(var i in t)t.hasOwnProperty(i)&&(r.data.datasets[a][i]=t[i])}),t.hasOwnProperty("labels")&&(r.data.labels=t.labels,this.$emit("labels:update")),t.hasOwnProperty("xLabels")&&(r.data.xLabels=t.xLabels,this.$emit("xlabels:update")),t.hasOwnProperty("yLabels")&&(r.data.yLabels=t.yLabels,this.$emit("ylabels:update")),r.update(),this.$emit("chart:update")):(r&&(r.destroy(),this.$emit("chart:destroy")),this.renderChart(this.chartData,this.options),this.$emit("chart:render"))}else this.$data._chart&&(this.$data._chart.destroy(),this.$emit("chart:destroy")),this.renderChart(this.chartData,this.options),this.$emit("chart:render")}function n(t,e){return{render:function(t){return t("div",{style:this.styles,class:this.cssClasses},[t("canvas",{attrs:{id:this.chartId,width:this.width,height:this.height},ref:"canvas"})])},props:{chartId:{default:t,type:String},width:{default:400,type:Number},height:{default:400,type:Number},cssClasses:{type:String,default:""},styles:{type:Object},plugins:{type:Array,default:function(){return[]}}},data:function(){return{_chart:null,_plugins:this.plugins}},methods:{addPlugin:function(t){this.$data._plugins.push(t)},generateLegend:function(){if(this.$data._chart)return this.$data._chart.generateLegend()},renderChart:function(t,r){this.$data._chart&&this.$data._chart.destroy(),this.$data._chart=new h.a(this.$refs.canvas.getContext("2d"),{type:e,data:t,options:r,plugins:this.$data._plugins})}},beforeDestroy:function(){this.$data._chart&&this.$data._chart.destroy()}}}Object.defineProperty(e,"__esModule",{value:!0});var s={data:function(){return{chartData:null}},watch:{chartData:a}},i={props:{chartData:{required:!0}},watch:{chartData:a}},o={reactiveData:s,reactiveProp:i},u=r(1),h=r.n(u),c=n("bar-chart","bar"),d=n("horizontalbar-chart","horizontalBar"),l=n("doughnut-chart","doughnut"),f=n("line-chart","line"),p=n("pie-chart","pie"),b=n("polar-chart","polarArea"),y=n("radar-chart","radar"),g=n("bubble-chart","bubble"),m=n("scatter-chart","scatter");r.d(e,"VueCharts",function(){return v}),r.d(e,"Bar",function(){return c}),r.d(e,"HorizontalBar",function(){return d}),r.d(e,"Doughnut",function(){return l}),r.d(e,"Line",function(){return f}),r.d(e,"Pie",function(){return p}),r.d(e,"PolarArea",function(){return b}),r.d(e,"Radar",function(){return y}),r.d(e,"Bubble",function(){return g}),r.d(e,"Scatter",function(){return m}),r.d(e,"mixins",function(){return o}),r.d(e,"generateChart",function(){return n});var v={Bar:c,HorizontalBar:d,Doughnut:l,Line:f,Pie:p,PolarArea:b,Radar:y,Bubble:g,Scatter:m,mixins:o,generateChart:n,render:function(){return console.error("[vue-chartjs]: This is not a vue component. It is the whole object containing all vue components. Please import the named export or access the components over the dot notation. For more info visit https://vue-chartjs.org/#/home?id=quick-start")}};e.default=v},function(e,r){e.exports=t}])}); +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("chart.js")):"function"==typeof define&&define.amd?define("VueChartJs",["chart.js"],e):"object"==typeof exports?exports.VueChartJs=e(require("chart.js")):t.VueChartJs=e(t.Chart)}("undefined"!=typeof self?self:this,function(t){return function(t){function e(a){if(r[a])return r[a].exports;var n=r[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:a})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){"use strict";function a(t,e){if(e){var r=this.$data._chart,a=t.datasets.map(function(t){return t.label}),n=e.datasets.map(function(t){return t.label}),s=JSON.stringify(n);JSON.stringify(a)===s&&e.datasets.length===t.datasets.length?(t.datasets.forEach(function(t,a){var n=Object.keys(e.datasets[a]),s=Object.keys(t);n.filter(function(t){return"_meta"!==t&&-1===s.indexOf(t)}).forEach(function(t){delete r.data.datasets[a][t]});for(var i in t)t.hasOwnProperty(i)&&(r.data.datasets[a][i]=t[i])}),t.hasOwnProperty("labels")&&(r.data.labels=t.labels,this.$emit("labels:update")),t.hasOwnProperty("xLabels")&&(r.data.xLabels=t.xLabels,this.$emit("xlabels:update")),t.hasOwnProperty("yLabels")&&(r.data.yLabels=t.yLabels,this.$emit("ylabels:update")),r.update(),this.$emit("chart:update")):(r&&(r.destroy(),this.$emit("chart:destroy")),this.renderChart(this.chartData,this.options),this.$emit("chart:render"))}else this.$data._chart&&(this.$data._chart.destroy(),this.$emit("chart:destroy")),this.renderChart(this.chartData,this.options),this.$emit("chart:render")}function n(t,e){return{render:function(t){return t("div",{style:this.styles,class:this.cssClasses},[t("canvas",{attrs:{id:this.chartId,width:this.width,height:this.height},ref:"canvas"})])},props:{chartId:{default:t,type:String},width:{default:400,type:Number},height:{default:400,type:Number},cssClasses:{type:String,default:""},styles:{type:Object},plugins:{type:Array,default:function(){return[]}}},data:function(){return{_chart:null,_plugins:this.plugins}},methods:{addPlugin:function(t){this.$data._plugins.push(t)},generateLegend:function(){if(this.$data._chart)return this.$data._chart.generateLegend()},renderChart:function(t,r){this.$data._chart&&this.$data._chart.destroy(),this.$data._chart=new c.a(this.$refs.canvas.getContext("2d"),{type:e,data:t,options:r,plugins:this.$data._plugins})}},beforeDestroy:function(){this.$data._chart&&this.$data._chart.destroy()}}}Object.defineProperty(e,"__esModule",{value:!0});var s={data:function(){return{chartData:null}},watch:{chartData:a}},i={props:{chartData:{type:Object,required:!0,default:function(){}}},watch:{chartData:a}},o={reactiveData:s,reactiveProp:i},u=r(1),c=r.n(u),h=n("bar-chart","bar"),d=n("horizontalbar-chart","horizontalBar"),l=n("doughnut-chart","doughnut"),f=n("line-chart","line"),p=n("pie-chart","pie"),b=n("polar-chart","polarArea"),y=n("radar-chart","radar"),g=n("bubble-chart","bubble"),m=n("scatter-chart","scatter");r.d(e,"VueCharts",function(){return v}),r.d(e,"Bar",function(){return h}),r.d(e,"HorizontalBar",function(){return d}),r.d(e,"Doughnut",function(){return l}),r.d(e,"Line",function(){return f}),r.d(e,"Pie",function(){return p}),r.d(e,"PolarArea",function(){return b}),r.d(e,"Radar",function(){return y}),r.d(e,"Bubble",function(){return g}),r.d(e,"Scatter",function(){return m}),r.d(e,"mixins",function(){return o}),r.d(e,"generateChart",function(){return n});var v={Bar:h,HorizontalBar:d,Doughnut:l,Line:f,Pie:p,PolarArea:b,Radar:y,Bubble:g,Scatter:m,mixins:o,generateChart:n,render:function(){return console.error("[vue-chartjs]: This is not a vue component. It is the whole object containing all vue components. Please import the named export or access the components over the dot notation. For more info visit https://vue-chartjs.org/#/home?id=quick-start")}};e.default=v},function(e,r){e.exports=t}])}); //# sourceMappingURL=vue-chartjs.min.js.map \ No newline at end of file diff --git a/dist/vue-chartjs.min.js.map b/dist/vue-chartjs.min.js.map index ae6309d3..2ba8d930 100644 --- a/dist/vue-chartjs.min.js.map +++ b/dist/vue-chartjs.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///dist/vue-chartjs.min.js","webpack:///webpack/bootstrap 2173ae4d9ea35878f7ab","webpack:///./src/mixins/index.js","webpack:///./src/BaseCharts.js","webpack:///./src/index.js","webpack:///external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}"],"names":["root","factory","exports","module","require","define","amd","self","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","dataHandler","newData","oldData","chart","$data","_chart","newDatasetLabels","datasets","map","dataset","label","oldDatasetLabels","oldLabels","JSON","stringify","length","forEach","oldDatasetKeys","keys","newDatasetKeys","filter","key","indexOf","deletionKey","data","attribute","labels","$emit","xLabels","yLabels","update","destroy","renderChart","chartData","options","generateChart","chartId","chartType","render","createElement","style","styles","class","cssClasses","attrs","id","width","height","ref","props","default","type","String","Number","plugins","Array","_plugins","methods","addPlugin","plugin","push","generateLegend","external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js___default","a","$refs","canvas","getContext","beforeDestroy","value","reactiveData","watch","reactiveProp","required","mixins","external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js__","Bar","HorizontalBar","Doughnut","Line","Pie","PolarArea","Radar","Bubble","Scatter","VueCharts","console","error"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,aACA,kBAAAC,gBAAAC,IACAD,OAAA,0BAAAJ,GACA,gBAAAC,SACAA,QAAA,WAAAD,EAAAG,QAAA,aAEAJ,EAAA,WAAAC,EAAAD,EAAA,QACC,mBAAAO,WAAAC,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAV,OAGA,IAAAC,GAAAU,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAb,WAUA,OANAQ,GAAAE,GAAAI,KAAAb,EAAAD,QAAAC,IAAAD,QAAAS,GAGAR,EAAAY,GAAA,EAGAZ,EAAAD,QAvBA,GAAAW,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAjB,EAAAkB,EAAAC,GACAV,EAAAW,EAAApB,EAAAkB,IACAG,OAAAC,eAAAtB,EAAAkB,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAAzB,GACA,GAAAkB,GAAAlB,KAAA0B,WACA,WAA2B,MAAA1B,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAQ,GAAAQ,EAAAE,EAA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PJuRSvF,GAA6B,QAAI,GAKlE,SAAUjC,EAAQD,GKvTxBC,EAAAD,QAAAO","file":"./dist/vue-chartjs.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"chart.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"VueChartJs\", [\"chart.js\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VueChartJs\"] = factory(require(\"chart.js\"));\n\telse\n\t\troot[\"VueChartJs\"] = factory(root[\"Chart\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"chart.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"VueChartJs\", [\"chart.js\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VueChartJs\"] = factory(require(\"chart.js\"));\n\telse\n\t\troot[\"VueChartJs\"] = factory(root[\"Chart\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n\n// CONCATENATED MODULE: ./src/mixins/index.js\nfunction dataHandler(newData, oldData) {\n if (oldData) {\n var chart = this.$data._chart;\n var newDatasetLabels = newData.datasets.map(function (dataset) {\n return dataset.label;\n });\n var oldDatasetLabels = oldData.datasets.map(function (dataset) {\n return dataset.label;\n });\n var oldLabels = JSON.stringify(oldDatasetLabels);\n var newLabels = JSON.stringify(newDatasetLabels);\n\n if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) {\n newData.datasets.forEach(function (dataset, i) {\n var oldDatasetKeys = Object.keys(oldData.datasets[i]);\n var newDatasetKeys = Object.keys(dataset);\n var deletionKeys = oldDatasetKeys.filter(function (key) {\n return key !== '_meta' && newDatasetKeys.indexOf(key) === -1;\n });\n deletionKeys.forEach(function (deletionKey) {\n delete chart.data.datasets[i][deletionKey];\n });\n\n for (var attribute in dataset) {\n if (dataset.hasOwnProperty(attribute)) {\n chart.data.datasets[i][attribute] = dataset[attribute];\n }\n }\n });\n\n if (newData.hasOwnProperty('labels')) {\n chart.data.labels = newData.labels;\n this.$emit('labels:update');\n }\n\n if (newData.hasOwnProperty('xLabels')) {\n chart.data.xLabels = newData.xLabels;\n this.$emit('xlabels:update');\n }\n\n if (newData.hasOwnProperty('yLabels')) {\n chart.data.yLabels = newData.yLabels;\n this.$emit('ylabels:update');\n }\n\n chart.update();\n this.$emit('chart:update');\n } else {\n if (chart) {\n chart.destroy();\n this.$emit('chart:destroy');\n }\n\n this.renderChart(this.chartData, this.options);\n this.$emit('chart:render');\n }\n } else {\n if (this.$data._chart) {\n this.$data._chart.destroy();\n\n this.$emit('chart:destroy');\n }\n\n this.renderChart(this.chartData, this.options);\n this.$emit('chart:render');\n }\n}\n\nvar reactiveData = {\n data: function data() {\n return {\n chartData: null\n };\n },\n watch: {\n 'chartData': dataHandler\n }\n};\nvar reactiveProp = {\n props: {\n chartData: {\n required: true\n }\n },\n watch: {\n 'chartData': dataHandler\n }\n};\n/* harmony default export */ var mixins = ({\n reactiveData: reactiveData,\n reactiveProp: reactiveProp\n});\n// EXTERNAL MODULE: external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}\nvar external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js__ = __webpack_require__(1);\nvar external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js___default = /*#__PURE__*/__webpack_require__.n(external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js__);\n\n// CONCATENATED MODULE: ./src/BaseCharts.js\n\nfunction generateChart(chartId, chartType) {\n return {\n render: function render(createElement) {\n return createElement('div', {\n style: this.styles,\n class: this.cssClasses\n }, [createElement('canvas', {\n attrs: {\n id: this.chartId,\n width: this.width,\n height: this.height\n },\n ref: 'canvas'\n })]);\n },\n props: {\n chartId: {\n default: chartId,\n type: String\n },\n width: {\n default: 400,\n type: Number\n },\n height: {\n default: 400,\n type: Number\n },\n cssClasses: {\n type: String,\n default: ''\n },\n styles: {\n type: Object\n },\n plugins: {\n type: Array,\n default: function _default() {\n return [];\n }\n }\n },\n data: function data() {\n return {\n _chart: null,\n _plugins: this.plugins\n };\n },\n methods: {\n addPlugin: function addPlugin(plugin) {\n this.$data._plugins.push(plugin);\n },\n generateLegend: function generateLegend() {\n if (this.$data._chart) {\n return this.$data._chart.generateLegend();\n }\n },\n renderChart: function renderChart(data, options) {\n if (this.$data._chart) this.$data._chart.destroy();\n this.$data._chart = new external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js___default.a(this.$refs.canvas.getContext('2d'), {\n type: chartType,\n data: data,\n options: options,\n plugins: this.$data._plugins\n });\n }\n },\n beforeDestroy: function beforeDestroy() {\n if (this.$data._chart) {\n this.$data._chart.destroy();\n }\n }\n };\n}\nvar Bar = generateChart('bar-chart', 'bar');\nvar HorizontalBar = generateChart('horizontalbar-chart', 'horizontalBar');\nvar Doughnut = generateChart('doughnut-chart', 'doughnut');\nvar Line = generateChart('line-chart', 'line');\nvar Pie = generateChart('pie-chart', 'pie');\nvar PolarArea = generateChart('polar-chart', 'polarArea');\nvar Radar = generateChart('radar-chart', 'radar');\nvar Bubble = generateChart('bubble-chart', 'bubble');\nvar Scatter = generateChart('scatter-chart', 'scatter');\n/* harmony default export */ var BaseCharts = ({\n Bar: Bar,\n HorizontalBar: HorizontalBar,\n Doughnut: Doughnut,\n Line: Line,\n Pie: Pie,\n PolarArea: PolarArea,\n Radar: Radar,\n Bubble: Bubble,\n Scatter: Scatter\n});\n// CONCATENATED MODULE: ./src/index.js\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VueCharts\", function() { return VueCharts; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Bar\", function() { return Bar; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"HorizontalBar\", function() { return HorizontalBar; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Doughnut\", function() { return Doughnut; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Line\", function() { return Line; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Pie\", function() { return Pie; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"PolarArea\", function() { return PolarArea; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Radar\", function() { return Radar; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Bubble\", function() { return Bubble; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Scatter\", function() { return Scatter; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"mixins\", function() { return mixins; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"generateChart\", function() { return generateChart; });\n\n\nvar VueCharts = {\n Bar: Bar,\n HorizontalBar: HorizontalBar,\n Doughnut: Doughnut,\n Line: Line,\n Pie: Pie,\n PolarArea: PolarArea,\n Radar: Radar,\n Bubble: Bubble,\n Scatter: Scatter,\n mixins: mixins,\n generateChart: generateChart,\n render: function render() {\n return console.error('[vue-chartjs]: This is not a vue component. It is the whole object containing all vue components. Please import the named export or access the components over the dot notation. For more info visit https://vue-chartjs.org/#/home?id=quick-start');\n }\n};\n/* harmony default export */ var src = __webpack_exports__[\"default\"] = (VueCharts);\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// dist/vue-chartjs.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2173ae4d9ea35878f7ab","function dataHandler (newData, oldData) {\n if (oldData) {\n let chart = this.$data._chart\n\n // Get new and old DataSet Labels\n let newDatasetLabels = newData.datasets.map((dataset) => {\n return dataset.label\n })\n\n let oldDatasetLabels = oldData.datasets.map((dataset) => {\n return dataset.label\n })\n\n // Stringify 'em for easier compare\n const oldLabels = JSON.stringify(oldDatasetLabels)\n const newLabels = JSON.stringify(newDatasetLabels)\n\n // Check if Labels are equal and if dataset length is equal\n if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) {\n newData.datasets.forEach((dataset, i) => {\n // Get new and old dataset keys\n const oldDatasetKeys = Object.keys(oldData.datasets[i])\n const newDatasetKeys = Object.keys(dataset)\n\n // Get keys that aren't present in the new data\n const deletionKeys = oldDatasetKeys.filter((key) => {\n return key !== '_meta' && newDatasetKeys.indexOf(key) === -1\n })\n\n // Remove outdated key-value pairs\n deletionKeys.forEach((deletionKey) => {\n delete chart.data.datasets[i][deletionKey]\n })\n\n // Update attributes individually to avoid re-rendering the entire chart\n for (const attribute in dataset) {\n if (dataset.hasOwnProperty(attribute)) {\n chart.data.datasets[i][attribute] = dataset[attribute]\n }\n }\n })\n\n if (newData.hasOwnProperty('labels')) {\n chart.data.labels = newData.labels\n this.$emit('labels:update')\n }\n if (newData.hasOwnProperty('xLabels')) {\n chart.data.xLabels = newData.xLabels\n this.$emit('xlabels:update')\n }\n if (newData.hasOwnProperty('yLabels')) {\n chart.data.yLabels = newData.yLabels\n this.$emit('ylabels:update')\n }\n chart.update()\n this.$emit('chart:update')\n } else {\n if (chart) {\n chart.destroy()\n this.$emit('chart:destroy')\n }\n this.renderChart(this.chartData, this.options)\n this.$emit('chart:render')\n }\n } else {\n if (this.$data._chart) {\n this.$data._chart.destroy()\n this.$emit('chart:destroy')\n }\n this.renderChart(this.chartData, this.options)\n this.$emit('chart:render')\n }\n}\n\nexport const reactiveData = {\n data () {\n return {\n chartData: null\n }\n },\n\n watch: {\n 'chartData': dataHandler\n }\n}\n\nexport const reactiveProp = {\n props: {\n chartData: {\n required: true\n }\n },\n watch: {\n 'chartData': dataHandler\n }\n}\n\nexport default {\n reactiveData,\n reactiveProp\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/mixins/index.js","import Chart from 'chart.js'\n\nexport function generateChart (chartId, chartType) {\n return {\n render: function (createElement) {\n return createElement(\n 'div', {\n style: this.styles,\n class: this.cssClasses\n },\n [\n createElement(\n 'canvas', {\n attrs: {\n id: this.chartId,\n width: this.width,\n height: this.height\n },\n ref: 'canvas'\n }\n )\n ]\n )\n },\n\n props: {\n chartId: {\n default: chartId,\n type: String\n },\n width: {\n default: 400,\n type: Number\n },\n height: {\n default: 400,\n type: Number\n },\n cssClasses: {\n type: String,\n default: ''\n },\n styles: {\n type: Object\n },\n plugins: {\n type: Array,\n default () {\n return []\n }\n }\n },\n\n data () {\n return {\n _chart: null,\n _plugins: this.plugins\n }\n },\n\n methods: {\n addPlugin (plugin) {\n this.$data._plugins.push(plugin)\n },\n generateLegend () {\n if (this.$data._chart) {\n return this.$data._chart.generateLegend()\n }\n },\n renderChart (data, options) {\n if (this.$data._chart) this.$data._chart.destroy()\n this.$data._chart = new Chart(\n this.$refs.canvas.getContext('2d'), {\n type: chartType,\n data: data,\n options: options,\n plugins: this.$data._plugins\n }\n )\n }\n },\n beforeDestroy () {\n if (this.$data._chart) {\n this.$data._chart.destroy()\n }\n }\n }\n}\n\nexport const Bar = generateChart('bar-chart', 'bar')\nexport const HorizontalBar = generateChart('horizontalbar-chart', 'horizontalBar')\nexport const Doughnut = generateChart('doughnut-chart', 'doughnut')\nexport const Line = generateChart('line-chart', 'line')\nexport const Pie = generateChart('pie-chart', 'pie')\nexport const PolarArea = generateChart('polar-chart', 'polarArea')\nexport const Radar = generateChart('radar-chart', 'radar')\nexport const Bubble = generateChart('bubble-chart', 'bubble')\nexport const Scatter = generateChart('scatter-chart', 'scatter')\n\nexport default {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/BaseCharts.js","import mixins from './mixins/index.js'\n\nimport {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n generateChart\n} from './BaseCharts'\n\nconst VueCharts = {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n mixins,\n generateChart,\n render: () => console.error('[vue-chartjs]: This is not a vue component. It is the whole object containing all vue components. Please import the named export or access the components over the dot notation. For more info visit https://vue-chartjs.org/#/home?id=quick-start')\n}\n\nexport default VueCharts\n\nexport {\n VueCharts,\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n mixins,\n generateChart\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}\n// module id = 1\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///dist/vue-chartjs.min.js","webpack:///webpack/bootstrap ee72205a986d15250d05","webpack:///./src/mixins/index.js","webpack:///./src/BaseCharts.js","webpack:///./src/index.js","webpack:///external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}"],"names":["root","factory","exports","module","require","define","amd","self","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","dataHandler","newData","oldData","chart","$data","_chart","newDatasetLabels","datasets","map","dataset","label","oldDatasetLabels","oldLabels","JSON","stringify","length","forEach","oldDatasetKeys","keys","newDatasetKeys","filter","key","indexOf","deletionKey","data","attribute","labels","$emit","xLabels","yLabels","update","destroy","renderChart","chartData","options","generateChart","chartId","chartType","render","createElement","style","styles","class","cssClasses","attrs","id","width","height","ref","props","default","type","String","Number","plugins","Array","_plugins","methods","addPlugin","plugin","push","generateLegend","external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js___default","a","$refs","canvas","getContext","beforeDestroy","value","reactiveData","watch","reactiveProp","required","mixins","external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js__","Bar","HorizontalBar","Doughnut","Line","Pie","PolarArea","Radar","Bubble","Scatter","VueCharts","console","error"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,aACA,kBAAAC,gBAAAC,IACAD,OAAA,0BAAAJ,GACA,gBAAAC,SACAA,QAAA,WAAAD,EAAAG,QAAA,aAEAJ,EAAA,WAAAC,EAAAD,EAAA,QACC,mBAAAO,WAAAC,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAV,OAGA,IAAAC,GAAAU,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAb,WAUA,OANAQ,GAAAE,GAAAI,KAAAb,EAAAD,QAAAC,IAAAD,QAAAS,GAGAR,EAAAY,GAAA,EAGAZ,EAAAD,QAvBA,GAAAW,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAjB,EAAAkB,EAAAC,GACAV,EAAAW,EAAApB,EAAAkB,IACAG,OAAAC,eAAAtB,EAAAkB,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAAzB,GACA,GAAAkB,GAAAlB,KAAA0B,WACA,WAA2B,MAAA1B,GAAA,SAC3B,WAA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AC,YACAC,QACAC,SACAC,UACAV,SACAtC,gBACAG,OAAQ,iBAAM+C,SAAQC,MAAM,uPJyRSvF,GAA6B,QAAI,GAKlE,SAAUjC,EAAQD,GKzTxBC,EAAAD,QAAAO","file":"./dist/vue-chartjs.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"chart.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"VueChartJs\", [\"chart.js\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VueChartJs\"] = factory(require(\"chart.js\"));\n\telse\n\t\troot[\"VueChartJs\"] = factory(root[\"Chart\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"chart.js\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"VueChartJs\", [\"chart.js\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VueChartJs\"] = factory(require(\"chart.js\"));\n\telse\n\t\troot[\"VueChartJs\"] = factory(root[\"Chart\"]);\n})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n\n// CONCATENATED MODULE: ./src/mixins/index.js\nfunction dataHandler(newData, oldData) {\n if (oldData) {\n var chart = this.$data._chart;\n var newDatasetLabels = newData.datasets.map(function (dataset) {\n return dataset.label;\n });\n var oldDatasetLabels = oldData.datasets.map(function (dataset) {\n return dataset.label;\n });\n var oldLabels = JSON.stringify(oldDatasetLabels);\n var newLabels = JSON.stringify(newDatasetLabels);\n\n if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) {\n newData.datasets.forEach(function (dataset, i) {\n var oldDatasetKeys = Object.keys(oldData.datasets[i]);\n var newDatasetKeys = Object.keys(dataset);\n var deletionKeys = oldDatasetKeys.filter(function (key) {\n return key !== '_meta' && newDatasetKeys.indexOf(key) === -1;\n });\n deletionKeys.forEach(function (deletionKey) {\n delete chart.data.datasets[i][deletionKey];\n });\n\n for (var attribute in dataset) {\n if (dataset.hasOwnProperty(attribute)) {\n chart.data.datasets[i][attribute] = dataset[attribute];\n }\n }\n });\n\n if (newData.hasOwnProperty('labels')) {\n chart.data.labels = newData.labels;\n this.$emit('labels:update');\n }\n\n if (newData.hasOwnProperty('xLabels')) {\n chart.data.xLabels = newData.xLabels;\n this.$emit('xlabels:update');\n }\n\n if (newData.hasOwnProperty('yLabels')) {\n chart.data.yLabels = newData.yLabels;\n this.$emit('ylabels:update');\n }\n\n chart.update();\n this.$emit('chart:update');\n } else {\n if (chart) {\n chart.destroy();\n this.$emit('chart:destroy');\n }\n\n this.renderChart(this.chartData, this.options);\n this.$emit('chart:render');\n }\n } else {\n if (this.$data._chart) {\n this.$data._chart.destroy();\n\n this.$emit('chart:destroy');\n }\n\n this.renderChart(this.chartData, this.options);\n this.$emit('chart:render');\n }\n}\n\nvar reactiveData = {\n data: function data() {\n return {\n chartData: null\n };\n },\n watch: {\n 'chartData': dataHandler\n }\n};\nvar reactiveProp = {\n props: {\n chartData: {\n type: Object,\n required: true,\n default: function _default() {}\n }\n },\n watch: {\n 'chartData': dataHandler\n }\n};\n/* harmony default export */ var mixins = ({\n reactiveData: reactiveData,\n reactiveProp: reactiveProp\n});\n// EXTERNAL MODULE: external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}\nvar external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js__ = __webpack_require__(1);\nvar external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js___default = /*#__PURE__*/__webpack_require__.n(external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js__);\n\n// CONCATENATED MODULE: ./src/BaseCharts.js\n\nfunction generateChart(chartId, chartType) {\n return {\n render: function render(createElement) {\n return createElement('div', {\n style: this.styles,\n class: this.cssClasses\n }, [createElement('canvas', {\n attrs: {\n id: this.chartId,\n width: this.width,\n height: this.height\n },\n ref: 'canvas'\n })]);\n },\n props: {\n chartId: {\n default: chartId,\n type: String\n },\n width: {\n default: 400,\n type: Number\n },\n height: {\n default: 400,\n type: Number\n },\n cssClasses: {\n type: String,\n default: ''\n },\n styles: {\n type: Object\n },\n plugins: {\n type: Array,\n default: function _default() {\n return [];\n }\n }\n },\n data: function data() {\n return {\n _chart: null,\n _plugins: this.plugins\n };\n },\n methods: {\n addPlugin: function addPlugin(plugin) {\n this.$data._plugins.push(plugin);\n },\n generateLegend: function generateLegend() {\n if (this.$data._chart) {\n return this.$data._chart.generateLegend();\n }\n },\n renderChart: function renderChart(data, options) {\n if (this.$data._chart) this.$data._chart.destroy();\n this.$data._chart = new external___root___Chart___commonjs___chart_js___commonjs2___chart_js___amd___chart_js___default.a(this.$refs.canvas.getContext('2d'), {\n type: chartType,\n data: data,\n options: options,\n plugins: this.$data._plugins\n });\n }\n },\n beforeDestroy: function beforeDestroy() {\n if (this.$data._chart) {\n this.$data._chart.destroy();\n }\n }\n };\n}\nvar Bar = generateChart('bar-chart', 'bar');\nvar HorizontalBar = generateChart('horizontalbar-chart', 'horizontalBar');\nvar Doughnut = generateChart('doughnut-chart', 'doughnut');\nvar Line = generateChart('line-chart', 'line');\nvar Pie = generateChart('pie-chart', 'pie');\nvar PolarArea = generateChart('polar-chart', 'polarArea');\nvar Radar = generateChart('radar-chart', 'radar');\nvar Bubble = generateChart('bubble-chart', 'bubble');\nvar Scatter = generateChart('scatter-chart', 'scatter');\n/* harmony default export */ var BaseCharts = ({\n Bar: Bar,\n HorizontalBar: HorizontalBar,\n Doughnut: Doughnut,\n Line: Line,\n Pie: Pie,\n PolarArea: PolarArea,\n Radar: Radar,\n Bubble: Bubble,\n Scatter: Scatter\n});\n// CONCATENATED MODULE: ./src/index.js\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"VueCharts\", function() { return VueCharts; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Bar\", function() { return Bar; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"HorizontalBar\", function() { return HorizontalBar; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Doughnut\", function() { return Doughnut; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Line\", function() { return Line; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Pie\", function() { return Pie; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"PolarArea\", function() { return PolarArea; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Radar\", function() { return Radar; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Bubble\", function() { return Bubble; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"Scatter\", function() { return Scatter; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"mixins\", function() { return mixins; });\n/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, \"generateChart\", function() { return generateChart; });\n\n\nvar VueCharts = {\n Bar: Bar,\n HorizontalBar: HorizontalBar,\n Doughnut: Doughnut,\n Line: Line,\n Pie: Pie,\n PolarArea: PolarArea,\n Radar: Radar,\n Bubble: Bubble,\n Scatter: Scatter,\n mixins: mixins,\n generateChart: generateChart,\n render: function render() {\n return console.error('[vue-chartjs]: This is not a vue component. It is the whole object containing all vue components. Please import the named export or access the components over the dot notation. For more info visit https://vue-chartjs.org/#/home?id=quick-start');\n }\n};\n/* harmony default export */ var src = __webpack_exports__[\"default\"] = (VueCharts);\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// dist/vue-chartjs.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ee72205a986d15250d05","function dataHandler (newData, oldData) {\n if (oldData) {\n let chart = this.$data._chart\n\n // Get new and old DataSet Labels\n let newDatasetLabels = newData.datasets.map((dataset) => {\n return dataset.label\n })\n\n let oldDatasetLabels = oldData.datasets.map((dataset) => {\n return dataset.label\n })\n\n // Stringify 'em for easier compare\n const oldLabels = JSON.stringify(oldDatasetLabels)\n const newLabels = JSON.stringify(newDatasetLabels)\n\n // Check if Labels are equal and if dataset length is equal\n if (newLabels === oldLabels && oldData.datasets.length === newData.datasets.length) {\n newData.datasets.forEach((dataset, i) => {\n // Get new and old dataset keys\n const oldDatasetKeys = Object.keys(oldData.datasets[i])\n const newDatasetKeys = Object.keys(dataset)\n\n // Get keys that aren't present in the new data\n const deletionKeys = oldDatasetKeys.filter((key) => {\n return key !== '_meta' && newDatasetKeys.indexOf(key) === -1\n })\n\n // Remove outdated key-value pairs\n deletionKeys.forEach((deletionKey) => {\n delete chart.data.datasets[i][deletionKey]\n })\n\n // Update attributes individually to avoid re-rendering the entire chart\n for (const attribute in dataset) {\n if (dataset.hasOwnProperty(attribute)) {\n chart.data.datasets[i][attribute] = dataset[attribute]\n }\n }\n })\n\n if (newData.hasOwnProperty('labels')) {\n chart.data.labels = newData.labels\n this.$emit('labels:update')\n }\n if (newData.hasOwnProperty('xLabels')) {\n chart.data.xLabels = newData.xLabels\n this.$emit('xlabels:update')\n }\n if (newData.hasOwnProperty('yLabels')) {\n chart.data.yLabels = newData.yLabels\n this.$emit('ylabels:update')\n }\n chart.update()\n this.$emit('chart:update')\n } else {\n if (chart) {\n chart.destroy()\n this.$emit('chart:destroy')\n }\n this.renderChart(this.chartData, this.options)\n this.$emit('chart:render')\n }\n } else {\n if (this.$data._chart) {\n this.$data._chart.destroy()\n this.$emit('chart:destroy')\n }\n this.renderChart(this.chartData, this.options)\n this.$emit('chart:render')\n }\n}\n\nexport const reactiveData = {\n data () {\n return {\n chartData: null\n }\n },\n\n watch: {\n 'chartData': dataHandler\n }\n}\n\nexport const reactiveProp = {\n props: {\n chartData: {\n type: Object,\n required: true,\n default: () => {}\n }\n },\n watch: {\n 'chartData': dataHandler\n }\n}\n\nexport default {\n reactiveData,\n reactiveProp\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/mixins/index.js","import Chart from 'chart.js'\n\nexport function generateChart (chartId, chartType) {\n return {\n render: function (createElement) {\n return createElement(\n 'div', {\n style: this.styles,\n class: this.cssClasses\n },\n [\n createElement(\n 'canvas', {\n attrs: {\n id: this.chartId,\n width: this.width,\n height: this.height\n },\n ref: 'canvas'\n }\n )\n ]\n )\n },\n\n props: {\n chartId: {\n default: chartId,\n type: String\n },\n width: {\n default: 400,\n type: Number\n },\n height: {\n default: 400,\n type: Number\n },\n cssClasses: {\n type: String,\n default: ''\n },\n styles: {\n type: Object\n },\n plugins: {\n type: Array,\n default () {\n return []\n }\n }\n },\n\n data () {\n return {\n _chart: null,\n _plugins: this.plugins\n }\n },\n\n methods: {\n addPlugin (plugin) {\n this.$data._plugins.push(plugin)\n },\n generateLegend () {\n if (this.$data._chart) {\n return this.$data._chart.generateLegend()\n }\n },\n renderChart (data, options) {\n if (this.$data._chart) this.$data._chart.destroy()\n this.$data._chart = new Chart(\n this.$refs.canvas.getContext('2d'), {\n type: chartType,\n data: data,\n options: options,\n plugins: this.$data._plugins\n }\n )\n }\n },\n beforeDestroy () {\n if (this.$data._chart) {\n this.$data._chart.destroy()\n }\n }\n }\n}\n\nexport const Bar = generateChart('bar-chart', 'bar')\nexport const HorizontalBar = generateChart('horizontalbar-chart', 'horizontalBar')\nexport const Doughnut = generateChart('doughnut-chart', 'doughnut')\nexport const Line = generateChart('line-chart', 'line')\nexport const Pie = generateChart('pie-chart', 'pie')\nexport const PolarArea = generateChart('polar-chart', 'polarArea')\nexport const Radar = generateChart('radar-chart', 'radar')\nexport const Bubble = generateChart('bubble-chart', 'bubble')\nexport const Scatter = generateChart('scatter-chart', 'scatter')\n\nexport default {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/BaseCharts.js","import mixins from './mixins/index.js'\n\nimport {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n generateChart\n} from './BaseCharts'\n\nconst VueCharts = {\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n mixins,\n generateChart,\n render: () => console.error('[vue-chartjs]: This is not a vue component. It is the whole object containing all vue components. Please import the named export or access the components over the dot notation. For more info visit https://vue-chartjs.org/#/home?id=quick-start')\n}\n\nexport default VueCharts\n\nexport {\n VueCharts,\n Bar,\n HorizontalBar,\n Doughnut,\n Line,\n Pie,\n PolarArea,\n Radar,\n Bubble,\n Scatter,\n mixins,\n generateChart\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":\"Chart\",\"commonjs\":\"chart.js\",\"commonjs2\":\"chart.js\",\"amd\":\"chart.js\"}\n// module id = 1\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file