Bar
import {Bar} from 'cx/charts';Bar charts are commonly used to compare numerical values across a range of categories.
<Svg style="width:500px; height:400px;">
<Chart offset="20 -20 -40 130" axes={{
x: { type: NumericAxis, snapToTicks: 0 },
y: { type: CategoryAxis, vertical: true, snapToTicks: 1 }
}}>
<Gridlines/>
<Repeater records-bind="$page.points" recordAlias="$point" sorters-bind="$page.sorters">
<Bar colorIndex={0}
name="Value 1"
height={0.3}
offset={-0.15}
active-bind="$page.v1"
x-bind="$point.v1"
y-bind="$point.key"
tooltip-tpl="{$point.v1:n;0}" />
<Bar colorIndex={5}
name="Value 2"
height={0.3}
offset={0.15}
active-bind="$page.v2"
x-bind="$point.v2"
y-bind="$point.key"
tooltip-tpl="{$point.v2:n;0}" />
</Repeater>
</Chart>
<Legend />
</Svg>| Property | Description | Type |
|---|---|---|
autoSize | Set to true to auto calculate size and offset. Available only if the x axis is a category axis. | boolean |
borderRadius | Border radius of the column/bar. Default | number |
colorIndex | Index of a color from the standard palette of colors. 0-15. | number |
colorMap | Used to automatically assign a color based on the | string |
colorName | Name used to automatically resolve color based from the contextual | string |
name | Name of the item as it will appear in the legend. | string |
offset | Of center offset of the column. Use this in combination with | number |
size | Size (width) of the column in axis units. | number |
stacked | Indicate that columns should be stacked on top of the other columns. Default value is | boolean |
x | The | string/number |
x0 | Base value. Default value is | number |
xAxis | Name of the horizontal axis. The value should match one of the horizontal axes set in the | string |
y | The | string/number |
yAxis | Name of the vertical axis. The value should match one of the vertical axes set in the | string |
active | Used to indicate if an item is active or not. Inactive items are shown only in the legend. | boolean |
class | Additional CSS classes to be applied to the element. If an object is provided, all keys with a "truthy" value will be added to the CSS class list. | string/object |
hiddenBase | If set to | boolean |
items | List of child elements. | array |
layout | Define an inner layout. | string/object |
legend | Name of the legend to be used. Default is | string | false |
legendAction | Action to be performed if the user clicks on the legend entry. Default value is | string |
legendShape | Shape of the icon in the the legend. Default value is based on the chart type.
Additional shapes can be registered using the | string |
mod | Appearance modifier. For example, | string/array |
outerLayout | Defines the outer layout which wraps the widget. | widget |
plainText | Set to | boolean |
preserveWhitespace | Keep whitespace in text based children. Default is | boolean |
putInto | Used with outer layouts. Specifies the name of the content placeholder which should render the widget. | string |
stack | Name of the stack. If multiple stacks are used, each should have a unique name.
Default value is | string |
style | Style object applied to the wrapper div. Used for setting the dimensions of the element. | string/object |
tooltip | Tooltip configuration. For more info see Tooltips. | string/object |
trimWhitespace | Remove all whitespace in text based children. Default is | boolean |
vdomKey | Key that will be used as the key when rendering the React component. | string |
visible | Visibility of the widget. Defaults to | boolean |