# Chart Plugins can draw charts with any JavaScript charting library. The TRMNLCharts helper supplies the framework's colors, so a chart adapts to the device and themes like the rest of the screen. ### Usage Any JavaScript library you can load from a CDN can draw charts. The examples below use [Highcharts](https://highcharts.com) and [Chartkick](https://chartkick.com). Use the `TRMNLCharts` helper for your chart colors. It is bundled in the plugin runtime and reads the right paint from the screen as the chart builds, so a chart follows the device and the active theme like the rest of the screen. The methods below are the ones these examples use; [Painting Charts](/framework/docs/3.4/paint_charts) carries the full list. - `series(i, n, { el })`: the fill for series _i_ of _n_, correct for the current device, mode, and theme. - `applySwatches({ el })`: paints legend markers tagged `data-chart-series="i"` with matching series colors. Add `data-chart-series-count="n"` when the series total differs from the number of marks on screen. - `textStyle(role, { el })`: resolves a framework typography role for SVG text. - `options({ el })` and `merge()`: the recommended adaptive Highcharts defaults, merged under your overrides. - `watch(el, buildFn)`: rebuilds the chart when device, scale, mode, dark mode or theme changes. - `paint(token, { el })`: one framework color, as a flat color on solid panels or a dither pattern on 1- and 2-bit screens. - `grid({ el, dir })` and `axisLine({ el })`: the grid-line and axis and tick options that `options()` already applies, for an axis you build by hand. `{ el }` is the chart container id or element. Omit it on a single-screen plugin. `TRMNLCharts` is the Highcharts adapter built on `TRMNLPaint`, the framework's public JS paint API. Grid lines and plotted text use the same border and typography systems as the rest of the screen. For anything beyond Highcharts, use TRMNLPaint directly: see [Paint API](/framework/docs/3.4/paint_api) . On screens that dither, series paints are patterns that Highcharts draws through its pattern-fill module; load `pattern-fill.js` next to `highcharts.js` as the examples do. Maps follow the same pattern: `TRMNLMaps` composes MapLibre GL JS styles from framework paint over OpenStreetMap vector tiles. See [Map](/framework/docs/3.4/map) . Highcharts takes sizes as plain numbers, so they do not follow the device scale on their own. Pass heights, spacing, line widths, and label offsets through `TRMNLPaint.px()` inside `TRMNLCharts.watch()`. The watcher rebuilds the chart after a scale change, and the paint API supplies the new numbers. Set `height: null` in the chart options and the chart expands to fill the available space. Disable animations, or TRMNL's screenshot service may capture the chart only partially drawn. These examples load Highcharts and Chartkick from trmnl.com, so they render empty without network. Highcharts is a commercial library that TRMNL licenses, and a custom stack brings its own charting library and license. #### Line Chart A line chart tracks a value over time. 25,388Pageviews 4,771Visitors 2.23Mins on Page ![TRMNL Logo](/images/plugins/trmnl--render.svg)ChartsLine Chart ```
25,388 Pageviews
4,771 Visitors
2.23 Mins on Page
Simple Analytics Logo Simple Analytics trmnl.com
``` #### Multi-Series Line Chart A multi-series chart compares several lines in one plot. This example plots the current period against the previous one. $85,240Total Sales 32Pending Orders Jul 01 - Jul 15 Current $128AOV 665Fulfilled Orders Jun 15 - Jun 30 Previous ![TRMNL Logo](/images/plugins/trmnl--render.svg)ChartsMulti-Series Line Chart ```
$85,240 Total Sales
32 Pending Orders
Jul 01 - Jul 15
Current
$128 AOV
665 Fulfilled Orders
Jun 15 - Jun 30
Previous
Charts Multi-Series Line Chart
``` #### Bar Chart Bar charts compare discrete categories side by side. This example plots four metrics across six months. $31,883Revenue $22,910Expenses $8,990Marketing $14,930Operations ![TRMNL Logo](/images/plugins/trmnl--render.svg)ChartsBar Chart ```
$31,883 Revenue
$22,910 Expenses
$8,990 Marketing
$14,930 Operations
``` #### Gauge Chart A gauge shows a single score. This example puts seven daily gauges in a row above one weekly summary gauge. Monday Tuesday Wednesday Thursday Friday Saturday Sunday 18%REM Sleep 23%Deep Sleep 12mTime to Sleep 7h 32minSleep Duration 8Toss & Turns 0.5%Snoring ![TRMNL Logo](/images/plugins/trmnl--render.svg)ChartsGauge Chart ```
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
18% REM Sleep
23% Deep Sleep
12m Time to Sleep
7h 32min Sleep Duration
8 Toss & Turns
0.5% Snoring
``` Previous [ ## Table Create data tables optimized for 1-bit rendering ](/framework/docs/3.4/table) Next [ ## Map Plot locations and routes on a vector map that adapts to the device and theme ](/framework/docs/3.4/map)