mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-23 09:50:23 +08:00
!80 feat: 折线图和柱状图添加网格配置,xy轴标签偏移量
Merge pull request !80 from jiangcheng/dev
This commit is contained in:
commit
9c9bc98216
@ -51,6 +51,9 @@
|
|||||||
<setting-item name="大小">
|
<setting-item name="大小">
|
||||||
<n-input-number v-model:value="xAxis.axisLabel.fontSize" :min="8" size="small"></n-input-number>
|
<n-input-number v-model:value="xAxis.axisLabel.fontSize" :min="8" size="small"></n-input-number>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
|
<setting-item name="偏移量">
|
||||||
|
<n-input-number v-model:value="xAxis.axisLabel.rotate" :min="-90" :max="90" size="small"></n-input-number>
|
||||||
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
<setting-item-box name="轴线">
|
<setting-item-box name="轴线">
|
||||||
<setting-item name="展示">
|
<setting-item name="展示">
|
||||||
@ -140,6 +143,9 @@
|
|||||||
<setting-item name="大小">
|
<setting-item name="大小">
|
||||||
<n-input-number v-model:value="yAxis.axisLabel.fontSize" :min="8" size="small"></n-input-number>
|
<n-input-number v-model:value="yAxis.axisLabel.fontSize" :min="8" size="small"></n-input-number>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
|
<setting-item name="偏移量">
|
||||||
|
<n-input-number v-model:value="yAxis.axisLabel.rotate" :min="-90" :max="90" size="small"></n-input-number>
|
||||||
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
<setting-item-box name="轴线">
|
<setting-item-box name="轴线">
|
||||||
<setting-item name="展示">
|
<setting-item name="展示">
|
||||||
@ -210,6 +216,23 @@
|
|||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
</collapse-item>
|
</collapse-item>
|
||||||
|
|
||||||
|
<collapse-item v-if="grid" name="网格">
|
||||||
|
<setting-item-box name="容器距离">
|
||||||
|
<setting-item name="左侧距离">
|
||||||
|
<n-input v-model:value="grid.left" size="small"></n-input>
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="右侧距离">
|
||||||
|
<n-input v-model:value="grid.right" size="small"></n-input>
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="上侧距离">
|
||||||
|
<n-input v-model:value="grid.top" size="small"></n-input>
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="下侧距离">
|
||||||
|
<n-input v-model:value="grid.bottom" size="small"></n-input>
|
||||||
|
</setting-item>
|
||||||
|
</setting-item-box>
|
||||||
|
</collapse-item>
|
||||||
|
|
||||||
<collapse-item v-if="visualMap" name="视觉映射">
|
<collapse-item v-if="visualMap" name="视觉映射">
|
||||||
<template #header>
|
<template #header>
|
||||||
<n-switch v-model:value="visualMap.show" size="small"></n-switch>
|
<n-switch v-model:value="visualMap.show" size="small"></n-switch>
|
||||||
@ -289,6 +312,10 @@ const legend = computed(() => {
|
|||||||
return props.optionData.legend
|
return props.optionData.legend
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const grid = computed(() => {
|
||||||
|
return props.optionData.grid
|
||||||
|
})
|
||||||
|
|
||||||
const visualMap = computed(() => {
|
const visualMap = computed(() => {
|
||||||
return props.optionData.visualMap
|
return props.optionData.visualMap
|
||||||
})
|
})
|
||||||
|
@ -4,15 +4,15 @@ import { CreateComponentType } from '@/packages/index.d'
|
|||||||
import cloneDeep from 'lodash/cloneDeep'
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
export const seriesItem = {
|
export const seriesItem = {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: 15,
|
barWidth: 15,
|
||||||
label:{
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
position: 'top',
|
position: 'top',
|
||||||
color: "#fff",
|
color: '#fff',
|
||||||
fontSize: 12,
|
fontSize: 12
|
||||||
},
|
},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: null,
|
color: null,
|
||||||
@ -31,6 +31,13 @@ export const option = {
|
|||||||
legend: {
|
legend: {
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
|
grid: {
|
||||||
|
show: false,
|
||||||
|
left: '10%',
|
||||||
|
top: '60',
|
||||||
|
right: '10%',
|
||||||
|
bottom: '60'
|
||||||
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
show: true,
|
show: true,
|
||||||
type: 'category'
|
type: 'category'
|
||||||
|
@ -4,7 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
|
|||||||
import cloneDeep from 'lodash/cloneDeep'
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
export const seriesItem = {
|
export const seriesItem = {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: null,
|
barWidth: null,
|
||||||
@ -31,6 +31,13 @@ export const option = {
|
|||||||
legend: {
|
legend: {
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
|
grid: {
|
||||||
|
show: false,
|
||||||
|
left: '10%',
|
||||||
|
top: '60',
|
||||||
|
right: '10%',
|
||||||
|
bottom: '60'
|
||||||
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
show: true,
|
show: true,
|
||||||
type: 'value'
|
type: 'value'
|
||||||
|
@ -4,7 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
|
|||||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
export const seriesItem = {
|
export const seriesItem = {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
label: {
|
label: {
|
||||||
@ -21,7 +21,7 @@ export const seriesItem = {
|
|||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'solid',
|
type: 'solid',
|
||||||
width: 3,
|
width: 3,
|
||||||
color: null,
|
color: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,6 +36,13 @@ export const option = {
|
|||||||
legend: {
|
legend: {
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
|
grid: {
|
||||||
|
show: false,
|
||||||
|
left: '10%',
|
||||||
|
top: '60',
|
||||||
|
right: '10%',
|
||||||
|
bottom: '60'
|
||||||
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
show: true,
|
show: true,
|
||||||
type: 'category'
|
type: 'category'
|
||||||
|
@ -5,7 +5,7 @@ import { graphic } from 'echarts/core'
|
|||||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
@ -18,9 +18,16 @@ const options = {
|
|||||||
legend: {
|
legend: {
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
|
grid: {
|
||||||
|
show: false,
|
||||||
|
left: '10%',
|
||||||
|
top: '60',
|
||||||
|
right: '10%',
|
||||||
|
bottom: '60'
|
||||||
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
show: true,
|
show: true,
|
||||||
type: 'category',
|
type: 'category'
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
show: true,
|
show: true,
|
||||||
@ -32,11 +39,11 @@ const options = {
|
|||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: false,
|
smooth: false,
|
||||||
symbolSize: 5, //设定实心点的大小
|
symbolSize: 5, //设定实心点的大小
|
||||||
label:{
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
position: 'top',
|
position: 'top',
|
||||||
color: "#fff",
|
color: '#fff',
|
||||||
fontSize: 12,
|
fontSize: 12
|
||||||
},
|
},
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'solid',
|
type: 'solid',
|
||||||
@ -59,8 +66,7 @@ const options = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Config extends PublicConfigClass
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
implements CreateComponentType {
|
|
||||||
public key: string = LineGradientSingleConfig.key
|
public key: string = LineGradientSingleConfig.key
|
||||||
public chartConfig = LineGradientSingleConfig
|
public chartConfig = LineGradientSingleConfig
|
||||||
// 图表配置项
|
// 图表配置项
|
||||||
|
@ -5,12 +5,19 @@ import { graphic } from 'echarts/core'
|
|||||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
legend: {
|
legend: {
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
|
grid: {
|
||||||
|
show: false,
|
||||||
|
left: '10%',
|
||||||
|
top: '60',
|
||||||
|
right: '10%',
|
||||||
|
bottom: '60'
|
||||||
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
show: true,
|
show: true,
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
|
@ -4,7 +4,7 @@ import { CreateComponentType } from '@/packages/index.d'
|
|||||||
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
|
||||||
import dataJson from './data.json'
|
import dataJson from './data.json'
|
||||||
|
|
||||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
||||||
|
|
||||||
export const option = {
|
export const option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
@ -17,6 +17,13 @@ export const option = {
|
|||||||
legend: {
|
legend: {
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
|
grid: {
|
||||||
|
show: false,
|
||||||
|
left: '10%',
|
||||||
|
top: '60',
|
||||||
|
right: '10%',
|
||||||
|
bottom: '60'
|
||||||
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
show: true,
|
show: true,
|
||||||
type: 'category'
|
type: 'category'
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
"axisLabel": {
|
"axisLabel": {
|
||||||
"show": true,
|
"show": true,
|
||||||
"fontSize": 12,
|
"fontSize": 12,
|
||||||
"color": "#B9B8CE"
|
"color": "#B9B8CE",
|
||||||
|
"rotate": 0
|
||||||
},
|
},
|
||||||
"position": "bottom",
|
"position": "bottom",
|
||||||
"axisLine": {
|
"axisLine": {
|
||||||
@ -58,7 +59,8 @@
|
|||||||
"axisLabel": {
|
"axisLabel": {
|
||||||
"show": true,
|
"show": true,
|
||||||
"fontSize": 12,
|
"fontSize": 12,
|
||||||
"color": "#B9B8CE"
|
"color": "#B9B8CE",
|
||||||
|
"rotate": 0
|
||||||
},
|
},
|
||||||
"position": "left",
|
"position": "left",
|
||||||
"axisLine": {
|
"axisLine": {
|
||||||
@ -88,5 +90,12 @@
|
|||||||
"textStyle": {
|
"textStyle": {
|
||||||
"color": "#B9B8CE"
|
"color": "#B9B8CE"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"grid": {
|
||||||
|
"show": false,
|
||||||
|
"left": "10%",
|
||||||
|
"top": "60",
|
||||||
|
"right": "10%",
|
||||||
|
"bottom": "60"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user