mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-12 15:52:57 +00:00
feat: update echarts graphs style
This commit is contained in:
parent
6f1e3dc3ae
commit
8431115d60
@ -30,6 +30,7 @@ import { useDebounceFn } from "@vueuse/core";
|
|||||||
import { useEventListener } from "./useEventListener";
|
import { useEventListener } from "./useEventListener";
|
||||||
import { useBreakpoint } from "./useBreakpoint";
|
import { useBreakpoint } from "./useBreakpoint";
|
||||||
import echarts from "@/utils/echarts";
|
import echarts from "@/utils/echarts";
|
||||||
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
|
|
||||||
export type ECOption = echarts.ComposeOption<
|
export type ECOption = echarts.ComposeOption<
|
||||||
| BarSeriesOption
|
| BarSeriesOption
|
||||||
@ -44,8 +45,9 @@ export type ECOption = echarts.ComposeOption<
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
export function useECharts(elRef: Ref<HTMLDivElement>, theme: "light" | "dark" | "default" = "default"): Indexable {
|
export function useECharts(elRef: Ref<HTMLDivElement>, theme: "light" | "dark" | "default" = "default"): Indexable {
|
||||||
|
const appStore = useAppStoreWithOut();
|
||||||
const getDarkMode = computed(() => {
|
const getDarkMode = computed(() => {
|
||||||
return theme === "default" ? "light" : theme;
|
return appStore.theme === "default" ? "light" : theme;
|
||||||
});
|
});
|
||||||
let chartInstance: Nullable<echarts.ECharts> = null;
|
let chartInstance: Nullable<echarts.ECharts> = null;
|
||||||
let resizeFn: Fn = resize;
|
let resizeFn: Fn = resize;
|
||||||
|
@ -24,6 +24,7 @@ limitations under the License. -->
|
|||||||
import type { BarConfig, EventParams, RelatedTrace, Filters } from "@/types/dashboard";
|
import type { BarConfig, EventParams, RelatedTrace, Filters } from "@/types/dashboard";
|
||||||
import useLegendProcess from "@/hooks/useLegendProcessor";
|
import useLegendProcess from "@/hooks/useLegendProcessor";
|
||||||
import Legend from "./components/Legend.vue";
|
import Legend from "./components/Legend.vue";
|
||||||
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
/*global defineProps, defineEmits */
|
||||||
const emits = defineEmits(["click"]);
|
const emits = defineEmits(["click"]);
|
||||||
@ -46,6 +47,7 @@ limitations under the License. -->
|
|||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const appStore = useAppStoreWithOut();
|
||||||
const { showEchartsLegend, isRight, chartColors } = useLegendProcess(props.config.legend);
|
const { showEchartsLegend, isRight, chartColors } = useLegendProcess(props.config.legend);
|
||||||
const option = computed(() => getOption());
|
const option = computed(() => getOption());
|
||||||
|
|
||||||
@ -91,8 +93,11 @@ limitations under the License. -->
|
|||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
itemWidth: 12,
|
itemWidth: 12,
|
||||||
|
backgroundColor: appStore.theme === "dark" ? "#333" : "#fff",
|
||||||
|
borderColor: appStore.theme === "dark" ? "#333" : "#fff",
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: "#333",
|
fontSize: 12,
|
||||||
|
color: appStore.theme === "dark" ? "#eee" : "#333",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
|
@ -31,6 +31,7 @@ limitations under the License. -->
|
|||||||
import Legend from "./components/Legend.vue";
|
import Legend from "./components/Legend.vue";
|
||||||
import useLegendProcess from "@/hooks/useLegendProcessor";
|
import useLegendProcess from "@/hooks/useLegendProcessor";
|
||||||
import { isDef } from "@/utils/is";
|
import { isDef } from "@/utils/is";
|
||||||
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
/*global defineProps, defineEmits */
|
||||||
const emits = defineEmits(["click"]);
|
const emits = defineEmits(["click"]);
|
||||||
@ -40,7 +41,6 @@ limitations under the License. -->
|
|||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
intervalTime: { type: Array as PropType<string[]>, default: () => [] },
|
intervalTime: { type: Array as PropType<string[]>, default: () => [] },
|
||||||
theme: { type: String, default: "light" },
|
|
||||||
config: {
|
config: {
|
||||||
type: Object as PropType<
|
type: Object as PropType<
|
||||||
LineConfig & {
|
LineConfig & {
|
||||||
@ -62,6 +62,7 @@ limitations under the License. -->
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const appStore = useAppStoreWithOut();
|
||||||
const setRight = ref<boolean>(false);
|
const setRight = ref<boolean>(false);
|
||||||
const option = computed(() => getOption());
|
const option = computed(() => getOption());
|
||||||
function getOption() {
|
function getOption() {
|
||||||
@ -93,9 +94,11 @@ limitations under the License. -->
|
|||||||
const color: string[] = chartColors(keys);
|
const color: string[] = chartColors(keys);
|
||||||
const tooltip = {
|
const tooltip = {
|
||||||
trigger: "axis",
|
trigger: "axis",
|
||||||
|
backgroundColor: appStore.theme === "dark" ? "#333" : "#fff",
|
||||||
|
borderColor: appStore.theme === "dark" ? "#333" : "#fff",
|
||||||
textStyle: {
|
textStyle: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: "#333",
|
color: appStore.theme === "dark" ? "#eee" : "#333",
|
||||||
},
|
},
|
||||||
enterable: true,
|
enterable: true,
|
||||||
confine: true,
|
confine: true,
|
||||||
@ -108,9 +111,11 @@ limitations under the License. -->
|
|||||||
confine: true,
|
confine: true,
|
||||||
extraCssText: `height: 20px; padding:0 2px;`,
|
extraCssText: `height: 20px; padding:0 2px;`,
|
||||||
trigger: "axis",
|
trigger: "axis",
|
||||||
|
backgroundColor: appStore.theme === "dark" ? "#666" : "#eee",
|
||||||
|
borderColor: appStore.theme === "dark" ? "#666" : "#eee",
|
||||||
textStyle: {
|
textStyle: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: "#333",
|
color: appStore.theme === "dark" ? "#eee" : "#333",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -125,7 +130,7 @@ limitations under the License. -->
|
|||||||
left: 0,
|
left: 0,
|
||||||
itemWidth: 12,
|
itemWidth: 12,
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: props.theme === "dark" ? "#fff" : "#333",
|
color: appStore.theme === "dark" ? "#fff" : "#333",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
|
Loading…
Reference in New Issue
Block a user