echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] xAxis type time, showMinLabel=false not work

Open MeetzhDing opened this issue 3 years ago • 3 comments

Version

5.3.2

Link to Minimal Reproduction

No response

Steps to Reproduce

var option;

let base = +new Date(1988, 9, 3);
let oneDay = 24 * 3600 * 1000;
let data = [[base, Math.random() * 50]];
for (let i = 1; i < 20000; i++) {
  let now = new Date((base += oneDay));
  data.push([+now, Math.round((Math.random() - 0.5) * 20 + data[i - 1][1])]);
}

const baseOption = {
  grid: {
    left: 5,
    containLabel: true,
  },
  tooltip: {
    trigger: 'axis',
    appendToBody: true,
    position: function (pt) {
      return [pt[0], '10%'];
    },
  },
  xAxis: {
    type: 'time',
    boundaryGap: false,

    axisLabel: {
      showMinLabel: false,
      showMaxLabel: false,
      hideOverlap: true,
      // formatter: null,
    },
  },
  yAxis: {
    type: 'value',
    boundaryGap: [0, '100%'],
  },
};

option = ({
  ...baseOption,
  series: [
    {
      name: 'Series1',
      type: 'line',
      smooth: false,
      symbol: 'circle', //'none',
      symbolSize: 7,
      lineStyle: {
        width: 1,
      },
      data: data.slice(0, 10),
      stack: 'Total',
    },
  ],
})

Current Behavior

image

Expected Behavior

hide min label when xAxis type is time

Environment

- OS: MacOS
- Browser: Chrome 100
- Framework: any

Any additional comments?

No response

MeetzhDing avatar Apr 14 '22 12:04 MeetzhDing

image

https://github.com/apache/echarts/blob/b2168d5f3d91d2e444c69d88ba28c24565a749fc/src/scale/Time.ts#L158-L179

extent[0] === startTime === innerTicks[0]

As a consequence, ticks is [extend[0], extend[0], ......., extend[1] ]

maybe we can delete innerTicks[0] when it equals to extend[0] ?

MeetzhDing avatar Apr 14 '22 14:04 MeetzhDing

https://github.com/apache/echarts/blob/3961cefc0329cfa8782602fc2aea46cc76c3f50e/src/scale/Time.ts#L630-L632

Or change line 631 like this

return tick.value > extent[0] && tick.value < extent[1] && !tick.notAdd;

@pissang

MeetzhDing avatar Apr 24 '22 03:04 MeetzhDing

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] avatar Apr 23 '24 21:04 github-actions[bot]

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

github-actions[bot] avatar Apr 30 '24 21:04 github-actions[bot]