11import * as echarts from "echarts/core" ;
2- import {
3- GraphChart ,
4- EffectScatterChart ,
5- LinesChart ,
6- ScatterChart ,
7- } from "echarts/charts" ;
2+ import { GraphChart , EffectScatterChart , LinesChart , ScatterChart } from "echarts/charts" ;
83import {
94 TooltipComponent ,
105 TitleComponent ,
@@ -161,8 +156,7 @@ class NetJSONGraphRender {
161156
162157 const series = [
163158 Object . assign ( configs . graphConfig . series , {
164- type :
165- configs . graphConfig . series . type === "graphGL" ? "graphGL" : "graph" ,
159+ type : configs . graphConfig . series . type === "graphGL" ? "graphGL" : "graph" ,
166160 layout :
167161 configs . graphConfig . series . type === "graphGL"
168162 ? "forceAtlas2"
@@ -229,11 +223,7 @@ class NetJSONGraphRender {
229223 if ( ! location || ! location . lng || ! location . lat ) {
230224 console . error ( `Node ${ node . id } position is undefined!` ) ;
231225 } else {
232- const { nodeEmphasisConfig} = self . utils . getNodeStyle (
233- node ,
234- configs ,
235- "map" ,
236- ) ;
226+ const { nodeEmphasisConfig} = self . utils . getNodeStyle ( node , configs , "map" ) ;
237227
238228 nodesData . push ( {
239229 name : typeof node . label === "string" ? node . label : "" ,
@@ -340,8 +330,7 @@ class NetJSONGraphRender {
340330 : nodeSizeConfig ;
341331 }
342332 return (
343- ( configs . mapOptions . nodeConfig &&
344- configs . mapOptions . nodeConfig . nodeSize ) ||
333+ ( configs . mapOptions . nodeConfig && configs . mapOptions . nodeConfig . nodeSize ) ||
345334 17
346335 ) ;
347336 } ,
@@ -374,10 +363,7 @@ class NetJSONGraphRender {
374363 *
375364 */
376365 graphRender ( JSONData , self ) {
377- self . utils . echartsSetOption (
378- self . utils . generateGraphOption ( JSONData , self ) ,
379- self ,
380- ) ;
366+ self . utils . echartsSetOption ( self . utils . generateGraphOption ( JSONData , self ) , self ) ;
381367
382368 window . onresize = ( ) => {
383369 self . echarts . resize ( ) ;
@@ -553,29 +539,22 @@ class NetJSONGraphRender {
553539 self . leaflet . getZoom ( ) >= self . config . loadMoreAtZoomLevel &&
554540 self . hasMoreData
555541 ) {
556- const data = await self . utils . getBBoxData . call (
557- self ,
558- self . JSONParam ,
559- bounds ,
560- ) ;
542+ const data = await self . utils . getBBoxData . call ( self , self . JSONParam , bounds ) ;
561543 self . config . prepareData . call ( self , data ) ;
562544 const dataNodeSet = new Set ( self . data . nodes . map ( ( n ) => n . id ) ) ;
563545 const sourceLinkSet = new Set ( self . data . links . map ( ( l ) => l . source ) ) ;
564546 const targetLinkSet = new Set ( self . data . links . map ( ( l ) => l . target ) ) ;
565547 const nodes = data . nodes . filter ( ( node ) => ! dataNodeSet . has ( node . id ) ) ;
566548 const links = data . links . filter (
567- ( link ) =>
568- ! sourceLinkSet . has ( link . source ) && ! targetLinkSet . has ( link . target ) ,
549+ ( link ) => ! sourceLinkSet . has ( link . source ) && ! targetLinkSet . has ( link . target ) ,
569550 ) ;
570551 const boundsDataSet = new Set ( data . nodes . map ( ( n ) => n . id ) ) ;
571552 const nonCommonNodes = self . bboxData . nodes . filter (
572553 ( node ) => ! boundsDataSet . has ( node . id ) ,
573554 ) ;
574555 const removableNodes = new Set ( nonCommonNodes . map ( ( n ) => n . id ) ) ;
575556
576- JSONData . nodes = JSONData . nodes . filter (
577- ( node ) => ! removableNodes . has ( node . id ) ,
578- ) ;
557+ JSONData . nodes = JSONData . nodes . filter ( ( node ) => ! removableNodes . has ( node . id ) ) ;
579558 self . bboxData . nodes = self . bboxData . nodes . concat ( nodes ) ;
580559 self . bboxData . links = self . bboxData . links . concat ( links ) ;
581560 JSONData = {
@@ -593,8 +572,7 @@ class NetJSONGraphRender {
593572 self . config . clustering &&
594573 self . config . clusteringThreshold < JSONData . nodes . length
595574 ) {
596- let { clusters, nonClusterNodes, nonClusterLinks} =
597- self . utils . makeCluster ( self ) ;
575+ let { clusters, nonClusterNodes, nonClusterLinks} = self . utils . makeCluster ( self ) ;
598576
599577 // Only show clusters if we're below the disableClusteringAtLevel
600578 if ( self . leaflet . getZoom ( ) > self . config . disableClusteringAtLevel ) {
@@ -623,10 +601,7 @@ class NetJSONGraphRender {
623601 ) {
624602 // Zoom into the clicked cluster instead of expanding it
625603 const currentZoom = self . leaflet . getZoom ( ) ;
626- const targetZoom = Math . min (
627- currentZoom + 2 ,
628- self . leaflet . getMaxZoom ( ) ,
629- ) ;
604+ const targetZoom = Math . min ( currentZoom + 2 , self . leaflet . getMaxZoom ( ) ) ;
630605 self . leaflet . setView (
631606 [ params . data . value [ 1 ] , params . data . value [ 0 ] ] ,
632607 targetZoom ,
@@ -741,9 +716,7 @@ class NetJSONGraphRender {
741716 return true ;
742717 }
743718 if ( existingNodeIds . has ( node . id ) ) {
744- console . warn (
745- `Duplicate node ID ${ node . id } detected during merge and skipped.` ,
746- ) ;
719+ console . warn ( `Duplicate node ID ${ node . id } detected during merge and skipped.` ) ;
747720 return false ;
748721 }
749722 return true ;
0 commit comments