mirror of
https://github.com/VisActor/VChart
synced 2024-11-22 17:26:19 +00:00
fix: fix the error type define
This commit is contained in:
parent
61ed334766
commit
62dd5fe819
@ -24,13 +24,13 @@ export interface ICartesianChartSpec extends IChartSpec {
|
||||
/**
|
||||
* 参考线配置
|
||||
*/
|
||||
markLine?: IMarkLineSpec;
|
||||
markLine?: IMarkLineSpec | IMarkLineSpec[];
|
||||
/**
|
||||
* 参考区域配置
|
||||
*/
|
||||
markArea?: IMarkAreaSpec;
|
||||
markArea?: IMarkAreaSpec | IMarkLineSpec[];
|
||||
/**
|
||||
* 参考点配置
|
||||
*/
|
||||
markPoint?: IMarkPointSpec;
|
||||
markPoint?: IMarkPointSpec | IMarkPointSpec[];
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import type { IPadding, IPointLike } from '@visactor/vutils';
|
||||
import type { SymbolType } from '@visactor/vrender';
|
||||
import type { IModelSpec } from '../../model/interface';
|
||||
import type { IRectMarkSpec, ISymbolMarkSpec, ITextMarkSpec, StringOrNumber } from '../../typings';
|
||||
import type { IComponentSpec } from '../base/interface';
|
||||
import type { Datum } from '@visactor/vrender-components';
|
||||
|
||||
export type IAggrType = 'sum' | 'average' | 'min' | 'max' | 'variance' | 'standardDeviation' | 'median';
|
||||
export type IDataPos = string | number | IAggrType;
|
||||
@ -46,7 +46,7 @@ export type IMarkerLabelSpec = {
|
||||
/**
|
||||
* 内部边距
|
||||
*/
|
||||
padding?: IPadding;
|
||||
padding?: IPadding | number[] | number;
|
||||
/**
|
||||
* 背景面板样式
|
||||
*/
|
||||
@ -58,10 +58,11 @@ export type IMarkerLabelSpec = {
|
||||
text?: string | string[] | number | number[];
|
||||
/**
|
||||
* label文本 - 文本格式化
|
||||
* @param datum marker组件聚合或回归计算后的数据值
|
||||
* @param markData 组成标注的数据
|
||||
* @param seriesData 标注关联的数据
|
||||
* @returns 格式化后的文本
|
||||
*/
|
||||
formatMethod?: (datum: IDataPos) => string | string[] | number | number[];
|
||||
formatMethod?: (markData: Datum[], seriesData: Datum[]) => string | string[] | number | number[];
|
||||
/**
|
||||
* label文本 - 文本样式
|
||||
*/
|
||||
@ -148,7 +149,7 @@ export interface IMarkerSpec extends IComponentSpec {
|
||||
|
||||
export interface IMarkerSymbol extends IMarkerRef {
|
||||
/** 是否展示 symbol */
|
||||
visible: boolean;
|
||||
visible?: boolean;
|
||||
/**
|
||||
* symbol 形状,默认为带左右方向的箭头
|
||||
*/
|
||||
|
@ -85,6 +85,9 @@ export class MarkArea extends BaseMarker<IMarkAreaSpec & IMarkAreaTheme> impleme
|
||||
}
|
||||
|
||||
protected _markerLayout() {
|
||||
if (!this._markerComponent) {
|
||||
return;
|
||||
}
|
||||
const spec = this._spec as any;
|
||||
const data = this._markerData;
|
||||
const startRelativeSeries = this._startRelativeSeries;
|
||||
@ -124,12 +127,12 @@ export class MarkArea extends BaseMarker<IMarkAreaSpec & IMarkAreaTheme> impleme
|
||||
width: maxX - minX,
|
||||
height: maxY - minY
|
||||
};
|
||||
this._markerComponent?.setAttributes({
|
||||
this._markerComponent.setAttributes({
|
||||
points: points,
|
||||
label: {
|
||||
...this._markerComponent.attribute?.label,
|
||||
text: this._spec.label.formatMethod
|
||||
? this._spec.label.formatMethod(dataPoints)
|
||||
? this._spec.label.formatMethod(dataPoints, this._relativeSeries.getViewData().latestData)
|
||||
: this._markerComponent.attribute?.label?.text
|
||||
},
|
||||
limitRect
|
||||
|
@ -14,7 +14,7 @@ export interface IMarkLineTheme {
|
||||
position?: IMarkLineLabelPosition;
|
||||
} & IMarkerLabelSpec;
|
||||
|
||||
startSymbol: IMarkerSymbol;
|
||||
startSymbol?: IMarkerSymbol;
|
||||
|
||||
endSymbol: IMarkerSymbol;
|
||||
endSymbol?: IMarkerSymbol;
|
||||
}
|
||||
|
@ -85,6 +85,9 @@ export class MarkPoint extends BaseMarker<IMarkPointSpec & IMarkPointTheme> impl
|
||||
}
|
||||
|
||||
protected _markerLayout() {
|
||||
if (!this._markerComponent) {
|
||||
return;
|
||||
}
|
||||
const spec = this._spec;
|
||||
const data = this._markerData;
|
||||
const relativeSeries = this._relativeSeries;
|
||||
@ -109,14 +112,14 @@ export class MarkPoint extends BaseMarker<IMarkPointSpec & IMarkPointTheme> impl
|
||||
height: maxY - minY
|
||||
};
|
||||
|
||||
this._markerComponent?.setAttributes({
|
||||
this._markerComponent.setAttributes({
|
||||
position: point,
|
||||
itemContent: {
|
||||
...this._markerComponent.attribute?.itemContent,
|
||||
textStyle: {
|
||||
...this._markerComponent.attribute?.itemContent?.textStyle,
|
||||
text: this._spec.itemContent.text?.formatMethod
|
||||
? this._spec.itemContent.text.formatMethod(dataPoints)
|
||||
? this._spec.itemContent.text.formatMethod(dataPoints, this._relativeSeries.getViewData().latestData)
|
||||
: this._markerComponent.attribute?.itemContent?.textStyle?.text
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user