weizhenye / vue-highcharts

:bar_chart: Highcharts component for Vue
MIT License
414 stars 53 forks source link

how to extend it #50

Closed dfy167 closed 6 years ago

dfy167 commented 6 years ago

i have been extend it : ``

<script> import defaultOptions from './chartsOptions' import deepAssign from 'deep-assign'

export default { props: { options: Object, type: { type: String, default: 'normal' } }, computed: { chartOptions: function () { if (this.type === 'sparkline') { return defaultOptions.sparkline // return deepAssign({}, defaultOptions.sparkline, this.options || {}) } else if (this.type === 'normal') { return deepAssign({}, defaultOptions.normal, this.options || {}) } else { return this.options } } }, mounted () { console.log(this.chartOptions) } } `

use it `

data () { return { options: {} }

created () { this.options={ series: [{ type: 'column', name: ' ', data: [[1516204800000, 3.0], [1516287600000, 6.9], [1516291200000, 9.5]], borderWidth: 0 }]} } `

and defaultOptions have some optionsset. but defaultOptions seens to be no effect.

weizhenye commented 6 years ago

I think this is not related to vue-highcharts.

I suggest you:

dfy167 commented 6 years ago

thanks . is not related to vue-highcharts . Rewrite defaultOptions and it works