antvis/G2

【v5】极坐标 gridline 线,在中心多余 #5430

ai-qing-hai posted onGitHub

image

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

const data = [
  { item: 'Design', type: 'a', score: 70 },
  { item: 'Design', type: 'b', score: 30 },
  { item: 'Development', type: 'a', score: 60 },
  { item: 'Development', type: 'b', score: 70 },
  { item: 'Marketing', type: 'a', score: 50 },
  { item: 'Marketing', type: 'b', score: 60 },
  { item: 'Users', type: 'a', score: 40 },
  { item: 'Users', type: 'b', score: 50 },
  { item: 'User2s', type: 'a', score: 40 },
  { item: 'User2s', type: 'b', score: 50 },
];

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

chart.coordinate({ type: 'polar' });

chart
  .data(data)
  .scale('x', { padding: 0.5, align: 0 })
  .scale('y', { tickCount: 5 })
  .axis('x', { grid: true, gridLineWidth: 4 })

chart
  .area()
  .encode('x', 'item')
  .encode('y', 'score')
  .encode('color', 'type')
  .encode('shape', 'smooth')
  .style('fillOpacity', 0.01)
  .scale('y', { domainMax: 80 });

chart
  .line()
  .encode('x', 'item')
  .encode('y', 'score')
  .encode('color', 'type');

chart.render();

这个好像也无解吧,主要是 grid line 叠加在一起,如果有透明度的话,叠加的点会比较深。

posted by hustcc over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests