MCPcopy Create free account
hub / github.com/apache/echarts / wrapInlineValueHTML

Function wrapInlineValueHTML

src/component/tooltip/tooltipMarkup.ts:448–464  ·  view source on GitHub ↗
(
    valueList: string | string[],
    alignRight: boolean,
    valueCloseToMarker: boolean,
    style: string
)

Source from the content-addressed store, hash-verified

446}
447
448function wrapInlineValueHTML(
449 valueList: string | string[],
450 alignRight: boolean,
451 valueCloseToMarker: boolean,
452 style: string
453): string {
454 // Do not too close to marker, considering there are multiple values separated by spaces.
455 const paddingStr = valueCloseToMarker ? '10px' : '20px';
456 const alignCSS = alignRight ? `float:right;margin-left:${paddingStr}` : '';
457 valueList = isArray(valueList) ? valueList : [valueList];
458 return (
459 `<span style="${alignCSS};${style}">`
460 // Value has commas inside, so use ' ' as delimiter for multiple values.
461 + map(valueList, value => encodeHTML(value)).join('&nbsp;&nbsp;')
462 + '</span>'
463 );
464}
465
466function wrapInlineNameRichText(ctx: TooltipMarkupBuildContext, name: string, style: RichTextStyle): string {
467 return ctx.markupStyleCreator.wrapRichTextStyle(name, style as Dictionary<unknown>);

Callers 1

buildNameValueFunction · 0.85

Calls 2

isArrayFunction · 0.85
encodeHTMLFunction · 0.85

Tested by

no test coverage detected