Numbers
Statistics
LineUp-lite computes the following statistics for a numerical attribute:
export interface INumberStats extends IBoxPlot, INumericStats<number> {}
Generator Function
The statistics are the same as the number attribute ones.
see numberStatsGenerator API Docs
Example
Live Editor
// import { numberStatsGenerator } from '@lineup-lite/components';function Example() {const compute = numberStatsGenerator();const data = [[10, 20, 40, 30, 15],[21, 39, 25, 42, 18],[16, 44, 30, 32, 31],[39, 50, 43, 32, 24],[36, 19, 37, 38, 17],];const stats = compute(data);return <pre>{JSON.stringify(stats, null, 2)}</pre>;}
Result
Loading...
Visualization
Cell
HeatMap1D
React component
Live Editor
// import { numberStatsGenerator, NumberBar, NumberColor, NumberSymbol } from '@lineup-lite/components';function Example() {const compute = numberStatsGenerator();const data = [[10, 20, 40, 30, 15],[21, 39, 25, 42, 18],[16, 44, 30, 32, 31],[39, 50, 43, 32, 24],[36, 19, 37, 38, 17],];const stats = compute(data);return (<div><HeatMap1D value={data[0]} scale={stats.scale} color={stats.color} format={stats.format} /><HeatMap1D value={data[1]} scale={stats.scale} color={stats.color} format={stats.format} /><HeatMap1D value={data[2]} scale={stats.scale} color={stats.color} format={stats.format} /></div>);}
Result
Loading...
LineChart
React component
Live Editor
// import { numberStatsGenerator, LineChart } from '@lineup-lite/components';function Example() {const compute = numberStatsGenerator();const data = [[10, 20, 40, 30, 15],[21, 39, 25, 42, 18],[16, 44, 30, 32, 31],[39, 50, 43, 32, 24],[36, 19, 37, 38, 17],];const stats = compute(data);return (<div><LineChart value={data[0]} scale={stats.scale} color={stats.color} format={stats.format} /><LineChart value={data[1]} scale={stats.scale} color={stats.color} format={stats.format} /><LineChart value={data[2]} scale={stats.scale} color={stats.color} format={stats.format} /><LineChart value={data[0]} scale={stats.scale} color={stats.color} format={stats.format} fill /><LineChart value={data[1]} scale={stats.scale} color={stats.color} format={stats.format} fill /><LineChart value={data[2]} scale={stats.scale} color={stats.color} format={stats.format} fill /><LineChart value={data[0]} scale={stats.scale} color={stats.color} format={stats.format} gradient /><LineChart value={data[1]} scale={stats.scale} color={stats.color} format={stats.format} gradient /><LineChart value={data[2]} scale={stats.scale} color={stats.color} format={stats.format} gradient /><LineChart value={data[0]} scale={stats.scale} color={stats.color} format={stats.format} fill gradient /><LineChart value={data[1]} scale={stats.scale} color={stats.color} format={stats.format} fill gradient /><LineChart value={data[2]} scale={stats.scale} color={stats.color} format={stats.format} fill gradient /></div>);}
Result
Loading...
Aggregation
BoxPlotArray
React component
Live Editor
// import { numberStatsGenerator, BoxPlotArray } from '@lineup-lite/components';function Example() {const compute = numberStatsGenerator();const data = [[10, 20, 40, 30, 15],[21, 39, 25, 42, 18],[16, 44, 30, 32, 31],[39, 50, 43, 32, 24],[36, 19, 37, 38, 17],];const stats = compute(data);const vs = data[0].map((_, i) => compute(data.map((d) => d[i])));return (<div><BoxPlotArray value={vs} format={stats.format} scale={stats.scale} color={stats.color} style={{ height: 100 }} /></div>);}
Result
Loading...
MultiLineChart
React component
Live Editor
// import { numberStatsGenerator, MultiLineChart } from '@lineup-lite/components';function Example() {const compute = numberStatsGenerator();const data = [[10, 20, 40, 30, 15],[21, 39, 25, 42, 18],[16, 44, 30, 32, 31],[39, 50, 43, 32, 24],[36, 19, 37, 38, 17],];const stats = compute(data);return (<div><MultiLineChartvalue={data}format={stats.format}scale={stats.scale}color={stats.color}style={{ height: 100 }}/><MultiLineChartvalue={data}format={stats.format}scale={stats.scale}color={stats.color}style={{ height: 100 }}fill/><MultiLineChartvalue={data}format={stats.format}scale={stats.scale}color={stats.color}style={{ height: 100 }}gradient/><MultiLineChartvalue={data}format={stats.format}scale={stats.scale}color={stats.color}style={{ height: 100 }}fillgradient/></div>);}
Result
Loading...
Interactive Summary
FilterRangeHistogram
React component or
FilterRangeBoxPlot
React component
Live Editor
// import { numberStatsGenerator, FilterRangeHistogram, FilterRangeBoxPlot } from '@lineup-lite/components';function Example() {const compute = numberStatsGenerator();const data = [[10, 20, 40, 30, 15],[21, 39, 25, 42, 18],[16, 44, 30, 32, 31],[39, 50, 43, 32, 24],[36, 19, 37, 38, 17],];const stats = compute(data);console.log(stats.min, stats.max);const [filterValue, setFilter] = React.useState(null);const filtered = filterValue? data.filter((vs) =>vs.every((d) => (filterValue[0] == null || filterValue[0] <= d) && (filterValue[1] == null || d <= filterValue[1]))): data;const filteredStats = numberStatsGenerator({ min: stats.min, max: stats.max, numberOfBins: stats.hist.length })(filtered);return (<div><FilterRangeHistograms={filteredStats}preFilter={stats}filterValue={filterValue}setFilter={setFilter}summarystyle={{ height: 100 }}/><FilterRangeBoxPlots={filteredStats}preFilter={stats}filterValue={filterValue}setFilter={setFilter}summarystyle={{ height: 100 }}/></div>);}
Result
Loading...