# Chartist — Simple Responsive Charts with SVG > A lightweight charting library that uses SVG to render beautiful, responsive charts with minimal configuration. Chartist focuses on clean design and CSS-based styling for maximum flexibility. ## Install Save as a script file and run: # Chartist — Simple Responsive Charts with SVG ## Quick Use ```bash npm install chartist ``` ```html
``` ## Introduction Chartist is a charting library that renders responsive SVG charts with a focus on simplicity and clean design. Unlike canvas-based libraries, Chartist produces accessible SVG markup that can be fully styled with CSS, making it easy to match charts to any design system. ## What Chartist Does - Renders line, bar, and pie charts using inline SVG - Creates fully responsive charts that scale with their container - Supports CSS-based styling for colors, fonts, and animations - Provides a plugin system for tooltips, legends, and custom behaviors - Works with vanilla JavaScript, React, Vue, and Angular wrappers ## Architecture Overview Chartist generates SVG elements directly in the DOM. Each chart type has a dedicated renderer that maps data points to SVG paths, lines, and shapes. The library calculates axis scales and label positions, then outputs clean SVG markup with class names for CSS hooks. Responsiveness is handled by watching the container size and redrawing when dimensions change. ## Self-Hosting & Configuration - Install via npm: `npm install chartist` - Import CSS: `import "chartist/dist/chartist.min.css"` - Create a chart by passing a CSS selector, data, and optional config - Customize appearance through CSS classes like `.ct-series-a` and `.ct-bar` - Add plugins for tooltips, axis titles, or threshold lines ## Key Features - Pure SVG output for accessibility and CSS styling - Responsive by default with configurable aspect ratios - CSS animation support for chart transitions - Plugin architecture for extending functionality - Small bundle size under 10 KB gzipped ## Comparison with Similar Tools - **Chart.js** — Canvas-based with more chart types; Chartist uses SVG for CSS styling - **D3.js** — Low-level visualization toolkit; Chartist is higher-level and simpler - **Recharts** — React-specific; Chartist is framework-agnostic - **Apache ECharts** — Full-featured with maps and 3D; Chartist is minimal and lightweight ## FAQ **Q: Can I animate Chartist charts?** A: Yes. Chartist supports CSS transitions and provides lifecycle events for programmatic SVG animations using SMIL or CSS keyframes. **Q: Does Chartist support real-time data updates?** A: Yes. Call the `update()` method with new data and Chartist redraws the chart. Combine with CSS transitions for smooth live updates. **Q: How do I add tooltips?** A: Use the `chartist-plugin-tooltip` package, which hooks into Chartist's event system to display values on hover. **Q: Is Chartist still maintained?** A: Chartist received a major v1.0 rewrite with TypeScript support and modern build tooling. The project continues to receive maintenance updates. ## Sources - [GitHub Repository](https://github.com/chartist-js/chartist) - [Official Documentation](https://chartist.dev) --- Source: https://tokrepo.com/en/workflows/asset-9d127ad5 Author: Script Depot