Closed dfy167 closed 6 years ago
I think this is not related to vue-highcharts.
I suggest you:
chartOptions
is when actually computed, and check chartOptions
whether it's satisfied with Highcharts API.defaultOptions
to a function to avoid changing it accidentally. Something like:
function getDefaultOptions() {
return {
sparkline: {
// ...
},
normal: {
// ...
},
};
}
thanks . is not related to vue-highcharts . Rewrite defaultOptions and it works
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.