echarts icon indicating copy to clipboard operation
echarts copied to clipboard

echarts 柱状图使用brush移动框时,每次最终都会停留在柱形中间,什么原因?可以设置成移到哪里停在那里吗?

Open chenxia123 opened this issue 10 years ago • 4 comments

问题简述 (One-line summary)

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):
  • 浏览器类型和版本 (Browser version):
  • 操作系统类型和版本 (OS Version):

重现步骤 (Steps to reproduce)

1. 2.

期望结果 (Expected behaviour)

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

option = {

}

其他信息 (Other comments)

chenxia123 avatar Nov 28 '16 12:11 chenxia123

没有看懂您的描述。可以提供 option 么?

100pah avatar Nov 28 '16 13:11 100pah

1 1.以上是我的柱状图,问题在于,比如:当我把brush的左边框移动到某两个绿色柱状中间时,brush框不会立马停住,而是会自适应移动到其中一个绿色柱状的中间位置!(即不管把brush框移到哪里,它的最终位置都会移到最近的一个绿色柱状上)

2.我的echarts是插入在react里的,所用到的echarts图表组件代码如下:

export default function fundRange() {
  const option = {
    color: ['#05e090'],
    // color: [new echarts.graphic.LinearGradient(0, 1, 0, 0, [{ offset: 0, color: '#05E388' }, { offset: 0.9, color: '#03BCDD' }])],
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true,
    },
    toolbox: {
      show: false,
    },
    brush: {
      xAxisIndex: 0,
      outOfBrush: {
        colorAlpha: 0.1,
      },
      brushType: 'lineX',
      // brushStyle: {           // Default brushStyle
      //   borderWidth: 1,
      //   color: 'rgba(120,140,180,0)',
      //   borderColor: 'rgba(120,140,180,0)',
      //   width: null,         // do not use bursh width in line brush, but fetch from grid.
      // },
      throttleType: 'debounce',
      throttleDelay: 1000,
    },
    xAxis: [
      {
        type: 'category',
        data: [
          '一', '二', '三', '四', '五',
          '六', '七', '八', '九', '十', '十一',
          '十二', '十三', '十四', '十五', '十六',
          '十七', '十八', '十九', '二十'],
        axisLine: {
          show: false,
        },
        axisTick: {
          show: false,
        },
        axisLabel: {
          show: false,
        },
      },
    ],
    yAxis: [
      {
        type: 'value',
        axisLine: {
          show: false,
        },
        axisTick: {
          show: false,
        },
        axisLabel: {
          show: false,
        },
        splitLine: {
          show: false,
        },
      },
    ],
    series: [
      {
        name: '直接访问',
        type: 'bar',
        barWidth: '60%',
        // data,
            // label: {
            //   normal: {
            //     show: true,
            //     position: 'outside'
            //   }
            // },
        data: [2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 7, 6, 5, 4, 3, 2, 1, 2, 1],
      },
    ],
  };
  return option;
}

chenxia123 avatar Nov 28 '16 14:11 chenxia123

@100pah 我把问题重新复述了下,请帮我看看是什么原因吧?

chenxia123 avatar Nov 29 '16 02:11 chenxia123

我也遇到同样的问题,不过我发现问题是,通过

dispatchAction({ type: 'brush', areas: [{ brushType: 'lineX', coordRange: [ [minX, minY] ] }] }) 触发后框的边缘在柱状的中间,很尴尬,目前没解决

djy2017 avatar Dec 18 '18 02:12 djy2017