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 {
|
export interface BarConfig {
|
||||||
type?: string;
|
type?: string;
|
||||||
showBackground?: boolean;
|
showBackground?: boolean;
|
||||||
LegendOptions?: LegendOptions;
|
legend?: LegendOptions;
|
||||||
}
|
}
|
||||||
export interface LineConfig extends AreaConfig {
|
export interface LineConfig extends AreaConfig {
|
||||||
type?: string;
|
type?: string;
|
||||||
@ -111,7 +111,7 @@ export interface LineConfig extends AreaConfig {
|
|||||||
export interface AreaConfig {
|
export interface AreaConfig {
|
||||||
type?: string;
|
type?: string;
|
||||||
opacity?: number;
|
opacity?: number;
|
||||||
LegendOptions?: LegendOptions;
|
legend?: LegendOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CardConfig {
|
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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<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>
|
<div>
|
||||||
<span class="label">{{ t("legendOptions") }}</span>
|
<span class="label">{{ t("legendOptions") }}</span>
|
||||||
<span class="title mr-5">{{ t("asTable") }}</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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
|
<div class="graph">
|
||||||
<Graph :option="option" @select="clickEvent" :filters="config.filters" />
|
<Graph :option="option" @select="clickEvent" :filters="config.filters" />
|
||||||
|
<Legend :config="config.legend" :data="data" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
@ -39,7 +42,8 @@ const props = defineProps({
|
|||||||
BarConfig & {
|
BarConfig & {
|
||||||
filters: Filters;
|
filters: Filters;
|
||||||
relatedTrace: RelatedTrace;
|
relatedTrace: RelatedTrace;
|
||||||
} & { id: string }
|
id: string;
|
||||||
|
}
|
||||||
>,
|
>,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
@ -160,3 +164,9 @@ function clickEvent(params: EventParams) {
|
|||||||
emits("click", params);
|
emits("click", params);
|
||||||
}
|
}
|
||||||
</script>
|
</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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
|
<div class="graph">
|
||||||
<Graph
|
<Graph
|
||||||
:option="option"
|
:option="option"
|
||||||
@select="clickEvent"
|
@select="clickEvent"
|
||||||
:filters="config.filters"
|
:filters="config.filters"
|
||||||
:relatedTrace="config.relatedTrace"
|
:relatedTrace="config.relatedTrace"
|
||||||
/>
|
/>
|
||||||
|
<Legend :config="config.legend" :data="data" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
@ -29,6 +32,7 @@ import {
|
|||||||
RelatedTrace,
|
RelatedTrace,
|
||||||
Filters,
|
Filters,
|
||||||
} from "@/types/dashboard";
|
} from "@/types/dashboard";
|
||||||
|
import Legend from "./components/Legend.vue";
|
||||||
|
|
||||||
/*global defineProps, defineEmits */
|
/*global defineProps, defineEmits */
|
||||||
const emits = defineEmits(["click"]);
|
const emits = defineEmits(["click"]);
|
||||||
@ -206,3 +210,9 @@ function clickEvent(params: EventParams) {
|
|||||||
emits("click", params);
|
emits("click", params);
|
||||||
}
|
}
|
||||||
</script>
|
</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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<div>legend</div>
|
<div></div>
|
||||||
</template>
|
</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