@grafana/ui
Version:
Grafana Components Library
26 lines (21 loc) • 997 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var Plot = require('../uPlot/Plot.cjs');
var utils$1 = require('../uPlot/utils.cjs');
var utils = require('./utils.cjs');
;
const Sparkline = React.memo((props) => {
const { sparkline, config: fieldConfig, theme, width, height, showHighlights } = props;
const { frame: alignedDataFrame, warning } = utils.prepareSeries(sparkline, theme, fieldConfig, showHighlights);
if (warning) {
return null;
}
const data = utils$1.preparePlotData2(alignedDataFrame, utils$1.getStackingGroups(alignedDataFrame));
const configBuilder = utils.prepareConfig(sparkline, alignedDataFrame, theme, showHighlights);
return /* @__PURE__ */ jsxRuntime.jsx(Plot.UPlotChart, { data, config: configBuilder, width, height });
});
Sparkline.displayName = "Sparkline";
exports.Sparkline = Sparkline;
//# sourceMappingURL=Sparkline.cjs.map