LoveLuanQi1202 opened a new pull request #14994:
URL: https://github.com/apache/echarts/pull/14994
<!-- Please fill in the following information to help us review your PR more
efficiently. -->
## Brief Information
This pull request is in the type of:s
- [x] bug fixing
- [x] new feature
- [ ] others
### What does this PR do?
<!-- USE ONCE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
like the option of title.textStyle.rich , i add rich option to tooltip
### Fixed issues
- #12232: need rich option to set richText for tooltip
## Details
### Before: What was the problem?
<!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
textStyle lineHeight/borderWidth... is not available to tooltip
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
```
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
}],
tooltip:{
show:true,
textStyle:{
borderWidth:20,
lineHeight: 56,
}
}
};
```
### After: How is it fixed in this PR?
<!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED.
-->
By imitating the textStyle setting of title, I use the 'createTextStyle'
function to generate ZRText style
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
```
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line',
}],
tooltip:{
trigger: "axis",
formatter: function (params) {
return `{abg|${params[0].value}},123`;
},
textStyle: {
lineHeight: 100,
color: "#ff0000",
rich: {
abg: {
color: "#ff00ff",
fontStyle: "italic",
fontWeight: "bold",
fontFamily: "Microsoft YaHei",
fontSize: 20,
lineHeight: 56,
width: 100,
height: 90,
textBorderColor: "red",
},
},
},
}
};
```
## Misc
<!-- ADD RELATED ISSUE ID WHEN APPLICABLE -->
- [ ] The API has been changed (apache/echarts-doc#xxx).
- [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
### Related test cases or examples to use the new APIs
NA.
## Others
### Merging options
- [ ] Please squash the commits into a single one when merge.
### Other information
--
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]