HTML 标签

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

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

const data = [
  { repo: 'G', star: 918 },
  { repo: 'G2', star: 11688 },
  { repo: 'G6', star: 10045 },
  { repo: 'L7', star: 3125 },
  { repo: 'F2', star: 7820 },
  { repo: 'S2', star: 1231 },
  { repo: 'X6', star: 4755 },
];

chart.options({
  type: 'interval',
  data: data,
  encode: { x: 'repo', y: 'star', color: 'repo' },
  labels: [
    {
      text: 'star',
      render: (text, datum) => {
        return `
        <div style="left:-50%;top:-20px;position:relative;font-size:14px;">
          <span>${datum.repo}</span>
          :
          <a href="https://github.com/antvis/${datum.repo}" target="_blank">${datum.star}</a>
        </div>
      `;
      },
    },
  ],
  legend: false,
});

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

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

选择打开Esc关闭