260202_01_ENH: route 구조 초창기 기획으로 다시 변경 및 Category 별 하위 페이지에 샘플 데이터 모두 적용

This commit is contained in:
2026-02-02 11:32:50 +09:00
parent 4b40c43962
commit 6f8e09bcf3
60 changed files with 1750 additions and 464 deletions

View File

@@ -6,6 +6,14 @@ import BaseEChart from "../BaseEChart";
import {ChartData, ShowLabel, ValueFormatter} from "../types";
import { buildLgPalette } from "../color";
import {getIsShowLabel} from "@/components/lge-dashboard/chart/utill";
import {
createDefaultTooltip,
createDefaultLegend,
createDefaultGrid,
createCategoryAxis,
createValueAxis,
} from "@/lib/chart-options";
import { BAR_WIDTHS } from "@/const/chartConst";
type Props = {
data: ChartData;
@@ -41,24 +49,13 @@ const HorizontalBar = ({
const option: EChartsOption = useMemo(() => {
const fmt = valueFormatter ?? ((v: number) => String(v));
const defaultTooltip: EChartsOption["tooltip"] = {
trigger: "axis",
axisPointer: { type: "shadow" },
valueFormatter: (v: unknown) => (typeof v === "number" ? fmt(v) : String(v)),
};
const defaultLegend: EChartsOption["legend"] = { top: 0 };
const defaultGrid: EChartsOption["grid"] = { left: 16, right: 16, top: 36, bottom: 12, containLabel: true };
const defaultXAxis: EChartsOption["xAxis"] = { type: "value" };
const defaultYAxis: EChartsOption["yAxis"] = { type: "category", data: data.categories };
return {
color: palette,
tooltip: tooltip ?? defaultTooltip,
legend: legend ?? defaultLegend,
grid: grid ?? defaultGrid,
xAxis: xAxis ?? defaultXAxis,
yAxis: yAxis ?? defaultYAxis,
tooltip: tooltip ?? createDefaultTooltip(fmt),
legend: legend ?? createDefaultLegend(),
grid: grid ?? createDefaultGrid(),
xAxis: xAxis ?? createValueAxis(),
yAxis: yAxis ?? createCategoryAxis(data.categories),
series: data.series.map((s, index) => {
const showLabel = getIsShowLabel(showFocusLabel, index, data.series.length);
@@ -67,7 +64,7 @@ const HorizontalBar = ({
type: "bar",
data: s.data,
emphasis: { disabled: true },
barMaxWidth: barMaxWidth ?? 42,
barMaxWidth: barMaxWidth ?? BAR_WIDTHS.DEFAULT,
label: showLabel
? {
show: true,