@@ -554,6 +554,10 @@ export class Graph extends EventEmitter {
554
554
* const node1 = graph.getNodeData('node-1');
555
555
* ```
556
556
* @apiCategory data
557
+ * @remarks
558
+ * <zh/> 节点 id 必须存在,否则会抛出异常
559
+ *
560
+ * <en/> Node id must exist, otherwise an exception will be thrown
557
561
*/
558
562
public getNodeData ( id : ID ) : NodeData ;
559
563
/**
@@ -567,12 +571,16 @@ export class Graph extends EventEmitter {
567
571
* const [node1, node2] = graph.getNodeData(['node-1', 'node-2']);
568
572
* ```
569
573
* @apiCategory data
574
+ * @remarks
575
+ * <zh/> 数组中的每个节点 id 必须存在,否则将抛出异常
576
+ *
577
+ * <en/> Each node id in the array must exist, otherwise an exception will be thrown
570
578
*/
571
579
public getNodeData ( ids : ID [ ] ) : NodeData [ ] ;
572
580
public getNodeData ( id ?: ID | ID [ ] ) : NodeData | NodeData [ ] {
573
581
if ( id === undefined ) return this . context . model . getNodeData ( ) ;
574
582
if ( Array . isArray ( id ) ) return this . context . model . getNodeData ( id ) ;
575
- return this . context . model . getNodeData ( [ id ] ) ?. [ 0 ] ;
583
+ return this . context . model . getNodeLikeDatum ( id ) ;
576
584
}
577
585
578
586
/**
@@ -594,6 +602,10 @@ export class Graph extends EventEmitter {
594
602
* const edge1 = graph.getEdgeData('edge-1');
595
603
* ```
596
604
* @apiCategory data
605
+ * @remarks
606
+ * <zh/> 边 id 必须存在,否则会抛出异常
607
+ *
608
+ * <en/> Edge id must exist, otherwise an exception will be thrown
597
609
*/
598
610
public getEdgeData ( id : ID ) : EdgeData ;
599
611
/**
@@ -607,12 +619,16 @@ export class Graph extends EventEmitter {
607
619
* const [edge1, edge2] = graph.getEdgeData(['edge-1', 'edge-2']);
608
620
* ```
609
621
* @apiCategory data
622
+ * @remarks
623
+ * <zh/> 数组中的每个边 id 必须存在,否则将抛出异常
624
+ *
625
+ * <en/> Each edge id in the array must exist, otherwise an exception will be thrown
610
626
*/
611
627
public getEdgeData ( ids : ID [ ] ) : EdgeData [ ] ;
612
628
public getEdgeData ( id ?: ID | ID [ ] ) : EdgeData | EdgeData [ ] {
613
629
if ( id === undefined ) return this . context . model . getEdgeData ( ) ;
614
630
if ( Array . isArray ( id ) ) return this . context . model . getEdgeData ( id ) ;
615
- return this . context . model . getEdgeData ( [ id ] ) ?. [ 0 ] ;
631
+ return this . context . model . getEdgeDatum ( id ) ;
616
632
}
617
633
618
634
/**
@@ -634,6 +650,10 @@ export class Graph extends EventEmitter {
634
650
* const combo1 = graph.getComboData('combo-1');
635
651
* ```
636
652
* @apiCategory data
653
+ * @remarks
654
+ * <zh/> 组合 id 必须存在,否则会抛出异常
655
+ *
656
+ * <en/> Combo id must exist, otherwise an exception will be thrown
637
657
*/
638
658
public getComboData ( id : ID ) : ComboData ;
639
659
/**
@@ -647,12 +667,16 @@ export class Graph extends EventEmitter {
647
667
* const [combo1, combo2] = graph.getComboData(['combo-1', 'combo-2']);
648
668
* ```
649
669
* @apiCategory data
670
+ * @remarks
671
+ * <zh/> 数组中的每个组合 id 必须存在,否则将抛出异常
672
+ *
673
+ * <en/> Each combo id in the array must exist, otherwise an exception will be thrown
650
674
*/
651
675
public getComboData ( ids : ID [ ] ) : ComboData [ ] ;
652
676
public getComboData ( id ?: ID | ID [ ] ) : ComboData | ComboData [ ] {
653
677
if ( id === undefined ) return this . context . model . getComboData ( ) ;
654
678
if ( Array . isArray ( id ) ) return this . context . model . getComboData ( id ) ;
655
- return this . context . model . getComboData ( [ id ] ) ?. [ 0 ] ;
679
+ return this . context . model . getNodeLikeDatum ( id ) ;
656
680
}
657
681
658
682
/**
0 commit comments