SparklineColumn
Displays a sparkline (a small inline chart that gives an at-a-glance view of trends in a data series) in a grid cell.
Sparkline column
//<code-header>
fiddle.title = 'Sparkline column';
//</code-header>
class Row extends GridRowModel {
static fields = [
{ name : 'name' },
{ name : 'monthlySales' }
];
}
const
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
products = [
'Blue jeans mens L', 'Sweatshirt XL', 'Black turtleneck womens M', 'Red flannel shirt mens S', 'White tank top womens XS', 'Denim jacket mens L'
],
data = ArrayHelper.populate(6, n => ({
id : n,
name : products[n],
// The Sparkline column expects an array of numeric values in its configured `field`, on each record
monthlySales : months.map(m => Math.round(Math.random() * 80 + 20)),
rating : Math.round(Math.random() * 5)
}));
// grid with SparklineColumn
const grid = new Grid({
appendTo : targetElement,
// makes grid as high as it needs to be to fit rows
autoHeight : true,
rowHeight : 35,
data,
columns : [
{
text : 'Name',
field : 'name',
width : 300,
editor : {
type : 'textfield',
required : true
}
},
{
id : 'line',
text : 'Sparkline',
width : 120,
type : 'sparkline',
field : 'monthlySales'
},
{
id : 'bar',
text : 'Bar',
width : 120,
type : 'sparkline',
chartType : 'bar',
field : 'monthlySales'
},
{
id : 'pie',
text : 'Pie',
width : 80,
type : 'sparkline',
chartType : 'pie',
field : 'monthlySales'
},
...months.map((monthName, i) => ({
text : monthName,
width : 80,
editor : false,
renderer : ({ record }) => record.monthlySales[i]
}))
]
});The column's field should be a property on your Grid data model containing an array of numbers that make up the data series to display in the sparkline.
SparklineColumn supports chartTypes of line, bar, and pie.
new Grid({
columns : [
{
type : 'sparkline',
chartType : 'line',
field : 'values' // field named here should contain
// an array of numbers
}
]
});
Note that this column requires using thin bundles or thin npm packages in your application, and importing the
chart
bundle / package. It does not work with normal packages, module or umd bundles.
Configs
86
Configs
86Common
autoHeightColumn
autoWidthColumn
fieldColumn
fitModeColumn
flexColumn
listenersEvents
maxWidthColumn
textColumn
widgetsWidgetColumn
widthColumn
Other
The type of chart.
The hex color to use to highlight the minimum and maximum values when highlightMinMax is
true. Applicable for chartTypes line and bar.
Whether to highlight the minimum and maximum values in highlightColor. Applicable for
chartTypes line and bar.
chartChartColumn
formulaColumn
pinnedColumn
pinnedWidthColumn
readOnlyColumn
Integration
vueColumn
Interaction
cellEditorColumn
collapsedColumn
collapseModeColumn
collapsibleColumn
draggableColumn
editorColumn
filterableColumn
finalizeCellEditColumn
groupableColumn
hideableColumn
invalidActionColumn
managedCellEditingColumn
resizableColumn
revertOnEscapeColumn
sealedColumn
searchableColumn
sortableColumn
toggleAllHiddenColumn
Menu
cellMenuItemsColumn
enableCellContextMenuColumn
enableHeaderContextMenuColumn
headerMenuItemsColumn
showColumnPickerColumn
Misc
alwaysClearCellColumn
autoSyncHtmlColumn
bubbleEventsEvents
callOnFunctionsEvents
editTargetSelectorColumn
filterTypeColumn
headerWidgetsColumn
headerWritingModeColumn
htmlEncodeColumn
htmlEncodeHeaderTextColumn
instantUpdateColumn
localeClassLocalizable
localizableLocalizable
localizablePropertiesLocalizable
responsiveLevelsColumn
tagsColumn
touchConfigColumn
treeColumn
Rendering
afterRenderCellWidgetColumn
cellClsColumn
chartClsChartColumn
clsColumn
groupRendererColumn
headerRendererColumn
iconColumn
rendererWidgetColumn
tooltipColumn
tooltipRendererColumn
Properties
154
Properties
154Common
autoHeightColumn
autoWidthColumn
fieldColumn
fitModeColumn
flexColumn
maxWidthColumn
textColumn
widgetsWidgetColumn
widthColumn
Class hierarchy
Identifies an object as an instance of SparklineColumn class, or subclass thereof.
Identifies an object as an instance of SparklineColumn class, or subclass thereof.
isChartColumnChartColumn
isColumnColumn
isEventsEvents
isLocalizableLocalizable
isModelModel
isModelLinkModelLink
isModelStmModelStm
isTreeNodeTreeNode
isWidgetColumnWidgetColumn
Editing
copyOfModel
isBatchUpdatingModel
isCommittingModel
isCreatingModel
isModifiedModel
isValidModel
modificationDataModel
modificationsModel
Integration
vueColumn
Interaction
cellEditorColumn
collapsedColumn
collapseModeColumn
collapsibleColumn
draggableColumn
editorColumn
filterableColumn
finalizeCellEditColumn
groupableColumn
hideableColumn
invalidActionColumn
managedCellEditingColumn
resizableColumn
revertOnEscapeColumn
sealedColumn
searchableColumn
sortableColumn
toggleAllHiddenColumn
JSON
jsonModel
Menu
cellMenuItemsColumn
enableCellContextMenuColumn
enableHeaderContextMenuColumn
headerMenuItemsColumn
showColumnPickerColumn
Misc
alwaysClearCellColumn
autoSyncHtmlColumn
callOnFunctionsEvents
editTargetSelectorColumn
filterTypeColumn
firstStoreModel
headerWidgetsColumn
headerWritingModeColumn
htmlEncodeColumn
htmlEncodeHeaderTextColumn
instantUpdateColumn
localeHelperLocalizable
localeManagerLocalizable
responsiveLevelsColumn
stmModelStm
tagsColumn
touchConfigColumn
treeColumn
Other
chartChartColumn
contentElementColumn
defaultsColumn
elementColumn
formulaColumn
gridColumn
isPersistableModel
pinnedColumn
pinnedWidthColumn
readOnlyColumn
subGridColumn
textElementColumn
textWrapperColumn
visibleColumn
Parent & children
allChildrenTreeNode
allUnfilteredChildrenTreeNode
childLevelTreeNode
descendantCountTreeNode
firstChildTreeNode
isLeafTreeNode
isLoadedTreeNode
isParentTreeNode
isRootTreeNode
lastChildTreeNode
nextSiblingTreeNode
parentTreeNode
parentIdTreeNode
previousSiblingTreeNode
previousSiblingsTotalCountTreeNode
visibleDescendantCountTreeNode
Rendering
afterRenderCellWidgetColumn
cellClsColumn
clsColumn
groupRendererColumn
headerRendererColumn
iconColumn
rendererWidgetColumn
tooltipColumn
tooltipRendererColumn
Functions
78
Functions
78Configuration
Editing
beginBatchModel
cancelBatchModel
clearChangesModel
copyModel
endBatchModel
getDataModel
getUnmodifiedModel
hasBatchedChangeModel
isFieldModifiedModel
removeModel
revertChangesModel
setModel
Events
detachListenersBase
Identification
Misc
animatePropertyBase
callbackBase
downloadTestCaseBase
equalsModel
linkModelLink
resolveCallbackBase
updateLocalizationLocalizable
Other
addListenerEvents
getFilterableValueColumn
getRawValueColumn
hasListenerEvents
hideColumn
isEditableModel
onEvents
onAfterWidgetSetValueWidgetColumn
onBeforeWidgetSetValueWidgetColumn
refreshCellColumn
refreshCellsColumn
refreshHeaderColumn
relayAllEvents
removeAllListenersEvents
removeListenerEvents
resizeToFitContentColumn
resumeEventsEvents
showColumn
suspendEventsEvents
toggleColumn
toggleChildrenColumn
triggerEvents
unEvents
Parent & children
ancestorsExpandedTreeNode
appendChildTreeNode
bubbleTreeNode
bubbleWhileTreeNode
clearChildrenTreeNode
containsTreeNode
convertToParentTreeNode
getDescendantCountTreeNode
insertChildColumn
isExpandedTreeNode
removeChildTreeNode
replaceChildrenTreeNode
traverseTreeNode
traverseBeforeTreeNode
traverseWhileTreeNode
Events
5
Events
5Event handlers
5
Event handlers
5Typedefs
2
Typedefs
2BryntumListenerConfigEvents
RelationConfigModel