apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.48k stars 19.62k forks source link

分级填色地图的VisualMap,如何使用categories属性,实现自定义颜色分类? #14380

Closed minren118 closed 1 year ago

minren118 commented 3 years ago

Version

5.0.0

Steps to reproduce

VisualMap的官方示例中,是以散点图为例,散点图的series最后一列是categories匹配的列,但在Map系列的填色地图里,尝试把Data属性加入额外的信息时,最终做图渲染颜色失败. image

目前测试结果,Map系列的data属性,只能是name、value结象数组。 image

我如何才能把VisualMap的categories所映射的列传入到Map系列地图中?

What is expected?

可以实现Map系列地图的VisualMap中的categories属性绑定,实现自定义颜色填充。

What is actually happening?

当前不能实现Map系列地图的VisualMap中的categories属性绑定。

echarts-bot[bot] commented 3 years ago

Hi! We've received your issue and please be patient to get responded. 🎉 The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list.

Have a nice day! 🍵

echarts-bot[bot] commented 3 years ago

@minren118 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people, we'd like to suggest using English next time. 🤗

TRANSLATED
**TITLE** How to use the categories attribute in VisualMap of graded color map to realize custom color classification? **BODY** ### Version 5.0.0 ### Steps to reproduce In the official example of VisualMap, the scatter chart is used as an example. The last column of the series of the scatter chart is the column matched by categories, but in the coloring map of the Map series, when trying to add the Data attribute to the additional information, the final drawing is done.Failed to render color. ![image](https://user-images.githubusercontent.com/28550438/109600786-aa557d80-7b58-11eb-8bed-2a9adbee99ab.png) According to the current test results, the data attribute of the Map series can only be an array of name and value nodes. ![image](https://user-images.githubusercontent.com/28550438/109600904-f0aadc80-7b58-11eb-9d35-1c7e31fa9c47.png) How can I transfer the columns mapped by the categories of VisualMap to the Map series map? ### What is expected? The categories property binding in VisualMap of Map series maps can be realized, and custom color filling can be realized. ### What is actually happening? Currently, it is not possible to bind the categories property in the VisualMap of the Map series map.
alphabetabc commented 3 years ago
const option = {

    visualMap: {
        show: false,
        categories: ['aa', 'bb', 'cc'], 
        inRange: {
            color: ['red', 'green', 'blue'],
        },
    },

   series: [
        {
            type: 'map',
            map: 'china',
            data: [
                { name: 'region0', value: [1, 'aa'] },
                { name: 'region1', value: [2, 'bb'] },
                { name: 'region2', value: [3, 'cc'] },
            ],
        },
    ]
}
minren118 commented 3 years ago

感谢,马上试试

github-actions[bot] commented 1 year ago

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] commented 1 year ago

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!