mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 09:00:50 +00:00
add mark area on graph
This commit is contained in:
parent
810393b304
commit
24f3bdd2b3
@ -46,8 +46,12 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
type: Object as PropType<{
|
type: Object as PropType<{
|
||||||
value: number | string;
|
duration: {
|
||||||
dataIndex: number;
|
startTime: string;
|
||||||
|
endTime: string;
|
||||||
|
};
|
||||||
|
isRange: boolean;
|
||||||
|
dataIndex?: number;
|
||||||
sourceId: string;
|
sourceId: string;
|
||||||
}>,
|
}>,
|
||||||
},
|
},
|
||||||
@ -110,9 +114,39 @@ watch(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (props.filters) {
|
if (props.filters) {
|
||||||
|
if (props.filters.isRange) {
|
||||||
|
const markArea = {
|
||||||
|
silent: true,
|
||||||
|
itemStyle: {
|
||||||
|
opacity: 0.3,
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
xAxis: props.filters.duration.startTime,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xAxis: props.filters.duration.endTime,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const series = props.option.series;
|
||||||
|
for (const [key, temp] of series.entries()) {
|
||||||
|
if (key === 0) {
|
||||||
|
temp.markArea = markArea;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const options = {
|
||||||
|
...props.option,
|
||||||
|
series,
|
||||||
|
};
|
||||||
|
setOptions(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
instance.dispatchAction({
|
instance.dispatchAction({
|
||||||
type: "showTip",
|
type: "showTip",
|
||||||
dataIndex: props.filters.dataIndex,
|
dataIndex: props.filters.dataIndex || undefined,
|
||||||
seriesIndex: 0,
|
seriesIndex: 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import {
|
|||||||
DataZoomComponent,
|
DataZoomComponent,
|
||||||
VisualMapComponent,
|
VisualMapComponent,
|
||||||
TimelineComponent,
|
TimelineComponent,
|
||||||
|
MarkAreaComponent,
|
||||||
} from "echarts/components";
|
} from "echarts/components";
|
||||||
|
|
||||||
import { SVGRenderer } from "echarts/renderers";
|
import { SVGRenderer } from "echarts/renderers";
|
||||||
@ -43,6 +44,7 @@ echarts.use([
|
|||||||
DataZoomComponent,
|
DataZoomComponent,
|
||||||
VisualMapComponent,
|
VisualMapComponent,
|
||||||
TimelineComponent,
|
TimelineComponent,
|
||||||
|
MarkAreaComponent,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export default echarts;
|
export default echarts;
|
||||||
|
@ -20,6 +20,14 @@ limitations under the License. -->
|
|||||||
@change="updateConfig"
|
@change="updateConfig"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
<el-button size="small" @click="cancelConfig">
|
||||||
|
{{ t("cancel") }}
|
||||||
|
</el-button>
|
||||||
|
<el-button size="small" type="primary" @click="applyConfig">
|
||||||
|
{{ t("apply") }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
@ -28,6 +36,7 @@ import { useDashboardStore } from "@/store/modules/dashboard";
|
|||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
|
const originConfig = dashboardStore.selectedGrid;
|
||||||
const eventAssociate = ref(dashboardStore.selectedGrid.eventAssociate || false);
|
const eventAssociate = ref(dashboardStore.selectedGrid.eventAssociate || false);
|
||||||
|
|
||||||
function updateConfig() {
|
function updateConfig() {
|
||||||
@ -37,6 +46,16 @@ function updateConfig() {
|
|||||||
};
|
};
|
||||||
dashboardStore.selectWidget(dashboardStore.selectedGrid);
|
dashboardStore.selectWidget(dashboardStore.selectedGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applyConfig() {
|
||||||
|
dashboardStore.setConfigPanel(false);
|
||||||
|
dashboardStore.setConfigs(dashboardStore.selectedGrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelConfig() {
|
||||||
|
dashboardStore.selectWidget(originConfig);
|
||||||
|
dashboardStore.setConfigPanel(false);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.label {
|
.label {
|
||||||
@ -49,4 +68,15 @@ function updateConfig() {
|
|||||||
.item {
|
.item {
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: right;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -33,9 +33,13 @@ const props = defineProps({
|
|||||||
type: Object as PropType<
|
type: Object as PropType<
|
||||||
LineConfig & {
|
LineConfig & {
|
||||||
filters: {
|
filters: {
|
||||||
value: number | string;
|
|
||||||
dataIndex: number;
|
|
||||||
sourceId: string;
|
sourceId: string;
|
||||||
|
duration: {
|
||||||
|
startTime: string;
|
||||||
|
endTime: string;
|
||||||
|
};
|
||||||
|
isRange: boolean;
|
||||||
|
dataIndex?: number;
|
||||||
};
|
};
|
||||||
} & { id: string }
|
} & { id: string }
|
||||||
>,
|
>,
|
||||||
|
@ -112,16 +112,11 @@ function visTimeline() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
const index = properties.items[0];
|
const index = properties.items[0];
|
||||||
const i = items[index];
|
const i = events[index - 1 || 0];
|
||||||
|
|
||||||
for (const widget of widgets) {
|
for (const widget of widgets) {
|
||||||
const startTime: string = dateFormatTime(
|
const startTime = dateFormatTime(i.start, appStore.duration.step);
|
||||||
new Date(i.startTime),
|
const endTime = dateFormatTime(i.end, appStore.duration.step);
|
||||||
appStore.duration.step
|
|
||||||
);
|
|
||||||
const endTime: string = dateFormatTime(
|
|
||||||
new Date(i.endTime),
|
|
||||||
appStore.duration.step
|
|
||||||
);
|
|
||||||
widget.filters = {
|
widget.filters = {
|
||||||
sourceId: dashboardStore.selectedGrid.id || "",
|
sourceId: dashboardStore.selectedGrid.id || "",
|
||||||
isRange: true,
|
isRange: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user