apache / apache/echarts

[Bug] The slider mode dataZoom should clip the background by the borderRadius property

Open Beginner friendly
#21,231 0 comments 0 reactions 0 assignees View on GitHub
bug en
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

6.0.0

### Link to Minimal Reproduction

N/A

### Steps to Reproduce

- Create a chart with a slider dataZoom.
- Specify a backgroundColor for the dataZoom
- Specify a borderRadius for the dataZoom

### Current Behavior

The background extends beyond the defined border radius.

### Expected Behavior

The background should not extend beyond the defined borderRadius.

### Environment

```markdown
- OS:
- Browser:
- Framework:
```

### Any additional comments?

Fixing this issue is trivial.

The current code:

```
SliderZoomView.prototype._renderBackground = function () {
var dataZoomModel = this.dataZoomModel;
var size = this._size;
var barGroup = this._displayables.sliderGroup;
var brushSelect = dataZoomModel.get('brushSelect');
barGroup.add(new Rect$2({
silent: true,
shape: {
x: 0,
y: 0,
width: size[0],
height: size[1]
},
style: {
fill: dataZoomModel.get('backgroundColor')
},
z2: -40
}));
```

Results in this:

Image

Changing it to:

```
SliderZoomView.prototype._renderBackground = function () {
var dataZoomModel = this.dataZoomModel;
var size = this._size;
var barGroup = this._displayables.sliderGroup;
var brushSelect = dataZoomModel.get('brushSelect');
var borderRadius = dataZoomModel.get('borderRadius');
barGroup.add(new Rect$2({
silent: true,
shape: {
x: 0,
y: 0,
width: size[0],
height: size[1],
r: borderRadius
},
style: {
fill: dataZoomModel.get('backgroundColor')
},
z2: -40
}));
```

Results in a properly clipped rectange:

Image

Contributor guide

Open the contributing guide

Research direction

Start at SliderZoomView.prototype._renderBackground and inspect how the slider dataZoom background rectangle is created with Rect$2. Verify how borderRadius is obtained from the dataZoom model, then confirm that the background remains clipped to the rounded shape when backgroundColor and borderRadius are specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.