mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 00:37:33 +00:00
add legend in line/bar/area graphs
This commit is contained in:
parent
42d2545e61
commit
5bfac6fdc9
4
src/types/dashboard.d.ts
vendored
4
src/types/dashboard.d.ts
vendored
@ -95,7 +95,7 @@ export type GraphConfig =
|
||||
export interface BarConfig {
|
||||
type?: string;
|
||||
showBackground?: boolean;
|
||||
LegendOptions?: LegendOptions;
|
||||
legend?: LegendOptions;
|
||||
}
|
||||
export interface LineConfig extends AreaConfig {
|
||||
type?: string;
|
||||
@ -111,7 +111,7 @@ export interface LineConfig extends AreaConfig {
|
||||
export interface AreaConfig {
|
||||
type?: string;
|
||||
opacity?: number;
|
||||
LegendOptions?: LegendOptions;
|
||||
legend?: LegendOptions;
|
||||
}
|
||||
|
||||
export interface CardConfig {
|
||||
|
@ -13,15 +13,6 @@ 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>
|
||||
<div>
|
||||
<span class="label">{{ t("showLegend") }}</span>
|
||||
<el-switch
|
||||
v-model="legend.showLegend"
|
||||
active-text="Yes"
|
||||
inactive-text="No"
|
||||
@change="updateLegendConfig({ showLegend: legend.showLegend })"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<span class="label">{{ t("legendOptions") }}</span>
|
||||
<span class="title mr-5">{{ t("asTable") }}</span>
|
||||
|
@ -13,7 +13,10 @@ 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" :filters="config.filters" />
|
||||
<div class="graph">
|
||||
<Graph :option="option" @select="clickEvent" :filters="config.filters" />
|
||||
<Legend :config="config.legend" :data="data" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
@ -39,7 +42,8 @@ const props = defineProps({
|
||||
BarConfig & {
|
||||
filters: Filters;
|
||||
relatedTrace: RelatedTrace;
|
||||
} & { id: string }
|
||||
id: string;
|
||||
}
|
||||
>,
|
||||
default: () => ({}),
|
||||
},
|
||||
@ -160,3 +164,9 @@ function clickEvent(params: EventParams) {
|
||||
emits("click", params);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.graph {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
@ -13,12 +13,15 @@ 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"
|
||||
:filters="config.filters"
|
||||
:relatedTrace="config.relatedTrace"
|
||||
/>
|
||||
<div class="graph">
|
||||
<Graph
|
||||
:option="option"
|
||||
@select="clickEvent"
|
||||
:filters="config.filters"
|
||||
:relatedTrace="config.relatedTrace"
|
||||
/>
|
||||
<Legend :config="config.legend" :data="data" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
@ -29,6 +32,7 @@ import {
|
||||
RelatedTrace,
|
||||
Filters,
|
||||
} from "@/types/dashboard";
|
||||
import Legend from "./components/Legend.vue";
|
||||
|
||||
/*global defineProps, defineEmits */
|
||||
const emits = defineEmits(["click"]);
|
||||
@ -206,3 +210,9 @@ function clickEvent(params: EventParams) {
|
||||
emits("click", params);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.graph {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
@ -13,6 +13,24 @@ 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>
|
||||
<div>legend</div>
|
||||
<div></div>
|
||||
</template>
|
||||
<script lang="ts" setup></script>
|
||||
<script lang="ts" setup>
|
||||
import type { PropType } from "vue";
|
||||
import { LegendOptions } from "@/types/dashboard";
|
||||
|
||||
/*global defineProps */
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object as PropType<{ [key: string]: number[] }>,
|
||||
default: () => ({}),
|
||||
},
|
||||
config: {
|
||||
type: Object as PropType<LegendOptions>,
|
||||
default: () => ({
|
||||
legend: {},
|
||||
}),
|
||||
},
|
||||
});
|
||||
// console.log(props);
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user