Skip to content
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

fix(radar): name being - in tooltip when name.show is false #15915 #15985

Merged
merged 5 commits into from
Jan 13, 2022
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: 4 additions & 0 deletions src/component/radar/RadarView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ class RadarView extends ComponentView {
const radar = radarModel.coordinateSystem;
const indicatorAxes = radar.getIndicatorAxes();
const axisBuilders = zrUtil.map(indicatorAxes, function (indicatorAxis) {
const axisName = indicatorAxis.model.get('showName')
? indicatorAxis.name
: ''; // hide name
const axisBuilder = new AxisBuilder(indicatorAxis.model, {
axisName: axisName,
position: [radar.cx, radar.cy],
rotation: indicatorAxis.angle,
labelDirection: -1,
Expand Down
8 changes: 5 additions & 3 deletions src/coord/radar/RadarModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ function defaultsShow(opt: object, show: boolean) {

export interface RadarIndicatorOption {
name?: string
/**
* @deprecated Use `name` instead.
*/
text?: string
min?: number
max?: number
Expand Down Expand Up @@ -88,6 +91,7 @@ export interface RadarOption extends ComponentOption, CircleLayoutOptionMixin {
export type InnerIndicatorAxisOption = AxisBaseOption & {
// TODO Use type?
// axisType?: 'value' | 'log'
showName?: boolean
};

class RadarModel extends ComponentModel<RadarOption> implements CoordinateSystemHostModel {
Expand Down Expand Up @@ -137,15 +141,13 @@ class RadarModel extends ComponentModel<RadarOption> implements CoordinateSystem
axisLabel: axisLabel,
// Compatible with 2 and use text
name: indicatorOpt.text,
showName: showName,
nameLocation: 'end',
nameGap: nameGap,
// min: 0,
nameTextStyle: iNameTextStyle,
triggerEvent: triggerEvent
} as InnerIndicatorAxisOption, false);
if (!showName) {
innerIndicatorOpt.name = '';
}
if (typeof nameFormatter === 'string') {
const indName = innerIndicatorOpt.name;
innerIndicatorOpt.name = nameFormatter.replace('{value}', indName != null ? indName : '');
Expand Down
7 changes: 7 additions & 0 deletions src/preprocessor/helper/compatStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,13 @@ export default function globalCompatStyle(option: any, isTheme?: boolean) {
deprecateLog('nameGap property in radar component has been changed to axisNameGap');
}
}
if (__DEV__) {
each(radarOpt.indicator, function (indicatorOpt: any) {
if (indicatorOpt.text) {
deprecateReplaceLog('text', 'name', 'radar.indicator');
}
});
}
});

each(toArr(option.geo), function (geoOpt) {
Expand Down
21 changes: 15 additions & 6 deletions test/radar3.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.