260226_05_ENH: 카테고리 파트 옵션으로 ChartLegend, ChartTopMargin 추가
This commit is contained in:
@@ -65,7 +65,7 @@ const StackBar = ({
|
||||
const option: EChartsOption = useMemo(() => {
|
||||
const fmt = valueFormatter ?? ((v: number) => String(v));
|
||||
const isV = orientation === "vertical";
|
||||
|
||||
console.log(grid)
|
||||
return {
|
||||
color: palette,
|
||||
tooltip: tooltip ?? (isReverse ? createReverseTooltip(data, fmt) : createDefaultTooltip(fmt)),
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import BannerButtons from "@/components/lge-dashboard/BannerButtons";
|
||||
import {totalFilters} from "@/config/filter.data";
|
||||
import React, {useMemo, useState} from "react";
|
||||
import {BannerGroupKey, CategoryChartMode, BannerRow} from "@/types/lg";
|
||||
import {BannerGroupKey, CategoryChartMode, BannerRow, LegendOption} from "@/types/lg";
|
||||
import {
|
||||
buildRowLabelSeriesChartData,
|
||||
buildYearSeriesChartData, formatRowLabel,
|
||||
@@ -22,6 +22,8 @@ type CategoryByDataProps = {
|
||||
selectedYear: string;
|
||||
title?: string;
|
||||
chartMode: CategoryChartMode;
|
||||
chartLegend?: LegendOption;
|
||||
chartTopMargin?: number;
|
||||
allTableData: BannerRow[];
|
||||
fillGreaterThan5?: boolean;
|
||||
chartHeight?: number | string;
|
||||
@@ -44,6 +46,8 @@ const CategoryByData = ({
|
||||
selectedYear,
|
||||
title,
|
||||
chartMode,
|
||||
chartLegend,
|
||||
chartTopMargin,
|
||||
allTableData,
|
||||
fillGreaterThan5,
|
||||
chartHeight,
|
||||
@@ -102,6 +106,7 @@ const CategoryByData = ({
|
||||
})
|
||||
, [allTableData, selectedYear]);
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="mb-2 flex items-center pr-6">
|
||||
@@ -110,11 +115,14 @@ const CategoryByData = ({
|
||||
<div className="flex gap-6 p-3">
|
||||
<div className="flex-shrink-0" style={{ width: `${chartWidth ?? 400}px`}}>
|
||||
{(() => {
|
||||
console.log(chartTopMargin)
|
||||
switch (chartMode) {
|
||||
case "horizontal":
|
||||
return (
|
||||
<HorizontalBar
|
||||
data={chartData}
|
||||
legend={chartLegend}
|
||||
grid={chartTopMargin?createDefaultGrid("default", { top: chartTopMargin }):undefined}
|
||||
height={chartHeight}
|
||||
showFocusLabel="none"
|
||||
paletteVarNames={
|
||||
@@ -127,8 +135,9 @@ const CategoryByData = ({
|
||||
return (
|
||||
<StackBar
|
||||
data={chartData}
|
||||
legend={chartLegend}
|
||||
height={chartHeight}
|
||||
grid={createDefaultGrid("default", { top: 52 })}
|
||||
grid={createDefaultGrid("default", { top: chartTopMargin?chartTopMargin:52 })}
|
||||
isReverse={chartMode === "reverseStack"}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -22,6 +22,8 @@ const CategoryDetail = ({
|
||||
return {
|
||||
title: typeof f.title === "string"? f.title : f.title[debouncedFilterValue.type.value],
|
||||
chartMode:f.chartMode,
|
||||
chartLegend:f.chartLegend,
|
||||
chartTopMargin:f.chartTopMargin,
|
||||
data: dataLength && dataLength > 0 ? dataMap[f.requestKeyResolved] : []
|
||||
};
|
||||
});
|
||||
@@ -69,6 +71,8 @@ const CategoryDetail = ({
|
||||
selectedYear={filterValue.year}
|
||||
title={tableData.title}
|
||||
chartMode={tableData.chartMode}
|
||||
chartLegend={tableData.chartLegend}
|
||||
chartTopMargin={tableData.chartTopMargin}
|
||||
allTableData={tableData.data}
|
||||
chartHeight={tableData.chartHeight}
|
||||
chartWidth={tableData.chartWidth}
|
||||
|
||||
Reference in New Issue
Block a user