bundled/skills/g2-legend-expert/SKILL.md
Expert skill for G2 legend development - provides comprehensive knowledge about legend rendering implementation, component architecture, layout algorithms, and interaction handling. Use when implementing, customizing, or debugging legend functionality in G2 visualizations.
npx skillsauth add foryourhealth111-pixel/vco-skills-codex G2 Legend ExpertInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides comprehensive knowledge about legend rendering in G2, covering the complete legend rendering flow from component creation to layout calculation and interaction handling.
The legend rendering flow in G2 follows a multi-stage process that transforms legend configuration into visual components. This flow involves several key stages:
Legend components are inferred from the chart's scales and configuration during the initial setup phase. The inference process is handled by the inferComponent function in src/runtime/component.ts:
shape, size, color, and opacitylegendCategory (for discrete scales) or legendContinuous (for continuous scales)Two main legend component types are implemented:
Located in src/component/legendCategory.ts, this component handles categorical legends:
LegendCategoryLayout to handle layout positioningrender optionLocated in src/component/legendContinuous.ts, this handles continuous legends:
The layout process is managed in src/runtime/layout.ts and involves several critical steps:
The computeComponentSize function handles sizing based on component type:
The core layout logic is in the computePadding function:
const autoSizeOf = (d) => {
if (d.size) return;
if (value !== 'auto') sizeOf(d);
else {
// Compute component size dynamically
computeComponentSize(
d,
crossSize,
crossPadding,
position,
theme,
library,
);
defaultSizeOf(d);
}
};
computeComponentSize to measure actual content dimensionsdefaultSize directly, bypassing content measurementThe renderComponent function in src/runtime/component.ts handles the actual rendering:
After size calculation, the placeComponents function assigns bounding boxes:
Categorical legends (LegendCategory) are used for discrete scales and support:
render optionContinuous legends (LegendContinuous) handle continuous scales:
The legend filtering interaction is implemented in src/interaction/legendFilter.ts:
Legends support multiple visual states:
Legend components integrate with G2's theming system:
When paddingTop is manually set (e.g., paddingTop: 72), the height of legendCategory changes unexpectedly (e.g., from 60px to 40px). This occurs because:
defaultSize instead of measuring actual contentLegendCategory, the default size is 40 (defined in src/component/legendCategory.ts)size property in the legend configuration to override the defaultFor more detailed information on legend layout mechanisms and related topics, see the knowledge directory:
./knowledge/legendLayout.md - Detailed analysis of padding behavior and layout calculations
computePadding functiondevelopment
Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model.
development
Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.
development
World-class prompt engineering skill for LLM optimization, prompt patterns, structured outputs, and AI product development. Expertise in Claude, GPT-4, prompt design patterns, few-shot learning, chain-of-thought, and AI evaluation. Includes RAG optimization, agent design, and LLM system architecture. Use when building AI products, optimizing LLM performance, designing agentic systems, or implementing advanced prompting techniques.
development
World-class ML engineering skill for productionizing ML models, MLOps, and building scalable ML systems. Expertise in PyTorch, TensorFlow, model deployment, feature stores, model monitoring, and ML infrastructure. Includes LLM integration, fine-tuning, RAG systems, and agentic AI. Use when deploying ML models, building ML platforms, implementing MLOps, or integrating LLMs into production systems.