How to use the g2.Stat function in g2

To help you get started, we’ve selected a few g2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github canisminor1990 / ffxiv-cmskin / src / components / PieChart / index.js View on Github external
const Chart = createG2(chart => {
    const Stat = G2.Stat;
    chart.coord('theta', {
      radius: 0.4, // 设置饼图的大小
    });
    chart.legend('name', {
      position: 'bottom',
      itemWrap: true,
      word: {
        fill: 'rgba(255,255,255,.5)',
      },
      formatter: name => `${name}: ${desc[name].percent} - ${desc[name].ps}`,
    });
    chart
      .intervalStack()
      .position(Stat.summary.percent('data'))
      .color('name', color)
      .label('name');
github ant-design / ant-design-pro-site / scaffold / src / components / Charts / Pie / index.js View on Github external
if (!margin) {
      if (hasLegend) {
        m = [24, 240, 24, 0];
      } else if (percent) {
        m = [0, 0, 0, 0];
      } else {
        m = [24, 0, 24, 0];
      }
    }

    const h = title ? (height + m[0] + m[2] + (-46)) : (height + m[0] + m[2]);

    // clean
    this.node.innerHTML = '';

    const Stat = G2.Stat;

    const chart = new G2.Chart({
      container: this.node,
      forceFit: fit,
      height: h,
      plotCfg: {
        margin: m,
      },
      animate,
    });

    if (!tooltip) {
      chart.tooltip(false);
    } else {
      chart.tooltip({
        title: null,

g2

An implementation of the Grammar of Graphics in javascript

MIT
Latest version published 7 years ago

Package Health Score

70 / 100
Full package analysis