mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-18 16:07:10 +00:00
32 lines
621 B
TypeScript
32 lines
621 B
TypeScript
|
|
import uPlot from 'uplot';
|
||
|
|
|
||
|
|
// Define type annotations for style and interp
|
||
|
|
export const drawStyles = {
|
||
|
|
line: 'line',
|
||
|
|
bars: 'bars',
|
||
|
|
barsLeft: 'barsLeft',
|
||
|
|
barsRight: 'barsRight',
|
||
|
|
points: 'points',
|
||
|
|
};
|
||
|
|
|
||
|
|
export const lineInterpolations = {
|
||
|
|
linear: 'linear',
|
||
|
|
stepAfter: 'stepAfter',
|
||
|
|
stepBefore: 'stepBefore',
|
||
|
|
spline: 'spline',
|
||
|
|
};
|
||
|
|
|
||
|
|
const { spline: splinePath } = uPlot.paths;
|
||
|
|
|
||
|
|
const spline = splinePath && splinePath();
|
||
|
|
|
||
|
|
const getRenderer = (style: any, interp: any): any => {
|
||
|
|
if (style === drawStyles.line && interp === lineInterpolations.spline) {
|
||
|
|
return spline;
|
||
|
|
}
|
||
|
|
|
||
|
|
return null;
|
||
|
|
};
|
||
|
|
|
||
|
|
export default getRenderer;
|