위젯 미니차트 수정

This commit is contained in:
Macbook
2026-06-14 01:30:12 +09:00
parent f0de69dc95
commit 810411367c
3 changed files with 55 additions and 14 deletions
@@ -24,6 +24,7 @@ import {
import type { WidgetSlot } from '../../types/widgetDashboard'; import type { WidgetSlot } from '../../types/widgetDashboard';
import FloatingWidgetLayoutPicker from './FloatingWidgetLayoutPicker'; import FloatingWidgetLayoutPicker from './FloatingWidgetLayoutPicker';
import FloatingWidgetWindow from './FloatingWidgetWindow'; import FloatingWidgetWindow from './FloatingWidgetWindow';
import '../../styles/paperDashboard.css';
import '../../styles/widgetDashboard.css'; import '../../styles/widgetDashboard.css';
import '../../styles/floatingWidget.css'; import '../../styles/floatingWidget.css';
@@ -69,7 +69,10 @@ const PaperMiniChart: React.FC<Props> = ({
useEffect(() => { useEffect(() => {
if (!containerRef.current) return undefined; if (!containerRef.current) return undefined;
const t = readChartTheme(containerRef.current); const t = readChartTheme(containerRef.current);
const chart = createChart(containerRef.current, { const el = containerRef.current;
const chart = createChart(el, {
width: el.clientWidth || undefined,
height: el.clientHeight || undefined,
layout: { layout: {
background: { type: ColorType.Solid, color: t.bgColor }, background: { type: ColorType.Solid, color: t.bgColor },
textColor: t.textColor, textColor: t.textColor,
@@ -103,7 +106,18 @@ const PaperMiniChart: React.FC<Props> = ({
}); });
ro.observe(containerRef.current); ro.observe(containerRef.current);
const onLayoutSync = () => {
if (containerRef.current && chartRef.current) {
chartRef.current.applyOptions({
width: containerRef.current.clientWidth,
height: containerRef.current.clientHeight,
});
}
};
window.addEventListener('gc-widget-layout-sync', onLayoutSync);
return () => { return () => {
window.removeEventListener('gc-widget-layout-sync', onLayoutSync);
ro.disconnect(); ro.disconnect();
chart.remove(); chart.remove();
chartRef.current = null; chartRef.current = null;
+39 -13
View File
@@ -303,10 +303,49 @@
flex: 0 0 auto; flex: 0 0 auto;
} }
.fw-window-cell .wd-widget-host--panel,
.fw-window-cell .wd-widget-host--mini-chart {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
height: 100%;
overflow: hidden;
}
.fw-window-cell .wd-widget-host--panel > .wd-panel-body, .fw-window-cell .wd-widget-host--panel > .wd-panel-body,
.fw-window-cell .wd-widget-host--panel > .wd-mini-chart-wrap { .fw-window-cell .wd-widget-host--panel > .wd-mini-chart-wrap {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.fw-window-cell .wd-mini-chart-wrap {
padding: 0;
}
.fw-window-cell .wd-widget-host--mini-chart .ptd-chart-wrap {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
padding: 4px 8px 0;
overflow: hidden;
}
.fw-window-cell .wd-widget-host--mini-chart .ptd-chart-head,
.fw-window-cell .wd-widget-host--mini-chart .ptd-tf-row {
flex-shrink: 0;
}
.fw-window-cell .wd-widget-host--mini-chart .ptd-chart-canvas {
flex: 1;
min-height: 80px !important;
max-height: none !important;
width: 100%;
position: relative;
} }
.fw-window-cell .wd-widget-host--chart, .fw-window-cell .wd-widget-host--chart,
@@ -371,19 +410,6 @@
overflow: auto; overflow: auto;
} }
.fw-window-cell .wd-widget-host--mini-chart .ptd-chart-wrap {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.fw-window-cell .wd-widget-host--mini-chart .ptd-chart-canvas {
flex: 1;
min-height: 0 !important;
max-height: none !important;
}
.fw-window-cell .ptd-analysis-chart { .fw-window-cell .ptd-analysis-chart {
flex: 1; flex: 1;
min-height: 0; min-height: 0;