PercentColumn
A column that either displays a basic percent number, a rectangular progress bar, or a circular progress bar.
new Grid({
appendTo : document.body,
columns : [
{ type: 'percent', text: 'Progress', data: 'progress' }
]
});
Styling
All cells in this column get a b-percent-cell class added.
If mode is set to bar (default), the progress bar element in the cell gets a few special CSS classes added:
- If value equals 0, a
b-zeroCSS class is added to the circle element. - If value is less than lowThreshold, a
b-lowCSS class is added to the bar element. - If value equals 100, a
b-fullCSS class is added to the bar element. - If value is > 100, a
b-overCSS class is added to the bar element.
If mode is set to circle, the progress circle element in the cell gets a few special CSS classes added:
- If value equals 0, a
b-emptyCSS class is added to the circle element. - If value equals 100, a
b-fullCSS class is added to the circle element. - If value is > 100, a
b-overCSS class is added to the circle element.
Default editor is a NumberField.
Useful configs
| Config | Description |
|---|---|
| mode | Display mode: bar, circle, or number |
| lowThreshold | Value below which b-low CSS class is added |
| showValue | Show numeric value inside the bar |
See also
- NumberColumn - Parent column type
- NumberField - Default editor widget
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
When below this percentage the bar will have
b-lowCSS class added. By default, it turns the bar red.Has a corresponding runtime lowThreshold property.
-
This mode controls the rendering.
numberto render a formatted number value (e.g. 15%)circleto render a circular progress barbarto render a plain rectangular progress bar
Has a corresponding runtime mode property.
-
Set to
trueto render the number value inside the bar, for example'15%'.Has a corresponding runtime showValue property.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of PercentColumn class, or subclass thereof.
-
Identifies an object as an instance of PercentColumn class, or subclass thereof.
-
When below this percentage the bar will have
b-lowCSS class added. By default, it turns the bar red.Has a corresponding lowThreshold config.
-
This mode controls the rendering.
numberto render a formatted number value (e.g. 15%)circleto render a circular progress barbarto render a plain rectangular progress bar
Has a corresponding mode config.
-
Set to
trueto render the number value inside the bar, for example'15%'.Has a corresponding showValue config.
Functions
Functions are methods available for calling on the classCSS variables
CSS variables that can be set to adjust appearance| Name | Description |
|---|---|
| --b-percent-column-bar-background | Percent bar background color (the "empty" part of the bar) |
| --b-percent-column-bar-border | Percent bar border |
| --b-percent-column-bar-border-radius | Percent bar border radius |
| --b-percent-column-bar-max-height | Percent bar max height |
| --b-percent-column-circle-background |
circle Background color for the circle in "circle" mode
|
| --b-percent-column-circle-done-color |
circle Color of the filled part of the circle in "circle" mode
|
| --b-percent-column-circle-label-background |
circle Background color for the label (center) in "circle" mode
|
| --b-percent-column-circle-label-color |
circle Value label's color in "circle" mode
|
| --b-percent-column-circle-label-font-size |
circle Label font size in "circle" mode
|
| --b-percent-column-circle-thickness |
circle Thickness of the outer circle in "circle" mode
|
| --b-percent-column-fill-background | Fill color for the bar (the "filled" part of the bar) |
| --b-percent-column-low-fill-background | Fill color for the bar when value is below `lowThreshold` |
| --b-percent-column-low-value-color | Value label's color when the value is below `lowThreshold` |
| --b-percent-column-value-color | Value label's color |
| --b-percent-column-wide-value-color | Value label's color when the bar is wide, and label gets moved inside the bar |
| --b-percent-column-zero-value-color | Value label's color when the value is zero |