Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

折线图和面积图的颜色渐变需要考虑坐标系 #5361

Closed
1 task done
pearmini opened this issue Aug 2, 2023 Discussed in #5333 · 1 comment · Fixed by #5809
Closed
1 task done

折线图和面积图的颜色渐变需要考虑坐标系 #5361

pearmini opened this issue Aug 2, 2023 Discussed in #5333 · 1 comment · Fixed by #5809

Comments

@pearmini
Copy link
Member

pearmini commented Aug 2, 2023

AntV Open Source Contribution Plan(可选)

  • 我同意将这个 Issue 参与 OSCP 计划

Issue 类型

中级任务

任务介绍

保证折线图和面积图颜色渐变在 transpose 的情况下正常。下图中颜色从上到下渐变,期望效果是从左到右渐变

/**
 * A recreation of this demo: https://observablehq.com/@d3/gradient-encoding
 */
import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  theme: 'classic',
  padding: 'auto',
  height: 640,
  width: 480,
});

chart
  .line()
  .coordinate({transform:[{type:'transpose'}]})
  .data({
    type: 'fetch',
    value: 'https://assets.antv.antgroup.com/g2/temperatures2.json',
  })
  .scale('x', { utc: true })
  .scale('y', { nice: true })
  .scale('color', { palette: 'turbo' })
  .encode('x', (d) => new Date(d.date))
  .encode('y', 'value')
  .encode('shape', 'hvh')
  .encode('color', 'value')
  .encode('series', () => undefined)
  .style('gradient', 'y')
  .style('lineWidth', 2)
  .style('lineJoin', 'round')
  .axis('x', { title: 'date' });

chart.render();

参考说明

@Runtus
Copy link
Contributor

Runtus commented Nov 16, 2023

【Runtus】认领

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

2 participants