Data Binding

The data map for Sparklines for WireBootstrap is listed below. The component expects these field names in its data configuration.

Properties

Name
Description

value

The field containing the values to be used in the chart.

Datamap

Use the datamap configuration property to bind a data structure to the component.

The following example creates a bar chart showing sales for six months.

const salesData = [
    { month: "Jan", sales: 2544 },
    { month: "Feb", sales: 1439 },
    { month: "Mar", sales: 3849 },
    { month: "Apr", sales: 2341 },
    { month: "May", sales: 2932 },
    { month: "Jun", sales: 1976 }
]
new wire.sparkline().render("#chart", {
    data: salesData,
    datamap: {value: "sales"}
});

Last updated