1
This commit is contained in:
1 parent
5c3be71186
commit
0990959e82
10 files changed
+145
-850
No files matched your search
+9
-11
@@ -14,7 +14,7 @@ import { AG_CHARTS_LOCALE_ZH_CN } from 'ag-charts-locale';
|
||||
LicenseManager.setLicenseKey('[v3][RELEASE][0102]_NDg2Njc4MzY3MDgzNw==16d78ca762fb5d2ff740aed081e2af7b');
|
||||
ModuleRegistry.registerModules([AnnotationsModule, ContextMenuModule, ZoomModule, CrosshairModule]);
|
||||
|
||||
const API_BASE_URL = 'http://127.0.0.1:9089/api/v1';
|
||||
const API_BASE_URL = 'https://nest.zwgczx.com/api/v1';
|
||||
|
||||
const statisticOptions = [
|
||||
{ key: 'minValue', label: '最低值', shortLabel: '低' },
|
||||
@@ -365,9 +365,6 @@ function App() {
|
||||
);
|
||||
|
||||
const getNodeColor = (contentKey: ContentKey, nodeId: string) => {
|
||||
const selectedIndex = selectedContentNodes.findIndex((node) => node.contentKey === contentKey && node.id === nodeId);
|
||||
if (selectedIndex >= 0) return selectedContentNodes[selectedIndex].color;
|
||||
|
||||
let hash = 0;
|
||||
const key = getSelectionKey(contentKey, nodeId);
|
||||
for (let index = 0; index < key.length; index += 1) {
|
||||
@@ -506,8 +503,7 @@ function App() {
|
||||
return current.filter((_, index) => index !== existingIndex);
|
||||
}
|
||||
|
||||
const usedColors = new Set(current.map((item) => item.color));
|
||||
const color = chartLineColors.find((item) => !usedColors.has(item)) ?? chartLineColors[current.length % chartLineColors.length];
|
||||
const color = getNodeColor(contentKey, node.id);
|
||||
return [...current, { id: node.id, contentKey, label: node.label, color }];
|
||||
});
|
||||
};
|
||||
@@ -588,7 +584,6 @@ function App() {
|
||||
} catch (error) {
|
||||
if (controller.signal.aborted) return;
|
||||
setLoadError(error instanceof Error ? error.message : '接口请求失败');
|
||||
setChartDataBySelection({});
|
||||
} finally {
|
||||
if (!controller.signal.aborted) {
|
||||
setLoading(false);
|
||||
@@ -601,7 +596,7 @@ function App() {
|
||||
return () => {
|
||||
controller.abort();
|
||||
};
|
||||
}, [chartDataBySelection, chartQueryVersion, groupKey, metricKey, selectedContentNodes]);
|
||||
}, [chartQueryVersion, groupKey, metricKey, selectedContentNodes]);
|
||||
|
||||
useEffect(() => {
|
||||
const frame = chartFrameRef.current;
|
||||
@@ -785,6 +780,11 @@ function App() {
|
||||
enabled: true,
|
||||
items: ['defaults'],
|
||||
},
|
||||
overlays: {
|
||||
noData: {
|
||||
text: '请选择右侧分类项',
|
||||
},
|
||||
},
|
||||
annotations: {
|
||||
enabled: true,
|
||||
toolbar: {
|
||||
@@ -969,9 +969,7 @@ function App() {
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
{loading || loadError || selectedContentNodes.length === 0 ? (
|
||||
<div className="chart-status">{loading ? '加载中' : loadError || '请选择右侧分类项'}</div>
|
||||
) : null}
|
||||
{loading || loadError ? <div className="chart-status">{loading ? '加载中' : loadError}</div> : null}
|
||||
<button className="chart-fullscreen-button ag-charts-toolbar__button" type="button" title="全屏(F11)">
|
||||
<i className="anticon anticon-arrow-salt ag-charts-myButton-fullScreen ag-charts-diy-button" />
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user