mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 19:23:16 +00:00
feat: visualize Snapshot
on Alerting page (#444)
This commit is contained in:
parent
55b3867bea
commit
8ea50c8680
@ -24,6 +24,7 @@ export const Alarm = {
|
|||||||
message
|
message
|
||||||
startTime
|
startTime
|
||||||
scope
|
scope
|
||||||
|
name
|
||||||
tags {
|
tags {
|
||||||
key
|
key
|
||||||
value
|
value
|
||||||
@ -43,6 +44,35 @@ export const Alarm = {
|
|||||||
startTime
|
startTime
|
||||||
endTime
|
endTime
|
||||||
}
|
}
|
||||||
|
snapshot {
|
||||||
|
expression
|
||||||
|
metrics {
|
||||||
|
name
|
||||||
|
results {
|
||||||
|
metric {
|
||||||
|
labels {
|
||||||
|
key
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
id
|
||||||
|
owner {
|
||||||
|
scope
|
||||||
|
serviceID
|
||||||
|
serviceName
|
||||||
|
normal
|
||||||
|
serviceInstanceID
|
||||||
|
serviceInstanceName
|
||||||
|
endpointID
|
||||||
|
endpointName
|
||||||
|
}
|
||||||
|
value
|
||||||
|
traceID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
};
|
};
|
||||||
|
47
src/hooks/useSnapshot.ts
Normal file
47
src/hooks/useSnapshot.ts
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
import type { MetricsResults } from "@/types/dashboard";
|
||||||
|
|
||||||
|
export function useSnapshot(metrics: { name: string; results: MetricsResults[] }[]) {
|
||||||
|
function processResults() {
|
||||||
|
const sources = metrics.map((metric: { name: string; results: MetricsResults[] }) => {
|
||||||
|
const values = metric.results.map(
|
||||||
|
(r: { values: { value: string }[]; metric: { labels: { key: string; value: string }[] } }) => {
|
||||||
|
const arr = r.values.map((v: { value: string }) => Number(v.value));
|
||||||
|
if (!r.metric.labels.length) {
|
||||||
|
return { values: arr };
|
||||||
|
}
|
||||||
|
const name = r.metric.labels
|
||||||
|
.map(
|
||||||
|
(label: { key: string; value: string }) =>
|
||||||
|
`${metric.name}${label ? "{" : ""}${label.key}=${label.value}${label ? "}" : ""}`,
|
||||||
|
)
|
||||||
|
.join(",");
|
||||||
|
return { name, values: arr };
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
return { name: metric.name, values };
|
||||||
|
});
|
||||||
|
|
||||||
|
return sources;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
processResults,
|
||||||
|
};
|
||||||
|
}
|
@ -395,5 +395,7 @@ const msg = {
|
|||||||
profilingEvents: "Async Profiling Events",
|
profilingEvents: "Async Profiling Events",
|
||||||
execArgs: "Exec Args",
|
execArgs: "Exec Args",
|
||||||
instances: "Instances",
|
instances: "Instances",
|
||||||
|
snapshot: "Snapshot",
|
||||||
|
expression: "Expression",
|
||||||
};
|
};
|
||||||
export default msg;
|
export default msg;
|
||||||
|
@ -395,5 +395,7 @@ const msg = {
|
|||||||
profilingEvents: "Async Profiling Events",
|
profilingEvents: "Async Profiling Events",
|
||||||
execArgs: "Exec Args",
|
execArgs: "Exec Args",
|
||||||
instances: "Instances",
|
instances: "Instances",
|
||||||
|
snapshot: "Snapshot",
|
||||||
|
expression: "Expression",
|
||||||
};
|
};
|
||||||
export default msg;
|
export default msg;
|
||||||
|
@ -393,5 +393,7 @@ const msg = {
|
|||||||
profilingEvents: "异步分析事件",
|
profilingEvents: "异步分析事件",
|
||||||
execArgs: "String任务扩展",
|
execArgs: "String任务扩展",
|
||||||
instances: "实例",
|
instances: "实例",
|
||||||
|
snapshot: "快照",
|
||||||
|
expression: "表达式",
|
||||||
};
|
};
|
||||||
export default msg;
|
export default msg;
|
||||||
|
1
src/types/alarm.d.ts
vendored
1
src/types/alarm.d.ts
vendored
@ -27,6 +27,7 @@ export interface Alarm {
|
|||||||
scope: string;
|
scope: string;
|
||||||
tags: Array<{ key: string; value: string }>;
|
tags: Array<{ key: string; value: string }>;
|
||||||
events: Event[];
|
events: Event[];
|
||||||
|
snapshot: Indexable;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Event {
|
export interface Event {
|
||||||
|
16
src/types/dashboard.d.ts
vendored
16
src/types/dashboard.d.ts
vendored
@ -111,6 +111,8 @@ export interface LineConfig extends AreaConfig {
|
|||||||
showYAxis?: boolean;
|
showYAxis?: boolean;
|
||||||
smallTips?: boolean;
|
smallTips?: boolean;
|
||||||
showlabels?: boolean;
|
showlabels?: boolean;
|
||||||
|
noTooltips?: boolean;
|
||||||
|
showLegend?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AreaConfig {
|
export interface AreaConfig {
|
||||||
@ -197,3 +199,17 @@ export type LegendOptions = {
|
|||||||
toTheRight: boolean;
|
toTheRight: boolean;
|
||||||
width: number;
|
width: number;
|
||||||
};
|
};
|
||||||
|
export type MetricsResults = {
|
||||||
|
metric: { labels: MetricLabel[] };
|
||||||
|
values: MetricValue[];
|
||||||
|
};
|
||||||
|
type MetricLabel = {
|
||||||
|
key: string;
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
type MetricValue = {
|
||||||
|
name: string;
|
||||||
|
value: string;
|
||||||
|
owner: null | string;
|
||||||
|
refId: null | string;
|
||||||
|
};
|
||||||
|
@ -22,15 +22,17 @@ limitations under the License. -->
|
|||||||
<div class="message mb-5 b">
|
<div class="message mb-5 b">
|
||||||
{{ i.message }}
|
{{ i.message }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="flex-h">
|
||||||
class="timeline-table-i-scope mr-10 l sm"
|
<div
|
||||||
:class="{
|
class="timeline-table-i-scope"
|
||||||
blue: i.scope === 'Service',
|
:class="{
|
||||||
green: i.scope === 'Endpoint',
|
blue: i.scope === 'Service',
|
||||||
yellow: i.scope === 'ServiceInstance',
|
green: i.scope === 'Endpoint',
|
||||||
}"
|
yellow: i.scope === 'ServiceInstance',
|
||||||
>
|
}"
|
||||||
{{ t(i.scope.toLowerCase()) }}
|
>
|
||||||
|
{{ t(i.scope.toLowerCase()) }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grey sm show-xs">
|
<div class="grey sm show-xs">
|
||||||
{{ dateFormat(parseInt(i.startTime)) }}
|
{{ dateFormat(parseInt(i.startTime)) }}
|
||||||
@ -46,7 +48,7 @@ limitations under the License. -->
|
|||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@closed="isShowDetails = false"
|
@closed="isShowDetails = false"
|
||||||
>
|
>
|
||||||
<div class="mb-10 clear alarm-detail" v-for="(item, index) in AlarmDetailCol" :key="index">
|
<div class="mb-20 clear alarm-detail" v-for="(item, index) in AlarmDetailCol" :key="index">
|
||||||
<span class="g-sm-2 grey">{{ t(item.value) }}:</span>
|
<span class="g-sm-2 grey">{{ t(item.value) }}:</span>
|
||||||
<span v-if="item.label === 'startTime'">
|
<span v-if="item.label === 'startTime'">
|
||||||
{{ dateFormat(currentDetail[item.label]) }}
|
{{ dateFormat(currentDetail[item.label]) }}
|
||||||
@ -54,7 +56,7 @@ limitations under the License. -->
|
|||||||
<span v-else-if="item.label === 'tags'">
|
<span v-else-if="item.label === 'tags'">
|
||||||
<div v-for="(d, index) in alarmTags" :key="index">{{ d }}</div>
|
<div v-for="(d, index) in alarmTags" :key="index">{{ d }}</div>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.label === 'events'" class="event-detail">
|
<span v-else-if="item.label === 'events'">
|
||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
@ -75,6 +77,12 @@ limitations under the License. -->
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
<span v-else-if="item.label === 'expression'">
|
||||||
|
{{ currentDetail.snapshot.expression }}
|
||||||
|
</span>
|
||||||
|
<span v-else-if="item.label === 'snapshot'">
|
||||||
|
<Snapshot :snapshot="currentDetail.snapshot" />
|
||||||
|
</span>
|
||||||
<span v-else>{{ currentDetail[item.label] }}</span>
|
<span v-else>{{ currentDetail[item.label] }}</span>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -85,7 +93,7 @@ limitations under the License. -->
|
|||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@closed="showEventDetails = false"
|
@closed="showEventDetails = false"
|
||||||
>
|
>
|
||||||
<div class="event-detail">
|
<div>
|
||||||
<div class="mb-10" v-for="(eventKey, index) in EventsDetailKeys" :key="index">
|
<div class="mb-10" v-for="(eventKey, index) in EventsDetailKeys" :key="index">
|
||||||
<span class="keys">{{ t(eventKey.text) }}</span>
|
<span class="keys">{{ t(eventKey.text) }}</span>
|
||||||
<span v-if="eventKey.class === 'parameters'">
|
<span v-if="eventKey.class === 'parameters'">
|
||||||
@ -117,6 +125,7 @@ limitations under the License. -->
|
|||||||
import { useAlarmStore } from "@/store/modules/alarm";
|
import { useAlarmStore } from "@/store/modules/alarm";
|
||||||
import { EventsDetailHeaders, AlarmDetailCol, EventsDetailKeys } from "./data";
|
import { EventsDetailHeaders, AlarmDetailCol, EventsDetailKeys } from "./data";
|
||||||
import { dateFormat } from "@/utils/dateFormat";
|
import { dateFormat } from "@/utils/dateFormat";
|
||||||
|
import Snapshot from "./components/Snapshot.vue";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const alarmStore = useAlarmStore();
|
const alarmStore = useAlarmStore();
|
||||||
@ -186,11 +195,10 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
|
|
||||||
.timeline-table-i-scope {
|
.timeline-table-i-scope {
|
||||||
display: inline-block;
|
padding: 0 5px;
|
||||||
padding: 0 8px;
|
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
margin-top: -1px;
|
border-radius: 3px;
|
||||||
border-radius: 4px;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeline-item {
|
.timeline-item {
|
||||||
@ -224,9 +232,6 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
|
|
||||||
.alarm-detail {
|
.alarm-detail {
|
||||||
max-height: 600px;
|
|
||||||
overflow: auto;
|
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
min-height: 100px;
|
min-height: 100px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -247,4 +252,9 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mini-chart {
|
||||||
|
height: 20px;
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
141
src/views/alarm/components/Line.vue
Normal file
141
src/views/alarm/components/Line.vue
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
||||||
|
<template>
|
||||||
|
<Graph :option="option" @select="clickEvent" />
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from "vue";
|
||||||
|
import type { PropType } from "vue";
|
||||||
|
import type { EventParams } from "@/types/dashboard";
|
||||||
|
import useLegendProcess from "@/hooks/useLegendProcessor";
|
||||||
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
|
import { Themes } from "@/constants/data";
|
||||||
|
|
||||||
|
/*global defineProps, defineEmits */
|
||||||
|
const emits = defineEmits(["click"]);
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Array as PropType<any>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
intervalTime: { type: Array as PropType<string[]>, default: () => [] },
|
||||||
|
});
|
||||||
|
const appStore = useAppStoreWithOut();
|
||||||
|
const option = computed(() => getOption());
|
||||||
|
function getOption() {
|
||||||
|
const { chartColors } = useLegendProcess();
|
||||||
|
const color: string[] = chartColors();
|
||||||
|
const series = [];
|
||||||
|
const grid = [];
|
||||||
|
const xAxis = [];
|
||||||
|
const yAxis = [];
|
||||||
|
for (const [index, metric] of props.data.entries()) {
|
||||||
|
grid.push({
|
||||||
|
top: 300 * index + 30,
|
||||||
|
left: 0,
|
||||||
|
right: 10,
|
||||||
|
bottom: 5,
|
||||||
|
containLabel: true,
|
||||||
|
height: 260,
|
||||||
|
});
|
||||||
|
xAxis.push({
|
||||||
|
type: "category",
|
||||||
|
show: true,
|
||||||
|
axisTick: {
|
||||||
|
lineStyle: { color: "#c1c5ca41" },
|
||||||
|
alignWithLabel: true,
|
||||||
|
},
|
||||||
|
splitLine: { show: false },
|
||||||
|
axisLine: { lineStyle: { color: "rgba(0,0,0,0)" } },
|
||||||
|
axisLabel: { color: "#9da5b2", fontSize: "11" },
|
||||||
|
gridIndex: index,
|
||||||
|
});
|
||||||
|
yAxis.push({
|
||||||
|
type: "value",
|
||||||
|
axisLine: { show: false },
|
||||||
|
axisTick: { show: false },
|
||||||
|
splitLine: { lineStyle: { color: "#c1c5ca41", type: "dashed" } },
|
||||||
|
axisLabel: {
|
||||||
|
color: "#9da5b2",
|
||||||
|
fontSize: "11",
|
||||||
|
show: true,
|
||||||
|
},
|
||||||
|
gridIndex: index,
|
||||||
|
});
|
||||||
|
for (const item of metric.values) {
|
||||||
|
series.push({
|
||||||
|
data: item.values.map((item: number, itemIndex: number) => [props.intervalTime[itemIndex], item]),
|
||||||
|
name: item.name || metric.name,
|
||||||
|
type: "line",
|
||||||
|
symbol: "circle",
|
||||||
|
symbolSize: 4,
|
||||||
|
xAxisIndex: index,
|
||||||
|
yAxisIndex: index,
|
||||||
|
lineStyle: {
|
||||||
|
width: 2,
|
||||||
|
type: "solid",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const tooltip = {
|
||||||
|
trigger: "axis",
|
||||||
|
backgroundColor: appStore.theme === Themes.Dark ? "#333" : "#fff",
|
||||||
|
borderColor: appStore.theme === Themes.Dark ? "#333" : "#fff",
|
||||||
|
textStyle: {
|
||||||
|
fontSize: 12,
|
||||||
|
color: appStore.theme === Themes.Dark ? "#eee" : "#333",
|
||||||
|
},
|
||||||
|
enterable: true,
|
||||||
|
confine: true,
|
||||||
|
extraCssText: "max-height:85%; overflow: auto;",
|
||||||
|
axisPointer: {
|
||||||
|
animation: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
color,
|
||||||
|
tooltip,
|
||||||
|
axisPointer: {
|
||||||
|
link: { xAxisIndex: "all" },
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
type: "scroll",
|
||||||
|
icon: "circle",
|
||||||
|
top: -5,
|
||||||
|
left: 0,
|
||||||
|
itemWidth: 12,
|
||||||
|
textStyle: {
|
||||||
|
color: appStore.theme === Themes.Dark ? "#fff" : "#333",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
grid,
|
||||||
|
xAxis,
|
||||||
|
yAxis,
|
||||||
|
series,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function clickEvent(params: EventParams) {
|
||||||
|
emits("click", params);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.snapshot-charts {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
35
src/views/alarm/components/Snapshot.vue
Normal file
35
src/views/alarm/components/Snapshot.vue
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
||||||
|
<template>
|
||||||
|
<LineChart
|
||||||
|
:intervalTime="appStore.intervalTime"
|
||||||
|
:data="metrics"
|
||||||
|
:style="{ width: `800px`, height: `${metrics.length * 300}px` }"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from "vue";
|
||||||
|
import { useSnapshot } from "@/hooks/useSnapshot";
|
||||||
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
|
import LineChart from "./Line.vue";
|
||||||
|
|
||||||
|
/*global defineProps */
|
||||||
|
const props = defineProps({
|
||||||
|
snapshot: { type: Object, default: () => {} },
|
||||||
|
});
|
||||||
|
const { processResults } = useSnapshot(props.snapshot.metrics);
|
||||||
|
const metrics = computed(() => processResults());
|
||||||
|
const appStore = useAppStoreWithOut();
|
||||||
|
</script>
|
@ -52,6 +52,14 @@ export const AlarmDetailCol = [
|
|||||||
label: "events",
|
label: "events",
|
||||||
value: "eventDetail",
|
value: "eventDetail",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "expression",
|
||||||
|
value: "expression",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "snapshot",
|
||||||
|
value: "snapshot",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const EventsDetailKeys = [
|
export const EventsDetailKeys = [
|
||||||
|
@ -60,6 +60,8 @@ limitations under the License. -->
|
|||||||
showYAxis: true,
|
showYAxis: true,
|
||||||
smallTips: false,
|
smallTips: false,
|
||||||
showlabels: true,
|
showlabels: true,
|
||||||
|
noTooltips: false,
|
||||||
|
showLegend: true,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -69,10 +71,12 @@ limitations under the License. -->
|
|||||||
function getOption() {
|
function getOption() {
|
||||||
const { showEchartsLegend, isRight, chartColors } = useLegendProcess(props.config.legend);
|
const { showEchartsLegend, isRight, chartColors } = useLegendProcess(props.config.legend);
|
||||||
setRight.value = isRight;
|
setRight.value = isRight;
|
||||||
const keys = Object.keys(props.data || {}).filter((i: any) => Array.isArray(props.data[i]) && props.data[i].length);
|
const keys = Object.keys(props.data || {}).filter(
|
||||||
const temp = keys.map((i: any) => {
|
(i: string) => Array.isArray(props.data[i]) && props.data[i].length,
|
||||||
|
);
|
||||||
|
const temp = keys.map((i: string) => {
|
||||||
const serie: any = {
|
const serie: any = {
|
||||||
data: props.data[i].map((item: any, itemIndex: number) => [props.intervalTime[itemIndex], item]),
|
data: props.data[i].map((item: number, itemIndex: number) => [props.intervalTime[itemIndex], item]),
|
||||||
name: i,
|
name: i,
|
||||||
type: "line",
|
type: "line",
|
||||||
symbol: "circle",
|
symbol: "circle",
|
||||||
@ -95,6 +99,7 @@ limitations under the License. -->
|
|||||||
const color: string[] = chartColors();
|
const color: string[] = chartColors();
|
||||||
const tooltip = {
|
const tooltip = {
|
||||||
trigger: "axis",
|
trigger: "axis",
|
||||||
|
show: !props.config.noTooltips,
|
||||||
backgroundColor: appStore.theme === Themes.Dark ? "#333" : "#fff",
|
backgroundColor: appStore.theme === Themes.Dark ? "#333" : "#fff",
|
||||||
borderColor: appStore.theme === Themes.Dark ? "#333" : "#fff",
|
borderColor: appStore.theme === Themes.Dark ? "#333" : "#fff",
|
||||||
textStyle: {
|
textStyle: {
|
||||||
@ -106,10 +111,10 @@ limitations under the License. -->
|
|||||||
extraCssText: "max-height:85%; overflow: auto;",
|
extraCssText: "max-height:85%; overflow: auto;",
|
||||||
};
|
};
|
||||||
const tips = {
|
const tips = {
|
||||||
|
show: !props.config.noTooltips,
|
||||||
formatter(params: any) {
|
formatter(params: any) {
|
||||||
return `${params[0].value[1]}`;
|
return `${params[0].value[1]}`;
|
||||||
},
|
},
|
||||||
confine: true,
|
|
||||||
extraCssText: `height: 20px; padding:0 2px;`,
|
extraCssText: `height: 20px; padding:0 2px;`,
|
||||||
trigger: "axis",
|
trigger: "axis",
|
||||||
backgroundColor: appStore.theme === Themes.Dark ? "#666" : "#eee",
|
backgroundColor: appStore.theme === Themes.Dark ? "#666" : "#eee",
|
||||||
@ -125,7 +130,7 @@ limitations under the License. -->
|
|||||||
tooltip: props.config.smallTips ? tips : tooltip,
|
tooltip: props.config.smallTips ? tips : tooltip,
|
||||||
legend: {
|
legend: {
|
||||||
type: "scroll",
|
type: "scroll",
|
||||||
show: showEchartsLegend(keys),
|
show: props.config.showLegend ? showEchartsLegend(keys) : false,
|
||||||
icon: "circle",
|
icon: "circle",
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user