forked from apertureless/vue-chartjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue-chartjs.js.map
1 lines (1 loc) · 15.1 KB
/
vue-chartjs.js.map
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;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;AC7DA;AAEA;AAaA,IAAMA,YAAY;AAChB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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":""}