antvis/G2

系列折线图设置渐变色失败 #5221

pearmini posted onGitHub

Discussed in https://github.com/antvis/G2/discussions/5206

<img src="https://user-images.githubusercontent.com/49330279/248522453-34c1acfd-0a39-4e12-b3b1-9e316f383bd1.png" width=640 />

import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  theme: 'classic',
  autoFit: true,
});

chart
  .line()
  .data({
    type: 'fetch',
    value:
      'https://gw.alipayobjects.com/os/bmw-prod/cb99c4ab-e0a3-4c76-9586-fe7fa2ff1a8c.csv',
  })
  .encode('x', (d) => new Date(d.date))
  .encode('y', 'price')
  .encode('series', 'symbol')
  .encode('color', 'price')
  .legend('size', false)
  .style('gradient', 'y')

chart.render();

posted by pearmini almost 2 years ago

Fund this Issue

$0.00
Funded

Pull requests