Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
antvis avatar

Antv G2 Chart

  • 978 installs
  • 454 repo stars
  • Updated July 31, 2026
  • antvis/chart-visualization-skills

antv-g2-chart is an AntV G2 v5 visualization skill that configures enter, update, and exit animations via the animate property for developers who need polished chart transitions in data dashboards.

About

antv-g2-chart is an antvis/chart-visualization-skills agent skill focused on the G2 v5 animation system through the animate configuration property. It documents three timing phases—enter, update, and exit—and built-in animation types including fadeIn/Out, scaleInX/Y, growInX/Y, waveIn, zoomIn/Out, morphing, and pathIn, each tunable with duration, delay, and easing. Frontend developers building AntV G2 dashboards reach for antv-g2-chart when first render, data refresh, or chart removal needs motion without hand-rolling keyframes. The skill is tagged beginner difficulty with full completeness and links related skills g2-animation-keyframe and g2-core-chart-init for deeper animation control.

  • Supports 14 built-in animation types including fadeIn/Out, scaleInX/Y, growInX/Y, waveIn, zoomIn/Out, morphing and pathI
  • Configure timing with duration, delay, and easing functions for enter, update, and exit moments
  • One-line animate option on G2 chart elements
  • Ready-to-run minimal JavaScript example included
  • Visual reference table mapping each animation to its best-use chart type

Antv G2 Chart by the numbers

  • 978 all-time installs (skills.sh)
  • +46 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #388 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/antvis/chart-visualization-skills --skill antv-g2-chart

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs978
repo stars454
Security audit3 / 3 scanners passed
Last updatedJuly 31, 2026
Repositoryantvis/chart-visualization-skills

How do you add enter and exit animations in AntV G2?

Quickly add polished enter, update, and exit animations to data visualizations built with AntV G2.

Who is it for?

Frontend developers shipping AntV G2 v5 charts who want built-in transition animations on render and data updates.

Skip if: Non-G2 chart libraries, static SVG exports with no animation requirements, or backend-only data pipelines.

When should I use this skill?

The user asks for G2 chart animations, animate config, or enter/update/exit transitions on AntV visualizations.

What you get

G2 animate configurations for enter, update, and exit phases with duration, delay, and easing settings.

  • animate configuration snippets
  • Animation timing setup for chart lifecycle

By the numbers

  • G2 v5 animation system with 3 timing phases: enter, update, exit
  • Documents 10+ built-in animation types including fadeIn, waveIn, and morphing

Files

SKILL.mdMarkdownGitHub ↗

内置动画类型速查

动画名效果适合场景
fadeIn从透明到不透明通用入场
fadeOut从不透明到透明通用退场
scaleInX从 X 轴起点缩放展开柱状图入场
scaleInY从 Y 轴底部缩放展开柱状图入场(竖向)
scaleOutX向 X 轴收缩消失柱状图退场
scaleOutY向 Y 轴收缩消失柱状图退场
growInX从左向右生长条形图、折线图入场
growInY从下向上生长柱状图入场
waveIn波浪扫描入场极坐标图(玫瑰图、饼图)
zoomIn从中心缩放放大点图入场
zoomOut向中心缩小消失点图退场
pathIn路径逐步绘制折线图、路径图
morphing形状变形过渡图表类型切换

最小可运行示例

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

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

chart.options({
  type: 'interval',
  data: [
    { genre: 'Sports', sold: 275 },
    { genre: 'Strategy', sold: 115 },
    { genre: 'Action', sold: 120 },
    { genre: 'RPG', sold: 98 },
  ],
  encode: { x: 'genre', y: 'sold', color: 'genre' },
  animate: {
    enter: {
      type: 'growInY',    // 入场动画:从下向上生长
      duration: 800,      // 持续时间(毫秒)
      delay: 0,           // 延迟
      easing: 'ease-out', // 缓动函数
    },
  },
});

chart.render();

配置动画的三个时机

chart.options({
  type: 'interval',
  data,
  encode: { x: 'x', y: 'y', color: 'type' },
  animate: {
    // 入场:图表首次渲染时
    enter: {
      type: 'scaleInY',
      duration: 1000,
      easing: 'ease-out-bounce',
    },
    // 更新:数据变化时
    update: {
      type: 'morphing',
      duration: 500,
    },
    // 退场:图元被移除时
    exit: {
      type: 'fadeOut',
      duration: 300,
    },
  },
});

禁用动画

// 禁用所有动画
chart.options({
  animate: false,
});

// 仅禁用入场动画
chart.options({
  animate: {
    enter: false,
  },
});

常见动画组合推荐

// 柱状图:growInY 入场
animate: { enter: { type: 'growInY', duration: 800 } }

// 折线图:pathIn 入场(路径绘制效果)
animate: { enter: { type: 'pathIn', duration: 1200 } }

// 饼图(极坐标):waveIn 入场
animate: { enter: { type: 'waveIn', duration: 1000 } }

// 散点图:zoomIn 入场
animate: { enter: { type: 'zoomIn', duration: 600 } }

// 通用淡入
animate: { enter: { type: 'fadeIn', duration: 500 } }

常见错误与修正

错误 1:animate.enter 写成字符串

// ❌ 错误:enter 不是字符串,是对象
chart.options({
  animate: { enter: 'fadeIn' },  // ❌
});

// ✅ 正确
chart.options({
  animate: { enter: { type: 'fadeIn', duration: 600 } },  // ✅
});

错误 2:在极坐标图用非极坐标动画

// ❌ scaleInX/Y 在极坐标中效果不对
chart.options({
  coordinate: { type: 'theta' },
  animate: { enter: { type: 'scaleInY' } },  // ❌ 饼图应该用 waveIn
});

// ✅ 极坐标图推荐 waveIn
chart.options({
  coordinate: { type: 'theta' },
  animate: { enter: { type: 'waveIn', duration: 1000 } },  // ✅
});

--- id: "g2-animation-keyframe" title: "G2 关键帧动画(timingKeyframe)" description: | timingKeyframe 是 G2 v5 的组合类型,将多个图表视图按时序播放, 实现数据故事讲述(data storytelling)效果。 每个子视图是一个"关键帧",系统自动在帧间插值过渡,支持形变动画(morphing)。

library: "g2" version: "5.x" category: "animations" tags:

  • "timingKeyframe"
  • "关键帧"
  • "数据故事"
  • "keyframe"
  • "morphing"
  • "动画"
  • "composition"

related:

  • "g2-animation-intro"
  • "g2-core-view-composition"

use_cases:

  • "演示数据如何从一种图表类型变为另一种(柱状图 → 折线图)"
  • "展示数据随时间的演变过程"
  • "数据新闻和可视化故事讲述"

difficulty: "advanced" completeness: "full" created: "2025-03-24" updated: "2025-03-24" author: "antv-team" source_url: "https://g2.antv.ant

Related skills

FAQ

Which animation phases does antv-g2-chart configure?

antv-g2-chart covers AntV G2 v5 animate timing for enter (first render), update (data changes), and exit (removal). Each phase accepts built-in animation types with duration, delay, and easing overrides.

What built-in G2 animations does antv-g2-chart document?

antv-g2-chart lists fadeIn/Out, scaleInX/Y, growInX/Y, waveIn, zoomIn/Out, morphing, and pathIn as built-in animate types on G2 v5 charts. Developers pick a type per phase instead of writing custom keyframes.

Is Antv G2 Chart safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Frontend Developmentagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.