+
+
+
+
diff --git a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue
index 9c6345989..99c06d43c 100644
--- a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue
+++ b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue
@@ -1,13 +1,209 @@
-
+
-
-
diff --git a/nezha-fronted/src/components/chart/chart/legend.vue b/nezha-fronted/src/components/chart/chart/legend.vue
new file mode 100644
index 000000000..58fa4aaf6
--- /dev/null
+++ b/nezha-fronted/src/components/chart/chart/legend.vue
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+ {{item.alias ? item.alias : item.name}}
+
+
{{statistics.value}}
+
+
+
+
+
+
+ {{item.alias ? item.alias : item.name}}
+
+
+
+
+
+
+
+
diff --git a/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js b/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js
index ea8d3025a..2ca399b85 100644
--- a/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js
+++ b/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js
@@ -1,7 +1,97 @@
+import { initColor } from '@/components/chart/chart/tools'
export const chartTimeSeriesLineOption = {
-
+ title: {
+ show: false
+ },
+ legend: {
+ show: false
+ },
+ toolbox: {
+ show: false
+ },
+ tooltip: {
+ trigger: 'axis',
+ confine: false,
+ extraCssText: 'z-index:1000;'
+ // formatter: 动态生成
+ },
+ color: initColor(),
+ grid: {
+ left: 20,
+ right: 20,
+ top: 20,
+ bottom: 10,
+ containLabel: true
+ },
+ xAxis: {
+ type: 'time',
+ animation: false,
+ showAllSymbol: false,
+ axisLabel: {
+ interval: '0',
+ showMaxLabel: false,
+ rotate: 0,
+ show: true,
+ fontSize: 10
+ // formatter: 动态生成
+ },
+ axisPointer: { // y轴上显示指针对应的值
+ show: true
+ },
+ splitLine: {
+ show: true,
+ lineStyle: {
+ color: '#d9d9d9',
+ opacity: 0.8,
+ width: 1
+ }
+ },
+ axisLine: {
+ show: false
+ },
+ axisTick: {
+ show: false
+ }
+ },
+ yAxis: {
+ type: 'value',
+ splitLine: {
+ show: true,
+ lineStyle: {
+ color: '#d9d9d9',
+ opacity: 0.8,
+ width: 1
+ }
+ },
+ // 去掉y轴
+ axisLine: {
+ show: false
+ },
+ axisTick: {
+ show: false
+ },
+ axisLabel: {
+ show: true,
+ fontSize: 10
+ // formatter: 动态生成
+ }
+ },
+ series: [{
+ name: '',
+ type: 'line',
+ symbol: 'emptyCircle', // 去掉点
+ symbolSize: [2, 2],
+ smooth: 0.2, // 曲线变平滑
+ showSymbol: false,
+ data: [],
+ lineStyle: {
+ width: 1,
+ opacity: 0.9
+ }
+ }],
+ useUTC: false // 使用本地时间
}
-export const chartTimeSeriesBarOption = {
+export const chartTimeSeriesAreaOption = {
}
export const chartTimeSeriesScatterOption = {
diff --git a/nezha-fronted/src/components/chart/chart/options/index.js b/nezha-fronted/src/components/chart/chart/options/index.js
deleted file mode 100644
index 52473da2d..000000000
--- a/nezha-fronted/src/components/chart/chart/options/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import chartBarOption from './chartBar'
-import chartGaugeOption from './chartGauge'
-import chartPieOption from './chartPie'
-import { chartTimeSeriesLineOption, chartTimeSeriesBarOption, chartTimeSeriesScatterOption } from './chartTimeSeries'
-import chartTreemapOption from './chartTreemap'
-
-export default { chartBarOption, chartGaugeOption, chartPieOption, chartTimeSeriesLineOption, chartTimeSeriesBarOption, chartTimeSeriesScatterOption, chartTreemapOption }
diff --git a/nezha-fronted/src/components/chart/chart/tools.js b/nezha-fronted/src/components/chart/chart/tools.js
new file mode 100644
index 000000000..e6f09e0ad
--- /dev/null
+++ b/nezha-fronted/src/components/chart/chart/tools.js
@@ -0,0 +1,66 @@
+import { chartType } from '@/components/common/js/constants'
+import chartBarOption from './options/chartBar'
+import chartGaugeOption from './options/chartGauge'
+import chartPieOption from './options/chartPie'
+import lodash from 'lodash'
+import {
+ chartTimeSeriesLineOption,
+ chartTimeSeriesScatterOption,
+ chartTimeSeriesAreaOption
+} from './options/chartTimeSeries'
+import chartTreemapOption from './options/chartTreemap'
+import {randomcolor} from "@/components/common/js/radomcolor/randomcolor";
+
+export function getOption (type) {
+ let chartOption = null
+ switch (type) {
+ case chartType.stackArea: {
+ chartOption = lodash.cloneDeep(chartTimeSeriesAreaOption)
+ break
+ }
+ case chartType.point: {
+ chartOption = lodash.cloneDeep(chartTimeSeriesScatterOption)
+ break
+ }
+ case chartType.line: {
+ chartOption = lodash.cloneDeep(chartTimeSeriesLineOption)
+ break
+ }
+ case chartType.bar: {
+ chartOption = lodash.cloneDeep(chartBarOption)
+ break
+ }
+ case chartType.gauge: {
+ chartOption = lodash.cloneDeep(chartGaugeOption)
+ break
+ }
+ case chartType.pie: {
+ chartOption = lodash.cloneDeep(chartPieOption)
+ break
+ }
+ case chartType.treemap: {
+ chartOption = lodash.cloneDeep(chartTreemapOption)
+ break
+ }
+ default: break
+ }
+ return chartOption
+}
+
+export function isTimeSeries (type) {
+ return type === chartType.line || type === chartType.stackArea || type === chartType.point
+}
+
+export function initColor (colorNum = 20) {
+ const colorList = [
+ '#FF5200', '#3685FF', '#FF8D00', '#00DCA2',
+ '#954Eff', '#FFCB01', '#f65A96', '#00BFD0',
+ '#FF8BEA', '#4D7693', '#72577C', '#99D750',
+ '#DD8270', '#C475EE', '#7E83FB', '#7EB090',
+ '#FF9094', '#00CCF5', '#CF6684', '#4E55FF'
+ ]
+ for (let i = 0; i < colorNum - 20; i++) {
+ colorList.push(randomcolor())
+ }
+ return colorList
+}
diff --git a/nezha-fronted/src/components/chart/chartList.vue b/nezha-fronted/src/components/chart/chartList.vue
index c588bc886..fba7c4b85 100644
--- a/nezha-fronted/src/components/chart/chartList.vue
+++ b/nezha-fronted/src/components/chart/chartList.vue
@@ -11,7 +11,7 @@
:vertical-compact="true"
>
@@ -43,10 +44,6 @@