Chart declarative HTML API
The declarative HTML API enables you to create and configure charts directly in HTML using simple, semantic tags. It streamlines the charting process by embedding data and configuration options within HTML elements, avoiding complex JavaScript code.
G2Plot chart
Top-level web component, which is used to initialize a chart.
<rapid-g2plot-chart></rapid-g2plot-chart>
DOM API
Property and attribute binding examples for Genesis Component syntax. Closing tag omitted.
Attributes
Attribute | Type | Use | Example |
---|---|---|---|
type | ChartTypes | The type to use for the chart. If not set, the default bar type will be used. |
|
Properties
Property | Type | Use | Example |
---|---|---|---|
config | ChartConfig | The configuration to use for the chart. |
|
data | any[] | The data to display in the chart. |
|
Slots
Slot | Use |
---|---|
chart-datasource-error | The chart-datasource-error slot is displayed when the data source encounters errors, such as connection issues or invalid data. This slot allows you to define custom fallback content or error messages for a better user experience. |
Parts
Part | Use |
---|---|
chart-container | Using this part enables you to change the styles for the main chart container. |
Fired events
Events can be received by the emitting <rapid-g2plot-chart>
, or any parent element.
Event | Type | Use | Example |
---|---|---|---|
plot:click | Custom Event | Adds click events to the entire chart area. |
|
element:click | Custom Event | Adds click events to the element of the chart. |
|
legend-item:click | Custom Event | Adds click events to the legened element. |
|
For a complete list of available events, go to the G2Plot Events Documentation.
Listened events
This component doesn't listen to any public API events.
Chart datasource
The chart-datasource
element is used to declaratively set the data source for a rapid-g2plot-chart
.
<rapid-g2plot-chart>
<chart-datasource></chart-datasource>
</rapid-g2plot-chart>
DOM API
Property and attribute binding examples for Genesis Component syntax. Closing tag omitted.
Attributes
Attribute | Type | Use | Example |
---|---|---|---|
chart-fields | string | Defines the fields for chart configuration.
|
|
server-fields | string | Defines the fields of data to be charted.
|
|
resourceName | string | Name of the backend resource which contain the data. |
|
criteria | string | Clients can send a Groovy expression to perform filters on the query server, these remain active for the life of the subscription. More examples |
|
isSnapshot | boolean | Request a snapshot from the server. |
|
maxRows | number | Maximum number of rows to be returned as part of the initial message, and as part of any additional MORE_ROWS messages. This will not affect the number of rows displayed. |
|
maxView | number | Maximum number of rows to track as part of a client view or table. |
|
orderBy | string | This option can be used to select a Data Server index (defined in the Data Server query), which is especially useful if you want the data to be sorted in a specific way. |
|
reverse | boolean | This option changes the Data Server index iteration. |
|
rowId | string | Attribute to set an unique identifier for the row. |
|
is-stack | boolean | If true, will enable stacked chart to effectively portray comparisons of total values across several categories |
|
is-group | boolean | If true, will enable grouped chart plotting numeric values for levels of two categorical variables instead of one. |
|
reduced | boolean | Enabled by default, will not work if a custom charts-fields is used (requires [type, value]) |
|
with-timestamp-formatting | boolean | Enabled by default, will format UNIX timestamp fields to readable DATE|DATETIME values |
|
show-formatted-time | boolean | Disabled by default, will ignore the TIME portion in the Chart labels. Only works if withTimestampFormatting is true. Only affects DATETIME fields. |
|
Criteria use groovy expressions to filter responses from the back end.
Properties
Property | Type | Use | Example |
---|---|---|---|
request | any | This optional parameter enables you to specify request fields, which can include wildcards. |
|
data | any[] | Optional attribute that can be used to pass the data that will be used in the component. |
|
Slots
This component doesn't have any slots.
Parts
This component doesn't have any css parts.
Fired events
This component doesn't fire any events.
Listened events
This component doesn't listen to any events.