echarts [Bug] 如何扩充markArea区域背景色宽度

iq3niunx  于 5个月前  发布在  Echarts
关注(0)|答案(8)|浏览(110)

Version

5.3.2

none

Steps to Reproduce

markArea: {

          data: [
            [
              {
                name: "受理服务",
                xAxis: "普通电话受理",
                itemStyle: {
                  color:"rgba(1, 151, 255, 0.4)"
                },
                label: {
                  backgroundColor: "#0197FF",
                  color: "white",
                  borderColor: "#0197FF",
                  borderWidth: 1,
                  padding: 8,
                  align: "center"
                  // width: 120
                }
              },
              {
                xAxis: "网点受理"
              }
            ],
            [
              {
                name: "揽收服务",
                xAxis: "普通电话受理",
                itemStyle: {
                 color:"rgba(1, 80, 193, 0.4)
                },
                label: {
                  backgroundColor: "#0150C1",
                  color: "white",
                  borderColor: "#0150C1",
                  borderWidth: 1,
                  padding: 8,
                  align: "center"
                  // width: 120
                }
              },
              {
                xAxis: "网点受理"
              }
            ],
           ]
        }

Current Behavior

the markArea bgcolor is base the x center point,how can it extend left and right area.

Expected Behavior

markArea

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

fd3cxomn

fd3cxomn1#

@Oracimaru 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] How to expand the width of the background color in the markArea area

BODY

Version

5.3.2

none

Steps to Reproduce

markArea: {

          data: [
            [
              {
                name: "Acceptance Service",
                xAxis: "Ordinary call acceptance",
                itemStyle: {
                  color:"rgba(1, 151, 255, 0.4)"
                },
                label: {
                  backgroundColor: "#0197FF",
                  color: "white",
                  borderColor: "#0197FF",
                  borderWidth: 1,
                  padding: 8,
                  align: "center"
                  // width: 120
                }
              },
              {
                xAxis: "Acceptance at outlets"
              }
            ],
            [
              {
                name: "Collection Service",
                xAxis: "Ordinary call acceptance",
                itemStyle: {
                 color: "rgba(1, 80, 193, 0.4)
                },
                label: {
                  backgroundColor: "#0150C1",
                  color: "white",
                  borderColor: "#0150C1",
                  borderWidth: 1,
                  padding: 8,
                  align: "center"
                  // width: 120
                }
              },
              {
                xAxis: "Acceptance at outlets"
              }
            ],
           ]
        }

Current Behavior

the markArea bgcolor is base the x center point, how can it extend left and right area.

Expected Behavior

markArea

Environment

- OS:
-Browser:
- Framework:

Any additional comments?

No response

2ekbmq32

2ekbmq322#

this is the second area.

yk9xbfzb

yk9xbfzb4#

可以设置xAxis.axisTick.alignWithLabel为false,让柱子在刻度之间对齐达到效果。https://echarts.apache.org/zh/option.html#xAxis.axisTick.alignWithLabel

5jvtdoz2

5jvtdoz25#

5.3.2

谢谢,我试了下在5.4.2版本确实起作用,5.3.2依旧是上面的样式。另外,如果把bar换成line,它依旧左右留白了,设置boundaryGap:false会让其闭合,但是依旧不是真实的对应关系,有别的配置参数吗

3mpgtkmj

3mpgtkmj6#

可以设置xAxis.axisTick.alignWithLabel为false,让柱子在刻度之间对齐达到效果。https://echarts.apache.org/zh/option.html#xAxis.axisTick.alignWithLabel

非常感谢,type:'bar’可以。type:'line'有实现方式吗

相关问题