跳到主要内容

示例加载中…

源码
/**
 * A recreation of this demo: http://benfred.github.io/venn.js/examples/intersection_tooltip.html
 */
import { Chart } from '@antv/g2';

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

chart.options({
  type: 'path',
  data: {
    type: 'fetch',
    value: 'https://assets.antv.antgroup.com/g2/lastfm.json',
    transform: [
      {
        type: 'venn',
        padding: 8,
        sets: 'sets',
        size: 'size',
        as: ['key', 'path'],
      },
    ],
  },
  encode: { d: 'path', color: 'key' },
  labels: [
    {
      position: 'inside',
      text: (d) => d.label || '',
      transform: [{ type: 'contrastReverse' }],
    },
  ],
  style: { opacity: (d) => (d.sets.length > 1 ? 0.001 : 0.5) },
  state: { inactive: { opacity: 0.2 }, active: { opacity: 0.8 } },
  interaction: { elementHighlight: true },
  legend: false,
});

chart.render();
全站搜索
文档与示例输入关键词开始搜索

输入关键词,查找文档、API 与示例

↑↓选择↵打开Esc关闭