Merge remote-tracking branch 'origin/iipbs/common/main' into iipbs/sn/ii
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
|||||||
type ChartConfig
|
type ChartConfig
|
||||||
} from "./lib/chart";
|
} from "./lib/chart";
|
||||||
import type { CSSProperties } from "react";
|
import type { CSSProperties } from "react";
|
||||||
|
import { formatCommaNumber } from "./lib/function";
|
||||||
|
|
||||||
const customStyles = {
|
const customStyles = {
|
||||||
legendContainer: {
|
legendContainer: {
|
||||||
@@ -119,6 +120,7 @@ export default function Chart({chartConfig=undefined, chartData=[], chartTitle='
|
|||||||
fontWeight={500}
|
fontWeight={500}
|
||||||
domain={[0, globalMax]}
|
domain={[0, globalMax]}
|
||||||
ticks={ticks}
|
ticks={ticks}
|
||||||
|
tickFormatter={(value) => formatCommaNumber(value)}
|
||||||
label={yFieldText ? { value: yFieldText, className:"text-[15px] font-bold", position: 'insideLeft', angle: -90, offset: -30 } : undefined}
|
label={yFieldText ? { value: yFieldText, className:"text-[15px] font-bold", position: 'insideLeft', angle: -90, offset: -30 } : undefined}
|
||||||
/>
|
/>
|
||||||
<ChartTooltip cursor={false} content={<CustomTooltip active={undefined} payload={undefined} label={undefined} />}/>
|
<ChartTooltip cursor={false} content={<CustomTooltip active={undefined} payload={undefined} label={undefined} />}/>
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// 숫자입력시 , 삽입
|
||||||
|
export const formatCommaNumber = (
|
||||||
|
value: number | string | undefined | null
|
||||||
|
): string => {
|
||||||
|
if (value === undefined || value === null || value === "") return "";
|
||||||
|
const num = Number(value);
|
||||||
|
// 숫자로 변환할 수 없는 값이 들어올 경우 빈 문자열을 반환하여 예상치 못한 "NaN" 출력을 방지합니다.
|
||||||
|
if (isNaN(num)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return num.toLocaleString();
|
||||||
|
};
|
||||||
@@ -86,20 +86,28 @@ function Gis({
|
|||||||
foundFeature = data;
|
foundFeature = data;
|
||||||
} else {
|
} else {
|
||||||
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
|
// 아니면 featureId로 맵에서 Feature 인스턴스를 찾아서 사용
|
||||||
let featureId
|
let featureId = data.fid;
|
||||||
const layerName = layerNmRef.current
|
const layerName = layerNmRef.current
|
||||||
if (layerName === '하수재이용시설') {
|
if (layerName === '하수재이용시설') {
|
||||||
featureId = data.searchPk;
|
featureId = data.searchPk;
|
||||||
} else if (layerName === '빗물이용시설'|| layerName == '중수도시설') {
|
} else if (layerName === '빗물이용시설' || layerName == '중수도시설') {
|
||||||
featureId = data.bdstInfoSn;
|
featureId = data.bdstInfoSn;
|
||||||
} else if (layerName === '하수처리시설') {
|
} else if (layerName === '하수처리시설') {
|
||||||
featureId = data.bscFctCd;
|
featureId = data.bscFctCd;
|
||||||
} else if (layerName === '온배수시설' ) {
|
} else if (layerName === '온배수시설') {
|
||||||
featureId = data.bdstRuseFcltSn;
|
featureId = data.bdstRuseFcltSn;
|
||||||
} else {
|
} else {
|
||||||
console.warn('해당 레이어에 대한 featureId 매핑 없음', layerNm);
|
console.warn('해당 레이어에 대한 featureId 매핑 없음', layerNm);
|
||||||
featureId = data.fid || data.id || data.ftrIdn;
|
featureId = data.fid || data.id || data.ftrIdn;
|
||||||
}
|
}
|
||||||
|
// gisMap.getLayers().getArray().forEach(layer => {
|
||||||
|
// const source = layer.getSource?.();
|
||||||
|
// if (source?.getFeatureById) {
|
||||||
|
// const feature = source.getFeatureById(String(featureId).trim());
|
||||||
|
// if (feature) foundFeature = feature;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// const [layerType, id] = String(featureId).split('.');
|
||||||
gisMap.getLayers().getArray().forEach(layer => {
|
gisMap.getLayers().getArray().forEach(layer => {
|
||||||
const source = layer.getSource?.();
|
const source = layer.getSource?.();
|
||||||
if (source?.getFeatures) {
|
if (source?.getFeatures) {
|
||||||
|
|||||||
Reference in New Issue
Block a user