LineChart

LineChart is a component for drawing line charts to compare multiple sets of data.

Usage

import { LineChart } from "@yamada-ui/react"
<LineChart.Root>
  <LineChart.Line>
    <LineChart.LabelList />
  </LineChart.Line>
  <LineChart.Label />
  <LineChart.ReferenceLine />
  <LineChart.Grid />
  <LineChart.XAxis />
  <LineChart.YAxis />
  <LineChart.Tooltip />
  <LineChart.Legend />
</LineChart.Root>

Composition

Change Size

Change Color Scheme

Change Color

Change Type

To change the type, set type in series or lineProps.type to "monotone", "linear", etc. The default is "monotone".

Add Y Axis

To add the Y axis, set withYAxis to true. The default is false.

To change the orientation of the Y axis, set yAxisProps.orientation to "start" or "end". The default is "start".

Add Legend

To add the legend, set withLegend to true. The default is false. To change the placement of the legend, set legendProps.placement to "start-start", "end-end", etc. The default is "start-end".

Change Name

To change item names in the tooltip or legend, set name in series.

Change Grid

To change the grid, set booleans in gridProps.horizontal and gridProps.vertical.

Add Dot

To add dots, set dot of series or lineProps.dot to true. The default is false.

Add Label

To add labels, set label of series or lineProps.label to true. The default is false.

Add Unit

To add units, use formatter, tickFormatter, or set a string in unit.

Sync

To sync charts, set syncId to a string.

Format

To format values, use formatter, tickFormatter, etc.

Add Reference Line

Add Tick Line

To add tick lines, set xAxisProps.tickLine or yAxisProps.tickLine to true. The default is false.

Add Axis Label

To add axis labels, set a string in xAxisProps.label or yAxisProps.label. The default is false.

Set Domain

To set the range, set yAxisProps.domain to [min, max]. To set the interval, set an array in yAxisProps.ticks.

Add Tooltip Cursor

To add a tooltip cursor, set tooltipProps.cursor to true. The default is false.

Hide X Axis

To hide the X axis, set withXAxis to false. The default is true.

Hide Active Dot

To hide active dots, set activeDot in series or lineProps.activeDot to false. The default is true.

Hide Tooltip

To hide the tooltip, set withTooltip to false. The default is true.

Customize Axis

Customize Dot

Customize Active Dot

Customize Label

Customize Grid

Customize Tooltip Cursor

Props