MCPcopy
hub / github.com/tdewolff/minify / getTooltipMarker

Function getTooltipMarker

_benchmarks/sample_echarts.js:16554–16593  ·  view source on GitHub ↗
(inOpt, extraCssText)

Source from the content-addressed store, hash-verified

16552 return tpl;
16553 }
16554 function getTooltipMarker(inOpt, extraCssText) {
16555 var opt = isString(inOpt) ? {
16556 color: inOpt,
16557 extraCssText: extraCssText
16558 } : inOpt || {};
16559 var color = opt.color;
16560 var type = opt.type;
16561 extraCssText = opt.extraCssText;
16562 var renderMode = opt.renderMode || 'html';
16563
16564 if (!color) {
16565 return '';
16566 }
16567
16568 if (renderMode === 'html') {
16569 return type === 'subItem' ? '<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;' + 'border-radius:4px;width:4px;height:4px;background-color:' // Only support string
16570 + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>' : '<span style="display:inline-block;margin-right:4px;' + 'border-radius:10px;width:10px;height:10px;background-color:' + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>';
16571 } else {
16572 // Should better not to auto generate style name by auto-increment number here.
16573 // Because this util is usually called in tooltip formatter, which is probably
16574 // called repeatly when mouse move and the auto-increment number increases fast.
16575 // Users can make their own style name by theirselves, make it unique and readable.
16576 var markerId = opt.markerId || 'markerX';
16577 return {
16578 renderMode: renderMode,
16579 content: '{' + markerId + '|} ',
16580 style: type === 'subItem' ? {
16581 width: 4,
16582 height: 4,
16583 borderRadius: 2,
16584 backgroundColor: color
16585 } : {
16586 width: 10,
16587 height: 10,
16588 borderRadius: 5,
16589 backgroundColor: color
16590 }
16591 };
16592 }
16593 }
16594 /**
16595 * @deprecated Use `time/format` instead.
16596 * ISO Date format

Callers 1

sample_echarts.jsFile · 0.85

Calls 2

encodeHTMLFunction · 0.85
isStringFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…