100pah commented on a change in pull request #13848:
URL: 
https://github.com/apache/incubator-echarts/pull/13848#discussion_r552354435



##########
File path: src/component/tooltip/tooltipMarkup.ts
##########
@@ -32,20 +32,52 @@ import { getRandomIdBase } from '../../util/number';
 import Model from '../../model/Model';
 import { TooltipOption } from './TooltipModel';
 
-
-const TOOLTIP_NAME_TEXT_STYLE_CSS = 'font-size:12px;color:#6e7079';
-const TOOLTIP_TEXT_STYLE_RICH = {
-    fontSize: 12,
-    fill: '#6e7079'
-};
-const TOOLTIP_VALUE_TEXT_STYLE_CSS = 
'font-size:14px;color:#464646;font-weight:900';
-const TOOLTIP_VALUE_TEXT_STYLE_RICH = {
-    fontSize: 14,
-    fill: '#464646',
-    fontWeight: 900
+type RichTextStyle = {
+    fontSize: number | string,
+    fill: string,
+    fontWeight?: number | string
 };
+
+type TextStyle = string | RichTextStyle;
+
 const TOOLTIP_LINE_HEIGHT_CSS = 'line-height:1';
 
+// TODO: more textStyle option
+function getTooltipTextStyle(
+    textStyle: TooltipOption['textStyle'],
+    renderMode: TooltipRenderMode,
+    tooltipModel?: Model<TooltipOption>
+): {
+    nameStyle: TextStyle
+    valueStyle: TextStyle
+} {
+    const nameFontColor = textStyle.color || '#6e7079';
+    const nameFontSize = textStyle.fontSize || '12px';

Review comment:
       @susiwen8 
   I means that user will set `fontSize` in option like
   ```js
   tooltip: {
       textStyle: { fontSize: 14 }
   }
   ```
   And then `textStyle.fontSize` has the value `14` rather than `14px` here.
   And then the html template should be like:
   ```js
   return {
       nameStyle: 
`font-size:${nameFontSize}px;color:${nameFontColor};font-weight:${nameFontWeight}`,
       valueStyle: 
`font-size:${valueFontSize}px;color:${valueFontColor};font-weight:${valueFontWeight}`
   }
   ```
   If we intend to support other unit like `em`/`rem`/... in future, it would 
be another topic, and could be discussed in new thread.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to