antvis/G2

条形图的背景有属性吗? #5109

Pentium286 posted onGitHub

<img width="355" alt="image" src="https://github.com/antvis/G2/assets/1262247/0ed95639-c202-474f-83b2-069b509ed201">

G2plot里有,但是和G2的设置的数据结构不一样


image

// 这里是背景 shape
chart
  .interval()
  .encode('x', 'month')
  .encode('y', () => 1)
  .scale('y', { independent: true, domain: [0, 1] })
  .scale('x', { independent: true })
  .axis('y', false)
  .axis('x', false)
  .style('fill', 'red')
  .style('opacity', '0.1')
  .style('pointerEvents', 'none') // 不响应事件
  ;

也可以直接看 DEMO

posted by hustcc almost 2 years ago

Fund this Issue

$0.00
Funded

Pull requests