2026-09-12 01:33:07 +03:30
|
|
|
<script lang="ts">
|
2026-09-10 01:22:24 +03:30
|
|
|
import { use } from 'echarts/core';
|
|
|
|
|
import { CanvasRenderer } from 'echarts/renderers';
|
2026-09-12 01:33:07 +03:30
|
|
|
import { LineChart, PieChart, BarChart } from 'echarts/charts';
|
2026-09-10 01:22:24 +03:30
|
|
|
import {
|
|
|
|
|
GridComponent,
|
|
|
|
|
LegendComponent,
|
|
|
|
|
TooltipComponent,
|
2026-09-12 01:33:07 +03:30
|
|
|
TitleComponent,
|
2026-09-10 01:22:24 +03:30
|
|
|
} from 'echarts/components';
|
|
|
|
|
import type { ComposeOption } from 'echarts/core';
|
2026-09-12 01:33:07 +03:30
|
|
|
import type { LineSeriesOption, PieSeriesOption, BarSeriesOption } from 'echarts/charts';
|
2026-09-10 01:22:24 +03:30
|
|
|
import type {
|
|
|
|
|
GridComponentOption,
|
|
|
|
|
LegendComponentOption,
|
|
|
|
|
TooltipComponentOption,
|
2026-09-12 01:33:07 +03:30
|
|
|
TitleComponentOption,
|
2026-09-10 01:22:24 +03:30
|
|
|
} from 'echarts/components';
|
|
|
|
|
|
|
|
|
|
use([
|
|
|
|
|
CanvasRenderer,
|
|
|
|
|
LineChart,
|
|
|
|
|
PieChart,
|
2026-09-12 01:33:07 +03:30
|
|
|
BarChart,
|
2026-09-10 01:22:24 +03:30
|
|
|
GridComponent,
|
|
|
|
|
TooltipComponent,
|
|
|
|
|
LegendComponent,
|
2026-09-12 01:33:07 +03:30
|
|
|
TitleComponent,
|
2026-09-10 01:22:24 +03:30
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
export type UiChartOption = ComposeOption<
|
|
|
|
|
| LineSeriesOption
|
|
|
|
|
| PieSeriesOption
|
2026-09-12 01:33:07 +03:30
|
|
|
| BarSeriesOption
|
2026-09-10 01:22:24 +03:30
|
|
|
| GridComponentOption
|
|
|
|
|
| TooltipComponentOption
|
|
|
|
|
| LegendComponentOption
|
2026-09-12 01:33:07 +03:30
|
|
|
| TitleComponentOption
|
2026-09-10 01:22:24 +03:30
|
|
|
>;
|
|
|
|
|
|
2026-09-12 01:33:07 +03:30
|
|
|
/**
|
|
|
|
|
* Shared palette matching Montact CRM design tokens
|
|
|
|
|
*/
|
|
|
|
|
export const CHART_PALETTE = [
|
|
|
|
|
'#14b8a6', // Teal (Accent)
|
|
|
|
|
'#3b82f6', // Blue
|
|
|
|
|
'#f59e0b', // Amber
|
|
|
|
|
'#10b981', // Emerald
|
|
|
|
|
'#8b5cf6', // Violet
|
|
|
|
|
'#f43f5e', // Rose
|
|
|
|
|
'#06b6d4', // Cyan
|
|
|
|
|
'#eab308', // Yellow
|
|
|
|
|
];
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import VChart from 'vue-echarts';
|
|
|
|
|
|
2026-09-10 01:22:24 +03:30
|
|
|
withDefaults(
|
|
|
|
|
defineProps<{
|
|
|
|
|
option: UiChartOption;
|
|
|
|
|
height?: string;
|
2026-09-12 01:33:07 +03:30
|
|
|
loading?: boolean;
|
2026-09-10 01:22:24 +03:30
|
|
|
}>(),
|
2026-09-12 01:33:07 +03:30
|
|
|
{ height: '260px', loading: false },
|
2026-09-10 01:22:24 +03:30
|
|
|
);
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-09-12 01:33:07 +03:30
|
|
|
<div class="ui-chart-container" :style="{ height }">
|
|
|
|
|
<div v-if="loading" class="chart-loading">
|
|
|
|
|
<div class="chart-spinner"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<VChart v-else class="ui-chart" :option="option" autoresize />
|
|
|
|
|
</div>
|
2026-09-10 01:22:24 +03:30
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-09-12 01:33:07 +03:30
|
|
|
.ui-chart-container {
|
2026-09-10 01:22:24 +03:30
|
|
|
width: 100%;
|
|
|
|
|
min-width: 0;
|
2026-09-12 01:33:07 +03:30
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ui-chart {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.chart-loading {
|
|
|
|
|
position: absolute;
|
|
|
|
|
inset: 0;
|
|
|
|
|
display: grid;
|
|
|
|
|
place-items: center;
|
|
|
|
|
background: rgba(255, 255, 255, 0.7);
|
|
|
|
|
z-index: 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.chart-spinner {
|
|
|
|
|
width: 28px;
|
|
|
|
|
height: 28px;
|
|
|
|
|
border: 3px solid var(--line);
|
|
|
|
|
border-top-color: var(--accent);
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
animation: chart-spin 0.8s linear infinite;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes chart-spin {
|
|
|
|
|
to {
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
}
|
2026-09-10 01:22:24 +03:30
|
|
|
}
|
|
|
|
|
</style>
|