Commit 5617df3e by zhaochengxiang

关系图调整

parent 66cb76d7
...@@ -2,11 +2,12 @@ import React from 'react'; ...@@ -2,11 +2,12 @@ import React from 'react';
import Chart from '@antv/chart-node-g6'; import Chart from '@antv/chart-node-g6';
import G6 from '@antv/g6'; import G6 from '@antv/g6';
import { isSzseEnv } from '../../../../util';
import centerImg from '../assets/center.png'; import centerImg from '../assets/center.png';
import expandImg from '../assets/expand.png'; import expandImg from '../assets/expand.png';
const maxInnerRaduis = 40, imageWidth = 30, textFontSize = 8; const maxInnerRaduis = 40, imageWidth = 20, textFontSize = 8;
const centerColorGroup = ['#D8E9FF', '#A7CEFF', '#196AD2']; const centerColorGroup = ['#D8E9FF', '#A7CEFF', '#196AD2'];
const centerHighlightColorGroup = ['#99c6ff', '#4d8ddf', '#145ab3']; const centerHighlightColorGroup = ['#99c6ff', '#4d8ddf', '#145ab3'];
...@@ -73,7 +74,10 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) { ...@@ -73,7 +74,10 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
}); });
const calcRaduis = (node) => { const calcRaduis = (node) => {
if (!node?.levelId) return { innerRaduis: maxInnerRaduis, raduis: maxInnerRaduis+30 };
const outerRaduis = (isSzseEnv ? 20 : 30)
if (!node?.levelId) return { innerRaduis: maxInnerRaduis, raduis: (maxInnerRaduis+outerRaduis) };
const nodeLevel = node?.levelId.split('-').length; const nodeLevel = node?.levelId.split('-').length;
let innerRaduis = maxInnerRaduis; let innerRaduis = maxInnerRaduis;
...@@ -85,21 +89,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) { ...@@ -85,21 +89,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
innerRaduis = 15; innerRaduis = 15;
} }
return { innerRaduis, raduis: (innerRaduis+30) }; return { innerRaduis, raduis: (innerRaduis+outerRaduis) };
}
const calcOpacity = (node) => {
const nodeLevel = node?.levelId.split('-').length;
if (nodeLevel <=2) return 1.0;
if (nodeLevel === 3) return 0.8;
if (nodeLevel === 4) return 0.6;
if (nodeLevel === 5) return 0.4;
return 0.3;
} }
const calcSecondaryNodeColor = (node) => { const calcSecondaryNodeColor = (node) => {
...@@ -120,7 +110,6 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) { ...@@ -120,7 +110,6 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
const { innerRaduis, raduis } = calcRaduis(cfg); const { innerRaduis, raduis } = calcRaduis(cfg);
const { nodeColor, nodeHighlightColor } = calcSecondaryNodeColor(cfg); const { nodeColor, nodeHighlightColor } = calcSecondaryNodeColor(cfg);
const opacity = calcOpacity(cfg);
const nodeLevel = cfg?.levelId.split('-').length; const nodeLevel = cfg?.levelId.split('-').length;
let chartColor = ''; let chartColor = '';
...@@ -174,7 +163,6 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) { ...@@ -174,7 +163,6 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
.style({ .style({
lineWidth: 0, lineWidth: 0,
cursor: 'pointer', cursor: 'pointer',
fillOpacity: opacity,
}) })
.state({ .state({
active: { active: {
...@@ -291,7 +279,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) { ...@@ -291,7 +279,7 @@ const init = (ctx) => function (container, data, onCenterClick, onExpandClick) {
r: innerRaduis, r: innerRaduis,
lineWidth: 0, lineWidth: 0,
fill: nodeColor, fill: nodeColor,
fillOpacity: opacity, fillOpacity: 1.0,
stroke: '#fff', stroke: '#fff',
strokeOpacity: 0, strokeOpacity: 0,
cursor: (cfg?.virtual)?'':'pointer', cursor: (cfg?.virtual)?'':'pointer',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment