MCPcopy
hub / github.com/apache/echarts / formatTooltip

Method formatTooltip

src/chart/sankey/SankeySeries.ts:249–280  ·  view source on GitHub ↗
(
        dataIndex: number,
        multipleSeries: boolean,
        dataType: 'node' | 'edge'
    )

Source from the content-addressed store, hash-verified

247 }
248
249 formatTooltip(
250 dataIndex: number,
251 multipleSeries: boolean,
252 dataType: 'node' | 'edge'
253 ) {
254 function noValue(val: unknown): boolean {
255 return isNaN(val as number) || val == null;
256 }
257 // dataType === 'node' or empty do not show tooltip by default
258 if (dataType === 'edge') {
259 const params = this.getDataParams(dataIndex, dataType);
260 const rawDataOpt = params.data as SankeyEdgeItemOption;
261 const edgeValue = params.value;
262 const edgeName = rawDataOpt.source + ' -- ' + rawDataOpt.target;
263 return createTooltipMarkup('nameValue', {
264 name: edgeName,
265 value: edgeValue,
266 noValue: noValue(edgeValue)
267 });
268 }
269 // dataType === 'node'
270 else {
271 const node = this.getGraph().getNodeByIndex(dataIndex);
272 const value = node.getLayout().value;
273 const name = (this.getDataParams(dataIndex, dataType).data as SankeyNodeItemOption).name;
274 return createTooltipMarkup('nameValue', {
275 name: name != null ? name + '' : null,
276 value: value,
277 noValue: noValue(value)
278 });
279 }
280 }
281
282 optionUpdated() {}
283

Callers

nothing calls this directly

Calls 5

getDataParamsMethod · 0.95
getGraphMethod · 0.95
createTooltipMarkupFunction · 0.90
getNodeByIndexMethod · 0.80
getLayoutMethod · 0.65

Tested by

no test coverage detected