@grafana/ui
Version:
Grafana Components Library
22 lines (19 loc) • 913 B
JavaScript
import { jsx } from 'react/jsx-runtime';
import { memo } from 'react';
import { UPlotChart } from '../uPlot/Plot.mjs';
import { preparePlotData2, getStackingGroups } from '../uPlot/utils.mjs';
import { prepareSeries, prepareConfig } from './utils.mjs';
;
const Sparkline = memo((props) => {
const { sparkline, config: fieldConfig, theme, width, height, showHighlights } = props;
const { frame: alignedDataFrame, warning } = prepareSeries(sparkline, theme, fieldConfig, showHighlights);
if (warning) {
return null;
}
const data = preparePlotData2(alignedDataFrame, getStackingGroups(alignedDataFrame));
const configBuilder = prepareConfig(sparkline, alignedDataFrame, theme, showHighlights);
return /* @__PURE__ */ jsx(UPlotChart, { data, config: configBuilder, width, height });
});
Sparkline.displayName = "Sparkline";
export { Sparkline };
//# sourceMappingURL=Sparkline.mjs.map