增加tooltip

This commit is contained in:
yy
2025-05-26 17:40:35 +08:00
parent 0c791e7e15
commit f7e4ccc608
2 changed files with 106 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
import dayjs from 'dayjs';
import { ReactNode } from 'react';
export type TimeDimension = '月' | '季度' | '年';
export type AnalysisType = '岗位发布数量' | '招聘增长率';
@@ -27,6 +28,17 @@ export interface IndustryTrendApiResult {
msg: string;
}
export interface TooltipItem {
name: string;
value: number;
color: string;
data: {
date: string;
category: string;
value: number;
};
}
export interface ChartConfig {
data: IndustryDataItem[];
height: number;
@@ -44,7 +56,11 @@ export interface ChartConfig {
formatter: (val: string) => string;
};
};
tooltip: false;
tooltip: {
showTitle?: boolean;
title?: string | ((title: string, data?: TooltipItem[]) => string);
customContent?: (title: string, items: TooltipItem[]) => ReactNode;
};
point: {
size: number;
shape: string;
@@ -56,6 +72,13 @@ export interface ChartConfig {
};
};
smooth: boolean;
interactions?: Array<{
type: string;
cfg: {
render: (event: any, { title, items }: { title: string; items: TooltipItem[] }) => ReactNode;
};
}>;
legend?: boolean;
}
export type DateFormatter = (dateStr: string, dimension: TimeDimension) => string;