mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
improve mutual friends graph performance
This commit is contained in:
@@ -287,7 +287,7 @@
|
|||||||
if (!chartRef.value) {
|
if (!chartRef.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
chartInstance = echarts.init(chartRef.value, chartTheme.value, { useDirtyRect: totalFriends.value > 1000 });
|
chartInstance = echarts.init(chartRef.value, chartTheme.value, { renderer: 'svg' });
|
||||||
chartInstance.on('click', handleChartNodeClick);
|
chartInstance.on('click', handleChartNodeClick);
|
||||||
|
|
||||||
if (graphReady.value) {
|
if (graphReady.value) {
|
||||||
|
|||||||
@@ -184,16 +184,23 @@ export function useMutualGraphChart({ cachedUsers, graphPayload }) {
|
|||||||
function createChartOption(payload, force) {
|
function createChartOption(payload, force) {
|
||||||
const nodes = payload?.nodes ?? [];
|
const nodes = payload?.nodes ?? [];
|
||||||
const links = payload?.links ?? [];
|
const links = payload?.links ?? [];
|
||||||
const resolvedForce = force || computeForceOptions(nodes, links);
|
|
||||||
const labelMap = Object.create(null);
|
const labelMap = Object.create(null);
|
||||||
nodes.forEach((node) => {
|
nodes.forEach((node) => {
|
||||||
if (node?.id) {
|
if (node?.id) {
|
||||||
labelMap[node.id] = node.name || node.id;
|
labelMap[node.id] = node.name || node.id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const resolvedForce = {
|
||||||
|
...(force || {}),
|
||||||
|
layoutAnimation: false
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
color: COLORS_PALETTE,
|
color: COLORS_PALETTE,
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
|
animation: false,
|
||||||
|
animationDuration: 0,
|
||||||
|
animationDurationUpdate: 0,
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'item',
|
trigger: 'item',
|
||||||
formatter: (params) => {
|
formatter: (params) => {
|
||||||
@@ -231,6 +238,9 @@ export function useMutualGraphChart({ cachedUsers, graphPayload }) {
|
|||||||
legendHoverLink: false,
|
legendHoverLink: false,
|
||||||
roam: true,
|
roam: true,
|
||||||
roamTrigger: 'global',
|
roamTrigger: 'global',
|
||||||
|
animation: false,
|
||||||
|
animationDuration: 0,
|
||||||
|
animationDurationUpdate: 0,
|
||||||
data: nodes,
|
data: nodes,
|
||||||
links,
|
links,
|
||||||
label: {
|
label: {
|
||||||
@@ -249,7 +259,7 @@ export function useMutualGraphChart({ cachedUsers, graphPayload }) {
|
|||||||
opacity: 0.5
|
opacity: 0.5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
force,
|
force: resolvedForce,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
borderColor: '#ffffff',
|
borderColor: '#ffffff',
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user