ASCII-styled data visualization components with bar, line, and area chart variants.
npm install react-ascii-ui
import { AsciiChart } from 'react-ascii-ui';
export default function Example() {
const data = [3, 7, 4, 9, 2, 8, 5];
return (
<AsciiChart
data={data}
type="bar"
color="success"
title="Sales Data"
showValues
/>
);
}<AsciiChart
data={[5, 8, 3, 9, 2, 7, 4, 6]}
type="bar"
height={6}
showValues
/><AsciiChart
data={[2, 5, 3, 8, 4, 6, 1, 7, 3, 5]}
type="line"
color="primary"
height={8}
/><AsciiChart
data={[1, 4, 2, 6, 3, 5, 2, 4]}
type="area"
color="success"
height={7}
/><AsciiChart
data={[12, 19, 3, 17, 6, 3, 19, 6]}
type="bar"
color="warning"
title="Monthly Revenue"
showValues
height={8}
/><AsciiChart
data={[7, 2, 9, 1, 8, 3, 6, 4]}
type="area"
color="error"
title="System Errors"
showValues
/>| Prop | Type | Default | Description |
|---|---|---|---|
| data | number[] | - | Array of numeric data points to visualize |
| type | 'bar' | 'line' | 'area' | 'bar' | Chart visualization type |
| height | number | 8 | Height of the chart in character rows |
| width | number | data.length | Width of the chart in characters |
| showValues | boolean | false | Whether to show min/max values below the chart |
| color | 'default' | 'success' | 'warning' | 'error' | 'primary' | 'default' | Color theme for the chart |
| title | string | - | Optional title displayed above the chart |
| className | string | "" | Additional CSS classes |
AsciiChart extends all HTML div attributes and supports all React div props.