echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] add options to set the gap between `visualMap.text` and item

Open ZeekoZhu opened this issue 3 years ago • 3 comments

What problem does this feature solve?

I want to increase the distance between the "text on the ends" and the visualMap items.

image

For now, no existent function seems to directly control it

What does the proposed API look like?

Add textStyle option to visualMap.

textStyle: StyleObject | [StyleObject, StyleObject];
  • textStyle: {...}: set style of text on both ends
  • textStyle: [{...}, {...}]: set different style of text on each ends

Once this feature is implemented, we can solve the above problem easily:

textStyle: { padding: [0, 42] }

ZeekoZhu avatar Mar 21 '22 10:03 ZeekoZhu

I'm going to look into this issue.

ZeekoZhu avatar Jun 26 '22 04:06 ZeekoZhu

I have found a solution: https://jsfiddle.net/zeeko/bhw2m5tc/2/

    text: ['High', 'Low'],
    textStyle: {
        padding: [20, 0],
        borderWidth: 0.000001,
        borderColor: 'transparent'
    }

Actually visualMap.textStyle.padding is a valid option, but it is not mentioned in the docs.

Due to the strange behavior of ZRText, the textStyle.padding doesn't work without a border, so the borderWidth and borderColor options are also required.

ZeekoZhu avatar Jun 26 '22 06:06 ZeekoZhu

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] avatar Jun 25 '24 21:06 github-actions[bot]

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

github-actions[bot] avatar Jul 03 '24 21:07 github-actions[bot]