<chart> Component

The <chart> component creates data visualizations with clear configuration and data mapping.

🛠 Attributes

Attribute
Type
Required
Description

type

string

Yes

Chart type (bar, line, area, pie, donut, scatter)

title

string

No

Chart title

width

string

No

Chart width (e.g., 100%, 600px)

height

string

No

Chart height (e.g., 400px)

theme

string

No

Color theme (light, dark, custom)

Data Configuration

<chart type="bar">
  <!-- Data source configuration -->
  <data source="salesData">
    <!-- X-axis configuration -->
    <xAxis 
      field="month" 
      type="category"
      label="Month"
      format="MMM YYYY"
    />
    
    <!-- Y-axis configuration -->
    <yAxis 
      field="revenue" 
      type="number"
      label="Revenue"
      format="currency"
      currency="USD"
    />
    
    <!-- Series configuration -->
    <series 
      name="Revenue"
      type="bar"
      color="#3366FF"
      stack="true"
    />
    
    <!-- Additional series -->
    <series 
      name="Profit"
      field="profit"
      type="line"
      color="#00CC66"
    />
  </data>
  
  <!-- Chart customization -->
  <style>
    <grid show="true" color="#eee"/>
    <tooltip show="true" format="currency"/>
    <legend position="bottom" orientation="horizontal"/>
    <animation duration="500"/>
  </style>
</chart>

Chart Types and Their Specific Configurations

Bar Chart

Line Chart

Pie/Donut Chart

🧩 AI Interpretation Guidelines

  • Generate appropriate chart library initialization

  • Map data fields to chart dimensions

  • Apply styling and formatting

  • Handle interactions and tooltips

  • Support responsive sizing

  • Implement accessibility features

  • Generate appropriate legends and labels


Last updated