Ovilia commented on code in PR #21081:
URL: https://github.com/apache/echarts/pull/21081#discussion_r2218113386
##########
src/chart/radar/RadarView.ts:
##########
@@ -215,53 +215,84 @@ class RadarView extends ChartView {
polygon.useStyle(
zrUtil.defaults(
- areaStyleModel.getAreaStyle(),
- {
- fill: color,
- opacity: 0.7,
- decal: itemStyle.decal
+ itemModel.getModel('areaStyle').getAreaStyle(),
Review Comment:
Any reason to use `itemModel.getModel('areaStyle').getAreaStyle()` instead
of `areaStyleModel.getAreaStyle()`?
##########
src/chart/radar/RadarView.ts:
##########
@@ -215,53 +215,84 @@ class RadarView extends ChartView {
polygon.useStyle(
zrUtil.defaults(
- areaStyleModel.getAreaStyle(),
- {
- fill: color,
- opacity: 0.7,
- decal: itemStyle.decal
+ itemModel.getModel('areaStyle').getAreaStyle(),
+ {
+ fill: color,
+ decal: itemStyle.decal
}
)
);
- const emphasisModel = itemModel.getModel('emphasis');
- const itemHoverStyle =
emphasisModel.getModel('itemStyle').getItemStyle();
- symbolGroup.eachChild(function (symbolPath: RadarSymbol) {
+
+ symbolGroup.eachChild((symbolPath: RadarSymbol) => {
if (symbolPath instanceof ZRImage) {
- const pathStyle = symbolPath.style;
- symbolPath.useStyle(zrUtil.extend({
- // TODO other properties like x, y ?
- image: pathStyle.image,
- x: pathStyle.x, y: pathStyle.y,
- width: pathStyle.width, height: pathStyle.height
- }, itemStyle));
+ const ps = symbolPath.style
Review Comment:
Don't change the indent.
##########
src/chart/radar/RadarView.ts:
##########
@@ -215,53 +215,84 @@ class RadarView extends ChartView {
polygon.useStyle(
zrUtil.defaults(
- areaStyleModel.getAreaStyle(),
- {
- fill: color,
- opacity: 0.7,
- decal: itemStyle.decal
+ itemModel.getModel('areaStyle').getAreaStyle(),
+ {
Review Comment:
Please fix the lint problems.
##########
src/chart/radar/RadarView.ts:
##########
@@ -215,53 +215,84 @@ class RadarView extends ChartView {
polygon.useStyle(
zrUtil.defaults(
- areaStyleModel.getAreaStyle(),
- {
- fill: color,
- opacity: 0.7,
- decal: itemStyle.decal
+ itemModel.getModel('areaStyle').getAreaStyle(),
+ {
+ fill: color,
+ decal: itemStyle.decal
}
)
);
- const emphasisModel = itemModel.getModel('emphasis');
- const itemHoverStyle =
emphasisModel.getModel('itemStyle').getItemStyle();
- symbolGroup.eachChild(function (symbolPath: RadarSymbol) {
+
+ symbolGroup.eachChild((symbolPath: RadarSymbol) => {
Review Comment:
Don't make unnecessary changes. It makes it hard to review.
##########
src/chart/radar/RadarView.ts:
##########
@@ -215,53 +215,84 @@ class RadarView extends ChartView {
polygon.useStyle(
zrUtil.defaults(
- areaStyleModel.getAreaStyle(),
- {
- fill: color,
- opacity: 0.7,
- decal: itemStyle.decal
+ itemModel.getModel('areaStyle').getAreaStyle(),
+ {
+ fill: color,
+ decal: itemStyle.decal
}
)
);
- const emphasisModel = itemModel.getModel('emphasis');
- const itemHoverStyle =
emphasisModel.getModel('itemStyle').getItemStyle();
- symbolGroup.eachChild(function (symbolPath: RadarSymbol) {
+
+ symbolGroup.eachChild((symbolPath: RadarSymbol) => {
if (symbolPath instanceof ZRImage) {
- const pathStyle = symbolPath.style;
- symbolPath.useStyle(zrUtil.extend({
- // TODO other properties like x, y ?
- image: pathStyle.image,
- x: pathStyle.x, y: pathStyle.y,
- width: pathStyle.width, height: pathStyle.height
- }, itemStyle));
+ const ps = symbolPath.style
+
+ symbolPath.useStyle(
+ zrUtil.extend(
+ {
+ image: ps.image,
+ x: ps.x,
+ y: ps.y,
+ width: ps.width,
+ height: ps.height,
+ },
+ itemStyle,
+ ),
+ )
+ } else {
+ symbolPath.useStyle(itemStyle)
+ symbolPath.setColor(color)
+ symbolPath.style.strokeNoScale = true
}
- else {
- symbolPath.useStyle(itemStyle);
- symbolPath.setColor(color);
- symbolPath.style.strokeNoScale = true;
+
+ const emphasisModel = itemModel.getModel('emphasis')
+
+ const hoverStyle =
emphasisModel.getModel('itemStyle').getItemStyle()
+
+ symbolPath.ensureState('emphasis').style =
zrUtil.clone(hoverStyle)
+
+ let txt =
data.getStore().get(data.getDimensionIndex(symbolPath.__dimIdx), idx)
+
+ if (txt == null || isNaN(txt as number)) {
+ txt = ''
}
-
- const pathEmphasisState = symbolPath.ensureState('emphasis');
- pathEmphasisState.style = zrUtil.clone(itemHoverStyle);
- let defaultText =
data.getStore().get(data.getDimensionIndex(symbolPath.__dimIdx), idx);
- (defaultText == null || isNaN(defaultText as number)) &&
(defaultText = '');
-
- setLabelStyle(
- symbolPath, getLabelStatesModels(itemModel),
- {
- labelFetcher: data.hostModel,
- labelDataIndex: idx,
- labelDimIndex: symbolPath.__dimIdx,
- defaultText: defaultText as string,
- inheritColor: color as ColorString,
- defaultOpacity: itemStyle.opacity
- }
- );
- });
-
- toggleHoverEmphasis(
- itemGroup, emphasisModel.get('focus'),
emphasisModel.get('blurScope'), emphasisModel.get('disabled')
- );
+
+ setLabelStyle(symbolPath, getLabelStatesModels(itemModel), {
+ labelFetcher: data.hostModel,
+ labelDataIndex: idx,
+ labelDimIndex: symbolPath.__dimIdx,
+ defaultText: txt as string,
+ inheritColor: color,
+ defaultOpacity: itemStyle.opacity,
+ })
+ })
+
+ function applyStateOpacity(state: 'emphasis' | 'select' |
'blur') {
Review Comment:
`opacity` doesn't seem need to have special operation. This seems to be a
wrong approach.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]