vue-highcharts
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -7,12 +7,11 @@ (function (global, factory) { | ||
HighchartsOnly = 'default' in HighchartsOnly ? HighchartsOnly['default'] : HighchartsOnly; | ||
HighchartsOnly = HighchartsOnly && HighchartsOnly.hasOwnProperty('default') ? HighchartsOnly['default'] : HighchartsOnly; | ||
var ctors = { | ||
highcharts: 'Chart', | ||
highstock: 'StockChart', | ||
highmaps: 'Map', | ||
'highcharts-renderer': 'Renderer' | ||
Highcharts: 'Chart', | ||
Highstock: 'StockChart', | ||
Highmaps: 'Map', | ||
HighchartsRenderer: 'Renderer' | ||
}; | ||
/* istanbul ignore next */ | ||
function clone(obj) { | ||
@@ -30,2 +29,3 @@ var copy; | ||
} | ||
/* istanbul ignore else */ | ||
if (obj instanceof Object) { | ||
@@ -54,3 +54,3 @@ copy = {}; | ||
} | ||
var isRenderer = tagName === 'highcharts-renderer'; | ||
var isRenderer = tagName === 'HighchartsRenderer'; | ||
var component = { | ||
@@ -57,0 +57,0 @@ name: tagName, |
@@ -1,1 +0,1 @@ | ||
(function(e,r){typeof exports==="object"&&typeof module!=="undefined"?module.exports=r(require("highcharts")):typeof define==="function"&&define.amd?define(["highcharts"],r):e.VueHighcharts=r(e.Highcharts)})(this,function(e){"use strict";e="default"in e?e["default"]:e;var r={highcharts:"Chart",highstock:"StockChart",highmaps:"Map","highcharts-renderer":"Renderer"};function t(e){var r;if(e===null||typeof e!=="object"){return e}if(e instanceof Array){r=[];for(var i=e.length-1;i>=0;i--){r[i]=t(e[i])}return r}if(e instanceof Object){r={};for(var h in e){r[h]=t(e[h])}return r}}function i(e){return e("div")}function h(e,h,n){var s=h[r[e]];if(!s){return h.win?null:{render:i}}var o=e==="highcharts-renderer";var a={name:e,props:o?{width:{type:Number,required:true},height:{type:Number,required:true}}:{options:{type:Object,required:true}},methods:{_initChart:function(){this._renderChart();if(o){this.$watch("width",this._renderChart);this.$watch("height",this._renderChart)}else{this.$watch("options",this._renderChart,{deep:true})}},_renderChart:function(){if(o){this.renderer&&this.$el.removeChild(this.renderer.box);this.renderer=new s(this.$el,this.width,this.height)}else{this.chart=new s(this.$el,t(this.options))}}},beforeDestroy:function(){if(o){this.$el.removeChild(this.renderer.box);for(var e in this.renderer){delete this.renderer[e]}this.renderer=null}else{this.chart.destroy()}}};var d=/^1\./.test(n.version);if(d){a.template="<div></div>";a.ready=function(){this._initChart()}}else{a.render=i;a.mounted=function(){this._initChart()}}return a}function n(t,i){var n=i&&i.Highcharts||e;t.prototype.Highcharts=n;for(var s in r){var o=h(s,n,t);o&&t.component(s,o)}}return n}); | ||
(function(e,r){typeof exports==="object"&&typeof module!=="undefined"?module.exports=r(require("highcharts")):typeof define==="function"&&define.amd?define(["highcharts"],r):e.VueHighcharts=r(e.Highcharts)})(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e["default"]:e;var r={Highcharts:"Chart",Highstock:"StockChart",Highmaps:"Map",HighchartsRenderer:"Renderer"};function t(e){var r;if(e===null||typeof e!=="object"){return e}if(e instanceof Array){r=[];for(var i=e.length-1;i>=0;i--){r[i]=t(e[i])}return r}if(e instanceof Object){r={};for(var n in e){r[n]=t(e[n])}return r}}function i(e){return e("div")}function n(e,n,h){var s=n[r[e]];if(!s){return n.win?null:{render:i}}var o=e==="HighchartsRenderer";var a={name:e,props:o?{width:{type:Number,required:true},height:{type:Number,required:true}}:{options:{type:Object,required:true}},methods:{_initChart:function(){this._renderChart();if(o){this.$watch("width",this._renderChart);this.$watch("height",this._renderChart)}else{this.$watch("options",this._renderChart,{deep:true})}},_renderChart:function(){if(o){this.renderer&&this.$el.removeChild(this.renderer.box);this.renderer=new s(this.$el,this.width,this.height)}else{this.chart=new s(this.$el,t(this.options))}}},beforeDestroy:function(){if(o){this.$el.removeChild(this.renderer.box);for(var e in this.renderer){delete this.renderer[e]}this.renderer=null}else{this.chart.destroy()}}};var d=/^1\./.test(h.version);if(d){a.template="<div></div>";a.ready=function(){this._initChart()}}else{a.render=i;a.mounted=function(){this._initChart()}}return a}function h(t,i){var h=i&&i.Highcharts||e;t.prototype.Highcharts=h;for(var s in r){var o=n(s,h,t);o&&t.component(s,o)}}return h}); |
{ | ||
"name": "vue-highcharts", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Highcharts component for Vue", | ||
@@ -13,3 +13,4 @@ "main": "dist/vue-highcharts.js", | ||
"lint": "eslint src test", | ||
"test": "npm run lint && karma start", | ||
"unit": "karma start", | ||
"test": "npm run lint && npm run unit", | ||
"bundle": "rollup src/index.js -f umd -n VueHighcharts -g highcharts:Highcharts -o dist/vue-highcharts.js", | ||
@@ -44,18 +45,18 @@ "minify": "uglifyjs dist/vue-highcharts.js -m -o dist/vue-highcharts.min.js", | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"eslint": "^3.19.0", | ||
"eslint-config-google": "^0.7.1", | ||
"highcharts": "^5.0.10", | ||
"karma": "^1.6.0", | ||
"chai": "^4.1.2", | ||
"eslint": "^4.8.0", | ||
"eslint-config-google": "^0.9.1", | ||
"highcharts": "^6.0.1", | ||
"karma": "^1.7.1", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-coverage": "^1.1.1", | ||
"karma-mocha": "^1.3.0", | ||
"karma-phantomjs-launcher": "^1.0.4", | ||
"karma-rollup-plugin": "^0.2.4", | ||
"mocha": "^3.3.0", | ||
"phantomjs-prebuilt": "^2.1.14", | ||
"rollup": "^0.41.6", | ||
"uglify-js": "^2.8.22", | ||
"vue": "^2.3.0" | ||
"karma-rollup-preprocessor": "^5.0.1", | ||
"mocha": "^4.0.1", | ||
"rollup": "^0.50.0", | ||
"rollup-plugin-istanbul": "^1.1.0", | ||
"uglify-js": "^3.1.3", | ||
"vue": "^2.4.4" | ||
} | ||
} |
# vue-highcharts | ||
[](https://travis-ci.org/weizhenye/vue-highcharts) | ||
[](https://coveralls.io/github/weizhenye/vue-highcharts?branch=master) | ||
[](https://codecov.io/gh/weizhenye/vue-highcharts) | ||
[](https://david-dm.org/weizhenye/vue-highcharts) | ||
@@ -35,23 +35,25 @@ [](https://www.npmjs.com/package/vue-highcharts) | ||
If you want to use Highstock, Highmaps or any other add-ons, you should pass in the `Highcharts` object [which included the corresponding modules](http://www.highcharts.com/docs/getting-started/install-from-npm). | ||
If you want to use Highstock, Highmaps or any other add-ons, you should pass in the `Highcharts` object [which included the corresponding modules](https://www.highcharts.com/docs/getting-started/install-from-npm). | ||
```js | ||
// Use Highstock | ||
import Vue from 'vue'; | ||
import VueHighcharts from 'vue-highcharts'; | ||
import Highcharts from 'highcharts/highstock'; | ||
import Highcharts from 'highcharts'; | ||
Vue.use(VueHighcharts, { Highcharts }); | ||
``` | ||
```js | ||
// Use Highstock and Highmaps | ||
import Vue from 'vue'; | ||
import VueHighcharts from 'vue-highcharts'; | ||
import Highcharts from 'highcharts/highstock'; | ||
// load these modules as your need | ||
import loadStock from 'highcharts/modules/stock'; | ||
import loadMap from 'highcharts/modules/map'; | ||
import loadDrilldown from 'highcharts/modules/drilldown'; | ||
// some charts like solid gauge require `highcharts-more.js`, you can find it in official demo. | ||
import loadHighchartsMore from 'highcharts/highcharts-more'; | ||
import loadSolidGauge from 'highcharts/modules/solid-gauge'; | ||
loadStock(Highcharts); | ||
loadMap(Highcharts); | ||
loadDrilldown(Highcharts); | ||
loadHighchartsMore(Highcharts); | ||
loadSolidGauge(Highcharts); | ||
Vue.use(VueHighcharts, { Highcharts }); | ||
// Now you can use Highstock, Highmaps, drilldown and solid gauge. | ||
``` | ||
@@ -68,5 +70,5 @@ | ||
The `options` object can be found in [Highcharts API Reference](http://api.highcharts.com/highcharts). Note you should never pass in `chart.renderTo` for watching it may cause stack overflow. | ||
The `options` object can be found in [Highcharts API Reference](https://api.highcharts.com/highcharts). Note you should never pass in `chart.renderTo` for watching it may cause stack overflow. | ||
`<highcharts-renderer>` [creates an independent renderer](http://api.highcharts.com/highcharts/Renderer). | ||
`<highcharts-renderer>` [creates an independent renderer](https://api.highcharts.com/class-reference/Highcharts.SVGRenderer). | ||
@@ -73,0 +75,0 @@ The `Highcharts` object is available at `vm.Highcharts`. If you want to access the `chart` or `renderer` instance, you can use child component refs: |
@@ -1,2 +0,1 @@ | ||
/* istanbul ignore next */ | ||
export default function clone(obj) { | ||
@@ -14,2 +13,3 @@ var copy; | ||
} | ||
/* istanbul ignore else */ | ||
if (obj instanceof Object) { | ||
@@ -16,0 +16,0 @@ copy = {}; |
export default { | ||
highcharts: 'Chart', | ||
highstock: 'StockChart', | ||
highmaps: 'Map', | ||
'highcharts-renderer': 'Renderer' | ||
Highcharts: 'Chart', | ||
Highstock: 'StockChart', | ||
Highmaps: 'Map', | ||
HighchartsRenderer: 'Renderer' | ||
}; |
@@ -18,3 +18,3 @@ import clone from './clone.js'; | ||
} | ||
var isRenderer = tagName === 'highcharts-renderer'; | ||
var isRenderer = tagName === 'HighchartsRenderer'; | ||
var component = { | ||
@@ -21,0 +21,0 @@ name: tagName, |
14200
90