kor TürkçeGitHub

BarChart

Compares categories with vertical or horizontal bars.

kor/ui/BarChartSource

When to use

  • Compare categories side by side, stacked or in percent.
  • For long names use horizontal bars; for time series use Trend.

Examples

Grouped bars

Loading the example

<k:BarChart label="Sales by quarter" labels="{/quarters}" unit="thousand TRY">
	<k:Series name="2025" values="{/last}"/>
	<k:Series name="2026" values="{/now}"/>
</k:BarChart>

Horizontal, with values

Loading the example

<k:BarChart horizontal="true" showValues="true" label="Open orders by plant" labels="{/plants}" unit="orders">
	<k:Series name="Open orders" values="{/open}"/>
</k:BarChart>

Stacked

Loading the example

<k:BarChart stack="stacked" showValues="true" label="Shipments by channel" labels="{/quarters}" unit="tons">
	<k:Series name="Road" values="{/road}"/>
	<k:Series name="Sea" values="{/sea}"/>
	<k:Series name="Air" values="{/air}"/>
</k:BarChart>

Percent, horizontal

Loading the example

<k:BarChart stack="full" horizontal="true" label="Delivery performance" labels="{/carriers}">
	<k:Series name="Late" values="{/late}"/>
	<k:Series name="On time" values="{/ontime}"/>
</k:BarChart>

Negative values

Loading the example

<k:BarChart showValues="true" label="Monthly net cash" labels="{/months}" unit="thousand TRY" height="220">
	<k:Series name="Net cash" values="{/net}"/>
</k:BarChart>

Keyboard

← → ↑ ↓
Move between categories: left and right for vertical bars, up and down for horizontal bars.
Home End
Go to the first or last category.
Enter
Presses the category when barPress is set.

API

Properties

NameTypeDefaultDescription
labelsobjectCategory names
labelstringAccessible name
horizontalbooleanfalseWhether bars are horizontal
stackstringnonenone (grouped), stacked or full (percent)
heightint0Height in pixels. 0 means 260 for vertical bars and one row per category for horizontal bars
unitstringUnit
decimalsint0Decimal places
showValuesbooleanfalseWrites values at bar ends; totals when stacked. Values that do not fit are left out

Aggregations

NameTypeDescription
seriesSeries[]Series (up to 6). Series.kind is not used

Events

NameTypeDescription
barPressindex: int
label: string
seriesIndex: int
A bar was pressed. seriesIndex is -1 from the keyboard or between bars

Methods

NameDescription
getBars(i: number): Bar[]Where each bar of a category starts and ends. Stacks add positives and negatives separately.

Series

A series of a Trend or BarChart.

Properties

NameTypeDefaultDescription
namestringSeries name
valuesobjectArray of numeric values
kindstringlineFor Trend: area, line, bar or ghost

Related

PieChartTrendWaterfall