Agent Skills: JWebMP AG Charts

Enterprise-grade charting library integration for JWebMP with Angular 21. Provides CRTP-based fluent Java API for AG Charts 13.1.0 with TypeScript type generation, reactive data binding, and server-side chart configuration. Supports line, bar, area, scatter, bubble, pie, donut, histogram charts with advanced axes, theming, tooltips, legends, zoom, and navigator components. Use when working with AG Charts, creating data visualizations, configuring chart options, building dashboards, or implementing charting features in JWebMP applications.

UncategorizedID: GuicedEE/ai-rules/jwebmp-agcharts

Install this agent skill to your local

pnpm dlx add-skill https://github.com/GuicedEE/ai-rules/tree/HEAD/skills/.system/jwebmp-agcharts

Skill Files

Browse the full folder contents for jwebmp-agcharts.

Download Skill

Loading file tree…

skills/.system/jwebmp-agcharts/SKILL.md

Skill Metadata

Name
jwebmp-agcharts
Description
"Build JWebMP AG Charts community visualizations with Java chart options, generated TypeScript, data binding, and themes."

JWebMP AG Charts

Enterprise-grade charting library integration for JWebMP with AG Charts 13.1.0 and Angular 21.

Workflow references

Read the reference for the task you are working on. Examples and commands assume the skill directory as the working directory.

  • Chart options: Chart Types; Axes Configuration; Legend Configuration; Tooltip Configuration; Theming; Animation; Zoom & Pan; Navigator Component; Gradient Legend; Context Menu.
  • Examples: Multi-Series Example; Common Patterns.
  • Integration: Complete Chart Options (38); NPM Dependencies; JPMS Module; Installation; Exported Packages.

Core Features

  • Complete AG Charts 13.1.0 API — All 38 official chart options implemented
  • CRTP Fluent Builders — Type-safe, self-referencing setters
  • Angular 21 Integration — Seamless component integration
  • TypeScript Type Generation — Automatic interface generation
  • Reactive Data Binding — Real-time chart updates
  • Multiple Chart Types — Line, Bar, Area, Scatter, Bubble, Pie, Donut, Histogram
  • Advanced Axes — Number, Time, Log, Category, Grouped Category
  • Rich Interactions — Tooltips, legends, zoom, pan, highlighting, animations

Quick Start

Basic Line Chart

@NgComponent
public class LineChartComponent implements INgComponent<LineChartComponent> {
    @Override
    public String render() {
        AgChartOptions<LineChartComponent> options = new AgChartOptions<>(this)
            .setData("""
                [
                    { month: 'Jan', sales: 100 },
                    { month: 'Feb', sales: 150 },
                    { month: 'Mar', sales: 130 }
                ]
                """)
            .setSeries(List.of(
                new AgLineSeriesOptions<>()
                    .setXKey("month")
                    .setYKey("sales")
                    .setYName("Sales")
            ))
            .setAxes(List.of(
                new AgCategoryAxisOptions<>()
                    .setType("category")
                    .setPosition(AgCartesianAxisPosition.BOTTOM),
                new AgNumberAxisOptions<>()
                    .setType("number")
                    .setPosition(AgCartesianAxisPosition.LEFT)
            ));

        return """
            <ag-charts-angular [options]="chartOptions">
            </ag-charts-angular>
            """;
    }
}

CRTP Pattern

All options classes use CRTP for type-safe fluent builders:

public class AgChartOptions<J extends AgChartOptions<J>>
        extends ChartOptionsBase<J> {

    public J setTitle(AgChartCaptionOptions<?> title) {
        this.title = title;
        return (J) this;
    }

    public J setSeries(List<AgSeriesBaseOptions<?>> series) {
        this.series = series;
        return (J) this;
    }
}

Method chaining returns correct type:

AgChartOptions<MyComponent> options = new AgChartOptions<>(this)
    .setTitle(title)    // Returns AgChartOptions<MyComponent>
    .setSeries(series)  // Still AgChartOptions<MyComponent>
    .setLegend(legend); // Type-safe throughout

Best Practices

  • Use CRTP pattern correctly — Always use generic type <J extends YourClass<J>>
  • Set required fields — Ensure type, xKey, yKey for series
  • Leverage themes — Use built-in themes for consistency
  • Handle null data — Check for null/undefined before rendering
  • Optimize updates — Batch data updates to minimize re-renders
  • Follow Angular patterns — Use observables for reactive data
  • Test with real data — Use production-like datasets

References