echarts icon indicating copy to clipboard operation
echarts copied to clipboard

feat: the value axis range should be designed to accommodate marker

Open linlang171 opened this issue 2 months ago • 8 comments

Brief Information

This pull request is in the type of:

  • [ ] bug fixing
  • [x] new feature
  • [ ] others

fix issue

Fixes #21203

What does this PR do?

When markers such as marker line, marker pointer, and marker area exceed the default axis range, they will be discarded directly. When the user set the includeMarkerInExtent of the axis to true, the default axis range will take into account the marker value

Details

Before: What was the problem?

{
             title: {
                text: '主标题',
                subtext: '副标题',
                left: 'center',
                top: 'top',
                textAlign: 'center',
                textVerticalAlign: 'top'
            },
            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
             series: [{
                    data: [150, 230, 224, 218, 135, 147, 260],
                    type: 'line',
                    markLine: {
                        data: [
                            {
                                name: '两个屏幕坐标之间的标线',
                                yAxis: 467,
                                lineStyle: { color: 'red' }
                            }
                        ]
                    }
            }]
}

When markers such as marker line, marker pointer, and marker area exceed the default axis range, they will be discarded directly.

image

After: How does it behave after the fixing?

When the user set the includeMarkerInExtent of the axis to true, the axis range will take into account the marker value

image

Document Info

One of the following should be checked.

  • [ ] This PR doesn't relate to document changes
  • [ ] The document should be updated later
  • [x] The document changes have been made in apache/echarts-doc#481

Misc

ZRender Changes

  • [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

  • [x] Please squash the commits into a single one when merging.

Other information

linlang171 avatar Oct 14 '25 12:10 linlang171

Thanks for your contribution! The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

echarts-bot[bot] avatar Oct 14 '25 12:10 echarts-bot[bot]

Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the PR: awaiting doc label.

echarts-bot[bot] avatar Oct 15 '25 09:10 echarts-bot[bot]

I think we should probably introduce a new option for this behavior.

I have added a new configuration item, includeMarkerInExtent, in the axis configuration to control whether marker labels are considered when calculating the default axis range. Could you please review if this is reasonable? Thank you very much

linlang171 avatar Oct 15 '25 09:10 linlang171

@linlang171, I appreciate you letting me know about this PR. It would definitely help fix #21203. I agree that all marks (lines, points, areas) are an integral part of their series and should be visible by default. If the user wants to "hide" some of them, he could set axis range with min/max.

helgasoft avatar Oct 16 '25 04:10 helgasoft

@100pah Could you help me review this pull request?

linlang171 avatar Oct 20 '25 01:10 linlang171

@Ovilia Could you help push this PR forward? I think it would be beneficial in some scenarios

linlang171 avatar Nov 10 '25 01:11 linlang171

@100pah Could you help me review this pull request?

linlang171 avatar Nov 25 '25 11:11 linlang171

@Ovilia @100pah Could you help push this PR forward?

linlang171 avatar Dec 08 '25 01:12 linlang171

@Ovilia @100pah Could you help review this PR?

linlang171 avatar Dec 15 '25 09:12 linlang171