mirror of
https://github.com/SigNoz/signoz.git
synced 2026-02-03 08:33:26 +00:00
Merge branch 'main' into feat/tooltip-plugin
This commit is contained in:
@@ -5,8 +5,8 @@ import uPlot, { Series } from 'uplot';
|
|||||||
import {
|
import {
|
||||||
ConfigBuilder,
|
ConfigBuilder,
|
||||||
DrawStyle,
|
DrawStyle,
|
||||||
FillStyle,
|
|
||||||
LineInterpolation,
|
LineInterpolation,
|
||||||
|
LineStyle,
|
||||||
SeriesProps,
|
SeriesProps,
|
||||||
VisibilityMode,
|
VisibilityMode,
|
||||||
} from './types';
|
} from './types';
|
||||||
@@ -16,23 +16,29 @@ import {
|
|||||||
* Handles creation of series settings
|
* Handles creation of series settings
|
||||||
*/
|
*/
|
||||||
export class UPlotSeriesBuilder extends ConfigBuilder<SeriesProps, Series> {
|
export class UPlotSeriesBuilder extends ConfigBuilder<SeriesProps, Series> {
|
||||||
private buildLineConfig(
|
private buildLineConfig({
|
||||||
lineColor: string,
|
lineColor,
|
||||||
lineWidth?: number,
|
lineWidth,
|
||||||
lineStyle?: { fill?: FillStyle; dash?: number[] },
|
lineStyle,
|
||||||
): Partial<Series> {
|
lineCap,
|
||||||
|
}: {
|
||||||
|
lineColor: string;
|
||||||
|
lineWidth?: number;
|
||||||
|
lineStyle?: LineStyle;
|
||||||
|
lineCap?: Series.Cap;
|
||||||
|
}): Partial<Series> {
|
||||||
const lineConfig: Partial<Series> = {
|
const lineConfig: Partial<Series> = {
|
||||||
stroke: lineColor,
|
stroke: lineColor,
|
||||||
width: lineWidth ?? 2,
|
width: lineWidth ?? 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (lineStyle && lineStyle.fill !== FillStyle.Solid) {
|
if (lineStyle === LineStyle.Dashed) {
|
||||||
if (lineStyle.fill === FillStyle.Dot) {
|
lineConfig.dash = [10, 10];
|
||||||
lineConfig.cap = 'round';
|
|
||||||
}
|
|
||||||
lineConfig.dash = lineStyle.dash ?? [10, 10];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lineCap) {
|
||||||
|
lineConfig.cap = lineCap;
|
||||||
|
}
|
||||||
return lineConfig;
|
return lineConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,6 +144,7 @@ export class UPlotSeriesBuilder extends ConfigBuilder<SeriesProps, Series> {
|
|||||||
lineInterpolation,
|
lineInterpolation,
|
||||||
lineWidth,
|
lineWidth,
|
||||||
lineStyle,
|
lineStyle,
|
||||||
|
lineCap,
|
||||||
showPoints,
|
showPoints,
|
||||||
pointSize,
|
pointSize,
|
||||||
scaleKey,
|
scaleKey,
|
||||||
@@ -148,7 +155,12 @@ export class UPlotSeriesBuilder extends ConfigBuilder<SeriesProps, Series> {
|
|||||||
|
|
||||||
const lineColor = this.getLineColor();
|
const lineColor = this.getLineColor();
|
||||||
|
|
||||||
const lineConfig = this.buildLineConfig(lineColor, lineWidth, lineStyle);
|
const lineConfig = this.buildLineConfig({
|
||||||
|
lineColor,
|
||||||
|
lineWidth,
|
||||||
|
lineStyle,
|
||||||
|
lineCap,
|
||||||
|
});
|
||||||
const pathConfig = this.buildPathConfig({
|
const pathConfig = this.buildPathConfig({
|
||||||
pathBuilder,
|
pathBuilder,
|
||||||
drawStyle,
|
drawStyle,
|
||||||
|
|||||||
@@ -92,16 +92,9 @@ export interface ScaleProps {
|
|||||||
* Props for configuring a series
|
* Props for configuring a series
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export enum FillStyle {
|
export enum LineStyle {
|
||||||
Solid = 'solid',
|
Solid = 'solid',
|
||||||
Dash = 'dash',
|
Dashed = 'dashed',
|
||||||
Dot = 'dot',
|
|
||||||
Square = 'square',
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LineStyle {
|
|
||||||
dash?: Array<number>;
|
|
||||||
fill?: FillStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum DrawStyle {
|
export enum DrawStyle {
|
||||||
@@ -141,6 +134,7 @@ export interface SeriesProps {
|
|||||||
lineInterpolation?: LineInterpolation;
|
lineInterpolation?: LineInterpolation;
|
||||||
lineStyle?: LineStyle;
|
lineStyle?: LineStyle;
|
||||||
lineWidth?: number;
|
lineWidth?: number;
|
||||||
|
lineCap?: Series.Cap;
|
||||||
|
|
||||||
// Points config
|
// Points config
|
||||||
pointColor?: string;
|
pointColor?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user