Loading...
Loading...
Implement Syncfusion React Sparkline components for compact, inline data visualization. Use this when working with sparklines, mini charts, or trend indicators in constrained spaces. This skill covers all 5 sparkline types (line, column, area, win-loss, pie), tooltips, markers, data labels, range bands, axis customization, and themes. Ideal for displaying data trends within grids, dashboards, or tables without full-sized charts.
npx skill4agent add syncfusion/react-ui-components-skills syncfusion-react-sparkline@syncfusion/ej2-react-chartsSparklineComponentnpm install @syncfusion/ej2-react-charts --saveimport { SparklineComponent } from '@syncfusion/ej2-react-charts';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
function App() {
const data = [0, 6, 4, 1, 3, 2, 5];
return (
<SparklineComponent
dataSource={data}
type="Line"
height="150px"
width="300px"
/>
);
}
export default App;
ReactDOM.render(<App />, document.getElementById('charts'));import { SparklineComponent, Inject, SparklineTooltip } from '@syncfusion/ej2-react-charts';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
function App() {
const data = [0, 6, 4, 1, 3, 2, 5];
return (
<SparklineComponent
dataSource={data}
type="Area"
height="150px"
width="300px"
tooltipSettings={{ visible: true, format: '${x} : ${y}' }}
>
<Inject services={[SparklineTooltip]} />
</SparklineComponent>
);
}
export default App;
ReactDOM.render(<App />, document.getElementById('charts'));import { SparklineComponent } from '@syncfusion/ej2-react-charts';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
function ColumnSparkline() {
const data = [3, 6, 4, 1, 3, 2, 5];
return (
<SparklineComponent
dataSource={data}
type="Column"
height="150px"
width="300px"
markerSettings={{ visible: ['High', 'Low'] }}
highPointColor="green"
lowPointColor="red"
/>
);
}
export default ColumnSparkline;
ReactDOM.render(<ColumnSparkline />, document.getElementById('charts'));import { SparklineComponent } from '@syncfusion/ej2-react-charts';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
function WinLossSparkline() {
const data = [12, 15, -10, 13, 15, 6, -12, 17, 13, 0, 8, -10];
return (
<SparklineComponent
dataSource={data}
type="WinLoss"
height="150px"
width="300px"
tiePointColor="blue"
/>
);
}
export default WinLossSparkline;
ReactDOM.render(<WinLossSparkline />, document.getElementById('charts'));import { SparklineComponent } from '@syncfusion/ej2-react-charts';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
function SparklineWithLabels() {
const data = [0, 6, 4, 1, 3, 2, 5];
return (
<SparklineComponent
dataSource={data}
type="Line"
height="150px"
width="300px"
dataLabelSettings={{
visible: ['Start', 'End'],
border: { color: 'blue', width: 1 },
fill: 'blue',
opacity: 0.4,
textStyle: { color: 'white' }
}}
/>
);
}
export default SparklineWithLabels;
ReactDOM.render(<SparklineWithLabels />, document.getElementById('charts'));import { SparklineComponent } from '@syncfusion/ej2-react-charts';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
function SparklineWithRangeBand() {
const data = [0, 6, 4, 1, 3, 2, 5];
return (
<SparklineComponent
dataSource={data}
type="Area"
height="150px"
width="300px"
rangeBandSettings={[
{ startRange: 1, endRange: 3, color: '#bfd4fc', opacity: 0.4 }
]}
/>
);
}
export default SparklineWithRangeBand;
ReactDOM.render(<SparklineWithRangeBand />, document.getElementById('charts'));| Property | Type | Description |
|---|---|---|
| object[] | Data for the sparkline |
| string | Sparkline type: 'Line', 'Column', 'Area', 'WinLoss', 'Pie' |
| string | Property name for x-axis from dataSource |
| string | Property name for y-axis from dataSource |
| string | Height of the sparkline |
| string | Width of the sparkline |
| string | Color of the sparkline |
| string | Axis value type: 'Numeric', 'Category', 'DateTime' |
| object | Configuration for markers |
| object | Configuration for data labels |
| object | Configuration for tooltips |
| object | Axis min/max and line customization |
| object[] | Range band configurations |
| string | Theme: 'Material', 'Fabric', 'Bootstrap', 'Highcontrast' |
| object | Padding around sparkline (left, right, top, bottom) |
| object | Border and background for sparkline area |
references/getting-started.mdreferences/sparkline-types.mdreferences/appearance-customization.mdreferences/user-interaction.mdreferences/advanced-features.md