apache / echarts

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

[Bug] geo.select.disabled 设置为true,不生效 #19903

Closed FlyoverBlind closed 4 months ago

FlyoverBlind commented 4 months ago

Version

5.5.0

Link to Minimal Reproduction

geo.select.disabled 设置为true,不生效

Steps to Reproduce

geo.select.disabled 设置为true,不生效

Current Behavior

geo.select.disabled 设置为true,不生效

Expected Behavior

geo.select.disabled 设置为true,不生效

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

echarts-bot[bot] commented 4 months ago

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

TRANSLATED
**TITLE** [Bug] geo.select.disabled is set to true and does not take effect **BODY** ### Version 5.5.0 ### Link to Minimal Reproduction geo.select.disabled is set to true and does not take effect ### Steps to Reproduce geo.select.disabled is set to true and does not take effect ### Current Behavior geo.select.disabled is set to true and does not take effect ### Expected Behavior geo.select.disabled is set to true and does not take effect ### Environment ```markdown - OS: -Browser: - Framework: ``` ### Any additional comments? _No response_
echarts-bot[bot] commented 4 months ago

@FlyoverBlind Please provide a demo for the issue either with Official Editor, CodePen, CodeSandbox or JSFiddle.

helgasoft commented 4 months ago

Did you forget to set also selectedMode ?

FlyoverBlind commented 4 months ago

Did you forget to set also selectedMode ?

this is my code

myChart.showLoading();
$.get(ROOT_PATH + '/data/asset/geo/HK.json', function (geoJson) {
  myChart.hideLoading();
  echarts.registerMap('HK', geoJson);
  myChart.setOption(
    (option = {
      title: {
        text: 'Population Density of Hong Kong (2011)',
        subtext: 'Data from Wikipedia',
        sublink:
          'http://zh.wikipedia.org/wiki/%E9%A6%99%E6%B8%AF%E8%A1%8C%E6%94%BF%E5%8D%80%E5%8A%83#cite_note-12'
      },
      tooltip: {
        trigger: 'item',
        formatter: '{b}<br/>{c} (p / km2)'
      },
      toolbox: {
        show: true,
        orient: 'vertical',
        left: 'right',
        top: 'center',
        feature: {
          dataView: { readOnly: false },
          restore: {},
          saveAsImage: {}
        }
      },
      visualMap: {
        min: 800,
        max: 50000,
        text: ['High', 'Low'],
        realtime: false,
        calculable: true,
        inRange: {
          color: ['lightskyblue', 'yellow', 'orangered']
        }
      },
      geo: {
        map: 'HK',
        selectedMode: 'multiple',
        label: {
          show: true
        },
        emphasis: {
          disabled: true
        },
        select: {
          disabled: true
        },

      },

    })
  );
});
plainheart commented 4 months ago

根据原始 PR #15534,select: { disabled: true } 是为了设置某个数据项禁止选中,如果全部都不希望选中,可以直接设置 selectedModefalse

helgasoft commented 4 months ago

And here is the opposite - to select from data and from dispatch action - Demo.

FlyoverBlind commented 4 months ago

this is ok