amis-reports
Version:
爱速搭报表,基于 ECharts 实现的图表功能组件,旨在为用户提供简单和快捷的可视化报表能力,帮助用户在爱速搭平台上快速设计常见的数据报表页和大屏报表效果页。
537 lines (536 loc) • 18.2 kB
TypeScript
import { ChartProps } from 'amis/lib/renderers/Chart';
import { ChartField, PlainObject, TextStyle, AxisTickStyleStyle, ChartItemStyle, LegendConfig } from './type';
export declare const CHART_CHANGE_ATTRIBUTES: string[];
export declare const TOOLTIP_ATTRIBUTES: string[];
export declare const CENTER_AND_RADIUS_ATTRIBUTES: string[];
export declare const ROSE_ATTRIBUTES: string[];
export declare const GRID_ATTRIBUTES: string[];
export declare const XAXIS_ATTRIBUTES: string[];
export declare const YAXIS_ATTRIBUTES: string[];
export declare const YAXIS2_ATTRIBUTES: string[];
export declare const MARK_POINT_ATTRIBUTES: string[];
export declare const MARK_LINE_ATTRIBUTES: string[];
export declare const LABEL_ATTRIBUTES: string[];
export declare const SCATTER_ATTRIBUTES: string[];
export declare const TARGET_NUMBER_ATTRIBUTES: string[];
export declare const GAUGE_DATA_TITLE_ATTRIBUTES: string[];
export declare const GAUGE_DATA_DETAIL_ATTRIBUTES: string[];
export declare const PROGRESS_ATTRIBUTES: string[];
export declare const GAUGE_AXIS_LINE_ATTRIBUTES: string[];
export declare const GAUGE_SPLIT_LINE_ATTRIBUTES: string[];
export declare const GAUGE_AXIS_TICK_ATTRIBUTES: string[];
export declare const GAUGE_AXIS_LABEL_ATTRIBUTES: string[];
export declare const GAUGE_POINTER_ATTRIBUTES: string[];
export declare const LEGEND_ATTRIBUTES: string[];
export declare const BACKGROUND_AND_BORDER_ATTRBUTES: string[];
export declare const BORDER_STYLE_ATTRIBUTES: string[];
export declare const TITLE_ATTRIBUTES: string[];
export declare const AMNIMATION_ATTRIBUTES: string[];
export declare const FUNNEL_CHART_SETTINGS: string[];
export declare const COLUMN_CHART_SETTINGS: string[];
export declare const COLUMN_CHART_COLUMN_ITEM_SETTINGS: string[];
export declare const LINE_CHART_LINE_SETTINGS: string[];
export declare const LINE_CHART_SETTINGS: string[];
export declare const STYLE_ATTRIBUTES: string[];
export declare const WORD_CLOUD_ATTRIBUTES: string[];
export declare const CHART_MAP_ATTRIBUTES: string[];
export declare const CHART_VISUALMAP_ATTRIBUTES: string[];
export declare const CHART_SANKEY_ATTRIBUTES: string[];
export declare const STATISTIC_FUNCTIONS_LABEL: {
SUM: string;
AVG: string;
MAX: string;
MIN: string;
COUNT: string;
COUNT_DISTINCT: string;
};
export declare function getFunctionsMark(funcKey: string): string;
/**
* 数据获取接口
* @param props 组件porps
* @param params 请求参数
* @returns
*/
export declare function fetchData(props: any): Promise<any>;
/**
* 根据字段名查找字段完整信息
* @param modelFields
* @param name
*/
export declare function getFieldFullInfoByName(modelFields: ChartField[], name: string): ChartField | null | undefined;
/**
* 判断报表组件数据相关的配置是否有变化,有变化则请求新数据并返回,没有变化则返回 false
* @param props 当前组件属性
* @param preProps 前次组件属性
*/
export declare function diffDataAttrAndFetch(props: any, preProps: any): Promise<any>;
/**
* 获取报表组件最新的数据
* @returns
*/
export declare function getChartData(props: any): Promise<any>;
/**
* 对比图表属性有没有变化, 如果有变化,返回true
* @param props
* @param preProps
*/
export declare function diffAttribute(props: any, preProps: any): boolean | PlainObject<any>;
export declare const FORMATTERS: PlainObject<(value: number, config?: any) => any>;
/**
* 将报表组件标题相关配置转成 ECharts 图表配置
* @param titleConfig 报表组件配置项
* @returns
*/
export declare function makeEchartsTitleConfig(titleConfig: any, curElem?: any): {
show: any;
text: any;
left: any;
textStyle: any;
backgroundColor: any;
link: any;
};
export declare function makeChartStyleConfig(chartConfig: any, chartStyleKey?: string, defaultConfig?: any, curElem?: any): any;
export declare function makeAxisLineStyle(chartConfig: any, chartStyleKey?: string, curElem?: any): {
color: any;
width: any;
};
export declare function makeLineStyle(chartConfig: any, chartStyleKey?: string, curElem?: any): {
color: any;
width: any;
};
export declare function makeCenterAndRadiusConfig(centerAndRadiusConfig: {
centerHorizontal?: number | string;
centerVertical?: number | string;
innerRadius?: number | string;
radius?: number | string;
}): PlainObject<any>;
export declare function makeGridConfig(gridConfig: {
gridLeft?: number | string;
gridTop?: number | string;
gridBottom?: number | string;
gridRight?: number | string;
}, defaultValue?: {
notNeedDefaultVal?: boolean;
defaultGridLeft?: number | string;
defaultGridTop?: number | string;
defaultGridBottom?: number | string;
defaultGridRight?: number | string;
}): {
left: any;
right: any;
top: any;
bottom: any;
containLabel: boolean;
};
export declare function makeAxisNameConfig(chartConfig: any, chartStyleKey?: string, curElem?: any): any;
export declare function getNumberByDefault(curVal: any, defaultVal: any): any;
export declare const STATISTIC_FUNCTIONS: {
[key: string]: (data: Array<any>) => number;
};
export declare function makeEchartsLegendConfig(legendConfig: LegendConfig, series?: Array<any>, curElem?: any): {
type: string;
show: boolean;
textStyle: {
color: string;
fontSize: string | number;
fontStyle: string | undefined;
fontWeight: string | undefined;
fontFamily: any;
lineHeight: string | undefined;
};
align: "auto" | "left" | "right";
orient: "vertical" | "horizontal";
width: string | number | undefined;
height: string | number | undefined;
formatter: (name: string) => string;
};
export declare function setChartElementStyle(notEChartsDiff: PlainObject, node: any, props: any): void;
export declare function makeProgressConfig(progressConfig: {
progressShow?: boolean;
progressWidth?: number;
progressColor?: string;
}, curElem?: any): {
show: boolean;
width: number;
itemStyle: {
color: string;
};
};
export declare function makeGaugeDataTitleConfig(dataTitleConfig: {
dataTitleShow?: boolean;
dataTitleOffsetX?: number | string;
dataTitleOffsetY?: number | string;
dataTitleColor?: string;
dataTitleFontSize?: number;
dataTitleFontWeight?: number;
}, curElem?: any): any;
export declare function makeGaugeDataDetailConfig(dataTitleConfig: any, dataConfig?: any, curElem?: any): PlainObject<any>;
export declare function makeGaugeAxisLineConfig(axisLineConfig: {
axisLineShow?: boolean;
axisLineColor?: string;
progressWidth?: number;
}, curElem?: any): {
show: boolean;
lineStyle: {
color: (string | number)[][];
width: number | undefined;
};
};
export declare function makeGaugeAxisTickConfig(axisTickConfig: {
axisTickShow?: boolean;
axisTickSplitNumber?: number;
axisTickLength?: number | string;
axisTickDistance?: number;
axisTickColor?: string;
axisTickWidth?: number;
}, curElem?: any): {
show: boolean;
splitNumber: number;
length: string | number;
distance: number | undefined;
lineStyle: {
color: string;
width: number | undefined;
};
};
export declare function makeGaugeSplitLineConfig(splitLineConfig: {
splitLineShow?: boolean;
splitLineLength?: number | string;
splitLineDistance?: number;
splitLineColor?: string;
splitLineWidth?: string;
}, curElem?: any): {
show: boolean;
length: string | number;
distance: number;
lineStyle: {
color: string;
width: string | number;
};
};
export declare function makeGaugeAxisLabelConfig(axisLabelConfig: {
axisLabelShow?: boolean;
axisLabelDistance?: number;
axisLabelRotate?: number;
axisLabelColor?: string;
axisLabelFontSize?: number;
axisLabelFontWeight?: number;
}, curElem?: any): any;
export declare function makeGaugePointerConfig(pointerConfig: {
pointerShow?: boolean;
pointerColor?: string;
}): {
show: boolean;
itemStyle: {
color: string | undefined;
};
};
export declare function makeMarkPointConfig(markPointConfig: {
markPointSymbol?: string;
markPointMax?: boolean;
markPointMin?: boolean;
markPointBackground?: string;
markPointSymbolSize?: number;
markPointSymbolRotate?: number;
markPointSymboloffsetX?: number;
markPointSymboloffsetY?: number;
}, curElem?: any): PlainObject<any>;
export declare function makeMarkLineConfig(markLineConfig: {
markLineAvarage?: boolean;
markLineAvarageColor?: string;
markLineSymbolLeft?: string;
markLineSymbolRight?: string;
markLineBase?: boolean;
markLineBaseValue?: number;
markLineBaseColor?: string;
}, xyFlip: boolean, curElem?: any): PlainObject<any>;
export declare function makeTooltipConfig(tooltipConfig: {
tooltipShow?: boolean;
tooltipFontSize?: number;
tooltipColor?: string;
tooltipBackgroundColor?: string;
tooltipBorderWidth?: number;
tooltipBorderColor?: string;
tooltipPadding?: number;
tooltipContent?: string;
tooltipTextStyle?: TextStyle;
type: string;
columnChartType?: string;
dimensions?: Array<any>;
measures?: Array<any>;
measures2?: Array<any>;
bubbleField?: Array<any>;
groupField?: string;
dataType?: number;
}, indicator?: Array<any>, curElem?: any): PlainObject<any>;
export declare function makeLabelConfig(labelConfig: {
type: string;
labelShow?: boolean;
labelFontSize?: number;
labelColor?: string;
labelPosition?: string;
labelFontWeight?: number;
labelContent?: string;
labelOverflow?: string;
labelLineHeight?: number;
labelTextStyle?: TextStyle;
dimensions?: Array<any>;
measures?: Array<any>;
measures2?: Array<any>;
dataType?: number;
bubbleField?: Array<any>;
groupField?: string;
}, formatter?: {
type?: string;
negative?: boolean;
formatterToFixed?: number;
}, curElem?: any): PlainObject<any>;
export declare function makeLineChartLineConfig(lineChartLineConfig: {
lineWidth?: number;
lineCap?: string;
lineJoin?: string;
lineShadowBlur?: number;
lineShadowColor?: string;
lineShadowOffsetX?: number;
lineShadowOffsetY?: number;
lineOpacity?: number;
}): {
lineStyle: {
width: number;
cap: string;
join: string;
shadowBlur: number | undefined;
shadowColor: string | undefined;
shadowOffsetX: number | undefined;
shadowOffsetY: number | undefined;
opacity: number | undefined;
};
};
export declare function makeColumnItemConfig(columnItemStyleConfig: {
columnBorderWidth?: number;
columnBorderColor?: string;
columnBorderType?: string;
columnBorderRadius?: number | {
'top-left-border-radius': string;
'top-right-border-radius': string;
'bottom-left-border-radius': string;
'bottom-right-border-radius': string;
};
columnShadowBlur?: number;
columnShadowColor?: number;
columnShadowOffsetX?: number;
columnShadowOffsetY?: number;
}, curElem?: any): {
borderColor: string | undefined;
borderWidth: number | undefined;
borderType: string | undefined;
borderRadius: any;
shadowBlur: number | undefined;
shadowColor: string | number;
shadowOffsetX: number | undefined;
shadowOffsetY: number | undefined;
};
export declare function makeChartItemConfig(chartItemStyleConfig: {
bubbleShadowShow?: boolean;
shadowBlur?: number;
shadowColor?: number;
shadowOffsetX?: number;
shadowOffsetY?: number;
}): {
shadowBlur: number;
shadowColor: undefined;
shadowOffsetX: number;
shadowOffsetY: number;
} | {
shadowBlur: number;
shadowColor: string | number;
shadowOffsetX: number;
shadowOffsetY: number;
};
export declare function makeCateAxisConfig(xAxisConfig: {
columnChartType?: string;
xAxisShow?: boolean;
xAxisInverse?: boolean;
xAxisLabelShow?: boolean;
xAxisLabelShowOverlap?: boolean;
xAxisLabelRotate?: number;
xAxisFontSize?: number;
xAxisName?: string;
xAxisNameRotate?: number;
xAxisLineShow?: boolean;
axisTickStyle?: AxisTickStyleStyle;
xAxisNameGap?: number;
xAxisNameLocation?: string;
xAxisNameStyle?: TextStyle;
xAxisMin?: number;
xAxisMax?: number;
xAxisSplitLineShow?: boolean;
xAxisSplitAreaShow?: boolean;
}, isValue?: boolean, curElem?: any): PlainObject<any>;
export declare function makeChartItemStyleConfig(chartItemStyleConfig: {
chartItemStyle?: ChartItemStyle;
}): PlainObject<any>;
export declare function makeAreaStyleConfig(areaStyleConfig: {
areaShow?: boolean;
areaStyle?: {
tooltipShow?: boolean;
shadowBlur?: number;
shadowColor?: string;
shadowOffsetX?: number;
shadowOffsetY?: number;
opacity?: number;
};
}): PlainObject<any> | null;
export declare function getLinearColor(color: string, gradientMode: string, gradientAlpha?: number): {
colorStops: {
offset: number;
color: string;
}[];
x: number;
y: number;
x2: number;
y2: number;
type: string;
};
export declare function hexToRgba(hexColor: string, alpha?: number): string;
export declare function getChartDataColors(chartConfig: any): any[];
interface ValueAxisConfig {
doubleYAxisAlign?: boolean;
columnChartType?: string;
yAxisShow?: boolean;
yAxisMinAsDataMinAndMaxAsDataMax?: boolean;
yAxisSplitLineShow?: boolean;
yAxisSplitAreaShow?: boolean;
yAxisLabelFontSize?: number;
yAxisMin?: number;
yAxisMax?: number;
yAxisLabelRotate?: number;
yAxisPreUnit?: string;
yAxisAfterUnit?: string;
yAxisName?: string;
yAxisFormatter?: string;
doubleYAxis?: boolean;
axisYLabelStyle?: any;
}
export declare function makeValueAxisConfig(valueAxisConfig: ValueAxisConfig | ValueAxisConfig[], axisValueMinAndMax?: {
measuresValueMax?: number;
measuresValueMin?: number;
measures2ValueMax?: number;
measures2ValueMin?: number;
}, curElem?: any): PlainObject<any>;
export declare function makeChartAnimationConfig(chartAnimationConfig: {
animationDurationUpdate?: number;
animationThreshold?: number;
animationDuration?: number;
}): {
animationDurationUpdate: number | undefined;
animationThreshold: number | undefined;
animationDuration: number | undefined;
};
export declare function makeWordCloudConfig(chartConfigProps: {
shape?: string;
sizeRangeBegin?: number;
sizeRangeEnd?: number;
rotationRangeBegin?: number;
rotationRangeEnd?: number;
gridSize?: number;
} | ChartProps): PlainObject<any>;
export declare function makeCharMapVisualMapMapConfig(chartConfigProps: {
visualMapShow?: boolean;
visualMapMin?: number;
visualMapMax?: number;
visualMapItemWidth?: number;
visualMapItemHeight?: number;
visualMapHoverLink?: boolean;
visualMapOrient?: string;
visualMapInverse?: boolean;
visualMapCalculable?: boolean;
visualMapRealtime?: boolean;
visualMapTextMax?: string;
visualMapTextMin?: string;
visualMapInRangeMin?: number;
visualMapInRangeMax?: number;
} | ChartProps): PlainObject<any>;
export declare function makeReportVisualMapMapConfig(chartConfigProps: {
show?: boolean;
type?: string;
min?: number;
max?: number;
splitNumber?: number;
itemWidth?: number;
itemHeight?: number;
hoverLink?: boolean;
orient?: string;
inverse?: boolean;
calculable?: boolean;
realtime?: boolean;
textMax?: string;
textMin?: string;
InRangeMinColor?: string;
InRangeMaxColor?: string;
}): PlainObject<any>;
export declare function makeReportCalendarConfig(chartConfigProps: {
rangeStart?: string;
rangeEnd?: string;
orient?: string;
yearLabel?: any;
itemStyle?: any;
splitLine?: any;
}): PlainObject<any>;
export declare function makeWaveletStyleConfig(chartConfigProps: {
showEffectOn?: string;
brushType?: string;
number?: number;
period?: number;
scale?: number;
}): PlainObject<any>;
export declare function makeSankeyConfig(chartConfigProps: {
nodeWidth?: number;
nodeGap?: number;
nodeAlign?: string;
orient?: string;
}): PlainObject<any>;
/**
* 返回维度数据
* 备注:当维度数值为对象类型,则默认优先使用label,其次value
*/
export declare function getDimensionVal(dimensionVal: any): any;
export declare function getValExpr(varExpr: string, data: Object): any;
/**
* 提取数值
* 备注:当数值为对象类型,则默认优先使用value,其次id、label、name
*/
export declare function getValue(valObj: any, valueKey?: string): any;
/**
* 时间字段格式化,兼容各类时间格式
*/
export declare function timeFormat(dateTime: string): string;
/**
* 返回度量数据
*/
export declare function getMeasureVal(measure: any, defaultVal?: string): string;
export declare function getMeasureLabel(measure: any): any;
export declare function extendReportSchema(reportSchema: any, newSchema?: any): any;
export declare function autoVarReportSchema(reportSchema: any, propData: any): any;
export declare function getVarReportSchema(reportSchema: any, propData: any): {
[key: string]: any;
};
/**
* 判断当前API是否为有效API地址
* @param api
* @returns boolean
*/
export declare function isEffectiveAPIURL(dataApi: any, data?: any): boolean;
export declare function isAdvancedType(type: string): boolean;
export declare function formulaExecByDataObject(dataObject: any, contextData: any): any;
/**
* 判断 api.data 是否有变化
*/
export declare function isApiDataOutdated(prevApiData: any, nextApiData: any, prevData: any, nextData: any): boolean;
export declare function getChartType(measure: any, dataIndex: number): any;
export declare const DATETIME_FUNCTIONS: {
label: string;
value: string;
}[];
export declare function is_datetime_func(statisticsFunction: string): boolean;
export {};