The Chart Java API (patternfly-java-charts module) provides Java component wrappers for PatternFly chart visualizations. This module packages chart components as a GWT library (gwt-lib) that integrates with both GWT and J2CL applications. The Java API serves as a type-safe interface to chart web components that are implemented using React and distributed via the @patternfly-java/charts NPM package.
For information about the underlying web component implementation, see Chart Web Components. For details on the NPM package build process, see Chart Build and Publishing.
The patternfly-java-charts module follows the standard PatternFly Java architecture but uses specialized packaging to support chart-specific requirements. The module provides Java component classes that extend BaseComponent and integrate with the chart web components at runtime.
Sources: charts/pom.xml1-77
The charts module uses the gwt-lib packaging type, which differs from standard JAR packaging in several important ways:
| Aspect | Configuration | Purpose |
|---|---|---|
| Packaging Type | gwt-lib | Produces a GWT library archive suitable for both GWT and J2CL consumption |
| Module Name | org.patternfly.Charts | Defines the GWT module descriptor location |
| Resource Inclusion | .js files from src/main/java and src/main/resources | Includes JavaScript resources needed by chart components |
The gwt-lib packaging is configured via the gwt-maven-plugin:
This packaging type ensures that:
.gwt.xml files) are preservedSources: charts/pom.xml31 charts/pom.xml68-74
The charts module depends on two core PatternFly Java modules:
patternfly-java-core - Provides foundational classes:
BaseComponent for HTML element wrappingpatternfly-java-tokens - Provides design system integration:
Token enum with CSS custom propertiesSources: charts/pom.xml35-43
The charts module includes JavaScript files as resources, which are packaged with the GWT library for runtime access. This configuration allows chart components to load necessary JavaScript code when integrated into applications.
The resource configuration includes two directories:
This dual-directory approach allows:
src/main/java)src/main/resources)Sources: charts/pom.xml52-64
The module defines a GWT module descriptor named org.patternfly.Charts, which serves as the entry point for integrating chart components into GWT applications. Applications using charts must inherit this module in their own .gwt.xml file:
The module descriptor:
patternfly-java-core and patternfly-java-tokens modulesSources: charts/pom.xml72
Chart components in the Java API follow the standard PatternFly Java component pattern, extending BaseComponent and implementing chart-specific interfaces. The architecture bridges Java code with React-based web components:
The Java components:
Sources: charts/pom.xml36-39
Applications using the charts module must:
Add the Maven dependency:
For GWT applications: Inherit the Charts module in .gwt.xml:
For J2CL applications: Include the charts module in the classpath; the patternfly-java-j2cl module handles integration automatically.
Include runtime dependencies: The @patternfly-java/charts NPM package must be available at runtime, as documented in Chart Web Components.
Sources: charts/pom.xml1-77
The charts module includes JUnit Jupiter for unit testing, following the standard PatternFly Java testing approach:
Tests verify:
Sources: charts/pom.xml45-48
Refresh this wiki
This wiki was recently refreshed. Please wait 5 days to refresh again.