Getting Started
Charts
- Charts
- Line Chart
- Bar Chart
- Area Chart
- Scatter Chart
- Pie Chart
- Donut Chart
- Dot Plot Chart
- Lollipop Chart
- Dumbbell Chart
- Slope Chart
- Range Chart
- Histogram Chart
- Box Plot Chart
- Violin Chart
- Polar Chart
- Parallel Coordinates
- SPLOM Chart
- Parcats Chart
- Candlestick Chart
- OHLC Chart
- Waterfall Chart
- Funnel Chart
- Heatmap Chart
- Contour Chart
- Density Chart
- Ternary Chart
- Radar Chart
- Treemap Chart
- Sunburst Chart
- Sankey Chart
- Gauge Chart
- Bullet Chart
- Icicle Chart
- Network Graph
- Dendrogram
- Choropleth Chart
cyl
4
6
8
"use client"
import { LollipopChart } from "@/components/ui/charts"
const data = [
{ category: "TYC", value: 2.3, color: "#00BFC4", group: "4 cyl" },
{ category: "F28", value: 2.0, color: "#00BFC4", group: "4 cyl" },
{ category: "HCV", value: 1.7, color: "#00BFC4", group: "4 cyl" },
{ category: "LEU", value: 1.7, color: "#00BFC4", group: "4 cyl" },
{ category: "FX9", value: 1.2, color: "#00BFC4", group: "4 cyl" },
{ category: "P91", value: 1.0, color: "#00BFC4", group: "4 cyl" },
{ category: "M24", value: 0.7, color: "#00BFC4", group: "4 cyl" },
{ category: "MRX", value: 0.2, color: "#F8766D", group: "6 cyl" },
{ category: "H4D", value: 0.2, color: "#F8766D", group: "6 cyl" },
{ category: "FDN", value: 0.0, color: "#F8766D", group: "6 cyl" },
{ category: "M28", value: -0.1, color: "#F8766D", group: "6 cyl" },
{ category: "VAL", value: -0.2, color: "#F8766D", group: "6 cyl" },
{ category: "M2C", value: -0.4, color: "#F8766D", group: "6 cyl" },
{ category: "HSB", value: -0.2, color: "#7CAE00", group: "8 cyl" },
{ category: "M4S", value: -0.4, color: "#7CAE00", group: "8 cyl" },
{ category: "M4E", value: -0.6, color: "#7CAE00", group: "8 cyl" },
{ category: "DCH", value: -0.8, color: "#7CAE00", group: "8 cyl" },
{ category: "AMJ", value: -0.8, color: "#7CAE00", group: "8 cyl" },
{ category: "CZ8", value: -1.1, color: "#7CAE00", group: "8 cyl" },
{ category: "CFL", value: -1.6, color: "#7CAE00", group: "8 cyl" },
]
export function LollipopChartDemo() {
return <LollipopChart data={data} dotSize={10} yAxisLabel="mpg_z" />
}
About
The Lollipop Chart is a variation of a bar chart where bars are replaced with lines (stems) and circles (dots). It's especially effective for diverging data where values can be positive or negative, with stems extending from a zero baseline.
Installation
pnpm dlx shadcn@latest add https://ui.simplifying.ai/r/lollipop-chart.json
Usage
import { LollipopChart } from "@/components/ui/charts"
const data = [
{ category: "Product A", value: 1.5, color: "#00BFC4", group: "High" },
{ category: "Product B", value: 0.8, color: "#00BFC4", group: "High" },
{ category: "Product C", value: -0.3, color: "#F8766D", group: "Low" },
{ category: "Product D", value: -1.2, color: "#F8766D", group: "Low" },
]
export function Example() {
return (
<LollipopChart
data={data}
orientation="vertical"
showLegend
yAxisLabel="Score"
/>
)
}API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| data | LollipopDataPoint[] | required | Array of data points |
| orientation | "horizontal" | "vertical" | "vertical" | Chart orientation |
| dotSize | number | 12 | Radius of dots in pixels |
| showGrid | boolean | true | Show grid lines |
| showLegend | boolean | true | Show legend for grouped data |
| color | string | "#2563eb" | Default dot color |
| stemColor | string | "#e5e7eb" | Stem color |
| yAxisLabel | string | - | Label for the y-axis |
Data Format
interface LollipopDataPoint {
category: string // Label for the data point
value: number // Can be positive or negative
color?: string // Optional custom color
group?: string // Optional group for legend
}Notes
- Lollipop charts excel at showing diverging data with positive and negative values
- The zero baseline makes it easy to identify above/below average values
- Use the
groupproperty to create a color legend for categorical groupings - Chart width automatically scales based on the number of data points
- Horizontally scrollable when data exceeds viewport width
- Works well with normalized/z-score data for comparing across different scales
Deploy and Scale Agents with Simplifying AI
Simplifying AI delivers the infrastructure and developer experience you need to ship reliable audio & agent applications at scale.
Talk to an expert