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

Function assembleFont

src/component/tooltip/TooltipHTMLContent.ts:150–180  ·  view source on GitHub ↗

* @param {Object} textStyle * @return {string} * @inner

(textStyleModel: Model<TooltipOption['textStyle']>)

Source from the content-addressed store, hash-verified

148 * @inner
149 */
150function assembleFont(textStyleModel: Model<TooltipOption['textStyle']>): string {
151 const cssText = [];
152
153 const fontSize = textStyleModel.get('fontSize');
154 const color = textStyleModel.getTextColor();
155
156 color && cssText.push('color:' + color);
157
158 cssText.push('font:' + textStyleModel.getFont());
159
160 // @ts-ignore, leave it to the tooltip refactor.
161 const lineHeight = retrieve2(textStyleModel.get('lineHeight'), Math.round(fontSize * 3 / 2));
162
163 fontSize
164 && cssText.push('line-height:' + lineHeight + 'px');
165
166 const shadowColor = textStyleModel.get('textShadowColor');
167 const shadowBlur = textStyleModel.get('textShadowBlur') || 0;
168 const shadowOffsetX = textStyleModel.get('textShadowOffsetX') || 0;
169 const shadowOffsetY = textStyleModel.get('textShadowOffsetY') || 0;
170 shadowColor && shadowBlur
171 && cssText.push('text-shadow:' + shadowOffsetX + 'px ' + shadowOffsetY + 'px '
172 + shadowBlur + 'px ' + shadowColor);
173
174 each(['decoration', 'align'] as const, function (name) {
175 const val = textStyleModel.get(name);
176 val && cssText.push('text-' + name + ':' + val);
177 });
178
179 return cssText.join(';');
180}
181
182function assembleCssText(
183 tooltipModel: Model<TooltipOption>,

Callers 1

assembleCssTextFunction · 0.85

Calls 4

getTextColorMethod · 0.80
getFontMethod · 0.80
eachFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…