1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- const defaultOptions = {
- title: {
- text: '',
- left: 'left',
- top: 0,
- textStyle: {
- fontSize: 17
- }
- },
- textStyle: {
- color: '#909090'
- },
- grid: {
- top: 37,
- left: 40,
- right: 20,
- bottom: 20
- },
- color: ["#17D2D2", "#738EFE"],
- legend: {
- left: 'right',
- itemWidth: 14,
- icon: 'roundRect',
- textStyle: {
- fontSize: 11
- }
- },
- tooltip: {
- show: true,
- trigger: 'axis'
- // formatter: "{c} {d}"
- },
- xAxis: {
- type: 'category',
- // boundaryGap: false,
- data: [],
- boundaryGap: false,
- axisTick: {
- show: false
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#e5e5e5'
- }
- },
- splitLine: {
- lineStyle: {
- color: '#e5e5e5'
- }
- },
- axisLabel: {
- showMaxLabel: true
- }
- },
- yAxis: {
- type: 'value',
- minInterval: 1,
- axisTick: {
- show: false
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#e5e5e5'
- }
- },
- axisLabel: {
- margin: 7,
- formatter (value) {
- return value.toString()
- }
- },
- splitLine: {
- lineStyle: {
- color: '#e5e5e5'
- }
- }
- }
- }
- function isObject (value) {
- return Object.prototype.toString.call(value) === '[object Object]'
- }
- export function mergeOptions (options, defaultOption=defaultOptions) {
- Object.keys(defaultOption).forEach(item => {
- if (!options[item]) {
- options[item] = defaultOption[item]
- } else {
- if (isObject(options[item])) {
- mergeOptions(options[item], defaultOption[item])
- }
- }
- })
- return options
- }
|