de/frontend/src/views/chart/chart/chart.js
2021-10-14 18:06:19 +08:00

856 lines
13 KiB
JavaScript

export const DEFAULT_COLOR_CASE = {
value: 'default',
colors: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],
alpha: 100,
tableHeaderBgColor: '#4e81bb',
tableItemBgColor: '#c6d9f0',
tableFontColor: '#000000',
tableStripe: true,
dimensionColor: '#000000',
quotaColor: '#000000'
}
export const DEFAULT_SIZE = {
barDefault: true,
barWidth: 40,
barGap: 0.4,
lineWidth: 1,
lineType: 'solid',
lineSymbol: 'emptyCircle',
lineSymbolSize: 4,
lineSmooth: false,
lineArea: false,
pieInnerRadius: 0,
pieOuterRadius: 80,
pieRoseType: 'radius',
pieRoseRadius: 5,
funnelWidth: 80,
radarShape: 'polygon',
radarSize: 80,
tableTitleFontSize: 12,
tableItemFontSize: 12,
tableTitleHeight: 36,
tableItemHeight: 36,
gaugeMin: 0,
gaugeMax: 100,
gaugeStartAngle: 225,
gaugeEndAngle: -45,
dimensionFontSize: 18,
quotaFontSize: 18,
spaceSplit: 10,
dimensionShow: true,
quotaShow: true,
scatterSymbol: 'circle',
scatterSymbolSize: 20,
treemapWidth: 80,
treemapHeight: 80,
liquidMax: 100,
liquidSize: 80,
liquidOutlineBorder: 4,
liquidOutlineDistance: 8,
liquidWaveLength: 128,
liquidWaveCount: 3,
liquidShape: 'circle'
}
export const DEFAULT_LABEL = {
show: false,
position: 'top',
color: '#909399',
fontSize: '10',
formatter: '{c}',
gaugeFormatter: '{value}',
labelLine: {
show: true
}
}
export const DEFAULT_TOOLTIP = {
show: true,
trigger: 'item',
confine: true,
textStyle: {
fontSize: '10',
color: '#909399'
},
formatter: ''
}
export const DEFAULT_TITLE_STYLE = {
show: true,
fontSize: '18',
color: '#303133',
hPosition: 'center',
vPosition: 'top',
isItalic: false,
isBolder: false
}
export const DEFAULT_LEGEND_STYLE = {
show: true,
hPosition: 'center',
vPosition: 'bottom',
orient: 'horizontal',
icon: 'circle',
textStyle: {
color: '#333333',
fontSize: '12'
}
}
export const DEFAULT_XAXIS_STYLE = {
show: true,
position: 'bottom',
name: '',
nameTextStyle: {
color: '#333333',
fontSize: 12
},
axisLabel: {
show: true,
color: '#333333',
fontSize: '12',
rotate: 0,
formatter: '{value}'
},
splitLine: {
show: false,
lineStyle: {
color: '#cccccc',
width: 1,
style: 'solid'
}
},
axisValue: {
auto: true,
min: null,
max: null,
split: null,
splitCount: null
}
}
export const DEFAULT_YAXIS_STYLE = {
show: true,
position: 'left',
name: '',
nameTextStyle: {
color: '#333333',
fontSize: 12
},
axisLabel: {
show: true,
color: '#333333',
fontSize: '12',
rotate: 0,
formatter: '{value}'
},
splitLine: {
show: true,
lineStyle: {
color: '#cccccc',
width: 1,
style: 'solid'
}
},
axisValue: {
auto: true,
min: null,
max: null,
split: null,
splitCount: null
}
}
export const DEFAULT_YAXIS_EXT_STYLE = {
show: true,
position: 'right',
name: '',
nameTextStyle: {
color: '#333333',
fontSize: 12
},
axisLabel: {
show: true,
color: '#333333',
fontSize: '12',
rotate: 0,
formatter: '{value}'
},
splitLine: {
show: true,
lineStyle: {
color: '#cccccc',
width: 1,
style: 'solid'
}
},
axisValue: {
auto: true,
min: null,
max: null,
split: null,
splitCount: null
}
}
export const DEFAULT_BACKGROUND_COLOR = {
color: '#ffffff',
alpha: 100,
borderRadius: 5
}
export const DEFAULT_SPLIT = {
name: {
show: true,
color: '#999999',
fontSize: '12'
},
splitNumber: 5,
axisLine: {
show: true,
lineStyle: {
color: '#999999',
width: 1,
type: 'solid'
}
},
axisTick: {
show: false,
length: 5,
lineStyle: {
color: '#999999',
width: 1,
type: 'solid'
}
},
axisLabel: {
show: false,
rotate: 0,
margin: 8,
color: '#999999',
fontSize: '12',
formatter: '{value}'
},
splitLine: {
show: true,
lineStyle: {
color: '#999999',
width: 1,
type: 'solid'
}
},
splitArea: {
show: true
}
}
// chart config
export const BASE_BAR = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect',
data: []
},
xAxis: {
data: []
},
yAxis: {
type: 'value'
},
series: [],
dataZoom: [
{
type: 'slider',
show: false,
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'slider',
show: false,
yAxisIndex: [0],
left: '93%',
start: 0,
end: 100
},
{
type: 'inside',
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'inside',
yAxisIndex: [0],
start: 0,
end: 100
}
]
}
export const HORIZONTAL_BAR = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect',
data: []
},
xAxis: {
type: 'value'
},
yAxis: {
data: []
},
series: [],
dataZoom: [
{
type: 'slider',
show: false,
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'slider',
show: false,
yAxisIndex: [0],
left: '93%',
start: 0,
end: 100
},
{
type: 'inside',
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'inside',
yAxisIndex: [0],
start: 0,
end: 100
}
]
}
export const BASE_LINE = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect',
data: []
},
xAxis: {
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
series: [],
dataZoom: [
{
type: 'slider',
show: false,
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'slider',
show: false,
yAxisIndex: [0],
left: '93%',
start: 0,
end: 100
},
{
type: 'inside',
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'inside',
yAxisIndex: [0],
start: 0,
end: 100
}
]
}
export const BASE_PIE = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect'
},
series: [
{
name: '',
type: 'pie',
radius: ['0%', '60%'],
avoidLabelOverlap: false,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
data: []
}
]
}
export const BASE_FUNNEL = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {
trigger: 'item'
},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect'
},
series: [
{
name: '',
type: 'funnel',
left: 'center',
top: 60,
bottom: 60,
width: '80%',
min: 0,
max: 100,
minSize: '0%',
maxSize: '100%',
sort: 'descending',
gap: 1,
// label: {
// show: true,
// position: 'inside'
// },
labelLine: {
length: 10,
lineStyle: {
width: 1,
type: 'solid'
}
},
itemStyle: {
borderColor: '#fff',
borderWidth: 1
},
emphasis: {
label: {
fontSize: 20
}
},
data: []
}
]
}
export const BASE_RADAR = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect',
data: []
},
radar: {
shape: 'polygon',
name: {
show: true,
color: '#999999',
fontSize: '12'
},
splitNumber: 5,
axisLine: {
show: true,
lineStyle: {
color: '#999999',
width: 1,
type: 'solid'
}
},
axisTick: {
show: false,
length: 5,
lineStyle: {
color: '#999999',
width: 1,
type: 'solid'
}
},
axisLabel: {
show: false,
rotate: 0,
margin: 8,
color: '#999999',
fontSize: '12',
formatter: '{value}'
},
splitLine: {
show: true,
lineStyle: {
color: '#999999',
width: 1,
type: 'solid'
}
},
splitArea: {
show: true
},
indicator: []
},
series: []
}
export const BASE_GAUGE = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect'
},
series: [
{
name: '',
type: 'gauge',
startAngle: 225,
endAngle: -45,
min: 0,
max: 100,
progress: {
show: true
},
detail: {
show: true,
valueAnimation: true,
formatter: '{value}'
},
data: []
}
]
}
export const BASE_CHART_STRING = {
stylePriority: 'view',
xaxis: '[]',
yaxis: '[]',
show: true,
type: 'panel',
title: '',
customAttr: JSON.stringify({
color: DEFAULT_COLOR_CASE,
tableColor: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
}),
customStyle: JSON.stringify({
text: DEFAULT_TITLE_STYLE,
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
yAxisExt: DEFAULT_YAXIS_EXT_STYLE,
background: DEFAULT_BACKGROUND_COLOR
}),
customFilter: '[]'
}
export const BASE_CHART = {
xaxis: [],
yaxis: [],
show: true,
type: 'panel',
title: '',
customAttr: {
color: DEFAULT_COLOR_CASE,
tableColor: DEFAULT_COLOR_CASE,
size: DEFAULT_SIZE,
label: DEFAULT_LABEL,
tooltip: DEFAULT_TOOLTIP
},
customStyle: {
text: DEFAULT_TITLE_STYLE,
legend: DEFAULT_LEGEND_STYLE,
xAxis: DEFAULT_XAXIS_STYLE,
yAxis: DEFAULT_YAXIS_STYLE,
yAxisExt: DEFAULT_YAXIS_EXT_STYLE,
background: DEFAULT_BACKGROUND_COLOR
},
customFilter: []
}
export const BASE_MAP = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
tooltip: {},
visualMap: {
min: 50,
max: 52,
text: ['High', 'Low'],
realtime: false,
calculable: true,
inRange: {
color: ['lightskyblue', 'yellow', 'orangered']
},
right: 0
},
// legend: {},
series: [
{
name: '',
type: 'map',
map: 'MAP',
roam: true,
// label: {
// show: true
// },
data: []
}
]
}
export const BASE_SCATTER = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect',
data: []
},
xAxis: {
data: [],
boundaryGap: false
},
yAxis: {
type: 'value'
},
series: [],
dataZoom: [
{
type: 'slider',
show: false,
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'slider',
show: false,
yAxisIndex: [0],
left: '93%',
start: 0,
end: 100
},
{
type: 'inside',
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'inside',
yAxisIndex: [0],
start: 0,
end: 100
}
]
}
export const BASE_TREEMAP = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect'
},
series: [
{
// name: '',
type: 'treemap',
itemStyle: {
gapWidth: 2
},
breadcrumb: {
show: false
},
// radius: ['0%', '60%'],
// avoidLabelOverlap: false,
// emphasis: {
// itemStyle: {
// shadowBlur: 10,
// shadowOffsetX: 0,
// shadowColor: 'rgba(0, 0, 0, 0.5)'
// }
// },
data: []
}
]
}
export const BASE_MIX = {
title: {
text: '',
textStyle: {
fontWeight: 'normal'
}
},
grid: {
containLabel: true
},
tooltip: {},
legend: {
show: true,
type: 'scroll',
itemWidth: 10,
itemHeight: 10,
icon: 'rect',
data: []
},
xAxis: {
data: []
},
yAxis: [
{
type: 'value'
},
{
type: 'value'
}
],
series: [],
dataZoom: [
{
type: 'slider',
show: false,
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'slider',
show: false,
yAxisIndex: [0],
left: '93%',
start: 0,
end: 100
},
{
type: 'inside',
xAxisIndex: [0],
start: 0,
end: 100
},
{
type: 'inside',
yAxisIndex: [0],
start: 0,
end: 100
}
]
}