2025-08-24 21:23:02 +08:00
|
|
|
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
|
|
|
|
import { LineGraph01 } from './index'
|
|
|
|
import { CreateComponentType } from '@/packages/index.d'
|
|
|
|
import cloneDeep from 'lodash/cloneDeep'
|
|
|
|
import { chartInitConfig } from '@/settings/designSetting'
|
|
|
|
import dataJson from './data.json'
|
2025-09-08 17:25:49 +08:00
|
|
|
|
2025-08-24 21:23:02 +08:00
|
|
|
export interface DataSourceItem {
|
|
|
|
dataname: string;
|
|
|
|
values: number[];
|
|
|
|
datavalues: (string | number)[][];
|
|
|
|
}
|
|
|
|
export interface DatasType {
|
|
|
|
title: string;
|
|
|
|
names: string[];
|
|
|
|
tip: string;
|
|
|
|
dataIndex: number;
|
|
|
|
dataSource: DataSourceItem[];
|
|
|
|
}
|
|
|
|
|
2025-09-08 17:25:49 +08:00
|
|
|
const otherOption = {
|
|
|
|
titleText: '报警处置情况'
|
|
|
|
}
|
2025-08-24 21:23:02 +08:00
|
|
|
export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
|
|
|
|
export const seriesItem = {
|
|
|
|
type: 'line',
|
|
|
|
smooth: true,
|
|
|
|
symbol: 'none',
|
|
|
|
|
|
|
|
label: {
|
|
|
|
show: false,
|
|
|
|
position: 'top',
|
|
|
|
color: '#fff',
|
|
|
|
fontSize: 12
|
|
|
|
},
|
|
|
|
itemStyle: {
|
|
|
|
color: null,
|
|
|
|
borderRadius: 0
|
|
|
|
},
|
|
|
|
lineStyle: {
|
|
|
|
type: 'solid',
|
|
|
|
width: 2,
|
|
|
|
color: '#50BB9A'
|
|
|
|
},
|
|
|
|
areaStyle: {
|
|
|
|
color: {
|
|
|
|
type: 'linear',
|
|
|
|
x: 0,
|
|
|
|
y: 0,
|
|
|
|
x2: 0,
|
|
|
|
y2: 1,
|
|
|
|
colorStops: [{
|
|
|
|
offset: 0,
|
|
|
|
color: 'rgba(80,187,154,0.6)'
|
|
|
|
}, {
|
|
|
|
offset: 1,
|
|
|
|
color: 'rgba(80,187,154,0.3)'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export const option = {
|
2025-09-08 17:25:49 +08:00
|
|
|
...otherOption,
|
|
|
|
sceneCode: 'T04',
|
|
|
|
dateTime: {
|
|
|
|
selectValue: 'day',
|
|
|
|
dataset: [
|
|
|
|
{
|
|
|
|
label: '当天',
|
|
|
|
value: 'day'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '本周',
|
|
|
|
value: 'week'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '当月',
|
|
|
|
value: 'month'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '本季度',
|
|
|
|
value: 'quarter'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '当年',
|
|
|
|
value: 'year'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2025-08-24 21:23:02 +08:00
|
|
|
dataset: {
|
|
|
|
source: dataJson.dataSource[0].datavalues
|
|
|
|
},
|
|
|
|
grid: {
|
|
|
|
left: '15%',
|
|
|
|
right: '12%',
|
|
|
|
top: 9,
|
|
|
|
bottom: '25%'
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
boundaryGap: false,
|
|
|
|
axisLine: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
color: '#B7BFC6'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
yAxis: {
|
|
|
|
type: 'value',
|
|
|
|
axisLabel: {
|
|
|
|
formatter: '{value}s',
|
|
|
|
color: "#4C535B"
|
|
|
|
},
|
|
|
|
|
|
|
|
axisLine: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
series: [seriesItem]
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
|
|
|
public key: string = LineGraph01.key
|
|
|
|
public chartConfig = cloneDeep(LineGraph01)
|
|
|
|
public mockData = dataJson
|
|
|
|
// 图表配置项
|
|
|
|
public option = echartOptionProfixHandle(option, includes)
|
2025-09-08 17:53:35 +08:00
|
|
|
public attr = { ...chartInitConfig, x: 0, y: 0, w: 500, h: 325, zIndex: 1 }
|
2025-08-24 21:23:02 +08:00
|
|
|
}
|
|
|
|
|