feat: implement dashboard types, Polymarket data collection, and decision utilities for AI-driven city weather analysis

This commit is contained in:
2569718930@qq.com
2026-04-26 09:40:02 +08:00
parent da2126e33e
commit 0f23d8af9d
6 changed files with 249 additions and 35 deletions
+11 -5
View File
@@ -29,19 +29,25 @@ export function useChart<TType extends ChartType>(
if (disposed) return;
const config = createConfig();
if (chartRef.current) {
chartRef.current.destroy();
chartRef.current = null;
const nextType = (config as { type?: ChartType }).type;
const currentType = chartRef.current
? (chartRef.current.config as { type?: ChartType }).type
: null;
if (chartRef.current && currentType === nextType) {
chartRef.current.data = config.data as ChartInstance<TType>["data"];
chartRef.current.options =
(config.options || {}) as ChartInstance<TType>["options"];
chartRef.current.update("none");
return;
}
chartRef.current?.destroy();
chartRef.current = new Chart(canvas, config);
};
void setupChart();
return () => {
disposed = true;
chartRef.current?.destroy();
chartRef.current = null;
};
}, dependencies);