DocsGitHub
Getting Started
  • Overview
  • Design Tokens
Components
  • Accordion
  • Alert
  • Announcement
  • Avatar
  • Badge
  • BigCalendar
  • Breadcrumb
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Checkbox
  • Chip
  • CloseButton
  • Combobox
  • CommandPalette
  • ContextMenu
  • Currency
  • DatePicker
  • DescriptionList
  • Drawer
  • DropdownMenu
  • EmptyState
  • Field
  • FileUpload
  • FormGrid
  • Hotkey
  • Icon
  • Input
  • Metric
  • Modal
  • MultiSelect
  • NumberInput
  • Pagination
  • Popover
  • ProgressBar
  • Radio
  • Rating
  • SegmentedControl
  • Select
  • SelectionCard
  • Sidebar
  • Skeleton
  • Slider
  • Spinner
  • Stepper
  • Switch
  • Table
  • Tabs
  • Textarea
  • Timeline
  • TimePicker
  • Toast
  • Tooltip
  • TransferList
  • TreeView
  • Wizard
Charts
  • Overview
  • Area Chart
  • Bar Chart
  • Donut Chart
  • Line Chart
  • Pie Chart
  • Stacked Bar Chart

Bar Chart

A column chart for comparing discrete values across categories.

Installation

tsx
import { BarChart } from "madagent";

Default

Loading chart...

Props

PropTypeDefaultDescription
data*
Record<string, unknown>[]
-The chart data array
xAxisKey*
string
-The data key used for the x-axis
config*
ChartConfig
-Maps each series key to a label and color
showGrid
boolean
trueShow the cartesian grid
showTooltip
boolean
trueShow the tooltip on hover
showLegend
boolean
falseShow the chart legend
showYAxis
boolean
falseShow the y-axis
height
number
350Container height in pixels
stacked
boolean
falseUse stacked bars
horizontal
boolean
falseRender bars horizontally
radius
number
8Bar corner radius in pixels

RTL Support

Components automatically adapt to right-to-left languages using CSS logical properties.

Preview

Loading chart...

Usage

tsx
<BarChart
  data={[
    { month: "يناير", desktop: 186, mobile: 80 },
    { month: "فبراير", desktop: 305, mobile: 200 },
    { month: "مارس", desktop: 237, mobile: 120 },
  ]}
  xAxisKey="month"
  config={{
    desktop: { label: "سطح المكتب", color: "var(--md-chart-1)" },
    mobile: { label: "الجوال", color: "var(--md-chart-2)" },
  }}
  height={300}
  showLegend
/>