8000 fix(marker): markpoint error in map by skie1997 · Pull Request #2633 · VisActor/VChart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(marker): markpoint error in map #2633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/assets/examples/en/marker/geo-mark-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ option: mapChart#markPoint

## Key Configuration

- Use the `markPoint.name` attribute to declare the geographical location to be marked
- Use the `markPoint.areaName` attribute to declare the geographical location to be marked

## Demo source

Expand Down Expand Up @@ -84,7 +84,7 @@ option: mapChart#markPoint
],
markPoint: data.map(d => {
return {
name: d.name,
areaName: d.name,
itemLine: {
visible: false,
},
Expand Down
4 changes: 2 additions & 2 deletions docs/assets/examples/zh/marker/geo-mark-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ option: mapChart#markPoint

## 关键配置

- 使用 `markPoint.name` 属性声明要标注的地理位置
- 使用 `markPoint.areaName` 属性声明要标注的地理位置

## 代码演示

Expand Down Expand Up @@ -84,7 +84,7 @@ option: mapChart#markPoint
],
markPoint: data.map(d => {
return {
name: d.name,
areaName: d.name,
itemLine: {
visible: false,
},
Expand Down
6 changes: 3 additions & 3 deletions docs/assets/option/en/component/mark-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Since the `1.11.0` version, you can configure the value of the annotation point
** Note that the usage scenario of this property is in the polar coordinate system: **
1. Configure the angle and radius properties together to label the data points with coordinates on (angle, radius)

### name (string | number | function)
### areaName (string | number | function)
Since the `1.11.0` version, you can configure the geographical location of the annotation point on the map, and calculate it yourself through the data in the form of a callback.

** Note that this property is used in a geographic coordinate system **
Expand Down Expand Up @@ -177,7 +177,7 @@ layout like this: https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/marker-pos

The x-direction offset of the mark content relative to the mark point.

In addition to directly configuring offset values, since the `0.11.0` version:
In addition to directly configuring offset values, since the `1.11.0` version:
1. `'regionRight'` | `'regionLeft'`: Used to place at the leftmost or rightmost end of the region.
2. Callback form
```ts
Expand All @@ -188,7 +188,7 @@ In addition to directly configuring offset values, since the `0.11.0` version:

The y-direction offset of the mark content relative to the mark point.

In addition to directly configuring offset values, since the `0.11.0` version:
In addition to directly configuring offset values, since the `1.11.0` version:
1. `'regionTop'` | `'regionBottom'`: Used to place at the topmost or bottommost end of the region.
2. Callback form
```ts
Expand Down
4 changes: 2 additions & 2 deletions docs/assets/option/en/component/marker-common/marker-axis.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The series index associated with the marked data (default is using the first val
The series ID associated with the marked data (default is using the first valid series in the current region).

#${prefix} specifiedDataSeriesIndex(string|number|array)
Since the `0.11.0` version, data processing needs to be associated with series separately. When configured as 'all', it means that all series under the current region are associated.
Since the `1.11.0` version, data processing needs to be associated with series separately. When configured as 'all', it means that all series under the current region are associated.

#${prefix} specifiedDataSeriesId(string|number|array)
Since the `0.11.0` version, data processing needs to be associated with series separately. When configured as 'all', it means that all series under the current region are associated.
Since the `1.11.0` version, data processing needs to be associated with series separately. When configured as 'all', it means that all series under the current region are associated.
6 changes: 3 additions & 3 deletions docs/assets/option/zh/component/mark-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
**注意该属性的使用场景为极坐标系下:**
1. 配合配置 angle,radius 属性,用于标注坐标在(angle, radius)上的数据点

### name(string|number|function)
### areaName(string|number|function)
自`1.11.0`版本开始支持, 可以配置标注点在地图上的地理位置, 以回调的形式通过数据自行计算。

**注意该属性的使用场景为地理坐标系**
Expand Down Expand Up @@ -177,7 +177,7 @@

标注内容相对于标注点的 x 方向偏移量。

除了直接配置偏移量数值外,自`0.11.0` 版本起提供了:
除了直接配置偏移量数值外,自`1.11.0` 版本起提供了:
1. `'regionRight' | 'regionLeft'`: 用于放置在region最左端或最右端。
2. 回调形式
```ts
Expand All @@ -188,7 +188,7 @@

标注内容相对于标注点的 y 方向偏移量。

除了直接配置偏移量数值外,自`0.11.0` 版本起提供了:
除了直接配置偏移量数值外,自`1.11.0` 版本起提供了:
1. `'regionTop' | 'regionBottom'`: 用于放置在region最顶端或最底端。
2. 回调形式
```ts
Expand Down
4 changes: 2 additions & 2 deletions docs/assets/option/zh/component/marker-common/marker-axis.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
被标注数据关联的series ID(默认使用当前region第一个有效series)。

#${prefix} specifiedDataSeriesIndex(string|number|array)
自`0.11.0`版本,数据处理需要单独关联系列, 当配置为'all'时代表关联当前region下所有系列。
自`1.11.0`版本,数据处理需要单独关联系列, 当配置为'all'时代表关联当前region下所有系列。

#${prefix} specifiedDataSeriesId(string|number|array)
自`0.11.0`版本,数据处理需要单独关联系列, 当配置为'all'时代表关联当前region下所有系列。
自`1.11.0`版本,数据处理需要单独关联系列, 当配置为'all'时代表关联当前region下所有系列。
3 changes: 2 additions & 1 deletion packages/vchart/src/component/map-label/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ export class MapLabelComponent extends BaseComponent<IMapLabelSpec> {
if (!this._markerComponents) {
this._markerComponents = this._data?.getLatestData().map((data: Datum, index: number) => {
const cmp = new MarkPoint({
position: undefined
position: undefined,
animation: false // 地图标签使用的是markPoint, 暂不开启动画, 待优化@chensiji
});
if (cmp) {
cmp.name = `${this.name}_marker_${index}`;
Expand Down
6 changes: 3 additions & 3 deletions packages/vchart/src/component/marker/base-marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export abstract class BaseMarker<T extends IMarkerSpec> extends BaseComponent<T>
}

private _getFieldInfoFromSpec(
dim: 'x' | 'y' | 'angle' | 'radius' | 'name',
dim: 'x' | 'y' | 'angle' | 'radius' | 'areaName',
spec: IDataPos | IDataPosCallback,
relativeSeries: IMarkerSupportSeries
) {
Expand All @@ -118,7 +118,7 @@ export abstract class BaseMarker<T extends IMarkerSpec> extends BaseComponent<T>
y: 'yField',
radius: 'valueField',
angle: 'categoryField',
name: 'nameField'
areaName: 'nameField'
};

if (isString(spec) && isAggrSpec(spec)) {
Expand All @@ -132,7 +132,7 @@ export abstract class BaseMarker<T extends IMarkerSpec> extends BaseComponent<T>

protected _processSpecByDims(
dimSpec: {
dim: 'x' | 'y' | 'angle' | 'radius' | 'name';
dim: 'x' | 'y' | 'angle' | 'radius' | 'areaName';
specValue: IDataPos | IDataPosCallback;
}[]
) {
Expand Down
4 changes: 2 additions & 2 deletions packages/vchart/src/component/marker/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export interface IMarkerCrossSeriesSpec {
endRelativeSeriesId?: string;
/**
* 数据处理需要单独关联系列, 当配置为'all'时代表关联当前region下所有系列
* @since 0.11.0
* @since 1.11.0
*/
specifiedDataSeriesIndex?: 'all' | number | number[];
specifiedDataSeriesId?: 'all' | string | string[];
Expand Down Expand Up @@ -279,7 +279,7 @@ export type IMarkerSpec = IComponentSpec & {
/**
* 标注所在的坐标系类型
* @description 一般情况下内部逻辑会根据配置自动推导类型,但如果是coordinates的配置方式,则无法推导,需要用户自行配置
* @since 0.11.0
* @since 1.11.0
*/
coordinateType?: string;
};
Expand Down
18 changes: 9 additions & 9 deletions packages/vchart/src/component/marker/mark-area/interface/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type IMarkAreaSpec = IMarkerSpec &
IMarkAreaTheme &
/**
* 动画配置
* @since 0.11.0
* @since 1.11.0
*/
BaseMarkerAnimation<CommonMarkAreaAnimationType>; // 标注目标:任意位置

Expand Down Expand Up @@ -78,48 +78,48 @@ export interface IMarkAreaXYSpec extends IMarkerCrossSeriesSpec {
export interface IMarkAreaAngleSpec extends IMarkerCrossSeriesSpec {
/**
* 极坐标系下, angle 轴上位置,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle: IDataPos | IDataPosCallback;
/**
* 极坐标系下, angle 轴上位置,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle1: IDataPos | IDataPosCallback;
}

export interface IMarkAreaRadiusSpec extends IMarkerCrossSeriesSpec {
/**
* 极坐标系下, radius 轴上位置, 或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius: IDataPos | IDataPosCallback;
/**
* 极坐标系下, radius 轴上位置, 或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius1: IDataPos | IDataPosCallback;
}

export interface IMarkAreaAngleRadiusSpec extends IMarkerCrossSeriesSpec {
/**
* 极坐标系下, angle 轴上位置,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle: IDataPos | IDataPosCallback;
/**
* 极坐标系下, angle 轴上位置,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle1: IDataPos | IDataPosCallback;
/**
* 极坐标系下, radius 轴上位置, 或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius: IDataPos | IDataPosCallback;
/**
* 极坐标系下, radius 轴上位置, 或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius1: IDataPos | IDataPosCallback;
}
Expand Down
26 changes: 13 additions & 13 deletions packages/vchart/src/component/marker/mark-line/interface/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type IMarkLineSpec =
IMarkLineTheme &
/**
* 动画配置
* @since 0.11.0
* @since 1.11.0
*/
BaseMarkerAnimation<MarkCommonLineAnimationType>)
| (IStepMarkLineSpec & BaseMarkerAnimation<MarkCommonLineAnimationType>); // 标注目标:任意位置
Expand Down Expand Up @@ -135,74 +135,74 @@ export interface IMarkLineXYSpec extends IMarkerCrossSeriesSpec {
export interface IMarkLineAngleSpec extends IMarkerCrossSeriesSpec {
/**
* 极坐标系下, 参考线在 angle 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle: IDataPos | IDataPosCallback;
}

export interface IMarkLineRadiusSpec extends IMarkerCrossSeriesSpec {
/**
* 极坐标系下, 参考线在 radius 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius: IDataPos | IDataPosCallback;
}

export interface IMarkLineAngRadRad1Spec extends IMarkerCrossSeriesSpec {
/**
* 极坐标系下, 参考线在 angle 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle: IDataPos | IDataPosCallback;
/**
* 极坐标系下, 参考线在 radius 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius: IDataPos | IDataPosCallback;
/**
* 极坐标系下, 参考线在 radius 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius1: IDataPos | IDataPosCallback;
}

export interface IMarkLineRadAngAng1Spec extends IMarkerCrossSeriesSpec {
/**
* 极坐标系下, 参考线在 angle 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle: IDataPos | IDataPosCallback;
/**
* 极坐标系下, 参考线在 angle 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle1: IDataPos | IDataPosCallback;
/**
* 极坐标系下, 参考线在 radius 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius: IDataPos | IDataPosCallback;
}

export interface IMarkLineAngRadSpec extends IMarkerCrossSeriesSpec {
/**
* 极坐标系下, 参考线在 angle 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle: IDataPos | IDataPosCallback;
/**
* 极坐标系下, 参考线在 angle 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle1: IDataPos | IDataPosCallback;
/**
* 极坐标系下, 参考线在 radius 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius: IDataPos | IDataPosCallback;
/**
* 极坐标系下, 参考线在 radius 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius1: IDataPos | IDataPosCallback;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class GeoMarkPoint extends BaseMarkPoint {

protected _computeOptions(): any {
const spec = this._spec as any;
const options = [this._processSpecByDims([{ dim: 'name', specValue: spec.name }])];
const options = [this._processSpecByDims([{ dim: 'areaName', specValue: spec.areaName }])];
return { options };
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export type IMarkPointSpec = IMarkerSpec &
// 标注目标: 笛卡尔坐标系
(| IMarkPointXYSpec
/** 标注目标: 极坐标系
* @since 0.11.0
* @since 1.11.0
*/
| IMarkPointAngleRadiusSpec
/** 标注目标: 地理坐标系
* @since 0.11.0
* @since 1.11.0
*/
| IMarkPointGeoNameSpec
// 标注目标:数据元素
Expand All @@ -31,7 +31,7 @@ export type IMarkPointSpec = IMarkerSpec &
IMarkPointTheme<IMarkerSymbol> &
/**
* 动画配置
* @since 0.11.0
* @since 1.11.0
*/
BaseMarkerAnimation<MarkPointAnimationType>;

Expand All @@ -51,22 +51,22 @@ export type IMarkPointXYSpec = {
export type IMarkPointAngleRadiusSpec = {
/**
* 极坐标系下, angle 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
angle: IDataPos | IDataPosCallback;
/**
* 极坐标系下, radius 轴上位置,可以配置参考线在 angle 轴上的值,或者聚合计算类型,或者以回调的形式通过数据自行计算。
* @since 0.11.0
* @since 1.11.0
*/
radius: IDataPos | IDataPosCallback;
};

export type IMarkPointGeoNameSpec = {
/**
* 地理坐标系下, 地理区域的名称。
* @since 0.11.0
* @since 1.11.0
*/
name: string | IDataPosCallback;
areaName: string | IDataPosCallback;
};

export type IMarkPointCoordinateSpec = {
Expand Down
Loading
0