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

Function normalizeTooltipFormatResult

src/model/mixin/dataFormat.ts:223–260  ·  view source on GitHub ↗
(result: TooltipFormatResult)

Source from the content-addressed store, hash-verified

221 * For backward compat, normalize the return from `formatTooltip`.
222 */
223export function normalizeTooltipFormatResult(result: TooltipFormatResult): {
224 // If `markupFragment` exists, `markupText` should be ignored.
225 frag: TooltipMarkupBlockFragment;
226 // Can be `null`/`undefined`, means no tooltip.
227 text: string;
228 // Merged with `markersExisting`.
229 // markers: Dictionary<ColorString>;
230} {
231 let markupText;
232 // let markers: Dictionary<ColorString>;
233 let markupFragment: TooltipMarkupBlockFragment;
234 if (zrUtil.isObject(result)) {
235 if ((result as TooltipMarkupBlockFragment).type) {
236 markupFragment = result as TooltipMarkupBlockFragment;
237 }
238 else {
239 if (__DEV__) {
240 console.warn('The return type of `formatTooltip` is not supported: ' + makePrintable(result));
241 }
242 }
243 // else {
244 // markupText = (result as TooltipFormatResultLegacyObject).html;
245 // markers = (result as TooltipFormatResultLegacyObject).markers;
246 // if (markersExisting) {
247 // markers = zrUtil.merge(markersExisting, markers);
248 // }
249 // }
250 }
251 else {
252 markupText = result;
253 }
254
255 return {
256 text: markupText,
257 // markers: markers || markersExisting,
258 frag: markupFragment
259 };
260}

Callers 2

_showAxisTooltipMethod · 0.90

Calls 1

makePrintableFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…