* @param {Object|string} [opt] If string, means color. * @param {string} [opt.color] * @param {string} [opt.extraCssText] * @param {string} [opt.type='item'] 'item' or 'subItem' * @param {string} [opt.renderMode='html'] render mode of tooltip, 'html' or 'richText' * @param {string} [opt.markerI
(opt, extraCssText)
| 19425 | * @return {string} |
| 19426 | */ |
| 19427 | function getTooltipMarker(opt, extraCssText) { |
| 19428 | opt = isString(opt) ? {color: opt, extraCssText: extraCssText} : (opt || {}); |
| 19429 | var color = opt.color; |
| 19430 | var type = opt.type; |
| 19431 | var extraCssText = opt.extraCssText; |
| 19432 | var renderMode = opt.renderMode || 'html'; |
| 19433 | var markerId = opt.markerId || 'X'; |
| 19434 | |
| 19435 | if (!color) { |
| 19436 | return ''; |
| 19437 | } |
| 19438 | |
| 19439 | if (renderMode === 'html') { |
| 19440 | return type === 'subItem' |
| 19441 | ? '<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;' |
| 19442 | + 'border-radius:4px;width:4px;height:4px;background-color:' |
| 19443 | + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>' |
| 19444 | : '<span style="display:inline-block;margin-right:5px;' |
| 19445 | + 'border-radius:10px;width:10px;height:10px;background-color:' |
| 19446 | + encodeHTML(color) + ';' + (extraCssText || '') + '"></span>'; |
| 19447 | } |
| 19448 | else { |
| 19449 | // Space for rich element marker |
| 19450 | return { |
| 19451 | renderMode: renderMode, |
| 19452 | content: '{marker' + markerId + '|} ', |
| 19453 | style: { |
| 19454 | color: color |
| 19455 | } |
| 19456 | }; |
| 19457 | } |
| 19458 | } |
| 19459 | |
| 19460 | function pad(str, len) { |
| 19461 | str += ''; |
no test coverage detected