Merge pull request #19901 from apache/fix/seriesModel-getLinkedData-NPE

fix(series): avoid NPE caused by `seriesData.getLinkedData`
diff --git a/src/model/Series.ts b/src/model/Series.ts
index 89be20c..94e630f 100644
--- a/src/model/Series.ts
+++ b/src/model/Series.ts
@@ -347,7 +347,7 @@
         const task = getCurrentTask(this);
         if (task) {
             const data = task.context.data;
-            return (dataType == null ? data : data.getLinkedData(dataType)) as SeriesData<this>;
+            return (dataType == null || !data.getLinkedData ? data : data.getLinkedData(dataType)) as SeriesData<this>;
         }
         else {
             // When series is not alive (that may happen when click toolbox
diff --git a/test/graph-case.html b/test/graph-case.html
index 4523593..8112b80 100644
--- a/test/graph-case.html
+++ b/test/graph-case.html
@@ -40,7 +40,7 @@
         <div id="main0"></div>
         <div id="main1"></div>
         <div id="main2"></div>
-
+        <div id="main3"></div>
 
 
 
@@ -209,6 +209,256 @@
                     });
                 });
                 </script>
+
+                <script>
+                    require(['echarts'], function (echarts) {
+                        var option = {
+						  xAxis: { show: false, type: 'value', min: 0, max: 503 },
+						  yAxis: { show: false, type: 'value', min: 0, max: 810 },
+						  series: [
+							{
+							  name: '马王堆一号+',
+							  type: 'graph',
+							  coordinateSystem: 'cartesian2d',
+							  symbol: 'circle',
+							  emphasis: { focus: 'adjacency' },
+							  z: 3,
+							  scaleLimit: { min: 0.5, max: 2 },
+							  draggable: true,
+							  roam: 'scale',
+							  label: {
+								show: true,
+								position: 'bottom',
+								color: 'black',
+								fontWeight: 'bold'
+							  },
+							  data: [
+								{
+								  value: [430, 257],
+								  id: '1',
+								  name: '入职指导',
+								  symbolSize: 51,
+								  attributes: {},
+								  itemStyle: { color: '#3ba272' }
+								},
+								{
+								  value: [468, 684],
+								  id: '2',
+								  name: '开发规范参考',
+								  symbolSize: 20,
+								  attributes: {},
+								  itemStyle: { color: '#fc8452' }
+								},
+								{
+								  value: [487, 326],
+								  id: '3',
+								  name: 'Web 前端',
+								  symbolSize: 59,
+								  attributes: {},
+								  itemStyle: { color: '#9a60b4' }
+								},
+								{
+								  value: [238, 121],
+								  id: '4',
+								  name: '响应式分享',
+								  symbolSize: 51,
+								  attributes: {},
+								  itemStyle: { color: '#ea7ccc' }
+								},
+								{
+								  value: [394, 529],
+								  id: '5',
+								  name: '技术文档',
+								  symbolSize: 20,
+								  attributes: {},
+								  itemStyle: { color: '#cfb850' }
+								},
+								{
+								  value: [261, 369],
+								  id: '6',
+								  name: '组件库方案',
+								  symbolSize: 57,
+								  attributes: {},
+								  itemStyle: { color: '#4ee0d7' }
+								},
+								{
+								  value: [125, 366],
+								  id: '7',
+								  name: '数字文博 C 端 Web 技术选型',
+								  symbolSize: 41,
+								  attributes: {},
+								  itemStyle: { color: '#e3698c' }
+								},
+								{
+								  value: [230, 55],
+								  id: '8',
+								  name: '3D 展示调研',
+								  symbolSize: 60,
+								  attributes: {},
+								  itemStyle: { color: '#e3698c' }
+								},
+								{
+								  value: [195, 447],
+								  id: '9',
+								  name: '送审方案',
+								  symbolSize: 46,
+								  attributes: {},
+								  itemStyle: { color: '#eca389' }
+								},
+								{
+								  value: [367, 645],
+								  id: '10',
+								  name: '蜂鸟go-ceres开发规范',
+								  symbolSize: 30,
+								  attributes: {},
+								  itemStyle: { color: '#6939e4' }
+								},
+								{
+								  value: [350, 701],
+								  id: '11',
+								  name: '分库分表规范',
+								  symbolSize: 57,
+								  attributes: {},
+								  itemStyle: { color: '#9f73c7' }
+								}
+							  ],
+							  edges: [
+								{ source: '2', target: '9' },
+								{ source: '2', target: '10' },
+								{ source: '2', target: '11' },
+								{ source: '3', target: '1' },
+								{ source: '3', target: '2' },
+								{ source: '3', target: '5' },
+								{ source: '3', target: '7' },
+								{ source: '3', target: '8' },
+								{ source: '5', target: '4' },
+								{ source: '5', target: '7' },
+								{ source: '5', target: '8' },
+								{ source: '7', target: '5' },
+								{ source: '7', target: '6' },
+								{ source: '7', target: '9' },
+								{ source: '9', target: '10' }
+							  ],
+							  lineStyle: { color: 'orange', curveness: 0, width: 1, type: 'solid' }
+							},
+							{
+							  name: '线图',
+							  type: 'lines',
+							  coordinateSystem: 'cartesian2d',
+							  effect: {
+								show: true,
+								trailLength: 0,
+								symbol: 'circle',
+								color: 'red',
+								symbolSize: 6,
+								constantSpeed: 60
+							  },
+							  z: 1,
+							  lineStyle: { width: 0 },
+							  data: [
+								{
+								  coords: [
+									[468, 684],
+									[195, 447]
+								  ]
+								},
+								{
+								  coords: [
+									[468, 684],
+									[367, 645]
+								  ]
+								},
+								{
+								  coords: [
+									[468, 684],
+									[350, 701]
+								  ]
+								},
+								{
+								  coords: [
+									[487, 326],
+									[430, 257]
+								  ]
+								},
+								{
+								  coords: [
+									[487, 326],
+									[468, 684]
+								  ]
+								},
+								{
+								  coords: [
+									[487, 326],
+									[394, 529]
+								  ]
+								},
+								{
+								  coords: [
+									[487, 326],
+									[125, 366]
+								  ]
+								},
+								{
+								  coords: [
+									[487, 326],
+									[230, 55]
+								  ]
+								},
+								{
+								  coords: [
+									[394, 529],
+									[238, 121]
+								  ]
+								},
+								{
+								  coords: [
+									[394, 529],
+									[125, 366]
+								  ]
+								},
+								{
+								  coords: [
+									[394, 529],
+									[230, 55]
+								  ]
+								},
+								{
+								  coords: [
+									[125, 366],
+									[394, 529]
+								  ]
+								},
+								{
+								  coords: [
+									[125, 366],
+									[261, 369]
+								  ]
+								},
+								{
+								  coords: [
+									[125, 366],
+									[195, 447]
+								  ]
+								},
+								{
+								  coords: [
+									[195, 447],
+									[367, 645]
+								  ]
+								}
+							  ]
+							}
+						  ]
+						};
+                        var chart = testHelper.create(echarts, 'main3', {
+                            option,
+                            title: [
+                                'Hover on the symbols or lines, **SHOULD NOT** throw NPE',
+                                'See also https://github.com/apache/echarts/issues/19900'
+                            ]
+                        });
+                    });
+                </script>
     </body>
 </html>
 
diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json
index bf0a57e..a7aba92 100644
--- a/test/runTest/actions/__meta__.json
+++ b/test/runTest/actions/__meta__.json
@@ -101,7 +101,7 @@
   "geoScatter": 1,
   "getOption": 1,
   "graph": 2,
-  "graph-case": 2,
+  "graph-case": 3,
   "graph-grid": 1,
   "graph-simple": 2,
   "graphic-animation": 1,
diff --git a/test/runTest/actions/graph-case.json b/test/runTest/actions/graph-case.json
index a4f3458..aae562b 100644
--- a/test/runTest/actions/graph-case.json
+++ b/test/runTest/actions/graph-case.json
@@ -1 +1 @@
-[{"name":"Action 1","ops":[{"type":"mousemove","time":475,"x":416,"y":188},{"type":"mousemove","time":675,"x":406,"y":208},{"type":"mousedown","time":848,"x":406,"y":210},{"type":"mousemove","time":881,"x":406,"y":210},{"type":"mouseup","time":979,"x":406,"y":210},{"time":980,"delay":400,"type":"screenshot-auto"},{"type":"mousedown","time":1837,"x":406,"y":210},{"type":"mouseup","time":1988,"x":406,"y":210},{"time":1989,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":2341,"x":406,"y":211},{"type":"mousemove","time":2541,"x":415,"y":180}],"scrollY":334,"scrollX":0,"timestamp":1684056156749},{"name":"Action 2","ops":[{"type":"mousedown","time":677,"x":43,"y":180},{"type":"mousemove","time":683,"x":43,"y":180},{"type":"mouseup","time":853,"x":43,"y":180},{"time":854,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":886,"x":43,"y":180}],"scrollY":833,"scrollX":0,"timestamp":1705353513922}]
\ No newline at end of file
+[{"name":"Action 1","ops":[{"type":"mousemove","time":475,"x":416,"y":188},{"type":"mousemove","time":675,"x":406,"y":208},{"type":"mousedown","time":848,"x":406,"y":210},{"type":"mousemove","time":881,"x":406,"y":210},{"type":"mouseup","time":979,"x":406,"y":210},{"time":980,"delay":400,"type":"screenshot-auto"},{"type":"mousedown","time":1837,"x":406,"y":210},{"type":"mouseup","time":1988,"x":406,"y":210},{"time":1989,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":2341,"x":406,"y":211},{"type":"mousemove","time":2541,"x":415,"y":180}],"scrollY":334,"scrollX":0,"timestamp":1684056156749},{"name":"Action 2","ops":[{"type":"mousedown","time":677,"x":43,"y":180},{"type":"mousemove","time":683,"x":43,"y":180},{"type":"mouseup","time":853,"x":43,"y":180},{"time":854,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":886,"x":43,"y":180}],"scrollY":833,"scrollX":0,"timestamp":1705353513922},{"name":"Action 3","ops":[{"type":"mousemove","time":222,"x":497,"y":223},{"type":"mousemove","time":422,"x":507,"y":274},{"type":"mousemove","time":635,"x":519,"y":293},{"type":"mousemove","time":1158,"x":520,"y":294},{"type":"mousemove","time":1358,"x":602,"y":295},{"type":"mousemove","time":1559,"x":607,"y":295},{"type":"mousemove","time":1826,"x":610,"y":297},{"type":"mousemove","time":2063,"x":612,"y":299},{"type":"mousemove","time":2678,"x":613,"y":300},{"type":"mousemove","time":2887,"x":651,"y":292},{"type":"mousemove","time":3094,"x":665,"y":294},{"type":"mousemove","time":3298,"x":672,"y":301}],"scrollY":1309,"scrollX":0,"timestamp":1715075160362}]
\ No newline at end of file