Code & DataChart

Chart

Turns a Markdown table into a chart. The first column becomes axis labels, the header row becomes series names, and data cells become values.

Bar chart

The default chart type displays data as vertical bars.

{% chart type="bar" title="Monthly Revenue" %}
| Month | Revenue | Expenses |
|-------|---------|----------|
| Jan   | 4200    | 3100     |
| Feb   | 5100    | 3400     |
| Mar   | 4800    | 3200     |
| Apr   | 6200    | 3800     |
{% /chart %}
<rf-chart data-rune="chart" data-rune-fields="{&quot;type&quot;:&quot;bar&quot;,&quot;stacked&quot;:&quot;false&quot;}">
  <table data-name="data">
    <caption>Monthly Revenue</caption>
    <thead>
      <tr>
        <th>Month</th>
        <th>Revenue</th>
        <th>Expenses</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Jan</td>
        <td>4200</td>
        <td>3100</td>
      </tr>
      <tr>
        <td>Feb</td>
        <td>5100</td>
        <td>3400</td>
      </tr>
      <tr>
        <td>Mar</td>
        <td>4800</td>
        <td>3200</td>
      </tr>
      <tr>
        <td>Apr</td>
        <td>6200</td>
        <td>3800</td>
      </tr>
    </tbody>
  </table>
</rf-chart>
Monthly Revenue
MonthRevenueExpenses
Jan42003100
Feb51003400
Mar48003200
Apr62003800
<rf-chart class="rf-chart" data-type="bar" data-stacked="false" data-rune="chart" data-density="compact">
  <table data-name="data" class="rf-chart__data">
    <caption>Monthly Revenue</caption>
    <thead>
      <tr>
        <th>Month</th>
        <th>Revenue</th>
        <th>Expenses</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Jan</td>
        <td>4200</td>
        <td>3100</td>
      </tr>
      <tr>
        <td>Feb</td>
        <td>5100</td>
        <td>3400</td>
      </tr>
      <tr>
        <td>Mar</td>
        <td>4800</td>
        <td>3200</td>
      </tr>
      <tr>
        <td>Apr</td>
        <td>6200</td>
        <td>3800</td>
      </tr>
    </tbody>
  </table>
</rf-chart>

Line chart

Use type="line" for trend data.

{% chart type="line" title="User Growth" %}
| Quarter | Users |
|---------|-------|
| Q1 2024 | 1000  |
| Q2 2024 | 2500  |
| Q3 2024 | 5000  |
| Q4 2024 | 8500  |
{% /chart %}
<rf-chart data-rune="chart" data-rune-fields="{&quot;type&quot;:&quot;line&quot;,&quot;stacked&quot;:&quot;false&quot;}">
  <table data-name="data">
    <caption>User Growth</caption>
    <thead>
      <tr>
        <th>Quarter</th>
        <th>Users</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Q1 2024</td>
        <td>1000</td>
      </tr>
      <tr>
        <td>Q2 2024</td>
        <td>2500</td>
      </tr>
      <tr>
        <td>Q3 2024</td>
        <td>5000</td>
      </tr>
      <tr>
        <td>Q4 2024</td>
        <td>8500</td>
      </tr>
    </tbody>
  </table>
</rf-chart>
User Growth
QuarterUsers
Q1 20241000
Q2 20242500
Q3 20245000
Q4 20248500
<rf-chart class="rf-chart" data-type="line" data-stacked="false" data-rune="chart" data-density="compact">
  <table data-name="data" class="rf-chart__data">
    <caption>User Growth</caption>
    <thead>
      <tr>
        <th>Quarter</th>
        <th>Users</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Q1 2024</td>
        <td>1000</td>
      </tr>
      <tr>
        <td>Q2 2024</td>
        <td>2500</td>
      </tr>
      <tr>
        <td>Q3 2024</td>
        <td>5000</td>
      </tr>
      <tr>
        <td>Q4 2024</td>
        <td>8500</td>
      </tr>
    </tbody>
  </table>
</rf-chart>

Attributes

AttributeTypeDefaultDescription
typestringbarChart type: bar, line, pie, or area
titlestringChart title
stackedbooleanfalseStack series values

Common attributes

All block runes share these attributes for layout and theming.

AttributeTypeDefaultDescription
widthstringcontentPage grid width: content, wide, or full
spacingstringVertical spacing: flush, tight, default, loose, or breathe
insetstringHorizontal padding: flush, tight, default, loose, or breathe
tintstringNamed colour tint from theme configuration
tint-modestringautoColour scheme override: auto, dark, or light
bgstringNamed background preset from theme configuration